• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=VLX
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=NoVLX
4
5define <4 x i64> @test256_1(<4 x i64> %x, <4 x i64> %y) nounwind {
6; VLX-LABEL: test256_1:
7; VLX:       # %bb.0:
8; VLX-NEXT:    vpcmpeqq %ymm1, %ymm0, %k1
9; VLX-NEXT:    vpblendmq %ymm0, %ymm1, %ymm0 {%k1}
10; VLX-NEXT:    retq
11;
12; NoVLX-LABEL: test256_1:
13; NoVLX:       # %bb.0:
14; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
15; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
16; NoVLX-NEXT:    vpcmpeqq %zmm1, %zmm0, %k1
17; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
18; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
19; NoVLX-NEXT:    retq
20  %mask = icmp eq <4 x i64> %x, %y
21  %max = select <4 x i1> %mask, <4 x i64> %x, <4 x i64> %y
22  ret <4 x i64> %max
23}
24
25define <4 x i64> @test256_2(<4 x i64> %x, <4 x i64> %y, <4 x i64> %x1) nounwind {
26; VLX-LABEL: test256_2:
27; VLX:       # %bb.0:
28; VLX-NEXT:    vpcmpgtq %ymm1, %ymm0, %k1
29; VLX-NEXT:    vpblendmq %ymm2, %ymm1, %ymm0 {%k1}
30; VLX-NEXT:    retq
31;
32; NoVLX-LABEL: test256_2:
33; NoVLX:       # %bb.0:
34; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
35; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
36; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
37; NoVLX-NEXT:    vpcmpgtq %zmm1, %zmm0, %k1
38; NoVLX-NEXT:    vpblendmq %zmm2, %zmm1, %zmm0 {%k1}
39; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
40; NoVLX-NEXT:    retq
41  %mask = icmp sgt <4 x i64> %x, %y
42  %max = select <4 x i1> %mask, <4 x i64> %x1, <4 x i64> %y
43  ret <4 x i64> %max
44}
45
46define <8 x i32> @test256_3(<8 x i32> %x, <8 x i32> %y, <8 x i32> %x1) nounwind {
47; VLX-LABEL: test256_3:
48; VLX:       # %bb.0:
49; VLX-NEXT:    vpcmpnltd %ymm1, %ymm0, %k1
50; VLX-NEXT:    vpblendmd %ymm2, %ymm1, %ymm0 {%k1}
51; VLX-NEXT:    retq
52;
53; NoVLX-LABEL: test256_3:
54; NoVLX:       # %bb.0:
55; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
56; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
57; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
58; NoVLX-NEXT:    vpcmpnltd %zmm1, %zmm0, %k1
59; NoVLX-NEXT:    vpblendmd %zmm2, %zmm1, %zmm0 {%k1}
60; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
61; NoVLX-NEXT:    retq
62  %mask = icmp sge <8 x i32> %x, %y
63  %max = select <8 x i1> %mask, <8 x i32> %x1, <8 x i32> %y
64  ret <8 x i32> %max
65}
66
67define <4 x i64> @test256_4(<4 x i64> %x, <4 x i64> %y, <4 x i64> %x1) nounwind {
68; VLX-LABEL: test256_4:
69; VLX:       # %bb.0:
70; VLX-NEXT:    vpcmpnleuq %ymm1, %ymm0, %k1
71; VLX-NEXT:    vpblendmq %ymm2, %ymm1, %ymm0 {%k1}
72; VLX-NEXT:    retq
73;
74; NoVLX-LABEL: test256_4:
75; NoVLX:       # %bb.0:
76; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
77; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
78; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
79; NoVLX-NEXT:    vpcmpnleuq %zmm1, %zmm0, %k1
80; NoVLX-NEXT:    vpblendmq %zmm2, %zmm1, %zmm0 {%k1}
81; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
82; NoVLX-NEXT:    retq
83  %mask = icmp ugt <4 x i64> %x, %y
84  %max = select <4 x i1> %mask, <4 x i64> %x1, <4 x i64> %y
85  ret <4 x i64> %max
86}
87
88define <8 x i32> @test256_5(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
89; VLX-LABEL: test256_5:
90; VLX:       # %bb.0:
91; VLX-NEXT:    vpcmpeqd (%rdi), %ymm0, %k1
92; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
93; VLX-NEXT:    retq
94;
95; NoVLX-LABEL: test256_5:
96; NoVLX:       # %bb.0:
97; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
98; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
99; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
100; NoVLX-NEXT:    vpcmpeqd %zmm2, %zmm0, %k1
101; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
102; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
103; NoVLX-NEXT:    retq
104  %y = load <8 x i32>, <8 x i32>* %yp, align 4
105  %mask = icmp eq <8 x i32> %x, %y
106  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
107  ret <8 x i32> %max
108}
109
110define <8 x i32> @test256_5b(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
111; VLX-LABEL: test256_5b:
112; VLX:       # %bb.0:
113; VLX-NEXT:    vpcmpeqd (%rdi), %ymm0, %k1
114; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
115; VLX-NEXT:    retq
116;
117; NoVLX-LABEL: test256_5b:
118; NoVLX:       # %bb.0:
119; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
120; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
121; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
122; NoVLX-NEXT:    vpcmpeqd %zmm0, %zmm2, %k1
123; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
124; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
125; NoVLX-NEXT:    retq
126  %y = load <8 x i32>, <8 x i32>* %yp, align 4
127  %mask = icmp eq <8 x i32> %y, %x
128  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
129  ret <8 x i32> %max
130}
131
132define <8 x i32> @test256_6(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
133; VLX-LABEL: test256_6:
134; VLX:       # %bb.0:
135; VLX-NEXT:    vpcmpgtd (%rdi), %ymm0, %k1
136; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
137; VLX-NEXT:    retq
138;
139; NoVLX-LABEL: test256_6:
140; NoVLX:       # %bb.0:
141; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
142; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
143; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
144; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1
145; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
146; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
147; NoVLX-NEXT:    retq
148  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
149  %mask = icmp sgt <8 x i32> %x, %y
150  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
151  ret <8 x i32> %max
152}
153
154define <8 x i32> @test256_6b(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
155; VLX-LABEL: test256_6b:
156; VLX:       # %bb.0:
157; VLX-NEXT:    vpcmpgtd (%rdi), %ymm0, %k1
158; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
159; VLX-NEXT:    retq
160;
161; NoVLX-LABEL: test256_6b:
162; NoVLX:       # %bb.0:
163; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
164; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
165; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
166; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1
167; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
168; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
169; NoVLX-NEXT:    retq
170  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
171  %mask = icmp slt <8 x i32> %y, %x
172  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
173  ret <8 x i32> %max
174}
175
176define <8 x i32> @test256_7(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
177; VLX-LABEL: test256_7:
178; VLX:       # %bb.0:
179; VLX-NEXT:    vpcmpled (%rdi), %ymm0, %k1
180; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
181; VLX-NEXT:    retq
182;
183; NoVLX-LABEL: test256_7:
184; NoVLX:       # %bb.0:
185; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
186; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
187; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
188; NoVLX-NEXT:    vpcmpled %zmm2, %zmm0, %k1
189; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
190; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
191; NoVLX-NEXT:    retq
192  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
193  %mask = icmp sle <8 x i32> %x, %y
194  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
195  ret <8 x i32> %max
196}
197
198define <8 x i32> @test256_7b(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
199; VLX-LABEL: test256_7b:
200; VLX:       # %bb.0:
201; VLX-NEXT:    vpcmpled (%rdi), %ymm0, %k1
202; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
203; VLX-NEXT:    retq
204;
205; NoVLX-LABEL: test256_7b:
206; NoVLX:       # %bb.0:
207; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
208; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
209; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
210; NoVLX-NEXT:    vpcmpnltd %zmm0, %zmm2, %k1
211; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
212; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
213; NoVLX-NEXT:    retq
214  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
215  %mask = icmp sge <8 x i32> %y, %x
216  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
217  ret <8 x i32> %max
218}
219
220define <8 x i32> @test256_8(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
221; VLX-LABEL: test256_8:
222; VLX:       # %bb.0:
223; VLX-NEXT:    vpcmpleud (%rdi), %ymm0, %k1
224; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
225; VLX-NEXT:    retq
226;
227; NoVLX-LABEL: test256_8:
228; NoVLX:       # %bb.0:
229; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
230; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
231; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
232; NoVLX-NEXT:    vpcmpleud %zmm2, %zmm0, %k1
233; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
234; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
235; NoVLX-NEXT:    retq
236  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
237  %mask = icmp ule <8 x i32> %x, %y
238  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
239  ret <8 x i32> %max
240}
241
242define <8 x i32> @test256_8b(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %y.ptr) nounwind {
243; VLX-LABEL: test256_8b:
244; VLX:       # %bb.0:
245; VLX-NEXT:    vpcmpleud (%rdi), %ymm0, %k1
246; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
247; VLX-NEXT:    retq
248;
249; NoVLX-LABEL: test256_8b:
250; NoVLX:       # %bb.0:
251; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
252; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
253; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
254; NoVLX-NEXT:    vpcmpnltud %zmm0, %zmm2, %k1
255; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
256; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
257; NoVLX-NEXT:    retq
258  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
259  %mask = icmp uge <8 x i32> %y, %x
260  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
261  ret <8 x i32> %max
262}
263
264define <8 x i32> @test256_9(<8 x i32> %x, <8 x i32> %y, <8 x i32> %x1, <8 x i32> %y1) nounwind {
265; VLX-LABEL: test256_9:
266; VLX:       # %bb.0:
267; VLX-NEXT:    vpcmpeqd %ymm1, %ymm0, %k1
268; VLX-NEXT:    vpcmpeqd %ymm3, %ymm2, %k1 {%k1}
269; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
270; VLX-NEXT:    retq
271;
272; NoVLX-LABEL: test256_9:
273; NoVLX:       # %bb.0:
274; NoVLX-NEXT:    # kill: def $ymm3 killed $ymm3 def $zmm3
275; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
276; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
277; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
278; NoVLX-NEXT:    vpcmpeqd %zmm1, %zmm0, %k1
279; NoVLX-NEXT:    vpcmpeqd %zmm3, %zmm2, %k1 {%k1}
280; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
281; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
282; NoVLX-NEXT:    retq
283  %mask1 = icmp eq <8 x i32> %x1, %y1
284  %mask0 = icmp eq <8 x i32> %x, %y
285  %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
286  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %y
287  ret <8 x i32> %max
288}
289
290define <4 x i64> @test256_10(<4 x i64> %x, <4 x i64> %y, <4 x i64> %x1, <4 x i64> %y1) nounwind {
291; VLX-LABEL: test256_10:
292; VLX:       # %bb.0:
293; VLX-NEXT:    vpcmpleq %ymm1, %ymm0, %k1
294; VLX-NEXT:    vpcmpnltq %ymm3, %ymm2, %k1 {%k1}
295; VLX-NEXT:    vpblendmq %ymm0, %ymm2, %ymm0 {%k1}
296; VLX-NEXT:    retq
297;
298; NoVLX-LABEL: test256_10:
299; NoVLX:       # %bb.0:
300; NoVLX-NEXT:    # kill: def $ymm3 killed $ymm3 def $zmm3
301; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
302; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
303; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
304; NoVLX-NEXT:    vpcmpleq %zmm1, %zmm0, %k1
305; NoVLX-NEXT:    vpcmpnltq %zmm3, %zmm2, %k1 {%k1}
306; NoVLX-NEXT:    vpblendmq %zmm0, %zmm2, %zmm0 {%k1}
307; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
308; NoVLX-NEXT:    retq
309  %mask1 = icmp sge <4 x i64> %x1, %y1
310  %mask0 = icmp sle <4 x i64> %x, %y
311  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
312  %max = select <4 x i1> %mask, <4 x i64> %x, <4 x i64> %x1
313  ret <4 x i64> %max
314}
315
316define <4 x i64> @test256_11(<4 x i64> %x, <4 x i64>* %y.ptr, <4 x i64> %x1, <4 x i64> %y1) nounwind {
317; VLX-LABEL: test256_11:
318; VLX:       # %bb.0:
319; VLX-NEXT:    vpcmpgtq %ymm2, %ymm1, %k1
320; VLX-NEXT:    vpcmpgtq (%rdi), %ymm0, %k1 {%k1}
321; VLX-NEXT:    vpblendmq %ymm0, %ymm1, %ymm0 {%k1}
322; VLX-NEXT:    retq
323;
324; NoVLX-LABEL: test256_11:
325; NoVLX:       # %bb.0:
326; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
327; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
328; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
329; NoVLX-NEXT:    vmovdqu (%rdi), %ymm3
330; NoVLX-NEXT:    vpcmpgtq %zmm3, %zmm0, %k1
331; NoVLX-NEXT:    vpcmpgtq %zmm2, %zmm1, %k1 {%k1}
332; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
333; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
334; NoVLX-NEXT:    retq
335  %mask1 = icmp sgt <4 x i64> %x1, %y1
336  %y = load <4 x i64>, <4 x i64>* %y.ptr, align 4
337  %mask0 = icmp sgt <4 x i64> %x, %y
338  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
339  %max = select <4 x i1> %mask, <4 x i64> %x, <4 x i64> %x1
340  ret <4 x i64> %max
341}
342
343define <8 x i32> @test256_12(<8 x i32> %x, <8 x i32>* %y.ptr, <8 x i32> %x1, <8 x i32> %y1) nounwind {
344; VLX-LABEL: test256_12:
345; VLX:       # %bb.0:
346; VLX-NEXT:    vpcmpnltd %ymm2, %ymm1, %k1
347; VLX-NEXT:    vpcmpleud (%rdi), %ymm0, %k1 {%k1}
348; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
349; VLX-NEXT:    retq
350;
351; NoVLX-LABEL: test256_12:
352; NoVLX:       # %bb.0:
353; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
354; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
355; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
356; NoVLX-NEXT:    vmovdqu (%rdi), %ymm3
357; NoVLX-NEXT:    vpcmpleud %zmm3, %zmm0, %k1
358; NoVLX-NEXT:    vpcmpnltd %zmm2, %zmm1, %k1 {%k1}
359; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
360; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
361; NoVLX-NEXT:    retq
362  %mask1 = icmp sge <8 x i32> %x1, %y1
363  %y = load <8 x i32>, <8 x i32>* %y.ptr, align 4
364  %mask0 = icmp ule <8 x i32> %x, %y
365  %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
366  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
367  ret <8 x i32> %max
368}
369
370define <4 x i64> @test256_13(<4 x i64> %x, <4 x i64> %x1, i64* %yb.ptr) nounwind {
371; VLX-LABEL: test256_13:
372; VLX:       # %bb.0:
373; VLX-NEXT:    vpcmpeqq (%rdi){1to4}, %ymm0, %k1
374; VLX-NEXT:    vpblendmq %ymm0, %ymm1, %ymm0 {%k1}
375; VLX-NEXT:    retq
376;
377; NoVLX-LABEL: test256_13:
378; NoVLX:       # %bb.0:
379; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
380; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
381; NoVLX-NEXT:    vpbroadcastq (%rdi), %ymm2
382; NoVLX-NEXT:    vpcmpeqq %zmm2, %zmm0, %k1
383; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
384; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
385; NoVLX-NEXT:    retq
386  %yb = load i64, i64* %yb.ptr, align 4
387  %y.0 = insertelement <4 x i64> undef, i64 %yb, i32 0
388  %y = shufflevector <4 x i64> %y.0, <4 x i64> undef, <4 x i32> zeroinitializer
389  %mask = icmp eq <4 x i64> %x, %y
390  %max = select <4 x i1> %mask, <4 x i64> %x, <4 x i64> %x1
391  ret <4 x i64> %max
392}
393
394define <8 x i32> @test256_14(<8 x i32> %x, i32* %yb.ptr, <8 x i32> %x1) nounwind {
395; VLX-LABEL: test256_14:
396; VLX:       # %bb.0:
397; VLX-NEXT:    vpcmpled (%rdi){1to8}, %ymm0, %k1
398; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
399; VLX-NEXT:    retq
400;
401; NoVLX-LABEL: test256_14:
402; NoVLX:       # %bb.0:
403; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
404; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
405; NoVLX-NEXT:    vpbroadcastd (%rdi), %ymm2
406; NoVLX-NEXT:    vpcmpled %zmm2, %zmm0, %k1
407; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
408; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
409; NoVLX-NEXT:    retq
410  %yb = load i32, i32* %yb.ptr, align 4
411  %y.0 = insertelement <8 x i32> undef, i32 %yb, i32 0
412  %y = shufflevector <8 x i32> %y.0, <8 x i32> undef, <8 x i32> zeroinitializer
413  %mask = icmp sle <8 x i32> %x, %y
414  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
415  ret <8 x i32> %max
416}
417
418define <8 x i32> @test256_15(<8 x i32> %x, i32* %yb.ptr, <8 x i32> %x1, <8 x i32> %y1) nounwind {
419; VLX-LABEL: test256_15:
420; VLX:       # %bb.0:
421; VLX-NEXT:    vpcmpnltd %ymm2, %ymm1, %k1
422; VLX-NEXT:    vpcmpgtd (%rdi){1to8}, %ymm0, %k1 {%k1}
423; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
424; VLX-NEXT:    retq
425;
426; NoVLX-LABEL: test256_15:
427; NoVLX:       # %bb.0:
428; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
429; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
430; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
431; NoVLX-NEXT:    vpcmpnltd %zmm2, %zmm1, %k1
432; NoVLX-NEXT:    vpbroadcastd (%rdi), %ymm2
433; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1 {%k1}
434; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
435; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
436; NoVLX-NEXT:    retq
437  %mask1 = icmp sge <8 x i32> %x1, %y1
438  %yb = load i32, i32* %yb.ptr, align 4
439  %y.0 = insertelement <8 x i32> undef, i32 %yb, i32 0
440  %y = shufflevector <8 x i32> %y.0, <8 x i32> undef, <8 x i32> zeroinitializer
441  %mask0 = icmp sgt <8 x i32> %x, %y
442  %mask = select <8 x i1> %mask0, <8 x i1> %mask1, <8 x i1> zeroinitializer
443  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
444  ret <8 x i32> %max
445}
446
447define <4 x i64> @test256_16(<4 x i64> %x, i64* %yb.ptr, <4 x i64> %x1, <4 x i64> %y1) nounwind {
448; VLX-LABEL: test256_16:
449; VLX:       # %bb.0:
450; VLX-NEXT:    vpcmpnltq %ymm2, %ymm1, %k1
451; VLX-NEXT:    vpcmpgtq (%rdi){1to4}, %ymm0, %k1 {%k1}
452; VLX-NEXT:    vpblendmq %ymm0, %ymm1, %ymm0 {%k1}
453; VLX-NEXT:    retq
454;
455; NoVLX-LABEL: test256_16:
456; NoVLX:       # %bb.0:
457; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
458; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
459; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
460; NoVLX-NEXT:    vpcmpnltq %zmm2, %zmm1, %k1
461; NoVLX-NEXT:    vpbroadcastq (%rdi), %ymm2
462; NoVLX-NEXT:    vpcmpgtq %zmm2, %zmm0, %k1 {%k1}
463; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
464; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
465; NoVLX-NEXT:    retq
466  %mask1 = icmp sge <4 x i64> %x1, %y1
467  %yb = load i64, i64* %yb.ptr, align 4
468  %y.0 = insertelement <4 x i64> undef, i64 %yb, i32 0
469  %y = shufflevector <4 x i64> %y.0, <4 x i64> undef, <4 x i32> zeroinitializer
470  %mask0 = icmp sgt <4 x i64> %x, %y
471  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
472  %max = select <4 x i1> %mask, <4 x i64> %x, <4 x i64> %x1
473  ret <4 x i64> %max
474}
475
476define <8 x i32> @test256_17(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
477; VLX-LABEL: test256_17:
478; VLX:       # %bb.0:
479; VLX-NEXT:    vpcmpneqd (%rdi), %ymm0, %k1
480; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
481; VLX-NEXT:    retq
482;
483; NoVLX-LABEL: test256_17:
484; NoVLX:       # %bb.0:
485; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
486; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
487; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
488; NoVLX-NEXT:    vpcmpneqd %zmm2, %zmm0, %k1
489; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
490; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
491; NoVLX-NEXT:    retq
492  %y = load <8 x i32>, <8 x i32>* %yp, align 4
493  %mask = icmp ne <8 x i32> %x, %y
494  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
495  ret <8 x i32> %max
496}
497
498define <8 x i32> @test256_18(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
499; VLX-LABEL: test256_18:
500; VLX:       # %bb.0:
501; VLX-NEXT:    vpcmpneqd (%rdi), %ymm0, %k1
502; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
503; VLX-NEXT:    retq
504;
505; NoVLX-LABEL: test256_18:
506; NoVLX:       # %bb.0:
507; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
508; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
509; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
510; NoVLX-NEXT:    vpcmpneqd %zmm0, %zmm2, %k1
511; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
512; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
513; NoVLX-NEXT:    retq
514  %y = load <8 x i32>, <8 x i32>* %yp, align 4
515  %mask = icmp ne <8 x i32> %y, %x
516  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
517  ret <8 x i32> %max
518}
519
520define <8 x i32> @test256_19(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
521; VLX-LABEL: test256_19:
522; VLX:       # %bb.0:
523; VLX-NEXT:    vpcmpnltud (%rdi), %ymm0, %k1
524; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
525; VLX-NEXT:    retq
526;
527; NoVLX-LABEL: test256_19:
528; NoVLX:       # %bb.0:
529; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
530; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
531; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
532; NoVLX-NEXT:    vpcmpnltud %zmm2, %zmm0, %k1
533; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
534; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
535; NoVLX-NEXT:    retq
536  %y = load <8 x i32>, <8 x i32>* %yp, align 4
537  %mask = icmp uge <8 x i32> %x, %y
538  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
539  ret <8 x i32> %max
540}
541
542define <8 x i32> @test256_20(<8 x i32> %x, <8 x i32> %x1, <8 x i32>* %yp) nounwind {
543; VLX-LABEL: test256_20:
544; VLX:       # %bb.0:
545; VLX-NEXT:    vpcmpleud (%rdi), %ymm0, %k1
546; VLX-NEXT:    vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
547; VLX-NEXT:    retq
548;
549; NoVLX-LABEL: test256_20:
550; NoVLX:       # %bb.0:
551; NoVLX-NEXT:    # kill: def $ymm1 killed $ymm1 def $zmm1
552; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 def $zmm0
553; NoVLX-NEXT:    vmovdqu (%rdi), %ymm2
554; NoVLX-NEXT:    vpcmpnltud %zmm0, %zmm2, %k1
555; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
556; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
557; NoVLX-NEXT:    retq
558  %y = load <8 x i32>, <8 x i32>* %yp, align 4
559  %mask = icmp uge <8 x i32> %y, %x
560  %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %x1
561  ret <8 x i32> %max
562}
563
564define <2 x i64> @test128_1(<2 x i64> %x, <2 x i64> %y) nounwind {
565; VLX-LABEL: test128_1:
566; VLX:       # %bb.0:
567; VLX-NEXT:    vpcmpeqq %xmm1, %xmm0, %k1
568; VLX-NEXT:    vpblendmq %xmm0, %xmm1, %xmm0 {%k1}
569; VLX-NEXT:    retq
570;
571; NoVLX-LABEL: test128_1:
572; NoVLX:       # %bb.0:
573; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
574; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
575; NoVLX-NEXT:    vpcmpeqq %zmm1, %zmm0, %k1
576; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
577; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
578; NoVLX-NEXT:    retq
579  %mask = icmp eq <2 x i64> %x, %y
580  %max = select <2 x i1> %mask, <2 x i64> %x, <2 x i64> %y
581  ret <2 x i64> %max
582}
583
584define <2 x i64> @test128_2(<2 x i64> %x, <2 x i64> %y, <2 x i64> %x1) nounwind {
585; VLX-LABEL: test128_2:
586; VLX:       # %bb.0:
587; VLX-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
588; VLX-NEXT:    vpblendmq %xmm2, %xmm1, %xmm0 {%k1}
589; VLX-NEXT:    retq
590;
591; NoVLX-LABEL: test128_2:
592; NoVLX:       # %bb.0:
593; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
594; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
595; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
596; NoVLX-NEXT:    vpcmpgtq %zmm1, %zmm0, %k1
597; NoVLX-NEXT:    vpblendmq %zmm2, %zmm1, %zmm0 {%k1}
598; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
599; NoVLX-NEXT:    retq
600  %mask = icmp sgt <2 x i64> %x, %y
601  %max = select <2 x i1> %mask, <2 x i64> %x1, <2 x i64> %y
602  ret <2 x i64> %max
603}
604
605define <4 x i32> @test128_3(<4 x i32> %x, <4 x i32> %y, <4 x i32> %x1) nounwind {
606; VLX-LABEL: test128_3:
607; VLX:       # %bb.0:
608; VLX-NEXT:    vpcmpnltd %xmm1, %xmm0, %k1
609; VLX-NEXT:    vpblendmd %xmm2, %xmm1, %xmm0 {%k1}
610; VLX-NEXT:    retq
611;
612; NoVLX-LABEL: test128_3:
613; NoVLX:       # %bb.0:
614; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
615; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
616; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
617; NoVLX-NEXT:    vpcmpnltd %zmm1, %zmm0, %k1
618; NoVLX-NEXT:    vpblendmd %zmm2, %zmm1, %zmm0 {%k1}
619; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
620; NoVLX-NEXT:    retq
621  %mask = icmp sge <4 x i32> %x, %y
622  %max = select <4 x i1> %mask, <4 x i32> %x1, <4 x i32> %y
623  ret <4 x i32> %max
624}
625
626define <2 x i64> @test128_4(<2 x i64> %x, <2 x i64> %y, <2 x i64> %x1) nounwind {
627; VLX-LABEL: test128_4:
628; VLX:       # %bb.0:
629; VLX-NEXT:    vpcmpnleuq %xmm1, %xmm0, %k1
630; VLX-NEXT:    vpblendmq %xmm2, %xmm1, %xmm0 {%k1}
631; VLX-NEXT:    retq
632;
633; NoVLX-LABEL: test128_4:
634; NoVLX:       # %bb.0:
635; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
636; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
637; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
638; NoVLX-NEXT:    vpcmpnleuq %zmm1, %zmm0, %k1
639; NoVLX-NEXT:    vpblendmq %zmm2, %zmm1, %zmm0 {%k1}
640; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
641; NoVLX-NEXT:    retq
642  %mask = icmp ugt <2 x i64> %x, %y
643  %max = select <2 x i1> %mask, <2 x i64> %x1, <2 x i64> %y
644  ret <2 x i64> %max
645}
646
647define <4 x i32> @test128_5(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %yp) nounwind {
648; VLX-LABEL: test128_5:
649; VLX:       # %bb.0:
650; VLX-NEXT:    vpcmpeqd (%rdi), %xmm0, %k1
651; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
652; VLX-NEXT:    retq
653;
654; NoVLX-LABEL: test128_5:
655; NoVLX:       # %bb.0:
656; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
657; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
658; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
659; NoVLX-NEXT:    vpcmpeqd %zmm2, %zmm0, %k1
660; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
661; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
662; NoVLX-NEXT:    retq
663  %y = load <4 x i32>, <4 x i32>* %yp, align 4
664  %mask = icmp eq <4 x i32> %x, %y
665  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
666  ret <4 x i32> %max
667}
668
669define <4 x i32> @test128_5b(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %yp) nounwind {
670; VLX-LABEL: test128_5b:
671; VLX:       # %bb.0:
672; VLX-NEXT:    vpcmpeqd (%rdi), %xmm0, %k1
673; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
674; VLX-NEXT:    retq
675;
676; NoVLX-LABEL: test128_5b:
677; NoVLX:       # %bb.0:
678; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
679; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
680; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
681; NoVLX-NEXT:    vpcmpeqd %zmm0, %zmm2, %k1
682; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
683; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
684; NoVLX-NEXT:    retq
685  %y = load <4 x i32>, <4 x i32>* %yp, align 4
686  %mask = icmp eq <4 x i32> %y, %x
687  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
688  ret <4 x i32> %max
689}
690
691define <4 x i32> @test128_6(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
692; VLX-LABEL: test128_6:
693; VLX:       # %bb.0:
694; VLX-NEXT:    vpcmpgtd (%rdi), %xmm0, %k1
695; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
696; VLX-NEXT:    retq
697;
698; NoVLX-LABEL: test128_6:
699; NoVLX:       # %bb.0:
700; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
701; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
702; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
703; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1
704; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
705; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
706; NoVLX-NEXT:    retq
707  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
708  %mask = icmp sgt <4 x i32> %x, %y
709  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
710  ret <4 x i32> %max
711}
712
713define <4 x i32> @test128_6b(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
714; VLX-LABEL: test128_6b:
715; VLX:       # %bb.0:
716; VLX-NEXT:    vpcmpgtd (%rdi), %xmm0, %k1
717; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
718; VLX-NEXT:    retq
719;
720; NoVLX-LABEL: test128_6b:
721; NoVLX:       # %bb.0:
722; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
723; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
724; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
725; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1
726; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
727; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
728; NoVLX-NEXT:    retq
729  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
730  %mask = icmp slt <4 x i32> %y, %x
731  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
732  ret <4 x i32> %max
733}
734
735define <4 x i32> @test128_7(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
736; VLX-LABEL: test128_7:
737; VLX:       # %bb.0:
738; VLX-NEXT:    vpcmpled (%rdi), %xmm0, %k1
739; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
740; VLX-NEXT:    retq
741;
742; NoVLX-LABEL: test128_7:
743; NoVLX:       # %bb.0:
744; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
745; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
746; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
747; NoVLX-NEXT:    vpcmpled %zmm2, %zmm0, %k1
748; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
749; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
750; NoVLX-NEXT:    retq
751  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
752  %mask = icmp sle <4 x i32> %x, %y
753  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
754  ret <4 x i32> %max
755}
756
757define <4 x i32> @test128_7b(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
758; VLX-LABEL: test128_7b:
759; VLX:       # %bb.0:
760; VLX-NEXT:    vpcmpled (%rdi), %xmm0, %k1
761; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
762; VLX-NEXT:    retq
763;
764; NoVLX-LABEL: test128_7b:
765; NoVLX:       # %bb.0:
766; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
767; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
768; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
769; NoVLX-NEXT:    vpcmpnltd %zmm0, %zmm2, %k1
770; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
771; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
772; NoVLX-NEXT:    retq
773  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
774  %mask = icmp sge <4 x i32> %y, %x
775  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
776  ret <4 x i32> %max
777}
778
779define <4 x i32> @test128_8(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
780; VLX-LABEL: test128_8:
781; VLX:       # %bb.0:
782; VLX-NEXT:    vpcmpleud (%rdi), %xmm0, %k1
783; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
784; VLX-NEXT:    retq
785;
786; NoVLX-LABEL: test128_8:
787; NoVLX:       # %bb.0:
788; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
789; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
790; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
791; NoVLX-NEXT:    vpcmpleud %zmm2, %zmm0, %k1
792; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
793; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
794; NoVLX-NEXT:    retq
795  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
796  %mask = icmp ule <4 x i32> %x, %y
797  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
798  ret <4 x i32> %max
799}
800
801define <4 x i32> @test128_8b(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
802; VLX-LABEL: test128_8b:
803; VLX:       # %bb.0:
804; VLX-NEXT:    vpcmpleud (%rdi), %xmm0, %k1
805; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
806; VLX-NEXT:    retq
807;
808; NoVLX-LABEL: test128_8b:
809; NoVLX:       # %bb.0:
810; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
811; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
812; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
813; NoVLX-NEXT:    vpcmpnltud %zmm0, %zmm2, %k1
814; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
815; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
816; NoVLX-NEXT:    retq
817  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
818  %mask = icmp uge <4 x i32> %y, %x
819  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
820  ret <4 x i32> %max
821}
822
823define <4 x i32> @test128_9(<4 x i32> %x, <4 x i32> %y, <4 x i32> %x1, <4 x i32> %y1) nounwind {
824; VLX-LABEL: test128_9:
825; VLX:       # %bb.0:
826; VLX-NEXT:    vpcmpeqd %xmm1, %xmm0, %k1
827; VLX-NEXT:    vpcmpeqd %xmm3, %xmm2, %k1 {%k1}
828; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
829; VLX-NEXT:    retq
830;
831; NoVLX-LABEL: test128_9:
832; NoVLX:       # %bb.0:
833; NoVLX-NEXT:    # kill: def $xmm3 killed $xmm3 def $zmm3
834; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
835; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
836; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
837; NoVLX-NEXT:    vpcmpeqd %zmm1, %zmm0, %k1
838; NoVLX-NEXT:    vpcmpeqd %zmm3, %zmm2, %k1 {%k1}
839; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
840; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
841; NoVLX-NEXT:    retq
842  %mask1 = icmp eq <4 x i32> %x1, %y1
843  %mask0 = icmp eq <4 x i32> %x, %y
844  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
845  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %y
846  ret <4 x i32> %max
847}
848
849define <2 x i64> @test128_10(<2 x i64> %x, <2 x i64> %y, <2 x i64> %x1, <2 x i64> %y1) nounwind {
850; VLX-LABEL: test128_10:
851; VLX:       # %bb.0:
852; VLX-NEXT:    vpcmpleq %xmm1, %xmm0, %k1
853; VLX-NEXT:    vpcmpnltq %xmm3, %xmm2, %k1 {%k1}
854; VLX-NEXT:    vpblendmq %xmm0, %xmm2, %xmm0 {%k1}
855; VLX-NEXT:    retq
856;
857; NoVLX-LABEL: test128_10:
858; NoVLX:       # %bb.0:
859; NoVLX-NEXT:    # kill: def $xmm3 killed $xmm3 def $zmm3
860; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
861; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
862; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
863; NoVLX-NEXT:    vpcmpleq %zmm1, %zmm0, %k1
864; NoVLX-NEXT:    vpcmpnltq %zmm3, %zmm2, %k1 {%k1}
865; NoVLX-NEXT:    vpblendmq %zmm0, %zmm2, %zmm0 {%k1}
866; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
867; NoVLX-NEXT:    retq
868  %mask1 = icmp sge <2 x i64> %x1, %y1
869  %mask0 = icmp sle <2 x i64> %x, %y
870  %mask = select <2 x i1> %mask0, <2 x i1> %mask1, <2 x i1> zeroinitializer
871  %max = select <2 x i1> %mask, <2 x i64> %x, <2 x i64> %x1
872  ret <2 x i64> %max
873}
874
875define <2 x i64> @test128_11(<2 x i64> %x, <2 x i64>* %y.ptr, <2 x i64> %x1, <2 x i64> %y1) nounwind {
876; VLX-LABEL: test128_11:
877; VLX:       # %bb.0:
878; VLX-NEXT:    vpcmpgtq %xmm2, %xmm1, %k1
879; VLX-NEXT:    vpcmpgtq (%rdi), %xmm0, %k1 {%k1}
880; VLX-NEXT:    vpblendmq %xmm0, %xmm1, %xmm0 {%k1}
881; VLX-NEXT:    retq
882;
883; NoVLX-LABEL: test128_11:
884; NoVLX:       # %bb.0:
885; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
886; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
887; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
888; NoVLX-NEXT:    vmovdqu (%rdi), %xmm3
889; NoVLX-NEXT:    vpcmpgtq %zmm3, %zmm0, %k1
890; NoVLX-NEXT:    vpcmpgtq %zmm2, %zmm1, %k1 {%k1}
891; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
892; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
893; NoVLX-NEXT:    retq
894  %mask1 = icmp sgt <2 x i64> %x1, %y1
895  %y = load <2 x i64>, <2 x i64>* %y.ptr, align 4
896  %mask0 = icmp sgt <2 x i64> %x, %y
897  %mask = select <2 x i1> %mask0, <2 x i1> %mask1, <2 x i1> zeroinitializer
898  %max = select <2 x i1> %mask, <2 x i64> %x, <2 x i64> %x1
899  ret <2 x i64> %max
900}
901
902define <4 x i32> @test128_12(<4 x i32> %x, <4 x i32>* %y.ptr, <4 x i32> %x1, <4 x i32> %y1) nounwind {
903; VLX-LABEL: test128_12:
904; VLX:       # %bb.0:
905; VLX-NEXT:    vpcmpnltd %xmm2, %xmm1, %k1
906; VLX-NEXT:    vpcmpleud (%rdi), %xmm0, %k1 {%k1}
907; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
908; VLX-NEXT:    retq
909;
910; NoVLX-LABEL: test128_12:
911; NoVLX:       # %bb.0:
912; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
913; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
914; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
915; NoVLX-NEXT:    vmovdqu (%rdi), %xmm3
916; NoVLX-NEXT:    vpcmpleud %zmm3, %zmm0, %k1
917; NoVLX-NEXT:    vpcmpnltd %zmm2, %zmm1, %k1 {%k1}
918; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
919; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
920; NoVLX-NEXT:    retq
921  %mask1 = icmp sge <4 x i32> %x1, %y1
922  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
923  %mask0 = icmp ule <4 x i32> %x, %y
924  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
925  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
926  ret <4 x i32> %max
927}
928
929define <2 x i64> @test128_13(<2 x i64> %x, <2 x i64> %x1, i64* %yb.ptr) nounwind {
930; VLX-LABEL: test128_13:
931; VLX:       # %bb.0:
932; VLX-NEXT:    vpcmpeqq (%rdi){1to2}, %xmm0, %k1
933; VLX-NEXT:    vpblendmq %xmm0, %xmm1, %xmm0 {%k1}
934; VLX-NEXT:    retq
935;
936; NoVLX-LABEL: test128_13:
937; NoVLX:       # %bb.0:
938; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
939; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
940; NoVLX-NEXT:    vpbroadcastq (%rdi), %xmm2
941; NoVLX-NEXT:    vpcmpeqq %zmm2, %zmm0, %k1
942; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
943; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
944; NoVLX-NEXT:    retq
945  %yb = load i64, i64* %yb.ptr, align 4
946  %y.0 = insertelement <2 x i64> undef, i64 %yb, i32 0
947  %y = insertelement <2 x i64> %y.0, i64 %yb, i32 1
948  %mask = icmp eq <2 x i64> %x, %y
949  %max = select <2 x i1> %mask, <2 x i64> %x, <2 x i64> %x1
950  ret <2 x i64> %max
951}
952
953define <4 x i32> @test128_14(<4 x i32> %x, i32* %yb.ptr, <4 x i32> %x1) nounwind {
954; VLX-LABEL: test128_14:
955; VLX:       # %bb.0:
956; VLX-NEXT:    vpcmpled (%rdi){1to4}, %xmm0, %k1
957; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
958; VLX-NEXT:    retq
959;
960; NoVLX-LABEL: test128_14:
961; NoVLX:       # %bb.0:
962; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
963; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
964; NoVLX-NEXT:    vpbroadcastd (%rdi), %xmm2
965; NoVLX-NEXT:    vpcmpled %zmm2, %zmm0, %k1
966; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
967; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
968; NoVLX-NEXT:    retq
969  %yb = load i32, i32* %yb.ptr, align 4
970  %y.0 = insertelement <4 x i32> undef, i32 %yb, i32 0
971  %y = shufflevector <4 x i32> %y.0, <4 x i32> undef, <4 x i32> zeroinitializer
972  %mask = icmp sle <4 x i32> %x, %y
973  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
974  ret <4 x i32> %max
975}
976
977define <4 x i32> @test128_15(<4 x i32> %x, i32* %yb.ptr, <4 x i32> %x1, <4 x i32> %y1) nounwind {
978; VLX-LABEL: test128_15:
979; VLX:       # %bb.0:
980; VLX-NEXT:    vpcmpnltd %xmm2, %xmm1, %k1
981; VLX-NEXT:    vpcmpgtd (%rdi){1to4}, %xmm0, %k1 {%k1}
982; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
983; VLX-NEXT:    retq
984;
985; NoVLX-LABEL: test128_15:
986; NoVLX:       # %bb.0:
987; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
988; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
989; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
990; NoVLX-NEXT:    vpcmpnltd %zmm2, %zmm1, %k1
991; NoVLX-NEXT:    vpbroadcastd (%rdi), %xmm2
992; NoVLX-NEXT:    vpcmpgtd %zmm2, %zmm0, %k1 {%k1}
993; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
994; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
995; NoVLX-NEXT:    retq
996  %mask1 = icmp sge <4 x i32> %x1, %y1
997  %yb = load i32, i32* %yb.ptr, align 4
998  %y.0 = insertelement <4 x i32> undef, i32 %yb, i32 0
999  %y = shufflevector <4 x i32> %y.0, <4 x i32> undef, <4 x i32> zeroinitializer
1000  %mask0 = icmp sgt <4 x i32> %x, %y
1001  %mask = select <4 x i1> %mask0, <4 x i1> %mask1, <4 x i1> zeroinitializer
1002  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
1003  ret <4 x i32> %max
1004}
1005
1006define <2 x i64> @test128_16(<2 x i64> %x, i64* %yb.ptr, <2 x i64> %x1, <2 x i64> %y1) nounwind {
1007; VLX-LABEL: test128_16:
1008; VLX:       # %bb.0:
1009; VLX-NEXT:    vpcmpnltq %xmm2, %xmm1, %k1
1010; VLX-NEXT:    vpcmpgtq (%rdi){1to2}, %xmm0, %k1 {%k1}
1011; VLX-NEXT:    vpblendmq %xmm0, %xmm1, %xmm0 {%k1}
1012; VLX-NEXT:    retq
1013;
1014; NoVLX-LABEL: test128_16:
1015; NoVLX:       # %bb.0:
1016; NoVLX-NEXT:    # kill: def $xmm2 killed $xmm2 def $zmm2
1017; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
1018; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1019; NoVLX-NEXT:    vpcmpnltq %zmm2, %zmm1, %k1
1020; NoVLX-NEXT:    vpbroadcastq (%rdi), %xmm2
1021; NoVLX-NEXT:    vpcmpgtq %zmm2, %zmm0, %k1 {%k1}
1022; NoVLX-NEXT:    vpblendmq %zmm0, %zmm1, %zmm0 {%k1}
1023; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
1024; NoVLX-NEXT:    retq
1025  %mask1 = icmp sge <2 x i64> %x1, %y1
1026  %yb = load i64, i64* %yb.ptr, align 4
1027  %y.0 = insertelement <2 x i64> undef, i64 %yb, i32 0
1028  %y = insertelement <2 x i64> %y.0, i64 %yb, i32 1
1029  %mask0 = icmp sgt <2 x i64> %x, %y
1030  %mask = select <2 x i1> %mask0, <2 x i1> %mask1, <2 x i1> zeroinitializer
1031  %max = select <2 x i1> %mask, <2 x i64> %x, <2 x i64> %x1
1032  ret <2 x i64> %max
1033}
1034
1035define <4 x i32> @test128_17(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
1036; VLX-LABEL: test128_17:
1037; VLX:       # %bb.0:
1038; VLX-NEXT:    vpcmpneqd (%rdi), %xmm0, %k1
1039; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
1040; VLX-NEXT:    retq
1041;
1042; NoVLX-LABEL: test128_17:
1043; NoVLX:       # %bb.0:
1044; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
1045; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1046; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
1047; NoVLX-NEXT:    vpcmpneqd %zmm2, %zmm0, %k1
1048; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
1049; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
1050; NoVLX-NEXT:    retq
1051  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
1052  %mask = icmp ne <4 x i32> %x, %y
1053  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
1054  ret <4 x i32> %max
1055}
1056
1057define <4 x i32> @test128_18(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
1058; VLX-LABEL: test128_18:
1059; VLX:       # %bb.0:
1060; VLX-NEXT:    vpcmpneqd (%rdi), %xmm0, %k1
1061; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
1062; VLX-NEXT:    retq
1063;
1064; NoVLX-LABEL: test128_18:
1065; NoVLX:       # %bb.0:
1066; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
1067; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1068; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
1069; NoVLX-NEXT:    vpcmpneqd %zmm0, %zmm2, %k1
1070; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
1071; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
1072; NoVLX-NEXT:    retq
1073  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
1074  %mask = icmp ne <4 x i32> %y, %x
1075  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
1076  ret <4 x i32> %max
1077}
1078
1079define <4 x i32> @test128_19(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
1080; VLX-LABEL: test128_19:
1081; VLX:       # %bb.0:
1082; VLX-NEXT:    vpcmpnltud (%rdi), %xmm0, %k1
1083; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
1084; VLX-NEXT:    retq
1085;
1086; NoVLX-LABEL: test128_19:
1087; NoVLX:       # %bb.0:
1088; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
1089; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1090; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
1091; NoVLX-NEXT:    vpcmpnltud %zmm2, %zmm0, %k1
1092; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
1093; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
1094; NoVLX-NEXT:    retq
1095  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
1096  %mask = icmp uge <4 x i32> %x, %y
1097  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
1098  ret <4 x i32> %max
1099}
1100
1101define <4 x i32> @test128_20(<4 x i32> %x, <4 x i32> %x1, <4 x i32>* %y.ptr) nounwind {
1102; VLX-LABEL: test128_20:
1103; VLX:       # %bb.0:
1104; VLX-NEXT:    vpcmpleud (%rdi), %xmm0, %k1
1105; VLX-NEXT:    vpblendmd %xmm0, %xmm1, %xmm0 {%k1}
1106; VLX-NEXT:    retq
1107;
1108; NoVLX-LABEL: test128_20:
1109; NoVLX:       # %bb.0:
1110; NoVLX-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
1111; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
1112; NoVLX-NEXT:    vmovdqu (%rdi), %xmm2
1113; NoVLX-NEXT:    vpcmpnltud %zmm0, %zmm2, %k1
1114; NoVLX-NEXT:    vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
1115; NoVLX-NEXT:    # kill: def $xmm0 killed $xmm0 killed $zmm0
1116; NoVLX-NEXT:    retq
1117  %y = load <4 x i32>, <4 x i32>* %y.ptr, align 4
1118  %mask = icmp uge <4 x i32> %y, %x
1119  %max = select <4 x i1> %mask, <4 x i32> %x, <4 x i32> %x1
1120  ret <4 x i32> %max
1121}
1122
1123define <8 x i32> @testnm_and(<8 x i32> %a, <8 x i32> %b, <8 x i32> %x, <8 x i32> %y) {
1124; VLX-LABEL: testnm_and:
1125; VLX:       # %bb.0:
1126; VLX-NEXT:    vpor %ymm1, %ymm0, %ymm0
1127; VLX-NEXT:    vptestnmd %ymm0, %ymm0, %k1
1128; VLX-NEXT:    vpblendmd %ymm2, %ymm3, %ymm0 {%k1}
1129; VLX-NEXT:    retq
1130;
1131; NoVLX-LABEL: testnm_and:
1132; NoVLX:       # %bb.0:
1133; NoVLX-NEXT:    # kill: def $ymm3 killed $ymm3 def $zmm3
1134; NoVLX-NEXT:    # kill: def $ymm2 killed $ymm2 def $zmm2
1135; NoVLX-NEXT:    vpor %ymm1, %ymm0, %ymm0
1136; NoVLX-NEXT:    vptestnmd %zmm0, %zmm0, %k1
1137; NoVLX-NEXT:    vpblendmd %zmm2, %zmm3, %zmm0 {%k1}
1138; NoVLX-NEXT:    # kill: def $ymm0 killed $ymm0 killed $zmm0
1139; NoVLX-NEXT:    retq
1140  %c = icmp eq <8 x i32> %a, zeroinitializer
1141  %d = icmp eq <8 x i32> %b, zeroinitializer
1142  %e = and <8 x i1> %c, %d
1143  %z = select <8 x i1> %e, <8 x i32> %x, <8 x i32> %y
1144  ret <8 x i32> %z
1145}
1146