1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve,+fullfp16 -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-MVE
3 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve.fp -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-MVEFP
5 define arm_aapcs_vfpcc <16 x i8> @smin_v16i8(<16 x i8> %s1, <16 x i8> %s2) {
6 ; CHECK-LABEL: smin_v16i8:
7 ; CHECK: @ %bb.0: @ %entry
8 ; CHECK-NEXT: vmin.s8 q0, q0, q1
11 %0 = icmp slt <16 x i8> %s1, %s2
12 %1 = select <16 x i1> %0, <16 x i8> %s1, <16 x i8> %s2
16 define arm_aapcs_vfpcc <8 x i16> @smin_v8i16(<8 x i16> %s1, <8 x i16> %s2) {
17 ; CHECK-LABEL: smin_v8i16:
18 ; CHECK: @ %bb.0: @ %entry
19 ; CHECK-NEXT: vmin.s16 q0, q0, q1
22 %0 = icmp slt <8 x i16> %s1, %s2
23 %1 = select <8 x i1> %0, <8 x i16> %s1, <8 x i16> %s2
27 define arm_aapcs_vfpcc <4 x i32> @smin_v4i32(<4 x i32> %s1, <4 x i32> %s2) {
28 ; CHECK-LABEL: smin_v4i32:
29 ; CHECK: @ %bb.0: @ %entry
30 ; CHECK-NEXT: vmin.s32 q0, q0, q1
33 %0 = icmp slt <4 x i32> %s1, %s2
34 %1 = select <4 x i1> %0, <4 x i32> %s1, <4 x i32> %s2
38 define arm_aapcs_vfpcc <2 x i64> @smin_v2i64(<2 x i64> %s1, <2 x i64> %s2) {
39 ; CHECK-LABEL: smin_v2i64:
40 ; CHECK: @ %bb.0: @ %entry
41 ; CHECK-NEXT: .save {r7, lr}
42 ; CHECK-NEXT: push {r7, lr}
43 ; CHECK-NEXT: vmov r2, s6
44 ; CHECK-NEXT: movs r0, #0
45 ; CHECK-NEXT: vmov r3, s2
46 ; CHECK-NEXT: vmov r12, s7
47 ; CHECK-NEXT: vmov r1, s3
48 ; CHECK-NEXT: vmov lr, s1
49 ; CHECK-NEXT: subs r2, r3, r2
50 ; CHECK-NEXT: vmov r3, s0
51 ; CHECK-NEXT: vmov r2, s4
52 ; CHECK-NEXT: sbcs.w r1, r1, r12
53 ; CHECK-NEXT: vmov r12, s5
54 ; CHECK-NEXT: mov.w r1, #0
56 ; CHECK-NEXT: movlt r1, #1
57 ; CHECK-NEXT: cmp r1, #0
59 ; CHECK-NEXT: movne.w r1, #-1
60 ; CHECK-NEXT: subs r2, r3, r2
61 ; CHECK-NEXT: sbcs.w r2, lr, r12
63 ; CHECK-NEXT: movlt r0, #1
64 ; CHECK-NEXT: cmp r0, #0
66 ; CHECK-NEXT: movne.w r0, #-1
67 ; CHECK-NEXT: vmov.32 q2[0], r0
68 ; CHECK-NEXT: vmov.32 q2[1], r0
69 ; CHECK-NEXT: vmov.32 q2[2], r1
70 ; CHECK-NEXT: vmov.32 q2[3], r1
71 ; CHECK-NEXT: vbic q1, q1, q2
72 ; CHECK-NEXT: vand q0, q0, q2
73 ; CHECK-NEXT: vorr q0, q0, q1
74 ; CHECK-NEXT: pop {r7, pc}
76 %0 = icmp slt <2 x i64> %s1, %s2
77 %1 = select <2 x i1> %0, <2 x i64> %s1, <2 x i64> %s2
81 define arm_aapcs_vfpcc <16 x i8> @umin_v16i8(<16 x i8> %s1, <16 x i8> %s2) {
82 ; CHECK-LABEL: umin_v16i8:
83 ; CHECK: @ %bb.0: @ %entry
84 ; CHECK-NEXT: vmin.u8 q0, q0, q1
87 %0 = icmp ult <16 x i8> %s1, %s2
88 %1 = select <16 x i1> %0, <16 x i8> %s1, <16 x i8> %s2
92 define arm_aapcs_vfpcc <8 x i16> @umin_v8i16(<8 x i16> %s1, <8 x i16> %s2) {
93 ; CHECK-LABEL: umin_v8i16:
94 ; CHECK: @ %bb.0: @ %entry
95 ; CHECK-NEXT: vmin.u16 q0, q0, q1
98 %0 = icmp ult <8 x i16> %s1, %s2
99 %1 = select <8 x i1> %0, <8 x i16> %s1, <8 x i16> %s2
103 define arm_aapcs_vfpcc <4 x i32> @umin_v4i32(<4 x i32> %s1, <4 x i32> %s2) {
104 ; CHECK-LABEL: umin_v4i32:
105 ; CHECK: @ %bb.0: @ %entry
106 ; CHECK-NEXT: vmin.u32 q0, q0, q1
109 %0 = icmp ult <4 x i32> %s1, %s2
110 %1 = select <4 x i1> %0, <4 x i32> %s1, <4 x i32> %s2
114 define arm_aapcs_vfpcc <2 x i64> @umin_v2i64(<2 x i64> %s1, <2 x i64> %s2) {
115 ; CHECK-LABEL: umin_v2i64:
116 ; CHECK: @ %bb.0: @ %entry
117 ; CHECK-NEXT: .save {r7, lr}
118 ; CHECK-NEXT: push {r7, lr}
119 ; CHECK-NEXT: vmov r2, s6
120 ; CHECK-NEXT: movs r0, #0
121 ; CHECK-NEXT: vmov r3, s2
122 ; CHECK-NEXT: vmov r12, s7
123 ; CHECK-NEXT: vmov r1, s3
124 ; CHECK-NEXT: vmov lr, s1
125 ; CHECK-NEXT: subs r2, r3, r2
126 ; CHECK-NEXT: vmov r3, s0
127 ; CHECK-NEXT: vmov r2, s4
128 ; CHECK-NEXT: sbcs.w r1, r1, r12
129 ; CHECK-NEXT: vmov r12, s5
130 ; CHECK-NEXT: mov.w r1, #0
132 ; CHECK-NEXT: movlo r1, #1
133 ; CHECK-NEXT: cmp r1, #0
135 ; CHECK-NEXT: movne.w r1, #-1
136 ; CHECK-NEXT: subs r2, r3, r2
137 ; CHECK-NEXT: sbcs.w r2, lr, r12
139 ; CHECK-NEXT: movlo r0, #1
140 ; CHECK-NEXT: cmp r0, #0
142 ; CHECK-NEXT: movne.w r0, #-1
143 ; CHECK-NEXT: vmov.32 q2[0], r0
144 ; CHECK-NEXT: vmov.32 q2[1], r0
145 ; CHECK-NEXT: vmov.32 q2[2], r1
146 ; CHECK-NEXT: vmov.32 q2[3], r1
147 ; CHECK-NEXT: vbic q1, q1, q2
148 ; CHECK-NEXT: vand q0, q0, q2
149 ; CHECK-NEXT: vorr q0, q0, q1
150 ; CHECK-NEXT: pop {r7, pc}
152 %0 = icmp ult <2 x i64> %s1, %s2
153 %1 = select <2 x i1> %0, <2 x i64> %s1, <2 x i64> %s2
158 define arm_aapcs_vfpcc <16 x i8> @smax_v16i8(<16 x i8> %s1, <16 x i8> %s2) {
159 ; CHECK-LABEL: smax_v16i8:
160 ; CHECK: @ %bb.0: @ %entry
161 ; CHECK-NEXT: vmax.s8 q0, q0, q1
164 %0 = icmp sgt <16 x i8> %s1, %s2
165 %1 = select <16 x i1> %0, <16 x i8> %s1, <16 x i8> %s2
169 define arm_aapcs_vfpcc <8 x i16> @smax_v8i16(<8 x i16> %s1, <8 x i16> %s2) {
170 ; CHECK-LABEL: smax_v8i16:
171 ; CHECK: @ %bb.0: @ %entry
172 ; CHECK-NEXT: vmax.s16 q0, q0, q1
175 %0 = icmp sgt <8 x i16> %s1, %s2
176 %1 = select <8 x i1> %0, <8 x i16> %s1, <8 x i16> %s2
180 define arm_aapcs_vfpcc <4 x i32> @smax_v4i32(<4 x i32> %s1, <4 x i32> %s2) {
181 ; CHECK-LABEL: smax_v4i32:
182 ; CHECK: @ %bb.0: @ %entry
183 ; CHECK-NEXT: vmax.s32 q0, q0, q1
186 %0 = icmp sgt <4 x i32> %s1, %s2
187 %1 = select <4 x i1> %0, <4 x i32> %s1, <4 x i32> %s2
191 define arm_aapcs_vfpcc <2 x i64> @smax_v2i64(<2 x i64> %s1, <2 x i64> %s2) {
192 ; CHECK-LABEL: smax_v2i64:
193 ; CHECK: @ %bb.0: @ %entry
194 ; CHECK-NEXT: .save {r7, lr}
195 ; CHECK-NEXT: push {r7, lr}
196 ; CHECK-NEXT: vmov r2, s2
197 ; CHECK-NEXT: movs r0, #0
198 ; CHECK-NEXT: vmov r3, s6
199 ; CHECK-NEXT: vmov r12, s3
200 ; CHECK-NEXT: vmov r1, s7
201 ; CHECK-NEXT: vmov lr, s5
202 ; CHECK-NEXT: subs r2, r3, r2
203 ; CHECK-NEXT: vmov r3, s4
204 ; CHECK-NEXT: vmov r2, s0
205 ; CHECK-NEXT: sbcs.w r1, r1, r12
206 ; CHECK-NEXT: vmov r12, s1
207 ; CHECK-NEXT: mov.w r1, #0
209 ; CHECK-NEXT: movlt r1, #1
210 ; CHECK-NEXT: cmp r1, #0
212 ; CHECK-NEXT: movne.w r1, #-1
213 ; CHECK-NEXT: subs r2, r3, r2
214 ; CHECK-NEXT: sbcs.w r2, lr, r12
216 ; CHECK-NEXT: movlt r0, #1
217 ; CHECK-NEXT: cmp r0, #0
219 ; CHECK-NEXT: movne.w r0, #-1
220 ; CHECK-NEXT: vmov.32 q2[0], r0
221 ; CHECK-NEXT: vmov.32 q2[1], r0
222 ; CHECK-NEXT: vmov.32 q2[2], r1
223 ; CHECK-NEXT: vmov.32 q2[3], r1
224 ; CHECK-NEXT: vbic q1, q1, q2
225 ; CHECK-NEXT: vand q0, q0, q2
226 ; CHECK-NEXT: vorr q0, q0, q1
227 ; CHECK-NEXT: pop {r7, pc}
229 %0 = icmp sgt <2 x i64> %s1, %s2
230 %1 = select <2 x i1> %0, <2 x i64> %s1, <2 x i64> %s2
234 define arm_aapcs_vfpcc <16 x i8> @umax_v16i8(<16 x i8> %s1, <16 x i8> %s2) {
235 ; CHECK-LABEL: umax_v16i8:
236 ; CHECK: @ %bb.0: @ %entry
237 ; CHECK-NEXT: vmax.u8 q0, q0, q1
240 %0 = icmp ugt <16 x i8> %s1, %s2
241 %1 = select <16 x i1> %0, <16 x i8> %s1, <16 x i8> %s2
245 define arm_aapcs_vfpcc <8 x i16> @umax_v8i16(<8 x i16> %s1, <8 x i16> %s2) {
246 ; CHECK-LABEL: umax_v8i16:
247 ; CHECK: @ %bb.0: @ %entry
248 ; CHECK-NEXT: vmax.u16 q0, q0, q1
251 %0 = icmp ugt <8 x i16> %s1, %s2
252 %1 = select <8 x i1> %0, <8 x i16> %s1, <8 x i16> %s2
256 define arm_aapcs_vfpcc <4 x i32> @umax_v4i32(<4 x i32> %s1, <4 x i32> %s2) {
257 ; CHECK-LABEL: umax_v4i32:
258 ; CHECK: @ %bb.0: @ %entry
259 ; CHECK-NEXT: vmax.u32 q0, q0, q1
262 %0 = icmp ugt <4 x i32> %s1, %s2
263 %1 = select <4 x i1> %0, <4 x i32> %s1, <4 x i32> %s2
267 define arm_aapcs_vfpcc <2 x i64> @umax_v2i64(<2 x i64> %s1, <2 x i64> %s2) {
268 ; CHECK-LABEL: umax_v2i64:
269 ; CHECK: @ %bb.0: @ %entry
270 ; CHECK-NEXT: .save {r7, lr}
271 ; CHECK-NEXT: push {r7, lr}
272 ; CHECK-NEXT: vmov r2, s2
273 ; CHECK-NEXT: movs r0, #0
274 ; CHECK-NEXT: vmov r3, s6
275 ; CHECK-NEXT: vmov r12, s3
276 ; CHECK-NEXT: vmov r1, s7
277 ; CHECK-NEXT: vmov lr, s5
278 ; CHECK-NEXT: subs r2, r3, r2
279 ; CHECK-NEXT: vmov r3, s4
280 ; CHECK-NEXT: vmov r2, s0
281 ; CHECK-NEXT: sbcs.w r1, r1, r12
282 ; CHECK-NEXT: vmov r12, s1
283 ; CHECK-NEXT: mov.w r1, #0
285 ; CHECK-NEXT: movlo r1, #1
286 ; CHECK-NEXT: cmp r1, #0
288 ; CHECK-NEXT: movne.w r1, #-1
289 ; CHECK-NEXT: subs r2, r3, r2
290 ; CHECK-NEXT: sbcs.w r2, lr, r12
292 ; CHECK-NEXT: movlo r0, #1
293 ; CHECK-NEXT: cmp r0, #0
295 ; CHECK-NEXT: movne.w r0, #-1
296 ; CHECK-NEXT: vmov.32 q2[0], r0
297 ; CHECK-NEXT: vmov.32 q2[1], r0
298 ; CHECK-NEXT: vmov.32 q2[2], r1
299 ; CHECK-NEXT: vmov.32 q2[3], r1
300 ; CHECK-NEXT: vbic q1, q1, q2
301 ; CHECK-NEXT: vand q0, q0, q2
302 ; CHECK-NEXT: vorr q0, q0, q1
303 ; CHECK-NEXT: pop {r7, pc}
305 %0 = icmp ugt <2 x i64> %s1, %s2
306 %1 = select <2 x i1> %0, <2 x i64> %s1, <2 x i64> %s2
311 define arm_aapcs_vfpcc <4 x float> @maxnm_float32_t(<4 x float> %src1, <4 x float> %src2) {
312 ; CHECK-MVE-LABEL: maxnm_float32_t:
313 ; CHECK-MVE: @ %bb.0: @ %entry
314 ; CHECK-MVE-NEXT: vmaxnm.f32 s11, s7, s3
315 ; CHECK-MVE-NEXT: vmaxnm.f32 s10, s6, s2
316 ; CHECK-MVE-NEXT: vmaxnm.f32 s9, s5, s1
317 ; CHECK-MVE-NEXT: vmaxnm.f32 s8, s4, s0
318 ; CHECK-MVE-NEXT: vmov q0, q2
319 ; CHECK-MVE-NEXT: bx lr
321 ; CHECK-MVEFP-LABEL: maxnm_float32_t:
322 ; CHECK-MVEFP: @ %bb.0: @ %entry
323 ; CHECK-MVEFP-NEXT: vmaxnm.f32 q0, q1, q0
324 ; CHECK-MVEFP-NEXT: bx lr
326 %cmp = fcmp fast ogt <4 x float> %src2, %src1
327 %0 = select <4 x i1> %cmp, <4 x float> %src2, <4 x float> %src1
331 define arm_aapcs_vfpcc <8 x half> @minnm_float16_t(<8 x half> %src1, <8 x half> %src2) {
332 ; CHECK-MVE-LABEL: minnm_float16_t:
333 ; CHECK-MVE: @ %bb.0: @ %entry
334 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[0]
335 ; CHECK-MVE-NEXT: vmov.u16 r1, q0[1]
336 ; CHECK-MVE-NEXT: vmov s8, r0
337 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[0]
338 ; CHECK-MVE-NEXT: vmov s10, r0
339 ; CHECK-MVE-NEXT: vmov.u16 r2, q1[1]
340 ; CHECK-MVE-NEXT: vminnm.f16 s8, s10, s8
341 ; CHECK-MVE-NEXT: vmov s10, r2
342 ; CHECK-MVE-NEXT: vmov r0, s8
343 ; CHECK-MVE-NEXT: vmov s8, r1
344 ; CHECK-MVE-NEXT: vminnm.f16 s8, s10, s8
345 ; CHECK-MVE-NEXT: vmov r1, s8
346 ; CHECK-MVE-NEXT: vmov.16 q2[0], r0
347 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[2]
348 ; CHECK-MVE-NEXT: vmov.16 q2[1], r1
349 ; CHECK-MVE-NEXT: vmov s12, r0
350 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[2]
351 ; CHECK-MVE-NEXT: vmov s14, r0
352 ; CHECK-MVE-NEXT: vminnm.f16 s12, s14, s12
353 ; CHECK-MVE-NEXT: vmov r0, s12
354 ; CHECK-MVE-NEXT: vmov.16 q2[2], r0
355 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[3]
356 ; CHECK-MVE-NEXT: vmov s12, r0
357 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[3]
358 ; CHECK-MVE-NEXT: vmov s14, r0
359 ; CHECK-MVE-NEXT: vminnm.f16 s12, s14, s12
360 ; CHECK-MVE-NEXT: vmov r0, s12
361 ; CHECK-MVE-NEXT: vmov.16 q2[3], r0
362 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[4]
363 ; CHECK-MVE-NEXT: vmov s12, r0
364 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[4]
365 ; CHECK-MVE-NEXT: vmov s14, r0
366 ; CHECK-MVE-NEXT: vminnm.f16 s12, s14, s12
367 ; CHECK-MVE-NEXT: vmov r0, s12
368 ; CHECK-MVE-NEXT: vmov.16 q2[4], r0
369 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[5]
370 ; CHECK-MVE-NEXT: vmov s12, r0
371 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[5]
372 ; CHECK-MVE-NEXT: vmov s14, r0
373 ; CHECK-MVE-NEXT: vminnm.f16 s12, s14, s12
374 ; CHECK-MVE-NEXT: vmov r0, s12
375 ; CHECK-MVE-NEXT: vmov.16 q2[5], r0
376 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[6]
377 ; CHECK-MVE-NEXT: vmov s12, r0
378 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[6]
379 ; CHECK-MVE-NEXT: vmov s14, r0
380 ; CHECK-MVE-NEXT: vminnm.f16 s12, s14, s12
381 ; CHECK-MVE-NEXT: vmov r0, s12
382 ; CHECK-MVE-NEXT: vmov.16 q2[6], r0
383 ; CHECK-MVE-NEXT: vmov.u16 r0, q0[7]
384 ; CHECK-MVE-NEXT: vmov s0, r0
385 ; CHECK-MVE-NEXT: vmov.u16 r0, q1[7]
386 ; CHECK-MVE-NEXT: vmov s2, r0
387 ; CHECK-MVE-NEXT: vminnm.f16 s0, s2, s0
388 ; CHECK-MVE-NEXT: vmov r0, s0
389 ; CHECK-MVE-NEXT: vmov.16 q2[7], r0
390 ; CHECK-MVE-NEXT: vmov q0, q2
391 ; CHECK-MVE-NEXT: bx lr
393 ; CHECK-MVEFP-LABEL: minnm_float16_t:
394 ; CHECK-MVEFP: @ %bb.0: @ %entry
395 ; CHECK-MVEFP-NEXT: vminnm.f16 q0, q1, q0
396 ; CHECK-MVEFP-NEXT: bx lr
398 %cmp = fcmp fast ogt <8 x half> %src2, %src1
399 %0 = select <8 x i1> %cmp, <8 x half> %src1, <8 x half> %src2
403 define arm_aapcs_vfpcc <2 x double> @maxnm_float64_t(<2 x double> %src1, <2 x double> %src2) {
404 ; CHECK-LABEL: maxnm_float64_t:
405 ; CHECK: @ %bb.0: @ %entry
406 ; CHECK-NEXT: .save {r4, lr}
407 ; CHECK-NEXT: push {r4, lr}
408 ; CHECK-NEXT: .vsave {d8, d9, d10, d11}
409 ; CHECK-NEXT: vpush {d8, d9, d10, d11}
410 ; CHECK-NEXT: vmov q4, q1
411 ; CHECK-NEXT: vmov q5, q0
412 ; CHECK-NEXT: vmov r0, r1, d9
413 ; CHECK-NEXT: vmov r2, r3, d11
414 ; CHECK-NEXT: bl __aeabi_dcmpgt
415 ; CHECK-NEXT: mov r4, r0
416 ; CHECK-NEXT: vmov r0, r1, d8
417 ; CHECK-NEXT: vmov r2, r3, d10
418 ; CHECK-NEXT: cmp r4, #0
420 ; CHECK-NEXT: movne r4, #1
421 ; CHECK-NEXT: cmp r4, #0
423 ; CHECK-NEXT: movne.w r4, #-1
424 ; CHECK-NEXT: bl __aeabi_dcmpgt
425 ; CHECK-NEXT: cmp r0, #0
427 ; CHECK-NEXT: movne r0, #1
428 ; CHECK-NEXT: cmp r0, #0
430 ; CHECK-NEXT: movne.w r0, #-1
431 ; CHECK-NEXT: vmov.32 q0[0], r0
432 ; CHECK-NEXT: vmov.32 q0[1], r0
433 ; CHECK-NEXT: vmov.32 q0[2], r4
434 ; CHECK-NEXT: vmov.32 q0[3], r4
435 ; CHECK-NEXT: vbic q1, q5, q0
436 ; CHECK-NEXT: vand q0, q4, q0
437 ; CHECK-NEXT: vorr q0, q0, q1
438 ; CHECK-NEXT: vpop {d8, d9, d10, d11}
439 ; CHECK-NEXT: pop {r4, pc}
441 %cmp = fcmp fast ogt <2 x double> %src2, %src1
442 %0 = select <2 x i1> %cmp, <2 x double> %src2, <2 x double> %src1