summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/avx-vbroadcast.ll
diff options
context:
space:
mode:
authorRobert Lougher <rob.lougher@gmail.com>2014-02-11 15:42:46 +0000
committerRobert Lougher <rob.lougher@gmail.com>2014-02-11 15:42:46 +0000
commit7d9084ffa13aabb4e3f7f6bd8d8263dce982421e (patch)
treea4320aa05e50955bfda075310488e9800abff5a8 /llvm/test/CodeGen/X86/avx-vbroadcast.ll
parent2228cd3f070da33be9e8ae456858ac5f2bd59679 (diff)
downloadbcm5719-llvm-7d9084ffa13aabb4e3f7f6bd8d8263dce982421e.tar.gz
bcm5719-llvm-7d9084ffa13aabb4e3f7f6bd8d8263dce982421e.zip
Teach the DAGCombiner how to fold concat_vector nodes when the input is two
BUILD_VECTOR nodes, e.g.: (concat_vectors (BUILD_VECTOR a1, a2, a3, a4), (BUILD_VECTOR b1, b2, b3, b4)) -> (BUILD_VECTOR a1, a2, a3, a4, b1, b2, b3, b4) This fixes an issue with AVX, where a sequence was not recognized as a 256-bit vbroadcast due to the concat_vectors. llvm-svn: 201158
Diffstat (limited to 'llvm/test/CodeGen/X86/avx-vbroadcast.ll')
-rw-r--r--llvm/test/CodeGen/X86/avx-vbroadcast.ll63
1 files changed, 63 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/avx-vbroadcast.ll b/llvm/test/CodeGen/X86/avx-vbroadcast.ll
index 0d403d4bb12..2ebe6fda37a 100644
--- a/llvm/test/CodeGen/X86/avx-vbroadcast.ll
+++ b/llvm/test/CodeGen/X86/avx-vbroadcast.ll
@@ -141,3 +141,66 @@ entry:
ret <4 x float> %t
}
+
+; These tests check that a vbroadcast instruction is used when we have a splat
+; formed from a concat_vectors (via the shufflevector) of two BUILD_VECTORs
+; (via the insertelements).
+
+; CHECK-LABEL: splat_concat1
+; CHECK-NOT: vinsertf128
+; CHECK: vbroadcastss (%
+; CHECK-NEXT: ret
+define <8 x float> @splat_concat1(float* %p) {
+ %1 = load float* %p, align 4
+ %2 = insertelement <4 x float> undef, float %1, i32 0
+ %3 = insertelement <4 x float> %2, float %1, i32 1
+ %4 = insertelement <4 x float> %3, float %1, i32 2
+ %5 = insertelement <4 x float> %4, float %1, i32 3
+ %6 = shufflevector <4 x float> %5, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
+ ret <8 x float> %6
+}
+
+; CHECK-LABEL: splat_concat2
+; CHECK-NOT: vinsertf128
+; CHECK: vbroadcastss (%
+; CHECK-NEXT: ret
+define <8 x float> @splat_concat2(float* %p) {
+ %1 = load float* %p, align 4
+ %2 = insertelement <4 x float> undef, float %1, i32 0
+ %3 = insertelement <4 x float> %2, float %1, i32 1
+ %4 = insertelement <4 x float> %3, float %1, i32 2
+ %5 = insertelement <4 x float> %4, float %1, i32 3
+ %6 = insertelement <4 x float> undef, float %1, i32 0
+ %7 = insertelement <4 x float> %6, float %1, i32 1
+ %8 = insertelement <4 x float> %7, float %1, i32 2
+ %9 = insertelement <4 x float> %8, float %1, i32 3
+ %10 = shufflevector <4 x float> %5, <4 x float> %9, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ ret <8 x float> %10
+}
+
+; CHECK-LABEL: splat_concat3
+; CHECK-NOT: vinsertf128
+; CHECK: vbroadcastsd (%
+; CHECK-NEXT: ret
+define <4 x double> @splat_concat3(double* %p) {
+ %1 = load double* %p, align 8
+ %2 = insertelement <2 x double> undef, double %1, i32 0
+ %3 = insertelement <2 x double> %2, double %1, i32 1
+ %4 = shufflevector <2 x double> %3, <2 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
+ ret <4 x double> %4
+}
+
+; CHECK-LABEL: splat_concat4
+; CHECK-NOT: vinsertf128
+; CHECK: vbroadcastsd (%
+; CHECK-NEXT: ret
+define <4 x double> @splat_concat4(double* %p) {
+ %1 = load double* %p, align 8
+ %2 = insertelement <2 x double> undef, double %1, i32 0
+ %3 = insertelement <2 x double> %2, double %1, i32 1
+ %4 = insertelement <2 x double> undef, double %1, i32 0
+ %5 = insertelement <2 x double> %2, double %1, i32 1
+ %6 = shufflevector <2 x double> %3, <2 x double> %5, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
+ ret <4 x double> %6
+}
+
OpenPOWER on IntegriCloud