1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s
3 ; CHECK-LABEL: test256_1
4 ; CHECK: vpcmpeqb {{.*%k[0-7]}}
5 ; CHECK: vmovdqu8 {{.*}}%k1
7 define <32 x i8> @test256_1(<32 x i8> %x, <32 x i8> %y) nounwind {
8 %mask = icmp eq <32 x i8> %x, %y
9 %max = select <32 x i1> %mask, <32 x i8> %x, <32 x i8> %y
13 ; CHECK-LABEL: test256_2
14 ; CHECK: vpcmpgtb {{.*%k[0-7]}}
15 ; CHECK: vmovdqu8 {{.*}}%k1
17 define <32 x i8> @test256_2(<32 x i8> %x, <32 x i8> %y, <32 x i8> %x1) nounwind {
18 %mask = icmp sgt <32 x i8> %x, %y
19 %max = select <32 x i1> %mask, <32 x i8> %x, <32 x i8> %x1
23 ; CHECK-LABEL: @test256_3
24 ; CHECK: vpcmplew {{.*%k[0-7]}}
27 define <16 x i16> @test256_3(<16 x i16> %x, <16 x i16> %y, <16 x i16> %x1) nounwind {
28 %mask = icmp sge <16 x i16> %x, %y
29 %max = select <16 x i1> %mask, <16 x i16> %x1, <16 x i16> %y
33 ; CHECK-LABEL: test256_4
34 ; CHECK: vpcmpnleub {{.*%k[0-7]}}
35 ; CHECK: vmovdqu8 {{.*}}%k1
37 define <32 x i8> @test256_4(<32 x i8> %x, <32 x i8> %y, <32 x i8> %x1) nounwind {
38 %mask = icmp ugt <32 x i8> %x, %y
39 %max = select <32 x i1> %mask, <32 x i8> %x, <32 x i8> %x1
43 ; CHECK-LABEL: test256_5
44 ; CHECK: vpcmpeqw (%rdi){{.*%k[0-7]}}
47 define <16 x i16> @test256_5(<16 x i16> %x, <16 x i16> %x1, <16 x i16>* %yp) nounwind {
48 %y = load <16 x i16>* %yp, align 4
49 %mask = icmp eq <16 x i16> %x, %y
50 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %x1
54 ; CHECK-LABEL: @test256_6
55 ; CHECK: vpcmpgtw (%rdi){{.*%k[0-7]}}
58 define <16 x i16> @test256_6(<16 x i16> %x, <16 x i16> %x1, <16 x i16>* %y.ptr) nounwind {
59 %y = load <16 x i16>* %y.ptr, align 4
60 %mask = icmp sgt <16 x i16> %x, %y
61 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %x1
65 ; CHECK-LABEL: @test256_7
66 ; CHECK: vpcmplew (%rdi){{.*%k[0-7]}}
69 define <16 x i16> @test256_7(<16 x i16> %x, <16 x i16> %x1, <16 x i16>* %y.ptr) nounwind {
70 %y = load <16 x i16>* %y.ptr, align 4
71 %mask = icmp sle <16 x i16> %x, %y
72 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %x1
76 ; CHECK-LABEL: @test256_8
77 ; CHECK: vpcmpleuw (%rdi){{.*%k[0-7]}}
80 define <16 x i16> @test256_8(<16 x i16> %x, <16 x i16> %x1, <16 x i16>* %y.ptr) nounwind {
81 %y = load <16 x i16>* %y.ptr, align 4
82 %mask = icmp ule <16 x i16> %x, %y
83 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %x1
87 ; CHECK-LABEL: @test256_9
88 ; CHECK: vpcmpeqw %ymm{{.*{%k[1-7]}}}
91 define <16 x i16> @test256_9(<16 x i16> %x, <16 x i16> %y, <16 x i16> %x1, <16 x i16> %y1) nounwind {
92 %mask1 = icmp eq <16 x i16> %x1, %y1
93 %mask0 = icmp eq <16 x i16> %x, %y
94 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
95 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %y
99 ; CHECK-LABEL: @test256_10
100 ; CHECK: vpcmpleb %ymm{{.*{%k[1-7]}}}
103 define <32 x i8> @test256_10(<32 x i8> %x, <32 x i8> %y, <32 x i8> %x1, <32 x i8> %y1) nounwind {
104 %mask1 = icmp sge <32 x i8> %x1, %y1
105 %mask0 = icmp sle <32 x i8> %x, %y
106 %mask = select <32 x i1> %mask0, <32 x i1> %mask1, <32 x i1> zeroinitializer
107 %max = select <32 x i1> %mask, <32 x i8> %x, <32 x i8> %x1
111 ; CHECK-LABEL: @test256_11
112 ; CHECK: vpcmpgtb (%rdi){{.*{%k[1-7]}}}
115 define <32 x i8> @test256_11(<32 x i8> %x, <32 x i8>* %y.ptr, <32 x i8> %x1, <32 x i8> %y1) nounwind {
116 %mask1 = icmp sgt <32 x i8> %x1, %y1
117 %y = load <32 x i8>* %y.ptr, align 4
118 %mask0 = icmp sgt <32 x i8> %x, %y
119 %mask = select <32 x i1> %mask0, <32 x i1> %mask1, <32 x i1> zeroinitializer
120 %max = select <32 x i1> %mask, <32 x i8> %x, <32 x i8> %x1
124 ; CHECK-LABEL: @test256_12
125 ; CHECK: vpcmpleuw (%rdi){{.*{%k[1-7]}}}
128 define <16 x i16> @test256_12(<16 x i16> %x, <16 x i16>* %y.ptr, <16 x i16> %x1, <16 x i16> %y1) nounwind {
129 %mask1 = icmp sge <16 x i16> %x1, %y1
130 %y = load <16 x i16>* %y.ptr, align 4
131 %mask0 = icmp ule <16 x i16> %x, %y
132 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
133 %max = select <16 x i1> %mask, <16 x i16> %x, <16 x i16> %x1
137 ; CHECK-LABEL: test128_1
138 ; CHECK: vpcmpeqb {{.*%k[0-7]}}
139 ; CHECK: vmovdqu8 {{.*}}%k1
141 define <16 x i8> @test128_1(<16 x i8> %x, <16 x i8> %y) nounwind {
142 %mask = icmp eq <16 x i8> %x, %y
143 %max = select <16 x i1> %mask, <16 x i8> %x, <16 x i8> %y
147 ; CHECK-LABEL: test128_2
148 ; CHECK: vpcmpgtb {{.*%k[0-7]}}
149 ; CHECK: vmovdqu8 {{.*}}%k1
151 define <16 x i8> @test128_2(<16 x i8> %x, <16 x i8> %y, <16 x i8> %x1) nounwind {
152 %mask = icmp sgt <16 x i8> %x, %y
153 %max = select <16 x i1> %mask, <16 x i8> %x, <16 x i8> %x1
157 ; CHECK-LABEL: @test128_3
158 ; CHECK: vpcmplew {{.*%k[0-7]}}
161 define <8 x i16> @test128_3(<8 x i16> %x, <8 x i16> %y, <8 x i16> %x1) nounwind {
162 %mask = icmp sge <8 x i16> %x, %y
163 %max = select <8 x i1> %mask, <8 x i16> %x1, <8 x i16> %y
167 ; CHECK-LABEL: test128_4
168 ; CHECK: vpcmpnleub {{.*%k[0-7]}}
169 ; CHECK: vmovdqu8 {{.*}}%k1
171 define <16 x i8> @test128_4(<16 x i8> %x, <16 x i8> %y, <16 x i8> %x1) nounwind {
172 %mask = icmp ugt <16 x i8> %x, %y
173 %max = select <16 x i1> %mask, <16 x i8> %x, <16 x i8> %x1
177 ; CHECK-LABEL: test128_5
178 ; CHECK: vpcmpeqw (%rdi){{.*%k[0-7]}}
181 define <8 x i16> @test128_5(<8 x i16> %x, <8 x i16> %x1, <8 x i16>* %yp) nounwind {
182 %y = load <8 x i16>* %yp, align 4
183 %mask = icmp eq <8 x i16> %x, %y
184 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %x1
188 ; CHECK-LABEL: @test128_6
189 ; CHECK: vpcmpgtw (%rdi){{.*%k[0-7]}}
192 define <8 x i16> @test128_6(<8 x i16> %x, <8 x i16> %x1, <8 x i16>* %y.ptr) nounwind {
193 %y = load <8 x i16>* %y.ptr, align 4
194 %mask = icmp sgt <8 x i16> %x, %y
195 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %x1
199 ; CHECK-LABEL: @test128_7
200 ; CHECK: vpcmplew (%rdi){{.*%k[0-7]}}
203 define <8 x i16> @test128_7(<8 x i16> %x, <8 x i16> %x1, <8 x i16>* %y.ptr) nounwind {
204 %y = load <8 x i16>* %y.ptr, align 4
205 %mask = icmp sle <8 x i16> %x, %y
206 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %x1
210 ; CHECK-LABEL: @test128_8
211 ; CHECK: vpcmpleuw (%rdi){{.*%k[0-7]}}
214 define <8 x i16> @test128_8(<8 x i16> %x, <8 x i16> %x1, <8 x i16>* %y.ptr) nounwind {
215 %y = load <8 x i16>* %y.ptr, align 4
216 %mask = icmp ule <8 x i16> %x, %y
217 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %x1
221 ; CHECK-LABEL: @test128_9
222 ; CHECK: vpcmpeqw %xmm{{.*{%k[1-7]}}}
225 define <8 x i16> @test128_9(<8 x i16> %x, <8 x i16> %y, <8 x i16> %x1, <8 x i16> %y1) nounwind {
226 %mask1 = icmp eq <8 x i16> %x1, %y1
227 %mask0 = icmp eq <8 x i16> %x, %y
228 %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
229 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %y
233 ; CHECK-LABEL: @test128_10
234 ; CHECK: vpcmpleb %xmm{{.*{%k[1-7]}}}
237 define <16 x i8> @test128_10(<16 x i8> %x, <16 x i8> %y, <16 x i8> %x1, <16 x i8> %y1) nounwind {
238 %mask1 = icmp sge <16 x i8> %x1, %y1
239 %mask0 = icmp sle <16 x i8> %x, %y
240 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
241 %max = select <16 x i1> %mask, <16 x i8> %x, <16 x i8> %x1
245 ; CHECK-LABEL: @test128_11
246 ; CHECK: vpcmpgtb (%rdi){{.*{%k[1-7]}}}
249 define <16 x i8> @test128_11(<16 x i8> %x, <16 x i8>* %y.ptr, <16 x i8> %x1, <16 x i8> %y1) nounwind {
250 %mask1 = icmp sgt <16 x i8> %x1, %y1
251 %y = load <16 x i8>* %y.ptr, align 4
252 %mask0 = icmp sgt <16 x i8> %x, %y
253 %mask = select <16 x i1> %mask0, <16 x i1> %mask1, <16 x i1> zeroinitializer
254 %max = select <16 x i1> %mask, <16 x i8> %x, <16 x i8> %x1
258 ; CHECK-LABEL: @test128_12
259 ; CHECK: vpcmpleuw (%rdi){{.*{%k[1-7]}}}
262 define <8 x i16> @test128_12(<8 x i16> %x, <8 x i16>* %y.ptr, <8 x i16> %x1, <8 x i16> %y1) nounwind {
263 %mask1 = icmp sge <8 x i16> %x1, %y1
264 %y = load <8 x i16>* %y.ptr, align 4
265 %mask0 = icmp ule <8 x i16> %x, %y
266 %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
267 %max = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %x1