[commit: ghc] ghc-8.0: PPC NCG: Emit more portable `fcmpu 0, ...` instead of `fcmpu cr0, ...` (fd139fc)

git at git.haskell.org git at git.haskell.org
Mon Mar 21 21:43:16 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/fd139fc1dde482b8363053d4a6a3fd3e0cef3364/ghc

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

commit fd139fc1dde482b8363053d4a6a3fd3e0cef3364
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.
    
    (cherry picked from commit 6f0e41da96b79cde49ad8761738c281cd190ac65)


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

fd139fc1dde482b8363053d4a6a3fd3e0cef3364
 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