summaryrefslogtreecommitdiff
path: root/ghc/compiler
diff options
context:
space:
mode:
authorsewardj <unknown>2000-01-25 10:23:34 +0000
committersewardj <unknown>2000-01-25 10:23:34 +0000
commit88f6ec6705990205ff66395fc16ae022e8403455 (patch)
treec061642ba6e826ae16f245394c2cb9cacb2ff5e4 /ghc/compiler
parentb539a820b8bef70044bd7f17e013a640d8be06b7 (diff)
downloadhaskell-88f6ec6705990205ff66395fc16ae022e8403455.tar.gz
[project @ 2000-01-25 10:23:34 by sewardj]
Minor improvements to x86 FP fake-to-real insn translation.
Diffstat (limited to 'ghc/compiler')
-rw-r--r--ghc/compiler/nativeGen/PprMach.lhs10
1 files changed, 6 insertions, 4 deletions
diff --git a/ghc/compiler/nativeGen/PprMach.lhs b/ghc/compiler/nativeGen/PprMach.lhs
index 22d74af17e..ac051ee738 100644
--- a/ghc/compiler/nativeGen/PprMach.lhs
+++ b/ghc/compiler/nativeGen/PprMach.lhs
@@ -1006,11 +1006,13 @@ pprInstr (CALL imm)
-- Simulating a flat register set on the x86 FP stack is tricky.
-- you have to free %st(7) before pushing anything on the FP reg stack
-- so as to preclude the possibility of a FP stack overflow exception.
--- ToDo: make gpop into a single instruction, FST
-pprInstr g@(GMOV src dst)
+pprInstr g@(GMOV src dst)
+ | src == dst
+ = empty
+ | otherwise
= pprG g (hcat [gtab, gpush src 0, gsemi, gpop dst 1])
--- GLD sz addr dst ==> FFREE %st(7) ; FLDsz addr ; FXCH (dst+1) ; FINCSTP
+-- GLD sz addr dst ==> FFREE %st(7) ; FLDsz addr ; FSTP (dst+1)
pprInstr g@(GLD sz addr dst)
= pprG g (hcat [gtab, text "ffree %st(7) ; fld", pprSize sz, gsp,
pprAddr addr, gsemi, gpop dst 1])
@@ -1069,7 +1071,7 @@ pprInstr g@(GDIV sz src1 src2 dst)
gpush reg offset
= hcat [text "ffree %st(7) ; fld ", greg reg offset]
gpop reg offset
- = hcat [text "fxch ", greg reg offset, gsemi, text "fincstp"]
+ = hcat [text "fstp ", greg reg offset]
bogus = text "\tbogus"
greg reg offset = text "%st(" <> int (gregno reg - 8+offset) <> char ')'