1 ; RUN: llc -aarch64-sve-vector-bits-min=128 -asm-verbose=0 < %s | FileCheck %s -check-prefix=NO_SVE
2 ; RUN: llc -aarch64-sve-vector-bits-min=256 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_EQ_256
3 ; RUN: llc -aarch64-sve-vector-bits-min=384 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK
4 ; RUN: llc -aarch64-sve-vector-bits-min=512 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
5 ; RUN: llc -aarch64-sve-vector-bits-min=640 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
6 ; RUN: llc -aarch64-sve-vector-bits-min=768 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
7 ; RUN: llc -aarch64-sve-vector-bits-min=896 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
8 ; RUN: llc -aarch64-sve-vector-bits-min=1024 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
9 ; RUN: llc -aarch64-sve-vector-bits-min=1152 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
10 ; RUN: llc -aarch64-sve-vector-bits-min=1280 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
11 ; RUN: llc -aarch64-sve-vector-bits-min=1408 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
12 ; RUN: llc -aarch64-sve-vector-bits-min=1536 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
13 ; RUN: llc -aarch64-sve-vector-bits-min=1664 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
14 ; RUN: llc -aarch64-sve-vector-bits-min=1792 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
15 ; RUN: llc -aarch64-sve-vector-bits-min=1920 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
16 ; RUN: llc -aarch64-sve-vector-bits-min=2048 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024,VBITS_GE_2048
18 target triple = "aarch64-unknown-linux-gnu"
20 ; Don't use SVE when its registers are no bigger than NEON.
27 ; Don't use SVE for 64-bit vectors.
28 define <8 x i8> @icmp_eq_v8i8(<8 x i8> %op1, <8 x i8> %op2) #0 {
29 ; CHECK-LABEL: icmp_eq_v8i8:
30 ; CHECK: cmeq v0.8b, v0.8b, v1.8b
32 %cmp = icmp eq <8 x i8> %op1, %op2
33 %sext = sext <8 x i1> %cmp to <8 x i8>
37 ; Don't use SVE for 128-bit vectors.
38 define <16 x i8> @icmp_eq_v16i8(<16 x i8> %op1, <16 x i8> %op2) #0 {
39 ; CHECK-LABEL: icmp_eq_v16i8:
40 ; CHECK: cmeq v0.16b, v0.16b, v1.16b
42 %cmp = icmp eq <16 x i8> %op1, %op2
43 %sext = sext <16 x i1> %cmp to <16 x i8>
47 define void @icmp_eq_v32i8(<32 x i8>* %a, <32 x i8>* %b) #0 {
48 ; CHECK-LABEL: icmp_eq_v32i8:
49 ; CHECK: ptrue [[PG:p[0-9]+]].b, vl32
50 ; CHECK-DAG: ld1b { [[OP1:z[0-9]+]].b }, [[PG]]/z, [x0]
51 ; CHECK-DAG: ld1b { [[OP2:z[0-9]+]].b }, [[PG]]/z, [x1]
52 ; CHECK-NEXT: cmpeq [[CMP:p[0-9]+]].b, [[PG]]/z, [[OP1]].b, [[OP2]].b
53 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].b, [[CMP]]/z, #-1
54 ; CHECK-NEXT: st1b { [[SEXT]].b }, [[PG]], [x0]
56 %op1 = load <32 x i8>, <32 x i8>* %a
57 %op2 = load <32 x i8>, <32 x i8>* %b
58 %cmp = icmp eq <32 x i8> %op1, %op2
59 %sext = sext <32 x i1> %cmp to <32 x i8>
60 store <32 x i8> %sext, <32 x i8>* %a
64 define void @icmp_eq_v64i8(<64 x i8>* %a, <64 x i8>* %b) #0 {
65 ; CHECK-LABEL: icmp_eq_v64i8:
66 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].b, vl64
67 ; VBITS_GE_512-DAG: ld1b { [[OP1:z[0-9]+]].b }, [[PG]]/z, [x0]
68 ; VBITS_GE_512-DAG: ld1b { [[OP2:z[0-9]+]].b }, [[PG]]/z, [x1]
69 ; VBITS_GE_512-NEXT: cmpeq [[CMP:p[0-9]+]].b, [[PG]]/z, [[OP1]].b, [[OP2]].b
70 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].b, [[CMP]]/z, #-1
71 ; VBITS_GE_512-NEXT: st1b { [[SEXT]].b }, [[PG]], [x0]
72 ; VBITS_GE_512-NEXT: ret
74 ; Ensure sensible type legalisation
75 ; VBITS_EQ_256-DAG: ptrue [[PG:p[0-9]+]].b, vl32
76 ; VBITS_EQ_256-DAG: mov w[[NUMELTS:[0-9]+]], #32
77 ; VBITS_EQ_256-DAG: ld1b { [[OP1_LO:z[0-9]+]].b }, [[PG]]/z, [x0]
78 ; VBITS_EQ_256-DAG: ld1b { [[OP1_HI:z[0-9]+]].b }, [[PG]]/z, [x0, x[[NUMELTS]]]
79 ; VBITS_EQ_256-DAG: ld1b { [[OP2_LO:z[0-9]+]].b }, [[PG]]/z, [x1]
80 ; VBITS_EQ_256-DAG: ld1b { [[OP2_HI:z[0-9]+]].b }, [[PG]]/z, [x1, x[[NUMELTS]]]
81 ; VBITS_EQ_256-DAG: cmpeq [[CMP_LO:p[0-9]+]].b, [[PG]]/z, [[OP1_LO]].b, [[OP2_LO]].b
82 ; VBITS_EQ_256-DAG: cmpeq [[CMP_HI:p[0-9]+]].b, [[PG]]/z, [[OP1_HI]].b, [[OP2_HI]].b
83 ; VBITS_EQ_256-DAG: mov [[SEXT_LO:z[0-9]+]].b, [[CMP_LO]]/z, #-1
84 ; VBITS_EQ_256-DAG: mov [[SEXT_HI:z[0-9]+]].b, [[CMP_HI]]/z, #-1
85 ; VBITS_EQ_256-DAG: st1b { [[SEXT_LO]].b }, [[PG]], [x0]
86 ; VBITS_EQ_256-DAG: st1b { [[SEXT_HI]].b }, [[PG]], [x0, x[[NUMELTS]]]
87 ; VBITS_EQ_256-NEXT: ret
88 %op1 = load <64 x i8>, <64 x i8>* %a
89 %op2 = load <64 x i8>, <64 x i8>* %b
90 %cmp = icmp eq <64 x i8> %op1, %op2
91 %sext = sext <64 x i1> %cmp to <64 x i8>
92 store <64 x i8> %sext, <64 x i8>* %a
96 define void @icmp_eq_v128i8(<128 x i8>* %a, <128 x i8>* %b) #0 {
97 ; CHECK-LABEL: icmp_eq_v128i8:
98 ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].b, vl128
99 ; VBITS_GE_1024-DAG: ld1b { [[OP1:z[0-9]+]].b }, [[PG]]/z, [x0]
100 ; VBITS_GE_1024-DAG: ld1b { [[OP2:z[0-9]+]].b }, [[PG]]/z, [x1]
101 ; VBITS_GE_1024-NEXT: cmpeq [[CMP:p[0-9]+]].b, [[PG]]/z, [[OP1]].b, [[OP2]].b
102 ; VBITS_GE_1024-NEXT: mov [[SEXT:z[0-9]+]].b, [[CMP]]/z, #-1
103 ; VBITS_GE_1024-NEXT: st1b { [[SEXT]].b }, [[PG]], [x0]
104 ; VBITS_GE_1024-NEXT: ret
105 %op1 = load <128 x i8>, <128 x i8>* %a
106 %op2 = load <128 x i8>, <128 x i8>* %b
107 %cmp = icmp eq <128 x i8> %op1, %op2
108 %sext = sext <128 x i1> %cmp to <128 x i8>
109 store <128 x i8> %sext, <128 x i8>* %a
113 define void @icmp_eq_v256i8(<256 x i8>* %a, <256 x i8>* %b) #0 {
114 ; CHECK-LABEL: icmp_eq_v256i8:
115 ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].b, vl256
116 ; VBITS_GE_2048-DAG: ld1b { [[OP1:z[0-9]+]].b }, [[PG]]/z, [x0]
117 ; VBITS_GE_2048-DAG: ld1b { [[OP2:z[0-9]+]].b }, [[PG]]/z, [x1]
118 ; VBITS_GE_2048-NEXT: cmpeq [[CMP:p[0-9]+]].b, [[PG]]/z, [[OP1]].b, [[OP2]].b
119 ; VBITS_GE_2048-NEXT: mov [[SEXT:z[0-9]+]].b, [[CMP]]/z, #-1
120 ; VBITS_GE_2048-NEXT: st1b { [[SEXT]].b }, [[PG]], [x0]
121 ; VBITS_GE_2048-NEXT: ret
122 %op1 = load <256 x i8>, <256 x i8>* %a
123 %op2 = load <256 x i8>, <256 x i8>* %b
124 %cmp = icmp eq <256 x i8> %op1, %op2
125 %sext = sext <256 x i1> %cmp to <256 x i8>
126 store <256 x i8> %sext, <256 x i8>* %a
130 ; Don't use SVE for 64-bit vectors.
131 define <4 x i16> @icmp_eq_v4i16(<4 x i16> %op1, <4 x i16> %op2) #0 {
132 ; CHECK-LABEL: icmp_eq_v4i16:
133 ; CHECK: cmeq v0.4h, v0.4h, v1.4h
135 %cmp = icmp eq <4 x i16> %op1, %op2
136 %sext = sext <4 x i1> %cmp to <4 x i16>
140 ; Don't use SVE for 128-bit vectors.
141 define <8 x i16> @icmp_eq_v8i16(<8 x i16> %op1, <8 x i16> %op2) #0 {
142 ; CHECK-LABEL: icmp_eq_v8i16:
143 ; CHECK: cmeq v0.8h, v0.8h, v1.8h
145 %cmp = icmp eq <8 x i16> %op1, %op2
146 %sext = sext <8 x i1> %cmp to <8 x i16>
150 define void @icmp_eq_v16i16(<16 x i16>* %a, <16 x i16>* %b) #0 {
151 ; CHECK-LABEL: icmp_eq_v16i16:
152 ; CHECK: ptrue [[PG:p[0-9]+]].h, vl16
153 ; CHECK-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
154 ; CHECK-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
155 ; CHECK-NEXT: cmpeq [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
156 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
157 ; CHECK-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
159 %op1 = load <16 x i16>, <16 x i16>* %a
160 %op2 = load <16 x i16>, <16 x i16>* %b
161 %cmp = icmp eq <16 x i16> %op1, %op2
162 %sext = sext <16 x i1> %cmp to <16 x i16>
163 store <16 x i16> %sext, <16 x i16>* %a
167 define void @icmp_eq_v32i16(<32 x i16>* %a, <32 x i16>* %b) #0 {
168 ; CHECK-LABEL: icmp_eq_v32i16:
169 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].h, vl32
170 ; VBITS_GE_512-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
171 ; VBITS_GE_512-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
172 ; VBITS_GE_512-NEXT: cmpeq [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
173 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
174 ; VBITS_GE_512-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
175 ; VBITS_GE_512-NEXT: ret
177 ; Ensure sensible type legalisation
178 ; VBITS_EQ_256-DAG: ptrue [[PG:p[0-9]+]].h, vl16
179 ; VBITS_EQ_256-DAG: mov x[[NUMELTS:[0-9]+]], #16
180 ; VBITS_EQ_256-DAG: ld1h { [[OP1_LO:z[0-9]+]].h }, [[PG]]/z, [x0]
181 ; VBITS_EQ_256-DAG: ld1h { [[OP1_HI:z[0-9]+]].h }, [[PG]]/z, [x0, x[[NUMELTS]], lsl #1]
182 ; VBITS_EQ_256-DAG: ld1h { [[OP2_LO:z[0-9]+]].h }, [[PG]]/z, [x1]
183 ; VBITS_EQ_256-DAG: ld1h { [[OP2_HI:z[0-9]+]].h }, [[PG]]/z, [x1, x[[NUMELTS]], lsl #1]
184 ; VBITS_EQ_256-DAG: cmpeq [[CMP_LO:p[0-9]+]].h, [[PG]]/z, [[OP1_LO]].h, [[OP2_LO]].h
185 ; VBITS_EQ_256-DAG: cmpeq [[CMP_HI:p[0-9]+]].h, [[PG]]/z, [[OP1_HI]].h, [[OP2_HI]].h
186 ; VBITS_EQ_256-DAG: mov [[SEXT_LO:z[0-9]+]].h, [[CMP_LO]]/z, #-1
187 ; VBITS_EQ_256-DAG: mov [[SEXT_HI:z[0-9]+]].h, [[CMP_HI]]/z, #-1
188 ; VBITS_EQ_256-DAG: st1h { [[SEXT_LO]].h }, [[PG]], [x0]
189 ; VBITS_EQ_256-DAG: st1h { [[SEXT_HI]].h }, [[PG]], [x0, x[[NUMELTS]], lsl #1]
190 ; VBITS_EQ_256-NEXT: ret
191 %op1 = load <32 x i16>, <32 x i16>* %a
192 %op2 = load <32 x i16>, <32 x i16>* %b
193 %cmp = icmp eq <32 x i16> %op1, %op2
194 %sext = sext <32 x i1> %cmp to <32 x i16>
195 store <32 x i16> %sext, <32 x i16>* %a
199 define void @icmp_eq_v64i16(<64 x i16>* %a, <64 x i16>* %b) #0 {
200 ; CHECK-LABEL: icmp_eq_v64i16:
201 ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].h, vl64
202 ; VBITS_GE_1024-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
203 ; VBITS_GE_1024-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
204 ; VBITS_GE_1024-NEXT: cmpeq [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
205 ; VBITS_GE_1024-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
206 ; VBITS_GE_1024-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
207 ; VBITS_GE_1024-NEXT: ret
208 %op1 = load <64 x i16>, <64 x i16>* %a
209 %op2 = load <64 x i16>, <64 x i16>* %b
210 %cmp = icmp eq <64 x i16> %op1, %op2
211 %sext = sext <64 x i1> %cmp to <64 x i16>
212 store <64 x i16> %sext, <64 x i16>* %a
216 define void @icmp_eq_v128i16(<128 x i16>* %a, <128 x i16>* %b) #0 {
217 ; CHECK-LABEL: icmp_eq_v128i16:
218 ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].h, vl128
219 ; VBITS_GE_2048-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
220 ; VBITS_GE_2048-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
221 ; VBITS_GE_2048-NEXT: cmpeq [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
222 ; VBITS_GE_2048-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
223 ; VBITS_GE_2048-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
224 ; VBITS_GE_2048-NEXT: ret
225 %op1 = load <128 x i16>, <128 x i16>* %a
226 %op2 = load <128 x i16>, <128 x i16>* %b
227 %cmp = icmp eq <128 x i16> %op1, %op2
228 %sext = sext <128 x i1> %cmp to <128 x i16>
229 store <128 x i16> %sext, <128 x i16>* %a
233 ; Don't use SVE for 64-bit vectors.
234 define <2 x i32> @icmp_eq_v2i32(<2 x i32> %op1, <2 x i32> %op2) #0 {
235 ; CHECK-LABEL: icmp_eq_v2i32:
236 ; CHECK: cmeq v0.2s, v0.2s, v1.2s
238 %cmp = icmp eq <2 x i32> %op1, %op2
239 %sext = sext <2 x i1> %cmp to <2 x i32>
243 ; Don't use SVE for 128-bit vectors.
244 define <4 x i32> @icmp_eq_v4i32(<4 x i32> %op1, <4 x i32> %op2) #0 {
245 ; CHECK-LABEL: icmp_eq_v4i32:
246 ; CHECK: cmeq v0.4s, v0.4s, v1.4s
248 %cmp = icmp eq <4 x i32> %op1, %op2
249 %sext = sext <4 x i1> %cmp to <4 x i32>
253 define void @icmp_eq_v8i32(<8 x i32>* %a, <8 x i32>* %b) #0 {
254 ; CHECK-LABEL: icmp_eq_v8i32:
255 ; CHECK: ptrue [[PG:p[0-9]+]].s, vl8
256 ; CHECK-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
257 ; CHECK-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
258 ; CHECK-NEXT: cmpeq [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP1]].s, [[OP2]].s
259 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
260 ; CHECK-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
262 %op1 = load <8 x i32>, <8 x i32>* %a
263 %op2 = load <8 x i32>, <8 x i32>* %b
264 %cmp = icmp eq <8 x i32> %op1, %op2
265 %sext = sext <8 x i1> %cmp to <8 x i32>
266 store <8 x i32> %sext, <8 x i32>* %a
270 define void @icmp_eq_v16i32(<16 x i32>* %a, <16 x i32>* %b) #0 {
271 ; CHECK-LABEL: icmp_eq_v16i32:
272 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].s, vl16
273 ; VBITS_GE_512-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
274 ; VBITS_GE_512-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
275 ; VBITS_GE_512-NEXT: cmpeq [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP1]].s, [[OP2]].s
276 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
277 ; VBITS_GE_512-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
278 ; VBITS_GE_512-NEXT: ret
280 ; Ensure sensible type legalisation
281 ; VBITS_EQ_256-DAG: ptrue [[PG:p[0-9]+]].s, vl8
282 ; VBITS_EQ_256-DAG: mov x[[NUMELTS:[0-9]+]], #8
283 ; VBITS_EQ_256-DAG: ld1w { [[OP1_LO:z[0-9]+]].s }, [[PG]]/z, [x0]
284 ; VBITS_EQ_256-DAG: ld1w { [[OP1_HI:z[0-9]+]].s }, [[PG]]/z, [x0, x[[NUMELTS]], lsl #2]
285 ; VBITS_EQ_256-DAG: ld1w { [[OP2_LO:z[0-9]+]].s }, [[PG]]/z, [x1]
286 ; VBITS_EQ_256-DAG: ld1w { [[OP2_HI:z[0-9]+]].s }, [[PG]]/z, [x1, x[[NUMELTS]], lsl #2]
287 ; VBITS_EQ_256-DAG: cmpeq [[CMP_LO:p[0-9]+]].s, [[PG]]/z, [[OP1_LO]].s, [[OP2_LO]].s
288 ; VBITS_EQ_256-DAG: cmpeq [[CMP_HI:p[0-9]+]].s, [[PG]]/z, [[OP1_HI]].s, [[OP2_HI]].s
289 ; VBITS_EQ_256-DAG: mov [[SEXT_LO:z[0-9]+]].s, [[CMP_LO]]/z, #-1
290 ; VBITS_EQ_256-DAG: mov [[SEXT_HI:z[0-9]+]].s, [[CMP_HI]]/z, #-1
291 ; VBITS_EQ_256-DAG: st1w { [[SEXT_LO]].s }, [[PG]], [x0]
292 ; VBITS_EQ_256-DAG: st1w { [[SEXT_HI]].s }, [[PG]], [x0, x[[NUMELTS]], lsl #2]
293 ; VBITS_EQ_256-NEXT: ret
294 %op1 = load <16 x i32>, <16 x i32>* %a
295 %op2 = load <16 x i32>, <16 x i32>* %b
296 %cmp = icmp eq <16 x i32> %op1, %op2
297 %sext = sext <16 x i1> %cmp to <16 x i32>
298 store <16 x i32> %sext, <16 x i32>* %a
302 define void @icmp_eq_v32i32(<32 x i32>* %a, <32 x i32>* %b) #0 {
303 ; CHECK-LABEL: icmp_eq_v32i32:
304 ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].s, vl32
305 ; VBITS_GE_1024-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
306 ; VBITS_GE_1024-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
307 ; VBITS_GE_1024-NEXT: cmpeq [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP1]].s, [[OP2]].s
308 ; VBITS_GE_1024-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
309 ; VBITS_GE_1024-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
310 ; VBITS_GE_1024-NEXT: ret
311 %op1 = load <32 x i32>, <32 x i32>* %a
312 %op2 = load <32 x i32>, <32 x i32>* %b
313 %cmp = icmp eq <32 x i32> %op1, %op2
314 %sext = sext <32 x i1> %cmp to <32 x i32>
315 store <32 x i32> %sext, <32 x i32>* %a
319 define void @icmp_eq_v64i32(<64 x i32>* %a, <64 x i32>* %b) #0 {
320 ; CHECK-LABEL: icmp_eq_v64i32:
321 ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].s, vl64
322 ; VBITS_GE_2048-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
323 ; VBITS_GE_2048-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
324 ; VBITS_GE_2048-NEXT: cmpeq [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP1]].s, [[OP2]].s
325 ; VBITS_GE_2048-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
326 ; VBITS_GE_2048-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
327 ; VBITS_GE_2048-NEXT: ret
328 %op1 = load <64 x i32>, <64 x i32>* %a
329 %op2 = load <64 x i32>, <64 x i32>* %b
330 %cmp = icmp eq <64 x i32> %op1, %op2
331 %sext = sext <64 x i1> %cmp to <64 x i32>
332 store <64 x i32> %sext, <64 x i32>* %a
336 ; Don't use SVE for 64-bit vectors.
337 define <1 x i64> @icmp_eq_v1i64(<1 x i64> %op1, <1 x i64> %op2) #0 {
338 ; CHECK-LABEL: icmp_eq_v1i64:
339 ; CHECK: cmeq d0, d0, d1
341 %cmp = icmp eq <1 x i64> %op1, %op2
342 %sext = sext <1 x i1> %cmp to <1 x i64>
346 ; Don't use SVE for 128-bit vectors.
347 define <2 x i64> @icmp_eq_v2i64(<2 x i64> %op1, <2 x i64> %op2) #0 {
348 ; CHECK-LABEL: icmp_eq_v2i64:
349 ; CHECK: cmeq v0.2d, v0.2d, v1.2d
351 %cmp = icmp eq <2 x i64> %op1, %op2
352 %sext = sext <2 x i1> %cmp to <2 x i64>
356 define void @icmp_eq_v4i64(<4 x i64>* %a, <4 x i64>* %b) #0 {
357 ; CHECK-LABEL: icmp_eq_v4i64:
358 ; CHECK: ptrue [[PG:p[0-9]+]].d, vl4
359 ; CHECK-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
360 ; CHECK-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
361 ; CHECK-NEXT: cmpeq [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
362 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
363 ; CHECK-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
365 %op1 = load <4 x i64>, <4 x i64>* %a
366 %op2 = load <4 x i64>, <4 x i64>* %b
367 %cmp = icmp eq <4 x i64> %op1, %op2
368 %sext = sext <4 x i1> %cmp to <4 x i64>
369 store <4 x i64> %sext, <4 x i64>* %a
373 define void @icmp_eq_v8i64(<8 x i64>* %a, <8 x i64>* %b) #0 {
374 ; CHECK-LABEL: icmp_eq_v8i64:
375 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].d, vl8
376 ; VBITS_GE_512-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
377 ; VBITS_GE_512-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
378 ; VBITS_GE_512-NEXT: cmpeq [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
379 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
380 ; VBITS_GE_512-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
381 ; VBITS_GE_512-NEXT: ret
383 ; Ensure sensible type legalisation
384 ; VBITS_EQ_256-DAG: ptrue [[PG:p[0-9]+]].d, vl4
385 ; VBITS_EQ_256-DAG: mov x[[NUMELTS:[0-9]+]], #4
386 ; VBITS_EQ_256-DAG: ld1d { [[OP1_LO:z[0-9]+]].d }, [[PG]]/z, [x0]
387 ; VBITS_EQ_256-DAG: ld1d { [[OP1_HI:z[0-9]+]].d }, [[PG]]/z, [x0, x[[NUMELTS]], lsl #3]
388 ; VBITS_EQ_256-DAG: ld1d { [[OP2_LO:z[0-9]+]].d }, [[PG]]/z, [x1]
389 ; VBITS_EQ_256-DAG: ld1d { [[OP2_HI:z[0-9]+]].d }, [[PG]]/z, [x1, x[[NUMELTS]], lsl #3]
390 ; VBITS_EQ_256-DAG: cmpeq [[CMP_LO:p[0-9]+]].d, [[PG]]/z, [[OP1_LO]].d, [[OP2_LO]].d
391 ; VBITS_EQ_256-DAG: cmpeq [[CMP_HI:p[0-9]+]].d, [[PG]]/z, [[OP1_HI]].d, [[OP2_HI]].d
392 ; VBITS_EQ_256-DAG: mov [[SEXT_LO:z[0-9]+]].d, [[CMP_LO]]/z, #-1
393 ; VBITS_EQ_256-DAG: mov [[SEXT_HI:z[0-9]+]].d, [[CMP_HI]]/z, #-1
394 ; VBITS_EQ_256-DAG: st1d { [[SEXT_LO]].d }, [[PG]], [x0]
395 ; VBITS_EQ_256-DAG: st1d { [[SEXT_HI]].d }, [[PG]], [x0, x[[NUMELTS]], lsl #3]
396 ; VBITS_EQ_256-NEXT: ret
397 %op1 = load <8 x i64>, <8 x i64>* %a
398 %op2 = load <8 x i64>, <8 x i64>* %b
399 %cmp = icmp eq <8 x i64> %op1, %op2
400 %sext = sext <8 x i1> %cmp to <8 x i64>
401 store <8 x i64> %sext, <8 x i64>* %a
405 define void @icmp_eq_v16i64(<16 x i64>* %a, <16 x i64>* %b) #0 {
406 ; CHECK-LABEL: icmp_eq_v16i64:
407 ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].d, vl16
408 ; VBITS_GE_1024-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
409 ; VBITS_GE_1024-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
410 ; VBITS_GE_1024-NEXT: cmpeq [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
411 ; VBITS_GE_1024-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
412 ; VBITS_GE_1024-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
413 ; VBITS_GE_1024-NEXT: ret
414 %op1 = load <16 x i64>, <16 x i64>* %a
415 %op2 = load <16 x i64>, <16 x i64>* %b
416 %cmp = icmp eq <16 x i64> %op1, %op2
417 %sext = sext <16 x i1> %cmp to <16 x i64>
418 store <16 x i64> %sext, <16 x i64>* %a
422 define void @icmp_eq_v32i64(<32 x i64>* %a, <32 x i64>* %b) #0 {
423 ; CHECK-LABEL: icmp_eq_v32i64:
424 ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].d, vl32
425 ; VBITS_GE_2048-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
426 ; VBITS_GE_2048-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
427 ; VBITS_GE_2048-NEXT: cmpeq [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
428 ; VBITS_GE_2048-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
429 ; VBITS_GE_2048-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
430 ; VBITS_GE_2048-NEXT: ret
431 %op1 = load <32 x i64>, <32 x i64>* %a
432 %op2 = load <32 x i64>, <32 x i64>* %b
433 %cmp = icmp eq <32 x i64> %op1, %op2
434 %sext = sext <32 x i1> %cmp to <32 x i64>
435 store <32 x i64> %sext, <32 x i64>* %a
443 define void @icmp_ne_v32i8(<32 x i8>* %a, <32 x i8>* %b) #0 {
444 ; CHECK-LABEL: icmp_ne_v32i8:
445 ; CHECK: ptrue [[PG:p[0-9]+]].b, vl32
446 ; CHECK-DAG: ld1b { [[OP1:z[0-9]+]].b }, [[PG]]/z, [x0]
447 ; CHECK-DAG: ld1b { [[OP2:z[0-9]+]].b }, [[PG]]/z, [x1]
448 ; CHECK-NEXT: cmpne [[CMP:p[0-9]+]].b, [[PG]]/z, [[OP1]].b, [[OP2]].b
449 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].b, [[CMP]]/z, #-1
450 ; CHECK-NEXT: st1b { [[SEXT]].b }, [[PG]], [x0]
452 %op1 = load <32 x i8>, <32 x i8>* %a
453 %op2 = load <32 x i8>, <32 x i8>* %b
454 %cmp = icmp ne <32 x i8> %op1, %op2
455 %sext = sext <32 x i1> %cmp to <32 x i8>
456 store <32 x i8> %sext, <32 x i8>* %a
464 define void @icmp_sge_v32i16(<32 x i16>* %a, <32 x i16>* %b) #0 {
465 ; CHECK-LABEL: icmp_sge_v32i16:
466 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].h, vl32
467 ; VBITS_GE_512-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
468 ; VBITS_GE_512-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
469 ; VBITS_GE_512-NEXT: cmpge [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
470 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
471 ; VBITS_GE_512-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
472 ; VBITS_GE_512-NEXT: ret
473 %op1 = load <32 x i16>, <32 x i16>* %a
474 %op2 = load <32 x i16>, <32 x i16>* %b
475 %cmp = icmp sge <32 x i16> %op1, %op2
476 %sext = sext <32 x i1> %cmp to <32 x i16>
477 store <32 x i16> %sext, <32 x i16>* %a
485 define void @icmp_sgt_v16i16(<16 x i16>* %a, <16 x i16>* %b) #0 {
486 ; CHECK-LABEL: icmp_sgt_v16i16:
487 ; CHECK: ptrue [[PG:p[0-9]+]].h, vl16
488 ; CHECK-DAG: ld1h { [[OP1:z[0-9]+]].h }, [[PG]]/z, [x0]
489 ; CHECK-DAG: ld1h { [[OP2:z[0-9]+]].h }, [[PG]]/z, [x1]
490 ; CHECK-NEXT: cmpgt [[CMP:p[0-9]+]].h, [[PG]]/z, [[OP1]].h, [[OP2]].h
491 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].h, [[CMP]]/z, #-1
492 ; CHECK-NEXT: st1h { [[SEXT]].h }, [[PG]], [x0]
494 %op1 = load <16 x i16>, <16 x i16>* %a
495 %op2 = load <16 x i16>, <16 x i16>* %b
496 %cmp = icmp sgt <16 x i16> %op1, %op2
497 %sext = sext <16 x i1> %cmp to <16 x i16>
498 store <16 x i16> %sext, <16 x i16>* %a
506 define void @icmp_sle_v16i32(<16 x i32>* %a, <16 x i32>* %b) #0 {
507 ; CHECK-LABEL: icmp_sle_v16i32:
508 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].s, vl16
509 ; VBITS_GE_512-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
510 ; VBITS_GE_512-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
511 ; VBITS_GE_512-NEXT: cmpge [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP2]].s, [[OP1]].s
512 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
513 ; VBITS_GE_512-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
514 ; VBITS_GE_512-NEXT: ret
515 %op1 = load <16 x i32>, <16 x i32>* %a
516 %op2 = load <16 x i32>, <16 x i32>* %b
517 %cmp = icmp sle <16 x i32> %op1, %op2
518 %sext = sext <16 x i1> %cmp to <16 x i32>
519 store <16 x i32> %sext, <16 x i32>* %a
527 define void @icmp_slt_v8i32(<8 x i32>* %a, <8 x i32>* %b) #0 {
528 ; CHECK-LABEL: icmp_slt_v8i32:
529 ; CHECK: ptrue [[PG:p[0-9]+]].s, vl8
530 ; CHECK-DAG: ld1w { [[OP1:z[0-9]+]].s }, [[PG]]/z, [x0]
531 ; CHECK-DAG: ld1w { [[OP2:z[0-9]+]].s }, [[PG]]/z, [x1]
532 ; CHECK-NEXT: cmpgt [[CMP:p[0-9]+]].s, [[PG]]/z, [[OP2]].s, [[OP1]].s
533 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].s, [[CMP]]/z, #-1
534 ; CHECK-NEXT: st1w { [[SEXT]].s }, [[PG]], [x0]
536 %op1 = load <8 x i32>, <8 x i32>* %a
537 %op2 = load <8 x i32>, <8 x i32>* %b
538 %cmp = icmp slt <8 x i32> %op1, %op2
539 %sext = sext <8 x i1> %cmp to <8 x i32>
540 store <8 x i32> %sext, <8 x i32>* %a
548 define void @icmp_uge_v8i64(<8 x i64>* %a, <8 x i64>* %b) #0 {
549 ; CHECK-LABEL: icmp_uge_v8i64:
550 ; VBITS_GE_512: ptrue [[PG:p[0-9]+]].d, vl8
551 ; VBITS_GE_512-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
552 ; VBITS_GE_512-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
553 ; VBITS_GE_512-NEXT: cmphs [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
554 ; VBITS_GE_512-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
555 ; VBITS_GE_512-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
556 ; VBITS_GE_512-NEXT: ret
557 %op1 = load <8 x i64>, <8 x i64>* %a
558 %op2 = load <8 x i64>, <8 x i64>* %b
559 %cmp = icmp uge <8 x i64> %op1, %op2
560 %sext = sext <8 x i1> %cmp to <8 x i64>
561 store <8 x i64> %sext, <8 x i64>* %a
569 define void @icmp_ugt_v4i64(<4 x i64>* %a, <4 x i64>* %b) #0 {
570 ; CHECK-LABEL: icmp_ugt_v4i64:
571 ; CHECK: ptrue [[PG:p[0-9]+]].d, vl4
572 ; CHECK-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
573 ; CHECK-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
574 ; CHECK-NEXT: cmphi [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP1]].d, [[OP2]].d
575 ; CHECK-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
576 ; CHECK-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
578 %op1 = load <4 x i64>, <4 x i64>* %a
579 %op2 = load <4 x i64>, <4 x i64>* %b
580 %cmp = icmp ugt <4 x i64> %op1, %op2
581 %sext = sext <4 x i1> %cmp to <4 x i64>
582 store <4 x i64> %sext, <4 x i64>* %a
590 define void @icmp_ule_v16i64(<16 x i64>* %a, <16 x i64>* %b) #0 {
591 ; CHECK-LABEL: icmp_ule_v16i64:
592 ; VBITS_GE_1024: ptrue [[PG:p[0-9]+]].d, vl16
593 ; VBITS_GE_1024-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
594 ; VBITS_GE_1024-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
595 ; VBITS_GE_1024-NEXT: cmphs [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP2]].d, [[OP1]].d
596 ; VBITS_GE_1024-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
597 ; VBITS_GE_1024-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
598 ; VBITS_GE_1024-NEXT: ret
599 %op1 = load <16 x i64>, <16 x i64>* %a
600 %op2 = load <16 x i64>, <16 x i64>* %b
601 %cmp = icmp ule <16 x i64> %op1, %op2
602 %sext = sext <16 x i1> %cmp to <16 x i64>
603 store <16 x i64> %sext, <16 x i64>* %a
611 define void @icmp_ult_v32i64(<32 x i64>* %a, <32 x i64>* %b) #0 {
612 ; CHECK-LABEL: icmp_ult_v32i64:
613 ; VBITS_GE_2048: ptrue [[PG:p[0-9]+]].d, vl32
614 ; VBITS_GE_2048-DAG: ld1d { [[OP1:z[0-9]+]].d }, [[PG]]/z, [x0]
615 ; VBITS_GE_2048-DAG: ld1d { [[OP2:z[0-9]+]].d }, [[PG]]/z, [x1]
616 ; VBITS_GE_2048-NEXT: cmphi [[CMP:p[0-9]+]].d, [[PG]]/z, [[OP2]].d, [[OP1]].d
617 ; VBITS_GE_2048-NEXT: mov [[SEXT:z[0-9]+]].d, [[CMP]]/z, #-1
618 ; VBITS_GE_2048-NEXT: st1d { [[SEXT]].d }, [[PG]], [x0]
619 ; VBITS_GE_2048-NEXT: ret
620 %op1 = load <32 x i64>, <32 x i64>* %a
621 %op2 = load <32 x i64>, <32 x i64>* %b
622 %cmp = icmp ult <32 x i64> %op1, %op2
623 %sext = sext <32 x i1> %cmp to <32 x i64>
624 store <32 x i64> %sext, <32 x i64>* %a
628 attributes #0 = { "target-features"="+sve" }