[llvm] d8a2b29 - [X86] Add test case for folding select on vXi1
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 14 21:12:25 PST 2023
Author: Luo, Yuanke
Date: 2023-01-15T13:12:01+08:00
New Revision: d8a2b295295e456a493166009b60c9480f123f2d
URL: https://github.com/llvm/llvm-project/commit/d8a2b295295e456a493166009b60c9480f123f2d
DIFF: https://github.com/llvm/llvm-project/commit/d8a2b295295e456a493166009b60c9480f123f2d.diff
LOG: [X86] Add test case for folding select on vXi1
Added:
llvm/test/CodeGen/X86/fold-select.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/fold-select.ll b/llvm/test/CodeGen/X86/fold-select.ll
new file mode 100644
index 000000000000..ed622d855880
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fold-select.ll
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=skx | FileCheck %s
+
+define <8 x float> @select_and_v8i1(<8 x i1> %a, <8 x i1> %b, <8 x i1> %c, <8 x float> %d) {
+; CHECK-LABEL: select_and_v8i1:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpsllw $15, %xmm2, %xmm4
+; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
+; CHECK-NEXT: vpmovw2m %xmm0, %k1
+; CHECK-NEXT: vpxor %xmm0, %xmm0, %xmm0
+; CHECK-NEXT: vpcmpgtw %xmm4, %xmm0, %k0 {%k1}
+; CHECK-NEXT: vpand %xmm1, %xmm2, %xmm0
+; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
+; CHECK-NEXT: vpmovw2m %xmm0, %k2
+; CHECK-NEXT: kandnb %k2, %k1, %k1
+; CHECK-NEXT: korb %k1, %k0, %k1
+; CHECK-NEXT: vbroadcastss {{.*#+}} ymm0 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0]
+; CHECK-NEXT: vmovaps %ymm3, %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %t2 = select <8 x i1> %a, <8 x i1> <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>, <8 x i1> %b
+ %t3 = and <8 x i1> %c, %t2
+ %t4= select <8 x i1> %t3, <8 x float> %d, <8 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
+ ret <8 x float> %t4
+}
+
+define <8 x float> @select_or_v8i1(<8 x i1> %a, <8 x i1> %b, <8 x i1> %c, <8 x float> %d) {
+; CHECK-LABEL: select_or_v8i1:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vpsllw $15, %xmm2, %xmm4
+; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
+; CHECK-NEXT: vpmovw2m %xmm0, %k1
+; CHECK-NEXT: vpxor %xmm0, %xmm0, %xmm0
+; CHECK-NEXT: vpcmpgtw %xmm4, %xmm0, %k0 {%k1}
+; CHECK-NEXT: vpor %xmm1, %xmm2, %xmm0
+; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
+; CHECK-NEXT: vpmovw2m %xmm0, %k2
+; CHECK-NEXT: kandnb %k2, %k1, %k1
+; CHECK-NEXT: korb %k1, %k0, %k1
+; CHECK-NEXT: vbroadcastss {{.*#+}} ymm0 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0]
+; CHECK-NEXT: vmovaps %ymm3, %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %t2 = select <8 x i1> %a, <8 x i1> <i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 0>, <8 x i1> %b
+ %t3 = or <8 x i1> %c, %t2
+ %t4= select <8 x i1> %t3, <8 x float> %d, <8 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
+ ret <8 x float> %t4
+}
More information about the llvm-commits
mailing list