From 6ea62427de419ea071e1ea79ad0c15d9f4e90a67 Mon Sep 17 00:00:00 2001 From: Takano Akio Date: Sun, 4 Sep 2016 13:22:22 -0400 Subject: 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 --- libraries/ghc-prim/GHC/Classes.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libraries') 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 -- cgit v1.2.1