Turn divInt# and modInt# into bitwise operations when possible
authorTakano Akio <tak@anoak.io>
Sun, 4 Sep 2016 17:22:22 +0000 (13:22 -0400)
committerBen Gamari <ben@smart-cactus.org>
Mon, 5 Sep 2016 18:58:20 +0000 (14:58 -0400)
commit6ea62427de419ea071e1ea79ad0c15d9f4e90a67
tree370423005b992268abf3b401d445bb48efed39bf
parent71dd6e4429833238bcdaf96da8e2e41a62dacbf4
Turn divInt# and modInt# into bitwise operations when possible

This implements #5615 for divInt# and modInt#.

I also included rules to do constant-folding when the both arguments
are known.

Test Plan: validate

Reviewers: austin, simonmar, bgamari

Reviewed By: bgamari

Subscribers: hvr, thomie

Differential Revision: https://phabricator.haskell.org/D2486

GHC Trac Issues: #5615
compiler/cmm/CmmOpt.hs
compiler/prelude/PrelNames.hs
compiler/prelude/PrelRules.hs
compiler/prelude/primops.txt.pp
compiler/utils/Util.hs
libraries/ghc-prim/GHC/Classes.hs
testsuite/tests/simplCore/should_compile/Makefile
testsuite/tests/simplCore/should_compile/T5615.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T5615.stdout [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T