Sven Tennie pushed to branch wip/supersven/riscv-vectors at Glasgow Haskell Compiler / GHC Commits: 09298c1f by Sven Tennie at 2026-11-29T18:15:35+00:00 RV64: Fix register class squeeze for float and vector realRegSqueeze reports whether a real register conflicts with (squeezes) a given register class. Integer, float and vector registers live in disjoint register files, so a neighbour in a different file denies zero colours. The refactoring on the vector branch replaced the explicit range checks with upper-bound comparisons that mistakenly count the lower-numbered register files too: RcFloat also counted integer registers (regNo <= d31RegNo) and RcVector counted integer and float registers (regNo <= v31RegNo). Use the isFloatRegNo/isVectorRegNo class predicates instead. - - - - - 6e797767 by Sven Tennie at 2026-11-29T18:15:42+00:00 RV64: Drop reserved v1 from allocatable vector registers v1 (REG_XMM1) is marked non-free in CodeGen.Platform (freeReg 65 = False), so listing it in allocatableVectorRegs was a dead entry that never survives initFreeRegs. It also made the list inconsistent with the 25 allocatable vector registers expected by TrivColorable (32 - 6 XMM regs - 1 mask register). - - - - - 2 changed files: - compiler/GHC/CmmToAsm/RV64/Regs.hs - compiler/GHC/CmmToAsm/Reg/Linear/RV64.hs Changes: ===================================== compiler/GHC/CmmToAsm/RV64/Regs.hs ===================================== @@ -250,12 +250,12 @@ realRegSqueeze cls rr = RcFloat -> case rr of RealRegSingle regNo - | regNo <= d31RegNo -> 1 + | isFloatRegNo regNo -> 1 | otherwise -> 0 RcVector -> case rr of RealRegSingle regNo - | regNo <= v31RegNo -> 1 + | isVectorRegNo regNo -> 1 | otherwise -> 0 mkVirtualReg :: Unique -> Format -> VirtualReg ===================================== compiler/GHC/CmmToAsm/Reg/Linear/RV64.hs ===================================== @@ -83,7 +83,7 @@ getFreeRegs cls (FreeRegs g f v) = -- change often.) allocatableIntRegs = [5 .. 7] ++ [10 .. 17] ++ [28 .. 30] allocatableDoubleRegs = [0 .. 7] ++ [10 .. 17] ++ [28 .. 31] - allocatableVectorRegs = 1 : [7 .. 31] + allocatableVectorRegs = [7 .. 31] -- | Set corresponding register bit to 0 allocateReg :: (HasCallStack) => RealReg -> FreeRegs -> FreeRegs View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4135fcc38efeb30e733b0e81d8295ab... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4135fcc38efeb30e733b0e81d8295ab... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Sven Tennie (@supersven)