X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FPprMach.hs;h=5210940f500d0a527d32d31974620ef2d03fa575;hb=4c6a3f787abcaed009a574196d82237d9ae64fc8;hp=91f9cdf48c3eb208ff9f21cac020680cc7670cc0;hpb=16a2f6a8a381af31c23b6a41a851951da9bc1803;p=ghc-hetmet.git diff --git a/compiler/nativeGen/PprMach.hs b/compiler/nativeGen/PprMach.hs index 91f9cdf..5210940 100644 --- a/compiler/nativeGen/PprMach.hs +++ b/compiler/nativeGen/PprMach.hs @@ -1,3 +1,10 @@ +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + ----------------------------------------------------------------------------- -- -- Pretty-printing assembly language @@ -10,13 +17,6 @@ -- (e.g., 'pprReg'); we conclude with the no-commonality monster, -- 'pprInstr'. -{-# OPTIONS -w #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and fix --- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings --- for details - #include "nativeGen/NCG.h" module PprMach ( @@ -1408,9 +1408,18 @@ pprInstr g@(GLD1 dst) pprInstr g@(GFTOI src dst) = pprInstr (GDTOI src dst) pprInstr g@(GDTOI src dst) - = pprG g (hcat [gtab, text "subl $4, %esp ; ", - gpush src 0, gsemi, text "fistpl 0(%esp) ; popl ", - pprReg I32 dst]) + = pprG g (vcat [ + hcat [gtab, text "subl $8, %esp ; fnstcw 4(%esp)"], + hcat [gtab, gpush src 0], + hcat [gtab, text "movzwl 4(%esp), ", reg, + text " ; orl $0xC00, ", reg], + hcat [gtab, text "movl ", reg, text ", 0(%esp) ; fldcw 0(%esp)"], + hcat [gtab, text "fistpl 0(%esp)"], + hcat [gtab, text "fldcw 4(%esp) ; movl 0(%esp), ", reg], + hcat [gtab, text "addl $8, %esp"] + ]) + where + reg = pprReg I32 dst pprInstr g@(GITOF src dst) = pprInstr (GITOD src dst)