[Git][ghc/ghc][wip/supersven/riscv64-ncg] Fix float NE: Needed width

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Wed Dec 6 20:49:43 UTC 2023



Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC


Commits:
467ae53a by Sven Tennie at 2023-12-06T21:49:14+01:00
Fix float NE: Needed width

- - - - -


1 changed file:

- compiler/GHC/CmmToAsm/RV64/Ppr.hs


Changes:

=====================================
compiler/GHC/CmmToAsm/RV64/Ppr.hs
=====================================
@@ -584,7 +584,8 @@ pprInstr platform instr = case instr of
                   , text "\tsnez" <+> pprOp platform o <> comma <+> pprOp platform o]
     --    feq.s   a0,fa0,fa1
     --    xori    a0,a0,1
-    NE | isFloatOp l && isFloatOp r -> lines_ [binOp "\tfeq.s", text "\txori" <+>  pprOp platform o <> comma <+> pprOp platform o <> comma <+> text "1"]
+    NE | isFloatOp l && isFloatOp r -> lines_ [binOp ("\tfeq." ++ floatOpPrecision platform l r)
+                                              , text "\txori" <+>  pprOp platform o <> comma <+> pprOp platform o <> comma <+> text "1"]
     SLT -> lines_ [ sltFor l r <+> pprOp platform o <> comma <+> pprOp platform l <> comma <+> pprOp platform r ]
     SLE -> lines_ [ sltFor l r <+> pprOp platform o <> comma <+> pprOp platform r <> comma <+> pprOp platform l
                   , text "\txori" <+>  pprOp platform o <> comma <+> pprOp platform o <> comma <+> text "1" ]
@@ -717,8 +718,8 @@ pprInstr platform instr = case instr of
        pprDmbType DmbReadWrite = text "rw"
 
 floatOpPrecision :: Platform -> Operand -> Operand -> String
-floatOpPrecision p l r | isFloatOp l && isFloatOp r && isSingleOp l && isSingleOp r = "s" -- single precision
-floatOpPrecision p l r | isFloatOp l && isFloatOp r && isDoubleOp l && isDoubleOp r = "d" -- double precision
+floatOpPrecision _p l r | isFloatOp l && isFloatOp r && isSingleOp l && isSingleOp r = "s" -- single precision
+floatOpPrecision _p l r | isFloatOp l && isFloatOp r && isDoubleOp l && isDoubleOp r = "d" -- double precision
 floatOpPrecision p l r = pprPanic "Cannot determine floating point precission" (text "op1" <+> pprOp p l <+> text "op2" <+> pprOp p r)
 
 pprBcond :: IsLine doc => Cond -> doc



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/467ae53a3a4681f87ea51fcbf06339ddde745a15

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/467ae53a3a4681f87ea51fcbf06339ddde745a15
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231206/53fbb51e/attachment-0001.html>


More information about the ghc-commits mailing list