1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00

AVX2: Add an additional broadcast idiom.

llvm-svn: 156540
This commit is contained in:
Nadav Rotem 2012-05-10 12:39:13 +00:00
parent 64319ce27c
commit 157be301c5
2 changed files with 17 additions and 2 deletions

View File

@ -4980,8 +4980,11 @@ X86TargetLowering::LowerVectorBroadcast(SDValue &Op, SelectionDAG &DAG) const {
return SDValue();
SDValue Sc = Op.getOperand(0);
if (Sc.getOpcode() != ISD::SCALAR_TO_VECTOR)
return SDValue();
if (Sc.getOpcode() == ISD::SCALAR_TO_VECTOR)
Ld = Sc.getOperand(0);
else if (Sc.getOpcode() == ISD::BUILD_VECTOR)
Ld = Sc.getOperand(0);
else return SDValue();
Ld = Sc.getOperand(0);
ConstSplatVal = (Ld.getOpcode() == ISD::Constant ||

View File

@ -129,3 +129,15 @@ entry:
ret <4 x float> %vecinit6.i
}
; CHECK: _RR2
; CHECK: vbroadcastss (%
; CHECK: ret
define <4 x float> @_RR2(float* %ptr, i32* %k) nounwind uwtable readnone ssp {
entry:
%q = load float* %ptr, align 4
%v = insertelement <4 x float> undef, float %q, i32 0
%t = shufflevector <4 x float> %v, <4 x float> undef, <4 x i32> zeroinitializer
ret <4 x float> %t
}