[Git][ghc/ghc][wip/supersven/riscv64-ncg] Fix MO_FF_CONV

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Mon Nov 6 17:34:48 UTC 2023



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


Commits:
9a68096e by Sven Tennie at 2023-11-06T18:33:45+01:00
Fix MO_FF_CONV

The instruction needs precision suffixes to be valid.

- - - - -


2 changed files:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/RV64/CodeGen.hs
=====================================
@@ -631,7 +631,7 @@ getRegister' config plat expr =
                                                             truncateReg from to dst
                                                           )
         MO_SS_Conv from to -> ss_conv from to reg code
-        MO_FF_Conv from to -> return $ Any (floatFormat to) (\dst -> code `snocOL` FCVT (OpReg to dst) (OpReg from reg))
+        MO_FF_Conv from to -> return $ Any (floatFormat to) (\dst -> code `snocOL` annExpr e (FCVT (OpReg to dst) (OpReg from reg)))
 
         -- Conversions
         MO_XX_Conv _from to -> swizzleRegisterRep (intFormat to) <$> getRegister e


=====================================
compiler/GHC/CmmToAsm/RV64/Ppr.hs
=====================================
@@ -684,7 +684,11 @@ pprInstr platform instr = case instr of
   DMBSY r w -> line $ text "\tfence" <+> pprDmbType r <> char ',' <+> pprDmbType w
 
   -- 9. Floating Point Instructions --------------------------------------------
-  FCVT o1 o2 -> op2 (text "\tfcvt") o1 o2
+  FCVT o1@(OpReg W32 _) o2@(OpReg W64 _) -> op2 (text "\tfcvt.s.d") o1 o2
+  FCVT o1@(OpReg W64 _) o2@(OpReg W32 _) -> op2 (text "\tfcvt.d.s") o1 o2
+  FCVT o1 o2 -> pprPanic "RV64.pprInstr - impossible float conversion" $
+                  line (pprOp platform o1 <> text "->" <> pprOp platform o2)
+
   SCVTF o1@(OpReg W32 _) o2@(OpReg W32 _) -> op2 (text "\tfcvt.s.w") o1 o2
   SCVTF o1@(OpReg W32 _) o2@(OpReg W64 _) -> op2 (text "\tfcvt.s.w") o1 o2
   SCVTF o1@(OpReg W64 _) o2@(OpReg W32 _) -> op2 (text "\tfcvt.d.l") o1 o2



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9a68096e0005855853de2cd3849352067d9b899d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9a68096e0005855853de2cd3849352067d9b899d
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/20231106/51049fd8/attachment-0001.html>


More information about the ghc-commits mailing list