1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s
4 ; CHECK: vpcmpeqb {{.*%k[0-7]}}
5 ; CHECK: vmovdqu8 {{.*}}%k1
7 define <64 x i8> @test1(<64 x i8> %x, <64 x i8> %y) nounwind {
8 %mask = icmp eq <64 x i8> %x, %y
9 %max = select <64 x i1> %mask, <64 x i8> %x, <64 x i8> %y
14 ; CHECK: vpcmpgtb {{.*%k[0-7]}}
15 ; CHECK: vmovdqu8 {{.*}}%k1
17 define <64 x i8> @test2(<64 x i8> %x, <64 x i8> %y, <64 x i8> %x1) nounwind {
18 %mask = icmp sgt <64 x i8> %x, %y
19 %max = select <64 x i1> %mask, <64 x i8> %x1, <64 x i8> %y
24 ; CHECK: vpcmplew {{.*%k[0-7]}}
27 define <32 x i16> @test3(<32 x i16> %x, <32 x i16> %y, <32 x i16> %x1) nounwind {
28 %mask = icmp sge <32 x i16> %x, %y
29 %max = select <32 x i1> %mask, <32 x i16> %x1, <32 x i16> %y
34 ; CHECK: vpcmpnleub {{.*%k[0-7]}}
35 ; CHECK: vmovdqu8 {{.*}}%k1
37 define <64 x i8> @test4(<64 x i8> %x, <64 x i8> %y, <64 x i8> %x1) nounwind {
38 %mask = icmp ugt <64 x i8> %x, %y
39 %max = select <64 x i1> %mask, <64 x i8> %x1, <64 x i8> %y
44 ; CHECK: vpcmpeqw (%rdi){{.*%k[0-7]}}
47 define <32 x i16> @test5(<32 x i16> %x, <32 x i16> %x1, <32 x i16>* %yp) nounwind {
48 %y = load <32 x i16>, <32 x i16>* %yp, align 4
49 %mask = icmp eq <32 x i16> %x, %y
50 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %x1
55 ; CHECK: vpcmpgtw (%rdi){{.*%k[0-7]}}
58 define <32 x i16> @test6(<32 x i16> %x, <32 x i16> %x1, <32 x i16>* %y.ptr) nounwind {
59 %y = load <32 x i16>, <32 x i16>* %y.ptr, align 4
60 %mask = icmp sgt <32 x i16> %x, %y
61 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %x1
66 ; CHECK: vpcmplew (%rdi){{.*%k[0-7]}}
69 define <32 x i16> @test7(<32 x i16> %x, <32 x i16> %x1, <32 x i16>* %y.ptr) nounwind {
70 %y = load <32 x i16>, <32 x i16>* %y.ptr, align 4
71 %mask = icmp sle <32 x i16> %x, %y
72 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %x1
77 ; CHECK: vpcmpleuw (%rdi){{.*%k[0-7]}}
80 define <32 x i16> @test8(<32 x i16> %x, <32 x i16> %x1, <32 x i16>* %y.ptr) nounwind {
81 %y = load <32 x i16>, <32 x i16>* %y.ptr, align 4
82 %mask = icmp ule <32 x i16> %x, %y
83 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %x1
88 ; CHECK: vpcmpeqw %zmm{{.*{%k[1-7]}}}
91 define <32 x i16> @test9(<32 x i16> %x, <32 x i16> %y, <32 x i16> %x1, <32 x i16> %y1) nounwind {
92 %mask1 = icmp eq <32 x i16> %x1, %y1
93 %mask0 = icmp eq <32 x i16> %x, %y
94 %mask = select <32 x i1> %mask0, <32 x i1> %mask1, <32 x i1> zeroinitializer
95 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %y
99 ; CHECK-LABEL: @test10
100 ; CHECK: vpcmpleb %zmm{{.*{%k[1-7]}}}
103 define <64 x i8> @test10(<64 x i8> %x, <64 x i8> %y, <64 x i8> %x1, <64 x i8> %y1) nounwind {
104 %mask1 = icmp sge <64 x i8> %x1, %y1
105 %mask0 = icmp sle <64 x i8> %x, %y
106 %mask = select <64 x i1> %mask0, <64 x i1> %mask1, <64 x i1> zeroinitializer
107 %max = select <64 x i1> %mask, <64 x i8> %x, <64 x i8> %x1
111 ; CHECK-LABEL: @test11
112 ; CHECK: vpcmpgtb (%rdi){{.*{%k[1-7]}}}
115 define <64 x i8> @test11(<64 x i8> %x, <64 x i8>* %y.ptr, <64 x i8> %x1, <64 x i8> %y1) nounwind {
116 %mask1 = icmp sgt <64 x i8> %x1, %y1
117 %y = load <64 x i8>, <64 x i8>* %y.ptr, align 4
118 %mask0 = icmp sgt <64 x i8> %x, %y
119 %mask = select <64 x i1> %mask0, <64 x i1> %mask1, <64 x i1> zeroinitializer
120 %max = select <64 x i1> %mask, <64 x i8> %x, <64 x i8> %x1
124 ; CHECK-LABEL: @test12
125 ; CHECK: vpcmpleuw (%rdi){{.*{%k[1-7]}}}
128 define <32 x i16> @test12(<32 x i16> %x, <32 x i16>* %y.ptr, <32 x i16> %x1, <32 x i16> %y1) nounwind {
129 %mask1 = icmp sge <32 x i16> %x1, %y1
130 %y = load <32 x i16>, <32 x i16>* %y.ptr, align 4
131 %mask0 = icmp ule <32 x i16> %x, %y
132 %mask = select <32 x i1> %mask0, <32 x i1> %mask1, <32 x i1> zeroinitializer
133 %max = select <32 x i1> %mask, <32 x i16> %x, <32 x i16> %x1