summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-10-20 03:58:59 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-22 10:58:04 -0400
commit7f4e0e91530117fd4d477d553a7f03993b86fe74 (patch)
treea5db048fda15bba200adb8fafac760d55f713661
parent56b2b04f6ff1961689d0ca7b74308879e3230e11 (diff)
downloadhaskell-7f4e0e91530117fd4d477d553a7f03993b86fe74.tar.gz
Do not sign extend CmmInt's unless negative.
Might fix #20526.
-rw-r--r--compiler/GHC/CmmToAsm/AArch64/CodeGen.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/CodeGen.hs b/compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
index e05fb38e60..57da087f2b 100644
--- a/compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
@@ -445,6 +445,11 @@ getRegister' config plat expr
-- TODO handle CmmInt 0 specially, use wzr or xzr.
+ CmmInt i W8 | i >= 0 -> do
+ return (Any (intFormat W8) (\dst -> unitOL $ annExpr expr (MOV (OpReg W8 dst) (OpImm (ImmInteger (narrowU W8 i))))))
+ CmmInt i W16 | i >= 0 -> do
+ return (Any (intFormat W16) (\dst -> unitOL $ annExpr expr (MOV (OpReg W16 dst) (OpImm (ImmInteger (narrowU W16 i))))))
+
CmmInt i W8 -> do
return (Any (intFormat W8) (\dst -> unitOL $ annExpr expr (MOV (OpReg W8 dst) (OpImm (ImmInteger (narrowS W8 i))))))
CmmInt i W16 -> do