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

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Wed Jun 12 16:18:18 UTC 2024



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


Commits:
42f544e7 by Sven Tennie at 2024-06-12T10:07:46+00:00
Fix MO_XX_Conv

Conversion to smaller Widths are actually a truncation.

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/RV64/CodeGen.hs
=====================================
@@ -616,7 +616,14 @@ getRegister' config plat expr =
         MO_FF_Conv from to -> return $ Any (floatFormat to) (\dst -> code `snocOL` annExpr e (FCVT (OpReg to dst) (OpReg from reg)))
 
         -- Conversions
+        -- TODO: Duplication with MO_UU_Conv
+        MO_XX_Conv from to | to < from -> pure $ Any (intFormat to) (\dst ->
+                                                                      code `snocOL`
+                                                                      annExpr e (MOV (OpReg from dst) (OpReg from reg)) `appOL`
+                                                                      truncateReg from to dst
+                                                                     )
         MO_XX_Conv _from to -> swizzleRegisterRep (intFormat to) <$> getRegister e
+
         MO_AlignmentCheck align wordWidth -> do
           reg <- getRegister' config plat e
           addAlignmentCheck align wordWidth reg



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/42f544e7670cc533373593b8a9483e762cdfe4f8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/42f544e7670cc533373593b8a9483e762cdfe4f8
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/20240612/dbb7e99c/attachment-0001.html>


More information about the ghc-commits mailing list