From 51dc807e146e9de6454cb455cb7592f22cd0fac0 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Wed, 20 Oct 2021 03:58:59 +0000 Subject: Do not sign extend CmmInt's unless negative. Might fix #20526. --- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.1