summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Trommler <ptrommler@acm.org>2021-05-16 15:01:52 +0200
committerZubin Duggal <zubin.duggal@gmail.com>2021-09-21 22:28:27 +0530
commit39ad330caae9f05a5bf07f2134aa58d1f4ed4739 (patch)
treed5a45f11d733b103793fdd5701604cb07761a464
parent6b64aa7c48d607052e79e3927a4f896b33803086 (diff)
downloadhaskell-39ad330caae9f05a5bf07f2134aa58d1f4ed4739.tar.gz
PPC NCG: Fix unsigned compare with 16-bit constants
Fixes #19852 and #19609 (cherry picked from commit 6a577cf0edb38577e703c9523a4307ae9fa7576d)
-rw-r--r--compiler/GHC/CmmToAsm/PPC/CodeGen.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs
index 367faa25bc..516a3840b6 100644
--- a/compiler/GHC/CmmToAsm/PPC/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/PPC/CodeGen.hs
@@ -981,7 +981,8 @@ condIntCode' _ cond width x (CmmLit (CmmInt y rep))
| Just src2 <- makeImmediate rep (not $ condUnsigned cond) y
= do
let op_len = max W32 width
- let extend = extendSExpr width op_len
+ let extend = if condUnsigned cond then extendUExpr width op_len
+ else extendSExpr width op_len
(src1, code) <- getSomeReg (extend x)
let format = intFormat op_len
code' = code `snocOL`