PPC: Handle right shift of > 31 bits. Fix #5900.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 16 Jun 2012 15:48:05 +0000 (10:48 -0500)
committerJoachim Breitner <nomeata@debian.org>
Sat, 16 Jun 2012 10:48:18 +0000 (10:48 +0000)
Gbp-Pq: Name fix-PPC-right-shift-bug

compiler/nativeGen/PPC/Ppr.hs

index 26f06c373b2c5ed685541080b9a620c654322114..8b0bc1e483e6639d585d9592a91ce010162476b3 100644 (file)
@@ -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 [