[llvm] 44133d9 - [X86][CGP] Pre-commit test cases for D86371.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 10:49:18 PDT 2020
Author: Craig Topper
Date: 2020-08-31T10:48:56-07:00
New Revision: 44133d9a0801f9bca777c4858ee7d59618a9c4fe
URL: https://github.com/llvm/llvm-project/commit/44133d9a0801f9bca777c4858ee7d59618a9c4fe
DIFF: https://github.com/llvm/llvm-project/commit/44133d9a0801f9bca777c4858ee7d59618a9c4fe.diff
LOG: [X86][CGP] Pre-commit test cases for D86371.
Added:
Modified:
llvm/test/CodeGen/X86/masked_gather_scatter.ll
llvm/test/Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/masked_gather_scatter.ll b/llvm/test/CodeGen/X86/masked_gather_scatter.ll
index df3af4c24659..2d087e467c97 100644
--- a/llvm/test/CodeGen/X86/masked_gather_scatter.ll
+++ b/llvm/test/CodeGen/X86/masked_gather_scatter.ll
@@ -3319,3 +3319,57 @@ define void @scatter_16i64_constant_indices(i32* %ptr, <16 x i1> %mask, <16 x i3
call void @llvm.masked.scatter.v16i32.v16p0i32(<16 x i32> %src0, <16 x i32*> %gep, i32 4, <16 x i1> %mask)
ret void
}
+
+define void @splat_ptr(i32* %ptr, <4 x i1> %mask, <4 x i32> %val) {
+; CHECK-LABEL: @splat_ptr(
+; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, i32* [[PTR:%.*]], <4 x i64> zeroinitializer
+; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL:%.*]], <4 x i32*> [[TMP1]], i32 4, <4 x i1> [[MASK:%.*]])
+; CHECK-NEXT: ret void
+;
+; KNL_64-LABEL: splat_ptr:
+; KNL_64: # %bb.0:
+; KNL_64-NEXT: # kill: def $xmm1 killed $xmm1 def $ymm1
+; KNL_64-NEXT: vpslld $31, %xmm0, %xmm0
+; KNL_64-NEXT: vptestmd %zmm0, %zmm0, %k0
+; KNL_64-NEXT: kshiftlw $12, %k0, %k0
+; KNL_64-NEXT: kshiftrw $12, %k0, %k1
+; KNL_64-NEXT: vmovq %rdi, %xmm0
+; KNL_64-NEXT: vpbroadcastq %xmm0, %ymm0
+; KNL_64-NEXT: vpscatterqd %ymm1, (,%zmm0) {%k1}
+; KNL_64-NEXT: vzeroupper
+; KNL_64-NEXT: retq
+;
+; KNL_32-LABEL: splat_ptr:
+; KNL_32: # %bb.0:
+; KNL_32-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
+; KNL_32-NEXT: vpslld $31, %xmm0, %xmm0
+; KNL_32-NEXT: vptestmd %zmm0, %zmm0, %k0
+; KNL_32-NEXT: kshiftlw $12, %k0, %k0
+; KNL_32-NEXT: kshiftrw $12, %k0, %k1
+; KNL_32-NEXT: vpbroadcastd {{[0-9]+}}(%esp), %xmm0
+; KNL_32-NEXT: vpscatterdd %zmm1, (,%zmm0) {%k1}
+; KNL_32-NEXT: vzeroupper
+; KNL_32-NEXT: retl
+;
+; SKX-LABEL: splat_ptr:
+; SKX: # %bb.0:
+; SKX-NEXT: vpslld $31, %xmm0, %xmm0
+; SKX-NEXT: vpmovd2m %xmm0, %k1
+; SKX-NEXT: vpbroadcastq %rdi, %ymm0
+; SKX-NEXT: vpscatterqd %xmm1, (,%ymm0) {%k1}
+; SKX-NEXT: vzeroupper
+; SKX-NEXT: retq
+;
+; SKX_32-LABEL: splat_ptr:
+; SKX_32: # %bb.0:
+; SKX_32-NEXT: vpslld $31, %xmm0, %xmm0
+; SKX_32-NEXT: vpmovd2m %xmm0, %k1
+; SKX_32-NEXT: vpbroadcastd {{[0-9]+}}(%esp), %xmm0
+; SKX_32-NEXT: vpscatterdd %xmm1, (,%xmm0) {%k1}
+; SKX_32-NEXT: retl
+ %1 = insertelement <4 x i32*> undef, i32* %ptr, i32 0
+ %2 = shufflevector <4 x i32*> %1, <4 x i32*> undef, <4 x i32> zeroinitializer
+ call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> %val, <4 x i32*> %2, i32 4, <4 x i1> %mask)
+ ret void
+}
+
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll b/llvm/test/Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
index 2cb749dc939c..03aa18a58c9d 100644
--- a/llvm/test/Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
@@ -85,4 +85,18 @@ define <4 x i32> @global_struct_splat() {
ret <4 x i32> %4
}
+define void @splat_ptr(i32* %ptr, <4 x i1> %mask, <4 x i32> %val) {
+; CHECK-LABEL: @splat_ptr(
+; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32*> undef, i32* [[PTR:%.*]], i32 0
+; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32*> [[TMP1]], <4 x i32*> undef, <4 x i32> zeroinitializer
+; CHECK-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL:%.*]], <4 x i32*> [[TMP2]], i32 4, <4 x i1> [[MASK:%.*]])
+; CHECK-NEXT: ret void
+;
+ %1 = insertelement <4 x i32*> undef, i32* %ptr, i32 0
+ %2 = shufflevector <4 x i32*> %1, <4 x i32*> undef, <4 x i32> zeroinitializer
+ call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> %val, <4 x i32*> %2, i32 4, <4 x i1> %mask)
+ ret void
+}
+
declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32, <4 x i1>, <4 x i32>)
+declare void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>, <4 x i32*>, i32, <4 x i1>)
More information about the llvm-commits
mailing list