[llvm] r363252 - [X86][AVX] Add broadcast(v4f64 hadd) test
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 04:42:32 PDT 2019
Author: rksimon
Date: Thu Jun 13 04:42:32 2019
New Revision: 363252
URL: http://llvm.org/viewvc/llvm-project?rev=363252&view=rev
Log:
[X86][AVX] Add broadcast(v4f64 hadd) test
Modified:
llvm/trunk/test/CodeGen/X86/haddsub-shuf.ll
Modified: llvm/trunk/test/CodeGen/X86/haddsub-shuf.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/haddsub-shuf.ll?rev=363252&r1=363251&r2=363252&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/haddsub-shuf.ll (original)
+++ llvm/trunk/test/CodeGen/X86/haddsub-shuf.ll Thu Jun 13 04:42:32 2019
@@ -263,6 +263,60 @@ define <4 x double> @hadd_v4f64_scalar_s
ret <4 x double> %shuf
}
+define <4 x double> @hadd_v4f64_scalar_broadcast(<4 x double> %a) {
+; SSSE3_SLOW-LABEL: hadd_v4f64_scalar_broadcast:
+; SSSE3_SLOW: # %bb.0:
+; SSSE3_SLOW-NEXT: movapd %xmm0, %xmm1
+; SSSE3_SLOW-NEXT: unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]
+; SSSE3_SLOW-NEXT: addsd %xmm0, %xmm1
+; SSSE3_SLOW-NEXT: movddup {{.*#+}} xmm0 = xmm1[0,0]
+; SSSE3_SLOW-NEXT: movapd %xmm0, %xmm1
+; SSSE3_SLOW-NEXT: retq
+;
+; SSSE3_FAST-LABEL: hadd_v4f64_scalar_broadcast:
+; SSSE3_FAST: # %bb.0:
+; SSSE3_FAST-NEXT: haddpd %xmm0, %xmm0
+; SSSE3_FAST-NEXT: movapd %xmm0, %xmm1
+; SSSE3_FAST-NEXT: retq
+;
+; AVX1_SLOW-LABEL: hadd_v4f64_scalar_broadcast:
+; AVX1_SLOW: # %bb.0:
+; AVX1_SLOW-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
+; AVX1_SLOW-NEXT: vaddsd %xmm1, %xmm0, %xmm0
+; AVX1_SLOW-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
+; AVX1_SLOW-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
+; AVX1_SLOW-NEXT: retq
+;
+; AVX1_FAST-LABEL: hadd_v4f64_scalar_broadcast:
+; AVX1_FAST: # %bb.0:
+; AVX1_FAST-NEXT: vhaddpd %xmm0, %xmm0, %xmm0
+; AVX1_FAST-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
+; AVX1_FAST-NEXT: retq
+;
+; AVX2_SLOW-LABEL: hadd_v4f64_scalar_broadcast:
+; AVX2_SLOW: # %bb.0:
+; AVX2_SLOW-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
+; AVX2_SLOW-NEXT: vaddsd %xmm1, %xmm0, %xmm0
+; AVX2_SLOW-NEXT: vbroadcastsd %xmm0, %ymm0
+; AVX2_SLOW-NEXT: retq
+;
+; AVX2_FAST-LABEL: hadd_v4f64_scalar_broadcast:
+; AVX2_FAST: # %bb.0:
+; AVX2_FAST-NEXT: vhaddpd %xmm0, %xmm0, %xmm0
+; AVX2_FAST-NEXT: vbroadcastsd %xmm0, %ymm0
+; AVX2_FAST-NEXT: retq
+ %a0 = extractelement <4 x double> %a, i32 0
+ %a1 = extractelement <4 x double> %a, i32 1
+ %hop0 = fadd double %a0, %a1
+ %a2 = extractelement <4 x double> %a, i32 2
+ %a3 = extractelement <4 x double> %a, i32 3
+ %hop1 = fadd double %a2, %a3
+ %ins = insertelement <4 x double> undef, double %hop0, i32 0
+ %ins2 = insertelement <4 x double> %ins, double %hop1, i32 2
+ %shuf = shufflevector <4 x double> %ins2, <4 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x double> %shuf
+}
+
define <4 x double> @hadd_v4f64(<4 x double> %a) {
; SSSE3_SLOW-LABEL: hadd_v4f64:
; SSSE3_SLOW: # %bb.0:
More information about the llvm-commits
mailing list