#5615: ghc produces poor code for `div` with constant powers of 2.
-------------------------+--------------------------------------------------
    Reporter:  Lennart   |       Owner:  daniel.is.fischer
        Type:  bug       |      Status:  new              
    Priority:  normal    |   Milestone:  7.6.1            
   Component:  Compiler  |     Version:  7.2.1            
    Keywords:            |          Os:  Unknown/Multiple 
Architecture:  x86       |     Failure:  None/Unknown     
  Difficulty:  Unknown   |    Testcase:                   
   Blockedby:            |    Blocking:                   
     Related:            |  
-------------------------+--------------------------------------------------

Comment(by simonpj):

 The trouble is that, as you can see above `divInt#` has a pretty big
 unfolding, and inlining that at every call site is perhaps overkill.  Mind
 you, if the denominator is constant, at least some of that unfolding is
 dead code.  But there's also a test on the numerator too; `quotInt#` is
 the primop I think (rightly or wrongly).

 I wonder whether this numerator test stuff affects the correctness or
 otherwise of replacing `divInt` with a shift?

 Anyway, adding a RULE woudl be fine I think.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to