[llvm-commits] [llvm] r48245 - in /llvm/trunk: lib/CodeGen/SelectionDAG/TargetLowering.cpp test/CodeGen/X86/sext-select.ll

Dan Gohman gohman at apple.com
Tue Mar 11 14:29:44 PDT 2008


Author: djg
Date: Tue Mar 11 16:29:43 2008
New Revision: 48245

URL: http://llvm.org/viewvc/llvm-project?rev=48245&view=rev
Log:
Use the correct value for InSignBit.

Added:
    llvm/trunk/test/CodeGen/X86/sext-select.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=48245&r1=48244&r2=48245&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Tue Mar 11 16:29:43 2008
@@ -892,7 +892,7 @@
     MVT::ValueType InVT = Op.getOperand(0).getValueType();
     unsigned InBits = MVT::getSizeInBits(InVT);
     APInt InMask    = APInt::getLowBitsSet(BitWidth, InBits);
-    APInt InSignBit = APInt::getLowBitsSet(BitWidth, InBits);
+    APInt InSignBit = APInt::getBitsSet(BitWidth, InBits - 1, InBits);
     APInt NewBits   = ~InMask & NewMask;
     
     // If none of the top bits are demanded, convert this into an any_extend.

Added: llvm/trunk/test/CodeGen/X86/sext-select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sext-select.ll?rev=48245&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/sext-select.ll (added)
+++ llvm/trunk/test/CodeGen/X86/sext-select.ll Tue Mar 11 16:29:43 2008
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep movsw
+; PR2139
+
+declare void @abort()
+
+define i32 @main() {
+entry:
+	%tmp73 = tail call i1 @return_false()		; <i8> [#uses=1]
+	%g.0 = select i1 %tmp73, i16 0, i16 -480		; <i16> [#uses=2]
+	%tmp7778 = sext i16 %g.0 to i32		; <i32> [#uses=1]
+	%tmp80 = shl i32 %tmp7778, 3		; <i32> [#uses=2]
+	%tmp87 = icmp sgt i32 %tmp80, 32767		; <i1> [#uses=1]
+	br i1 %tmp87, label %bb90, label %bb91
+bb90:		; preds = %bb84, %bb72
+	tail call void @abort()
+	unreachable
+bb91:		; preds = %bb84
+	ret i32 0
+}
+
+define i1 @return_false() {
+	ret i1 0
+}





More information about the llvm-commits mailing list