OSDN Git Service

[X86] Add 512-bit shuffle test cases for concatenating 128/256-bits with zeros in...
authorCraig Topper <craig.topper@intel.com>
Fri, 9 Feb 2018 05:54:31 +0000 (05:54 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 9 Feb 2018 05:54:31 +0000 (05:54 +0000)
We should recognize this and just use a mov that will zero the upper bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324708 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/vector-shuffle-512-v8.ll

index eed07bc..ca72ea0 100644 (file)
@@ -2761,3 +2761,37 @@ define <2 x i64> @test_v8i64_2_5 (<8 x i64> %v) {
   %res = shufflevector <8 x i64> %v, <8 x i64> undef, <2 x i32> <i32 2, i32 5>
   ret <2 x i64> %res
 }
+
+define <8 x i64> @test_v8i64_insert_zero_128(<8 x i64> %a) {
+; AVX512F-LABEL: test_v8i64_insert_zero_128:
+; AVX512F:       # %bb.0:
+; AVX512F-NEXT:    movb $3, %al
+; AVX512F-NEXT:    kmovw %eax, %k1
+; AVX512F-NEXT:    vpexpandq %zmm0, %zmm0 {%k1} {z}
+; AVX512F-NEXT:    retq
+;
+; AVX512F-32-LABEL: test_v8i64_insert_zero_128:
+; AVX512F-32:       # %bb.0:
+; AVX512F-32-NEXT:    movb $3, %al
+; AVX512F-32-NEXT:    kmovw %eax, %k1
+; AVX512F-32-NEXT:    vpexpandq %zmm0, %zmm0 {%k1} {z}
+; AVX512F-32-NEXT:    retl
+  %res = shufflevector <8 x i64> %a, <8 x i64> <i64 0, i64 0, i64 0, i64 0, i64 undef, i64 undef, i64 undef, i64 undef>, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 8, i32 9, i32 8, i32 9>
+  ret <8 x i64> %res
+}
+
+define <8 x i64> @test_v8i64_insert_zero_256(<8 x i64> %a) {
+; AVX512F-LABEL: test_v8i64_insert_zero_256:
+; AVX512F:       # %bb.0:
+; AVX512F-NEXT:    vxorps %xmm1, %xmm1, %xmm1
+; AVX512F-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
+; AVX512F-NEXT:    retq
+;
+; AVX512F-32-LABEL: test_v8i64_insert_zero_256:
+; AVX512F-32:       # %bb.0:
+; AVX512F-32-NEXT:    vpxor %xmm1, %xmm1, %xmm1
+; AVX512F-32-NEXT:    vshufi64x2 {{.*#+}} zmm0 = zmm0[0,1,2,3],zmm1[0,1,0,1]
+; AVX512F-32-NEXT:    retl
+  %res = shufflevector <8 x i64> %a, <8 x i64> <i64 0, i64 0, i64 0, i64 0, i64 undef, i64 undef, i64 undef, i64 undef>, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9>
+  ret <8 x i64> %res
+}