Commit a589e823 authored by Joachim Breitner's avatar Joachim Breitner

Actually add patch

parent b6cb33df
From e429f5af8845275a584eb683b2fe6cdca8a7501b Mon Sep 17 00:00:00 2001
From: Peter Trommler <ptrommler@acm.org>
Date: Mon, 9 Nov 2015 15:59:36 +0100
Subject: [PATCH 1/1] PPC nativeGen: fix shift right arithmetic > 31 bit
Arithmetic shift right of more than 31 bits yields
zero for positive Int and -1 for negative Int. On
PowerPC immediates greater than 31 are not allowed,
so replace with a shift by 31 bits which gives the
correct result.
Fixes #10870
---
compiler/nativeGen/PPC/Ppr.hs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
index 4ae32c9..876b11b 100644
--- a/compiler/nativeGen/PPC/Ppr.hs
+++ b/compiler/nativeGen/PPC/Ppr.hs
@@ -637,6 +637,8 @@ pprInstr (SLW reg1 reg2 (RIImm (ImmInt i))) | i < 0 || i > 31 =
-- Fixes ticket http://ghc.haskell.org/trac/ghc/ticket/10870
pprInstr (XOR reg1 reg2 (RIReg reg2))
+pprInstr (SRAW reg1 reg2 (RIImm (ImmInt i))) | i > 31 =
+ pprInstr (SRAW reg1 reg2 (RIImm (ImmInt 31)))
pprInstr (SLW reg1 reg2 ri) = pprLogic (sLit "slw") reg1 reg2 (limitShiftRI ri)
--
2.1.4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment