[llvm-commits] SHR Patch (Updated) [llvm-gccpart]

Chris Lattner clattner at apple.com
Thu Nov 2 21:01:02 PST 2006


The llvm-gcc part looks good, but you might as well do this for the  
future:  Instead of:

@@ -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(Val->getType()->isSigned() ?
+        Instruction::AShr : Instruction::LShr, Val, ShAmt, "tmp",  
CurBB);
      }

      return CastToType(Val, ConvertType(TREE_TYPE(exp)));

Select AShr or LShr based on TYPE_UNSIGNED(TREE_TYPE(exp)) instead of  
getType()->isSigned().

When you eliminate signedness you'll have to do this anyway.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061102/aab05033/attachment.html>


More information about the llvm-commits mailing list