From 375c4291ee9a0e3532efd030f57295b578fc91c9 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Sat, 16 Jun 2012 10:48:05 -0500 Subject: [PATCH] PPC: Handle right shift of > 31 bits. Fix #5900. Gbp-Pq: Name fix-PPC-right-shift-bug --- compiler/nativeGen/PPC/Ppr.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 26f06c37..8b0bc1e4 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -594,6 +594,13 @@ pprInstr platform (NEG reg1 reg2) = pprUnary platform (sLit "neg") reg1 reg2 pprInstr platform (NOT reg1 reg2) = pprUnary platform (sLit "not") reg1 reg2 pprInstr platform (SLW reg1 reg2 ri) = pprLogic platform (sLit "slw") reg1 reg2 (limitShiftRI ri) + +pprInstr platform (SRW reg1 reg2 (RIImm (ImmInt i))) | i > 31 || i < 0 = + -- Handle the case where we are asked to shift a 32 bit register by + -- less than zero or more than 31 bits. We convert this into a clear + -- of the destination register. + -- Fixes ticket http://hackage.haskell.org/trac/ghc/ticket/5900 + pprInstr platform (XOR reg1 reg2 (RIReg reg2)) pprInstr platform (SRW reg1 reg2 ri) = pprLogic platform (sLit "srw") reg1 reg2 (limitShiftRI ri) pprInstr platform (SRAW reg1 reg2 ri) = pprLogic platform (sLit "sraw") reg1 reg2 (limitShiftRI ri) pprInstr platform (RLWINM reg1 reg2 sh mb me) = hcat [ -- 2.30.2