[commit: ghc] master: PPC NCG: Emit more portable `fcmpu 0, ...` instead of `fcmpu cr0, ...` (6f0e41d)

git at git.haskell.org git at git.haskell.org
Mon Mar 21 21:41:59 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6f0e41da96b79cde49ad8761738c281cd190ac65/ghc

>---------------------------------------------------------------

commit 6f0e41da96b79cde49ad8761738c281cd190ac65
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Mon Mar 21 11:30:03 2016 +0100

    PPC NCG: Emit more portable `fcmpu 0, ...` instead of `fcmpu cr0, ...`
    
    Use `fcmpu 0, ...` rather than `fcmpu cr0, ...` for better
    portability since some non-GNU assembler (such as IBM's `as`) tend to not
    support the symbolic register name `cr0`. This matches the syntax that
    GCC emits for PPC targets.


>---------------------------------------------------------------

6f0e41da96b79cde49ad8761738c281cd190ac65
 compiler/nativeGen/PPC/Ppr.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
index 08c02f0..9326813 100644
--- a/compiler/nativeGen/PPC/Ppr.hs
+++ b/compiler/nativeGen/PPC/Ppr.hs
@@ -764,10 +764,14 @@ pprInstr (FNEG reg1 reg2) = pprUnary (sLit "fneg") reg1 reg2
 
 pprInstr (FCMP reg1 reg2) = hcat [
         char '\t',
-        text "fcmpu\tcr0, ",
+        text "fcmpu\t0, ",
             -- Note: we're using fcmpu, not fcmpo
             -- The difference is with fcmpo, compare with NaN is an invalid operation.
-            -- We don't handle invalid fp ops, so we don't care
+            -- We don't handle invalid fp ops, so we don't care.
+            -- Morever, we use `fcmpu 0, ...` rather than `fcmpu cr0, ...` for
+            -- better portability since some non-GNU assembler (such as
+            -- IBM's `as`) tend not to support the symbolic register name cr0.
+            -- This matches the syntax that GCC seems to emit for PPC targets.
         pprReg reg1,
         text ", ",
         pprReg reg2



More information about the ghc-commits mailing list