[llvm] r295729 - [X86][AVX] Add tests showing missed VPBROADCASTQ folding on 32-bit targets.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 08:05:36 PST 2017


Author: rksimon
Date: Tue Feb 21 10:05:35 2017
New Revision: 295729

URL: http://llvm.org/viewvc/llvm-project?rev=295729&view=rev
Log:
[X86][AVX] Add tests showing missed VPBROADCASTQ folding on 32-bit targets.

As i64 isn't a value type on 32-bit targets, we fail to fold the VZEXT_LOAD into VPBROADCASTQ.

Also shows that we're not decoding VPERMIV3 shuffles very well....

Modified:
    llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
    llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll

Modified: llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx2.ll?rev=295729&r1=295728&r2=295729&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx2.ll Tue Feb 21 10:05:35 2017
@@ -774,6 +774,42 @@ define <32 x i8> @combine_unpack_unpack_
   ret <32 x i8> %6
 }
 
+define <16 x i8> @combine_broadcast_pshufb_insertion_v2i64(i64 %a0) {
+; X32-LABEL: combine_broadcast_pshufb_insertion_v2i64:
+; X32:       # BB#0:
+; X32-NEXT:    vmovq {{.*#+}} xmm0 = mem[0],zero
+; X32-NEXT:    vpbroadcastq %xmm0, %xmm0
+; X32-NEXT:    retl
+;
+; X64-LABEL: combine_broadcast_pshufb_insertion_v2i64:
+; X64:       # BB#0:
+; X64-NEXT:    vmovq %rdi, %xmm0
+; X64-NEXT:    vpbroadcastq %xmm0, %xmm0
+; X64-NEXT:    retq
+  %1 = insertelement <2 x i64> undef, i64 %a0, i32 0
+  %2 = bitcast <2 x i64> %1 to <16 x i8>
+  %3 = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %2, <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>)
+  ret <16 x i8> %3
+}
+
+define <8 x i32> @combine_broadcast_permd_insertion_v4i64(i64 %a0) {
+; X32-LABEL: combine_broadcast_permd_insertion_v4i64:
+; X32:       # BB#0:
+; X32-NEXT:    vmovsd {{.*#+}} xmm0 = mem[0],zero
+; X32-NEXT:    vbroadcastsd %xmm0, %ymm0
+; X32-NEXT:    retl
+;
+; X64-LABEL: combine_broadcast_permd_insertion_v4i64:
+; X64:       # BB#0:
+; X64-NEXT:    vmovq %rdi, %xmm0
+; X64-NEXT:    vpbroadcastq %xmm0, %ymm0
+; X64-NEXT:    retq
+  %1 = insertelement <4 x i64> undef, i64 %a0, i32 0
+  %2 = bitcast <4 x i64> %1 to <8 x i32>
+  %3 = tail call <8 x i32> @llvm.x86.avx2.permd(<8 x i32> %2, <8 x i32> <i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1>)
+  ret <8 x i32> %3
+}
+
 define <8 x i32> @constant_fold_permd() {
 ; X32-LABEL: constant_fold_permd:
 ; X32:       # BB#0:

Modified: llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll?rev=295729&r1=295728&r2=295729&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll Tue Feb 21 10:05:35 2017
@@ -1133,3 +1133,21 @@ define <16 x float> @combine_vpermi2var_
   ret <16 x float> %res1
 }
 
+define <8 x i64> @combine_broadcast_vpermvar_insertion_v8i64(i64 %a0) {
+; X32-LABEL: combine_broadcast_vpermvar_insertion_v8i64:
+; X32:       # BB#0:
+; X32-NEXT:    vmovq {{.*#+}} xmm1 = mem[0],zero
+; X32-NEXT:    vpxord %zmm0, %zmm0, %zmm0
+; X32-NEXT:    vpermi2q %zmm0, %zmm1, %zmm0
+; X32-NEXT:    retl
+;
+; X64-LABEL: combine_broadcast_vpermvar_insertion_v8i64:
+; X64:       # BB#0:
+; X64-NEXT:    vmovq %rdi, %xmm1
+; X64-NEXT:    vpxord %zmm0, %zmm0, %zmm0
+; X64-NEXT:    vpermi2q %zmm0, %zmm1, %zmm0
+; X64-NEXT:    retq
+  %1 = insertelement <8 x i64> undef, i64 %a0, i32 0
+  %2 = tail call <8 x i64> @llvm.x86.avx512.mask.vpermi2var.q.512(<8 x i64> %1, <8 x i64> zeroinitializer, <8 x i64> undef, i8 -1)
+  ret <8 x i64> %2
+}




More information about the llvm-commits mailing list