Fix incorrect widening of the bitcast sdnode in case the incoming operand is integer-promoted.

llvm-svn: 147484
This commit is contained in:
Nadav Rotem 2012-01-03 22:12:28 +00:00
parent afcaa8f38a
commit cc49c4d74d
2 changed files with 17 additions and 0 deletions

View 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);

View 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
}