[Git][ghc/ghc][wip/ncg-simd] WIP: fix mkSpillInstr/mkLoadInstr panics

sheaf (@sheaf) gitlab at gitlab.haskell.org
Fri Jun 7 08:32:19 UTC 2024



sheaf pushed to branch wip/ncg-simd at Glasgow Haskell Compiler / GHC


Commits:
1a05aafa by sheaf at 2024-06-07T10:31:52+02:00
WIP: fix mkSpillInstr/mkLoadInstr panics

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/Instr.hs
=====================================
@@ -828,10 +828,6 @@ mkSpillInstr
 mkSpillInstr config reg fmt delta slot
   = let off s = spillSlotToOffset platform s - delta
     in case fmt of
-        IntegerFormat -> [MOV (archWordFormat is32Bit)
-                                   (OpReg reg) (OpAddr (spRel platform $ off slot))]
-        FF64 -> [MOV FF64 (OpReg reg) (OpAddr (spRel platform $ off slot))]
-        FF32 -> panic "X86_mkSpillInstr: RcFloat"
         VecFormat {} ->
           -- SIMD NCG TODO: panic for unsupported VecFormats (& same in mkLoadInstr)
           [MOV FF64 (OpReg reg) (OpAddr (spRel platform $ off slot))
@@ -839,10 +835,10 @@ mkSpillInstr config reg fmt delta slot
           ,SHUFPD (VecFormat 2 FmtDouble W64) (ImmInt 0b01) (OpReg reg) reg
             -- NB: this format doesn't matter, we emit the same instruction
             -- regardless of what is stored...
-            -- SIMD NCG TODO: avoid using MOV by using SHUFPD with an OpAddr argument?
+            -- SIMD NCG TODO: can we emit more efficient code here?
           ,MOV FF64 (OpReg reg) (OpAddr (spRel platform $ off (slot + 1)))]
+        _ -> [MOV fmt (OpReg reg) (OpAddr (spRel platform $ off slot))]
     where platform = ncgPlatform config
-          is32Bit = target32Bit platform
 
 -- | Make a spill reload instruction.
 mkLoadInstr
@@ -857,16 +853,13 @@ mkLoadInstr config reg fmt delta slot
   = let off s     = spillSlotToOffset platform s - delta
     in
         case fmt of
-              IntegerFormat -> ([MOV (archWordFormat is32Bit)
-                                 (OpAddr (spRel platform $ off slot)) (OpReg reg)])
-              FF64  -> ([MOV FF64 (OpAddr (spRel platform $ off slot)) (OpReg reg)])
-              FF32   -> panic "X86.mkLoadInstr RcFloat"
               VecFormat {} ->
+                -- SIMD NCG TODO: panic on unsupported VecFormats
                 [MOVH (VecFormat 2 FmtDouble W64) (OpAddr (spRel platform $ off (slot + 1))) (OpReg reg)
                 ,MOVL (VecFormat 2 FmtDouble W64) (OpAddr (spRel platform $ off slot)) (OpReg reg)]
+              _ -> [MOV fmt (OpAddr (spRel platform $ off slot)) (OpReg reg)]
 
     where platform = ncgPlatform config
-          is32Bit = target32Bit platform
 
 spillSlotSize :: Platform -> Int
 spillSlotSize platform



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1a05aafab2a9ae1d79d6ce746e33f3c2ac4d34b9

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1a05aafab2a9ae1d79d6ce746e33f3c2ac4d34b9
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/20240607/e09070f6/attachment-0001.html>


More information about the ghc-commits mailing list