diff options
-rw-r--r-- | compiler/GHC/CmmToAsm/PPC/Ppr.hs | 14 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/Ppr.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/Ppr.hs | 17 |
3 files changed, 9 insertions, 27 deletions
diff --git a/compiler/GHC/CmmToAsm/PPC/Ppr.hs b/compiler/GHC/CmmToAsm/PPC/Ppr.hs index bb8d412f52..eef37f0db7 100644 --- a/compiler/GHC/CmmToAsm/PPC/Ppr.hs +++ b/compiler/GHC/CmmToAsm/PPC/Ppr.hs @@ -238,9 +238,8 @@ pprImm (ImmInteger i) = integer i pprImm (ImmCLbl l) = ppr l pprImm (ImmIndex l i) = ppr l <> char '+' <> int i pprImm (ImmLit s) = s - -pprImm (ImmFloat _) = text "naughty float immediate" -pprImm (ImmDouble _) = text "naughty double immediate" +pprImm (ImmFloat f) = float $ fromRational f +pprImm (ImmDouble d) = double $ fromRational d pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b pprImm (ImmConstantDiff a b) = pprImm a <> char '-' @@ -338,13 +337,8 @@ pprDataItem platform lit <> int (fromIntegral (fromIntegral x :: Word32))] - ppr_item FF32 (CmmFloat r _) - = let bs = floatToBytes (fromRational r) - in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs - - ppr_item FF64 (CmmFloat r _) - = let bs = doubleToBytes (fromRational r) - in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs + ppr_item FF32 _ = [text "\t.float\t" <> pprImm imm] + ppr_item FF64 _ = [text "\t.double\t" <> pprImm imm] ppr_item _ _ = panic "PPC.Ppr.pprDataItem: no match" diff --git a/compiler/GHC/CmmToAsm/Ppr.hs b/compiler/GHC/CmmToAsm/Ppr.hs index 405bab9fff..9c8a19cee7 100644 --- a/compiler/GHC/CmmToAsm/Ppr.hs +++ b/compiler/GHC/CmmToAsm/Ppr.hs @@ -9,8 +9,6 @@ ----------------------------------------------------------------------------- module GHC.CmmToAsm.Ppr ( - castFloatToWord8Array, - castDoubleToWord8Array, floatToBytes, doubleToBytes, pprASCII, @@ -43,8 +41,6 @@ import qualified Data.ByteString as BS import GHC.Exts import GHC.Word - - -- ----------------------------------------------------------------------------- -- Converting floating-point literals to integrals for printing @@ -92,6 +88,7 @@ doubleToBytes d return (map fromIntegral [i0,i1,i2,i3,i4,i5,i6,i7]) ) + -- --------------------------------------------------------------------------- -- Printing ASCII strings. -- diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs index 49e4de8ad5..942e7a0858 100644 --- a/compiler/GHC/CmmToAsm/X86/Ppr.hs +++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs @@ -426,9 +426,8 @@ pprImm (ImmInteger i) = integer i pprImm (ImmCLbl l) = ppr l pprImm (ImmIndex l i) = ppr l <> char '+' <> int i pprImm (ImmLit s) = s - -pprImm (ImmFloat _) = text "naughty float immediate" -pprImm (ImmDouble _) = text "naughty double immediate" +pprImm (ImmFloat f) = float $ fromRational f +pprImm (ImmDouble d) = double $ fromRational d pprImm (ImmConstantSum a b) = pprImm a <> char '+' <> pprImm b pprImm (ImmConstantDiff a b) = pprImm a <> char '-' @@ -517,13 +516,8 @@ pprDataItem config lit ppr_item II16 _ = [text "\t.word\t" <> pprImm imm] ppr_item II32 _ = [text "\t.long\t" <> pprImm imm] - ppr_item FF32 (CmmFloat r _) - = let bs = floatToBytes (fromRational r) - in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs - - ppr_item FF64 (CmmFloat r _) - = let bs = doubleToBytes (fromRational r) - in map (\b -> text "\t.byte\t" <> pprImm (ImmInt b)) bs + ppr_item FF32 _ = [text "\t.float\t" <> pprImm imm] + ppr_item FF64 _ = [text "\t.double\t" <> pprImm imm] ppr_item II64 _ = case platformOS platform of @@ -561,9 +555,6 @@ pprDataItem config lit _ -> [text "\t.quad\t" <> pprImm imm] - ppr_item _ _ - = panic "X86.Ppr.ppr_item: no match" - asmComment :: SDoc -> SDoc asmComment c = whenPprDebug $ text "# " <> c |