summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Trommler <ptrommler@acm.org>2021-05-16 15:01:52 +0200
committerBen Gamari <ben@smart-cactus.org>2021-08-04 13:09:31 -0400
commit47b677535c2ee91f27e77ed88d586e88e5eecb13 (patch)
treeabe4e30b5d0d8c4f9791dadcdd06e76948228fd2
parent5f8aadabb420367807d6846eda3f008bcda1a5cd (diff)
downloadhaskell-47b677535c2ee91f27e77ed88d586e88e5eecb13.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`