1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
4 define arm_aapcs_vfpcc <4 x i32> @vqmovni32_smaxmin(<4 x i32> %s0) {
5 ; CHECK-LABEL: vqmovni32_smaxmin:
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: vqmovnb.s32 q0, q0
8 ; CHECK-NEXT: vmovlb.s16 q0, q0
11 %c1 = icmp slt <4 x i32> %s0, <i32 32767, i32 32767, i32 32767, i32 32767>
12 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 32767, i32 32767, i32 32767, i32 32767>
13 %c2 = icmp sgt <4 x i32> %s1, <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
14 %s2 = select <4 x i1> %c2, <4 x i32> %s1, <4 x i32> <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
18 define arm_aapcs_vfpcc <4 x i32> @vqmovni32_sminmax(<4 x i32> %s0) {
19 ; CHECK-LABEL: vqmovni32_sminmax:
20 ; CHECK: @ %bb.0: @ %entry
21 ; CHECK-NEXT: vqmovnb.s32 q0, q0
22 ; CHECK-NEXT: vmovlb.s16 q0, q0
25 %c1 = icmp sgt <4 x i32> %s0, <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
26 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
27 %c2 = icmp slt <4 x i32> %s1, <i32 32767, i32 32767, i32 32767, i32 32767>
28 %s2 = select <4 x i1> %c2, <4 x i32> %s1, <4 x i32> <i32 32767, i32 32767, i32 32767, i32 32767>
32 define arm_aapcs_vfpcc <4 x i32> @vqmovni32_umaxmin(<4 x i32> %s0) {
33 ; CHECK-LABEL: vqmovni32_umaxmin:
34 ; CHECK: @ %bb.0: @ %entry
35 ; CHECK-NEXT: vqmovnb.u32 q0, q0
36 ; CHECK-NEXT: vmovlb.u16 q0, q0
39 %c1 = icmp ult <4 x i32> %s0, <i32 65535, i32 65535, i32 65535, i32 65535>
40 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 65535, i32 65535, i32 65535, i32 65535>
44 define arm_aapcs_vfpcc <4 x i32> @vqmovni32_uminmax(<4 x i32> %s0) {
45 ; CHECK-LABEL: vqmovni32_uminmax:
46 ; CHECK: @ %bb.0: @ %entry
47 ; CHECK-NEXT: vqmovnb.u32 q0, q0
48 ; CHECK-NEXT: vmovlb.u16 q0, q0
51 %c2 = icmp ult <4 x i32> %s0, <i32 65535, i32 65535, i32 65535, i32 65535>
52 %s2 = select <4 x i1> %c2, <4 x i32> %s0, <4 x i32> <i32 65535, i32 65535, i32 65535, i32 65535>
56 define arm_aapcs_vfpcc <8 x i16> @vqmovni16_smaxmin(<8 x i16> %s0) {
57 ; CHECK-LABEL: vqmovni16_smaxmin:
58 ; CHECK: @ %bb.0: @ %entry
59 ; CHECK-NEXT: vqmovnb.s16 q0, q0
60 ; CHECK-NEXT: vmovlb.s8 q0, q0
63 %c1 = icmp slt <8 x i16> %s0, <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
64 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
65 %c2 = icmp sgt <8 x i16> %s1, <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
66 %s2 = select <8 x i1> %c2, <8 x i16> %s1, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
70 define arm_aapcs_vfpcc <8 x i16> @vqmovni16_sminmax(<8 x i16> %s0) {
71 ; CHECK-LABEL: vqmovni16_sminmax:
72 ; CHECK: @ %bb.0: @ %entry
73 ; CHECK-NEXT: vqmovnb.s16 q0, q0
74 ; CHECK-NEXT: vmovlb.s8 q0, q0
77 %c1 = icmp sgt <8 x i16> %s0, <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
78 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
79 %c2 = icmp slt <8 x i16> %s1, <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
80 %s2 = select <8 x i1> %c2, <8 x i16> %s1, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
84 define arm_aapcs_vfpcc <8 x i16> @vqmovni16_umaxmin(<8 x i16> %s0) {
85 ; CHECK-LABEL: vqmovni16_umaxmin:
86 ; CHECK: @ %bb.0: @ %entry
87 ; CHECK-NEXT: vqmovnb.u16 q0, q0
88 ; CHECK-NEXT: vmovlb.u8 q0, q0
91 %c1 = icmp ult <8 x i16> %s0, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
92 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
96 define arm_aapcs_vfpcc <8 x i16> @vqmovni16_uminmax(<8 x i16> %s0) {
97 ; CHECK-LABEL: vqmovni16_uminmax:
98 ; CHECK: @ %bb.0: @ %entry
99 ; CHECK-NEXT: vqmovnb.u16 q0, q0
100 ; CHECK-NEXT: vmovlb.u8 q0, q0
103 %c2 = icmp ult <8 x i16> %s0, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
104 %s2 = select <8 x i1> %c2, <8 x i16> %s0, <8 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
108 define arm_aapcs_vfpcc <16 x i8> @vqmovni8_smaxmin(<16 x i8> %s0) {
109 ; CHECK-LABEL: vqmovni8_smaxmin:
110 ; CHECK: @ %bb.0: @ %entry
111 ; CHECK-NEXT: vmov.i8 q1, #0x7
112 ; CHECK-NEXT: vmin.s8 q0, q0, q1
113 ; CHECK-NEXT: vmov.i8 q1, #0xf8
114 ; CHECK-NEXT: vmax.s8 q0, q0, q1
117 %c1 = icmp slt <16 x i8> %s0, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
118 %s1 = select <16 x i1> %c1, <16 x i8> %s0, <16 x i8> <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
119 %c2 = icmp sgt <16 x i8> %s1, <i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8>
120 %s2 = select <16 x i1> %c2, <16 x i8> %s1, <16 x i8> <i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8>
124 define arm_aapcs_vfpcc <16 x i8> @vqmovni8_sminmax(<16 x i8> %s0) {
125 ; CHECK-LABEL: vqmovni8_sminmax:
126 ; CHECK: @ %bb.0: @ %entry
127 ; CHECK-NEXT: vmov.i8 q1, #0xf8
128 ; CHECK-NEXT: vmax.s8 q0, q0, q1
129 ; CHECK-NEXT: vmov.i8 q1, #0x7
130 ; CHECK-NEXT: vmin.s8 q0, q0, q1
133 %c1 = icmp sgt <16 x i8> %s0, <i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8>
134 %s1 = select <16 x i1> %c1, <16 x i8> %s0, <16 x i8> <i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8, i8 -8>
135 %c2 = icmp slt <16 x i8> %s1, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
136 %s2 = select <16 x i1> %c2, <16 x i8> %s1, <16 x i8> <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
140 define arm_aapcs_vfpcc <16 x i8> @vqmovni8_umaxmin(<16 x i8> %s0) {
141 ; CHECK-LABEL: vqmovni8_umaxmin:
142 ; CHECK: @ %bb.0: @ %entry
143 ; CHECK-NEXT: vmov.i8 q1, #0xf
144 ; CHECK-NEXT: vmin.u8 q0, q0, q1
147 %c1 = icmp ult <16 x i8> %s0, <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15>
148 %s1 = select <16 x i1> %c1, <16 x i8> %s0, <16 x i8> <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15>
152 define arm_aapcs_vfpcc <16 x i8> @vqmovni8_uminmax(<16 x i8> %s0) {
153 ; CHECK-LABEL: vqmovni8_uminmax:
154 ; CHECK: @ %bb.0: @ %entry
155 ; CHECK-NEXT: vmov.i8 q1, #0xf
156 ; CHECK-NEXT: vmin.u8 q0, q0, q1
159 %c2 = icmp ult <16 x i8> %s0, <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15>
160 %s2 = select <16 x i1> %c2, <16 x i8> %s0, <16 x i8> <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15>
164 define arm_aapcs_vfpcc <2 x i64> @vqmovni64_smaxmin(<2 x i64> %s0) {
165 ; CHECK-LABEL: vqmovni64_smaxmin:
166 ; CHECK: @ %bb.0: @ %entry
167 ; CHECK-NEXT: vmov r1, r2, d1
168 ; CHECK-NEXT: mvn r12, #-2147483648
169 ; CHECK-NEXT: movs r0, #0
170 ; CHECK-NEXT: subs.w r1, r1, r12
171 ; CHECK-NEXT: sbcs r1, r2, #0
172 ; CHECK-NEXT: vmov r2, r3, d0
173 ; CHECK-NEXT: mov.w r1, #0
175 ; CHECK-NEXT: movlt r1, #1
176 ; CHECK-NEXT: cmp r1, #0
177 ; CHECK-NEXT: csetm r1, ne
178 ; CHECK-NEXT: subs.w r2, r2, r12
179 ; CHECK-NEXT: mov.w r12, #-1
180 ; CHECK-NEXT: sbcs r2, r3, #0
181 ; CHECK-NEXT: mov.w r2, #0
183 ; CHECK-NEXT: movlt r2, #1
184 ; CHECK-NEXT: cmp r2, #0
185 ; CHECK-NEXT: csetm r2, ne
186 ; CHECK-NEXT: vmov q1[2], q1[0], r2, r1
187 ; CHECK-NEXT: vmov q1[3], q1[1], r2, r1
188 ; CHECK-NEXT: adr r1, .LCPI12_0
189 ; CHECK-NEXT: vldrw.u32 q2, [r1]
190 ; CHECK-NEXT: vand q0, q0, q1
191 ; CHECK-NEXT: vbic q2, q2, q1
192 ; CHECK-NEXT: vorr q0, q0, q2
193 ; CHECK-NEXT: vmov r1, r2, d1
194 ; CHECK-NEXT: rsbs.w r1, r1, #-2147483648
195 ; CHECK-NEXT: sbcs.w r1, r12, r2
196 ; CHECK-NEXT: vmov r2, r3, d0
197 ; CHECK-NEXT: mov.w r1, #0
199 ; CHECK-NEXT: movlt r1, #1
200 ; CHECK-NEXT: cmp r1, #0
201 ; CHECK-NEXT: csetm r1, ne
202 ; CHECK-NEXT: rsbs.w r2, r2, #-2147483648
203 ; CHECK-NEXT: sbcs.w r2, r12, r3
205 ; CHECK-NEXT: movlt r0, #1
206 ; CHECK-NEXT: cmp r0, #0
207 ; CHECK-NEXT: csetm r0, ne
208 ; CHECK-NEXT: vmov q1[2], q1[0], r0, r1
209 ; CHECK-NEXT: vmov q1[3], q1[1], r0, r1
210 ; CHECK-NEXT: adr r0, .LCPI12_1
211 ; CHECK-NEXT: vldrw.u32 q2, [r0]
212 ; CHECK-NEXT: vand q0, q0, q1
213 ; CHECK-NEXT: vbic q2, q2, q1
214 ; CHECK-NEXT: vorr q0, q0, q2
216 ; CHECK-NEXT: .p2align 4
217 ; CHECK-NEXT: @ %bb.1:
218 ; CHECK-NEXT: .LCPI12_0:
219 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
220 ; CHECK-NEXT: .long 0 @ 0x0
221 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
222 ; CHECK-NEXT: .long 0 @ 0x0
223 ; CHECK-NEXT: .LCPI12_1:
224 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
225 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
226 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
227 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
229 %c1 = icmp slt <2 x i64> %s0, <i64 2147483647, i64 2147483647>
230 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 2147483647, i64 2147483647>
231 %c2 = icmp sgt <2 x i64> %s1, <i64 -2147483648, i64 -2147483648>
232 %s2 = select <2 x i1> %c2, <2 x i64> %s1, <2 x i64> <i64 -2147483648, i64 -2147483648>
236 define arm_aapcs_vfpcc <2 x i64> @vqmovni64_sminmax(<2 x i64> %s0) {
237 ; CHECK-LABEL: vqmovni64_sminmax:
238 ; CHECK: @ %bb.0: @ %entry
239 ; CHECK-NEXT: vmov r1, r2, d1
240 ; CHECK-NEXT: mov.w r12, #-1
241 ; CHECK-NEXT: movs r0, #0
242 ; CHECK-NEXT: rsbs.w r1, r1, #-2147483648
243 ; CHECK-NEXT: sbcs.w r1, r12, r2
244 ; CHECK-NEXT: vmov r2, r3, d0
245 ; CHECK-NEXT: mov.w r1, #0
247 ; CHECK-NEXT: movlt r1, #1
248 ; CHECK-NEXT: cmp r1, #0
249 ; CHECK-NEXT: csetm r1, ne
250 ; CHECK-NEXT: rsbs.w r2, r2, #-2147483648
251 ; CHECK-NEXT: sbcs.w r2, r12, r3
252 ; CHECK-NEXT: mvn r12, #-2147483648
253 ; CHECK-NEXT: mov.w r2, #0
255 ; CHECK-NEXT: movlt r2, #1
256 ; CHECK-NEXT: cmp r2, #0
257 ; CHECK-NEXT: csetm r2, ne
258 ; CHECK-NEXT: vmov q1[2], q1[0], r2, r1
259 ; CHECK-NEXT: vmov q1[3], q1[1], r2, r1
260 ; CHECK-NEXT: adr r1, .LCPI13_0
261 ; CHECK-NEXT: vldrw.u32 q2, [r1]
262 ; CHECK-NEXT: vand q0, q0, q1
263 ; CHECK-NEXT: vbic q2, q2, q1
264 ; CHECK-NEXT: vorr q0, q0, q2
265 ; CHECK-NEXT: vmov r1, r2, d1
266 ; CHECK-NEXT: subs.w r1, r1, r12
267 ; CHECK-NEXT: sbcs r1, r2, #0
268 ; CHECK-NEXT: vmov r2, r3, d0
269 ; CHECK-NEXT: mov.w r1, #0
271 ; CHECK-NEXT: movlt r1, #1
272 ; CHECK-NEXT: cmp r1, #0
273 ; CHECK-NEXT: csetm r1, ne
274 ; CHECK-NEXT: subs.w r2, r2, r12
275 ; CHECK-NEXT: sbcs r2, r3, #0
277 ; CHECK-NEXT: movlt r0, #1
278 ; CHECK-NEXT: cmp r0, #0
279 ; CHECK-NEXT: csetm r0, ne
280 ; CHECK-NEXT: vmov q1[2], q1[0], r0, r1
281 ; CHECK-NEXT: vmov q1[3], q1[1], r0, r1
282 ; CHECK-NEXT: adr r0, .LCPI13_1
283 ; CHECK-NEXT: vldrw.u32 q2, [r0]
284 ; CHECK-NEXT: vand q0, q0, q1
285 ; CHECK-NEXT: vbic q2, q2, q1
286 ; CHECK-NEXT: vorr q0, q0, q2
288 ; CHECK-NEXT: .p2align 4
289 ; CHECK-NEXT: @ %bb.1:
290 ; CHECK-NEXT: .LCPI13_0:
291 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
292 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
293 ; CHECK-NEXT: .long 2147483648 @ 0x80000000
294 ; CHECK-NEXT: .long 4294967295 @ 0xffffffff
295 ; CHECK-NEXT: .LCPI13_1:
296 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
297 ; CHECK-NEXT: .long 0 @ 0x0
298 ; CHECK-NEXT: .long 2147483647 @ 0x7fffffff
299 ; CHECK-NEXT: .long 0 @ 0x0
301 %c1 = icmp sgt <2 x i64> %s0, <i64 -2147483648, i64 -2147483648>
302 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 -2147483648, i64 -2147483648>
303 %c2 = icmp slt <2 x i64> %s1, <i64 2147483647, i64 2147483647>
304 %s2 = select <2 x i1> %c2, <2 x i64> %s1, <2 x i64> <i64 2147483647, i64 2147483647>
308 define arm_aapcs_vfpcc <2 x i64> @vqmovni64_umaxmin(<2 x i64> %s0) {
309 ; CHECK-LABEL: vqmovni64_umaxmin:
310 ; CHECK: @ %bb.0: @ %entry
311 ; CHECK-NEXT: vmov r0, r1, d1
312 ; CHECK-NEXT: movs r2, #0
313 ; CHECK-NEXT: vmov.i64 q2, #0xffffffff
314 ; CHECK-NEXT: subs.w r0, r0, #-1
315 ; CHECK-NEXT: sbcs r0, r1, #0
316 ; CHECK-NEXT: vmov r1, r3, d0
317 ; CHECK-NEXT: mov.w r0, #0
319 ; CHECK-NEXT: movlo r0, #1
320 ; CHECK-NEXT: cmp r0, #0
321 ; CHECK-NEXT: csetm r0, ne
322 ; CHECK-NEXT: subs.w r1, r1, #-1
323 ; CHECK-NEXT: sbcs r1, r3, #0
325 ; CHECK-NEXT: movlo r2, #1
326 ; CHECK-NEXT: cmp r2, #0
327 ; CHECK-NEXT: csetm r1, ne
328 ; CHECK-NEXT: vmov q1[2], q1[0], r1, r0
329 ; CHECK-NEXT: vmov q1[3], q1[1], r1, r0
330 ; CHECK-NEXT: vbic q2, q2, q1
331 ; CHECK-NEXT: vand q0, q0, q1
332 ; CHECK-NEXT: vorr q0, q0, q2
335 %c1 = icmp ult <2 x i64> %s0, <i64 4294967295, i64 4294967295>
336 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 4294967295, i64 4294967295>
340 define arm_aapcs_vfpcc <2 x i64> @vqmovni64_uminmax(<2 x i64> %s0) {
341 ; CHECK-LABEL: vqmovni64_uminmax:
342 ; CHECK: @ %bb.0: @ %entry
343 ; CHECK-NEXT: vmov r0, r1, d1
344 ; CHECK-NEXT: movs r2, #0
345 ; CHECK-NEXT: vmov.i64 q2, #0xffffffff
346 ; CHECK-NEXT: subs.w r0, r0, #-1
347 ; CHECK-NEXT: sbcs r0, r1, #0
348 ; CHECK-NEXT: vmov r1, r3, d0
349 ; CHECK-NEXT: mov.w r0, #0
351 ; CHECK-NEXT: movlo r0, #1
352 ; CHECK-NEXT: cmp r0, #0
353 ; CHECK-NEXT: csetm r0, ne
354 ; CHECK-NEXT: subs.w r1, r1, #-1
355 ; CHECK-NEXT: sbcs r1, r3, #0
357 ; CHECK-NEXT: movlo r2, #1
358 ; CHECK-NEXT: cmp r2, #0
359 ; CHECK-NEXT: csetm r1, ne
360 ; CHECK-NEXT: vmov q1[2], q1[0], r1, r0
361 ; CHECK-NEXT: vmov q1[3], q1[1], r1, r0
362 ; CHECK-NEXT: vbic q2, q2, q1
363 ; CHECK-NEXT: vand q0, q0, q1
364 ; CHECK-NEXT: vorr q0, q0, q2
367 %c2 = icmp ult <2 x i64> %s0, <i64 4294967295, i64 4294967295>
368 %s2 = select <2 x i1> %c2, <2 x i64> %s0, <2 x i64> <i64 4294967295, i64 4294967295>