diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2023-01-09 11:40:12 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-09 21:11:07 -0500 |
commit | 146a145835f5c2e82da4dd0bcb90702460505a01 (patch) | |
tree | 9b38dac68e71baa6e16cfce6c8b0f8606bcc6231 /compiler/GHC/CmmToAsm/X86 | |
parent | 2e926b887067aacb866740a878dc386ab74713da (diff) | |
download | haskell-146a145835f5c2e82da4dd0bcb90702460505a01.tar.gz |
Revert "NCG(x86): Compile add+shift as lea if possible."
This reverts commit 20457d775885d6c3df020d204da9a7acfb3c2e5a.
See #22666 and #21777
Diffstat (limited to 'compiler/GHC/CmmToAsm/X86')
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/CodeGen.hs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs index 8e57473384..d407a8a86a 100644 --- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs @@ -1048,29 +1048,10 @@ getRegister' _ is32Bit (CmmMachOp mop [x, y]) = -- dyadic MachOps -------------------- add_code :: Width -> CmmExpr -> CmmExpr -> NatM Register - -- x + imm add_code rep x (CmmLit (CmmInt y _)) | is32BitInteger y , rep /= W8 -- LEA doesn't support byte size (#18614) = add_int rep x y - -- x + (y << imm) - add_code rep x y - -- Byte size is not supported and 16bit size is slow when computed via LEA - | rep /= W8 && rep /= W16 - -- 2^3 = 8 is the highest multiplicator supported by LEA. - , Just (x,y,shift_bits) <- get_shift x y - = add_shiftL rep x y (fromIntegral shift_bits) - where - -- x + (y << imm) - get_shift x (CmmMachOp (MO_Shl _w) [y, CmmLit (CmmInt shift_bits _)]) - | shift_bits <= 3 - = Just (x, y, shift_bits) - -- (y << imm) + x - get_shift (CmmMachOp (MO_Shl _w) [y, CmmLit (CmmInt shift_bits _)]) x - | shift_bits <= 3 - = Just (x, y, shift_bits) - get_shift _ _ - = Nothing add_code rep x y = trivialCode rep (ADD format) (Just (ADD format)) x y where format = intFormat rep -- TODO: There are other interesting patterns we want to replace @@ -1085,7 +1066,6 @@ getRegister' _ is32Bit (CmmMachOp mop [x, y]) = -- dyadic MachOps sub_code rep x y = trivialCode rep (SUB (intFormat rep)) Nothing x y -- our three-operand add instruction: - add_int :: (Width -> CmmExpr -> Integer -> NatM Register) add_int width x y = do (x_reg, x_code) <- getSomeReg x let @@ -1099,22 +1079,6 @@ getRegister' _ is32Bit (CmmMachOp mop [x, y]) = -- dyadic MachOps -- return (Any format code) - -- x + (y << shift_bits) using LEA - add_shiftL :: (Width -> CmmExpr -> CmmExpr -> Int -> NatM Register) - add_shiftL width x y shift_bits = do - (x_reg, x_code) <- getSomeReg x - (y_reg, y_code) <- getSomeReg y - let - format = intFormat width - imm = ImmInt 0 - code dst - = (x_code `appOL` y_code) `snocOL` - LEA format - (OpAddr (AddrBaseIndex (EABaseReg x_reg) (EAIndex y_reg (2 ^ shift_bits)) imm)) - (OpReg dst) - -- - return (Any format code) - ---------------------- -- See Note [DIV/IDIV for bytes] |