Fix incorrect widening of the bitcast sdnode in case the incoming operand is integer...
authorNadav Rotem <nadav.rotem@intel.com>
Tue, 3 Jan 2012 22:12:28 +0000 (22:12 +0000)
committerNadav Rotem <nadav.rotem@intel.com>
Tue, 3 Jan 2012 22:12:28 +0000 (22:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147484 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
test/CodeGen/X86/promote.ll

index 7ca0d1e5c0f8ae1728d8feebbcecf536a9b52752..6b267c311d8d96e48fa433ca9a3681c056579347 100644 (file)
@@ -1571,6 +1571,12 @@ SDValue DAGTypeLegalizer::WidenVecRes_BITCAST(SDNode *N) {
   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);
index b8964f20c9c4d03b2bb619cba2c4c796bc863141..8b30dc718b088b81c10d8e07c9d9c65b55c4660f 100644 (file)
@@ -29,3 +29,14 @@ entry:
   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
+}
+