This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly with
the just committed SHR patch.  Please commit at earliest convenience. If
you're building llvm-gcc4 and you have updated your LLVM tree to include
the SHR patch, please apply this to your llvm-gcc4 tree so that it will
compile correctly.

Thanks,

Reid.
Index: gcc/llvm-convert.cpp
===================================================================
--- gcc/llvm-convert.cpp	(revision 199)
+++ gcc/llvm-convert.cpp	(working copy)
@@ -570,12 +570,17 @@
   case TRUTH_AND_EXPR: Result = EmitTruthOp(exp, Instruction::And); break;
   case TRUTH_OR_EXPR:  Result = EmitTruthOp(exp, Instruction::Or); break;
   case TRUTH_XOR_EXPR: Result = EmitTruthOp(exp, Instruction::Xor); break;
-  case RSHIFT_EXPR:    Result = EmitShiftOp(exp,DestLoc,Instruction::Shr);break;
+  case RSHIFT_EXPR:
+    Result = EmitShiftOp(exp,DestLoc,
+       TYPE_UNSIGNED(TREE_TYPE(exp)) ? Instruction::LShr : Instruction::AShr);
+    break;
   case LSHIFT_EXPR:    Result = EmitShiftOp(exp,DestLoc,Instruction::Shl);break;
-  case RROTATE_EXPR:   Result = EmitRotateOp(exp, Instruction::Shr,
-                                             Instruction::Shl); break;
-  case LROTATE_EXPR:   Result = EmitRotateOp(exp, Instruction::Shl, 
-                                             Instruction::Shr); break;
+  case RROTATE_EXPR: 
+    Result = EmitRotateOp(exp, Instruction::LShr, Instruction::Shl);
+    break;
+  case LROTATE_EXPR:
+    Result = EmitRotateOp(exp, Instruction::Shl, Instruction::LShr);
+    break;
   case MIN_EXPR:       Result = EmitMinMaxExpr(exp, Instruction::SetLE); break;
   case MAX_EXPR:       Result = EmitMinMaxExpr(exp, Instruction::SetGE); break;
   case CONSTRUCTOR:    Result = EmitCONSTRUCTOR(exp, DestLoc); break;
@@ -1723,7 +1728,8 @@
       }
         
       Value *ShAmt = ConstantInt::get(Type::UByteTy, ValSizeInBits-LV.BitSize);
-      Val = new ShiftInst(Instruction::Shr, Val, ShAmt, "tmp", CurBB);
+      Val = new ShiftInst( TYPE_UNSIGNED(TREE_TYPE(exp)) ? 
+        Instruction::LShr : Instruction::AShr, Val, ShAmt, "tmp", CurBB);
     }
     
     return CastToType(Val, ConvertType(TREE_TYPE(exp)));
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to