summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2021-10-20 03:58:59 +0000
committerBen Gamari <ben@smart-cactus.org>2021-10-25 23:50:59 -0400
commit3d296feb062c04913a889b9f4a5799b9ed200e69 (patch)
tree07cb9a8668d363f3db14be3c226c3b9dad8791bb
parentb3d2ced4c89eb0790f7cdb71363afb06307316e1 (diff)
downloadhaskell-3d296feb062c04913a889b9f4a5799b9ed200e69.tar.gz
Do not sign extend CmmInt's unless negative.
Might fix #20526. (cherry picked from commit 7f4e0e91530117fd4d477d553a7f03993b86fe74)
-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 39100ecb50..974e918683 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