summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-11-03 12:41:09 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-04 16:48:42 -0500
commit81560981fd9af7ea21b2592c405e9e22af838aab (patch)
tree9c6abd5b4b85f0990581567ef2f28d147d5601a7 /compiler/GHC
parentb790b7f91104197429cd80e2c192a6fcda9dd6b4 (diff)
downloadhaskell-81560981fd9af7ea21b2592c405e9e22af838aab.tar.gz
Don't use LEA with 8-bit registers (#18614)
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/CmmToAsm/X86/CodeGen.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
index 0f982b8d56..4480848b90 100644
--- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
@@ -1052,7 +1052,9 @@ getRegister' _ is32Bit (CmmMachOp mop [x, y]) = -- dyadic MachOps
--------------------
add_code :: Width -> CmmExpr -> CmmExpr -> NatM Register
add_code rep x (CmmLit (CmmInt y _))
- | is32BitInteger y = add_int rep x y
+ | is32BitInteger y
+ , rep /= W8 -- LEA doesn't support byte size (#18614)
+ = add_int rep x y
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
@@ -1061,7 +1063,9 @@ getRegister' _ is32Bit (CmmMachOp mop [x, y]) = -- dyadic MachOps
--------------------
sub_code :: Width -> CmmExpr -> CmmExpr -> NatM Register
sub_code rep x (CmmLit (CmmInt y _))
- | is32BitInteger (-y) = add_int rep x (-y)
+ | is32BitInteger (-y)
+ , rep /= W8 -- LEA doesn't support byte size (#18614)
+ = add_int rep x (-y)
sub_code rep x y = trivialCode rep (SUB (intFormat rep)) Nothing x y
-- our three-operand add instruction: