summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorNadav Rotem <nadav.rotem@intel.com>2012-05-10 12:39:13 +0000
committerNadav Rotem <nadav.rotem@intel.com>2012-05-10 12:39:13 +0000
commit15946e50c1d6565676dad5dc825f9daff59920cc (patch)
treeb115199cc3fdd7d9b48cca67801d0839b3d94174 /llvm
parentb86a3fb8d058205d35141527b161d1eee9bd25d1 (diff)
downloadbcm5719-llvm-15946e50c1d6565676dad5dc825f9daff59920cc.tar.gz
bcm5719-llvm-15946e50c1d6565676dad5dc825f9daff59920cc.zip
AVX2: Add an additional broadcast idiom.
llvm-svn: 156540
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp7
-rw-r--r--llvm/test/CodeGen/X86/avx-vbroadcast.ll12
2 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 4a312f4eb56..a7e72e05f7a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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 ||
diff --git a/llvm/test/CodeGen/X86/avx-vbroadcast.ll b/llvm/test/CodeGen/X86/avx-vbroadcast.ll
index 26ee1d33a17..0d403d4bb12 100644
--- a/llvm/test/CodeGen/X86/avx-vbroadcast.ll
+++ b/llvm/test/CodeGen/X86/avx-vbroadcast.ll
@@ -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
+}
+
OpenPOWER on IntegriCloud