patch applied (ghc): Fix truncate on amd64 NCG; fixes arith005.
Simon Marlow
simonmarhaskell at gmail.com
Mon May 7 03:58:33 EDT 2007
Ian Lynagh wrote:
> Thu May 3 15:38:33 PDT 2007 Ian Lynagh <igloo at earth.li>
> * Fix truncate on amd64 NCG; fixes arith005.
> cvts[sd]2siq? ->
> cvtts[sd]2siq?
>
> M ./compiler/nativeGen/MachCodeGen.hs -1 +3
> M ./compiler/nativeGen/MachInstrs.hs -2 +2
> M ./compiler/nativeGen/PprMach.hs -6 +6
> M ./compiler/nativeGen/RegAllocInfo.hs -4 +4
Something still looks odd here. We have a RULE in GHC/Float.hs mapping truncate
on Float->Int to the float2Int# primop (similarly for Double), which means that
either float2Int# should have truncating semantics, or the RULE is wrong. Looks
like you fixed the primop to have truncating semantics for the x86_64 NCG, but
it looks it still has rounding semantics for other platforms: the x86 NCG uses
fistpl, which rounds by default, and when going via C we use a cast, which also
rounds.
Who is right? I'd have thought the primop should round by default, but then the
RULE is wrong.
Cheers,
Simon
More information about the Cvs-ghc
mailing list