summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorTakano Akio <tak@anoak.io>2016-09-04 13:22:22 -0400
committerBen Gamari <ben@smart-cactus.org>2016-09-05 14:58:20 -0400
commit6ea62427de419ea071e1ea79ad0c15d9f4e90a67 (patch)
tree370423005b992268abf3b401d445bb48efed39bf /libraries
parent71dd6e4429833238bcdaf96da8e2e41a62dacbf4 (diff)
downloadhaskell-6ea62427de419ea071e1ea79ad0c15d9f4e90a67.tar.gz
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
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index 9c40449188..5fa118a7f6 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -440,6 +440,9 @@ not False = True
-- These don't really belong here, but we don't have a better place to
-- put them
+-- These functions have built-in rules.
+{-# NOINLINE [0] divInt# #-}
+{-# NOINLINE [0] modInt# #-}
divInt# :: Int# -> Int# -> Int#
x# `divInt#` y#
-- Be careful NOT to overflow if we do any additional arithmetic