Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 0a64a78b by Sven Tennie at 2025-11-15T20:31:10-05:00 AArch64: Simplify CmmAssign and CmmStore The special handling for floats was fake: The general case is always used. So, the additional code path isn't needed (and only adds complexity for the reader.) - - - - - 1 changed file: - compiler/GHC/CmmToAsm/AArch64/CodeGen.hs Changes: ===================================== compiler/GHC/CmmToAsm/AArch64/CodeGen.hs ===================================== @@ -317,15 +317,9 @@ stmtToInstrs stmt = do CmmComment s -> return (unitOL (COMMENT (ftext s))) CmmTick {} -> return nilOL - CmmAssign reg src - | isFloatType ty -> assignReg_FltCode format reg src - | otherwise -> assignReg_IntCode format reg src - where ty = cmmRegType reg - format = cmmTypeFormat ty + CmmAssign reg src -> assignReg reg src - CmmStore addr src _alignment - | isFloatType ty -> assignMem_FltCode format addr src - | otherwise -> assignMem_IntCode format addr src + CmmStore addr src _alignment -> assignMem format addr src where ty = cmmExprType platform src format = cmmTypeFormat ty @@ -1480,13 +1474,8 @@ getAmode _platform _ expr -- fails when the right hand side is forced into a fixed register -- (e.g. the result of a call). -assignMem_IntCode :: Format -> CmmExpr -> CmmExpr -> NatM InstrBlock -assignReg_IntCode :: Format -> CmmReg -> CmmExpr -> NatM InstrBlock - -assignMem_FltCode :: Format -> CmmExpr -> CmmExpr -> NatM InstrBlock -assignReg_FltCode :: Format -> CmmReg -> CmmExpr -> NatM InstrBlock - -assignMem_IntCode rep addrE srcE +assignMem :: Format -> CmmExpr -> CmmExpr -> NatM InstrBlock +assignMem rep addrE srcE = do (src_reg, _format, code) <- getSomeReg srcE platform <- getPlatform @@ -1497,19 +1486,17 @@ assignMem_IntCode rep addrE srcE `appOL` addr_code `snocOL` STR rep (OpReg w src_reg) (OpAddr addr)) -assignReg_IntCode _ reg src +assignReg :: CmmReg -> CmmExpr -> NatM InstrBlock +assignReg reg src = do platform <- getPlatform let dst = getRegisterReg platform reg r <- getRegister src return $ case r of - Any _ code -> COMMENT (text "CmmAssign" <+> parens (text (show reg)) <+> parens (text (show src))) `consOL` code dst - Fixed format freg fcode -> COMMENT (text "CmmAssign" <+> parens (text (show reg)) <+> parens (text (show src))) `consOL` (fcode `snocOL` MOV (OpReg (formatToWidth format) dst) (OpReg (formatToWidth format) freg)) - --- Let's treat Floating point stuff --- as integer code for now. Opaque. -assignMem_FltCode = assignMem_IntCode -assignReg_FltCode = assignReg_IntCode + Any _ code -> COMMENT (text "CmmAssign" <+> parens (text (show reg)) <+> parens (text (show src))) + `consOL` code dst + Fixed format freg fcode -> COMMENT (text "CmmAssign" <+> parens (text (show reg)) <+> parens (text (show src))) + `consOL` (fcode `snocOL` MOV (OpReg (formatToWidth format) dst) (OpReg (formatToWidth format) freg)) -- ----------------------------------------------------------------------------- -- Jumps View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a64a78bc91a57868195d596d98ebbd1... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a64a78bc91a57868195d596d98ebbd1... You're receiving this email because of your account on gitlab.haskell.org.