#3065: Reorder tests in quot to improve code
--------------------------------------+-------------------------------------
  Reporter:  simonpj                  |          Owner:                  
      Type:  bug                      |         Status:  new             
  Priority:  normal                   |      Milestone:  6.12 branch     
 Component:  libraries/base           |        Version:  6.10.1          
Resolution:                           |       Keywords:                  
Difficulty:  Unknown                  |             Os:  Unknown/Multiple
  Testcase:                           |   Architecture:  Unknown/Multiple
   Failure:  Runtime performance bug  |  
--------------------------------------+-------------------------------------
Comment (by rl):

 Doh. Your program prints -2147483648 with -O2 (which is what I tried) but
 that's only because of gcc's constant folding. You are right that it traps
 if it doesn't see the constants. I thought it handled this differently,
 sorry for the confusion.

 However, that doesn't really change my opinion. If x86 doesn't have a
 64-bit div instruction, then I think that having the NCG insert the
 necessary test when generating code for `quotInt#` or a calling a 64-bit
 div subroutine would result in much better code in the vast majority of
 cases. Exposing the test to GHC really tends to break loop performance. It
 also imposes a performance penalty on signed types smaller than `Int`
 which would work just fine without the test.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3065#comment:8>
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