1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming < %s | FileCheck %s
4 ; RUN: llc -force-streaming-compatible < %s | FileCheck %s --check-prefix=NONEON-NOSVE
6 target triple = "aarch64-unknown-linux-gnu"
12 define i8 @uaddv_v8i8(<8 x i8> %a) {
13 ; CHECK-LABEL: uaddv_v8i8:
15 ; CHECK-NEXT: ptrue p0.b, vl8
16 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
17 ; CHECK-NEXT: uaddv d0, p0, z0.b
18 ; CHECK-NEXT: fmov x0, d0
19 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
22 ; NONEON-NOSVE-LABEL: uaddv_v8i8:
23 ; NONEON-NOSVE: // %bb.0:
24 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
25 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
26 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
27 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #13]
28 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #12]
29 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #11]
30 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #10]
31 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #9]
32 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #8]
33 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #14]
34 ; NONEON-NOSVE-NEXT: add w8, w9, w8
35 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #15]
36 ; NONEON-NOSVE-NEXT: add w12, w13, w12
37 ; NONEON-NOSVE-NEXT: add w10, w11, w10
38 ; NONEON-NOSVE-NEXT: add w10, w12, w10
39 ; NONEON-NOSVE-NEXT: add w8, w8, w14
40 ; NONEON-NOSVE-NEXT: add w8, w10, w8
41 ; NONEON-NOSVE-NEXT: add w0, w8, w9
42 ; NONEON-NOSVE-NEXT: add sp, sp, #16
43 ; NONEON-NOSVE-NEXT: ret
44 %res = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %a)
48 define i8 @uaddv_v16i8(<16 x i8> %a) {
49 ; CHECK-LABEL: uaddv_v16i8:
51 ; CHECK-NEXT: ptrue p0.b, vl16
52 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
53 ; CHECK-NEXT: uaddv d0, p0, z0.b
54 ; CHECK-NEXT: fmov x0, d0
55 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
58 ; NONEON-NOSVE-LABEL: uaddv_v16i8:
59 ; NONEON-NOSVE: // %bb.0:
60 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
61 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
62 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #5]
63 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #1]
64 ; NONEON-NOSVE-NEXT: ldrb w11, [sp]
65 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #4]
66 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #3]
67 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #2]
68 ; NONEON-NOSVE-NEXT: add w10, w11, w10
69 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #12]
70 ; NONEON-NOSVE-NEXT: ldrb w15, [sp, #8]
71 ; NONEON-NOSVE-NEXT: add w11, w14, w13
72 ; NONEON-NOSVE-NEXT: add w9, w12, w9
73 ; NONEON-NOSVE-NEXT: ldrb w16, [sp, #6]
74 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #7]
75 ; NONEON-NOSVE-NEXT: add w10, w10, w11
76 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #11]
77 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #13]
78 ; NONEON-NOSVE-NEXT: add w9, w9, w16
79 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #9]
80 ; NONEON-NOSVE-NEXT: add w12, w12, w15
81 ; NONEON-NOSVE-NEXT: ldrb w15, [sp, #14]
82 ; NONEON-NOSVE-NEXT: add w8, w13, w8
83 ; NONEON-NOSVE-NEXT: ldrb w16, [sp, #10]
84 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #15]
85 ; NONEON-NOSVE-NEXT: add w12, w12, w14
86 ; NONEON-NOSVE-NEXT: add w8, w8, w11
87 ; NONEON-NOSVE-NEXT: add w9, w10, w9
88 ; NONEON-NOSVE-NEXT: add w10, w12, w16
89 ; NONEON-NOSVE-NEXT: add w8, w8, w15
90 ; NONEON-NOSVE-NEXT: add w9, w9, w10
91 ; NONEON-NOSVE-NEXT: add w8, w8, w13
92 ; NONEON-NOSVE-NEXT: add w0, w9, w8
93 ; NONEON-NOSVE-NEXT: add sp, sp, #16
94 ; NONEON-NOSVE-NEXT: ret
95 %res = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %a)
99 define i8 @uaddv_v32i8(ptr %a) {
100 ; CHECK-LABEL: uaddv_v32i8:
102 ; CHECK-NEXT: ldp q1, q0, [x0]
103 ; CHECK-NEXT: ptrue p0.b, vl16
104 ; CHECK-NEXT: add z0.b, z1.b, z0.b
105 ; CHECK-NEXT: uaddv d0, p0, z0.b
106 ; CHECK-NEXT: fmov x0, d0
107 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
110 ; NONEON-NOSVE-LABEL: uaddv_v32i8:
111 ; NONEON-NOSVE: // %bb.0:
112 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
113 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
114 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
115 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #17]
116 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #1]
117 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #16]
118 ; NONEON-NOSVE-NEXT: ldrb w11, [sp]
119 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #18]
120 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #2]
121 ; NONEON-NOSVE-NEXT: add w8, w9, w8
122 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #19]
123 ; NONEON-NOSVE-NEXT: ldrb w15, [sp, #3]
124 ; NONEON-NOSVE-NEXT: add w9, w11, w10
125 ; NONEON-NOSVE-NEXT: add w10, w13, w12
126 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #21]
127 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #5]
128 ; NONEON-NOSVE-NEXT: add w11, w15, w14
129 ; NONEON-NOSVE-NEXT: add w8, w9, w8
130 ; NONEON-NOSVE-NEXT: ldrb w16, [sp, #20]
131 ; NONEON-NOSVE-NEXT: ldrb w17, [sp, #4]
132 ; NONEON-NOSVE-NEXT: add w9, w10, w11
133 ; NONEON-NOSVE-NEXT: add w10, w13, w12
134 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #22]
135 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #6]
136 ; NONEON-NOSVE-NEXT: add w14, w17, w16
137 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #23]
138 ; NONEON-NOSVE-NEXT: ldrb w15, [sp, #8]
139 ; NONEON-NOSVE-NEXT: add w10, w14, w10
140 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #7]
141 ; NONEON-NOSVE-NEXT: add w11, w12, w11
142 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #24]
143 ; NONEON-NOSVE-NEXT: add w8, w8, w9
144 ; NONEON-NOSVE-NEXT: add w9, w10, w11
145 ; NONEON-NOSVE-NEXT: add w10, w14, w13
146 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #9]
147 ; NONEON-NOSVE-NEXT: add w8, w8, w9
148 ; NONEON-NOSVE-NEXT: add w11, w15, w12
149 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #25]
150 ; NONEON-NOSVE-NEXT: ldrb w14, [sp, #26]
151 ; NONEON-NOSVE-NEXT: add w9, w10, w11
152 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #27]
153 ; NONEON-NOSVE-NEXT: ldrb w15, [sp, #10]
154 ; NONEON-NOSVE-NEXT: add w10, w13, w12
155 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #11]
156 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #12]
157 ; NONEON-NOSVE-NEXT: add w9, w9, w10
158 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #28]
159 ; NONEON-NOSVE-NEXT: ldrb w16, [sp, #14]
160 ; NONEON-NOSVE-NEXT: add w11, w12, w11
161 ; NONEON-NOSVE-NEXT: ldrb w12, [sp, #29]
162 ; NONEON-NOSVE-NEXT: ldrb w17, [sp, #15]
163 ; NONEON-NOSVE-NEXT: add w10, w13, w10
164 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #13]
165 ; NONEON-NOSVE-NEXT: add w14, w15, w14
166 ; NONEON-NOSVE-NEXT: add w10, w11, w10
167 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #30]
168 ; NONEON-NOSVE-NEXT: add w9, w9, w14
169 ; NONEON-NOSVE-NEXT: add w12, w13, w12
170 ; NONEON-NOSVE-NEXT: ldrb w13, [sp, #31]
171 ; NONEON-NOSVE-NEXT: add w8, w8, w9
172 ; NONEON-NOSVE-NEXT: add w10, w10, w12
173 ; NONEON-NOSVE-NEXT: add w11, w16, w11
174 ; NONEON-NOSVE-NEXT: add w10, w10, w11
175 ; NONEON-NOSVE-NEXT: add w11, w17, w13
176 ; NONEON-NOSVE-NEXT: add w9, w10, w11
177 ; NONEON-NOSVE-NEXT: add w0, w8, w9
178 ; NONEON-NOSVE-NEXT: add sp, sp, #32
179 ; NONEON-NOSVE-NEXT: ret
180 %op = load <32 x i8>, ptr %a
181 %res = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> %op)
185 define i16 @uaddv_v4i16(<4 x i16> %a) {
186 ; CHECK-LABEL: uaddv_v4i16:
188 ; CHECK-NEXT: ptrue p0.h, vl4
189 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
190 ; CHECK-NEXT: uaddv d0, p0, z0.h
191 ; CHECK-NEXT: fmov x0, d0
192 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
195 ; NONEON-NOSVE-LABEL: uaddv_v4i16:
196 ; NONEON-NOSVE: // %bb.0:
197 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
198 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
199 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
200 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #14]
201 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #12]
202 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #10]
203 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #8]
204 ; NONEON-NOSVE-NEXT: add w8, w9, w8
205 ; NONEON-NOSVE-NEXT: add w10, w11, w10
206 ; NONEON-NOSVE-NEXT: add w0, w10, w8
207 ; NONEON-NOSVE-NEXT: add sp, sp, #16
208 ; NONEON-NOSVE-NEXT: ret
209 %res = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %a)
213 define i16 @uaddv_v8i16(<8 x i16> %a) {
214 ; CHECK-LABEL: uaddv_v8i16:
216 ; CHECK-NEXT: ptrue p0.h, vl8
217 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
218 ; CHECK-NEXT: uaddv d0, p0, z0.h
219 ; CHECK-NEXT: fmov x0, d0
220 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
223 ; NONEON-NOSVE-LABEL: uaddv_v8i16:
224 ; NONEON-NOSVE: // %bb.0:
225 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
226 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
227 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #10]
228 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #8]
229 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #6]
230 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #4]
231 ; NONEON-NOSVE-NEXT: ldrh w12, [sp, #2]
232 ; NONEON-NOSVE-NEXT: ldrh w13, [sp]
233 ; NONEON-NOSVE-NEXT: add w8, w9, w8
234 ; NONEON-NOSVE-NEXT: ldrh w14, [sp, #12]
235 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]
236 ; NONEON-NOSVE-NEXT: add w12, w13, w12
237 ; NONEON-NOSVE-NEXT: add w10, w11, w10
238 ; NONEON-NOSVE-NEXT: add w10, w12, w10
239 ; NONEON-NOSVE-NEXT: add w8, w8, w14
240 ; NONEON-NOSVE-NEXT: add w8, w10, w8
241 ; NONEON-NOSVE-NEXT: add w0, w8, w9
242 ; NONEON-NOSVE-NEXT: add sp, sp, #16
243 ; NONEON-NOSVE-NEXT: ret
244 %res = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %a)
248 define i16 @uaddv_v16i16(ptr %a) {
249 ; CHECK-LABEL: uaddv_v16i16:
251 ; CHECK-NEXT: ldp q1, q0, [x0]
252 ; CHECK-NEXT: ptrue p0.h, vl8
253 ; CHECK-NEXT: add z0.h, z1.h, z0.h
254 ; CHECK-NEXT: uaddv d0, p0, z0.h
255 ; CHECK-NEXT: fmov x0, d0
256 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
259 ; NONEON-NOSVE-LABEL: uaddv_v16i16:
260 ; NONEON-NOSVE: // %bb.0:
261 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
262 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
263 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
264 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #18]
265 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #2]
266 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #16]
267 ; NONEON-NOSVE-NEXT: ldrh w11, [sp]
268 ; NONEON-NOSVE-NEXT: ldrh w12, [sp, #20]
269 ; NONEON-NOSVE-NEXT: ldrh w13, [sp, #4]
270 ; NONEON-NOSVE-NEXT: add w8, w9, w8
271 ; NONEON-NOSVE-NEXT: ldrh w14, [sp, #22]
272 ; NONEON-NOSVE-NEXT: ldrh w15, [sp, #6]
273 ; NONEON-NOSVE-NEXT: add w9, w11, w10
274 ; NONEON-NOSVE-NEXT: add w12, w13, w12
275 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #26]
276 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #10]
277 ; NONEON-NOSVE-NEXT: add w13, w15, w14
278 ; NONEON-NOSVE-NEXT: add w8, w9, w8
279 ; NONEON-NOSVE-NEXT: ldrh w16, [sp, #24]
280 ; NONEON-NOSVE-NEXT: ldrh w17, [sp, #8]
281 ; NONEON-NOSVE-NEXT: add w9, w12, w13
282 ; NONEON-NOSVE-NEXT: add w10, w11, w10
283 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #28]
284 ; NONEON-NOSVE-NEXT: ldrh w15, [sp, #12]
285 ; NONEON-NOSVE-NEXT: add w14, w17, w16
286 ; NONEON-NOSVE-NEXT: ldrh w12, [sp, #30]
287 ; NONEON-NOSVE-NEXT: ldrh w13, [sp, #14]
288 ; NONEON-NOSVE-NEXT: add w10, w14, w10
289 ; NONEON-NOSVE-NEXT: add w11, w15, w11
290 ; NONEON-NOSVE-NEXT: add w8, w8, w9
291 ; NONEON-NOSVE-NEXT: add w9, w10, w11
292 ; NONEON-NOSVE-NEXT: add w8, w8, w9
293 ; NONEON-NOSVE-NEXT: add w9, w13, w12
294 ; NONEON-NOSVE-NEXT: add w0, w8, w9
295 ; NONEON-NOSVE-NEXT: add sp, sp, #32
296 ; NONEON-NOSVE-NEXT: ret
297 %op = load <16 x i16>, ptr %a
298 %res = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %op)
302 define i32 @uaddv_v2i32(<2 x i32> %a) {
303 ; CHECK-LABEL: uaddv_v2i32:
305 ; CHECK-NEXT: ptrue p0.s, vl2
306 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
307 ; CHECK-NEXT: uaddv d0, p0, z0.s
308 ; CHECK-NEXT: fmov x0, d0
309 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
312 ; NONEON-NOSVE-LABEL: uaddv_v2i32:
313 ; NONEON-NOSVE: // %bb.0:
314 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
315 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
316 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
317 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
318 ; NONEON-NOSVE-NEXT: add w0, w9, w8
319 ; NONEON-NOSVE-NEXT: add sp, sp, #16
320 ; NONEON-NOSVE-NEXT: ret
321 %res = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %a)
325 define i32 @uaddv_v4i32(<4 x i32> %a) {
326 ; CHECK-LABEL: uaddv_v4i32:
328 ; CHECK-NEXT: ptrue p0.s, vl4
329 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
330 ; CHECK-NEXT: uaddv d0, p0, z0.s
331 ; CHECK-NEXT: fmov x0, d0
332 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
335 ; NONEON-NOSVE-LABEL: uaddv_v4i32:
336 ; NONEON-NOSVE: // %bb.0:
337 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
338 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
339 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
340 ; NONEON-NOSVE-NEXT: ldp w11, w10, [sp], #16
341 ; NONEON-NOSVE-NEXT: add w10, w11, w10
342 ; NONEON-NOSVE-NEXT: add w8, w9, w8
343 ; NONEON-NOSVE-NEXT: add w0, w10, w8
344 ; NONEON-NOSVE-NEXT: ret
345 %res = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %a)
349 define i32 @uaddv_v8i32(ptr %a) {
350 ; CHECK-LABEL: uaddv_v8i32:
352 ; CHECK-NEXT: ldp q1, q0, [x0]
353 ; CHECK-NEXT: ptrue p0.s, vl4
354 ; CHECK-NEXT: add z0.s, z1.s, z0.s
355 ; CHECK-NEXT: uaddv d0, p0, z0.s
356 ; CHECK-NEXT: fmov x0, d0
357 ; CHECK-NEXT: // kill: def $w0 killed $w0 killed $x0
360 ; NONEON-NOSVE-LABEL: uaddv_v8i32:
361 ; NONEON-NOSVE: // %bb.0:
362 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
363 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
364 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
365 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #16]
366 ; NONEON-NOSVE-NEXT: ldp w11, w10, [sp]
367 ; NONEON-NOSVE-NEXT: ldp w12, w13, [sp, #24]
368 ; NONEON-NOSVE-NEXT: ldp w14, w15, [sp, #8]
369 ; NONEON-NOSVE-NEXT: add w8, w10, w8
370 ; NONEON-NOSVE-NEXT: add w9, w11, w9
371 ; NONEON-NOSVE-NEXT: add w8, w9, w8
372 ; NONEON-NOSVE-NEXT: add w10, w14, w12
373 ; NONEON-NOSVE-NEXT: add w11, w15, w13
374 ; NONEON-NOSVE-NEXT: add w9, w10, w11
375 ; NONEON-NOSVE-NEXT: add w0, w8, w9
376 ; NONEON-NOSVE-NEXT: add sp, sp, #32
377 ; NONEON-NOSVE-NEXT: ret
378 %op = load <8 x i32>, ptr %a
379 %res = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %op)
383 define i64 @uaddv_v2i64(<2 x i64> %a) {
384 ; CHECK-LABEL: uaddv_v2i64:
386 ; CHECK-NEXT: ptrue p0.d, vl2
387 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
388 ; CHECK-NEXT: uaddv d0, p0, z0.d
389 ; CHECK-NEXT: fmov x0, d0
392 ; NONEON-NOSVE-LABEL: uaddv_v2i64:
393 ; NONEON-NOSVE: // %bb.0:
394 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
395 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
396 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp], #16
397 ; NONEON-NOSVE-NEXT: add x0, x9, x8
398 ; NONEON-NOSVE-NEXT: ret
399 %res = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %a)
403 define i64 @uaddv_v4i64(ptr %a) {
404 ; CHECK-LABEL: uaddv_v4i64:
406 ; CHECK-NEXT: ldp q1, q0, [x0]
407 ; CHECK-NEXT: ptrue p0.d, vl2
408 ; CHECK-NEXT: add z0.d, z1.d, z0.d
409 ; CHECK-NEXT: uaddv d0, p0, z0.d
410 ; CHECK-NEXT: fmov x0, d0
413 ; NONEON-NOSVE-LABEL: uaddv_v4i64:
414 ; NONEON-NOSVE: // %bb.0:
415 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
416 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
417 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
418 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp, #16]
419 ; NONEON-NOSVE-NEXT: ldp x11, x10, [sp], #32
420 ; NONEON-NOSVE-NEXT: add x8, x10, x8
421 ; NONEON-NOSVE-NEXT: add x9, x11, x9
422 ; NONEON-NOSVE-NEXT: add x0, x9, x8
423 ; NONEON-NOSVE-NEXT: ret
424 %op = load <4 x i64>, ptr %a
425 %res = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %op)
433 define i8 @smaxv_v8i8(<8 x i8> %a) {
434 ; CHECK-LABEL: smaxv_v8i8:
436 ; CHECK-NEXT: ptrue p0.b, vl8
437 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
438 ; CHECK-NEXT: smaxv b0, p0, z0.b
439 ; CHECK-NEXT: fmov w0, s0
442 ; NONEON-NOSVE-LABEL: smaxv_v8i8:
443 ; NONEON-NOSVE: // %bb.0:
444 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
445 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
446 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
447 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #9]
448 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #8]
449 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #10]
450 ; NONEON-NOSVE-NEXT: cmp w9, w8
451 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
452 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #11]
453 ; NONEON-NOSVE-NEXT: cmp w8, w10
454 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
455 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #12]
456 ; NONEON-NOSVE-NEXT: cmp w8, w9
457 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
458 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #13]
459 ; NONEON-NOSVE-NEXT: cmp w8, w10
460 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
461 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #14]
462 ; NONEON-NOSVE-NEXT: cmp w8, w9
463 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
464 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #15]
465 ; NONEON-NOSVE-NEXT: cmp w8, w10
466 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
467 ; NONEON-NOSVE-NEXT: cmp w8, w9
468 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
469 ; NONEON-NOSVE-NEXT: add sp, sp, #16
470 ; NONEON-NOSVE-NEXT: ret
471 %res = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> %a)
475 define i8 @smaxv_v16i8(<16 x i8> %a) {
476 ; CHECK-LABEL: smaxv_v16i8:
478 ; CHECK-NEXT: ptrue p0.b, vl16
479 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
480 ; CHECK-NEXT: smaxv b0, p0, z0.b
481 ; CHECK-NEXT: fmov w0, s0
484 ; NONEON-NOSVE-LABEL: smaxv_v16i8:
485 ; NONEON-NOSVE: // %bb.0:
486 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
487 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
488 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #1]
489 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp]
490 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #2]
491 ; NONEON-NOSVE-NEXT: cmp w9, w8
492 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
493 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #3]
494 ; NONEON-NOSVE-NEXT: cmp w8, w10
495 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
496 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #4]
497 ; NONEON-NOSVE-NEXT: cmp w8, w9
498 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
499 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #5]
500 ; NONEON-NOSVE-NEXT: cmp w8, w10
501 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
502 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #6]
503 ; NONEON-NOSVE-NEXT: cmp w8, w9
504 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
505 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #7]
506 ; NONEON-NOSVE-NEXT: cmp w8, w10
507 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
508 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #8]
509 ; NONEON-NOSVE-NEXT: cmp w8, w9
510 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
511 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #9]
512 ; NONEON-NOSVE-NEXT: cmp w8, w10
513 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
514 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #10]
515 ; NONEON-NOSVE-NEXT: cmp w8, w9
516 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
517 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #11]
518 ; NONEON-NOSVE-NEXT: cmp w8, w10
519 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
520 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #12]
521 ; NONEON-NOSVE-NEXT: cmp w8, w9
522 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
523 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #13]
524 ; NONEON-NOSVE-NEXT: cmp w8, w10
525 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
526 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #14]
527 ; NONEON-NOSVE-NEXT: cmp w8, w9
528 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
529 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #15]
530 ; NONEON-NOSVE-NEXT: cmp w8, w10
531 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
532 ; NONEON-NOSVE-NEXT: cmp w8, w9
533 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
534 ; NONEON-NOSVE-NEXT: add sp, sp, #16
535 ; NONEON-NOSVE-NEXT: ret
536 %res = call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %a)
540 define i8 @smaxv_v32i8(ptr %a) {
541 ; CHECK-LABEL: smaxv_v32i8:
543 ; CHECK-NEXT: ldp q1, q0, [x0]
544 ; CHECK-NEXT: ptrue p0.b, vl16
545 ; CHECK-NEXT: smax z0.b, p0/m, z0.b, z1.b
546 ; CHECK-NEXT: smaxv b0, p0, z0.b
547 ; CHECK-NEXT: fmov w0, s0
550 ; NONEON-NOSVE-LABEL: smaxv_v32i8:
551 ; NONEON-NOSVE: // %bb.0:
552 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
553 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
554 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
555 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #17]
556 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #1]
557 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #16]
558 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp]
559 ; NONEON-NOSVE-NEXT: cmp w9, w8
560 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
561 ; NONEON-NOSVE-NEXT: cmp w11, w10
562 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
563 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #18]
564 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #2]
565 ; NONEON-NOSVE-NEXT: cmp w9, w8
566 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
567 ; NONEON-NOSVE-NEXT: cmp w11, w10
568 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
569 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #19]
570 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #3]
571 ; NONEON-NOSVE-NEXT: cmp w8, w9
572 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
573 ; NONEON-NOSVE-NEXT: cmp w11, w10
574 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
575 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #20]
576 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #4]
577 ; NONEON-NOSVE-NEXT: cmp w8, w9
578 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
579 ; NONEON-NOSVE-NEXT: cmp w11, w10
580 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
581 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #21]
582 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #5]
583 ; NONEON-NOSVE-NEXT: cmp w8, w9
584 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
585 ; NONEON-NOSVE-NEXT: cmp w11, w10
586 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
587 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #22]
588 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #6]
589 ; NONEON-NOSVE-NEXT: cmp w8, w9
590 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
591 ; NONEON-NOSVE-NEXT: cmp w11, w10
592 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
593 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #23]
594 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #7]
595 ; NONEON-NOSVE-NEXT: cmp w8, w9
596 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
597 ; NONEON-NOSVE-NEXT: cmp w11, w10
598 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
599 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #24]
600 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #8]
601 ; NONEON-NOSVE-NEXT: cmp w8, w9
602 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
603 ; NONEON-NOSVE-NEXT: cmp w11, w10
604 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
605 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #25]
606 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #9]
607 ; NONEON-NOSVE-NEXT: cmp w8, w9
608 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
609 ; NONEON-NOSVE-NEXT: cmp w11, w10
610 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
611 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #26]
612 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #10]
613 ; NONEON-NOSVE-NEXT: cmp w8, w9
614 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
615 ; NONEON-NOSVE-NEXT: cmp w11, w10
616 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
617 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #27]
618 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #11]
619 ; NONEON-NOSVE-NEXT: cmp w8, w9
620 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
621 ; NONEON-NOSVE-NEXT: cmp w11, w10
622 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
623 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #28]
624 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #12]
625 ; NONEON-NOSVE-NEXT: cmp w8, w9
626 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
627 ; NONEON-NOSVE-NEXT: cmp w11, w10
628 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
629 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #29]
630 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #13]
631 ; NONEON-NOSVE-NEXT: cmp w8, w9
632 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
633 ; NONEON-NOSVE-NEXT: cmp w11, w10
634 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
635 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #30]
636 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #14]
637 ; NONEON-NOSVE-NEXT: cmp w8, w9
638 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
639 ; NONEON-NOSVE-NEXT: cmp w11, w10
640 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
641 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #31]
642 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #15]
643 ; NONEON-NOSVE-NEXT: cmp w8, w9
644 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
645 ; NONEON-NOSVE-NEXT: cmp w11, w10
646 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
647 ; NONEON-NOSVE-NEXT: cmp w8, w9
648 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
649 ; NONEON-NOSVE-NEXT: add sp, sp, #32
650 ; NONEON-NOSVE-NEXT: ret
651 %op = load <32 x i8>, ptr %a
652 %res = call i8 @llvm.vector.reduce.smax.v32i8(<32 x i8> %op)
656 define i16 @smaxv_v4i16(<4 x i16> %a) {
657 ; CHECK-LABEL: smaxv_v4i16:
659 ; CHECK-NEXT: ptrue p0.h, vl4
660 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
661 ; CHECK-NEXT: smaxv h0, p0, z0.h
662 ; CHECK-NEXT: fmov w0, s0
665 ; NONEON-NOSVE-LABEL: smaxv_v4i16:
666 ; NONEON-NOSVE: // %bb.0:
667 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
668 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
669 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
670 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #10]
671 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #8]
672 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #12]
673 ; NONEON-NOSVE-NEXT: cmp w9, w8
674 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
675 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #14]
676 ; NONEON-NOSVE-NEXT: cmp w8, w10
677 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
678 ; NONEON-NOSVE-NEXT: cmp w8, w9
679 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
680 ; NONEON-NOSVE-NEXT: add sp, sp, #16
681 ; NONEON-NOSVE-NEXT: ret
682 %res = call i16 @llvm.vector.reduce.smax.v4i16(<4 x i16> %a)
686 define i16 @smaxv_v8i16(<8 x i16> %a) {
687 ; CHECK-LABEL: smaxv_v8i16:
689 ; CHECK-NEXT: ptrue p0.h, vl8
690 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
691 ; CHECK-NEXT: smaxv h0, p0, z0.h
692 ; CHECK-NEXT: fmov w0, s0
695 ; NONEON-NOSVE-LABEL: smaxv_v8i16:
696 ; NONEON-NOSVE: // %bb.0:
697 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
698 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
699 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #2]
700 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp]
701 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #4]
702 ; NONEON-NOSVE-NEXT: cmp w9, w8
703 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
704 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #6]
705 ; NONEON-NOSVE-NEXT: cmp w8, w10
706 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
707 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #8]
708 ; NONEON-NOSVE-NEXT: cmp w8, w9
709 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
710 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #10]
711 ; NONEON-NOSVE-NEXT: cmp w8, w10
712 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
713 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #12]
714 ; NONEON-NOSVE-NEXT: cmp w8, w9
715 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
716 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #14]
717 ; NONEON-NOSVE-NEXT: cmp w8, w10
718 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
719 ; NONEON-NOSVE-NEXT: cmp w8, w9
720 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
721 ; NONEON-NOSVE-NEXT: add sp, sp, #16
722 ; NONEON-NOSVE-NEXT: ret
723 %res = call i16 @llvm.vector.reduce.smax.v8i16(<8 x i16> %a)
727 define i16 @smaxv_v16i16(ptr %a) {
728 ; CHECK-LABEL: smaxv_v16i16:
730 ; CHECK-NEXT: ldp q1, q0, [x0]
731 ; CHECK-NEXT: ptrue p0.h, vl8
732 ; CHECK-NEXT: smax z0.h, p0/m, z0.h, z1.h
733 ; CHECK-NEXT: smaxv h0, p0, z0.h
734 ; CHECK-NEXT: fmov w0, s0
737 ; NONEON-NOSVE-LABEL: smaxv_v16i16:
738 ; NONEON-NOSVE: // %bb.0:
739 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
740 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
741 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
742 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #18]
743 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #2]
744 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #16]
745 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp]
746 ; NONEON-NOSVE-NEXT: cmp w9, w8
747 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
748 ; NONEON-NOSVE-NEXT: cmp w11, w10
749 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
750 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #20]
751 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #4]
752 ; NONEON-NOSVE-NEXT: cmp w9, w8
753 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
754 ; NONEON-NOSVE-NEXT: cmp w11, w10
755 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
756 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #22]
757 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #6]
758 ; NONEON-NOSVE-NEXT: cmp w8, w9
759 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
760 ; NONEON-NOSVE-NEXT: cmp w11, w10
761 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
762 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #24]
763 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #8]
764 ; NONEON-NOSVE-NEXT: cmp w8, w9
765 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
766 ; NONEON-NOSVE-NEXT: cmp w11, w10
767 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
768 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #26]
769 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #10]
770 ; NONEON-NOSVE-NEXT: cmp w8, w9
771 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
772 ; NONEON-NOSVE-NEXT: cmp w11, w10
773 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
774 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #28]
775 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #12]
776 ; NONEON-NOSVE-NEXT: cmp w8, w9
777 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
778 ; NONEON-NOSVE-NEXT: cmp w11, w10
779 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
780 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #30]
781 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #14]
782 ; NONEON-NOSVE-NEXT: cmp w8, w9
783 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
784 ; NONEON-NOSVE-NEXT: cmp w11, w10
785 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
786 ; NONEON-NOSVE-NEXT: cmp w8, w9
787 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
788 ; NONEON-NOSVE-NEXT: add sp, sp, #32
789 ; NONEON-NOSVE-NEXT: ret
790 %op = load <16 x i16>, ptr %a
791 %res = call i16 @llvm.vector.reduce.smax.v16i16(<16 x i16> %op)
795 define i32 @smaxv_v2i32(<2 x i32> %a) {
796 ; CHECK-LABEL: smaxv_v2i32:
798 ; CHECK-NEXT: ptrue p0.s, vl2
799 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
800 ; CHECK-NEXT: smaxv s0, p0, z0.s
801 ; CHECK-NEXT: fmov w0, s0
804 ; NONEON-NOSVE-LABEL: smaxv_v2i32:
805 ; NONEON-NOSVE: // %bb.0:
806 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
807 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
808 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
809 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
810 ; NONEON-NOSVE-NEXT: cmp w9, w8
811 ; NONEON-NOSVE-NEXT: csel w0, w9, w8, gt
812 ; NONEON-NOSVE-NEXT: add sp, sp, #16
813 ; NONEON-NOSVE-NEXT: ret
814 %res = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %a)
818 define i32 @smaxv_v4i32(<4 x i32> %a) {
819 ; CHECK-LABEL: smaxv_v4i32:
821 ; CHECK-NEXT: ptrue p0.s, vl4
822 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
823 ; CHECK-NEXT: smaxv s0, p0, z0.s
824 ; CHECK-NEXT: fmov w0, s0
827 ; NONEON-NOSVE-LABEL: smaxv_v4i32:
828 ; NONEON-NOSVE: // %bb.0:
829 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
830 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
831 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp]
832 ; NONEON-NOSVE-NEXT: cmp w9, w8
833 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
834 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #8]
835 ; NONEON-NOSVE-NEXT: cmp w8, w10
836 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
837 ; NONEON-NOSVE-NEXT: cmp w8, w9
838 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
839 ; NONEON-NOSVE-NEXT: add sp, sp, #16
840 ; NONEON-NOSVE-NEXT: ret
841 %res = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %a)
845 define i32 @smaxv_v8i32(ptr %a) {
846 ; CHECK-LABEL: smaxv_v8i32:
848 ; CHECK-NEXT: ldp q1, q0, [x0]
849 ; CHECK-NEXT: ptrue p0.s, vl4
850 ; CHECK-NEXT: smax z0.s, p0/m, z0.s, z1.s
851 ; CHECK-NEXT: smaxv s0, p0, z0.s
852 ; CHECK-NEXT: fmov w0, s0
855 ; NONEON-NOSVE-LABEL: smaxv_v8i32:
856 ; NONEON-NOSVE: // %bb.0:
857 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
858 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
859 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
860 ; NONEON-NOSVE-NEXT: ldp w11, w8, [sp]
861 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #16]
862 ; NONEON-NOSVE-NEXT: cmp w8, w9
863 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, gt
864 ; NONEON-NOSVE-NEXT: cmp w11, w10
865 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, gt
866 ; NONEON-NOSVE-NEXT: cmp w9, w8
867 ; NONEON-NOSVE-NEXT: ldp w10, w12, [sp, #8]
868 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, gt
869 ; NONEON-NOSVE-NEXT: ldp w11, w9, [sp, #24]
870 ; NONEON-NOSVE-NEXT: cmp w10, w11
871 ; NONEON-NOSVE-NEXT: csel w10, w10, w11, gt
872 ; NONEON-NOSVE-NEXT: cmp w8, w10
873 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, gt
874 ; NONEON-NOSVE-NEXT: cmp w12, w9
875 ; NONEON-NOSVE-NEXT: csel w9, w12, w9, gt
876 ; NONEON-NOSVE-NEXT: cmp w8, w9
877 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, gt
878 ; NONEON-NOSVE-NEXT: add sp, sp, #32
879 ; NONEON-NOSVE-NEXT: ret
880 %op = load <8 x i32>, ptr %a
881 %res = call i32 @llvm.vector.reduce.smax.v8i32(<8 x i32> %op)
885 ; No NEON 64-bit vector SMAXV support. Use SVE.
886 define i64 @smaxv_v2i64(<2 x i64> %a) {
887 ; CHECK-LABEL: smaxv_v2i64:
889 ; CHECK-NEXT: ptrue p0.d, vl2
890 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
891 ; CHECK-NEXT: smaxv d0, p0, z0.d
892 ; CHECK-NEXT: fmov x0, d0
895 ; NONEON-NOSVE-LABEL: smaxv_v2i64:
896 ; NONEON-NOSVE: // %bb.0:
897 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
898 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
899 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp], #16
900 ; NONEON-NOSVE-NEXT: cmp x9, x8
901 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, gt
902 ; NONEON-NOSVE-NEXT: ret
903 %res = call i64 @llvm.vector.reduce.smax.v2i64(<2 x i64> %a)
907 define i64 @smaxv_v4i64(ptr %a) {
908 ; CHECK-LABEL: smaxv_v4i64:
910 ; CHECK-NEXT: ldp q1, q0, [x0]
911 ; CHECK-NEXT: ptrue p0.d, vl2
912 ; CHECK-NEXT: smax z0.d, p0/m, z0.d, z1.d
913 ; CHECK-NEXT: smaxv d0, p0, z0.d
914 ; CHECK-NEXT: fmov x0, d0
917 ; NONEON-NOSVE-LABEL: smaxv_v4i64:
918 ; NONEON-NOSVE: // %bb.0:
919 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
920 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
921 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
922 ; NONEON-NOSVE-NEXT: ldp x8, x10, [sp, #8]
923 ; NONEON-NOSVE-NEXT: ldr x9, [sp, #24]
924 ; NONEON-NOSVE-NEXT: ldr x11, [sp], #32
925 ; NONEON-NOSVE-NEXT: cmp x8, x9
926 ; NONEON-NOSVE-NEXT: csel x8, x8, x9, gt
927 ; NONEON-NOSVE-NEXT: cmp x11, x10
928 ; NONEON-NOSVE-NEXT: csel x9, x11, x10, gt
929 ; NONEON-NOSVE-NEXT: cmp x9, x8
930 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, gt
931 ; NONEON-NOSVE-NEXT: ret
932 %op = load <4 x i64>, ptr %a
933 %res = call i64 @llvm.vector.reduce.smax.v4i64(<4 x i64> %op)
941 define i8 @sminv_v8i8(<8 x i8> %a) {
942 ; CHECK-LABEL: sminv_v8i8:
944 ; CHECK-NEXT: ptrue p0.b, vl8
945 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
946 ; CHECK-NEXT: sminv b0, p0, z0.b
947 ; CHECK-NEXT: fmov w0, s0
950 ; NONEON-NOSVE-LABEL: sminv_v8i8:
951 ; NONEON-NOSVE: // %bb.0:
952 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
953 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
954 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
955 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #9]
956 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #8]
957 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #10]
958 ; NONEON-NOSVE-NEXT: cmp w9, w8
959 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
960 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #11]
961 ; NONEON-NOSVE-NEXT: cmp w8, w10
962 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
963 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #12]
964 ; NONEON-NOSVE-NEXT: cmp w8, w9
965 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
966 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #13]
967 ; NONEON-NOSVE-NEXT: cmp w8, w10
968 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
969 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #14]
970 ; NONEON-NOSVE-NEXT: cmp w8, w9
971 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
972 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #15]
973 ; NONEON-NOSVE-NEXT: cmp w8, w10
974 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
975 ; NONEON-NOSVE-NEXT: cmp w8, w9
976 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
977 ; NONEON-NOSVE-NEXT: add sp, sp, #16
978 ; NONEON-NOSVE-NEXT: ret
979 %res = call i8 @llvm.vector.reduce.smin.v8i8(<8 x i8> %a)
983 define i8 @sminv_v16i8(<16 x i8> %a) {
984 ; CHECK-LABEL: sminv_v16i8:
986 ; CHECK-NEXT: ptrue p0.b, vl16
987 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
988 ; CHECK-NEXT: sminv b0, p0, z0.b
989 ; CHECK-NEXT: fmov w0, s0
992 ; NONEON-NOSVE-LABEL: sminv_v16i8:
993 ; NONEON-NOSVE: // %bb.0:
994 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
995 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
996 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #1]
997 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp]
998 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #2]
999 ; NONEON-NOSVE-NEXT: cmp w9, w8
1000 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1001 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #3]
1002 ; NONEON-NOSVE-NEXT: cmp w8, w10
1003 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1004 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #4]
1005 ; NONEON-NOSVE-NEXT: cmp w8, w9
1006 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1007 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #5]
1008 ; NONEON-NOSVE-NEXT: cmp w8, w10
1009 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1010 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #6]
1011 ; NONEON-NOSVE-NEXT: cmp w8, w9
1012 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1013 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #7]
1014 ; NONEON-NOSVE-NEXT: cmp w8, w10
1015 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1016 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #8]
1017 ; NONEON-NOSVE-NEXT: cmp w8, w9
1018 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1019 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #9]
1020 ; NONEON-NOSVE-NEXT: cmp w8, w10
1021 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1022 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #10]
1023 ; NONEON-NOSVE-NEXT: cmp w8, w9
1024 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1025 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #11]
1026 ; NONEON-NOSVE-NEXT: cmp w8, w10
1027 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1028 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #12]
1029 ; NONEON-NOSVE-NEXT: cmp w8, w9
1030 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1031 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #13]
1032 ; NONEON-NOSVE-NEXT: cmp w8, w10
1033 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1034 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #14]
1035 ; NONEON-NOSVE-NEXT: cmp w8, w9
1036 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1037 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #15]
1038 ; NONEON-NOSVE-NEXT: cmp w8, w10
1039 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1040 ; NONEON-NOSVE-NEXT: cmp w8, w9
1041 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1042 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1043 ; NONEON-NOSVE-NEXT: ret
1044 %res = call i8 @llvm.vector.reduce.smin.v16i8(<16 x i8> %a)
1048 define i8 @sminv_v32i8(ptr %a) {
1049 ; CHECK-LABEL: sminv_v32i8:
1051 ; CHECK-NEXT: ldp q1, q0, [x0]
1052 ; CHECK-NEXT: ptrue p0.b, vl16
1053 ; CHECK-NEXT: smin z0.b, p0/m, z0.b, z1.b
1054 ; CHECK-NEXT: sminv b0, p0, z0.b
1055 ; CHECK-NEXT: fmov w0, s0
1058 ; NONEON-NOSVE-LABEL: sminv_v32i8:
1059 ; NONEON-NOSVE: // %bb.0:
1060 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1061 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1062 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1063 ; NONEON-NOSVE-NEXT: ldrsb w8, [sp, #17]
1064 ; NONEON-NOSVE-NEXT: ldrsb w9, [sp, #1]
1065 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #16]
1066 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp]
1067 ; NONEON-NOSVE-NEXT: cmp w9, w8
1068 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1069 ; NONEON-NOSVE-NEXT: cmp w11, w10
1070 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1071 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #18]
1072 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #2]
1073 ; NONEON-NOSVE-NEXT: cmp w9, w8
1074 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1075 ; NONEON-NOSVE-NEXT: cmp w11, w10
1076 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1077 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #19]
1078 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #3]
1079 ; NONEON-NOSVE-NEXT: cmp w8, w9
1080 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1081 ; NONEON-NOSVE-NEXT: cmp w11, w10
1082 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1083 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #20]
1084 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #4]
1085 ; NONEON-NOSVE-NEXT: cmp w8, w9
1086 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1087 ; NONEON-NOSVE-NEXT: cmp w11, w10
1088 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1089 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #21]
1090 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #5]
1091 ; NONEON-NOSVE-NEXT: cmp w8, w9
1092 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1093 ; NONEON-NOSVE-NEXT: cmp w11, w10
1094 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1095 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #22]
1096 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #6]
1097 ; NONEON-NOSVE-NEXT: cmp w8, w9
1098 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1099 ; NONEON-NOSVE-NEXT: cmp w11, w10
1100 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1101 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #23]
1102 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #7]
1103 ; NONEON-NOSVE-NEXT: cmp w8, w9
1104 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1105 ; NONEON-NOSVE-NEXT: cmp w11, w10
1106 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1107 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #24]
1108 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #8]
1109 ; NONEON-NOSVE-NEXT: cmp w8, w9
1110 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1111 ; NONEON-NOSVE-NEXT: cmp w11, w10
1112 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1113 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #25]
1114 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #9]
1115 ; NONEON-NOSVE-NEXT: cmp w8, w9
1116 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1117 ; NONEON-NOSVE-NEXT: cmp w11, w10
1118 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1119 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #26]
1120 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #10]
1121 ; NONEON-NOSVE-NEXT: cmp w8, w9
1122 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1123 ; NONEON-NOSVE-NEXT: cmp w11, w10
1124 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1125 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #27]
1126 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #11]
1127 ; NONEON-NOSVE-NEXT: cmp w8, w9
1128 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1129 ; NONEON-NOSVE-NEXT: cmp w11, w10
1130 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1131 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #28]
1132 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #12]
1133 ; NONEON-NOSVE-NEXT: cmp w8, w9
1134 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1135 ; NONEON-NOSVE-NEXT: cmp w11, w10
1136 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1137 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #29]
1138 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #13]
1139 ; NONEON-NOSVE-NEXT: cmp w8, w9
1140 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1141 ; NONEON-NOSVE-NEXT: cmp w11, w10
1142 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1143 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #30]
1144 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #14]
1145 ; NONEON-NOSVE-NEXT: cmp w8, w9
1146 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1147 ; NONEON-NOSVE-NEXT: cmp w11, w10
1148 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1149 ; NONEON-NOSVE-NEXT: ldrsb w10, [sp, #31]
1150 ; NONEON-NOSVE-NEXT: ldrsb w11, [sp, #15]
1151 ; NONEON-NOSVE-NEXT: cmp w8, w9
1152 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1153 ; NONEON-NOSVE-NEXT: cmp w11, w10
1154 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1155 ; NONEON-NOSVE-NEXT: cmp w8, w9
1156 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1157 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1158 ; NONEON-NOSVE-NEXT: ret
1159 %op = load <32 x i8>, ptr %a
1160 %res = call i8 @llvm.vector.reduce.smin.v32i8(<32 x i8> %op)
1164 define i16 @sminv_v4i16(<4 x i16> %a) {
1165 ; CHECK-LABEL: sminv_v4i16:
1167 ; CHECK-NEXT: ptrue p0.h, vl4
1168 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1169 ; CHECK-NEXT: sminv h0, p0, z0.h
1170 ; CHECK-NEXT: fmov w0, s0
1173 ; NONEON-NOSVE-LABEL: sminv_v4i16:
1174 ; NONEON-NOSVE: // %bb.0:
1175 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1176 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1177 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1178 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #10]
1179 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #8]
1180 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #12]
1181 ; NONEON-NOSVE-NEXT: cmp w9, w8
1182 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1183 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #14]
1184 ; NONEON-NOSVE-NEXT: cmp w8, w10
1185 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1186 ; NONEON-NOSVE-NEXT: cmp w8, w9
1187 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1188 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1189 ; NONEON-NOSVE-NEXT: ret
1190 %res = call i16 @llvm.vector.reduce.smin.v4i16(<4 x i16> %a)
1194 define i16 @sminv_v8i16(<8 x i16> %a) {
1195 ; CHECK-LABEL: sminv_v8i16:
1197 ; CHECK-NEXT: ptrue p0.h, vl8
1198 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1199 ; CHECK-NEXT: sminv h0, p0, z0.h
1200 ; CHECK-NEXT: fmov w0, s0
1203 ; NONEON-NOSVE-LABEL: sminv_v8i16:
1204 ; NONEON-NOSVE: // %bb.0:
1205 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1206 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1207 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #2]
1208 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp]
1209 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #4]
1210 ; NONEON-NOSVE-NEXT: cmp w9, w8
1211 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1212 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #6]
1213 ; NONEON-NOSVE-NEXT: cmp w8, w10
1214 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1215 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #8]
1216 ; NONEON-NOSVE-NEXT: cmp w8, w9
1217 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1218 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #10]
1219 ; NONEON-NOSVE-NEXT: cmp w8, w10
1220 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1221 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #12]
1222 ; NONEON-NOSVE-NEXT: cmp w8, w9
1223 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1224 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #14]
1225 ; NONEON-NOSVE-NEXT: cmp w8, w10
1226 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1227 ; NONEON-NOSVE-NEXT: cmp w8, w9
1228 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1229 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1230 ; NONEON-NOSVE-NEXT: ret
1231 %res = call i16 @llvm.vector.reduce.smin.v8i16(<8 x i16> %a)
1235 define i16 @sminv_v16i16(ptr %a) {
1236 ; CHECK-LABEL: sminv_v16i16:
1238 ; CHECK-NEXT: ldp q1, q0, [x0]
1239 ; CHECK-NEXT: ptrue p0.h, vl8
1240 ; CHECK-NEXT: smin z0.h, p0/m, z0.h, z1.h
1241 ; CHECK-NEXT: sminv h0, p0, z0.h
1242 ; CHECK-NEXT: fmov w0, s0
1245 ; NONEON-NOSVE-LABEL: sminv_v16i16:
1246 ; NONEON-NOSVE: // %bb.0:
1247 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1248 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1249 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1250 ; NONEON-NOSVE-NEXT: ldrsh w8, [sp, #18]
1251 ; NONEON-NOSVE-NEXT: ldrsh w9, [sp, #2]
1252 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #16]
1253 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp]
1254 ; NONEON-NOSVE-NEXT: cmp w9, w8
1255 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1256 ; NONEON-NOSVE-NEXT: cmp w11, w10
1257 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1258 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #20]
1259 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #4]
1260 ; NONEON-NOSVE-NEXT: cmp w9, w8
1261 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1262 ; NONEON-NOSVE-NEXT: cmp w11, w10
1263 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1264 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #22]
1265 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #6]
1266 ; NONEON-NOSVE-NEXT: cmp w8, w9
1267 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1268 ; NONEON-NOSVE-NEXT: cmp w11, w10
1269 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1270 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #24]
1271 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #8]
1272 ; NONEON-NOSVE-NEXT: cmp w8, w9
1273 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1274 ; NONEON-NOSVE-NEXT: cmp w11, w10
1275 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1276 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #26]
1277 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #10]
1278 ; NONEON-NOSVE-NEXT: cmp w8, w9
1279 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1280 ; NONEON-NOSVE-NEXT: cmp w11, w10
1281 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1282 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #28]
1283 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #12]
1284 ; NONEON-NOSVE-NEXT: cmp w8, w9
1285 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1286 ; NONEON-NOSVE-NEXT: cmp w11, w10
1287 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1288 ; NONEON-NOSVE-NEXT: ldrsh w10, [sp, #30]
1289 ; NONEON-NOSVE-NEXT: ldrsh w11, [sp, #14]
1290 ; NONEON-NOSVE-NEXT: cmp w8, w9
1291 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1292 ; NONEON-NOSVE-NEXT: cmp w11, w10
1293 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1294 ; NONEON-NOSVE-NEXT: cmp w8, w9
1295 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1296 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1297 ; NONEON-NOSVE-NEXT: ret
1298 %op = load <16 x i16>, ptr %a
1299 %res = call i16 @llvm.vector.reduce.smin.v16i16(<16 x i16> %op)
1303 define i32 @sminv_v2i32(<2 x i32> %a) {
1304 ; CHECK-LABEL: sminv_v2i32:
1306 ; CHECK-NEXT: ptrue p0.s, vl2
1307 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1308 ; CHECK-NEXT: sminv s0, p0, z0.s
1309 ; CHECK-NEXT: fmov w0, s0
1312 ; NONEON-NOSVE-LABEL: sminv_v2i32:
1313 ; NONEON-NOSVE: // %bb.0:
1314 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1315 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1316 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1317 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
1318 ; NONEON-NOSVE-NEXT: cmp w9, w8
1319 ; NONEON-NOSVE-NEXT: csel w0, w9, w8, lt
1320 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1321 ; NONEON-NOSVE-NEXT: ret
1322 %res = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %a)
1326 define i32 @sminv_v4i32(<4 x i32> %a) {
1327 ; CHECK-LABEL: sminv_v4i32:
1329 ; CHECK-NEXT: ptrue p0.s, vl4
1330 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1331 ; CHECK-NEXT: sminv s0, p0, z0.s
1332 ; CHECK-NEXT: fmov w0, s0
1335 ; NONEON-NOSVE-LABEL: sminv_v4i32:
1336 ; NONEON-NOSVE: // %bb.0:
1337 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1338 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1339 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp]
1340 ; NONEON-NOSVE-NEXT: cmp w9, w8
1341 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1342 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #8]
1343 ; NONEON-NOSVE-NEXT: cmp w8, w10
1344 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1345 ; NONEON-NOSVE-NEXT: cmp w8, w9
1346 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1347 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1348 ; NONEON-NOSVE-NEXT: ret
1349 %res = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %a)
1353 define i32 @sminv_v8i32(ptr %a) {
1354 ; CHECK-LABEL: sminv_v8i32:
1356 ; CHECK-NEXT: ldp q1, q0, [x0]
1357 ; CHECK-NEXT: ptrue p0.s, vl4
1358 ; CHECK-NEXT: smin z0.s, p0/m, z0.s, z1.s
1359 ; CHECK-NEXT: sminv s0, p0, z0.s
1360 ; CHECK-NEXT: fmov w0, s0
1363 ; NONEON-NOSVE-LABEL: sminv_v8i32:
1364 ; NONEON-NOSVE: // %bb.0:
1365 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1366 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1367 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1368 ; NONEON-NOSVE-NEXT: ldp w11, w8, [sp]
1369 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #16]
1370 ; NONEON-NOSVE-NEXT: cmp w8, w9
1371 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lt
1372 ; NONEON-NOSVE-NEXT: cmp w11, w10
1373 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lt
1374 ; NONEON-NOSVE-NEXT: cmp w9, w8
1375 ; NONEON-NOSVE-NEXT: ldp w10, w12, [sp, #8]
1376 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lt
1377 ; NONEON-NOSVE-NEXT: ldp w11, w9, [sp, #24]
1378 ; NONEON-NOSVE-NEXT: cmp w10, w11
1379 ; NONEON-NOSVE-NEXT: csel w10, w10, w11, lt
1380 ; NONEON-NOSVE-NEXT: cmp w8, w10
1381 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lt
1382 ; NONEON-NOSVE-NEXT: cmp w12, w9
1383 ; NONEON-NOSVE-NEXT: csel w9, w12, w9, lt
1384 ; NONEON-NOSVE-NEXT: cmp w8, w9
1385 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lt
1386 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1387 ; NONEON-NOSVE-NEXT: ret
1388 %op = load <8 x i32>, ptr %a
1389 %res = call i32 @llvm.vector.reduce.smin.v8i32(<8 x i32> %op)
1393 ; No NEON 64-bit vector SMINV support. Use SVE.
1394 define i64 @sminv_v2i64(<2 x i64> %a) {
1395 ; CHECK-LABEL: sminv_v2i64:
1397 ; CHECK-NEXT: ptrue p0.d, vl2
1398 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1399 ; CHECK-NEXT: sminv d0, p0, z0.d
1400 ; CHECK-NEXT: fmov x0, d0
1403 ; NONEON-NOSVE-LABEL: sminv_v2i64:
1404 ; NONEON-NOSVE: // %bb.0:
1405 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1406 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1407 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp], #16
1408 ; NONEON-NOSVE-NEXT: cmp x9, x8
1409 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, lt
1410 ; NONEON-NOSVE-NEXT: ret
1411 %res = call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %a)
1415 define i64 @sminv_v4i64(ptr %a) {
1416 ; CHECK-LABEL: sminv_v4i64:
1418 ; CHECK-NEXT: ldp q1, q0, [x0]
1419 ; CHECK-NEXT: ptrue p0.d, vl2
1420 ; CHECK-NEXT: smin z0.d, p0/m, z0.d, z1.d
1421 ; CHECK-NEXT: sminv d0, p0, z0.d
1422 ; CHECK-NEXT: fmov x0, d0
1425 ; NONEON-NOSVE-LABEL: sminv_v4i64:
1426 ; NONEON-NOSVE: // %bb.0:
1427 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1428 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1429 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1430 ; NONEON-NOSVE-NEXT: ldp x8, x10, [sp, #8]
1431 ; NONEON-NOSVE-NEXT: ldr x9, [sp, #24]
1432 ; NONEON-NOSVE-NEXT: ldr x11, [sp], #32
1433 ; NONEON-NOSVE-NEXT: cmp x8, x9
1434 ; NONEON-NOSVE-NEXT: csel x8, x8, x9, lt
1435 ; NONEON-NOSVE-NEXT: cmp x11, x10
1436 ; NONEON-NOSVE-NEXT: csel x9, x11, x10, lt
1437 ; NONEON-NOSVE-NEXT: cmp x9, x8
1438 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, lt
1439 ; NONEON-NOSVE-NEXT: ret
1440 %op = load <4 x i64>, ptr %a
1441 %res = call i64 @llvm.vector.reduce.smin.v4i64(<4 x i64> %op)
1449 define i8 @umaxv_v8i8(<8 x i8> %a) {
1450 ; CHECK-LABEL: umaxv_v8i8:
1452 ; CHECK-NEXT: ptrue p0.b, vl8
1453 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1454 ; CHECK-NEXT: umaxv b0, p0, z0.b
1455 ; CHECK-NEXT: fmov w0, s0
1458 ; NONEON-NOSVE-LABEL: umaxv_v8i8:
1459 ; NONEON-NOSVE: // %bb.0:
1460 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1461 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1462 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1463 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #9]
1464 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #8]
1465 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #10]
1466 ; NONEON-NOSVE-NEXT: cmp w9, w8
1467 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1468 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #11]
1469 ; NONEON-NOSVE-NEXT: cmp w8, w10
1470 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1471 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #12]
1472 ; NONEON-NOSVE-NEXT: cmp w8, w9
1473 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1474 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #13]
1475 ; NONEON-NOSVE-NEXT: cmp w8, w10
1476 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1477 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #14]
1478 ; NONEON-NOSVE-NEXT: cmp w8, w9
1479 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1480 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #15]
1481 ; NONEON-NOSVE-NEXT: cmp w8, w10
1482 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1483 ; NONEON-NOSVE-NEXT: cmp w8, w9
1484 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1485 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1486 ; NONEON-NOSVE-NEXT: ret
1487 %res = call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %a)
1491 define i8 @umaxv_v16i8(<16 x i8> %a) {
1492 ; CHECK-LABEL: umaxv_v16i8:
1494 ; CHECK-NEXT: ptrue p0.b, vl16
1495 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1496 ; CHECK-NEXT: umaxv b0, p0, z0.b
1497 ; CHECK-NEXT: fmov w0, s0
1500 ; NONEON-NOSVE-LABEL: umaxv_v16i8:
1501 ; NONEON-NOSVE: // %bb.0:
1502 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1503 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1504 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #1]
1505 ; NONEON-NOSVE-NEXT: ldrb w9, [sp]
1506 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #2]
1507 ; NONEON-NOSVE-NEXT: cmp w9, w8
1508 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1509 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #3]
1510 ; NONEON-NOSVE-NEXT: cmp w8, w10
1511 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1512 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #4]
1513 ; NONEON-NOSVE-NEXT: cmp w8, w9
1514 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1515 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #5]
1516 ; NONEON-NOSVE-NEXT: cmp w8, w10
1517 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1518 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #6]
1519 ; NONEON-NOSVE-NEXT: cmp w8, w9
1520 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1521 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #7]
1522 ; NONEON-NOSVE-NEXT: cmp w8, w10
1523 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1524 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #8]
1525 ; NONEON-NOSVE-NEXT: cmp w8, w9
1526 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1527 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #9]
1528 ; NONEON-NOSVE-NEXT: cmp w8, w10
1529 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1530 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #10]
1531 ; NONEON-NOSVE-NEXT: cmp w8, w9
1532 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1533 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #11]
1534 ; NONEON-NOSVE-NEXT: cmp w8, w10
1535 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1536 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #12]
1537 ; NONEON-NOSVE-NEXT: cmp w8, w9
1538 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1539 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #13]
1540 ; NONEON-NOSVE-NEXT: cmp w8, w10
1541 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1542 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #14]
1543 ; NONEON-NOSVE-NEXT: cmp w8, w9
1544 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1545 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #15]
1546 ; NONEON-NOSVE-NEXT: cmp w8, w10
1547 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1548 ; NONEON-NOSVE-NEXT: cmp w8, w9
1549 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1550 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1551 ; NONEON-NOSVE-NEXT: ret
1552 %res = call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %a)
1556 define i8 @umaxv_v32i8(ptr %a) {
1557 ; CHECK-LABEL: umaxv_v32i8:
1559 ; CHECK-NEXT: ldp q1, q0, [x0]
1560 ; CHECK-NEXT: ptrue p0.b, vl16
1561 ; CHECK-NEXT: umax z0.b, p0/m, z0.b, z1.b
1562 ; CHECK-NEXT: umaxv b0, p0, z0.b
1563 ; CHECK-NEXT: fmov w0, s0
1566 ; NONEON-NOSVE-LABEL: umaxv_v32i8:
1567 ; NONEON-NOSVE: // %bb.0:
1568 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1569 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1570 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1571 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #17]
1572 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #1]
1573 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #16]
1574 ; NONEON-NOSVE-NEXT: ldrb w11, [sp]
1575 ; NONEON-NOSVE-NEXT: cmp w9, w8
1576 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1577 ; NONEON-NOSVE-NEXT: cmp w11, w10
1578 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1579 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #18]
1580 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #2]
1581 ; NONEON-NOSVE-NEXT: cmp w9, w8
1582 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1583 ; NONEON-NOSVE-NEXT: cmp w11, w10
1584 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1585 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #19]
1586 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #3]
1587 ; NONEON-NOSVE-NEXT: cmp w8, w9
1588 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1589 ; NONEON-NOSVE-NEXT: cmp w11, w10
1590 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1591 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #20]
1592 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #4]
1593 ; NONEON-NOSVE-NEXT: cmp w8, w9
1594 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1595 ; NONEON-NOSVE-NEXT: cmp w11, w10
1596 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1597 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #21]
1598 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #5]
1599 ; NONEON-NOSVE-NEXT: cmp w8, w9
1600 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1601 ; NONEON-NOSVE-NEXT: cmp w11, w10
1602 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1603 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #22]
1604 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #6]
1605 ; NONEON-NOSVE-NEXT: cmp w8, w9
1606 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1607 ; NONEON-NOSVE-NEXT: cmp w11, w10
1608 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1609 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #23]
1610 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #7]
1611 ; NONEON-NOSVE-NEXT: cmp w8, w9
1612 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1613 ; NONEON-NOSVE-NEXT: cmp w11, w10
1614 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1615 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #24]
1616 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #8]
1617 ; NONEON-NOSVE-NEXT: cmp w8, w9
1618 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1619 ; NONEON-NOSVE-NEXT: cmp w11, w10
1620 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1621 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #25]
1622 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #9]
1623 ; NONEON-NOSVE-NEXT: cmp w8, w9
1624 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1625 ; NONEON-NOSVE-NEXT: cmp w11, w10
1626 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1627 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #26]
1628 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #10]
1629 ; NONEON-NOSVE-NEXT: cmp w8, w9
1630 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1631 ; NONEON-NOSVE-NEXT: cmp w11, w10
1632 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1633 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #27]
1634 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #11]
1635 ; NONEON-NOSVE-NEXT: cmp w8, w9
1636 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1637 ; NONEON-NOSVE-NEXT: cmp w11, w10
1638 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1639 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #28]
1640 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #12]
1641 ; NONEON-NOSVE-NEXT: cmp w8, w9
1642 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1643 ; NONEON-NOSVE-NEXT: cmp w11, w10
1644 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1645 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #29]
1646 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #13]
1647 ; NONEON-NOSVE-NEXT: cmp w8, w9
1648 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1649 ; NONEON-NOSVE-NEXT: cmp w11, w10
1650 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1651 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #30]
1652 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #14]
1653 ; NONEON-NOSVE-NEXT: cmp w8, w9
1654 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1655 ; NONEON-NOSVE-NEXT: cmp w11, w10
1656 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1657 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #31]
1658 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #15]
1659 ; NONEON-NOSVE-NEXT: cmp w8, w9
1660 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1661 ; NONEON-NOSVE-NEXT: cmp w11, w10
1662 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1663 ; NONEON-NOSVE-NEXT: cmp w8, w9
1664 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1665 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1666 ; NONEON-NOSVE-NEXT: ret
1667 %op = load <32 x i8>, ptr %a
1668 %res = call i8 @llvm.vector.reduce.umax.v32i8(<32 x i8> %op)
1672 define i16 @umaxv_v4i16(<4 x i16> %a) {
1673 ; CHECK-LABEL: umaxv_v4i16:
1675 ; CHECK-NEXT: ptrue p0.h, vl4
1676 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1677 ; CHECK-NEXT: umaxv h0, p0, z0.h
1678 ; CHECK-NEXT: fmov w0, s0
1681 ; NONEON-NOSVE-LABEL: umaxv_v4i16:
1682 ; NONEON-NOSVE: // %bb.0:
1683 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1684 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1685 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1686 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #10]
1687 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #8]
1688 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #12]
1689 ; NONEON-NOSVE-NEXT: cmp w9, w8
1690 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1691 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]
1692 ; NONEON-NOSVE-NEXT: cmp w8, w10
1693 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1694 ; NONEON-NOSVE-NEXT: cmp w8, w9
1695 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1696 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1697 ; NONEON-NOSVE-NEXT: ret
1698 %res = call i16 @llvm.vector.reduce.umax.v4i16(<4 x i16> %a)
1702 define i16 @umaxv_v8i16(<8 x i16> %a) {
1703 ; CHECK-LABEL: umaxv_v8i16:
1705 ; CHECK-NEXT: ptrue p0.h, vl8
1706 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1707 ; CHECK-NEXT: umaxv h0, p0, z0.h
1708 ; CHECK-NEXT: fmov w0, s0
1711 ; NONEON-NOSVE-LABEL: umaxv_v8i16:
1712 ; NONEON-NOSVE: // %bb.0:
1713 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1714 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1715 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #2]
1716 ; NONEON-NOSVE-NEXT: ldrh w9, [sp]
1717 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #4]
1718 ; NONEON-NOSVE-NEXT: cmp w9, w8
1719 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1720 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #6]
1721 ; NONEON-NOSVE-NEXT: cmp w8, w10
1722 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1723 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #8]
1724 ; NONEON-NOSVE-NEXT: cmp w8, w9
1725 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1726 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #10]
1727 ; NONEON-NOSVE-NEXT: cmp w8, w10
1728 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1729 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #12]
1730 ; NONEON-NOSVE-NEXT: cmp w8, w9
1731 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1732 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]
1733 ; NONEON-NOSVE-NEXT: cmp w8, w10
1734 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1735 ; NONEON-NOSVE-NEXT: cmp w8, w9
1736 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1737 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1738 ; NONEON-NOSVE-NEXT: ret
1739 %res = call i16 @llvm.vector.reduce.umax.v8i16(<8 x i16> %a)
1743 define i16 @umaxv_v16i16(ptr %a) {
1744 ; CHECK-LABEL: umaxv_v16i16:
1746 ; CHECK-NEXT: ldp q1, q0, [x0]
1747 ; CHECK-NEXT: ptrue p0.h, vl8
1748 ; CHECK-NEXT: umax z0.h, p0/m, z0.h, z1.h
1749 ; CHECK-NEXT: umaxv h0, p0, z0.h
1750 ; CHECK-NEXT: fmov w0, s0
1753 ; NONEON-NOSVE-LABEL: umaxv_v16i16:
1754 ; NONEON-NOSVE: // %bb.0:
1755 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1756 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1757 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1758 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #18]
1759 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #2]
1760 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #16]
1761 ; NONEON-NOSVE-NEXT: ldrh w11, [sp]
1762 ; NONEON-NOSVE-NEXT: cmp w9, w8
1763 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1764 ; NONEON-NOSVE-NEXT: cmp w11, w10
1765 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1766 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #20]
1767 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #4]
1768 ; NONEON-NOSVE-NEXT: cmp w9, w8
1769 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1770 ; NONEON-NOSVE-NEXT: cmp w11, w10
1771 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1772 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #22]
1773 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #6]
1774 ; NONEON-NOSVE-NEXT: cmp w8, w9
1775 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1776 ; NONEON-NOSVE-NEXT: cmp w11, w10
1777 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1778 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #24]
1779 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #8]
1780 ; NONEON-NOSVE-NEXT: cmp w8, w9
1781 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1782 ; NONEON-NOSVE-NEXT: cmp w11, w10
1783 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1784 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #26]
1785 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #10]
1786 ; NONEON-NOSVE-NEXT: cmp w8, w9
1787 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1788 ; NONEON-NOSVE-NEXT: cmp w11, w10
1789 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1790 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #28]
1791 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #12]
1792 ; NONEON-NOSVE-NEXT: cmp w8, w9
1793 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1794 ; NONEON-NOSVE-NEXT: cmp w11, w10
1795 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1796 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #30]
1797 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #14]
1798 ; NONEON-NOSVE-NEXT: cmp w8, w9
1799 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1800 ; NONEON-NOSVE-NEXT: cmp w11, w10
1801 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1802 ; NONEON-NOSVE-NEXT: cmp w8, w9
1803 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1804 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1805 ; NONEON-NOSVE-NEXT: ret
1806 %op = load <16 x i16>, ptr %a
1807 %res = call i16 @llvm.vector.reduce.umax.v16i16(<16 x i16> %op)
1811 define i32 @umaxv_v2i32(<2 x i32> %a) {
1812 ; CHECK-LABEL: umaxv_v2i32:
1814 ; CHECK-NEXT: ptrue p0.s, vl2
1815 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1816 ; CHECK-NEXT: umaxv s0, p0, z0.s
1817 ; CHECK-NEXT: fmov w0, s0
1820 ; NONEON-NOSVE-LABEL: umaxv_v2i32:
1821 ; NONEON-NOSVE: // %bb.0:
1822 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1823 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1824 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1825 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
1826 ; NONEON-NOSVE-NEXT: cmp w9, w8
1827 ; NONEON-NOSVE-NEXT: csel w0, w9, w8, hi
1828 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1829 ; NONEON-NOSVE-NEXT: ret
1830 %res = call i32 @llvm.vector.reduce.umax.v2i32(<2 x i32> %a)
1834 define i32 @umaxv_v4i32(<4 x i32> %a) {
1835 ; CHECK-LABEL: umaxv_v4i32:
1837 ; CHECK-NEXT: ptrue p0.s, vl4
1838 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1839 ; CHECK-NEXT: umaxv s0, p0, z0.s
1840 ; CHECK-NEXT: fmov w0, s0
1843 ; NONEON-NOSVE-LABEL: umaxv_v4i32:
1844 ; NONEON-NOSVE: // %bb.0:
1845 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1846 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1847 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp]
1848 ; NONEON-NOSVE-NEXT: cmp w9, w8
1849 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1850 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #8]
1851 ; NONEON-NOSVE-NEXT: cmp w8, w10
1852 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1853 ; NONEON-NOSVE-NEXT: cmp w8, w9
1854 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1855 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1856 ; NONEON-NOSVE-NEXT: ret
1857 %res = call i32 @llvm.vector.reduce.umax.v4i32(<4 x i32> %a)
1861 define i32 @umaxv_v8i32(ptr %a) {
1862 ; CHECK-LABEL: umaxv_v8i32:
1864 ; CHECK-NEXT: ldp q1, q0, [x0]
1865 ; CHECK-NEXT: ptrue p0.s, vl4
1866 ; CHECK-NEXT: umax z0.s, p0/m, z0.s, z1.s
1867 ; CHECK-NEXT: umaxv s0, p0, z0.s
1868 ; CHECK-NEXT: fmov w0, s0
1871 ; NONEON-NOSVE-LABEL: umaxv_v8i32:
1872 ; NONEON-NOSVE: // %bb.0:
1873 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1874 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1875 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1876 ; NONEON-NOSVE-NEXT: ldp w11, w8, [sp]
1877 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #16]
1878 ; NONEON-NOSVE-NEXT: cmp w8, w9
1879 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, hi
1880 ; NONEON-NOSVE-NEXT: cmp w11, w10
1881 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, hi
1882 ; NONEON-NOSVE-NEXT: cmp w9, w8
1883 ; NONEON-NOSVE-NEXT: ldp w10, w12, [sp, #8]
1884 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, hi
1885 ; NONEON-NOSVE-NEXT: ldp w11, w9, [sp, #24]
1886 ; NONEON-NOSVE-NEXT: cmp w10, w11
1887 ; NONEON-NOSVE-NEXT: csel w10, w10, w11, hi
1888 ; NONEON-NOSVE-NEXT: cmp w8, w10
1889 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, hi
1890 ; NONEON-NOSVE-NEXT: cmp w12, w9
1891 ; NONEON-NOSVE-NEXT: csel w9, w12, w9, hi
1892 ; NONEON-NOSVE-NEXT: cmp w8, w9
1893 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, hi
1894 ; NONEON-NOSVE-NEXT: add sp, sp, #32
1895 ; NONEON-NOSVE-NEXT: ret
1896 %op = load <8 x i32>, ptr %a
1897 %res = call i32 @llvm.vector.reduce.umax.v8i32(<8 x i32> %op)
1901 ; No NEON 64-bit vector UMAXV support. Use SVE.
1902 define i64 @umaxv_v2i64(<2 x i64> %a) {
1903 ; CHECK-LABEL: umaxv_v2i64:
1905 ; CHECK-NEXT: ptrue p0.d, vl2
1906 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
1907 ; CHECK-NEXT: umaxv d0, p0, z0.d
1908 ; CHECK-NEXT: fmov x0, d0
1911 ; NONEON-NOSVE-LABEL: umaxv_v2i64:
1912 ; NONEON-NOSVE: // %bb.0:
1913 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
1914 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1915 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp], #16
1916 ; NONEON-NOSVE-NEXT: cmp x9, x8
1917 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, hi
1918 ; NONEON-NOSVE-NEXT: ret
1919 %res = call i64 @llvm.vector.reduce.umax.v2i64(<2 x i64> %a)
1923 define i64 @umaxv_v4i64(ptr %a) {
1924 ; CHECK-LABEL: umaxv_v4i64:
1926 ; CHECK-NEXT: ldp q1, q0, [x0]
1927 ; CHECK-NEXT: ptrue p0.d, vl2
1928 ; CHECK-NEXT: umax z0.d, p0/m, z0.d, z1.d
1929 ; CHECK-NEXT: umaxv d0, p0, z0.d
1930 ; CHECK-NEXT: fmov x0, d0
1933 ; NONEON-NOSVE-LABEL: umaxv_v4i64:
1934 ; NONEON-NOSVE: // %bb.0:
1935 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
1936 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
1937 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
1938 ; NONEON-NOSVE-NEXT: ldp x8, x10, [sp, #8]
1939 ; NONEON-NOSVE-NEXT: ldr x9, [sp, #24]
1940 ; NONEON-NOSVE-NEXT: ldr x11, [sp], #32
1941 ; NONEON-NOSVE-NEXT: cmp x8, x9
1942 ; NONEON-NOSVE-NEXT: csel x8, x8, x9, hi
1943 ; NONEON-NOSVE-NEXT: cmp x11, x10
1944 ; NONEON-NOSVE-NEXT: csel x9, x11, x10, hi
1945 ; NONEON-NOSVE-NEXT: cmp x9, x8
1946 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, hi
1947 ; NONEON-NOSVE-NEXT: ret
1948 %op = load <4 x i64>, ptr %a
1949 %res = call i64 @llvm.vector.reduce.umax.v4i64(<4 x i64> %op)
1957 define i8 @uminv_v8i8(<8 x i8> %a) {
1958 ; CHECK-LABEL: uminv_v8i8:
1960 ; CHECK-NEXT: ptrue p0.b, vl8
1961 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
1962 ; CHECK-NEXT: uminv b0, p0, z0.b
1963 ; CHECK-NEXT: fmov w0, s0
1966 ; NONEON-NOSVE-LABEL: uminv_v8i8:
1967 ; NONEON-NOSVE: // %bb.0:
1968 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
1969 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
1970 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
1971 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #9]
1972 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #8]
1973 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #10]
1974 ; NONEON-NOSVE-NEXT: cmp w9, w8
1975 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
1976 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #11]
1977 ; NONEON-NOSVE-NEXT: cmp w8, w10
1978 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
1979 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #12]
1980 ; NONEON-NOSVE-NEXT: cmp w8, w9
1981 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
1982 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #13]
1983 ; NONEON-NOSVE-NEXT: cmp w8, w10
1984 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
1985 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #14]
1986 ; NONEON-NOSVE-NEXT: cmp w8, w9
1987 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
1988 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #15]
1989 ; NONEON-NOSVE-NEXT: cmp w8, w10
1990 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
1991 ; NONEON-NOSVE-NEXT: cmp w8, w9
1992 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
1993 ; NONEON-NOSVE-NEXT: add sp, sp, #16
1994 ; NONEON-NOSVE-NEXT: ret
1995 %res = call i8 @llvm.vector.reduce.umin.v8i8(<8 x i8> %a)
1999 define i8 @uminv_v16i8(<16 x i8> %a) {
2000 ; CHECK-LABEL: uminv_v16i8:
2002 ; CHECK-NEXT: ptrue p0.b, vl16
2003 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
2004 ; CHECK-NEXT: uminv b0, p0, z0.b
2005 ; CHECK-NEXT: fmov w0, s0
2008 ; NONEON-NOSVE-LABEL: uminv_v16i8:
2009 ; NONEON-NOSVE: // %bb.0:
2010 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
2011 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2012 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #1]
2013 ; NONEON-NOSVE-NEXT: ldrb w9, [sp]
2014 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #2]
2015 ; NONEON-NOSVE-NEXT: cmp w9, w8
2016 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2017 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #3]
2018 ; NONEON-NOSVE-NEXT: cmp w8, w10
2019 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2020 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #4]
2021 ; NONEON-NOSVE-NEXT: cmp w8, w9
2022 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2023 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #5]
2024 ; NONEON-NOSVE-NEXT: cmp w8, w10
2025 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2026 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #6]
2027 ; NONEON-NOSVE-NEXT: cmp w8, w9
2028 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2029 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #7]
2030 ; NONEON-NOSVE-NEXT: cmp w8, w10
2031 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2032 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #8]
2033 ; NONEON-NOSVE-NEXT: cmp w8, w9
2034 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2035 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #9]
2036 ; NONEON-NOSVE-NEXT: cmp w8, w10
2037 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2038 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #10]
2039 ; NONEON-NOSVE-NEXT: cmp w8, w9
2040 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2041 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #11]
2042 ; NONEON-NOSVE-NEXT: cmp w8, w10
2043 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2044 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #12]
2045 ; NONEON-NOSVE-NEXT: cmp w8, w9
2046 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2047 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #13]
2048 ; NONEON-NOSVE-NEXT: cmp w8, w10
2049 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2050 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #14]
2051 ; NONEON-NOSVE-NEXT: cmp w8, w9
2052 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2053 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #15]
2054 ; NONEON-NOSVE-NEXT: cmp w8, w10
2055 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2056 ; NONEON-NOSVE-NEXT: cmp w8, w9
2057 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2058 ; NONEON-NOSVE-NEXT: add sp, sp, #16
2059 ; NONEON-NOSVE-NEXT: ret
2060 %res = call i8 @llvm.vector.reduce.umin.v16i8(<16 x i8> %a)
2064 define i8 @uminv_v32i8(ptr %a) {
2065 ; CHECK-LABEL: uminv_v32i8:
2067 ; CHECK-NEXT: ldp q1, q0, [x0]
2068 ; CHECK-NEXT: ptrue p0.b, vl16
2069 ; CHECK-NEXT: umin z0.b, p0/m, z0.b, z1.b
2070 ; CHECK-NEXT: uminv b0, p0, z0.b
2071 ; CHECK-NEXT: fmov w0, s0
2074 ; NONEON-NOSVE-LABEL: uminv_v32i8:
2075 ; NONEON-NOSVE: // %bb.0:
2076 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
2077 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
2078 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
2079 ; NONEON-NOSVE-NEXT: ldrb w8, [sp, #17]
2080 ; NONEON-NOSVE-NEXT: ldrb w9, [sp, #1]
2081 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #16]
2082 ; NONEON-NOSVE-NEXT: ldrb w11, [sp]
2083 ; NONEON-NOSVE-NEXT: cmp w9, w8
2084 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2085 ; NONEON-NOSVE-NEXT: cmp w11, w10
2086 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2087 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #18]
2088 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #2]
2089 ; NONEON-NOSVE-NEXT: cmp w9, w8
2090 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2091 ; NONEON-NOSVE-NEXT: cmp w11, w10
2092 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2093 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #19]
2094 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #3]
2095 ; NONEON-NOSVE-NEXT: cmp w8, w9
2096 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2097 ; NONEON-NOSVE-NEXT: cmp w11, w10
2098 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2099 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #20]
2100 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #4]
2101 ; NONEON-NOSVE-NEXT: cmp w8, w9
2102 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2103 ; NONEON-NOSVE-NEXT: cmp w11, w10
2104 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2105 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #21]
2106 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #5]
2107 ; NONEON-NOSVE-NEXT: cmp w8, w9
2108 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2109 ; NONEON-NOSVE-NEXT: cmp w11, w10
2110 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2111 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #22]
2112 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #6]
2113 ; NONEON-NOSVE-NEXT: cmp w8, w9
2114 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2115 ; NONEON-NOSVE-NEXT: cmp w11, w10
2116 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2117 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #23]
2118 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #7]
2119 ; NONEON-NOSVE-NEXT: cmp w8, w9
2120 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2121 ; NONEON-NOSVE-NEXT: cmp w11, w10
2122 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2123 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #24]
2124 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #8]
2125 ; NONEON-NOSVE-NEXT: cmp w8, w9
2126 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2127 ; NONEON-NOSVE-NEXT: cmp w11, w10
2128 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2129 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #25]
2130 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #9]
2131 ; NONEON-NOSVE-NEXT: cmp w8, w9
2132 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2133 ; NONEON-NOSVE-NEXT: cmp w11, w10
2134 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2135 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #26]
2136 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #10]
2137 ; NONEON-NOSVE-NEXT: cmp w8, w9
2138 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2139 ; NONEON-NOSVE-NEXT: cmp w11, w10
2140 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2141 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #27]
2142 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #11]
2143 ; NONEON-NOSVE-NEXT: cmp w8, w9
2144 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2145 ; NONEON-NOSVE-NEXT: cmp w11, w10
2146 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2147 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #28]
2148 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #12]
2149 ; NONEON-NOSVE-NEXT: cmp w8, w9
2150 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2151 ; NONEON-NOSVE-NEXT: cmp w11, w10
2152 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2153 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #29]
2154 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #13]
2155 ; NONEON-NOSVE-NEXT: cmp w8, w9
2156 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2157 ; NONEON-NOSVE-NEXT: cmp w11, w10
2158 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2159 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #30]
2160 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #14]
2161 ; NONEON-NOSVE-NEXT: cmp w8, w9
2162 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2163 ; NONEON-NOSVE-NEXT: cmp w11, w10
2164 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2165 ; NONEON-NOSVE-NEXT: ldrb w10, [sp, #31]
2166 ; NONEON-NOSVE-NEXT: ldrb w11, [sp, #15]
2167 ; NONEON-NOSVE-NEXT: cmp w8, w9
2168 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2169 ; NONEON-NOSVE-NEXT: cmp w11, w10
2170 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2171 ; NONEON-NOSVE-NEXT: cmp w8, w9
2172 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2173 ; NONEON-NOSVE-NEXT: add sp, sp, #32
2174 ; NONEON-NOSVE-NEXT: ret
2175 %op = load <32 x i8>, ptr %a
2176 %res = call i8 @llvm.vector.reduce.umin.v32i8(<32 x i8> %op)
2180 define i16 @uminv_v4i16(<4 x i16> %a) {
2181 ; CHECK-LABEL: uminv_v4i16:
2183 ; CHECK-NEXT: ptrue p0.h, vl4
2184 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
2185 ; CHECK-NEXT: uminv h0, p0, z0.h
2186 ; CHECK-NEXT: fmov w0, s0
2189 ; NONEON-NOSVE-LABEL: uminv_v4i16:
2190 ; NONEON-NOSVE: // %bb.0:
2191 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
2192 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2193 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
2194 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #10]
2195 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #8]
2196 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #12]
2197 ; NONEON-NOSVE-NEXT: cmp w9, w8
2198 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2199 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]
2200 ; NONEON-NOSVE-NEXT: cmp w8, w10
2201 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2202 ; NONEON-NOSVE-NEXT: cmp w8, w9
2203 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2204 ; NONEON-NOSVE-NEXT: add sp, sp, #16
2205 ; NONEON-NOSVE-NEXT: ret
2206 %res = call i16 @llvm.vector.reduce.umin.v4i16(<4 x i16> %a)
2210 define i16 @uminv_v8i16(<8 x i16> %a) {
2211 ; CHECK-LABEL: uminv_v8i16:
2213 ; CHECK-NEXT: ptrue p0.h, vl8
2214 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
2215 ; CHECK-NEXT: uminv h0, p0, z0.h
2216 ; CHECK-NEXT: fmov w0, s0
2219 ; NONEON-NOSVE-LABEL: uminv_v8i16:
2220 ; NONEON-NOSVE: // %bb.0:
2221 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
2222 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2223 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #2]
2224 ; NONEON-NOSVE-NEXT: ldrh w9, [sp]
2225 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #4]
2226 ; NONEON-NOSVE-NEXT: cmp w9, w8
2227 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2228 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #6]
2229 ; NONEON-NOSVE-NEXT: cmp w8, w10
2230 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2231 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #8]
2232 ; NONEON-NOSVE-NEXT: cmp w8, w9
2233 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2234 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #10]
2235 ; NONEON-NOSVE-NEXT: cmp w8, w10
2236 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2237 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #12]
2238 ; NONEON-NOSVE-NEXT: cmp w8, w9
2239 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2240 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]
2241 ; NONEON-NOSVE-NEXT: cmp w8, w10
2242 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2243 ; NONEON-NOSVE-NEXT: cmp w8, w9
2244 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2245 ; NONEON-NOSVE-NEXT: add sp, sp, #16
2246 ; NONEON-NOSVE-NEXT: ret
2247 %res = call i16 @llvm.vector.reduce.umin.v8i16(<8 x i16> %a)
2251 define i16 @uminv_v16i16(ptr %a) {
2252 ; CHECK-LABEL: uminv_v16i16:
2254 ; CHECK-NEXT: ldp q1, q0, [x0]
2255 ; CHECK-NEXT: ptrue p0.h, vl8
2256 ; CHECK-NEXT: umin z0.h, p0/m, z0.h, z1.h
2257 ; CHECK-NEXT: uminv h0, p0, z0.h
2258 ; CHECK-NEXT: fmov w0, s0
2261 ; NONEON-NOSVE-LABEL: uminv_v16i16:
2262 ; NONEON-NOSVE: // %bb.0:
2263 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
2264 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
2265 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
2266 ; NONEON-NOSVE-NEXT: ldrh w8, [sp, #18]
2267 ; NONEON-NOSVE-NEXT: ldrh w9, [sp, #2]
2268 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #16]
2269 ; NONEON-NOSVE-NEXT: ldrh w11, [sp]
2270 ; NONEON-NOSVE-NEXT: cmp w9, w8
2271 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2272 ; NONEON-NOSVE-NEXT: cmp w11, w10
2273 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2274 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #20]
2275 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #4]
2276 ; NONEON-NOSVE-NEXT: cmp w9, w8
2277 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2278 ; NONEON-NOSVE-NEXT: cmp w11, w10
2279 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2280 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #22]
2281 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #6]
2282 ; NONEON-NOSVE-NEXT: cmp w8, w9
2283 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2284 ; NONEON-NOSVE-NEXT: cmp w11, w10
2285 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2286 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #24]
2287 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #8]
2288 ; NONEON-NOSVE-NEXT: cmp w8, w9
2289 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2290 ; NONEON-NOSVE-NEXT: cmp w11, w10
2291 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2292 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #26]
2293 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #10]
2294 ; NONEON-NOSVE-NEXT: cmp w8, w9
2295 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2296 ; NONEON-NOSVE-NEXT: cmp w11, w10
2297 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2298 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #28]
2299 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #12]
2300 ; NONEON-NOSVE-NEXT: cmp w8, w9
2301 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2302 ; NONEON-NOSVE-NEXT: cmp w11, w10
2303 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2304 ; NONEON-NOSVE-NEXT: ldrh w10, [sp, #30]
2305 ; NONEON-NOSVE-NEXT: ldrh w11, [sp, #14]
2306 ; NONEON-NOSVE-NEXT: cmp w8, w9
2307 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2308 ; NONEON-NOSVE-NEXT: cmp w11, w10
2309 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2310 ; NONEON-NOSVE-NEXT: cmp w8, w9
2311 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2312 ; NONEON-NOSVE-NEXT: add sp, sp, #32
2313 ; NONEON-NOSVE-NEXT: ret
2314 %op = load <16 x i16>, ptr %a
2315 %res = call i16 @llvm.vector.reduce.umin.v16i16(<16 x i16> %op)
2319 define i32 @uminv_v2i32(<2 x i32> %a) {
2320 ; CHECK-LABEL: uminv_v2i32:
2322 ; CHECK-NEXT: ptrue p0.s, vl2
2323 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
2324 ; CHECK-NEXT: uminv s0, p0, z0.s
2325 ; CHECK-NEXT: fmov w0, s0
2328 ; NONEON-NOSVE-LABEL: uminv_v2i32:
2329 ; NONEON-NOSVE: // %bb.0:
2330 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
2331 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2332 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
2333 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]
2334 ; NONEON-NOSVE-NEXT: cmp w9, w8
2335 ; NONEON-NOSVE-NEXT: csel w0, w9, w8, lo
2336 ; NONEON-NOSVE-NEXT: add sp, sp, #16
2337 ; NONEON-NOSVE-NEXT: ret
2338 %res = call i32 @llvm.vector.reduce.umin.v2i32(<2 x i32> %a)
2342 define i32 @uminv_v4i32(<4 x i32> %a) {
2343 ; CHECK-LABEL: uminv_v4i32:
2345 ; CHECK-NEXT: ptrue p0.s, vl4
2346 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
2347 ; CHECK-NEXT: uminv s0, p0, z0.s
2348 ; CHECK-NEXT: fmov w0, s0
2351 ; NONEON-NOSVE-LABEL: uminv_v4i32:
2352 ; NONEON-NOSVE: // %bb.0:
2353 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
2354 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2355 ; NONEON-NOSVE-NEXT: ldp w9, w8, [sp]
2356 ; NONEON-NOSVE-NEXT: cmp w9, w8
2357 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2358 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #8]
2359 ; NONEON-NOSVE-NEXT: cmp w8, w10
2360 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2361 ; NONEON-NOSVE-NEXT: cmp w8, w9
2362 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2363 ; NONEON-NOSVE-NEXT: add sp, sp, #16
2364 ; NONEON-NOSVE-NEXT: ret
2365 %res = call i32 @llvm.vector.reduce.umin.v4i32(<4 x i32> %a)
2369 define i32 @uminv_v8i32(ptr %a) {
2370 ; CHECK-LABEL: uminv_v8i32:
2372 ; CHECK-NEXT: ldp q1, q0, [x0]
2373 ; CHECK-NEXT: ptrue p0.s, vl4
2374 ; CHECK-NEXT: umin z0.s, p0/m, z0.s, z1.s
2375 ; CHECK-NEXT: uminv s0, p0, z0.s
2376 ; CHECK-NEXT: fmov w0, s0
2379 ; NONEON-NOSVE-LABEL: uminv_v8i32:
2380 ; NONEON-NOSVE: // %bb.0:
2381 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
2382 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
2383 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
2384 ; NONEON-NOSVE-NEXT: ldp w11, w8, [sp]
2385 ; NONEON-NOSVE-NEXT: ldp w10, w9, [sp, #16]
2386 ; NONEON-NOSVE-NEXT: cmp w8, w9
2387 ; NONEON-NOSVE-NEXT: csel w8, w8, w9, lo
2388 ; NONEON-NOSVE-NEXT: cmp w11, w10
2389 ; NONEON-NOSVE-NEXT: csel w9, w11, w10, lo
2390 ; NONEON-NOSVE-NEXT: cmp w9, w8
2391 ; NONEON-NOSVE-NEXT: ldp w10, w12, [sp, #8]
2392 ; NONEON-NOSVE-NEXT: csel w8, w9, w8, lo
2393 ; NONEON-NOSVE-NEXT: ldp w11, w9, [sp, #24]
2394 ; NONEON-NOSVE-NEXT: cmp w10, w11
2395 ; NONEON-NOSVE-NEXT: csel w10, w10, w11, lo
2396 ; NONEON-NOSVE-NEXT: cmp w8, w10
2397 ; NONEON-NOSVE-NEXT: csel w8, w8, w10, lo
2398 ; NONEON-NOSVE-NEXT: cmp w12, w9
2399 ; NONEON-NOSVE-NEXT: csel w9, w12, w9, lo
2400 ; NONEON-NOSVE-NEXT: cmp w8, w9
2401 ; NONEON-NOSVE-NEXT: csel w0, w8, w9, lo
2402 ; NONEON-NOSVE-NEXT: add sp, sp, #32
2403 ; NONEON-NOSVE-NEXT: ret
2404 %op = load <8 x i32>, ptr %a
2405 %res = call i32 @llvm.vector.reduce.umin.v8i32(<8 x i32> %op)
2409 ; No NEON 64-bit vector UMINV support. Use SVE.
2410 define i64 @uminv_v2i64(<2 x i64> %a) {
2411 ; CHECK-LABEL: uminv_v2i64:
2413 ; CHECK-NEXT: ptrue p0.d, vl2
2414 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
2415 ; CHECK-NEXT: uminv d0, p0, z0.d
2416 ; CHECK-NEXT: fmov x0, d0
2419 ; NONEON-NOSVE-LABEL: uminv_v2i64:
2420 ; NONEON-NOSVE: // %bb.0:
2421 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
2422 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
2423 ; NONEON-NOSVE-NEXT: ldp x9, x8, [sp], #16
2424 ; NONEON-NOSVE-NEXT: cmp x9, x8
2425 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, lo
2426 ; NONEON-NOSVE-NEXT: ret
2427 %res = call i64 @llvm.vector.reduce.umin.v2i64(<2 x i64> %a)
2431 define i64 @uminv_v4i64(ptr %a) {
2432 ; CHECK-LABEL: uminv_v4i64:
2434 ; CHECK-NEXT: ldp q1, q0, [x0]
2435 ; CHECK-NEXT: ptrue p0.d, vl2
2436 ; CHECK-NEXT: umin z0.d, p0/m, z0.d, z1.d
2437 ; CHECK-NEXT: uminv d0, p0, z0.d
2438 ; CHECK-NEXT: fmov x0, d0
2441 ; NONEON-NOSVE-LABEL: uminv_v4i64:
2442 ; NONEON-NOSVE: // %bb.0:
2443 ; NONEON-NOSVE-NEXT: ldp q1, q0, [x0]
2444 ; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-32]!
2445 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32
2446 ; NONEON-NOSVE-NEXT: ldp x8, x10, [sp, #8]
2447 ; NONEON-NOSVE-NEXT: ldr x9, [sp, #24]
2448 ; NONEON-NOSVE-NEXT: ldr x11, [sp], #32
2449 ; NONEON-NOSVE-NEXT: cmp x8, x9
2450 ; NONEON-NOSVE-NEXT: csel x8, x8, x9, lo
2451 ; NONEON-NOSVE-NEXT: cmp x11, x10
2452 ; NONEON-NOSVE-NEXT: csel x9, x11, x10, lo
2453 ; NONEON-NOSVE-NEXT: cmp x9, x8
2454 ; NONEON-NOSVE-NEXT: csel x0, x9, x8, lo
2455 ; NONEON-NOSVE-NEXT: ret
2456 %op = load <4 x i64>, ptr %a
2457 %res = call i64 @llvm.vector.reduce.umin.v4i64(<4 x i64> %op)
2461 declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>)
2462 declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>)
2463 declare i8 @llvm.vector.reduce.add.v32i8(<32 x i8>)
2465 declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>)
2466 declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>)
2467 declare i16 @llvm.vector.reduce.add.v16i16(<16 x i16>)
2469 declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)
2470 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
2471 declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>)
2473 declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>)
2474 declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>)
2476 declare i8 @llvm.vector.reduce.smax.v8i8(<8 x i8>)
2477 declare i8 @llvm.vector.reduce.smax.v16i8(<16 x i8>)
2478 declare i8 @llvm.vector.reduce.smax.v32i8(<32 x i8>)
2480 declare i16 @llvm.vector.reduce.smax.v4i16(<4 x i16>)
2481 declare i16 @llvm.vector.reduce.smax.v8i16(<8 x i16>)
2482 declare i16 @llvm.vector.reduce.smax.v16i16(<16 x i16>)
2484 declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>)
2485 declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>)
2486 declare i32 @llvm.vector.reduce.smax.v8i32(<8 x i32>)
2488 declare i64 @llvm.vector.reduce.smax.v2i64(<2 x i64>)
2489 declare i64 @llvm.vector.reduce.smax.v4i64(<4 x i64>)
2491 declare i8 @llvm.vector.reduce.smin.v8i8(<8 x i8>)
2492 declare i8 @llvm.vector.reduce.smin.v16i8(<16 x i8>)
2493 declare i8 @llvm.vector.reduce.smin.v32i8(<32 x i8>)
2495 declare i16 @llvm.vector.reduce.smin.v4i16(<4 x i16>)
2496 declare i16 @llvm.vector.reduce.smin.v8i16(<8 x i16>)
2497 declare i16 @llvm.vector.reduce.smin.v16i16(<16 x i16>)
2499 declare i32 @llvm.vector.reduce.smin.v2i32(<2 x i32>)
2500 declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>)
2501 declare i32 @llvm.vector.reduce.smin.v8i32(<8 x i32>)
2503 declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>)
2504 declare i64 @llvm.vector.reduce.smin.v4i64(<4 x i64>)
2506 declare i8 @llvm.vector.reduce.umax.v8i8(<8 x i8>)
2507 declare i8 @llvm.vector.reduce.umax.v16i8(<16 x i8>)
2508 declare i8 @llvm.vector.reduce.umax.v32i8(<32 x i8>)
2510 declare i16 @llvm.vector.reduce.umax.v4i16(<4 x i16>)
2511 declare i16 @llvm.vector.reduce.umax.v8i16(<8 x i16>)
2512 declare i16 @llvm.vector.reduce.umax.v16i16(<16 x i16>)
2514 declare i32 @llvm.vector.reduce.umax.v2i32(<2 x i32>)
2515 declare i32 @llvm.vector.reduce.umax.v4i32(<4 x i32>)
2516 declare i32 @llvm.vector.reduce.umax.v8i32(<8 x i32>)
2518 declare i64 @llvm.vector.reduce.umax.v2i64(<2 x i64>)
2519 declare i64 @llvm.vector.reduce.umax.v4i64(<4 x i64>)
2521 declare i8 @llvm.vector.reduce.umin.v8i8(<8 x i8>)
2522 declare i8 @llvm.vector.reduce.umin.v16i8(<16 x i8>)
2523 declare i8 @llvm.vector.reduce.umin.v32i8(<32 x i8>)
2525 declare i16 @llvm.vector.reduce.umin.v4i16(<4 x i16>)
2526 declare i16 @llvm.vector.reduce.umin.v8i16(<8 x i16>)
2527 declare i16 @llvm.vector.reduce.umin.v16i16(<16 x i16>)
2529 declare i32 @llvm.vector.reduce.umin.v2i32(<2 x i32>)
2530 declare i32 @llvm.vector.reduce.umin.v4i32(<4 x i32>)
2531 declare i32 @llvm.vector.reduce.umin.v8i32(<8 x i32>)
2533 declare i64 @llvm.vector.reduce.umin.v2i64(<2 x i64>)
2534 declare i64 @llvm.vector.reduce.umin.v4i64(<4 x i64>)