[Git][ghc/ghc][wip/supersven/riscv64-ncg] Fix odd register move reduction

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sat Mar 9 11:40:20 UTC 2024



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


Commits:
46b55bb4 by Sven Tennie at 2024-03-09T12:38:09+01:00
Fix odd register move reduction

Probably, there're OpRegs with wrong format around.

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/RV64/Instr.hs
=====================================
@@ -434,7 +434,20 @@ mkRegRegMoveInstr src dst = ANN desc instr
 -- We have to be a bit careful here: A `MOV` can also mean an implicit
 -- conversion. This case is filtered out.
 takeRegRegMoveInstr :: Instr -> Maybe (Reg,Reg)
-takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst)
+-- TODO: If this doesn't work (I don't understand WHY):
+-- ghc: panic! (the 'impossible' happened)
+--  GHC version 9.6.3:
+--        RV64.ppr: unhandled CSET conditional
+--  FLE t6, t0, ft0
+--  Call stack:
+--      CallStack (from HasCallStack):
+--        callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
+--        pprPanic, called at compiler/GHC/CmmToAsm/RV64/Ppr.hs:598:11 in ghc:GHC.CmmToAsm.RV64.Ppr
+--  CallStack (from HasCallStack):
+--    panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error
+--
+-- Maybe, checking the format isn't enough and we have to check register types by their number?
+-- takeRegRegMoveInstr (MOV (OpReg fmt dst) (OpReg fmt' src)) | fmt == fmt' = pure (src, dst)
 takeRegRegMoveInstr _ = Nothing
 
 -- | Make an unconditional jump instruction.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/46b55bb485edadb28be7b9fcf7e16abea4f5a12e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/46b55bb485edadb28be7b9fcf7e16abea4f5a12e
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/20240309/89b24d2f/attachment-0001.html>


More information about the ghc-commits mailing list