[llvm-commits] [llvm] r147484 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp test/CodeGen/X86/promote.ll

Nadav Rotem nadav.rotem at intel.com
Tue Jan 3 14:12:28 PST 2012


Author: nadav
Date: Tue Jan  3 16:12:28 2012
New Revision: 147484

URL: http://llvm.org/viewvc/llvm-project?rev=147484&view=rev
Log:
Fix incorrect widening of the bitcast sdnode in case the incoming operand is integer-promoted.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
    llvm/trunk/test/CodeGen/X86/promote.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=147484&r1=147483&r2=147484&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Tue Jan  3 16:12:28 2012
@@ -1571,6 +1571,12 @@
   case TargetLowering::TypeLegal:
     break;
   case TargetLowering::TypePromoteInteger:
+    // If the incoming type is a vector that is being promoted, then
+    // we know that the elements are arranged differently and that we
+    // must perform the conversion using a stack slot.
+    if (InVT.isVector())
+      break;
+
     // If the InOp is promoted to the same size, convert it.  Otherwise,
     // fall out of the switch and widen the promoted input.
     InOp = GetPromotedInteger(InOp);

Modified: llvm/trunk/test/CodeGen/X86/promote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/promote.ll?rev=147484&r1=147483&r2=147484&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/promote.ll (original)
+++ llvm/trunk/test/CodeGen/X86/promote.ll Tue Jan  3 16:12:28 2012
@@ -29,3 +29,14 @@
   ret i32 0
 ; CHECK: ret
 }
+
+; CHECK: bitcast_widen
+define <2 x float> @bitcast_widen(<4 x i32> %in) nounwind readnone {
+entry:
+; CHECK-NOT: pshufd
+ %x = shufflevector <4 x i32> %in, <4 x i32> undef, <2 x i32> <i32 0, i32 1>
+ %y = bitcast <2 x i32> %x to <2 x float>
+ ret <2 x float> %y
+; CHECK: ret
+}
+





More information about the llvm-commits mailing list