[GHC] #9786: Make quot/rem/div/mod with known divisors fast

GHC ghc-devs at haskell.org
Tue Nov 11 06:13:08 UTC 2014


#9786: Make quot/rem/div/mod with known divisors fast
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  task        |           Status:  new
              Priority:  normal      |        Milestone:  7.12.1
             Component:  Compiler    |          Version:  7.9
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Runtime     |       Blocked By:
  performance bug                    |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 The more I think about it, the more likely it seems that we should
 `NOINLINE` `divMod` and `quotRem` until very, very late, or maybe never
 inline them. There are two reasons for this:

 1. We would prefer to snag them unmodified when we recognize known
 divisors.

 2. As described in #9617, it would be very nice to use CSE to merge `div`
 with `mod` and `quot` with `rem` automatically.

 The major complication, of course, is that in the case of an ''unknown''
 divisor that is used multiple times, we'd like to avoid repeating the sign
 test. I still have no clear sense of how to resolve the tension between
 these desires.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9786#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list