Wed Apr 12 07:42:47 PDT 2006 Simon Marlow <[EMAIL PROTECTED]>
* Fix a bug in optimising division to shift right
Division by an integral log2 can't be directly optimised to a shift
right, because shift right behaves like a division that rounds to
negative infinity, whereas we want one that rounds to zero. Fix this
by adding (divisor-1) to the dividend when it is negative before
shifting. We do this without jumps, generating very slightly worse
code than gcc, which uses conditional moves on CPUs that support it.
M ./compiler/cmm/CmmOpt.hs -7 +30
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc