From c8608af39a62e2d981d47b0066f6846b35b6d5de Mon Sep 17 00:00:00 2001
From: Erik de Castro Lopo <erikd@mega-nerd.com>
Date: Thu, 23 Aug 2012 20:39:47 +1000
Subject: [PATCH] Fix for optimizer bug on linux-powerpc (#6156).

MERGED from commit b4b78631890a4cd9cde1551de9a4440e7e750372
---
 compiler/nativeGen/PPC/CodeGen.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index 422e1bbf8926..7815551996c6 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -320,15 +320,15 @@ iselExpr64 (CmmLit (CmmInt i _)) = do
   (rlo,rhi) <- getNewRegPairNat II32
   let
         half0 = fromIntegral (fromIntegral i :: Word16)
-        half1 = fromIntegral ((fromIntegral i `shiftR` 16) :: Word16)
-        half2 = fromIntegral ((fromIntegral i `shiftR` 32) :: Word16)
-        half3 = fromIntegral ((fromIntegral i `shiftR` 48) :: Word16)
+        half1 = fromIntegral (fromIntegral (i `shiftR` 16) :: Word16)
+        half2 = fromIntegral (fromIntegral (i `shiftR` 32) :: Word16)
+        half3 = fromIntegral (fromIntegral (i `shiftR` 48) :: Word16)
 
         code = toOL [
                 LIS rlo (ImmInt half1),
                 OR rlo rlo (RIImm $ ImmInt half0),
                 LIS rhi (ImmInt half3),
-                OR rlo rlo (RIImm $ ImmInt half2)
+                OR rhi rhi (RIImm $ ImmInt half2)
                 ]
   return (ChildCode64 code rlo)
 
-- 
GitLab