[Git][ghc/ghc][wip/supersven/ghc-9.10-riscv-ncg] Fix MO_XX_Conv

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Mon Jun 10 15:04:29 UTC 2024



Sven Tennie pushed to branch wip/supersven/ghc-9.10-riscv-ncg at Glasgow Haskell Compiler / GHC


Commits:
f93e1323 by Sven Tennie at 2024-06-10T15:03:21+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
=====================================
@@ -618,7 +618,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/f93e13239e0805213faf64c90672b14576619d35

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f93e13239e0805213faf64c90672b14576619d35
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/20240610/b86289c9/attachment-0001.html>


More information about the ghc-commits mailing list