1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64 | FileCheck %s --check-prefixes=CHECK,CHECK-CVT
3 ; RUN: llc < %s -mtriple=aarch64 -mattr=+fullfp16 | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
6 ; Float to signed 32-bit -- Vector size variation
9 declare <1 x i32> @llvm.fptosi.sat.v1f32.v1i32 (<1 x float>)
10 declare <2 x i32> @llvm.fptosi.sat.v2f32.v2i32 (<2 x float>)
11 declare <3 x i32> @llvm.fptosi.sat.v3f32.v3i32 (<3 x float>)
12 declare <4 x i32> @llvm.fptosi.sat.v4f32.v4i32 (<4 x float>)
13 declare <5 x i32> @llvm.fptosi.sat.v5f32.v5i32 (<5 x float>)
14 declare <6 x i32> @llvm.fptosi.sat.v6f32.v6i32 (<6 x float>)
15 declare <7 x i32> @llvm.fptosi.sat.v7f32.v7i32 (<7 x float>)
16 declare <8 x i32> @llvm.fptosi.sat.v8f32.v8i32 (<8 x float>)
18 define <1 x i32> @test_signed_v1f32_v1i32(<1 x float> %f) {
19 ; CHECK-LABEL: test_signed_v1f32_v1i32:
21 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
23 %x = call <1 x i32> @llvm.fptosi.sat.v1f32.v1i32(<1 x float> %f)
27 define <2 x i32> @test_signed_v2f32_v2i32(<2 x float> %f) {
28 ; CHECK-LABEL: test_signed_v2f32_v2i32:
30 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
32 %x = call <2 x i32> @llvm.fptosi.sat.v2f32.v2i32(<2 x float> %f)
36 define <3 x i32> @test_signed_v3f32_v3i32(<3 x float> %f) {
37 ; CHECK-LABEL: test_signed_v3f32_v3i32:
39 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
41 %x = call <3 x i32> @llvm.fptosi.sat.v3f32.v3i32(<3 x float> %f)
45 define <4 x i32> @test_signed_v4f32_v4i32(<4 x float> %f) {
46 ; CHECK-LABEL: test_signed_v4f32_v4i32:
48 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
50 %x = call <4 x i32> @llvm.fptosi.sat.v4f32.v4i32(<4 x float> %f)
54 define <5 x i32> @test_signed_v5f32_v5i32(<5 x float> %f) {
55 ; CHECK-LABEL: test_signed_v5f32_v5i32:
57 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
58 ; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1
59 ; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2
60 ; CHECK-NEXT: // kill: def $s3 killed $s3 def $q3
61 ; CHECK-NEXT: // kill: def $s4 killed $s4 def $q4
62 ; CHECK-NEXT: mov v0.s[1], v1.s[0]
63 ; CHECK-NEXT: fcvtzs v4.4s, v4.4s
64 ; CHECK-NEXT: mov v0.s[2], v2.s[0]
65 ; CHECK-NEXT: fmov w4, s4
66 ; CHECK-NEXT: mov v0.s[3], v3.s[0]
67 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
68 ; CHECK-NEXT: mov w1, v0.s[1]
69 ; CHECK-NEXT: mov w2, v0.s[2]
70 ; CHECK-NEXT: mov w3, v0.s[3]
71 ; CHECK-NEXT: fmov w0, s0
73 %x = call <5 x i32> @llvm.fptosi.sat.v5f32.v5i32(<5 x float> %f)
77 define <6 x i32> @test_signed_v6f32_v6i32(<6 x float> %f) {
78 ; CHECK-LABEL: test_signed_v6f32_v6i32:
80 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
81 ; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1
82 ; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2
83 ; CHECK-NEXT: // kill: def $s4 killed $s4 def $q4
84 ; CHECK-NEXT: // kill: def $s5 killed $s5 def $q5
85 ; CHECK-NEXT: // kill: def $s3 killed $s3 def $q3
86 ; CHECK-NEXT: mov v0.s[1], v1.s[0]
87 ; CHECK-NEXT: mov v4.s[1], v5.s[0]
88 ; CHECK-NEXT: mov v0.s[2], v2.s[0]
89 ; CHECK-NEXT: fcvtzs v1.4s, v4.4s
90 ; CHECK-NEXT: mov v0.s[3], v3.s[0]
91 ; CHECK-NEXT: mov w5, v1.s[1]
92 ; CHECK-NEXT: fmov w4, s1
93 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
94 ; CHECK-NEXT: mov w1, v0.s[1]
95 ; CHECK-NEXT: mov w2, v0.s[2]
96 ; CHECK-NEXT: mov w3, v0.s[3]
97 ; CHECK-NEXT: fmov w0, s0
99 %x = call <6 x i32> @llvm.fptosi.sat.v6f32.v6i32(<6 x float> %f)
103 define <7 x i32> @test_signed_v7f32_v7i32(<7 x float> %f) {
104 ; CHECK-LABEL: test_signed_v7f32_v7i32:
106 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
107 ; CHECK-NEXT: // kill: def $s1 killed $s1 def $q1
108 ; CHECK-NEXT: // kill: def $s4 killed $s4 def $q4
109 ; CHECK-NEXT: // kill: def $s5 killed $s5 def $q5
110 ; CHECK-NEXT: // kill: def $s2 killed $s2 def $q2
111 ; CHECK-NEXT: // kill: def $s6 killed $s6 def $q6
112 ; CHECK-NEXT: // kill: def $s3 killed $s3 def $q3
113 ; CHECK-NEXT: mov v0.s[1], v1.s[0]
114 ; CHECK-NEXT: mov v4.s[1], v5.s[0]
115 ; CHECK-NEXT: mov v0.s[2], v2.s[0]
116 ; CHECK-NEXT: mov v4.s[2], v6.s[0]
117 ; CHECK-NEXT: mov v0.s[3], v3.s[0]
118 ; CHECK-NEXT: fcvtzs v1.4s, v4.4s
119 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
120 ; CHECK-NEXT: mov w5, v1.s[1]
121 ; CHECK-NEXT: mov w6, v1.s[2]
122 ; CHECK-NEXT: fmov w4, s1
123 ; CHECK-NEXT: mov w1, v0.s[1]
124 ; CHECK-NEXT: mov w2, v0.s[2]
125 ; CHECK-NEXT: mov w3, v0.s[3]
126 ; CHECK-NEXT: fmov w0, s0
128 %x = call <7 x i32> @llvm.fptosi.sat.v7f32.v7i32(<7 x float> %f)
132 define <8 x i32> @test_signed_v8f32_v8i32(<8 x float> %f) {
133 ; CHECK-LABEL: test_signed_v8f32_v8i32:
135 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
136 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
138 %x = call <8 x i32> @llvm.fptosi.sat.v8f32.v8i32(<8 x float> %f)
143 ; Double to signed 32-bit -- Vector size variation
146 declare <1 x i32> @llvm.fptosi.sat.v1f64.v1i32 (<1 x double>)
147 declare <2 x i32> @llvm.fptosi.sat.v2f64.v2i32 (<2 x double>)
148 declare <3 x i32> @llvm.fptosi.sat.v3f64.v3i32 (<3 x double>)
149 declare <4 x i32> @llvm.fptosi.sat.v4f64.v4i32 (<4 x double>)
150 declare <5 x i32> @llvm.fptosi.sat.v5f64.v5i32 (<5 x double>)
151 declare <6 x i32> @llvm.fptosi.sat.v6f64.v6i32 (<6 x double>)
153 define <1 x i32> @test_signed_v1f64_v1i32(<1 x double> %f) {
154 ; CHECK-LABEL: test_signed_v1f64_v1i32:
156 ; CHECK-NEXT: fcvtzs w8, d0
157 ; CHECK-NEXT: fmov s0, w8
159 %x = call <1 x i32> @llvm.fptosi.sat.v1f64.v1i32(<1 x double> %f)
163 define <2 x i32> @test_signed_v2f64_v2i32(<2 x double> %f) {
164 ; CHECK-LABEL: test_signed_v2f64_v2i32:
166 ; CHECK-NEXT: mov d1, v0.d[1]
167 ; CHECK-NEXT: fcvtzs w8, d0
168 ; CHECK-NEXT: fcvtzs w9, d1
169 ; CHECK-NEXT: fmov s0, w8
170 ; CHECK-NEXT: mov v0.s[1], w9
171 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
173 %x = call <2 x i32> @llvm.fptosi.sat.v2f64.v2i32(<2 x double> %f)
177 define <3 x i32> @test_signed_v3f64_v3i32(<3 x double> %f) {
178 ; CHECK-LABEL: test_signed_v3f64_v3i32:
180 ; CHECK-NEXT: fcvtzs w8, d0
181 ; CHECK-NEXT: fcvtzs w9, d1
182 ; CHECK-NEXT: fmov s0, w8
183 ; CHECK-NEXT: fcvtzs w8, d2
184 ; CHECK-NEXT: mov v0.s[1], w9
185 ; CHECK-NEXT: mov v0.s[2], w8
186 ; CHECK-NEXT: fcvtzs w8, d0
187 ; CHECK-NEXT: mov v0.s[3], w8
189 %x = call <3 x i32> @llvm.fptosi.sat.v3f64.v3i32(<3 x double> %f)
193 define <4 x i32> @test_signed_v4f64_v4i32(<4 x double> %f) {
194 ; CHECK-LABEL: test_signed_v4f64_v4i32:
196 ; CHECK-NEXT: mov d2, v0.d[1]
197 ; CHECK-NEXT: fcvtzs w8, d0
198 ; CHECK-NEXT: fcvtzs w9, d2
199 ; CHECK-NEXT: fmov s0, w8
200 ; CHECK-NEXT: fcvtzs w8, d1
201 ; CHECK-NEXT: mov d1, v1.d[1]
202 ; CHECK-NEXT: mov v0.s[1], w9
203 ; CHECK-NEXT: mov v0.s[2], w8
204 ; CHECK-NEXT: fcvtzs w8, d1
205 ; CHECK-NEXT: mov v0.s[3], w8
207 %x = call <4 x i32> @llvm.fptosi.sat.v4f64.v4i32(<4 x double> %f)
211 define <5 x i32> @test_signed_v5f64_v5i32(<5 x double> %f) {
212 ; CHECK-LABEL: test_signed_v5f64_v5i32:
214 ; CHECK-NEXT: fcvtzs w0, d0
215 ; CHECK-NEXT: fcvtzs w1, d1
216 ; CHECK-NEXT: fcvtzs w2, d2
217 ; CHECK-NEXT: fcvtzs w3, d3
218 ; CHECK-NEXT: fcvtzs w4, d4
220 %x = call <5 x i32> @llvm.fptosi.sat.v5f64.v5i32(<5 x double> %f)
224 define <6 x i32> @test_signed_v6f64_v6i32(<6 x double> %f) {
225 ; CHECK-LABEL: test_signed_v6f64_v6i32:
227 ; CHECK-NEXT: fcvtzs w0, d0
228 ; CHECK-NEXT: fcvtzs w1, d1
229 ; CHECK-NEXT: fcvtzs w2, d2
230 ; CHECK-NEXT: fcvtzs w3, d3
231 ; CHECK-NEXT: fcvtzs w4, d4
232 ; CHECK-NEXT: fcvtzs w5, d5
234 %x = call <6 x i32> @llvm.fptosi.sat.v6f64.v6i32(<6 x double> %f)
239 ; FP128 to signed 32-bit -- Vector size variation
242 declare <1 x i32> @llvm.fptosi.sat.v1f128.v1i32 (<1 x fp128>)
243 declare <2 x i32> @llvm.fptosi.sat.v2f128.v2i32 (<2 x fp128>)
244 declare <3 x i32> @llvm.fptosi.sat.v3f128.v3i32 (<3 x fp128>)
245 declare <4 x i32> @llvm.fptosi.sat.v4f128.v4i32 (<4 x fp128>)
247 define <1 x i32> @test_signed_v1f128_v1i32(<1 x fp128> %f) {
248 ; CHECK-LABEL: test_signed_v1f128_v1i32:
250 ; CHECK-NEXT: sub sp, sp, #32
251 ; CHECK-NEXT: stp x30, x19, [sp, #16] // 16-byte Folded Spill
252 ; CHECK-NEXT: .cfi_def_cfa_offset 32
253 ; CHECK-NEXT: .cfi_offset w19, -8
254 ; CHECK-NEXT: .cfi_offset w30, -16
255 ; CHECK-NEXT: adrp x8, .LCPI14_0
256 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
257 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI14_0]
258 ; CHECK-NEXT: bl __getf2
259 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
260 ; CHECK-NEXT: mov w19, w0
261 ; CHECK-NEXT: bl __fixtfsi
262 ; CHECK-NEXT: cmp w19, #0
263 ; CHECK-NEXT: mov w8, #-2147483648 // =0x80000000
264 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
265 ; CHECK-NEXT: csel w19, w8, w0, lt
266 ; CHECK-NEXT: adrp x8, .LCPI14_1
267 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI14_1]
268 ; CHECK-NEXT: bl __gttf2
269 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
270 ; CHECK-NEXT: mov w8, #2147483647 // =0x7fffffff
271 ; CHECK-NEXT: cmp w0, #0
272 ; CHECK-NEXT: csel w19, w8, w19, gt
273 ; CHECK-NEXT: mov v1.16b, v0.16b
274 ; CHECK-NEXT: bl __unordtf2
275 ; CHECK-NEXT: cmp w0, #0
276 ; CHECK-NEXT: csel w8, wzr, w19, ne
277 ; CHECK-NEXT: ldp x30, x19, [sp, #16] // 16-byte Folded Reload
278 ; CHECK-NEXT: fmov s0, w8
279 ; CHECK-NEXT: add sp, sp, #32
281 %x = call <1 x i32> @llvm.fptosi.sat.v1f128.v1i32(<1 x fp128> %f)
285 define <2 x i32> @test_signed_v2f128_v2i32(<2 x fp128> %f) {
286 ; CHECK-LABEL: test_signed_v2f128_v2i32:
288 ; CHECK-NEXT: sub sp, sp, #112
289 ; CHECK-NEXT: str x30, [sp, #64] // 8-byte Folded Spill
290 ; CHECK-NEXT: stp x22, x21, [sp, #80] // 16-byte Folded Spill
291 ; CHECK-NEXT: stp x20, x19, [sp, #96] // 16-byte Folded Spill
292 ; CHECK-NEXT: .cfi_def_cfa_offset 112
293 ; CHECK-NEXT: .cfi_offset w19, -8
294 ; CHECK-NEXT: .cfi_offset w20, -16
295 ; CHECK-NEXT: .cfi_offset w21, -24
296 ; CHECK-NEXT: .cfi_offset w22, -32
297 ; CHECK-NEXT: .cfi_offset w30, -48
298 ; CHECK-NEXT: mov v2.16b, v1.16b
299 ; CHECK-NEXT: stp q1, q0, [sp, #32] // 32-byte Folded Spill
300 ; CHECK-NEXT: adrp x8, .LCPI15_0
301 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI15_0]
302 ; CHECK-NEXT: mov v0.16b, v2.16b
303 ; CHECK-NEXT: str q1, [sp, #16] // 16-byte Folded Spill
304 ; CHECK-NEXT: bl __getf2
305 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
306 ; CHECK-NEXT: mov w19, w0
307 ; CHECK-NEXT: bl __fixtfsi
308 ; CHECK-NEXT: adrp x8, .LCPI15_1
309 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
310 ; CHECK-NEXT: cmp w19, #0
311 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI15_1]
312 ; CHECK-NEXT: mov w20, #-2147483648 // =0x80000000
313 ; CHECK-NEXT: csel w19, w20, w0, lt
314 ; CHECK-NEXT: str q1, [sp] // 16-byte Folded Spill
315 ; CHECK-NEXT: bl __gttf2
316 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
317 ; CHECK-NEXT: mov w21, #2147483647 // =0x7fffffff
318 ; CHECK-NEXT: cmp w0, #0
319 ; CHECK-NEXT: csel w19, w21, w19, gt
320 ; CHECK-NEXT: mov v1.16b, v0.16b
321 ; CHECK-NEXT: bl __unordtf2
322 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
323 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
324 ; CHECK-NEXT: cmp w0, #0
325 ; CHECK-NEXT: csel w22, wzr, w19, ne
326 ; CHECK-NEXT: bl __getf2
327 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
328 ; CHECK-NEXT: mov w19, w0
329 ; CHECK-NEXT: bl __fixtfsi
330 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
331 ; CHECK-NEXT: ldr q1, [sp] // 16-byte Folded Reload
332 ; CHECK-NEXT: cmp w19, #0
333 ; CHECK-NEXT: csel w19, w20, w0, lt
334 ; CHECK-NEXT: bl __gttf2
335 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
336 ; CHECK-NEXT: cmp w0, #0
337 ; CHECK-NEXT: csel w19, w21, w19, gt
338 ; CHECK-NEXT: mov v1.16b, v0.16b
339 ; CHECK-NEXT: bl __unordtf2
340 ; CHECK-NEXT: cmp w0, #0
341 ; CHECK-NEXT: ldr x30, [sp, #64] // 8-byte Folded Reload
342 ; CHECK-NEXT: csel w8, wzr, w19, ne
343 ; CHECK-NEXT: ldp x20, x19, [sp, #96] // 16-byte Folded Reload
344 ; CHECK-NEXT: fmov s0, w8
345 ; CHECK-NEXT: mov v0.s[1], w22
346 ; CHECK-NEXT: ldp x22, x21, [sp, #80] // 16-byte Folded Reload
347 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
348 ; CHECK-NEXT: add sp, sp, #112
350 %x = call <2 x i32> @llvm.fptosi.sat.v2f128.v2i32(<2 x fp128> %f)
354 define <3 x i32> @test_signed_v3f128_v3i32(<3 x fp128> %f) {
355 ; CHECK-LABEL: test_signed_v3f128_v3i32:
357 ; CHECK-NEXT: sub sp, sp, #128
358 ; CHECK-NEXT: str x30, [sp, #80] // 8-byte Folded Spill
359 ; CHECK-NEXT: stp x22, x21, [sp, #96] // 16-byte Folded Spill
360 ; CHECK-NEXT: stp x20, x19, [sp, #112] // 16-byte Folded Spill
361 ; CHECK-NEXT: .cfi_def_cfa_offset 128
362 ; CHECK-NEXT: .cfi_offset w19, -8
363 ; CHECK-NEXT: .cfi_offset w20, -16
364 ; CHECK-NEXT: .cfi_offset w21, -24
365 ; CHECK-NEXT: .cfi_offset w22, -32
366 ; CHECK-NEXT: .cfi_offset w30, -48
367 ; CHECK-NEXT: stp q0, q2, [sp, #48] // 32-byte Folded Spill
368 ; CHECK-NEXT: mov v2.16b, v1.16b
369 ; CHECK-NEXT: adrp x8, .LCPI16_0
370 ; CHECK-NEXT: str q1, [sp, #32] // 16-byte Folded Spill
371 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_0]
372 ; CHECK-NEXT: mov v0.16b, v2.16b
373 ; CHECK-NEXT: str q1, [sp, #16] // 16-byte Folded Spill
374 ; CHECK-NEXT: bl __getf2
375 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
376 ; CHECK-NEXT: mov w19, w0
377 ; CHECK-NEXT: bl __fixtfsi
378 ; CHECK-NEXT: adrp x8, .LCPI16_1
379 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
380 ; CHECK-NEXT: cmp w19, #0
381 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI16_1]
382 ; CHECK-NEXT: mov w20, #-2147483648 // =0x80000000
383 ; CHECK-NEXT: csel w19, w20, w0, lt
384 ; CHECK-NEXT: str q1, [sp] // 16-byte Folded Spill
385 ; CHECK-NEXT: bl __gttf2
386 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
387 ; CHECK-NEXT: mov w21, #2147483647 // =0x7fffffff
388 ; CHECK-NEXT: cmp w0, #0
389 ; CHECK-NEXT: csel w19, w21, w19, gt
390 ; CHECK-NEXT: mov v1.16b, v0.16b
391 ; CHECK-NEXT: bl __unordtf2
392 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
393 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
394 ; CHECK-NEXT: cmp w0, #0
395 ; CHECK-NEXT: csel w22, wzr, w19, ne
396 ; CHECK-NEXT: bl __getf2
397 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
398 ; CHECK-NEXT: mov w19, w0
399 ; CHECK-NEXT: bl __fixtfsi
400 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
401 ; CHECK-NEXT: ldr q1, [sp] // 16-byte Folded Reload
402 ; CHECK-NEXT: cmp w19, #0
403 ; CHECK-NEXT: csel w19, w20, w0, lt
404 ; CHECK-NEXT: bl __gttf2
405 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
406 ; CHECK-NEXT: cmp w0, #0
407 ; CHECK-NEXT: csel w19, w21, w19, gt
408 ; CHECK-NEXT: mov v1.16b, v0.16b
409 ; CHECK-NEXT: bl __unordtf2
410 ; CHECK-NEXT: cmp w0, #0
411 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
412 ; CHECK-NEXT: csel w8, wzr, w19, ne
413 ; CHECK-NEXT: fmov s0, w8
414 ; CHECK-NEXT: mov v0.s[1], w22
415 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
416 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
417 ; CHECK-NEXT: bl __getf2
418 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
419 ; CHECK-NEXT: mov w19, w0
420 ; CHECK-NEXT: bl __fixtfsi
421 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
422 ; CHECK-NEXT: ldr q1, [sp] // 16-byte Folded Reload
423 ; CHECK-NEXT: cmp w19, #0
424 ; CHECK-NEXT: csel w19, w20, w0, lt
425 ; CHECK-NEXT: bl __gttf2
426 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
427 ; CHECK-NEXT: cmp w0, #0
428 ; CHECK-NEXT: csel w19, w21, w19, gt
429 ; CHECK-NEXT: mov v1.16b, v0.16b
430 ; CHECK-NEXT: bl __unordtf2
431 ; CHECK-NEXT: cmp w0, #0
432 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
433 ; CHECK-NEXT: ldr x30, [sp, #80] // 8-byte Folded Reload
434 ; CHECK-NEXT: csel w8, wzr, w19, ne
435 ; CHECK-NEXT: ldp x20, x19, [sp, #112] // 16-byte Folded Reload
436 ; CHECK-NEXT: ldp x22, x21, [sp, #96] // 16-byte Folded Reload
437 ; CHECK-NEXT: mov v0.s[2], w8
438 ; CHECK-NEXT: add sp, sp, #128
440 %x = call <3 x i32> @llvm.fptosi.sat.v3f128.v3i32(<3 x fp128> %f)
444 define <4 x i32> @test_signed_v4f128_v4i32(<4 x fp128> %f) {
445 ; CHECK-LABEL: test_signed_v4f128_v4i32:
447 ; CHECK-NEXT: sub sp, sp, #144
448 ; CHECK-NEXT: str x30, [sp, #96] // 8-byte Folded Spill
449 ; CHECK-NEXT: stp x22, x21, [sp, #112] // 16-byte Folded Spill
450 ; CHECK-NEXT: stp x20, x19, [sp, #128] // 16-byte Folded Spill
451 ; CHECK-NEXT: .cfi_def_cfa_offset 144
452 ; CHECK-NEXT: .cfi_offset w19, -8
453 ; CHECK-NEXT: .cfi_offset w20, -16
454 ; CHECK-NEXT: .cfi_offset w21, -24
455 ; CHECK-NEXT: .cfi_offset w22, -32
456 ; CHECK-NEXT: .cfi_offset w30, -48
457 ; CHECK-NEXT: stp q2, q3, [sp, #64] // 32-byte Folded Spill
458 ; CHECK-NEXT: mov v2.16b, v1.16b
459 ; CHECK-NEXT: adrp x8, .LCPI17_0
460 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
461 ; CHECK-NEXT: str q1, [sp] // 16-byte Folded Spill
462 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_0]
463 ; CHECK-NEXT: mov v0.16b, v2.16b
464 ; CHECK-NEXT: str q1, [sp, #32] // 16-byte Folded Spill
465 ; CHECK-NEXT: bl __getf2
466 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
467 ; CHECK-NEXT: mov w19, w0
468 ; CHECK-NEXT: bl __fixtfsi
469 ; CHECK-NEXT: adrp x8, .LCPI17_1
470 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
471 ; CHECK-NEXT: cmp w19, #0
472 ; CHECK-NEXT: ldr q1, [x8, :lo12:.LCPI17_1]
473 ; CHECK-NEXT: mov w20, #-2147483648 // =0x80000000
474 ; CHECK-NEXT: csel w19, w20, w0, lt
475 ; CHECK-NEXT: str q1, [sp, #16] // 16-byte Folded Spill
476 ; CHECK-NEXT: bl __gttf2
477 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
478 ; CHECK-NEXT: mov w21, #2147483647 // =0x7fffffff
479 ; CHECK-NEXT: cmp w0, #0
480 ; CHECK-NEXT: csel w19, w21, w19, gt
481 ; CHECK-NEXT: mov v1.16b, v0.16b
482 ; CHECK-NEXT: bl __unordtf2
483 ; CHECK-NEXT: ldp q1, q0, [sp, #32] // 32-byte Folded Reload
484 ; CHECK-NEXT: cmp w0, #0
485 ; CHECK-NEXT: csel w22, wzr, w19, ne
486 ; CHECK-NEXT: bl __getf2
487 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
488 ; CHECK-NEXT: mov w19, w0
489 ; CHECK-NEXT: bl __fixtfsi
490 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
491 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
492 ; CHECK-NEXT: cmp w19, #0
493 ; CHECK-NEXT: csel w19, w20, w0, lt
494 ; CHECK-NEXT: bl __gttf2
495 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
496 ; CHECK-NEXT: cmp w0, #0
497 ; CHECK-NEXT: csel w19, w21, w19, gt
498 ; CHECK-NEXT: mov v1.16b, v0.16b
499 ; CHECK-NEXT: bl __unordtf2
500 ; CHECK-NEXT: cmp w0, #0
501 ; CHECK-NEXT: ldr q1, [sp, #32] // 16-byte Folded Reload
502 ; CHECK-NEXT: csel w8, wzr, w19, ne
503 ; CHECK-NEXT: fmov s0, w8
504 ; CHECK-NEXT: mov v0.s[1], w22
505 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
506 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
507 ; CHECK-NEXT: bl __getf2
508 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
509 ; CHECK-NEXT: mov w19, w0
510 ; CHECK-NEXT: bl __fixtfsi
511 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
512 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
513 ; CHECK-NEXT: cmp w19, #0
514 ; CHECK-NEXT: csel w19, w20, w0, lt
515 ; CHECK-NEXT: bl __gttf2
516 ; CHECK-NEXT: ldr q0, [sp, #64] // 16-byte Folded Reload
517 ; CHECK-NEXT: cmp w0, #0
518 ; CHECK-NEXT: csel w19, w21, w19, gt
519 ; CHECK-NEXT: mov v1.16b, v0.16b
520 ; CHECK-NEXT: bl __unordtf2
521 ; CHECK-NEXT: ldp q1, q0, [sp, #32] // 32-byte Folded Reload
522 ; CHECK-NEXT: cmp w0, #0
523 ; CHECK-NEXT: csel w8, wzr, w19, ne
524 ; CHECK-NEXT: mov v0.s[2], w8
525 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
526 ; CHECK-NEXT: ldr q0, [sp, #80] // 16-byte Folded Reload
527 ; CHECK-NEXT: bl __getf2
528 ; CHECK-NEXT: ldr q0, [sp, #80] // 16-byte Folded Reload
529 ; CHECK-NEXT: mov w19, w0
530 ; CHECK-NEXT: bl __fixtfsi
531 ; CHECK-NEXT: ldr q0, [sp, #80] // 16-byte Folded Reload
532 ; CHECK-NEXT: ldr q1, [sp, #16] // 16-byte Folded Reload
533 ; CHECK-NEXT: cmp w19, #0
534 ; CHECK-NEXT: csel w19, w20, w0, lt
535 ; CHECK-NEXT: bl __gttf2
536 ; CHECK-NEXT: ldr q0, [sp, #80] // 16-byte Folded Reload
537 ; CHECK-NEXT: cmp w0, #0
538 ; CHECK-NEXT: csel w19, w21, w19, gt
539 ; CHECK-NEXT: mov v1.16b, v0.16b
540 ; CHECK-NEXT: bl __unordtf2
541 ; CHECK-NEXT: cmp w0, #0
542 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
543 ; CHECK-NEXT: ldr x30, [sp, #96] // 8-byte Folded Reload
544 ; CHECK-NEXT: csel w8, wzr, w19, ne
545 ; CHECK-NEXT: ldp x20, x19, [sp, #128] // 16-byte Folded Reload
546 ; CHECK-NEXT: ldp x22, x21, [sp, #112] // 16-byte Folded Reload
547 ; CHECK-NEXT: mov v0.s[3], w8
548 ; CHECK-NEXT: add sp, sp, #144
550 %x = call <4 x i32> @llvm.fptosi.sat.v4f128.v4i32(<4 x fp128> %f)
555 ; FP16 to signed 32-bit -- Vector size variation
558 declare <1 x i32> @llvm.fptosi.sat.v1f16.v1i32 (<1 x half>)
559 declare <2 x i32> @llvm.fptosi.sat.v2f16.v2i32 (<2 x half>)
560 declare <3 x i32> @llvm.fptosi.sat.v3f16.v3i32 (<3 x half>)
561 declare <4 x i32> @llvm.fptosi.sat.v4f16.v4i32 (<4 x half>)
562 declare <5 x i32> @llvm.fptosi.sat.v5f16.v5i32 (<5 x half>)
563 declare <6 x i32> @llvm.fptosi.sat.v6f16.v6i32 (<6 x half>)
564 declare <7 x i32> @llvm.fptosi.sat.v7f16.v7i32 (<7 x half>)
565 declare <8 x i32> @llvm.fptosi.sat.v8f16.v8i32 (<8 x half>)
567 define <1 x i32> @test_signed_v1f16_v1i32(<1 x half> %f) {
568 ; CHECK-CVT-LABEL: test_signed_v1f16_v1i32:
569 ; CHECK-CVT: // %bb.0:
570 ; CHECK-CVT-NEXT: fcvt s0, h0
571 ; CHECK-CVT-NEXT: fcvtzs w8, s0
572 ; CHECK-CVT-NEXT: fmov s0, w8
573 ; CHECK-CVT-NEXT: ret
575 ; CHECK-FP16-LABEL: test_signed_v1f16_v1i32:
576 ; CHECK-FP16: // %bb.0:
577 ; CHECK-FP16-NEXT: fcvtzs w8, h0
578 ; CHECK-FP16-NEXT: fmov s0, w8
579 ; CHECK-FP16-NEXT: ret
580 %x = call <1 x i32> @llvm.fptosi.sat.v1f16.v1i32(<1 x half> %f)
584 define <2 x i32> @test_signed_v2f16_v2i32(<2 x half> %f) {
585 ; CHECK-LABEL: test_signed_v2f16_v2i32:
587 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
588 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
589 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
591 %x = call <2 x i32> @llvm.fptosi.sat.v2f16.v2i32(<2 x half> %f)
595 define <3 x i32> @test_signed_v3f16_v3i32(<3 x half> %f) {
596 ; CHECK-LABEL: test_signed_v3f16_v3i32:
598 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
599 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
601 %x = call <3 x i32> @llvm.fptosi.sat.v3f16.v3i32(<3 x half> %f)
605 define <4 x i32> @test_signed_v4f16_v4i32(<4 x half> %f) {
606 ; CHECK-LABEL: test_signed_v4f16_v4i32:
608 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
609 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
611 %x = call <4 x i32> @llvm.fptosi.sat.v4f16.v4i32(<4 x half> %f)
615 define <5 x i32> @test_signed_v5f16_v5i32(<5 x half> %f) {
616 ; CHECK-LABEL: test_signed_v5f16_v5i32:
618 ; CHECK-NEXT: fcvtl v1.4s, v0.4h
619 ; CHECK-NEXT: fcvtl2 v0.4s, v0.8h
620 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
621 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
622 ; CHECK-NEXT: mov w1, v1.s[1]
623 ; CHECK-NEXT: mov w2, v1.s[2]
624 ; CHECK-NEXT: mov w3, v1.s[3]
625 ; CHECK-NEXT: fmov w0, s1
626 ; CHECK-NEXT: fmov w4, s0
628 %x = call <5 x i32> @llvm.fptosi.sat.v5f16.v5i32(<5 x half> %f)
632 define <6 x i32> @test_signed_v6f16_v6i32(<6 x half> %f) {
633 ; CHECK-LABEL: test_signed_v6f16_v6i32:
635 ; CHECK-NEXT: fcvtl v1.4s, v0.4h
636 ; CHECK-NEXT: fcvtl2 v0.4s, v0.8h
637 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
638 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
639 ; CHECK-NEXT: mov w1, v1.s[1]
640 ; CHECK-NEXT: mov w2, v1.s[2]
641 ; CHECK-NEXT: mov w5, v0.s[1]
642 ; CHECK-NEXT: mov w3, v1.s[3]
643 ; CHECK-NEXT: fmov w4, s0
644 ; CHECK-NEXT: fmov w0, s1
646 %x = call <6 x i32> @llvm.fptosi.sat.v6f16.v6i32(<6 x half> %f)
650 define <7 x i32> @test_signed_v7f16_v7i32(<7 x half> %f) {
651 ; CHECK-LABEL: test_signed_v7f16_v7i32:
653 ; CHECK-NEXT: fcvtl v1.4s, v0.4h
654 ; CHECK-NEXT: fcvtl2 v0.4s, v0.8h
655 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
656 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
657 ; CHECK-NEXT: mov w1, v1.s[1]
658 ; CHECK-NEXT: mov w2, v1.s[2]
659 ; CHECK-NEXT: mov w3, v1.s[3]
660 ; CHECK-NEXT: mov w5, v0.s[1]
661 ; CHECK-NEXT: mov w6, v0.s[2]
662 ; CHECK-NEXT: fmov w0, s1
663 ; CHECK-NEXT: fmov w4, s0
665 %x = call <7 x i32> @llvm.fptosi.sat.v7f16.v7i32(<7 x half> %f)
669 define <8 x i32> @test_signed_v8f16_v8i32(<8 x half> %f) {
670 ; CHECK-LABEL: test_signed_v8f16_v8i32:
672 ; CHECK-NEXT: fcvtl2 v1.4s, v0.8h
673 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
674 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
675 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
677 %x = call <8 x i32> @llvm.fptosi.sat.v8f16.v8i32(<8 x half> %f)
682 ; 2-Vector float to signed integer -- result size variation
685 declare <2 x i1> @llvm.fptosi.sat.v2f32.v2i1 (<2 x float>)
686 declare <2 x i8> @llvm.fptosi.sat.v2f32.v2i8 (<2 x float>)
687 declare <2 x i13> @llvm.fptosi.sat.v2f32.v2i13 (<2 x float>)
688 declare <2 x i16> @llvm.fptosi.sat.v2f32.v2i16 (<2 x float>)
689 declare <2 x i19> @llvm.fptosi.sat.v2f32.v2i19 (<2 x float>)
690 declare <2 x i50> @llvm.fptosi.sat.v2f32.v2i50 (<2 x float>)
691 declare <2 x i64> @llvm.fptosi.sat.v2f32.v2i64 (<2 x float>)
692 declare <2 x i100> @llvm.fptosi.sat.v2f32.v2i100(<2 x float>)
693 declare <2 x i128> @llvm.fptosi.sat.v2f32.v2i128(<2 x float>)
695 define <2 x i1> @test_signed_v2f32_v2i1(<2 x float> %f) {
696 ; CHECK-LABEL: test_signed_v2f32_v2i1:
698 ; CHECK-NEXT: movi v1.2d, #0000000000000000
699 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
700 ; CHECK-NEXT: movi v2.2d, #0xffffffffffffffff
701 ; CHECK-NEXT: smin v0.2s, v0.2s, v1.2s
702 ; CHECK-NEXT: smax v0.2s, v0.2s, v2.2s
704 %x = call <2 x i1> @llvm.fptosi.sat.v2f32.v2i1(<2 x float> %f)
708 define <2 x i8> @test_signed_v2f32_v2i8(<2 x float> %f) {
709 ; CHECK-LABEL: test_signed_v2f32_v2i8:
711 ; CHECK-NEXT: movi v1.2s, #127
712 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
713 ; CHECK-NEXT: smin v0.2s, v0.2s, v1.2s
714 ; CHECK-NEXT: mvni v1.2s, #127
715 ; CHECK-NEXT: smax v0.2s, v0.2s, v1.2s
717 %x = call <2 x i8> @llvm.fptosi.sat.v2f32.v2i8(<2 x float> %f)
721 define <2 x i13> @test_signed_v2f32_v2i13(<2 x float> %f) {
722 ; CHECK-LABEL: test_signed_v2f32_v2i13:
724 ; CHECK-NEXT: movi v1.2s, #15, msl #8
725 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
726 ; CHECK-NEXT: smin v0.2s, v0.2s, v1.2s
727 ; CHECK-NEXT: mvni v1.2s, #15, msl #8
728 ; CHECK-NEXT: smax v0.2s, v0.2s, v1.2s
730 %x = call <2 x i13> @llvm.fptosi.sat.v2f32.v2i13(<2 x float> %f)
734 define <2 x i16> @test_signed_v2f32_v2i16(<2 x float> %f) {
735 ; CHECK-LABEL: test_signed_v2f32_v2i16:
737 ; CHECK-NEXT: movi v1.2s, #127, msl #8
738 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
739 ; CHECK-NEXT: smin v0.2s, v0.2s, v1.2s
740 ; CHECK-NEXT: mvni v1.2s, #127, msl #8
741 ; CHECK-NEXT: smax v0.2s, v0.2s, v1.2s
743 %x = call <2 x i16> @llvm.fptosi.sat.v2f32.v2i16(<2 x float> %f)
747 define <2 x i19> @test_signed_v2f32_v2i19(<2 x float> %f) {
748 ; CHECK-LABEL: test_signed_v2f32_v2i19:
750 ; CHECK-NEXT: movi v1.2s, #3, msl #16
751 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
752 ; CHECK-NEXT: smin v0.2s, v0.2s, v1.2s
753 ; CHECK-NEXT: mvni v1.2s, #3, msl #16
754 ; CHECK-NEXT: smax v0.2s, v0.2s, v1.2s
756 %x = call <2 x i19> @llvm.fptosi.sat.v2f32.v2i19(<2 x float> %f)
760 define <2 x i32> @test_signed_v2f32_v2i32_duplicate(<2 x float> %f) {
761 ; CHECK-LABEL: test_signed_v2f32_v2i32_duplicate:
763 ; CHECK-NEXT: fcvtzs v0.2s, v0.2s
765 %x = call <2 x i32> @llvm.fptosi.sat.v2f32.v2i32(<2 x float> %f)
769 define <2 x i50> @test_signed_v2f32_v2i50(<2 x float> %f) {
770 ; CHECK-LABEL: test_signed_v2f32_v2i50:
772 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
773 ; CHECK-NEXT: mov s1, v0.s[1]
774 ; CHECK-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
775 ; CHECK-NEXT: fcvtzs x10, s0
776 ; CHECK-NEXT: mov x11, #-562949953421312 // =0xfffe000000000000
777 ; CHECK-NEXT: fcvtzs x9, s1
778 ; CHECK-NEXT: cmp x9, x8
779 ; CHECK-NEXT: csel x9, x9, x8, lt
780 ; CHECK-NEXT: cmp x9, x11
781 ; CHECK-NEXT: csel x9, x9, x11, gt
782 ; CHECK-NEXT: cmp x10, x8
783 ; CHECK-NEXT: csel x8, x10, x8, lt
784 ; CHECK-NEXT: cmp x8, x11
785 ; CHECK-NEXT: csel x8, x8, x11, gt
786 ; CHECK-NEXT: fmov d0, x8
787 ; CHECK-NEXT: mov v0.d[1], x9
789 %x = call <2 x i50> @llvm.fptosi.sat.v2f32.v2i50(<2 x float> %f)
793 define <2 x i64> @test_signed_v2f32_v2i64(<2 x float> %f) {
794 ; CHECK-LABEL: test_signed_v2f32_v2i64:
796 ; CHECK-NEXT: fcvtl v0.2d, v0.2s
797 ; CHECK-NEXT: fcvtzs v0.2d, v0.2d
799 %x = call <2 x i64> @llvm.fptosi.sat.v2f32.v2i64(<2 x float> %f)
803 define <2 x i100> @test_signed_v2f32_v2i100(<2 x float> %f) {
804 ; CHECK-LABEL: test_signed_v2f32_v2i100:
806 ; CHECK-NEXT: sub sp, sp, #80
807 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
808 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
809 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
810 ; CHECK-NEXT: stp x22, x21, [sp, #48] // 16-byte Folded Spill
811 ; CHECK-NEXT: stp x20, x19, [sp, #64] // 16-byte Folded Spill
812 ; CHECK-NEXT: .cfi_def_cfa_offset 80
813 ; CHECK-NEXT: .cfi_offset w19, -8
814 ; CHECK-NEXT: .cfi_offset w20, -16
815 ; CHECK-NEXT: .cfi_offset w21, -24
816 ; CHECK-NEXT: .cfi_offset w22, -32
817 ; CHECK-NEXT: .cfi_offset w30, -40
818 ; CHECK-NEXT: .cfi_offset b8, -48
819 ; CHECK-NEXT: .cfi_offset b9, -56
820 ; CHECK-NEXT: .cfi_offset b10, -64
821 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
822 ; CHECK-NEXT: mov s8, v0.s[1]
823 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
824 ; CHECK-NEXT: fmov s0, s8
825 ; CHECK-NEXT: bl __fixsfti
826 ; CHECK-NEXT: movi v9.2s, #241, lsl #24
827 ; CHECK-NEXT: mov w8, #1895825407 // =0x70ffffff
828 ; CHECK-NEXT: mov x21, #-34359738368 // =0xfffffff800000000
829 ; CHECK-NEXT: fmov s10, w8
830 ; CHECK-NEXT: mov x22, #34359738367 // =0x7ffffffff
831 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
832 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
833 ; CHECK-NEXT: fcmp s8, s9
834 ; CHECK-NEXT: csel x8, xzr, x0, lt
835 ; CHECK-NEXT: csel x9, x21, x1, lt
836 ; CHECK-NEXT: fcmp s8, s10
837 ; CHECK-NEXT: csel x9, x22, x9, gt
838 ; CHECK-NEXT: csinv x8, x8, xzr, le
839 ; CHECK-NEXT: fcmp s8, s8
840 ; CHECK-NEXT: csel x19, xzr, x8, vs
841 ; CHECK-NEXT: csel x20, xzr, x9, vs
842 ; CHECK-NEXT: bl __fixsfti
843 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
844 ; CHECK-NEXT: mov x2, x19
845 ; CHECK-NEXT: mov x3, x20
846 ; CHECK-NEXT: ldp x20, x19, [sp, #64] // 16-byte Folded Reload
847 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
848 ; CHECK-NEXT: fcmp s0, s9
849 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
850 ; CHECK-NEXT: csel x8, x21, x1, lt
851 ; CHECK-NEXT: csel x9, xzr, x0, lt
852 ; CHECK-NEXT: fcmp s0, s10
853 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
854 ; CHECK-NEXT: csinv x9, x9, xzr, le
855 ; CHECK-NEXT: csel x8, x22, x8, gt
856 ; CHECK-NEXT: fcmp s0, s0
857 ; CHECK-NEXT: ldp x22, x21, [sp, #48] // 16-byte Folded Reload
858 ; CHECK-NEXT: csel x9, xzr, x9, vs
859 ; CHECK-NEXT: csel x1, xzr, x8, vs
860 ; CHECK-NEXT: fmov d0, x9
861 ; CHECK-NEXT: mov v0.d[1], x1
862 ; CHECK-NEXT: fmov x0, d0
863 ; CHECK-NEXT: add sp, sp, #80
865 %x = call <2 x i100> @llvm.fptosi.sat.v2f32.v2i100(<2 x float> %f)
869 define <2 x i128> @test_signed_v2f32_v2i128(<2 x float> %f) {
870 ; CHECK-LABEL: test_signed_v2f32_v2i128:
872 ; CHECK-NEXT: sub sp, sp, #80
873 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
874 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
875 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
876 ; CHECK-NEXT: stp x22, x21, [sp, #48] // 16-byte Folded Spill
877 ; CHECK-NEXT: stp x20, x19, [sp, #64] // 16-byte Folded Spill
878 ; CHECK-NEXT: .cfi_def_cfa_offset 80
879 ; CHECK-NEXT: .cfi_offset w19, -8
880 ; CHECK-NEXT: .cfi_offset w20, -16
881 ; CHECK-NEXT: .cfi_offset w21, -24
882 ; CHECK-NEXT: .cfi_offset w22, -32
883 ; CHECK-NEXT: .cfi_offset w30, -40
884 ; CHECK-NEXT: .cfi_offset b8, -48
885 ; CHECK-NEXT: .cfi_offset b9, -56
886 ; CHECK-NEXT: .cfi_offset b10, -64
887 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
888 ; CHECK-NEXT: mov s8, v0.s[1]
889 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
890 ; CHECK-NEXT: fmov s0, s8
891 ; CHECK-NEXT: bl __fixsfti
892 ; CHECK-NEXT: movi v9.2s, #255, lsl #24
893 ; CHECK-NEXT: mov w8, #2130706431 // =0x7effffff
894 ; CHECK-NEXT: mov x21, #-9223372036854775808 // =0x8000000000000000
895 ; CHECK-NEXT: fmov s10, w8
896 ; CHECK-NEXT: mov x22, #9223372036854775807 // =0x7fffffffffffffff
897 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
898 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
899 ; CHECK-NEXT: fcmp s8, s9
900 ; CHECK-NEXT: csel x8, xzr, x0, lt
901 ; CHECK-NEXT: csel x9, x21, x1, lt
902 ; CHECK-NEXT: fcmp s8, s10
903 ; CHECK-NEXT: csel x9, x22, x9, gt
904 ; CHECK-NEXT: csinv x8, x8, xzr, le
905 ; CHECK-NEXT: fcmp s8, s8
906 ; CHECK-NEXT: csel x19, xzr, x8, vs
907 ; CHECK-NEXT: csel x20, xzr, x9, vs
908 ; CHECK-NEXT: bl __fixsfti
909 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
910 ; CHECK-NEXT: mov x2, x19
911 ; CHECK-NEXT: mov x3, x20
912 ; CHECK-NEXT: ldp x20, x19, [sp, #64] // 16-byte Folded Reload
913 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
914 ; CHECK-NEXT: fcmp s0, s9
915 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
916 ; CHECK-NEXT: csel x8, x21, x1, lt
917 ; CHECK-NEXT: csel x9, xzr, x0, lt
918 ; CHECK-NEXT: fcmp s0, s10
919 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
920 ; CHECK-NEXT: csinv x9, x9, xzr, le
921 ; CHECK-NEXT: csel x8, x22, x8, gt
922 ; CHECK-NEXT: fcmp s0, s0
923 ; CHECK-NEXT: ldp x22, x21, [sp, #48] // 16-byte Folded Reload
924 ; CHECK-NEXT: csel x9, xzr, x9, vs
925 ; CHECK-NEXT: csel x1, xzr, x8, vs
926 ; CHECK-NEXT: fmov d0, x9
927 ; CHECK-NEXT: mov v0.d[1], x1
928 ; CHECK-NEXT: fmov x0, d0
929 ; CHECK-NEXT: add sp, sp, #80
931 %x = call <2 x i128> @llvm.fptosi.sat.v2f32.v2i128(<2 x float> %f)
936 ; 4-Vector float to signed integer -- result size variation
939 declare <4 x i1> @llvm.fptosi.sat.v4f32.v4i1 (<4 x float>)
940 declare <4 x i8> @llvm.fptosi.sat.v4f32.v4i8 (<4 x float>)
941 declare <4 x i13> @llvm.fptosi.sat.v4f32.v4i13 (<4 x float>)
942 declare <4 x i16> @llvm.fptosi.sat.v4f32.v4i16 (<4 x float>)
943 declare <4 x i19> @llvm.fptosi.sat.v4f32.v4i19 (<4 x float>)
944 declare <4 x i50> @llvm.fptosi.sat.v4f32.v4i50 (<4 x float>)
945 declare <4 x i64> @llvm.fptosi.sat.v4f32.v4i64 (<4 x float>)
946 declare <4 x i100> @llvm.fptosi.sat.v4f32.v4i100(<4 x float>)
947 declare <4 x i128> @llvm.fptosi.sat.v4f32.v4i128(<4 x float>)
949 define <4 x i1> @test_signed_v4f32_v4i1(<4 x float> %f) {
950 ; CHECK-LABEL: test_signed_v4f32_v4i1:
952 ; CHECK-NEXT: movi v1.2d, #0000000000000000
953 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
954 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
955 ; CHECK-NEXT: movi v1.2d, #0xffffffffffffffff
956 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
957 ; CHECK-NEXT: xtn v0.4h, v0.4s
959 %x = call <4 x i1> @llvm.fptosi.sat.v4f32.v4i1(<4 x float> %f)
963 define <4 x i8> @test_signed_v4f32_v4i8(<4 x float> %f) {
964 ; CHECK-LABEL: test_signed_v4f32_v4i8:
966 ; CHECK-NEXT: movi v1.4s, #127
967 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
968 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
969 ; CHECK-NEXT: mvni v1.4s, #127
970 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
971 ; CHECK-NEXT: xtn v0.4h, v0.4s
973 %x = call <4 x i8> @llvm.fptosi.sat.v4f32.v4i8(<4 x float> %f)
977 define <4 x i13> @test_signed_v4f32_v4i13(<4 x float> %f) {
978 ; CHECK-LABEL: test_signed_v4f32_v4i13:
980 ; CHECK-NEXT: movi v1.4s, #15, msl #8
981 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
982 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
983 ; CHECK-NEXT: mvni v1.4s, #15, msl #8
984 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
985 ; CHECK-NEXT: xtn v0.4h, v0.4s
987 %x = call <4 x i13> @llvm.fptosi.sat.v4f32.v4i13(<4 x float> %f)
991 define <4 x i16> @test_signed_v4f32_v4i16(<4 x float> %f) {
992 ; CHECK-LABEL: test_signed_v4f32_v4i16:
994 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
995 ; CHECK-NEXT: sqxtn v0.4h, v0.4s
997 %x = call <4 x i16> @llvm.fptosi.sat.v4f32.v4i16(<4 x float> %f)
1001 define <4 x i19> @test_signed_v4f32_v4i19(<4 x float> %f) {
1002 ; CHECK-LABEL: test_signed_v4f32_v4i19:
1004 ; CHECK-NEXT: movi v1.4s, #3, msl #16
1005 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
1006 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
1007 ; CHECK-NEXT: mvni v1.4s, #3, msl #16
1008 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
1010 %x = call <4 x i19> @llvm.fptosi.sat.v4f32.v4i19(<4 x float> %f)
1014 define <4 x i32> @test_signed_v4f32_v4i32_duplicate(<4 x float> %f) {
1015 ; CHECK-LABEL: test_signed_v4f32_v4i32_duplicate:
1017 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
1019 %x = call <4 x i32> @llvm.fptosi.sat.v4f32.v4i32(<4 x float> %f)
1023 define <4 x i50> @test_signed_v4f32_v4i50(<4 x float> %f) {
1024 ; CHECK-LABEL: test_signed_v4f32_v4i50:
1026 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
1027 ; CHECK-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
1028 ; CHECK-NEXT: mov x11, #-562949953421312 // =0xfffe000000000000
1029 ; CHECK-NEXT: fcvtzs x12, s0
1030 ; CHECK-NEXT: mov s2, v1.s[1]
1031 ; CHECK-NEXT: fcvtzs x9, s1
1032 ; CHECK-NEXT: mov s1, v0.s[1]
1033 ; CHECK-NEXT: fcvtzs x10, s2
1034 ; CHECK-NEXT: cmp x9, x8
1035 ; CHECK-NEXT: csel x9, x9, x8, lt
1036 ; CHECK-NEXT: cmp x9, x11
1037 ; CHECK-NEXT: csel x2, x9, x11, gt
1038 ; CHECK-NEXT: cmp x10, x8
1039 ; CHECK-NEXT: csel x9, x10, x8, lt
1040 ; CHECK-NEXT: fcvtzs x10, s1
1041 ; CHECK-NEXT: cmp x9, x11
1042 ; CHECK-NEXT: csel x3, x9, x11, gt
1043 ; CHECK-NEXT: cmp x12, x8
1044 ; CHECK-NEXT: csel x9, x12, x8, lt
1045 ; CHECK-NEXT: cmp x9, x11
1046 ; CHECK-NEXT: csel x0, x9, x11, gt
1047 ; CHECK-NEXT: cmp x10, x8
1048 ; CHECK-NEXT: csel x8, x10, x8, lt
1049 ; CHECK-NEXT: cmp x8, x11
1050 ; CHECK-NEXT: csel x1, x8, x11, gt
1052 %x = call <4 x i50> @llvm.fptosi.sat.v4f32.v4i50(<4 x float> %f)
1056 define <4 x i64> @test_signed_v4f32_v4i64(<4 x float> %f) {
1057 ; CHECK-LABEL: test_signed_v4f32_v4i64:
1059 ; CHECK-NEXT: fcvtl2 v1.2d, v0.4s
1060 ; CHECK-NEXT: fcvtl v0.2d, v0.2s
1061 ; CHECK-NEXT: fcvtzs v1.2d, v1.2d
1062 ; CHECK-NEXT: fcvtzs v0.2d, v0.2d
1064 %x = call <4 x i64> @llvm.fptosi.sat.v4f32.v4i64(<4 x float> %f)
1068 define <4 x i100> @test_signed_v4f32_v4i100(<4 x float> %f) {
1069 ; CHECK-LABEL: test_signed_v4f32_v4i100:
1071 ; CHECK-NEXT: sub sp, sp, #128
1072 ; CHECK-NEXT: str d10, [sp, #32] // 8-byte Folded Spill
1073 ; CHECK-NEXT: stp d9, d8, [sp, #40] // 16-byte Folded Spill
1074 ; CHECK-NEXT: str x30, [sp, #56] // 8-byte Folded Spill
1075 ; CHECK-NEXT: stp x26, x25, [sp, #64] // 16-byte Folded Spill
1076 ; CHECK-NEXT: stp x24, x23, [sp, #80] // 16-byte Folded Spill
1077 ; CHECK-NEXT: stp x22, x21, [sp, #96] // 16-byte Folded Spill
1078 ; CHECK-NEXT: stp x20, x19, [sp, #112] // 16-byte Folded Spill
1079 ; CHECK-NEXT: .cfi_def_cfa_offset 128
1080 ; CHECK-NEXT: .cfi_offset w19, -8
1081 ; CHECK-NEXT: .cfi_offset w20, -16
1082 ; CHECK-NEXT: .cfi_offset w21, -24
1083 ; CHECK-NEXT: .cfi_offset w22, -32
1084 ; CHECK-NEXT: .cfi_offset w23, -40
1085 ; CHECK-NEXT: .cfi_offset w24, -48
1086 ; CHECK-NEXT: .cfi_offset w25, -56
1087 ; CHECK-NEXT: .cfi_offset w26, -64
1088 ; CHECK-NEXT: .cfi_offset w30, -72
1089 ; CHECK-NEXT: .cfi_offset b8, -80
1090 ; CHECK-NEXT: .cfi_offset b9, -88
1091 ; CHECK-NEXT: .cfi_offset b10, -96
1092 ; CHECK-NEXT: mov s8, v0.s[1]
1093 ; CHECK-NEXT: str q0, [sp, #16] // 16-byte Folded Spill
1094 ; CHECK-NEXT: fmov s0, s8
1095 ; CHECK-NEXT: bl __fixsfti
1096 ; CHECK-NEXT: movi v9.2s, #241, lsl #24
1097 ; CHECK-NEXT: mov w8, #1895825407 // =0x70ffffff
1098 ; CHECK-NEXT: mov x25, #-34359738368 // =0xfffffff800000000
1099 ; CHECK-NEXT: fmov s10, w8
1100 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1101 ; CHECK-NEXT: mov x26, #34359738367 // =0x7ffffffff
1102 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
1103 ; CHECK-NEXT: fcmp s8, s9
1104 ; CHECK-NEXT: csel x8, xzr, x0, lt
1105 ; CHECK-NEXT: csel x9, x25, x1, lt
1106 ; CHECK-NEXT: fcmp s8, s10
1107 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1108 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
1109 ; CHECK-NEXT: csel x9, x26, x9, gt
1110 ; CHECK-NEXT: csinv x8, x8, xzr, le
1111 ; CHECK-NEXT: fcmp s8, s8
1112 ; CHECK-NEXT: csel x19, xzr, x8, vs
1113 ; CHECK-NEXT: csel x20, xzr, x9, vs
1114 ; CHECK-NEXT: bl __fixsfti
1115 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1116 ; CHECK-NEXT: fcmp s0, s9
1117 ; CHECK-NEXT: mov s8, v0.s[1]
1118 ; CHECK-NEXT: csel x8, xzr, x0, lt
1119 ; CHECK-NEXT: csel x9, x25, x1, lt
1120 ; CHECK-NEXT: fcmp s0, s10
1121 ; CHECK-NEXT: csel x9, x26, x9, gt
1122 ; CHECK-NEXT: csinv x8, x8, xzr, le
1123 ; CHECK-NEXT: fcmp s0, s0
1124 ; CHECK-NEXT: fmov s0, s8
1125 ; CHECK-NEXT: csel x21, xzr, x8, vs
1126 ; CHECK-NEXT: csel x22, xzr, x9, vs
1127 ; CHECK-NEXT: bl __fixsfti
1128 ; CHECK-NEXT: fcmp s8, s9
1129 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1130 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
1131 ; CHECK-NEXT: csel x8, xzr, x0, lt
1132 ; CHECK-NEXT: csel x9, x25, x1, lt
1133 ; CHECK-NEXT: fcmp s8, s10
1134 ; CHECK-NEXT: csel x9, x26, x9, gt
1135 ; CHECK-NEXT: csinv x8, x8, xzr, le
1136 ; CHECK-NEXT: fcmp s8, s8
1137 ; CHECK-NEXT: csel x23, xzr, x8, vs
1138 ; CHECK-NEXT: csel x24, xzr, x9, vs
1139 ; CHECK-NEXT: bl __fixsfti
1140 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1141 ; CHECK-NEXT: mov x2, x19
1142 ; CHECK-NEXT: mov x3, x20
1143 ; CHECK-NEXT: mov x4, x21
1144 ; CHECK-NEXT: mov x5, x22
1145 ; CHECK-NEXT: mov x6, x23
1146 ; CHECK-NEXT: fcmp s0, s9
1147 ; CHECK-NEXT: mov x7, x24
1148 ; CHECK-NEXT: ldr x30, [sp, #56] // 8-byte Folded Reload
1149 ; CHECK-NEXT: ldp x20, x19, [sp, #112] // 16-byte Folded Reload
1150 ; CHECK-NEXT: ldp x22, x21, [sp, #96] // 16-byte Folded Reload
1151 ; CHECK-NEXT: csel x8, x25, x1, lt
1152 ; CHECK-NEXT: csel x9, xzr, x0, lt
1153 ; CHECK-NEXT: fcmp s0, s10
1154 ; CHECK-NEXT: ldp x24, x23, [sp, #80] // 16-byte Folded Reload
1155 ; CHECK-NEXT: ldr d10, [sp, #32] // 8-byte Folded Reload
1156 ; CHECK-NEXT: ldp d9, d8, [sp, #40] // 16-byte Folded Reload
1157 ; CHECK-NEXT: csinv x9, x9, xzr, le
1158 ; CHECK-NEXT: csel x8, x26, x8, gt
1159 ; CHECK-NEXT: fcmp s0, s0
1160 ; CHECK-NEXT: ldp x26, x25, [sp, #64] // 16-byte Folded Reload
1161 ; CHECK-NEXT: csel x9, xzr, x9, vs
1162 ; CHECK-NEXT: csel x1, xzr, x8, vs
1163 ; CHECK-NEXT: fmov d0, x9
1164 ; CHECK-NEXT: mov v0.d[1], x1
1165 ; CHECK-NEXT: fmov x0, d0
1166 ; CHECK-NEXT: add sp, sp, #128
1168 %x = call <4 x i100> @llvm.fptosi.sat.v4f32.v4i100(<4 x float> %f)
1172 define <4 x i128> @test_signed_v4f32_v4i128(<4 x float> %f) {
1173 ; CHECK-LABEL: test_signed_v4f32_v4i128:
1175 ; CHECK-NEXT: sub sp, sp, #128
1176 ; CHECK-NEXT: str d10, [sp, #32] // 8-byte Folded Spill
1177 ; CHECK-NEXT: stp d9, d8, [sp, #40] // 16-byte Folded Spill
1178 ; CHECK-NEXT: str x30, [sp, #56] // 8-byte Folded Spill
1179 ; CHECK-NEXT: stp x26, x25, [sp, #64] // 16-byte Folded Spill
1180 ; CHECK-NEXT: stp x24, x23, [sp, #80] // 16-byte Folded Spill
1181 ; CHECK-NEXT: stp x22, x21, [sp, #96] // 16-byte Folded Spill
1182 ; CHECK-NEXT: stp x20, x19, [sp, #112] // 16-byte Folded Spill
1183 ; CHECK-NEXT: .cfi_def_cfa_offset 128
1184 ; CHECK-NEXT: .cfi_offset w19, -8
1185 ; CHECK-NEXT: .cfi_offset w20, -16
1186 ; CHECK-NEXT: .cfi_offset w21, -24
1187 ; CHECK-NEXT: .cfi_offset w22, -32
1188 ; CHECK-NEXT: .cfi_offset w23, -40
1189 ; CHECK-NEXT: .cfi_offset w24, -48
1190 ; CHECK-NEXT: .cfi_offset w25, -56
1191 ; CHECK-NEXT: .cfi_offset w26, -64
1192 ; CHECK-NEXT: .cfi_offset w30, -72
1193 ; CHECK-NEXT: .cfi_offset b8, -80
1194 ; CHECK-NEXT: .cfi_offset b9, -88
1195 ; CHECK-NEXT: .cfi_offset b10, -96
1196 ; CHECK-NEXT: mov s8, v0.s[1]
1197 ; CHECK-NEXT: str q0, [sp, #16] // 16-byte Folded Spill
1198 ; CHECK-NEXT: fmov s0, s8
1199 ; CHECK-NEXT: bl __fixsfti
1200 ; CHECK-NEXT: movi v9.2s, #255, lsl #24
1201 ; CHECK-NEXT: mov w8, #2130706431 // =0x7effffff
1202 ; CHECK-NEXT: mov x25, #-9223372036854775808 // =0x8000000000000000
1203 ; CHECK-NEXT: fmov s10, w8
1204 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1205 ; CHECK-NEXT: mov x26, #9223372036854775807 // =0x7fffffffffffffff
1206 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
1207 ; CHECK-NEXT: fcmp s8, s9
1208 ; CHECK-NEXT: csel x8, xzr, x0, lt
1209 ; CHECK-NEXT: csel x9, x25, x1, lt
1210 ; CHECK-NEXT: fcmp s8, s10
1211 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1212 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
1213 ; CHECK-NEXT: csel x9, x26, x9, gt
1214 ; CHECK-NEXT: csinv x8, x8, xzr, le
1215 ; CHECK-NEXT: fcmp s8, s8
1216 ; CHECK-NEXT: csel x19, xzr, x8, vs
1217 ; CHECK-NEXT: csel x20, xzr, x9, vs
1218 ; CHECK-NEXT: bl __fixsfti
1219 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1220 ; CHECK-NEXT: fcmp s0, s9
1221 ; CHECK-NEXT: mov s8, v0.s[1]
1222 ; CHECK-NEXT: csel x8, xzr, x0, lt
1223 ; CHECK-NEXT: csel x9, x25, x1, lt
1224 ; CHECK-NEXT: fcmp s0, s10
1225 ; CHECK-NEXT: csel x9, x26, x9, gt
1226 ; CHECK-NEXT: csinv x8, x8, xzr, le
1227 ; CHECK-NEXT: fcmp s0, s0
1228 ; CHECK-NEXT: fmov s0, s8
1229 ; CHECK-NEXT: csel x21, xzr, x8, vs
1230 ; CHECK-NEXT: csel x22, xzr, x9, vs
1231 ; CHECK-NEXT: bl __fixsfti
1232 ; CHECK-NEXT: fcmp s8, s9
1233 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1234 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
1235 ; CHECK-NEXT: csel x8, xzr, x0, lt
1236 ; CHECK-NEXT: csel x9, x25, x1, lt
1237 ; CHECK-NEXT: fcmp s8, s10
1238 ; CHECK-NEXT: csel x9, x26, x9, gt
1239 ; CHECK-NEXT: csinv x8, x8, xzr, le
1240 ; CHECK-NEXT: fcmp s8, s8
1241 ; CHECK-NEXT: csel x23, xzr, x8, vs
1242 ; CHECK-NEXT: csel x24, xzr, x9, vs
1243 ; CHECK-NEXT: bl __fixsfti
1244 ; CHECK-NEXT: ldr q0, [sp, #16] // 16-byte Folded Reload
1245 ; CHECK-NEXT: mov x2, x19
1246 ; CHECK-NEXT: mov x3, x20
1247 ; CHECK-NEXT: mov x4, x21
1248 ; CHECK-NEXT: mov x5, x22
1249 ; CHECK-NEXT: mov x6, x23
1250 ; CHECK-NEXT: fcmp s0, s9
1251 ; CHECK-NEXT: mov x7, x24
1252 ; CHECK-NEXT: ldr x30, [sp, #56] // 8-byte Folded Reload
1253 ; CHECK-NEXT: ldp x20, x19, [sp, #112] // 16-byte Folded Reload
1254 ; CHECK-NEXT: ldp x22, x21, [sp, #96] // 16-byte Folded Reload
1255 ; CHECK-NEXT: csel x8, x25, x1, lt
1256 ; CHECK-NEXT: csel x9, xzr, x0, lt
1257 ; CHECK-NEXT: fcmp s0, s10
1258 ; CHECK-NEXT: ldp x24, x23, [sp, #80] // 16-byte Folded Reload
1259 ; CHECK-NEXT: ldr d10, [sp, #32] // 8-byte Folded Reload
1260 ; CHECK-NEXT: ldp d9, d8, [sp, #40] // 16-byte Folded Reload
1261 ; CHECK-NEXT: csinv x9, x9, xzr, le
1262 ; CHECK-NEXT: csel x8, x26, x8, gt
1263 ; CHECK-NEXT: fcmp s0, s0
1264 ; CHECK-NEXT: ldp x26, x25, [sp, #64] // 16-byte Folded Reload
1265 ; CHECK-NEXT: csel x9, xzr, x9, vs
1266 ; CHECK-NEXT: csel x1, xzr, x8, vs
1267 ; CHECK-NEXT: fmov d0, x9
1268 ; CHECK-NEXT: mov v0.d[1], x1
1269 ; CHECK-NEXT: fmov x0, d0
1270 ; CHECK-NEXT: add sp, sp, #128
1272 %x = call <4 x i128> @llvm.fptosi.sat.v4f32.v4i128(<4 x float> %f)
1277 ; 2-Vector double to signed integer -- result size variation
1280 declare <2 x i1> @llvm.fptosi.sat.v2f64.v2i1 (<2 x double>)
1281 declare <2 x i8> @llvm.fptosi.sat.v2f64.v2i8 (<2 x double>)
1282 declare <2 x i13> @llvm.fptosi.sat.v2f64.v2i13 (<2 x double>)
1283 declare <2 x i16> @llvm.fptosi.sat.v2f64.v2i16 (<2 x double>)
1284 declare <2 x i19> @llvm.fptosi.sat.v2f64.v2i19 (<2 x double>)
1285 declare <2 x i50> @llvm.fptosi.sat.v2f64.v2i50 (<2 x double>)
1286 declare <2 x i64> @llvm.fptosi.sat.v2f64.v2i64 (<2 x double>)
1287 declare <2 x i100> @llvm.fptosi.sat.v2f64.v2i100(<2 x double>)
1288 declare <2 x i128> @llvm.fptosi.sat.v2f64.v2i128(<2 x double>)
1290 define <2 x i1> @test_signed_v2f64_v2i1(<2 x double> %f) {
1291 ; CHECK-LABEL: test_signed_v2f64_v2i1:
1293 ; CHECK-NEXT: mov d1, v0.d[1]
1294 ; CHECK-NEXT: fcvtzs w9, d0
1295 ; CHECK-NEXT: fcvtzs w8, d1
1296 ; CHECK-NEXT: ands w8, w8, w8, asr #31
1297 ; CHECK-NEXT: csinv w8, w8, wzr, ge
1298 ; CHECK-NEXT: ands w9, w9, w9, asr #31
1299 ; CHECK-NEXT: csinv w9, w9, wzr, ge
1300 ; CHECK-NEXT: fmov s0, w9
1301 ; CHECK-NEXT: mov v0.s[1], w8
1302 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1304 %x = call <2 x i1> @llvm.fptosi.sat.v2f64.v2i1(<2 x double> %f)
1308 define <2 x i8> @test_signed_v2f64_v2i8(<2 x double> %f) {
1309 ; CHECK-LABEL: test_signed_v2f64_v2i8:
1311 ; CHECK-NEXT: mov d1, v0.d[1]
1312 ; CHECK-NEXT: fcvtzs w10, d0
1313 ; CHECK-NEXT: mov w8, #127 // =0x7f
1314 ; CHECK-NEXT: mov w11, #-128 // =0xffffff80
1315 ; CHECK-NEXT: fcvtzs w9, d1
1316 ; CHECK-NEXT: cmp w9, #127
1317 ; CHECK-NEXT: csel w9, w9, w8, lt
1318 ; CHECK-NEXT: cmn w9, #128
1319 ; CHECK-NEXT: csel w9, w9, w11, gt
1320 ; CHECK-NEXT: cmp w10, #127
1321 ; CHECK-NEXT: csel w8, w10, w8, lt
1322 ; CHECK-NEXT: cmn w8, #128
1323 ; CHECK-NEXT: csel w8, w8, w11, gt
1324 ; CHECK-NEXT: fmov s0, w8
1325 ; CHECK-NEXT: mov v0.s[1], w9
1326 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1328 %x = call <2 x i8> @llvm.fptosi.sat.v2f64.v2i8(<2 x double> %f)
1332 define <2 x i13> @test_signed_v2f64_v2i13(<2 x double> %f) {
1333 ; CHECK-LABEL: test_signed_v2f64_v2i13:
1335 ; CHECK-NEXT: mov d1, v0.d[1]
1336 ; CHECK-NEXT: fcvtzs w10, d0
1337 ; CHECK-NEXT: mov w8, #4095 // =0xfff
1338 ; CHECK-NEXT: mov w11, #-4096 // =0xfffff000
1339 ; CHECK-NEXT: fcvtzs w9, d1
1340 ; CHECK-NEXT: cmp w9, #4095
1341 ; CHECK-NEXT: csel w9, w9, w8, lt
1342 ; CHECK-NEXT: cmn w9, #1, lsl #12 // =4096
1343 ; CHECK-NEXT: csel w9, w9, w11, gt
1344 ; CHECK-NEXT: cmp w10, #4095
1345 ; CHECK-NEXT: csel w8, w10, w8, lt
1346 ; CHECK-NEXT: cmn w8, #1, lsl #12 // =4096
1347 ; CHECK-NEXT: csel w8, w8, w11, gt
1348 ; CHECK-NEXT: fmov s0, w8
1349 ; CHECK-NEXT: mov v0.s[1], w9
1350 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1352 %x = call <2 x i13> @llvm.fptosi.sat.v2f64.v2i13(<2 x double> %f)
1356 define <2 x i16> @test_signed_v2f64_v2i16(<2 x double> %f) {
1357 ; CHECK-LABEL: test_signed_v2f64_v2i16:
1359 ; CHECK-NEXT: mov d1, v0.d[1]
1360 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
1361 ; CHECK-NEXT: fcvtzs w10, d0
1362 ; CHECK-NEXT: mov w11, #-32768 // =0xffff8000
1363 ; CHECK-NEXT: fcvtzs w9, d1
1364 ; CHECK-NEXT: cmp w9, w8
1365 ; CHECK-NEXT: csel w9, w9, w8, lt
1366 ; CHECK-NEXT: cmn w9, #8, lsl #12 // =32768
1367 ; CHECK-NEXT: csel w9, w9, w11, gt
1368 ; CHECK-NEXT: cmp w10, w8
1369 ; CHECK-NEXT: csel w8, w10, w8, lt
1370 ; CHECK-NEXT: cmn w8, #8, lsl #12 // =32768
1371 ; CHECK-NEXT: csel w8, w8, w11, gt
1372 ; CHECK-NEXT: fmov s0, w8
1373 ; CHECK-NEXT: mov v0.s[1], w9
1374 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1376 %x = call <2 x i16> @llvm.fptosi.sat.v2f64.v2i16(<2 x double> %f)
1380 define <2 x i19> @test_signed_v2f64_v2i19(<2 x double> %f) {
1381 ; CHECK-LABEL: test_signed_v2f64_v2i19:
1383 ; CHECK-NEXT: mov d1, v0.d[1]
1384 ; CHECK-NEXT: mov w8, #262143 // =0x3ffff
1385 ; CHECK-NEXT: fcvtzs w10, d0
1386 ; CHECK-NEXT: mov w11, #-262144 // =0xfffc0000
1387 ; CHECK-NEXT: fcvtzs w9, d1
1388 ; CHECK-NEXT: cmp w9, w8
1389 ; CHECK-NEXT: csel w9, w9, w8, lt
1390 ; CHECK-NEXT: cmn w9, #64, lsl #12 // =262144
1391 ; CHECK-NEXT: csel w9, w9, w11, gt
1392 ; CHECK-NEXT: cmp w10, w8
1393 ; CHECK-NEXT: csel w8, w10, w8, lt
1394 ; CHECK-NEXT: cmn w8, #64, lsl #12 // =262144
1395 ; CHECK-NEXT: csel w8, w8, w11, gt
1396 ; CHECK-NEXT: fmov s0, w8
1397 ; CHECK-NEXT: mov v0.s[1], w9
1398 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1400 %x = call <2 x i19> @llvm.fptosi.sat.v2f64.v2i19(<2 x double> %f)
1404 define <2 x i32> @test_signed_v2f64_v2i32_duplicate(<2 x double> %f) {
1405 ; CHECK-LABEL: test_signed_v2f64_v2i32_duplicate:
1407 ; CHECK-NEXT: mov d1, v0.d[1]
1408 ; CHECK-NEXT: fcvtzs w8, d0
1409 ; CHECK-NEXT: fcvtzs w9, d1
1410 ; CHECK-NEXT: fmov s0, w8
1411 ; CHECK-NEXT: mov v0.s[1], w9
1412 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1414 %x = call <2 x i32> @llvm.fptosi.sat.v2f64.v2i32(<2 x double> %f)
1418 define <2 x i50> @test_signed_v2f64_v2i50(<2 x double> %f) {
1419 ; CHECK-LABEL: test_signed_v2f64_v2i50:
1421 ; CHECK-NEXT: mov d1, v0.d[1]
1422 ; CHECK-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
1423 ; CHECK-NEXT: fcvtzs x10, d0
1424 ; CHECK-NEXT: mov x11, #-562949953421312 // =0xfffe000000000000
1425 ; CHECK-NEXT: fcvtzs x9, d1
1426 ; CHECK-NEXT: cmp x9, x8
1427 ; CHECK-NEXT: csel x9, x9, x8, lt
1428 ; CHECK-NEXT: cmp x9, x11
1429 ; CHECK-NEXT: csel x9, x9, x11, gt
1430 ; CHECK-NEXT: cmp x10, x8
1431 ; CHECK-NEXT: csel x8, x10, x8, lt
1432 ; CHECK-NEXT: cmp x8, x11
1433 ; CHECK-NEXT: csel x8, x8, x11, gt
1434 ; CHECK-NEXT: fmov d0, x8
1435 ; CHECK-NEXT: mov v0.d[1], x9
1437 %x = call <2 x i50> @llvm.fptosi.sat.v2f64.v2i50(<2 x double> %f)
1441 define <2 x i64> @test_signed_v2f64_v2i64(<2 x double> %f) {
1442 ; CHECK-LABEL: test_signed_v2f64_v2i64:
1444 ; CHECK-NEXT: fcvtzs v0.2d, v0.2d
1446 %x = call <2 x i64> @llvm.fptosi.sat.v2f64.v2i64(<2 x double> %f)
1450 define <2 x i100> @test_signed_v2f64_v2i100(<2 x double> %f) {
1451 ; CHECK-LABEL: test_signed_v2f64_v2i100:
1453 ; CHECK-NEXT: sub sp, sp, #80
1454 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
1455 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
1456 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
1457 ; CHECK-NEXT: stp x22, x21, [sp, #48] // 16-byte Folded Spill
1458 ; CHECK-NEXT: stp x20, x19, [sp, #64] // 16-byte Folded Spill
1459 ; CHECK-NEXT: .cfi_def_cfa_offset 80
1460 ; CHECK-NEXT: .cfi_offset w19, -8
1461 ; CHECK-NEXT: .cfi_offset w20, -16
1462 ; CHECK-NEXT: .cfi_offset w21, -24
1463 ; CHECK-NEXT: .cfi_offset w22, -32
1464 ; CHECK-NEXT: .cfi_offset w30, -40
1465 ; CHECK-NEXT: .cfi_offset b8, -48
1466 ; CHECK-NEXT: .cfi_offset b9, -56
1467 ; CHECK-NEXT: .cfi_offset b10, -64
1468 ; CHECK-NEXT: mov d8, v0.d[1]
1469 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1470 ; CHECK-NEXT: fmov d0, d8
1471 ; CHECK-NEXT: bl __fixdfti
1472 ; CHECK-NEXT: mov x8, #-4170333254945079296 // =0xc620000000000000
1473 ; CHECK-NEXT: mov x21, #-34359738368 // =0xfffffff800000000
1474 ; CHECK-NEXT: mov x22, #34359738367 // =0x7ffffffff
1475 ; CHECK-NEXT: fmov d9, x8
1476 ; CHECK-NEXT: mov x8, #5053038781909696511 // =0x461fffffffffffff
1477 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1478 ; CHECK-NEXT: fmov d10, x8
1479 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1480 ; CHECK-NEXT: fcmp d8, d9
1481 ; CHECK-NEXT: csel x8, xzr, x0, lt
1482 ; CHECK-NEXT: csel x9, x21, x1, lt
1483 ; CHECK-NEXT: fcmp d8, d10
1484 ; CHECK-NEXT: csel x9, x22, x9, gt
1485 ; CHECK-NEXT: csinv x8, x8, xzr, le
1486 ; CHECK-NEXT: fcmp d8, d8
1487 ; CHECK-NEXT: csel x19, xzr, x8, vs
1488 ; CHECK-NEXT: csel x20, xzr, x9, vs
1489 ; CHECK-NEXT: bl __fixdfti
1490 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1491 ; CHECK-NEXT: mov x2, x19
1492 ; CHECK-NEXT: mov x3, x20
1493 ; CHECK-NEXT: ldp x20, x19, [sp, #64] // 16-byte Folded Reload
1494 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
1495 ; CHECK-NEXT: fcmp d0, d9
1496 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
1497 ; CHECK-NEXT: csel x8, x21, x1, lt
1498 ; CHECK-NEXT: csel x9, xzr, x0, lt
1499 ; CHECK-NEXT: fcmp d0, d10
1500 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
1501 ; CHECK-NEXT: csinv x9, x9, xzr, le
1502 ; CHECK-NEXT: csel x8, x22, x8, gt
1503 ; CHECK-NEXT: fcmp d0, d0
1504 ; CHECK-NEXT: ldp x22, x21, [sp, #48] // 16-byte Folded Reload
1505 ; CHECK-NEXT: csel x9, xzr, x9, vs
1506 ; CHECK-NEXT: csel x1, xzr, x8, vs
1507 ; CHECK-NEXT: fmov d0, x9
1508 ; CHECK-NEXT: mov v0.d[1], x1
1509 ; CHECK-NEXT: fmov x0, d0
1510 ; CHECK-NEXT: add sp, sp, #80
1512 %x = call <2 x i100> @llvm.fptosi.sat.v2f64.v2i100(<2 x double> %f)
1516 define <2 x i128> @test_signed_v2f64_v2i128(<2 x double> %f) {
1517 ; CHECK-LABEL: test_signed_v2f64_v2i128:
1519 ; CHECK-NEXT: sub sp, sp, #80
1520 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
1521 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
1522 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
1523 ; CHECK-NEXT: stp x22, x21, [sp, #48] // 16-byte Folded Spill
1524 ; CHECK-NEXT: stp x20, x19, [sp, #64] // 16-byte Folded Spill
1525 ; CHECK-NEXT: .cfi_def_cfa_offset 80
1526 ; CHECK-NEXT: .cfi_offset w19, -8
1527 ; CHECK-NEXT: .cfi_offset w20, -16
1528 ; CHECK-NEXT: .cfi_offset w21, -24
1529 ; CHECK-NEXT: .cfi_offset w22, -32
1530 ; CHECK-NEXT: .cfi_offset w30, -40
1531 ; CHECK-NEXT: .cfi_offset b8, -48
1532 ; CHECK-NEXT: .cfi_offset b9, -56
1533 ; CHECK-NEXT: .cfi_offset b10, -64
1534 ; CHECK-NEXT: mov d8, v0.d[1]
1535 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1536 ; CHECK-NEXT: fmov d0, d8
1537 ; CHECK-NEXT: bl __fixdfti
1538 ; CHECK-NEXT: mov x8, #-4044232465378705408 // =0xc7e0000000000000
1539 ; CHECK-NEXT: mov x21, #-9223372036854775808 // =0x8000000000000000
1540 ; CHECK-NEXT: mov x22, #9223372036854775807 // =0x7fffffffffffffff
1541 ; CHECK-NEXT: fmov d9, x8
1542 ; CHECK-NEXT: mov x8, #5179139571476070399 // =0x47dfffffffffffff
1543 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1544 ; CHECK-NEXT: fmov d10, x8
1545 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
1546 ; CHECK-NEXT: fcmp d8, d9
1547 ; CHECK-NEXT: csel x8, xzr, x0, lt
1548 ; CHECK-NEXT: csel x9, x21, x1, lt
1549 ; CHECK-NEXT: fcmp d8, d10
1550 ; CHECK-NEXT: csel x9, x22, x9, gt
1551 ; CHECK-NEXT: csinv x8, x8, xzr, le
1552 ; CHECK-NEXT: fcmp d8, d8
1553 ; CHECK-NEXT: csel x19, xzr, x8, vs
1554 ; CHECK-NEXT: csel x20, xzr, x9, vs
1555 ; CHECK-NEXT: bl __fixdfti
1556 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1557 ; CHECK-NEXT: mov x2, x19
1558 ; CHECK-NEXT: mov x3, x20
1559 ; CHECK-NEXT: ldp x20, x19, [sp, #64] // 16-byte Folded Reload
1560 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
1561 ; CHECK-NEXT: fcmp d0, d9
1562 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
1563 ; CHECK-NEXT: csel x8, x21, x1, lt
1564 ; CHECK-NEXT: csel x9, xzr, x0, lt
1565 ; CHECK-NEXT: fcmp d0, d10
1566 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
1567 ; CHECK-NEXT: csinv x9, x9, xzr, le
1568 ; CHECK-NEXT: csel x8, x22, x8, gt
1569 ; CHECK-NEXT: fcmp d0, d0
1570 ; CHECK-NEXT: ldp x22, x21, [sp, #48] // 16-byte Folded Reload
1571 ; CHECK-NEXT: csel x9, xzr, x9, vs
1572 ; CHECK-NEXT: csel x1, xzr, x8, vs
1573 ; CHECK-NEXT: fmov d0, x9
1574 ; CHECK-NEXT: mov v0.d[1], x1
1575 ; CHECK-NEXT: fmov x0, d0
1576 ; CHECK-NEXT: add sp, sp, #80
1578 %x = call <2 x i128> @llvm.fptosi.sat.v2f64.v2i128(<2 x double> %f)
1583 ; 4-Vector half to signed integer -- result size variation
1586 declare <4 x i1> @llvm.fptosi.sat.v4f16.v4i1 (<4 x half>)
1587 declare <4 x i8> @llvm.fptosi.sat.v4f16.v4i8 (<4 x half>)
1588 declare <4 x i13> @llvm.fptosi.sat.v4f16.v4i13 (<4 x half>)
1589 declare <4 x i16> @llvm.fptosi.sat.v4f16.v4i16 (<4 x half>)
1590 declare <4 x i19> @llvm.fptosi.sat.v4f16.v4i19 (<4 x half>)
1591 declare <4 x i50> @llvm.fptosi.sat.v4f16.v4i50 (<4 x half>)
1592 declare <4 x i64> @llvm.fptosi.sat.v4f16.v4i64 (<4 x half>)
1593 declare <4 x i100> @llvm.fptosi.sat.v4f16.v4i100(<4 x half>)
1594 declare <4 x i128> @llvm.fptosi.sat.v4f16.v4i128(<4 x half>)
1596 define <4 x i1> @test_signed_v4f16_v4i1(<4 x half> %f) {
1597 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i1:
1598 ; CHECK-CVT: // %bb.0:
1599 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
1600 ; CHECK-CVT-NEXT: movi v1.2d, #0000000000000000
1601 ; CHECK-CVT-NEXT: fcvtzs v0.4s, v0.4s
1602 ; CHECK-CVT-NEXT: smin v0.4s, v0.4s, v1.4s
1603 ; CHECK-CVT-NEXT: movi v1.2d, #0xffffffffffffffff
1604 ; CHECK-CVT-NEXT: smax v0.4s, v0.4s, v1.4s
1605 ; CHECK-CVT-NEXT: xtn v0.4h, v0.4s
1606 ; CHECK-CVT-NEXT: ret
1608 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i1:
1609 ; CHECK-FP16: // %bb.0:
1610 ; CHECK-FP16-NEXT: movi v1.2d, #0000000000000000
1611 ; CHECK-FP16-NEXT: fcvtzs v0.4h, v0.4h
1612 ; CHECK-FP16-NEXT: movi v2.2d, #0xffffffffffffffff
1613 ; CHECK-FP16-NEXT: smin v0.4h, v0.4h, v1.4h
1614 ; CHECK-FP16-NEXT: smax v0.4h, v0.4h, v2.4h
1615 ; CHECK-FP16-NEXT: ret
1616 %x = call <4 x i1> @llvm.fptosi.sat.v4f16.v4i1(<4 x half> %f)
1620 define <4 x i8> @test_signed_v4f16_v4i8(<4 x half> %f) {
1621 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i8:
1622 ; CHECK-CVT: // %bb.0:
1623 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
1624 ; CHECK-CVT-NEXT: movi v1.4s, #127
1625 ; CHECK-CVT-NEXT: fcvtzs v0.4s, v0.4s
1626 ; CHECK-CVT-NEXT: smin v0.4s, v0.4s, v1.4s
1627 ; CHECK-CVT-NEXT: mvni v1.4s, #127
1628 ; CHECK-CVT-NEXT: smax v0.4s, v0.4s, v1.4s
1629 ; CHECK-CVT-NEXT: xtn v0.4h, v0.4s
1630 ; CHECK-CVT-NEXT: ret
1632 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i8:
1633 ; CHECK-FP16: // %bb.0:
1634 ; CHECK-FP16-NEXT: movi v1.4h, #127
1635 ; CHECK-FP16-NEXT: fcvtzs v0.4h, v0.4h
1636 ; CHECK-FP16-NEXT: smin v0.4h, v0.4h, v1.4h
1637 ; CHECK-FP16-NEXT: mvni v1.4h, #127
1638 ; CHECK-FP16-NEXT: smax v0.4h, v0.4h, v1.4h
1639 ; CHECK-FP16-NEXT: ret
1640 %x = call <4 x i8> @llvm.fptosi.sat.v4f16.v4i8(<4 x half> %f)
1644 define <4 x i13> @test_signed_v4f16_v4i13(<4 x half> %f) {
1645 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i13:
1646 ; CHECK-CVT: // %bb.0:
1647 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
1648 ; CHECK-CVT-NEXT: movi v1.4s, #15, msl #8
1649 ; CHECK-CVT-NEXT: fcvtzs v0.4s, v0.4s
1650 ; CHECK-CVT-NEXT: smin v0.4s, v0.4s, v1.4s
1651 ; CHECK-CVT-NEXT: mvni v1.4s, #15, msl #8
1652 ; CHECK-CVT-NEXT: smax v0.4s, v0.4s, v1.4s
1653 ; CHECK-CVT-NEXT: xtn v0.4h, v0.4s
1654 ; CHECK-CVT-NEXT: ret
1656 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i13:
1657 ; CHECK-FP16: // %bb.0:
1658 ; CHECK-FP16-NEXT: fcvtzs v0.4h, v0.4h
1659 ; CHECK-FP16-NEXT: mvni v1.4h, #240, lsl #8
1660 ; CHECK-FP16-NEXT: movi v2.4h, #240, lsl #8
1661 ; CHECK-FP16-NEXT: smin v0.4h, v0.4h, v1.4h
1662 ; CHECK-FP16-NEXT: smax v0.4h, v0.4h, v2.4h
1663 ; CHECK-FP16-NEXT: ret
1664 %x = call <4 x i13> @llvm.fptosi.sat.v4f16.v4i13(<4 x half> %f)
1668 define <4 x i16> @test_signed_v4f16_v4i16(<4 x half> %f) {
1669 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i16:
1670 ; CHECK-CVT: // %bb.0:
1671 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
1672 ; CHECK-CVT-NEXT: fcvtzs v0.4s, v0.4s
1673 ; CHECK-CVT-NEXT: sqxtn v0.4h, v0.4s
1674 ; CHECK-CVT-NEXT: ret
1676 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i16:
1677 ; CHECK-FP16: // %bb.0:
1678 ; CHECK-FP16-NEXT: fcvtzs v0.4h, v0.4h
1679 ; CHECK-FP16-NEXT: ret
1680 %x = call <4 x i16> @llvm.fptosi.sat.v4f16.v4i16(<4 x half> %f)
1684 define <4 x i19> @test_signed_v4f16_v4i19(<4 x half> %f) {
1685 ; CHECK-LABEL: test_signed_v4f16_v4i19:
1687 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
1688 ; CHECK-NEXT: movi v1.4s, #3, msl #16
1689 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
1690 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
1691 ; CHECK-NEXT: mvni v1.4s, #3, msl #16
1692 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
1694 %x = call <4 x i19> @llvm.fptosi.sat.v4f16.v4i19(<4 x half> %f)
1698 define <4 x i32> @test_signed_v4f16_v4i32_duplicate(<4 x half> %f) {
1699 ; CHECK-LABEL: test_signed_v4f16_v4i32_duplicate:
1701 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
1702 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
1704 %x = call <4 x i32> @llvm.fptosi.sat.v4f16.v4i32(<4 x half> %f)
1708 define <4 x i50> @test_signed_v4f16_v4i50(<4 x half> %f) {
1709 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i50:
1710 ; CHECK-CVT: // %bb.0:
1711 ; CHECK-CVT-NEXT: // kill: def $d0 killed $d0 def $q0
1712 ; CHECK-CVT-NEXT: mov h1, v0.h[1]
1713 ; CHECK-CVT-NEXT: fcvt s2, h0
1714 ; CHECK-CVT-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
1715 ; CHECK-CVT-NEXT: mov h3, v0.h[2]
1716 ; CHECK-CVT-NEXT: mov h0, v0.h[3]
1717 ; CHECK-CVT-NEXT: mov x11, #-562949953421312 // =0xfffe000000000000
1718 ; CHECK-CVT-NEXT: fcvt s1, h1
1719 ; CHECK-CVT-NEXT: fcvtzs x9, s2
1720 ; CHECK-CVT-NEXT: fcvt s2, h3
1721 ; CHECK-CVT-NEXT: fcvt s0, h0
1722 ; CHECK-CVT-NEXT: fcvtzs x10, s1
1723 ; CHECK-CVT-NEXT: cmp x9, x8
1724 ; CHECK-CVT-NEXT: csel x9, x9, x8, lt
1725 ; CHECK-CVT-NEXT: fcvtzs x12, s2
1726 ; CHECK-CVT-NEXT: cmp x9, x11
1727 ; CHECK-CVT-NEXT: csel x0, x9, x11, gt
1728 ; CHECK-CVT-NEXT: cmp x10, x8
1729 ; CHECK-CVT-NEXT: csel x9, x10, x8, lt
1730 ; CHECK-CVT-NEXT: fcvtzs x10, s0
1731 ; CHECK-CVT-NEXT: cmp x9, x11
1732 ; CHECK-CVT-NEXT: csel x1, x9, x11, gt
1733 ; CHECK-CVT-NEXT: cmp x12, x8
1734 ; CHECK-CVT-NEXT: csel x9, x12, x8, lt
1735 ; CHECK-CVT-NEXT: cmp x9, x11
1736 ; CHECK-CVT-NEXT: csel x2, x9, x11, gt
1737 ; CHECK-CVT-NEXT: cmp x10, x8
1738 ; CHECK-CVT-NEXT: csel x8, x10, x8, lt
1739 ; CHECK-CVT-NEXT: cmp x8, x11
1740 ; CHECK-CVT-NEXT: csel x3, x8, x11, gt
1741 ; CHECK-CVT-NEXT: ret
1743 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i50:
1744 ; CHECK-FP16: // %bb.0:
1745 ; CHECK-FP16-NEXT: // kill: def $d0 killed $d0 def $q0
1746 ; CHECK-FP16-NEXT: mov h1, v0.h[1]
1747 ; CHECK-FP16-NEXT: fcvtzs x9, h0
1748 ; CHECK-FP16-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
1749 ; CHECK-FP16-NEXT: mov h2, v0.h[2]
1750 ; CHECK-FP16-NEXT: mov x11, #-562949953421312 // =0xfffe000000000000
1751 ; CHECK-FP16-NEXT: mov h0, v0.h[3]
1752 ; CHECK-FP16-NEXT: fcvtzs x10, h1
1753 ; CHECK-FP16-NEXT: cmp x9, x8
1754 ; CHECK-FP16-NEXT: csel x9, x9, x8, lt
1755 ; CHECK-FP16-NEXT: fcvtzs x12, h2
1756 ; CHECK-FP16-NEXT: cmp x9, x11
1757 ; CHECK-FP16-NEXT: csel x0, x9, x11, gt
1758 ; CHECK-FP16-NEXT: cmp x10, x8
1759 ; CHECK-FP16-NEXT: csel x9, x10, x8, lt
1760 ; CHECK-FP16-NEXT: fcvtzs x10, h0
1761 ; CHECK-FP16-NEXT: cmp x9, x11
1762 ; CHECK-FP16-NEXT: csel x1, x9, x11, gt
1763 ; CHECK-FP16-NEXT: cmp x12, x8
1764 ; CHECK-FP16-NEXT: csel x9, x12, x8, lt
1765 ; CHECK-FP16-NEXT: cmp x9, x11
1766 ; CHECK-FP16-NEXT: csel x2, x9, x11, gt
1767 ; CHECK-FP16-NEXT: cmp x10, x8
1768 ; CHECK-FP16-NEXT: csel x8, x10, x8, lt
1769 ; CHECK-FP16-NEXT: cmp x8, x11
1770 ; CHECK-FP16-NEXT: csel x3, x8, x11, gt
1771 ; CHECK-FP16-NEXT: ret
1772 %x = call <4 x i50> @llvm.fptosi.sat.v4f16.v4i50(<4 x half> %f)
1776 define <4 x i64> @test_signed_v4f16_v4i64(<4 x half> %f) {
1777 ; CHECK-CVT-LABEL: test_signed_v4f16_v4i64:
1778 ; CHECK-CVT: // %bb.0:
1779 ; CHECK-CVT-NEXT: // kill: def $d0 killed $d0 def $q0
1780 ; CHECK-CVT-NEXT: mov h1, v0.h[2]
1781 ; CHECK-CVT-NEXT: mov h2, v0.h[1]
1782 ; CHECK-CVT-NEXT: mov h3, v0.h[3]
1783 ; CHECK-CVT-NEXT: fcvt s0, h0
1784 ; CHECK-CVT-NEXT: fcvt s1, h1
1785 ; CHECK-CVT-NEXT: fcvt s2, h2
1786 ; CHECK-CVT-NEXT: fcvt s3, h3
1787 ; CHECK-CVT-NEXT: fcvtzs x8, s0
1788 ; CHECK-CVT-NEXT: fcvtzs x9, s1
1789 ; CHECK-CVT-NEXT: fcvtzs x10, s2
1790 ; CHECK-CVT-NEXT: fcvtzs x11, s3
1791 ; CHECK-CVT-NEXT: fmov d0, x8
1792 ; CHECK-CVT-NEXT: fmov d1, x9
1793 ; CHECK-CVT-NEXT: mov v0.d[1], x10
1794 ; CHECK-CVT-NEXT: mov v1.d[1], x11
1795 ; CHECK-CVT-NEXT: ret
1797 ; CHECK-FP16-LABEL: test_signed_v4f16_v4i64:
1798 ; CHECK-FP16: // %bb.0:
1799 ; CHECK-FP16-NEXT: // kill: def $d0 killed $d0 def $q0
1800 ; CHECK-FP16-NEXT: mov h1, v0.h[2]
1801 ; CHECK-FP16-NEXT: mov h2, v0.h[1]
1802 ; CHECK-FP16-NEXT: mov h3, v0.h[3]
1803 ; CHECK-FP16-NEXT: fcvtzs x8, h0
1804 ; CHECK-FP16-NEXT: fcvtzs x9, h1
1805 ; CHECK-FP16-NEXT: fcvtzs x10, h2
1806 ; CHECK-FP16-NEXT: fcvtzs x11, h3
1807 ; CHECK-FP16-NEXT: fmov d0, x8
1808 ; CHECK-FP16-NEXT: fmov d1, x9
1809 ; CHECK-FP16-NEXT: mov v0.d[1], x10
1810 ; CHECK-FP16-NEXT: mov v1.d[1], x11
1811 ; CHECK-FP16-NEXT: ret
1812 %x = call <4 x i64> @llvm.fptosi.sat.v4f16.v4i64(<4 x half> %f)
1816 define <4 x i100> @test_signed_v4f16_v4i100(<4 x half> %f) {
1817 ; CHECK-LABEL: test_signed_v4f16_v4i100:
1819 ; CHECK-NEXT: sub sp, sp, #112
1820 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
1821 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
1822 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
1823 ; CHECK-NEXT: stp x26, x25, [sp, #48] // 16-byte Folded Spill
1824 ; CHECK-NEXT: stp x24, x23, [sp, #64] // 16-byte Folded Spill
1825 ; CHECK-NEXT: stp x22, x21, [sp, #80] // 16-byte Folded Spill
1826 ; CHECK-NEXT: stp x20, x19, [sp, #96] // 16-byte Folded Spill
1827 ; CHECK-NEXT: .cfi_def_cfa_offset 112
1828 ; CHECK-NEXT: .cfi_offset w19, -8
1829 ; CHECK-NEXT: .cfi_offset w20, -16
1830 ; CHECK-NEXT: .cfi_offset w21, -24
1831 ; CHECK-NEXT: .cfi_offset w22, -32
1832 ; CHECK-NEXT: .cfi_offset w23, -40
1833 ; CHECK-NEXT: .cfi_offset w24, -48
1834 ; CHECK-NEXT: .cfi_offset w25, -56
1835 ; CHECK-NEXT: .cfi_offset w26, -64
1836 ; CHECK-NEXT: .cfi_offset w30, -72
1837 ; CHECK-NEXT: .cfi_offset b8, -80
1838 ; CHECK-NEXT: .cfi_offset b9, -88
1839 ; CHECK-NEXT: .cfi_offset b10, -96
1840 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
1841 ; CHECK-NEXT: mov h1, v0.h[1]
1842 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1843 ; CHECK-NEXT: fcvt s8, h1
1844 ; CHECK-NEXT: fmov s0, s8
1845 ; CHECK-NEXT: bl __fixsfti
1846 ; CHECK-NEXT: movi v9.2s, #241, lsl #24
1847 ; CHECK-NEXT: mov w8, #1895825407 // =0x70ffffff
1848 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1849 ; CHECK-NEXT: fmov s10, w8
1850 ; CHECK-NEXT: mov x25, #-34359738368 // =0xfffffff800000000
1851 ; CHECK-NEXT: mov x26, #34359738367 // =0x7ffffffff
1852 ; CHECK-NEXT: mov h0, v0.h[2]
1853 ; CHECK-NEXT: fcmp s8, s9
1854 ; CHECK-NEXT: csel x8, xzr, x0, lt
1855 ; CHECK-NEXT: csel x9, x25, x1, lt
1856 ; CHECK-NEXT: fcmp s8, s10
1857 ; CHECK-NEXT: csel x9, x26, x9, gt
1858 ; CHECK-NEXT: csinv x8, x8, xzr, le
1859 ; CHECK-NEXT: fcmp s8, s8
1860 ; CHECK-NEXT: fcvt s8, h0
1861 ; CHECK-NEXT: csel x19, xzr, x8, vs
1862 ; CHECK-NEXT: csel x20, xzr, x9, vs
1863 ; CHECK-NEXT: fmov s0, s8
1864 ; CHECK-NEXT: bl __fixsfti
1865 ; CHECK-NEXT: fcmp s8, s9
1866 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1867 ; CHECK-NEXT: mov h0, v0.h[3]
1868 ; CHECK-NEXT: csel x8, xzr, x0, lt
1869 ; CHECK-NEXT: csel x9, x25, x1, lt
1870 ; CHECK-NEXT: fcmp s8, s10
1871 ; CHECK-NEXT: csel x9, x26, x9, gt
1872 ; CHECK-NEXT: csinv x8, x8, xzr, le
1873 ; CHECK-NEXT: fcmp s8, s8
1874 ; CHECK-NEXT: fcvt s8, h0
1875 ; CHECK-NEXT: csel x21, xzr, x8, vs
1876 ; CHECK-NEXT: csel x22, xzr, x9, vs
1877 ; CHECK-NEXT: fmov s0, s8
1878 ; CHECK-NEXT: bl __fixsfti
1879 ; CHECK-NEXT: fcmp s8, s9
1880 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1881 ; CHECK-NEXT: csel x8, xzr, x0, lt
1882 ; CHECK-NEXT: csel x9, x25, x1, lt
1883 ; CHECK-NEXT: fcmp s8, s10
1884 ; CHECK-NEXT: csel x9, x26, x9, gt
1885 ; CHECK-NEXT: csinv x8, x8, xzr, le
1886 ; CHECK-NEXT: fcmp s8, s8
1887 ; CHECK-NEXT: fcvt s8, h0
1888 ; CHECK-NEXT: csel x23, xzr, x8, vs
1889 ; CHECK-NEXT: csel x24, xzr, x9, vs
1890 ; CHECK-NEXT: fmov s0, s8
1891 ; CHECK-NEXT: bl __fixsfti
1892 ; CHECK-NEXT: fcmp s8, s9
1893 ; CHECK-NEXT: mov x2, x19
1894 ; CHECK-NEXT: mov x3, x20
1895 ; CHECK-NEXT: mov x4, x21
1896 ; CHECK-NEXT: mov x5, x22
1897 ; CHECK-NEXT: mov x6, x23
1898 ; CHECK-NEXT: mov x7, x24
1899 ; CHECK-NEXT: ldp x20, x19, [sp, #96] // 16-byte Folded Reload
1900 ; CHECK-NEXT: csel x8, x25, x1, lt
1901 ; CHECK-NEXT: csel x9, xzr, x0, lt
1902 ; CHECK-NEXT: fcmp s8, s10
1903 ; CHECK-NEXT: ldp x22, x21, [sp, #80] // 16-byte Folded Reload
1904 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
1905 ; CHECK-NEXT: ldp x24, x23, [sp, #64] // 16-byte Folded Reload
1906 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
1907 ; CHECK-NEXT: csinv x9, x9, xzr, le
1908 ; CHECK-NEXT: csel x8, x26, x8, gt
1909 ; CHECK-NEXT: fcmp s8, s8
1910 ; CHECK-NEXT: ldp x26, x25, [sp, #48] // 16-byte Folded Reload
1911 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
1912 ; CHECK-NEXT: csel x9, xzr, x9, vs
1913 ; CHECK-NEXT: csel x1, xzr, x8, vs
1914 ; CHECK-NEXT: fmov d0, x9
1915 ; CHECK-NEXT: mov v0.d[1], x1
1916 ; CHECK-NEXT: fmov x0, d0
1917 ; CHECK-NEXT: add sp, sp, #112
1919 %x = call <4 x i100> @llvm.fptosi.sat.v4f16.v4i100(<4 x half> %f)
1923 define <4 x i128> @test_signed_v4f16_v4i128(<4 x half> %f) {
1924 ; CHECK-LABEL: test_signed_v4f16_v4i128:
1926 ; CHECK-NEXT: sub sp, sp, #112
1927 ; CHECK-NEXT: str d10, [sp, #16] // 8-byte Folded Spill
1928 ; CHECK-NEXT: stp d9, d8, [sp, #24] // 16-byte Folded Spill
1929 ; CHECK-NEXT: str x30, [sp, #40] // 8-byte Folded Spill
1930 ; CHECK-NEXT: stp x26, x25, [sp, #48] // 16-byte Folded Spill
1931 ; CHECK-NEXT: stp x24, x23, [sp, #64] // 16-byte Folded Spill
1932 ; CHECK-NEXT: stp x22, x21, [sp, #80] // 16-byte Folded Spill
1933 ; CHECK-NEXT: stp x20, x19, [sp, #96] // 16-byte Folded Spill
1934 ; CHECK-NEXT: .cfi_def_cfa_offset 112
1935 ; CHECK-NEXT: .cfi_offset w19, -8
1936 ; CHECK-NEXT: .cfi_offset w20, -16
1937 ; CHECK-NEXT: .cfi_offset w21, -24
1938 ; CHECK-NEXT: .cfi_offset w22, -32
1939 ; CHECK-NEXT: .cfi_offset w23, -40
1940 ; CHECK-NEXT: .cfi_offset w24, -48
1941 ; CHECK-NEXT: .cfi_offset w25, -56
1942 ; CHECK-NEXT: .cfi_offset w26, -64
1943 ; CHECK-NEXT: .cfi_offset w30, -72
1944 ; CHECK-NEXT: .cfi_offset b8, -80
1945 ; CHECK-NEXT: .cfi_offset b9, -88
1946 ; CHECK-NEXT: .cfi_offset b10, -96
1947 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
1948 ; CHECK-NEXT: mov h1, v0.h[1]
1949 ; CHECK-NEXT: str q0, [sp] // 16-byte Folded Spill
1950 ; CHECK-NEXT: fcvt s8, h1
1951 ; CHECK-NEXT: fmov s0, s8
1952 ; CHECK-NEXT: bl __fixsfti
1953 ; CHECK-NEXT: movi v9.2s, #255, lsl #24
1954 ; CHECK-NEXT: mov w8, #2130706431 // =0x7effffff
1955 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1956 ; CHECK-NEXT: fmov s10, w8
1957 ; CHECK-NEXT: mov x25, #-9223372036854775808 // =0x8000000000000000
1958 ; CHECK-NEXT: mov x26, #9223372036854775807 // =0x7fffffffffffffff
1959 ; CHECK-NEXT: mov h0, v0.h[2]
1960 ; CHECK-NEXT: fcmp s8, s9
1961 ; CHECK-NEXT: csel x8, xzr, x0, lt
1962 ; CHECK-NEXT: csel x9, x25, x1, lt
1963 ; CHECK-NEXT: fcmp s8, s10
1964 ; CHECK-NEXT: csel x9, x26, x9, gt
1965 ; CHECK-NEXT: csinv x8, x8, xzr, le
1966 ; CHECK-NEXT: fcmp s8, s8
1967 ; CHECK-NEXT: fcvt s8, h0
1968 ; CHECK-NEXT: csel x19, xzr, x8, vs
1969 ; CHECK-NEXT: csel x20, xzr, x9, vs
1970 ; CHECK-NEXT: fmov s0, s8
1971 ; CHECK-NEXT: bl __fixsfti
1972 ; CHECK-NEXT: fcmp s8, s9
1973 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1974 ; CHECK-NEXT: mov h0, v0.h[3]
1975 ; CHECK-NEXT: csel x8, xzr, x0, lt
1976 ; CHECK-NEXT: csel x9, x25, x1, lt
1977 ; CHECK-NEXT: fcmp s8, s10
1978 ; CHECK-NEXT: csel x9, x26, x9, gt
1979 ; CHECK-NEXT: csinv x8, x8, xzr, le
1980 ; CHECK-NEXT: fcmp s8, s8
1981 ; CHECK-NEXT: fcvt s8, h0
1982 ; CHECK-NEXT: csel x21, xzr, x8, vs
1983 ; CHECK-NEXT: csel x22, xzr, x9, vs
1984 ; CHECK-NEXT: fmov s0, s8
1985 ; CHECK-NEXT: bl __fixsfti
1986 ; CHECK-NEXT: fcmp s8, s9
1987 ; CHECK-NEXT: ldr q0, [sp] // 16-byte Folded Reload
1988 ; CHECK-NEXT: csel x8, xzr, x0, lt
1989 ; CHECK-NEXT: csel x9, x25, x1, lt
1990 ; CHECK-NEXT: fcmp s8, s10
1991 ; CHECK-NEXT: csel x9, x26, x9, gt
1992 ; CHECK-NEXT: csinv x8, x8, xzr, le
1993 ; CHECK-NEXT: fcmp s8, s8
1994 ; CHECK-NEXT: fcvt s8, h0
1995 ; CHECK-NEXT: csel x23, xzr, x8, vs
1996 ; CHECK-NEXT: csel x24, xzr, x9, vs
1997 ; CHECK-NEXT: fmov s0, s8
1998 ; CHECK-NEXT: bl __fixsfti
1999 ; CHECK-NEXT: fcmp s8, s9
2000 ; CHECK-NEXT: mov x2, x19
2001 ; CHECK-NEXT: mov x3, x20
2002 ; CHECK-NEXT: mov x4, x21
2003 ; CHECK-NEXT: mov x5, x22
2004 ; CHECK-NEXT: mov x6, x23
2005 ; CHECK-NEXT: mov x7, x24
2006 ; CHECK-NEXT: ldp x20, x19, [sp, #96] // 16-byte Folded Reload
2007 ; CHECK-NEXT: csel x8, x25, x1, lt
2008 ; CHECK-NEXT: csel x9, xzr, x0, lt
2009 ; CHECK-NEXT: fcmp s8, s10
2010 ; CHECK-NEXT: ldp x22, x21, [sp, #80] // 16-byte Folded Reload
2011 ; CHECK-NEXT: ldr x30, [sp, #40] // 8-byte Folded Reload
2012 ; CHECK-NEXT: ldp x24, x23, [sp, #64] // 16-byte Folded Reload
2013 ; CHECK-NEXT: ldr d10, [sp, #16] // 8-byte Folded Reload
2014 ; CHECK-NEXT: csinv x9, x9, xzr, le
2015 ; CHECK-NEXT: csel x8, x26, x8, gt
2016 ; CHECK-NEXT: fcmp s8, s8
2017 ; CHECK-NEXT: ldp x26, x25, [sp, #48] // 16-byte Folded Reload
2018 ; CHECK-NEXT: ldp d9, d8, [sp, #24] // 16-byte Folded Reload
2019 ; CHECK-NEXT: csel x9, xzr, x9, vs
2020 ; CHECK-NEXT: csel x1, xzr, x8, vs
2021 ; CHECK-NEXT: fmov d0, x9
2022 ; CHECK-NEXT: mov v0.d[1], x1
2023 ; CHECK-NEXT: fmov x0, d0
2024 ; CHECK-NEXT: add sp, sp, #112
2026 %x = call <4 x i128> @llvm.fptosi.sat.v4f16.v4i128(<4 x half> %f)
2031 ; 8-Vector half to signed integer -- result size variation
2034 declare <8 x i1> @llvm.fptosi.sat.v8f16.v8i1 (<8 x half>)
2035 declare <8 x i8> @llvm.fptosi.sat.v8f16.v8i8 (<8 x half>)
2036 declare <8 x i13> @llvm.fptosi.sat.v8f16.v8i13 (<8 x half>)
2037 declare <8 x i16> @llvm.fptosi.sat.v8f16.v8i16 (<8 x half>)
2038 declare <8 x i19> @llvm.fptosi.sat.v8f16.v8i19 (<8 x half>)
2039 declare <8 x i50> @llvm.fptosi.sat.v8f16.v8i50 (<8 x half>)
2040 declare <8 x i64> @llvm.fptosi.sat.v8f16.v8i64 (<8 x half>)
2041 declare <8 x i100> @llvm.fptosi.sat.v8f16.v8i100(<8 x half>)
2042 declare <8 x i128> @llvm.fptosi.sat.v8f16.v8i128(<8 x half>)
2044 define <8 x i1> @test_signed_v8f16_v8i1(<8 x half> %f) {
2045 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i1:
2046 ; CHECK-CVT: // %bb.0:
2047 ; CHECK-CVT-NEXT: fcvtl2 v1.4s, v0.8h
2048 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
2049 ; CHECK-CVT-NEXT: mov s2, v1.s[1]
2050 ; CHECK-CVT-NEXT: fcvtzs w9, s1
2051 ; CHECK-CVT-NEXT: fcvtzs w13, s0
2052 ; CHECK-CVT-NEXT: fcvtzs w8, s2
2053 ; CHECK-CVT-NEXT: mov s2, v1.s[2]
2054 ; CHECK-CVT-NEXT: mov s1, v1.s[3]
2055 ; CHECK-CVT-NEXT: ands w8, w8, w8, asr #31
2056 ; CHECK-CVT-NEXT: fcvtzs w10, s2
2057 ; CHECK-CVT-NEXT: mov s2, v0.s[1]
2058 ; CHECK-CVT-NEXT: fcvtzs w11, s1
2059 ; CHECK-CVT-NEXT: mov s1, v0.s[2]
2060 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
2061 ; CHECK-CVT-NEXT: csinv w8, w8, wzr, ge
2062 ; CHECK-CVT-NEXT: ands w9, w9, w9, asr #31
2063 ; CHECK-CVT-NEXT: csinv w9, w9, wzr, ge
2064 ; CHECK-CVT-NEXT: ands w10, w10, w10, asr #31
2065 ; CHECK-CVT-NEXT: fcvtzs w12, s2
2066 ; CHECK-CVT-NEXT: fcvtzs w14, s1
2067 ; CHECK-CVT-NEXT: fmov s1, w9
2068 ; CHECK-CVT-NEXT: fcvtzs w9, s0
2069 ; CHECK-CVT-NEXT: csinv w10, w10, wzr, ge
2070 ; CHECK-CVT-NEXT: ands w11, w11, w11, asr #31
2071 ; CHECK-CVT-NEXT: csinv w11, w11, wzr, ge
2072 ; CHECK-CVT-NEXT: ands w12, w12, w12, asr #31
2073 ; CHECK-CVT-NEXT: mov v1.s[1], w8
2074 ; CHECK-CVT-NEXT: csinv w12, w12, wzr, ge
2075 ; CHECK-CVT-NEXT: ands w13, w13, w13, asr #31
2076 ; CHECK-CVT-NEXT: csinv w13, w13, wzr, ge
2077 ; CHECK-CVT-NEXT: ands w8, w14, w14, asr #31
2078 ; CHECK-CVT-NEXT: mov v1.s[2], w10
2079 ; CHECK-CVT-NEXT: fmov s2, w13
2080 ; CHECK-CVT-NEXT: csinv w8, w8, wzr, ge
2081 ; CHECK-CVT-NEXT: mov v2.s[1], w12
2082 ; CHECK-CVT-NEXT: mov v1.s[3], w11
2083 ; CHECK-CVT-NEXT: mov v2.s[2], w8
2084 ; CHECK-CVT-NEXT: ands w8, w9, w9, asr #31
2085 ; CHECK-CVT-NEXT: csinv w8, w8, wzr, ge
2086 ; CHECK-CVT-NEXT: mov v2.s[3], w8
2087 ; CHECK-CVT-NEXT: uzp1 v0.8h, v2.8h, v1.8h
2088 ; CHECK-CVT-NEXT: xtn v0.8b, v0.8h
2089 ; CHECK-CVT-NEXT: ret
2091 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i1:
2092 ; CHECK-FP16: // %bb.0:
2093 ; CHECK-FP16-NEXT: movi v1.2d, #0000000000000000
2094 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
2095 ; CHECK-FP16-NEXT: movi v2.2d, #0xffffffffffffffff
2096 ; CHECK-FP16-NEXT: smin v0.8h, v0.8h, v1.8h
2097 ; CHECK-FP16-NEXT: smax v0.8h, v0.8h, v2.8h
2098 ; CHECK-FP16-NEXT: xtn v0.8b, v0.8h
2099 ; CHECK-FP16-NEXT: ret
2100 %x = call <8 x i1> @llvm.fptosi.sat.v8f16.v8i1(<8 x half> %f)
2104 define <8 x i8> @test_signed_v8f16_v8i8(<8 x half> %f) {
2105 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i8:
2106 ; CHECK-CVT: // %bb.0:
2107 ; CHECK-CVT-NEXT: fcvtl2 v1.4s, v0.8h
2108 ; CHECK-CVT-NEXT: mov w8, #127 // =0x7f
2109 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
2110 ; CHECK-CVT-NEXT: mov w11, #-128 // =0xffffff80
2111 ; CHECK-CVT-NEXT: mov s2, v1.s[1]
2112 ; CHECK-CVT-NEXT: fcvtzs w10, s1
2113 ; CHECK-CVT-NEXT: fcvtzs w15, s0
2114 ; CHECK-CVT-NEXT: fcvtzs w9, s2
2115 ; CHECK-CVT-NEXT: mov s2, v1.s[2]
2116 ; CHECK-CVT-NEXT: mov s1, v1.s[3]
2117 ; CHECK-CVT-NEXT: cmp w9, #127
2118 ; CHECK-CVT-NEXT: fcvtzs w12, s2
2119 ; CHECK-CVT-NEXT: mov s2, v0.s[1]
2120 ; CHECK-CVT-NEXT: csel w9, w9, w8, lt
2121 ; CHECK-CVT-NEXT: fcvtzs w13, s1
2122 ; CHECK-CVT-NEXT: mov s1, v0.s[2]
2123 ; CHECK-CVT-NEXT: cmn w9, #128
2124 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
2125 ; CHECK-CVT-NEXT: csel w9, w9, w11, gt
2126 ; CHECK-CVT-NEXT: cmp w10, #127
2127 ; CHECK-CVT-NEXT: csel w10, w10, w8, lt
2128 ; CHECK-CVT-NEXT: fcvtzs w14, s2
2129 ; CHECK-CVT-NEXT: cmn w10, #128
2130 ; CHECK-CVT-NEXT: fcvtzs w16, s1
2131 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2132 ; CHECK-CVT-NEXT: cmp w12, #127
2133 ; CHECK-CVT-NEXT: csel w12, w12, w8, lt
2134 ; CHECK-CVT-NEXT: fmov s1, w10
2135 ; CHECK-CVT-NEXT: cmn w12, #128
2136 ; CHECK-CVT-NEXT: csel w12, w12, w11, gt
2137 ; CHECK-CVT-NEXT: cmp w13, #127
2138 ; CHECK-CVT-NEXT: csel w13, w13, w8, lt
2139 ; CHECK-CVT-NEXT: mov v1.s[1], w9
2140 ; CHECK-CVT-NEXT: fcvtzs w9, s0
2141 ; CHECK-CVT-NEXT: cmn w13, #128
2142 ; CHECK-CVT-NEXT: csel w13, w13, w11, gt
2143 ; CHECK-CVT-NEXT: cmp w14, #127
2144 ; CHECK-CVT-NEXT: csel w14, w14, w8, lt
2145 ; CHECK-CVT-NEXT: cmn w14, #128
2146 ; CHECK-CVT-NEXT: mov v1.s[2], w12
2147 ; CHECK-CVT-NEXT: csel w14, w14, w11, gt
2148 ; CHECK-CVT-NEXT: cmp w15, #127
2149 ; CHECK-CVT-NEXT: csel w15, w15, w8, lt
2150 ; CHECK-CVT-NEXT: cmn w15, #128
2151 ; CHECK-CVT-NEXT: csel w10, w15, w11, gt
2152 ; CHECK-CVT-NEXT: cmp w16, #127
2153 ; CHECK-CVT-NEXT: mov v1.s[3], w13
2154 ; CHECK-CVT-NEXT: fmov s2, w10
2155 ; CHECK-CVT-NEXT: csel w10, w16, w8, lt
2156 ; CHECK-CVT-NEXT: cmn w10, #128
2157 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2158 ; CHECK-CVT-NEXT: cmp w9, #127
2159 ; CHECK-CVT-NEXT: mov v2.s[1], w14
2160 ; CHECK-CVT-NEXT: csel w8, w9, w8, lt
2161 ; CHECK-CVT-NEXT: cmn w8, #128
2162 ; CHECK-CVT-NEXT: csel w8, w8, w11, gt
2163 ; CHECK-CVT-NEXT: mov v2.s[2], w10
2164 ; CHECK-CVT-NEXT: mov v2.s[3], w8
2165 ; CHECK-CVT-NEXT: uzp1 v0.8h, v2.8h, v1.8h
2166 ; CHECK-CVT-NEXT: xtn v0.8b, v0.8h
2167 ; CHECK-CVT-NEXT: ret
2169 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i8:
2170 ; CHECK-FP16: // %bb.0:
2171 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
2172 ; CHECK-FP16-NEXT: sqxtn v0.8b, v0.8h
2173 ; CHECK-FP16-NEXT: ret
2174 %x = call <8 x i8> @llvm.fptosi.sat.v8f16.v8i8(<8 x half> %f)
2178 define <8 x i13> @test_signed_v8f16_v8i13(<8 x half> %f) {
2179 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i13:
2180 ; CHECK-CVT: // %bb.0:
2181 ; CHECK-CVT-NEXT: fcvtl2 v1.4s, v0.8h
2182 ; CHECK-CVT-NEXT: mov w8, #4095 // =0xfff
2183 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
2184 ; CHECK-CVT-NEXT: mov w11, #-4096 // =0xfffff000
2185 ; CHECK-CVT-NEXT: mov s2, v1.s[1]
2186 ; CHECK-CVT-NEXT: fcvtzs w10, s1
2187 ; CHECK-CVT-NEXT: fcvtzs w15, s0
2188 ; CHECK-CVT-NEXT: fcvtzs w9, s2
2189 ; CHECK-CVT-NEXT: mov s2, v1.s[2]
2190 ; CHECK-CVT-NEXT: mov s1, v1.s[3]
2191 ; CHECK-CVT-NEXT: cmp w9, #4095
2192 ; CHECK-CVT-NEXT: fcvtzs w12, s2
2193 ; CHECK-CVT-NEXT: mov s2, v0.s[1]
2194 ; CHECK-CVT-NEXT: csel w9, w9, w8, lt
2195 ; CHECK-CVT-NEXT: fcvtzs w13, s1
2196 ; CHECK-CVT-NEXT: mov s1, v0.s[2]
2197 ; CHECK-CVT-NEXT: cmn w9, #1, lsl #12 // =4096
2198 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
2199 ; CHECK-CVT-NEXT: csel w9, w9, w11, gt
2200 ; CHECK-CVT-NEXT: cmp w10, #4095
2201 ; CHECK-CVT-NEXT: csel w10, w10, w8, lt
2202 ; CHECK-CVT-NEXT: fcvtzs w14, s2
2203 ; CHECK-CVT-NEXT: cmn w10, #1, lsl #12 // =4096
2204 ; CHECK-CVT-NEXT: fcvtzs w16, s1
2205 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2206 ; CHECK-CVT-NEXT: cmp w12, #4095
2207 ; CHECK-CVT-NEXT: csel w12, w12, w8, lt
2208 ; CHECK-CVT-NEXT: fmov s1, w10
2209 ; CHECK-CVT-NEXT: cmn w12, #1, lsl #12 // =4096
2210 ; CHECK-CVT-NEXT: csel w12, w12, w11, gt
2211 ; CHECK-CVT-NEXT: cmp w13, #4095
2212 ; CHECK-CVT-NEXT: csel w13, w13, w8, lt
2213 ; CHECK-CVT-NEXT: mov v1.s[1], w9
2214 ; CHECK-CVT-NEXT: fcvtzs w9, s0
2215 ; CHECK-CVT-NEXT: cmn w13, #1, lsl #12 // =4096
2216 ; CHECK-CVT-NEXT: csel w13, w13, w11, gt
2217 ; CHECK-CVT-NEXT: cmp w14, #4095
2218 ; CHECK-CVT-NEXT: csel w14, w14, w8, lt
2219 ; CHECK-CVT-NEXT: cmn w14, #1, lsl #12 // =4096
2220 ; CHECK-CVT-NEXT: mov v1.s[2], w12
2221 ; CHECK-CVT-NEXT: csel w14, w14, w11, gt
2222 ; CHECK-CVT-NEXT: cmp w15, #4095
2223 ; CHECK-CVT-NEXT: csel w15, w15, w8, lt
2224 ; CHECK-CVT-NEXT: cmn w15, #1, lsl #12 // =4096
2225 ; CHECK-CVT-NEXT: csel w10, w15, w11, gt
2226 ; CHECK-CVT-NEXT: cmp w16, #4095
2227 ; CHECK-CVT-NEXT: mov v1.s[3], w13
2228 ; CHECK-CVT-NEXT: fmov s2, w10
2229 ; CHECK-CVT-NEXT: csel w10, w16, w8, lt
2230 ; CHECK-CVT-NEXT: cmn w10, #1, lsl #12 // =4096
2231 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2232 ; CHECK-CVT-NEXT: cmp w9, #4095
2233 ; CHECK-CVT-NEXT: mov v2.s[1], w14
2234 ; CHECK-CVT-NEXT: csel w8, w9, w8, lt
2235 ; CHECK-CVT-NEXT: cmn w8, #1, lsl #12 // =4096
2236 ; CHECK-CVT-NEXT: csel w8, w8, w11, gt
2237 ; CHECK-CVT-NEXT: mov v2.s[2], w10
2238 ; CHECK-CVT-NEXT: mov v2.s[3], w8
2239 ; CHECK-CVT-NEXT: uzp1 v0.8h, v2.8h, v1.8h
2240 ; CHECK-CVT-NEXT: ret
2242 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i13:
2243 ; CHECK-FP16: // %bb.0:
2244 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
2245 ; CHECK-FP16-NEXT: mvni v1.8h, #240, lsl #8
2246 ; CHECK-FP16-NEXT: movi v2.8h, #240, lsl #8
2247 ; CHECK-FP16-NEXT: smin v0.8h, v0.8h, v1.8h
2248 ; CHECK-FP16-NEXT: smax v0.8h, v0.8h, v2.8h
2249 ; CHECK-FP16-NEXT: ret
2250 %x = call <8 x i13> @llvm.fptosi.sat.v8f16.v8i13(<8 x half> %f)
2254 define <8 x i16> @test_signed_v8f16_v8i16(<8 x half> %f) {
2255 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i16:
2256 ; CHECK-CVT: // %bb.0:
2257 ; CHECK-CVT-NEXT: fcvtl2 v1.4s, v0.8h
2258 ; CHECK-CVT-NEXT: mov w8, #32767 // =0x7fff
2259 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
2260 ; CHECK-CVT-NEXT: mov w11, #-32768 // =0xffff8000
2261 ; CHECK-CVT-NEXT: mov s2, v1.s[1]
2262 ; CHECK-CVT-NEXT: fcvtzs w10, s1
2263 ; CHECK-CVT-NEXT: fcvtzs w15, s0
2264 ; CHECK-CVT-NEXT: fcvtzs w9, s2
2265 ; CHECK-CVT-NEXT: mov s2, v1.s[2]
2266 ; CHECK-CVT-NEXT: mov s1, v1.s[3]
2267 ; CHECK-CVT-NEXT: cmp w9, w8
2268 ; CHECK-CVT-NEXT: fcvtzs w12, s2
2269 ; CHECK-CVT-NEXT: mov s2, v0.s[1]
2270 ; CHECK-CVT-NEXT: csel w9, w9, w8, lt
2271 ; CHECK-CVT-NEXT: fcvtzs w13, s1
2272 ; CHECK-CVT-NEXT: mov s1, v0.s[2]
2273 ; CHECK-CVT-NEXT: cmn w9, #8, lsl #12 // =32768
2274 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
2275 ; CHECK-CVT-NEXT: csel w9, w9, w11, gt
2276 ; CHECK-CVT-NEXT: cmp w10, w8
2277 ; CHECK-CVT-NEXT: csel w10, w10, w8, lt
2278 ; CHECK-CVT-NEXT: fcvtzs w14, s2
2279 ; CHECK-CVT-NEXT: cmn w10, #8, lsl #12 // =32768
2280 ; CHECK-CVT-NEXT: fcvtzs w16, s1
2281 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2282 ; CHECK-CVT-NEXT: cmp w12, w8
2283 ; CHECK-CVT-NEXT: csel w12, w12, w8, lt
2284 ; CHECK-CVT-NEXT: fmov s1, w10
2285 ; CHECK-CVT-NEXT: cmn w12, #8, lsl #12 // =32768
2286 ; CHECK-CVT-NEXT: csel w12, w12, w11, gt
2287 ; CHECK-CVT-NEXT: cmp w13, w8
2288 ; CHECK-CVT-NEXT: csel w13, w13, w8, lt
2289 ; CHECK-CVT-NEXT: mov v1.s[1], w9
2290 ; CHECK-CVT-NEXT: fcvtzs w9, s0
2291 ; CHECK-CVT-NEXT: cmn w13, #8, lsl #12 // =32768
2292 ; CHECK-CVT-NEXT: csel w13, w13, w11, gt
2293 ; CHECK-CVT-NEXT: cmp w14, w8
2294 ; CHECK-CVT-NEXT: csel w14, w14, w8, lt
2295 ; CHECK-CVT-NEXT: cmn w14, #8, lsl #12 // =32768
2296 ; CHECK-CVT-NEXT: mov v1.s[2], w12
2297 ; CHECK-CVT-NEXT: csel w14, w14, w11, gt
2298 ; CHECK-CVT-NEXT: cmp w15, w8
2299 ; CHECK-CVT-NEXT: csel w15, w15, w8, lt
2300 ; CHECK-CVT-NEXT: cmn w15, #8, lsl #12 // =32768
2301 ; CHECK-CVT-NEXT: csel w10, w15, w11, gt
2302 ; CHECK-CVT-NEXT: cmp w16, w8
2303 ; CHECK-CVT-NEXT: mov v1.s[3], w13
2304 ; CHECK-CVT-NEXT: fmov s2, w10
2305 ; CHECK-CVT-NEXT: csel w10, w16, w8, lt
2306 ; CHECK-CVT-NEXT: cmn w10, #8, lsl #12 // =32768
2307 ; CHECK-CVT-NEXT: csel w10, w10, w11, gt
2308 ; CHECK-CVT-NEXT: cmp w9, w8
2309 ; CHECK-CVT-NEXT: mov v2.s[1], w14
2310 ; CHECK-CVT-NEXT: csel w8, w9, w8, lt
2311 ; CHECK-CVT-NEXT: cmn w8, #8, lsl #12 // =32768
2312 ; CHECK-CVT-NEXT: csel w8, w8, w11, gt
2313 ; CHECK-CVT-NEXT: mov v2.s[2], w10
2314 ; CHECK-CVT-NEXT: mov v2.s[3], w8
2315 ; CHECK-CVT-NEXT: uzp1 v0.8h, v2.8h, v1.8h
2316 ; CHECK-CVT-NEXT: ret
2318 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i16:
2319 ; CHECK-FP16: // %bb.0:
2320 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
2321 ; CHECK-FP16-NEXT: ret
2322 %x = call <8 x i16> @llvm.fptosi.sat.v8f16.v8i16(<8 x half> %f)
2326 define <8 x i19> @test_signed_v8f16_v8i19(<8 x half> %f) {
2327 ; CHECK-LABEL: test_signed_v8f16_v8i19:
2329 ; CHECK-NEXT: fcvtl v2.4s, v0.4h
2330 ; CHECK-NEXT: fcvtl2 v0.4s, v0.8h
2331 ; CHECK-NEXT: movi v1.4s, #3, msl #16
2332 ; CHECK-NEXT: mvni v3.4s, #3, msl #16
2333 ; CHECK-NEXT: fcvtzs v2.4s, v2.4s
2334 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
2335 ; CHECK-NEXT: smin v2.4s, v2.4s, v1.4s
2336 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
2337 ; CHECK-NEXT: smax v1.4s, v2.4s, v3.4s
2338 ; CHECK-NEXT: smax v0.4s, v0.4s, v3.4s
2339 ; CHECK-NEXT: mov w1, v1.s[1]
2340 ; CHECK-NEXT: mov w2, v1.s[2]
2341 ; CHECK-NEXT: mov w3, v1.s[3]
2342 ; CHECK-NEXT: mov w5, v0.s[1]
2343 ; CHECK-NEXT: mov w6, v0.s[2]
2344 ; CHECK-NEXT: mov w7, v0.s[3]
2345 ; CHECK-NEXT: fmov w4, s0
2346 ; CHECK-NEXT: fmov w0, s1
2348 %x = call <8 x i19> @llvm.fptosi.sat.v8f16.v8i19(<8 x half> %f)
2352 define <8 x i32> @test_signed_v8f16_v8i32_duplicate(<8 x half> %f) {
2353 ; CHECK-LABEL: test_signed_v8f16_v8i32_duplicate:
2355 ; CHECK-NEXT: fcvtl2 v1.4s, v0.8h
2356 ; CHECK-NEXT: fcvtl v0.4s, v0.4h
2357 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
2358 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
2360 %x = call <8 x i32> @llvm.fptosi.sat.v8f16.v8i32(<8 x half> %f)
2364 define <8 x i50> @test_signed_v8f16_v8i50(<8 x half> %f) {
2365 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i50:
2366 ; CHECK-CVT: // %bb.0:
2367 ; CHECK-CVT-NEXT: ext v1.16b, v0.16b, v0.16b, #8
2368 ; CHECK-CVT-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
2369 ; CHECK-CVT-NEXT: mov x9, #-562949953421312 // =0xfffe000000000000
2370 ; CHECK-CVT-NEXT: mov h2, v1.h[1]
2371 ; CHECK-CVT-NEXT: fcvt s3, h1
2372 ; CHECK-CVT-NEXT: mov h4, v1.h[2]
2373 ; CHECK-CVT-NEXT: mov h1, v1.h[3]
2374 ; CHECK-CVT-NEXT: fcvt s2, h2
2375 ; CHECK-CVT-NEXT: fcvtzs x10, s3
2376 ; CHECK-CVT-NEXT: fcvt s3, h4
2377 ; CHECK-CVT-NEXT: fcvt s1, h1
2378 ; CHECK-CVT-NEXT: fcvtzs x11, s2
2379 ; CHECK-CVT-NEXT: cmp x10, x8
2380 ; CHECK-CVT-NEXT: fcvtzs x12, s3
2381 ; CHECK-CVT-NEXT: csel x10, x10, x8, lt
2382 ; CHECK-CVT-NEXT: mov h2, v0.h[1]
2383 ; CHECK-CVT-NEXT: fcvt s3, h0
2384 ; CHECK-CVT-NEXT: cmp x10, x9
2385 ; CHECK-CVT-NEXT: csel x4, x10, x9, gt
2386 ; CHECK-CVT-NEXT: cmp x11, x8
2387 ; CHECK-CVT-NEXT: csel x10, x11, x8, lt
2388 ; CHECK-CVT-NEXT: fcvtzs x11, s1
2389 ; CHECK-CVT-NEXT: mov h1, v0.h[2]
2390 ; CHECK-CVT-NEXT: cmp x10, x9
2391 ; CHECK-CVT-NEXT: fcvt s2, h2
2392 ; CHECK-CVT-NEXT: mov h0, v0.h[3]
2393 ; CHECK-CVT-NEXT: csel x5, x10, x9, gt
2394 ; CHECK-CVT-NEXT: cmp x12, x8
2395 ; CHECK-CVT-NEXT: csel x10, x12, x8, lt
2396 ; CHECK-CVT-NEXT: fcvtzs x12, s3
2397 ; CHECK-CVT-NEXT: cmp x10, x9
2398 ; CHECK-CVT-NEXT: fcvt s1, h1
2399 ; CHECK-CVT-NEXT: csel x6, x10, x9, gt
2400 ; CHECK-CVT-NEXT: cmp x11, x8
2401 ; CHECK-CVT-NEXT: fcvt s0, h0
2402 ; CHECK-CVT-NEXT: csel x10, x11, x8, lt
2403 ; CHECK-CVT-NEXT: fcvtzs x11, s2
2404 ; CHECK-CVT-NEXT: cmp x10, x9
2405 ; CHECK-CVT-NEXT: csel x7, x10, x9, gt
2406 ; CHECK-CVT-NEXT: cmp x12, x8
2407 ; CHECK-CVT-NEXT: csel x10, x12, x8, lt
2408 ; CHECK-CVT-NEXT: fcvtzs x12, s1
2409 ; CHECK-CVT-NEXT: cmp x10, x9
2410 ; CHECK-CVT-NEXT: csel x0, x10, x9, gt
2411 ; CHECK-CVT-NEXT: cmp x11, x8
2412 ; CHECK-CVT-NEXT: csel x10, x11, x8, lt
2413 ; CHECK-CVT-NEXT: fcvtzs x11, s0
2414 ; CHECK-CVT-NEXT: cmp x10, x9
2415 ; CHECK-CVT-NEXT: csel x1, x10, x9, gt
2416 ; CHECK-CVT-NEXT: cmp x12, x8
2417 ; CHECK-CVT-NEXT: csel x10, x12, x8, lt
2418 ; CHECK-CVT-NEXT: cmp x10, x9
2419 ; CHECK-CVT-NEXT: csel x2, x10, x9, gt
2420 ; CHECK-CVT-NEXT: cmp x11, x8
2421 ; CHECK-CVT-NEXT: csel x8, x11, x8, lt
2422 ; CHECK-CVT-NEXT: cmp x8, x9
2423 ; CHECK-CVT-NEXT: csel x3, x8, x9, gt
2424 ; CHECK-CVT-NEXT: ret
2426 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i50:
2427 ; CHECK-FP16: // %bb.0:
2428 ; CHECK-FP16-NEXT: ext v1.16b, v0.16b, v0.16b, #8
2429 ; CHECK-FP16-NEXT: mov x8, #562949953421311 // =0x1ffffffffffff
2430 ; CHECK-FP16-NEXT: mov x9, #-562949953421312 // =0xfffe000000000000
2431 ; CHECK-FP16-NEXT: mov h2, v1.h[1]
2432 ; CHECK-FP16-NEXT: fcvtzs x10, h1
2433 ; CHECK-FP16-NEXT: mov h3, v1.h[2]
2434 ; CHECK-FP16-NEXT: mov h1, v1.h[3]
2435 ; CHECK-FP16-NEXT: fcvtzs x11, h2
2436 ; CHECK-FP16-NEXT: cmp x10, x8
2437 ; CHECK-FP16-NEXT: fcvtzs x12, h3
2438 ; CHECK-FP16-NEXT: csel x10, x10, x8, lt
2439 ; CHECK-FP16-NEXT: mov h2, v0.h[2]
2440 ; CHECK-FP16-NEXT: cmp x10, x9
2441 ; CHECK-FP16-NEXT: csel x4, x10, x9, gt
2442 ; CHECK-FP16-NEXT: cmp x11, x8
2443 ; CHECK-FP16-NEXT: csel x10, x11, x8, lt
2444 ; CHECK-FP16-NEXT: fcvtzs x11, h1
2445 ; CHECK-FP16-NEXT: mov h1, v0.h[1]
2446 ; CHECK-FP16-NEXT: cmp x10, x9
2447 ; CHECK-FP16-NEXT: csel x5, x10, x9, gt
2448 ; CHECK-FP16-NEXT: cmp x12, x8
2449 ; CHECK-FP16-NEXT: csel x10, x12, x8, lt
2450 ; CHECK-FP16-NEXT: fcvtzs x12, h0
2451 ; CHECK-FP16-NEXT: mov h0, v0.h[3]
2452 ; CHECK-FP16-NEXT: cmp x10, x9
2453 ; CHECK-FP16-NEXT: csel x6, x10, x9, gt
2454 ; CHECK-FP16-NEXT: cmp x11, x8
2455 ; CHECK-FP16-NEXT: csel x10, x11, x8, lt
2456 ; CHECK-FP16-NEXT: fcvtzs x11, h1
2457 ; CHECK-FP16-NEXT: cmp x10, x9
2458 ; CHECK-FP16-NEXT: csel x7, x10, x9, gt
2459 ; CHECK-FP16-NEXT: cmp x12, x8
2460 ; CHECK-FP16-NEXT: csel x10, x12, x8, lt
2461 ; CHECK-FP16-NEXT: fcvtzs x12, h2
2462 ; CHECK-FP16-NEXT: cmp x10, x9
2463 ; CHECK-FP16-NEXT: csel x0, x10, x9, gt
2464 ; CHECK-FP16-NEXT: cmp x11, x8
2465 ; CHECK-FP16-NEXT: csel x10, x11, x8, lt
2466 ; CHECK-FP16-NEXT: fcvtzs x11, h0
2467 ; CHECK-FP16-NEXT: cmp x10, x9
2468 ; CHECK-FP16-NEXT: csel x1, x10, x9, gt
2469 ; CHECK-FP16-NEXT: cmp x12, x8
2470 ; CHECK-FP16-NEXT: csel x10, x12, x8, lt
2471 ; CHECK-FP16-NEXT: cmp x10, x9
2472 ; CHECK-FP16-NEXT: csel x2, x10, x9, gt
2473 ; CHECK-FP16-NEXT: cmp x11, x8
2474 ; CHECK-FP16-NEXT: csel x8, x11, x8, lt
2475 ; CHECK-FP16-NEXT: cmp x8, x9
2476 ; CHECK-FP16-NEXT: csel x3, x8, x9, gt
2477 ; CHECK-FP16-NEXT: ret
2478 %x = call <8 x i50> @llvm.fptosi.sat.v8f16.v8i50(<8 x half> %f)
2482 define <8 x i64> @test_signed_v8f16_v8i64(<8 x half> %f) {
2483 ; CHECK-CVT-LABEL: test_signed_v8f16_v8i64:
2484 ; CHECK-CVT: // %bb.0:
2485 ; CHECK-CVT-NEXT: ext v1.16b, v0.16b, v0.16b, #8
2486 ; CHECK-CVT-NEXT: mov h4, v0.h[2]
2487 ; CHECK-CVT-NEXT: mov h3, v0.h[1]
2488 ; CHECK-CVT-NEXT: mov h7, v0.h[3]
2489 ; CHECK-CVT-NEXT: fcvt s0, h0
2490 ; CHECK-CVT-NEXT: mov h2, v1.h[2]
2491 ; CHECK-CVT-NEXT: mov h5, v1.h[1]
2492 ; CHECK-CVT-NEXT: mov h6, v1.h[3]
2493 ; CHECK-CVT-NEXT: fcvt s1, h1
2494 ; CHECK-CVT-NEXT: fcvt s4, h4
2495 ; CHECK-CVT-NEXT: fcvt s3, h3
2496 ; CHECK-CVT-NEXT: fcvt s7, h7
2497 ; CHECK-CVT-NEXT: fcvtzs x9, s0
2498 ; CHECK-CVT-NEXT: fcvt s2, h2
2499 ; CHECK-CVT-NEXT: fcvt s5, h5
2500 ; CHECK-CVT-NEXT: fcvt s6, h6
2501 ; CHECK-CVT-NEXT: fcvtzs x8, s1
2502 ; CHECK-CVT-NEXT: fcvtzs x12, s4
2503 ; CHECK-CVT-NEXT: fcvtzs x11, s3
2504 ; CHECK-CVT-NEXT: fcvtzs x15, s7
2505 ; CHECK-CVT-NEXT: fmov d0, x9
2506 ; CHECK-CVT-NEXT: fcvtzs x10, s2
2507 ; CHECK-CVT-NEXT: fcvtzs x13, s5
2508 ; CHECK-CVT-NEXT: fcvtzs x14, s6
2509 ; CHECK-CVT-NEXT: fmov d2, x8
2510 ; CHECK-CVT-NEXT: fmov d1, x12
2511 ; CHECK-CVT-NEXT: mov v0.d[1], x11
2512 ; CHECK-CVT-NEXT: fmov d3, x10
2513 ; CHECK-CVT-NEXT: mov v2.d[1], x13
2514 ; CHECK-CVT-NEXT: mov v1.d[1], x15
2515 ; CHECK-CVT-NEXT: mov v3.d[1], x14
2516 ; CHECK-CVT-NEXT: ret
2518 ; CHECK-FP16-LABEL: test_signed_v8f16_v8i64:
2519 ; CHECK-FP16: // %bb.0:
2520 ; CHECK-FP16-NEXT: ext v1.16b, v0.16b, v0.16b, #8
2521 ; CHECK-FP16-NEXT: mov h4, v0.h[2]
2522 ; CHECK-FP16-NEXT: mov h3, v0.h[1]
2523 ; CHECK-FP16-NEXT: mov h7, v0.h[3]
2524 ; CHECK-FP16-NEXT: fcvtzs x9, h0
2525 ; CHECK-FP16-NEXT: mov h2, v1.h[2]
2526 ; CHECK-FP16-NEXT: mov h5, v1.h[1]
2527 ; CHECK-FP16-NEXT: mov h6, v1.h[3]
2528 ; CHECK-FP16-NEXT: fcvtzs x8, h1
2529 ; CHECK-FP16-NEXT: fcvtzs x12, h4
2530 ; CHECK-FP16-NEXT: fcvtzs x11, h3
2531 ; CHECK-FP16-NEXT: fcvtzs x15, h7
2532 ; CHECK-FP16-NEXT: fmov d0, x9
2533 ; CHECK-FP16-NEXT: fcvtzs x10, h2
2534 ; CHECK-FP16-NEXT: fcvtzs x13, h5
2535 ; CHECK-FP16-NEXT: fcvtzs x14, h6
2536 ; CHECK-FP16-NEXT: fmov d2, x8
2537 ; CHECK-FP16-NEXT: fmov d1, x12
2538 ; CHECK-FP16-NEXT: mov v0.d[1], x11
2539 ; CHECK-FP16-NEXT: fmov d3, x10
2540 ; CHECK-FP16-NEXT: mov v2.d[1], x13
2541 ; CHECK-FP16-NEXT: mov v1.d[1], x15
2542 ; CHECK-FP16-NEXT: mov v3.d[1], x14
2543 ; CHECK-FP16-NEXT: ret
2544 %x = call <8 x i64> @llvm.fptosi.sat.v8f16.v8i64(<8 x half> %f)
2548 define <8 x i100> @test_signed_v8f16_v8i100(<8 x half> %f) {
2549 ; CHECK-LABEL: test_signed_v8f16_v8i100:
2551 ; CHECK-NEXT: sub sp, sp, #192
2552 ; CHECK-NEXT: str d10, [sp, #64] // 8-byte Folded Spill
2553 ; CHECK-NEXT: stp d9, d8, [sp, #80] // 16-byte Folded Spill
2554 ; CHECK-NEXT: stp x29, x30, [sp, #96] // 16-byte Folded Spill
2555 ; CHECK-NEXT: stp x28, x27, [sp, #112] // 16-byte Folded Spill
2556 ; CHECK-NEXT: stp x26, x25, [sp, #128] // 16-byte Folded Spill
2557 ; CHECK-NEXT: stp x24, x23, [sp, #144] // 16-byte Folded Spill
2558 ; CHECK-NEXT: stp x22, x21, [sp, #160] // 16-byte Folded Spill
2559 ; CHECK-NEXT: stp x20, x19, [sp, #176] // 16-byte Folded Spill
2560 ; CHECK-NEXT: .cfi_def_cfa_offset 192
2561 ; CHECK-NEXT: .cfi_offset w19, -8
2562 ; CHECK-NEXT: .cfi_offset w20, -16
2563 ; CHECK-NEXT: .cfi_offset w21, -24
2564 ; CHECK-NEXT: .cfi_offset w22, -32
2565 ; CHECK-NEXT: .cfi_offset w23, -40
2566 ; CHECK-NEXT: .cfi_offset w24, -48
2567 ; CHECK-NEXT: .cfi_offset w25, -56
2568 ; CHECK-NEXT: .cfi_offset w26, -64
2569 ; CHECK-NEXT: .cfi_offset w27, -72
2570 ; CHECK-NEXT: .cfi_offset w28, -80
2571 ; CHECK-NEXT: .cfi_offset w30, -88
2572 ; CHECK-NEXT: .cfi_offset w29, -96
2573 ; CHECK-NEXT: .cfi_offset b8, -104
2574 ; CHECK-NEXT: .cfi_offset b9, -112
2575 ; CHECK-NEXT: .cfi_offset b10, -128
2576 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
2577 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
2578 ; CHECK-NEXT: mov x19, x8
2579 ; CHECK-NEXT: str q0, [sp, #32] // 16-byte Folded Spill
2580 ; CHECK-NEXT: mov h0, v0.h[1]
2581 ; CHECK-NEXT: fcvt s8, h0
2582 ; CHECK-NEXT: fmov s0, s8
2583 ; CHECK-NEXT: bl __fixsfti
2584 ; CHECK-NEXT: movi v10.2s, #241, lsl #24
2585 ; CHECK-NEXT: mov w8, #1895825407 // =0x70ffffff
2586 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2587 ; CHECK-NEXT: fmov s9, w8
2588 ; CHECK-NEXT: mov x22, #-34359738368 // =0xfffffff800000000
2589 ; CHECK-NEXT: mov x23, #34359738367 // =0x7ffffffff
2590 ; CHECK-NEXT: mov h0, v0.h[3]
2591 ; CHECK-NEXT: fcmp s8, s10
2592 ; CHECK-NEXT: csel x8, x22, x1, lt
2593 ; CHECK-NEXT: csel x9, xzr, x0, lt
2594 ; CHECK-NEXT: fcmp s8, s9
2595 ; CHECK-NEXT: csinv x9, x9, xzr, le
2596 ; CHECK-NEXT: csel x8, x23, x8, gt
2597 ; CHECK-NEXT: fcmp s8, s8
2598 ; CHECK-NEXT: fcvt s8, h0
2599 ; CHECK-NEXT: csel x8, xzr, x8, vs
2600 ; CHECK-NEXT: str x8, [sp, #72] // 8-byte Folded Spill
2601 ; CHECK-NEXT: csel x8, xzr, x9, vs
2602 ; CHECK-NEXT: fmov s0, s8
2603 ; CHECK-NEXT: str x8, [sp, #24] // 8-byte Folded Spill
2604 ; CHECK-NEXT: bl __fixsfti
2605 ; CHECK-NEXT: fcmp s8, s10
2606 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2607 ; CHECK-NEXT: csel x8, xzr, x0, lt
2608 ; CHECK-NEXT: csel x9, x22, x1, lt
2609 ; CHECK-NEXT: fcmp s8, s9
2610 ; CHECK-NEXT: csel x9, x23, x9, gt
2611 ; CHECK-NEXT: csinv x8, x8, xzr, le
2612 ; CHECK-NEXT: fcmp s8, s8
2613 ; CHECK-NEXT: fcvt s8, h0
2614 ; CHECK-NEXT: csel x10, xzr, x8, vs
2615 ; CHECK-NEXT: csel x8, xzr, x9, vs
2616 ; CHECK-NEXT: stp x8, x10, [sp, #8] // 16-byte Folded Spill
2617 ; CHECK-NEXT: fmov s0, s8
2618 ; CHECK-NEXT: bl __fixsfti
2619 ; CHECK-NEXT: fcmp s8, s10
2620 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2621 ; CHECK-NEXT: mov h0, v0.h[2]
2622 ; CHECK-NEXT: csel x8, x22, x1, lt
2623 ; CHECK-NEXT: csel x9, xzr, x0, lt
2624 ; CHECK-NEXT: fcmp s8, s9
2625 ; CHECK-NEXT: csinv x9, x9, xzr, le
2626 ; CHECK-NEXT: csel x8, x23, x8, gt
2627 ; CHECK-NEXT: fcmp s8, s8
2628 ; CHECK-NEXT: fcvt s8, h0
2629 ; CHECK-NEXT: csel x26, xzr, x8, vs
2630 ; CHECK-NEXT: csel x8, xzr, x9, vs
2631 ; CHECK-NEXT: str x8, [sp, #32] // 8-byte Folded Spill
2632 ; CHECK-NEXT: fmov s0, s8
2633 ; CHECK-NEXT: bl __fixsfti
2634 ; CHECK-NEXT: fcmp s8, s10
2635 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2636 ; CHECK-NEXT: mov h0, v0.h[1]
2637 ; CHECK-NEXT: csel x8, x22, x1, lt
2638 ; CHECK-NEXT: csel x9, xzr, x0, lt
2639 ; CHECK-NEXT: fcmp s8, s9
2640 ; CHECK-NEXT: csinv x9, x9, xzr, le
2641 ; CHECK-NEXT: csel x8, x23, x8, gt
2642 ; CHECK-NEXT: fcmp s8, s8
2643 ; CHECK-NEXT: fcvt s8, h0
2644 ; CHECK-NEXT: csel x27, xzr, x8, vs
2645 ; CHECK-NEXT: csel x8, xzr, x9, vs
2646 ; CHECK-NEXT: str x8, [sp] // 8-byte Folded Spill
2647 ; CHECK-NEXT: fmov s0, s8
2648 ; CHECK-NEXT: bl __fixsfti
2649 ; CHECK-NEXT: fcmp s8, s10
2650 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2651 ; CHECK-NEXT: mov h0, v0.h[3]
2652 ; CHECK-NEXT: csel x8, x22, x1, lt
2653 ; CHECK-NEXT: csel x9, xzr, x0, lt
2654 ; CHECK-NEXT: fcmp s8, s9
2655 ; CHECK-NEXT: csinv x9, x9, xzr, le
2656 ; CHECK-NEXT: csel x8, x23, x8, gt
2657 ; CHECK-NEXT: fcmp s8, s8
2658 ; CHECK-NEXT: fcvt s8, h0
2659 ; CHECK-NEXT: csel x20, xzr, x8, vs
2660 ; CHECK-NEXT: csel x21, xzr, x9, vs
2661 ; CHECK-NEXT: fmov s0, s8
2662 ; CHECK-NEXT: bl __fixsfti
2663 ; CHECK-NEXT: fcmp s8, s10
2664 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2665 ; CHECK-NEXT: csel x8, xzr, x0, lt
2666 ; CHECK-NEXT: csel x9, x22, x1, lt
2667 ; CHECK-NEXT: fcmp s8, s9
2668 ; CHECK-NEXT: csel x9, x23, x9, gt
2669 ; CHECK-NEXT: csinv x8, x8, xzr, le
2670 ; CHECK-NEXT: fcmp s8, s8
2671 ; CHECK-NEXT: fcvt s8, h0
2672 ; CHECK-NEXT: csel x28, xzr, x8, vs
2673 ; CHECK-NEXT: csel x24, xzr, x9, vs
2674 ; CHECK-NEXT: fmov s0, s8
2675 ; CHECK-NEXT: bl __fixsfti
2676 ; CHECK-NEXT: fcmp s8, s10
2677 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2678 ; CHECK-NEXT: mov h0, v0.h[2]
2679 ; CHECK-NEXT: csel x8, x22, x1, lt
2680 ; CHECK-NEXT: csel x9, xzr, x0, lt
2681 ; CHECK-NEXT: fcmp s8, s9
2682 ; CHECK-NEXT: csinv x9, x9, xzr, le
2683 ; CHECK-NEXT: csel x8, x23, x8, gt
2684 ; CHECK-NEXT: fcmp s8, s8
2685 ; CHECK-NEXT: fcvt s8, h0
2686 ; CHECK-NEXT: csel x25, xzr, x8, vs
2687 ; CHECK-NEXT: csel x29, xzr, x9, vs
2688 ; CHECK-NEXT: fmov s0, s8
2689 ; CHECK-NEXT: bl __fixsfti
2690 ; CHECK-NEXT: ldr x9, [sp] // 8-byte Folded Reload
2691 ; CHECK-NEXT: extr x8, x24, x28, #28
2692 ; CHECK-NEXT: fcmp s8, s10
2693 ; CHECK-NEXT: bfi x25, x21, #36, #28
2694 ; CHECK-NEXT: lsr x11, x20, #28
2695 ; CHECK-NEXT: stur x9, [x19, #75]
2696 ; CHECK-NEXT: extr x9, x20, x21, #28
2697 ; CHECK-NEXT: stur x8, [x19, #41]
2698 ; CHECK-NEXT: csel x8, x22, x1, lt
2699 ; CHECK-NEXT: str x9, [x19, #16]
2700 ; CHECK-NEXT: csel x9, xzr, x0, lt
2701 ; CHECK-NEXT: fcmp s8, s9
2702 ; CHECK-NEXT: ldr x10, [sp, #32] // 8-byte Folded Reload
2703 ; CHECK-NEXT: stp x29, x25, [x19]
2704 ; CHECK-NEXT: stur x10, [x19, #50]
2705 ; CHECK-NEXT: lsr x10, x24, #28
2706 ; CHECK-NEXT: csinv x9, x9, xzr, le
2707 ; CHECK-NEXT: csel x8, x23, x8, gt
2708 ; CHECK-NEXT: fcmp s8, s8
2709 ; CHECK-NEXT: strb w10, [x19, #49]
2710 ; CHECK-NEXT: ldp x14, x12, [sp, #8] // 16-byte Folded Reload
2711 ; CHECK-NEXT: strb w11, [x19, #24]
2712 ; CHECK-NEXT: csel x8, xzr, x8, vs
2713 ; CHECK-NEXT: ldr x13, [sp, #24] // 8-byte Folded Reload
2714 ; CHECK-NEXT: csel x9, xzr, x9, vs
2715 ; CHECK-NEXT: bfi x8, x28, #36, #28
2716 ; CHECK-NEXT: extr x10, x14, x12, #28
2717 ; CHECK-NEXT: bfi x27, x12, #36, #28
2718 ; CHECK-NEXT: ldr x12, [sp, #72] // 8-byte Folded Reload
2719 ; CHECK-NEXT: bfi x26, x13, #36, #28
2720 ; CHECK-NEXT: stur x9, [x19, #25]
2721 ; CHECK-NEXT: lsr x9, x14, #28
2722 ; CHECK-NEXT: extr x11, x12, x13, #28
2723 ; CHECK-NEXT: stur x8, [x19, #33]
2724 ; CHECK-NEXT: lsr x8, x12, #28
2725 ; CHECK-NEXT: stur x10, [x19, #91]
2726 ; CHECK-NEXT: stur x27, [x19, #83]
2727 ; CHECK-NEXT: stur x11, [x19, #66]
2728 ; CHECK-NEXT: stur x26, [x19, #58]
2729 ; CHECK-NEXT: strb w9, [x19, #99]
2730 ; CHECK-NEXT: strb w8, [x19, #74]
2731 ; CHECK-NEXT: ldp x20, x19, [sp, #176] // 16-byte Folded Reload
2732 ; CHECK-NEXT: ldr d10, [sp, #64] // 8-byte Folded Reload
2733 ; CHECK-NEXT: ldp x22, x21, [sp, #160] // 16-byte Folded Reload
2734 ; CHECK-NEXT: ldp x24, x23, [sp, #144] // 16-byte Folded Reload
2735 ; CHECK-NEXT: ldp x26, x25, [sp, #128] // 16-byte Folded Reload
2736 ; CHECK-NEXT: ldp x28, x27, [sp, #112] // 16-byte Folded Reload
2737 ; CHECK-NEXT: ldp x29, x30, [sp, #96] // 16-byte Folded Reload
2738 ; CHECK-NEXT: ldp d9, d8, [sp, #80] // 16-byte Folded Reload
2739 ; CHECK-NEXT: add sp, sp, #192
2741 %x = call <8 x i100> @llvm.fptosi.sat.v8f16.v8i100(<8 x half> %f)
2745 define <8 x i128> @test_signed_v8f16_v8i128(<8 x half> %f) {
2746 ; CHECK-LABEL: test_signed_v8f16_v8i128:
2748 ; CHECK-NEXT: sub sp, sp, #192
2749 ; CHECK-NEXT: str d10, [sp, #64] // 8-byte Folded Spill
2750 ; CHECK-NEXT: stp d9, d8, [sp, #80] // 16-byte Folded Spill
2751 ; CHECK-NEXT: stp x29, x30, [sp, #96] // 16-byte Folded Spill
2752 ; CHECK-NEXT: stp x28, x27, [sp, #112] // 16-byte Folded Spill
2753 ; CHECK-NEXT: stp x26, x25, [sp, #128] // 16-byte Folded Spill
2754 ; CHECK-NEXT: stp x24, x23, [sp, #144] // 16-byte Folded Spill
2755 ; CHECK-NEXT: stp x22, x21, [sp, #160] // 16-byte Folded Spill
2756 ; CHECK-NEXT: stp x20, x19, [sp, #176] // 16-byte Folded Spill
2757 ; CHECK-NEXT: .cfi_def_cfa_offset 192
2758 ; CHECK-NEXT: .cfi_offset w19, -8
2759 ; CHECK-NEXT: .cfi_offset w20, -16
2760 ; CHECK-NEXT: .cfi_offset w21, -24
2761 ; CHECK-NEXT: .cfi_offset w22, -32
2762 ; CHECK-NEXT: .cfi_offset w23, -40
2763 ; CHECK-NEXT: .cfi_offset w24, -48
2764 ; CHECK-NEXT: .cfi_offset w25, -56
2765 ; CHECK-NEXT: .cfi_offset w26, -64
2766 ; CHECK-NEXT: .cfi_offset w27, -72
2767 ; CHECK-NEXT: .cfi_offset w28, -80
2768 ; CHECK-NEXT: .cfi_offset w30, -88
2769 ; CHECK-NEXT: .cfi_offset w29, -96
2770 ; CHECK-NEXT: .cfi_offset b8, -104
2771 ; CHECK-NEXT: .cfi_offset b9, -112
2772 ; CHECK-NEXT: .cfi_offset b10, -128
2773 ; CHECK-NEXT: str q0, [sp, #48] // 16-byte Folded Spill
2774 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
2775 ; CHECK-NEXT: mov x19, x8
2776 ; CHECK-NEXT: fcvt s8, h0
2777 ; CHECK-NEXT: str q0, [sp, #32] // 16-byte Folded Spill
2778 ; CHECK-NEXT: fmov s0, s8
2779 ; CHECK-NEXT: bl __fixsfti
2780 ; CHECK-NEXT: movi v9.2s, #255, lsl #24
2781 ; CHECK-NEXT: mov w8, #2130706431 // =0x7effffff
2782 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2783 ; CHECK-NEXT: fmov s10, w8
2784 ; CHECK-NEXT: mov x22, #-9223372036854775808 // =0x8000000000000000
2785 ; CHECK-NEXT: mov x23, #9223372036854775807 // =0x7fffffffffffffff
2786 ; CHECK-NEXT: mov h0, v0.h[1]
2787 ; CHECK-NEXT: fcmp s8, s9
2788 ; CHECK-NEXT: csel x8, xzr, x0, lt
2789 ; CHECK-NEXT: csel x9, x22, x1, lt
2790 ; CHECK-NEXT: fcmp s8, s10
2791 ; CHECK-NEXT: csel x9, x23, x9, gt
2792 ; CHECK-NEXT: csinv x8, x8, xzr, le
2793 ; CHECK-NEXT: fcmp s8, s8
2794 ; CHECK-NEXT: fcvt s8, h0
2795 ; CHECK-NEXT: csel x8, xzr, x8, vs
2796 ; CHECK-NEXT: str x8, [sp, #72] // 8-byte Folded Spill
2797 ; CHECK-NEXT: csel x8, xzr, x9, vs
2798 ; CHECK-NEXT: fmov s0, s8
2799 ; CHECK-NEXT: str x8, [sp, #24] // 8-byte Folded Spill
2800 ; CHECK-NEXT: bl __fixsfti
2801 ; CHECK-NEXT: fcmp s8, s9
2802 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2803 ; CHECK-NEXT: mov h0, v0.h[2]
2804 ; CHECK-NEXT: csel x8, xzr, x0, lt
2805 ; CHECK-NEXT: csel x9, x22, x1, lt
2806 ; CHECK-NEXT: fcmp s8, s10
2807 ; CHECK-NEXT: csel x9, x23, x9, gt
2808 ; CHECK-NEXT: csinv x8, x8, xzr, le
2809 ; CHECK-NEXT: fcmp s8, s8
2810 ; CHECK-NEXT: fcvt s8, h0
2811 ; CHECK-NEXT: csel x10, xzr, x8, vs
2812 ; CHECK-NEXT: csel x8, xzr, x9, vs
2813 ; CHECK-NEXT: stp x8, x10, [sp, #8] // 16-byte Folded Spill
2814 ; CHECK-NEXT: fmov s0, s8
2815 ; CHECK-NEXT: bl __fixsfti
2816 ; CHECK-NEXT: fcmp s8, s9
2817 ; CHECK-NEXT: ldr q0, [sp, #32] // 16-byte Folded Reload
2818 ; CHECK-NEXT: mov h0, v0.h[3]
2819 ; CHECK-NEXT: csel x8, xzr, x0, lt
2820 ; CHECK-NEXT: csel x9, x22, x1, lt
2821 ; CHECK-NEXT: fcmp s8, s10
2822 ; CHECK-NEXT: csel x9, x23, x9, gt
2823 ; CHECK-NEXT: csinv x8, x8, xzr, le
2824 ; CHECK-NEXT: fcmp s8, s8
2825 ; CHECK-NEXT: fcvt s8, h0
2826 ; CHECK-NEXT: csel x8, xzr, x8, vs
2827 ; CHECK-NEXT: str x8, [sp, #32] // 8-byte Folded Spill
2828 ; CHECK-NEXT: csel x8, xzr, x9, vs
2829 ; CHECK-NEXT: fmov s0, s8
2830 ; CHECK-NEXT: str x8, [sp] // 8-byte Folded Spill
2831 ; CHECK-NEXT: bl __fixsfti
2832 ; CHECK-NEXT: fcmp s8, s9
2833 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2834 ; CHECK-NEXT: csel x8, xzr, x0, lt
2835 ; CHECK-NEXT: csel x9, x22, x1, lt
2836 ; CHECK-NEXT: fcmp s8, s10
2837 ; CHECK-NEXT: csel x9, x23, x9, gt
2838 ; CHECK-NEXT: csinv x8, x8, xzr, le
2839 ; CHECK-NEXT: fcmp s8, s8
2840 ; CHECK-NEXT: fcvt s8, h0
2841 ; CHECK-NEXT: csel x28, xzr, x8, vs
2842 ; CHECK-NEXT: csel x29, xzr, x9, vs
2843 ; CHECK-NEXT: fmov s0, s8
2844 ; CHECK-NEXT: bl __fixsfti
2845 ; CHECK-NEXT: fcmp s8, s9
2846 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2847 ; CHECK-NEXT: mov h0, v0.h[1]
2848 ; CHECK-NEXT: csel x8, xzr, x0, lt
2849 ; CHECK-NEXT: csel x9, x22, x1, lt
2850 ; CHECK-NEXT: fcmp s8, s10
2851 ; CHECK-NEXT: csel x9, x23, x9, gt
2852 ; CHECK-NEXT: csinv x8, x8, xzr, le
2853 ; CHECK-NEXT: fcmp s8, s8
2854 ; CHECK-NEXT: fcvt s8, h0
2855 ; CHECK-NEXT: csel x20, xzr, x8, vs
2856 ; CHECK-NEXT: csel x21, xzr, x9, vs
2857 ; CHECK-NEXT: fmov s0, s8
2858 ; CHECK-NEXT: bl __fixsfti
2859 ; CHECK-NEXT: fcmp s8, s9
2860 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2861 ; CHECK-NEXT: mov h0, v0.h[2]
2862 ; CHECK-NEXT: csel x8, xzr, x0, lt
2863 ; CHECK-NEXT: csel x9, x22, x1, lt
2864 ; CHECK-NEXT: fcmp s8, s10
2865 ; CHECK-NEXT: csel x9, x23, x9, gt
2866 ; CHECK-NEXT: csinv x8, x8, xzr, le
2867 ; CHECK-NEXT: fcmp s8, s8
2868 ; CHECK-NEXT: fcvt s8, h0
2869 ; CHECK-NEXT: csel x24, xzr, x8, vs
2870 ; CHECK-NEXT: csel x25, xzr, x9, vs
2871 ; CHECK-NEXT: fmov s0, s8
2872 ; CHECK-NEXT: bl __fixsfti
2873 ; CHECK-NEXT: fcmp s8, s9
2874 ; CHECK-NEXT: ldr q0, [sp, #48] // 16-byte Folded Reload
2875 ; CHECK-NEXT: mov h0, v0.h[3]
2876 ; CHECK-NEXT: csel x8, xzr, x0, lt
2877 ; CHECK-NEXT: csel x9, x22, x1, lt
2878 ; CHECK-NEXT: fcmp s8, s10
2879 ; CHECK-NEXT: csel x9, x23, x9, gt
2880 ; CHECK-NEXT: csinv x8, x8, xzr, le
2881 ; CHECK-NEXT: fcmp s8, s8
2882 ; CHECK-NEXT: fcvt s8, h0
2883 ; CHECK-NEXT: csel x26, xzr, x8, vs
2884 ; CHECK-NEXT: csel x27, xzr, x9, vs
2885 ; CHECK-NEXT: fmov s0, s8
2886 ; CHECK-NEXT: bl __fixsfti
2887 ; CHECK-NEXT: fcmp s8, s9
2888 ; CHECK-NEXT: stp x26, x27, [x19, #32]
2889 ; CHECK-NEXT: stp x24, x25, [x19, #16]
2890 ; CHECK-NEXT: stp x20, x21, [x19]
2891 ; CHECK-NEXT: csel x8, xzr, x0, lt
2892 ; CHECK-NEXT: csel x9, x22, x1, lt
2893 ; CHECK-NEXT: fcmp s8, s10
2894 ; CHECK-NEXT: stp x28, x29, [x19, #112]
2895 ; CHECK-NEXT: csel x9, x23, x9, gt
2896 ; CHECK-NEXT: csinv x8, x8, xzr, le
2897 ; CHECK-NEXT: fcmp s8, s8
2898 ; CHECK-NEXT: csel x9, xzr, x9, vs
2899 ; CHECK-NEXT: csel x8, xzr, x8, vs
2900 ; CHECK-NEXT: stp x8, x9, [x19, #48]
2901 ; CHECK-NEXT: ldr x8, [sp] // 8-byte Folded Reload
2902 ; CHECK-NEXT: str x8, [x19, #104]
2903 ; CHECK-NEXT: ldr x8, [sp, #32] // 8-byte Folded Reload
2904 ; CHECK-NEXT: str x8, [x19, #96]
2905 ; CHECK-NEXT: ldr x8, [sp, #8] // 8-byte Folded Reload
2906 ; CHECK-NEXT: str x8, [x19, #88]
2907 ; CHECK-NEXT: ldr x8, [sp, #16] // 8-byte Folded Reload
2908 ; CHECK-NEXT: str x8, [x19, #80]
2909 ; CHECK-NEXT: ldr x8, [sp, #24] // 8-byte Folded Reload
2910 ; CHECK-NEXT: str x8, [x19, #72]
2911 ; CHECK-NEXT: ldr x8, [sp, #72] // 8-byte Folded Reload
2912 ; CHECK-NEXT: str x8, [x19, #64]
2913 ; CHECK-NEXT: ldp x20, x19, [sp, #176] // 16-byte Folded Reload
2914 ; CHECK-NEXT: ldr d10, [sp, #64] // 8-byte Folded Reload
2915 ; CHECK-NEXT: ldp x22, x21, [sp, #160] // 16-byte Folded Reload
2916 ; CHECK-NEXT: ldp x24, x23, [sp, #144] // 16-byte Folded Reload
2917 ; CHECK-NEXT: ldp x26, x25, [sp, #128] // 16-byte Folded Reload
2918 ; CHECK-NEXT: ldp x28, x27, [sp, #112] // 16-byte Folded Reload
2919 ; CHECK-NEXT: ldp x29, x30, [sp, #96] // 16-byte Folded Reload
2920 ; CHECK-NEXT: ldp d9, d8, [sp, #80] // 16-byte Folded Reload
2921 ; CHECK-NEXT: add sp, sp, #192
2923 %x = call <8 x i128> @llvm.fptosi.sat.v8f16.v8i128(<8 x half> %f)
2928 declare <8 x i8> @llvm.fptosi.sat.v8f32.v8i8(<8 x float> %f)
2929 declare <8 x i16> @llvm.fptosi.sat.v8f32.v8i16(<8 x float> %f)
2930 declare <16 x i8> @llvm.fptosi.sat.v16f32.v16i8(<16 x float> %f)
2931 declare <16 x i16> @llvm.fptosi.sat.v16f32.v16i16(<16 x float> %f)
2933 declare <16 x i8> @llvm.fptosi.sat.v16f16.v16i8(<16 x half> %f)
2934 declare <16 x i16> @llvm.fptosi.sat.v16f16.v16i16(<16 x half> %f)
2936 declare <8 x i8> @llvm.fptosi.sat.v8f64.v8i8(<8 x double> %f)
2937 declare <8 x i16> @llvm.fptosi.sat.v8f64.v8i16(<8 x double> %f)
2938 declare <16 x i8> @llvm.fptosi.sat.v16f64.v16i8(<16 x double> %f)
2939 declare <16 x i16> @llvm.fptosi.sat.v16f64.v16i16(<16 x double> %f)
2941 define <8 x i8> @test_signed_v8f32_v8i8(<8 x float> %f) {
2942 ; CHECK-LABEL: test_signed_v8f32_v8i8:
2944 ; CHECK-NEXT: movi v2.4s, #127
2945 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
2946 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
2947 ; CHECK-NEXT: smin v1.4s, v1.4s, v2.4s
2948 ; CHECK-NEXT: smin v0.4s, v0.4s, v2.4s
2949 ; CHECK-NEXT: mvni v2.4s, #127
2950 ; CHECK-NEXT: smax v1.4s, v1.4s, v2.4s
2951 ; CHECK-NEXT: smax v0.4s, v0.4s, v2.4s
2952 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
2953 ; CHECK-NEXT: xtn v0.8b, v0.8h
2955 %x = call <8 x i8> @llvm.fptosi.sat.v8f32.v8i8(<8 x float> %f)
2959 define <16 x i8> @test_signed_v16f32_v16i8(<16 x float> %f) {
2960 ; CHECK-LABEL: test_signed_v16f32_v16i8:
2962 ; CHECK-NEXT: movi v4.4s, #127
2963 ; CHECK-NEXT: fcvtzs v3.4s, v3.4s
2964 ; CHECK-NEXT: fcvtzs v2.4s, v2.4s
2965 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
2966 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
2967 ; CHECK-NEXT: mvni v5.4s, #127
2968 ; CHECK-NEXT: smin v3.4s, v3.4s, v4.4s
2969 ; CHECK-NEXT: smin v2.4s, v2.4s, v4.4s
2970 ; CHECK-NEXT: smin v1.4s, v1.4s, v4.4s
2971 ; CHECK-NEXT: smin v0.4s, v0.4s, v4.4s
2972 ; CHECK-NEXT: smax v3.4s, v3.4s, v5.4s
2973 ; CHECK-NEXT: smax v2.4s, v2.4s, v5.4s
2974 ; CHECK-NEXT: smax v1.4s, v1.4s, v5.4s
2975 ; CHECK-NEXT: smax v0.4s, v0.4s, v5.4s
2976 ; CHECK-NEXT: uzp1 v2.8h, v2.8h, v3.8h
2977 ; CHECK-NEXT: uzp1 v0.8h, v0.8h, v1.8h
2978 ; CHECK-NEXT: uzp1 v0.16b, v0.16b, v2.16b
2980 %x = call <16 x i8> @llvm.fptosi.sat.v16f32.v16i8(<16 x float> %f)
2984 define <8 x i16> @test_signed_v8f32_v8i16(<8 x float> %f) {
2985 ; CHECK-LABEL: test_signed_v8f32_v8i16:
2987 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
2988 ; CHECK-NEXT: fcvtzs v1.4s, v1.4s
2989 ; CHECK-NEXT: sqxtn v0.4h, v0.4s
2990 ; CHECK-NEXT: sqxtn2 v0.8h, v1.4s
2992 %x = call <8 x i16> @llvm.fptosi.sat.v8f32.v8i16(<8 x float> %f)
2996 define <16 x i16> @test_signed_v16f32_v16i16(<16 x float> %f) {
2997 ; CHECK-LABEL: test_signed_v16f32_v16i16:
2999 ; CHECK-NEXT: fcvtzs v0.4s, v0.4s
3000 ; CHECK-NEXT: fcvtzs v2.4s, v2.4s
3001 ; CHECK-NEXT: fcvtzs v4.4s, v1.4s
3002 ; CHECK-NEXT: sqxtn v0.4h, v0.4s
3003 ; CHECK-NEXT: sqxtn v1.4h, v2.4s
3004 ; CHECK-NEXT: fcvtzs v2.4s, v3.4s
3005 ; CHECK-NEXT: sqxtn2 v0.8h, v4.4s
3006 ; CHECK-NEXT: sqxtn2 v1.8h, v2.4s
3008 %x = call <16 x i16> @llvm.fptosi.sat.v16f32.v16i16(<16 x float> %f)
3014 define <16 x i8> @test_signed_v16f16_v16i8(<16 x half> %f) {
3015 ; CHECK-CVT-LABEL: test_signed_v16f16_v16i8:
3016 ; CHECK-CVT: // %bb.0:
3017 ; CHECK-CVT-NEXT: fcvtl2 v2.4s, v1.8h
3018 ; CHECK-CVT-NEXT: mov w8, #127 // =0x7f
3019 ; CHECK-CVT-NEXT: fcvtl v1.4s, v1.4h
3020 ; CHECK-CVT-NEXT: mov s3, v2.s[1]
3021 ; CHECK-CVT-NEXT: fcvtzs w10, s2
3022 ; CHECK-CVT-NEXT: fcvtzs w16, s1
3023 ; CHECK-CVT-NEXT: fcvtzs w9, s3
3024 ; CHECK-CVT-NEXT: mov s3, v2.s[2]
3025 ; CHECK-CVT-NEXT: mov s2, v2.s[3]
3026 ; CHECK-CVT-NEXT: cmp w9, #127
3027 ; CHECK-CVT-NEXT: fcvtzs w12, s3
3028 ; CHECK-CVT-NEXT: mov s3, v1.s[1]
3029 ; CHECK-CVT-NEXT: csel w11, w9, w8, lt
3030 ; CHECK-CVT-NEXT: mov w9, #-128 // =0xffffff80
3031 ; CHECK-CVT-NEXT: fcvtzs w14, s2
3032 ; CHECK-CVT-NEXT: cmn w11, #128
3033 ; CHECK-CVT-NEXT: mov s2, v1.s[2]
3034 ; CHECK-CVT-NEXT: mov s1, v1.s[3]
3035 ; CHECK-CVT-NEXT: csel w11, w11, w9, gt
3036 ; CHECK-CVT-NEXT: cmp w10, #127
3037 ; CHECK-CVT-NEXT: csel w10, w10, w8, lt
3038 ; CHECK-CVT-NEXT: fcvtzs w15, s3
3039 ; CHECK-CVT-NEXT: fcvtl2 v3.4s, v0.8h
3040 ; CHECK-CVT-NEXT: cmn w10, #128
3041 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
3042 ; CHECK-CVT-NEXT: csel w13, w10, w9, gt
3043 ; CHECK-CVT-NEXT: cmp w12, #127
3044 ; CHECK-CVT-NEXT: fcvtzs w17, s1
3045 ; CHECK-CVT-NEXT: csel w10, w12, w8, lt
3046 ; CHECK-CVT-NEXT: cmn w10, #128
3047 ; CHECK-CVT-NEXT: mov s1, v3.s[2]
3048 ; CHECK-CVT-NEXT: fcvtzs w0, s3
3049 ; CHECK-CVT-NEXT: csel w10, w10, w9, gt
3050 ; CHECK-CVT-NEXT: cmp w14, #127
3051 ; CHECK-CVT-NEXT: fcvtzs w4, s0
3052 ; CHECK-CVT-NEXT: csel w12, w14, w8, lt
3053 ; CHECK-CVT-NEXT: cmn w12, #128
3054 ; CHECK-CVT-NEXT: csel w12, w12, w9, gt
3055 ; CHECK-CVT-NEXT: cmp w15, #127
3056 ; CHECK-CVT-NEXT: fcvtzs w1, s1
3057 ; CHECK-CVT-NEXT: csel w14, w15, w8, lt
3058 ; CHECK-CVT-NEXT: fcvtzs w15, s2
3059 ; CHECK-CVT-NEXT: mov s2, v3.s[1]
3060 ; CHECK-CVT-NEXT: cmn w14, #128
3061 ; CHECK-CVT-NEXT: mov s1, v0.s[1]
3062 ; CHECK-CVT-NEXT: csel w14, w14, w9, gt
3063 ; CHECK-CVT-NEXT: cmp w16, #127
3064 ; CHECK-CVT-NEXT: csel w16, w16, w8, lt
3065 ; CHECK-CVT-NEXT: cmn w16, #128
3066 ; CHECK-CVT-NEXT: fcvtzs w18, s2
3067 ; CHECK-CVT-NEXT: mov s2, v3.s[3]
3068 ; CHECK-CVT-NEXT: csel w16, w16, w9, gt
3069 ; CHECK-CVT-NEXT: cmp w15, #127
3070 ; CHECK-CVT-NEXT: fcvtzs w3, s1
3071 ; CHECK-CVT-NEXT: csel w15, w15, w8, lt
3072 ; CHECK-CVT-NEXT: mov s1, v0.s[2]
3073 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
3074 ; CHECK-CVT-NEXT: cmn w15, #128
3075 ; CHECK-CVT-NEXT: csel w15, w15, w9, gt
3076 ; CHECK-CVT-NEXT: cmp w17, #127
3077 ; CHECK-CVT-NEXT: fcvtzs w2, s2
3078 ; CHECK-CVT-NEXT: csel w17, w17, w8, lt
3079 ; CHECK-CVT-NEXT: fmov s2, w13
3080 ; CHECK-CVT-NEXT: cmn w17, #128
3081 ; CHECK-CVT-NEXT: csel w17, w17, w9, gt
3082 ; CHECK-CVT-NEXT: cmp w18, #127
3083 ; CHECK-CVT-NEXT: csel w18, w18, w8, lt
3084 ; CHECK-CVT-NEXT: mov v2.s[1], w11
3085 ; CHECK-CVT-NEXT: cmn w18, #128
3086 ; CHECK-CVT-NEXT: csel w18, w18, w9, gt
3087 ; CHECK-CVT-NEXT: cmp w0, #127
3088 ; CHECK-CVT-NEXT: csel w0, w0, w8, lt
3089 ; CHECK-CVT-NEXT: cmn w0, #128
3090 ; CHECK-CVT-NEXT: mov v2.s[2], w10
3091 ; CHECK-CVT-NEXT: csel w0, w0, w9, gt
3092 ; CHECK-CVT-NEXT: cmp w1, #127
3093 ; CHECK-CVT-NEXT: csel w1, w1, w8, lt
3094 ; CHECK-CVT-NEXT: fmov s3, w0
3095 ; CHECK-CVT-NEXT: cmn w1, #128
3096 ; CHECK-CVT-NEXT: csel w1, w1, w9, gt
3097 ; CHECK-CVT-NEXT: cmp w2, #127
3098 ; CHECK-CVT-NEXT: mov v2.s[3], w12
3099 ; CHECK-CVT-NEXT: csel w2, w2, w8, lt
3100 ; CHECK-CVT-NEXT: mov v3.s[1], w18
3101 ; CHECK-CVT-NEXT: cmn w2, #128
3102 ; CHECK-CVT-NEXT: csel w2, w2, w9, gt
3103 ; CHECK-CVT-NEXT: cmp w3, #127
3104 ; CHECK-CVT-NEXT: csel w3, w3, w8, lt
3105 ; CHECK-CVT-NEXT: cmn w3, #128
3106 ; CHECK-CVT-NEXT: mov v3.s[2], w1
3107 ; CHECK-CVT-NEXT: csel w13, w3, w9, gt
3108 ; CHECK-CVT-NEXT: cmp w4, #127
3109 ; CHECK-CVT-NEXT: csel w3, w4, w8, lt
3110 ; CHECK-CVT-NEXT: fcvtzs w4, s1
3111 ; CHECK-CVT-NEXT: fmov s1, w16
3112 ; CHECK-CVT-NEXT: cmn w3, #128
3113 ; CHECK-CVT-NEXT: csel w11, w3, w9, gt
3114 ; CHECK-CVT-NEXT: mov v3.s[3], w2
3115 ; CHECK-CVT-NEXT: fmov s4, w11
3116 ; CHECK-CVT-NEXT: mov v1.s[1], w14
3117 ; CHECK-CVT-NEXT: fcvtzs w11, s0
3118 ; CHECK-CVT-NEXT: cmp w4, #127
3119 ; CHECK-CVT-NEXT: mov v4.s[1], w13
3120 ; CHECK-CVT-NEXT: csel w13, w4, w8, lt
3121 ; CHECK-CVT-NEXT: cmn w13, #128
3122 ; CHECK-CVT-NEXT: mov v1.s[2], w15
3123 ; CHECK-CVT-NEXT: csel w10, w13, w9, gt
3124 ; CHECK-CVT-NEXT: cmp w11, #127
3125 ; CHECK-CVT-NEXT: csel w8, w11, w8, lt
3126 ; CHECK-CVT-NEXT: mov v4.s[2], w10
3127 ; CHECK-CVT-NEXT: cmn w8, #128
3128 ; CHECK-CVT-NEXT: csel w8, w8, w9, gt
3129 ; CHECK-CVT-NEXT: mov v1.s[3], w17
3130 ; CHECK-CVT-NEXT: mov v4.s[3], w8
3131 ; CHECK-CVT-NEXT: uzp1 v0.8h, v1.8h, v2.8h
3132 ; CHECK-CVT-NEXT: uzp1 v1.8h, v4.8h, v3.8h
3133 ; CHECK-CVT-NEXT: uzp1 v0.16b, v1.16b, v0.16b
3134 ; CHECK-CVT-NEXT: ret
3136 ; CHECK-FP16-LABEL: test_signed_v16f16_v16i8:
3137 ; CHECK-FP16: // %bb.0:
3138 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
3139 ; CHECK-FP16-NEXT: fcvtzs v1.8h, v1.8h
3140 ; CHECK-FP16-NEXT: sqxtn v0.8b, v0.8h
3141 ; CHECK-FP16-NEXT: sqxtn2 v0.16b, v1.8h
3142 ; CHECK-FP16-NEXT: ret
3143 %x = call <16 x i8> @llvm.fptosi.sat.v16f16.v16i8(<16 x half> %f)
3147 define <16 x i16> @test_signed_v16f16_v16i16(<16 x half> %f) {
3148 ; CHECK-CVT-LABEL: test_signed_v16f16_v16i16:
3149 ; CHECK-CVT: // %bb.0:
3150 ; CHECK-CVT-NEXT: fcvtl2 v2.4s, v0.8h
3151 ; CHECK-CVT-NEXT: mov w8, #32767 // =0x7fff
3152 ; CHECK-CVT-NEXT: fcvtl v0.4s, v0.4h
3153 ; CHECK-CVT-NEXT: mov s3, v2.s[1]
3154 ; CHECK-CVT-NEXT: fcvtzs w10, s2
3155 ; CHECK-CVT-NEXT: fcvtzs w16, s0
3156 ; CHECK-CVT-NEXT: fcvtzs w9, s3
3157 ; CHECK-CVT-NEXT: mov s3, v2.s[2]
3158 ; CHECK-CVT-NEXT: mov s2, v2.s[3]
3159 ; CHECK-CVT-NEXT: cmp w9, w8
3160 ; CHECK-CVT-NEXT: fcvtzs w12, s3
3161 ; CHECK-CVT-NEXT: mov s3, v0.s[1]
3162 ; CHECK-CVT-NEXT: csel w11, w9, w8, lt
3163 ; CHECK-CVT-NEXT: mov w9, #-32768 // =0xffff8000
3164 ; CHECK-CVT-NEXT: fcvtzs w14, s2
3165 ; CHECK-CVT-NEXT: cmn w11, #8, lsl #12 // =32768
3166 ; CHECK-CVT-NEXT: mov s2, v0.s[2]
3167 ; CHECK-CVT-NEXT: mov s0, v0.s[3]
3168 ; CHECK-CVT-NEXT: csel w11, w11, w9, gt
3169 ; CHECK-CVT-NEXT: cmp w10, w8
3170 ; CHECK-CVT-NEXT: csel w10, w10, w8, lt
3171 ; CHECK-CVT-NEXT: fcvtzs w15, s3
3172 ; CHECK-CVT-NEXT: fcvtl2 v3.4s, v1.8h
3173 ; CHECK-CVT-NEXT: cmn w10, #8, lsl #12 // =32768
3174 ; CHECK-CVT-NEXT: fcvtl v1.4s, v1.4h
3175 ; CHECK-CVT-NEXT: csel w13, w10, w9, gt
3176 ; CHECK-CVT-NEXT: cmp w12, w8
3177 ; CHECK-CVT-NEXT: fcvtzs w17, s0
3178 ; CHECK-CVT-NEXT: csel w10, w12, w8, lt
3179 ; CHECK-CVT-NEXT: cmn w10, #8, lsl #12 // =32768
3180 ; CHECK-CVT-NEXT: mov s0, v3.s[2]
3181 ; CHECK-CVT-NEXT: fcvtzs w0, s3
3182 ; CHECK-CVT-NEXT: csel w10, w10, w9, gt
3183 ; CHECK-CVT-NEXT: cmp w14, w8
3184 ; CHECK-CVT-NEXT: fcvtzs w4, s1
3185 ; CHECK-CVT-NEXT: csel w12, w14, w8, lt
3186 ; CHECK-CVT-NEXT: cmn w12, #8, lsl #12 // =32768
3187 ; CHECK-CVT-NEXT: csel w12, w12, w9, gt
3188 ; CHECK-CVT-NEXT: cmp w15, w8
3189 ; CHECK-CVT-NEXT: fcvtzs w1, s0
3190 ; CHECK-CVT-NEXT: csel w14, w15, w8, lt
3191 ; CHECK-CVT-NEXT: fcvtzs w15, s2
3192 ; CHECK-CVT-NEXT: mov s2, v3.s[1]
3193 ; CHECK-CVT-NEXT: cmn w14, #8, lsl #12 // =32768
3194 ; CHECK-CVT-NEXT: mov s0, v1.s[1]
3195 ; CHECK-CVT-NEXT: csel w14, w14, w9, gt
3196 ; CHECK-CVT-NEXT: cmp w16, w8
3197 ; CHECK-CVT-NEXT: csel w16, w16, w8, lt
3198 ; CHECK-CVT-NEXT: cmn w16, #8, lsl #12 // =32768
3199 ; CHECK-CVT-NEXT: fcvtzs w18, s2
3200 ; CHECK-CVT-NEXT: mov s2, v3.s[3]
3201 ; CHECK-CVT-NEXT: csel w16, w16, w9, gt
3202 ; CHECK-CVT-NEXT: cmp w15, w8
3203 ; CHECK-CVT-NEXT: fcvtzs w3, s0
3204 ; CHECK-CVT-NEXT: csel w15, w15, w8, lt
3205 ; CHECK-CVT-NEXT: mov s0, v1.s[2]
3206 ; CHECK-CVT-NEXT: cmn w15, #8, lsl #12 // =32768
3207 ; CHECK-CVT-NEXT: csel w15, w15, w9, gt
3208 ; CHECK-CVT-NEXT: cmp w17, w8
3209 ; CHECK-CVT-NEXT: fcvtzs w2, s2
3210 ; CHECK-CVT-NEXT: csel w17, w17, w8, lt
3211 ; CHECK-CVT-NEXT: fmov s2, w13
3212 ; CHECK-CVT-NEXT: cmn w17, #8, lsl #12 // =32768
3213 ; CHECK-CVT-NEXT: csel w17, w17, w9, gt
3214 ; CHECK-CVT-NEXT: cmp w18, w8
3215 ; CHECK-CVT-NEXT: csel w18, w18, w8, lt
3216 ; CHECK-CVT-NEXT: mov v2.s[1], w11
3217 ; CHECK-CVT-NEXT: cmn w18, #8, lsl #12 // =32768
3218 ; CHECK-CVT-NEXT: csel w18, w18, w9, gt
3219 ; CHECK-CVT-NEXT: cmp w0, w8
3220 ; CHECK-CVT-NEXT: csel w0, w0, w8, lt
3221 ; CHECK-CVT-NEXT: cmn w0, #8, lsl #12 // =32768
3222 ; CHECK-CVT-NEXT: mov v2.s[2], w10
3223 ; CHECK-CVT-NEXT: csel w0, w0, w9, gt
3224 ; CHECK-CVT-NEXT: cmp w1, w8
3225 ; CHECK-CVT-NEXT: csel w1, w1, w8, lt
3226 ; CHECK-CVT-NEXT: fmov s3, w0
3227 ; CHECK-CVT-NEXT: cmn w1, #8, lsl #12 // =32768
3228 ; CHECK-CVT-NEXT: csel w1, w1, w9, gt
3229 ; CHECK-CVT-NEXT: cmp w2, w8
3230 ; CHECK-CVT-NEXT: mov v2.s[3], w12
3231 ; CHECK-CVT-NEXT: csel w2, w2, w8, lt
3232 ; CHECK-CVT-NEXT: mov v3.s[1], w18
3233 ; CHECK-CVT-NEXT: cmn w2, #8, lsl #12 // =32768
3234 ; CHECK-CVT-NEXT: csel w2, w2, w9, gt
3235 ; CHECK-CVT-NEXT: cmp w3, w8
3236 ; CHECK-CVT-NEXT: csel w3, w3, w8, lt
3237 ; CHECK-CVT-NEXT: cmn w3, #8, lsl #12 // =32768
3238 ; CHECK-CVT-NEXT: mov v3.s[2], w1
3239 ; CHECK-CVT-NEXT: csel w13, w3, w9, gt
3240 ; CHECK-CVT-NEXT: cmp w4, w8
3241 ; CHECK-CVT-NEXT: csel w3, w4, w8, lt
3242 ; CHECK-CVT-NEXT: fcvtzs w4, s0
3243 ; CHECK-CVT-NEXT: mov s0, v1.s[3]
3244 ; CHECK-CVT-NEXT: cmn w3, #8, lsl #12 // =32768
3245 ; CHECK-CVT-NEXT: fmov s1, w16
3246 ; CHECK-CVT-NEXT: csel w11, w3, w9, gt
3247 ; CHECK-CVT-NEXT: mov v3.s[3], w2
3248 ; CHECK-CVT-NEXT: fmov s4, w11
3249 ; CHECK-CVT-NEXT: mov v1.s[1], w14
3250 ; CHECK-CVT-NEXT: cmp w4, w8
3251 ; CHECK-CVT-NEXT: fcvtzs w11, s0
3252 ; CHECK-CVT-NEXT: mov v4.s[1], w13
3253 ; CHECK-CVT-NEXT: csel w13, w4, w8, lt
3254 ; CHECK-CVT-NEXT: cmn w13, #8, lsl #12 // =32768
3255 ; CHECK-CVT-NEXT: csel w10, w13, w9, gt
3256 ; CHECK-CVT-NEXT: mov v1.s[2], w15
3257 ; CHECK-CVT-NEXT: cmp w11, w8
3258 ; CHECK-CVT-NEXT: csel w8, w11, w8, lt
3259 ; CHECK-CVT-NEXT: mov v4.s[2], w10
3260 ; CHECK-CVT-NEXT: cmn w8, #8, lsl #12 // =32768
3261 ; CHECK-CVT-NEXT: csel w8, w8, w9, gt
3262 ; CHECK-CVT-NEXT: mov v1.s[3], w17
3263 ; CHECK-CVT-NEXT: mov v4.s[3], w8
3264 ; CHECK-CVT-NEXT: uzp1 v0.8h, v1.8h, v2.8h
3265 ; CHECK-CVT-NEXT: uzp1 v1.8h, v4.8h, v3.8h
3266 ; CHECK-CVT-NEXT: ret
3268 ; CHECK-FP16-LABEL: test_signed_v16f16_v16i16:
3269 ; CHECK-FP16: // %bb.0:
3270 ; CHECK-FP16-NEXT: fcvtzs v0.8h, v0.8h
3271 ; CHECK-FP16-NEXT: fcvtzs v1.8h, v1.8h
3272 ; CHECK-FP16-NEXT: ret
3273 %x = call <16 x i16> @llvm.fptosi.sat.v16f16.v16i16(<16 x half> %f)
3277 define <8 x i8> @test_signed_v8f64_v8i8(<8 x double> %f) {
3278 ; CHECK-LABEL: test_signed_v8f64_v8i8:
3280 ; CHECK-NEXT: mov d4, v3.d[1]
3281 ; CHECK-NEXT: fcvtzs w11, d3
3282 ; CHECK-NEXT: mov w9, #127 // =0x7f
3283 ; CHECK-NEXT: mov d3, v1.d[1]
3284 ; CHECK-NEXT: fcvtzs w13, d2
3285 ; CHECK-NEXT: fcvtzs w15, d1
3286 ; CHECK-NEXT: fcvtzs w17, d0
3287 ; CHECK-NEXT: fcvtzs w8, d4
3288 ; CHECK-NEXT: mov d4, v2.d[1]
3289 ; CHECK-NEXT: mov d2, v0.d[1]
3290 ; CHECK-NEXT: fcvtzs w14, d3
3291 ; CHECK-NEXT: cmp w8, #127
3292 ; CHECK-NEXT: fcvtzs w12, d4
3293 ; CHECK-NEXT: fcvtzs w16, d2
3294 ; CHECK-NEXT: csel w10, w8, w9, lt
3295 ; CHECK-NEXT: mov w8, #-128 // =0xffffff80
3296 ; CHECK-NEXT: cmn w10, #128
3297 ; CHECK-NEXT: csel w10, w10, w8, gt
3298 ; CHECK-NEXT: cmp w11, #127
3299 ; CHECK-NEXT: csel w11, w11, w9, lt
3300 ; CHECK-NEXT: cmn w11, #128
3301 ; CHECK-NEXT: csel w11, w11, w8, gt
3302 ; CHECK-NEXT: cmp w12, #127
3303 ; CHECK-NEXT: csel w12, w12, w9, lt
3304 ; CHECK-NEXT: fmov s3, w11
3305 ; CHECK-NEXT: cmn w12, #128
3306 ; CHECK-NEXT: csel w12, w12, w8, gt
3307 ; CHECK-NEXT: cmp w13, #127
3308 ; CHECK-NEXT: csel w13, w13, w9, lt
3309 ; CHECK-NEXT: mov v3.s[1], w10
3310 ; CHECK-NEXT: cmn w13, #128
3311 ; CHECK-NEXT: csel w13, w13, w8, gt
3312 ; CHECK-NEXT: cmp w14, #127
3313 ; CHECK-NEXT: csel w14, w14, w9, lt
3314 ; CHECK-NEXT: fmov s2, w13
3315 ; CHECK-NEXT: cmn w14, #128
3316 ; CHECK-NEXT: csel w14, w14, w8, gt
3317 ; CHECK-NEXT: cmp w15, #127
3318 ; CHECK-NEXT: csel w15, w15, w9, lt
3319 ; CHECK-NEXT: mov v2.s[1], w12
3320 ; CHECK-NEXT: cmn w15, #128
3321 ; CHECK-NEXT: csel w15, w15, w8, gt
3322 ; CHECK-NEXT: cmp w16, #127
3323 ; CHECK-NEXT: csel w11, w16, w9, lt
3324 ; CHECK-NEXT: fmov s1, w15
3325 ; CHECK-NEXT: cmn w11, #128
3326 ; CHECK-NEXT: csel w10, w11, w8, gt
3327 ; CHECK-NEXT: cmp w17, #127
3328 ; CHECK-NEXT: csel w9, w17, w9, lt
3329 ; CHECK-NEXT: mov v1.s[1], w14
3330 ; CHECK-NEXT: cmn w9, #128
3331 ; CHECK-NEXT: csel w8, w9, w8, gt
3332 ; CHECK-NEXT: fmov s0, w8
3333 ; CHECK-NEXT: adrp x8, .LCPI82_0
3334 ; CHECK-NEXT: ldr d4, [x8, :lo12:.LCPI82_0]
3335 ; CHECK-NEXT: mov v0.s[1], w10
3336 ; CHECK-NEXT: tbl v0.8b, { v0.16b, v1.16b, v2.16b, v3.16b }, v4.8b
3338 %x = call <8 x i8> @llvm.fptosi.sat.v8f64.v8i8(<8 x double> %f)
3342 define <16 x i8> @test_signed_v16f64_v16i8(<16 x double> %f) {
3343 ; CHECK-LABEL: test_signed_v16f64_v16i8:
3345 ; CHECK-NEXT: mov d16, v0.d[1]
3346 ; CHECK-NEXT: fcvtzs w10, d0
3347 ; CHECK-NEXT: mov w8, #127 // =0x7f
3348 ; CHECK-NEXT: mov d0, v1.d[1]
3349 ; CHECK-NEXT: fcvtzs w13, d1
3350 ; CHECK-NEXT: mov d1, v2.d[1]
3351 ; CHECK-NEXT: fcvtzs w9, d16
3352 ; CHECK-NEXT: fcvtzs w12, d0
3353 ; CHECK-NEXT: cmp w9, #127
3354 ; CHECK-NEXT: csel w11, w9, w8, lt
3355 ; CHECK-NEXT: mov w9, #-128 // =0xffffff80
3356 ; CHECK-NEXT: cmn w11, #128
3357 ; CHECK-NEXT: csel w11, w11, w9, gt
3358 ; CHECK-NEXT: cmp w10, #127
3359 ; CHECK-NEXT: csel w10, w10, w8, lt
3360 ; CHECK-NEXT: cmn w10, #128
3361 ; CHECK-NEXT: csel w10, w10, w9, gt
3362 ; CHECK-NEXT: cmp w12, #127
3363 ; CHECK-NEXT: fmov s0, w10
3364 ; CHECK-NEXT: csel w10, w12, w8, lt
3365 ; CHECK-NEXT: cmn w10, #128
3366 ; CHECK-NEXT: csel w10, w10, w9, gt
3367 ; CHECK-NEXT: cmp w13, #127
3368 ; CHECK-NEXT: csel w12, w13, w8, lt
3369 ; CHECK-NEXT: mov v0.s[1], w11
3370 ; CHECK-NEXT: fcvtzs w11, d1
3371 ; CHECK-NEXT: cmn w12, #128
3372 ; CHECK-NEXT: csel w12, w12, w9, gt
3373 ; CHECK-NEXT: fmov s1, w12
3374 ; CHECK-NEXT: fcvtzs w12, d2
3375 ; CHECK-NEXT: mov d2, v3.d[1]
3376 ; CHECK-NEXT: cmp w11, #127
3377 ; CHECK-NEXT: mov w13, v0.s[1]
3378 ; CHECK-NEXT: mov v1.s[1], w10
3379 ; CHECK-NEXT: csel w10, w11, w8, lt
3380 ; CHECK-NEXT: cmn w10, #128
3381 ; CHECK-NEXT: fcvtzs w11, d2
3382 ; CHECK-NEXT: csel w10, w10, w9, gt
3383 ; CHECK-NEXT: cmp w12, #127
3384 ; CHECK-NEXT: mov v0.b[1], w13
3385 ; CHECK-NEXT: csel w12, w12, w8, lt
3386 ; CHECK-NEXT: cmn w12, #128
3387 ; CHECK-NEXT: mov w13, v1.s[1]
3388 ; CHECK-NEXT: csel w12, w12, w9, gt
3389 ; CHECK-NEXT: cmp w11, #127
3390 ; CHECK-NEXT: fmov s2, w12
3391 ; CHECK-NEXT: fcvtzs w12, d3
3392 ; CHECK-NEXT: mov d3, v4.d[1]
3393 ; CHECK-NEXT: mov v0.b[2], v1.b[0]
3394 ; CHECK-NEXT: mov v2.s[1], w10
3395 ; CHECK-NEXT: csel w10, w11, w8, lt
3396 ; CHECK-NEXT: cmn w10, #128
3397 ; CHECK-NEXT: fcvtzs w11, d3
3398 ; CHECK-NEXT: csel w10, w10, w9, gt
3399 ; CHECK-NEXT: cmp w12, #127
3400 ; CHECK-NEXT: mov v0.b[3], w13
3401 ; CHECK-NEXT: csel w12, w12, w8, lt
3402 ; CHECK-NEXT: cmn w12, #128
3403 ; CHECK-NEXT: mov w13, v2.s[1]
3404 ; CHECK-NEXT: csel w12, w12, w9, gt
3405 ; CHECK-NEXT: cmp w11, #127
3406 ; CHECK-NEXT: fmov s3, w12
3407 ; CHECK-NEXT: fcvtzs w12, d4
3408 ; CHECK-NEXT: mov v0.b[4], v2.b[0]
3409 ; CHECK-NEXT: mov d4, v5.d[1]
3410 ; CHECK-NEXT: mov v3.s[1], w10
3411 ; CHECK-NEXT: csel w10, w11, w8, lt
3412 ; CHECK-NEXT: cmn w10, #128
3413 ; CHECK-NEXT: mov v0.b[5], w13
3414 ; CHECK-NEXT: csel w10, w10, w9, gt
3415 ; CHECK-NEXT: cmp w12, #127
3416 ; CHECK-NEXT: fcvtzs w11, d4
3417 ; CHECK-NEXT: csel w12, w12, w8, lt
3418 ; CHECK-NEXT: cmn w12, #128
3419 ; CHECK-NEXT: mov w13, v3.s[1]
3420 ; CHECK-NEXT: csel w12, w12, w9, gt
3421 ; CHECK-NEXT: mov v0.b[6], v3.b[0]
3422 ; CHECK-NEXT: fmov s4, w12
3423 ; CHECK-NEXT: fcvtzs w12, d5
3424 ; CHECK-NEXT: cmp w11, #127
3425 ; CHECK-NEXT: mov d5, v6.d[1]
3426 ; CHECK-NEXT: mov v4.s[1], w10
3427 ; CHECK-NEXT: csel w10, w11, w8, lt
3428 ; CHECK-NEXT: mov v0.b[7], w13
3429 ; CHECK-NEXT: cmn w10, #128
3430 ; CHECK-NEXT: csel w10, w10, w9, gt
3431 ; CHECK-NEXT: cmp w12, #127
3432 ; CHECK-NEXT: fcvtzs w13, d5
3433 ; CHECK-NEXT: csel w11, w12, w8, lt
3434 ; CHECK-NEXT: cmn w11, #128
3435 ; CHECK-NEXT: mov w12, v4.s[1]
3436 ; CHECK-NEXT: mov v0.b[8], v4.b[0]
3437 ; CHECK-NEXT: csel w11, w11, w9, gt
3438 ; CHECK-NEXT: fmov s5, w11
3439 ; CHECK-NEXT: fcvtzs w11, d6
3440 ; CHECK-NEXT: cmp w13, #127
3441 ; CHECK-NEXT: mov d6, v7.d[1]
3442 ; CHECK-NEXT: mov v0.b[9], w12
3443 ; CHECK-NEXT: mov v5.s[1], w10
3444 ; CHECK-NEXT: csel w10, w13, w8, lt
3445 ; CHECK-NEXT: cmn w10, #128
3446 ; CHECK-NEXT: csel w10, w10, w9, gt
3447 ; CHECK-NEXT: cmp w11, #127
3448 ; CHECK-NEXT: fcvtzs w13, d6
3449 ; CHECK-NEXT: csel w11, w11, w8, lt
3450 ; CHECK-NEXT: cmn w11, #128
3451 ; CHECK-NEXT: mov v0.b[10], v5.b[0]
3452 ; CHECK-NEXT: mov w12, v5.s[1]
3453 ; CHECK-NEXT: csel w11, w11, w9, gt
3454 ; CHECK-NEXT: fmov s6, w11
3455 ; CHECK-NEXT: fcvtzs w11, d7
3456 ; CHECK-NEXT: cmp w13, #127
3457 ; CHECK-NEXT: mov v0.b[11], w12
3458 ; CHECK-NEXT: mov v6.s[1], w10
3459 ; CHECK-NEXT: csel w10, w13, w8, lt
3460 ; CHECK-NEXT: cmn w10, #128
3461 ; CHECK-NEXT: csel w10, w10, w9, gt
3462 ; CHECK-NEXT: cmp w11, #127
3463 ; CHECK-NEXT: csel w8, w11, w8, lt
3464 ; CHECK-NEXT: cmn w8, #128
3465 ; CHECK-NEXT: mov v0.b[12], v6.b[0]
3466 ; CHECK-NEXT: mov w11, v6.s[1]
3467 ; CHECK-NEXT: csel w8, w8, w9, gt
3468 ; CHECK-NEXT: fmov s7, w8
3469 ; CHECK-NEXT: mov v0.b[13], w11
3470 ; CHECK-NEXT: mov v7.s[1], w10
3471 ; CHECK-NEXT: mov v0.b[14], v7.b[0]
3472 ; CHECK-NEXT: mov w8, v7.s[1]
3473 ; CHECK-NEXT: mov v0.b[15], w8
3475 %x = call <16 x i8> @llvm.fptosi.sat.v16f64.v16i8(<16 x double> %f)
3479 define <8 x i16> @test_signed_v8f64_v8i16(<8 x double> %f) {
3480 ; CHECK-LABEL: test_signed_v8f64_v8i16:
3482 ; CHECK-NEXT: mov d4, v3.d[1]
3483 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
3484 ; CHECK-NEXT: fcvtzs w11, d3
3485 ; CHECK-NEXT: mov d3, v1.d[1]
3486 ; CHECK-NEXT: fcvtzs w13, d2
3487 ; CHECK-NEXT: fcvtzs w15, d1
3488 ; CHECK-NEXT: fcvtzs w17, d0
3489 ; CHECK-NEXT: fcvtzs w9, d4
3490 ; CHECK-NEXT: mov d4, v2.d[1]
3491 ; CHECK-NEXT: mov d2, v0.d[1]
3492 ; CHECK-NEXT: fcvtzs w14, d3
3493 ; CHECK-NEXT: cmp w9, w8
3494 ; CHECK-NEXT: fcvtzs w12, d4
3495 ; CHECK-NEXT: fcvtzs w16, d2
3496 ; CHECK-NEXT: csel w10, w9, w8, lt
3497 ; CHECK-NEXT: mov w9, #-32768 // =0xffff8000
3498 ; CHECK-NEXT: cmn w10, #8, lsl #12 // =32768
3499 ; CHECK-NEXT: csel w10, w10, w9, gt
3500 ; CHECK-NEXT: cmp w11, w8
3501 ; CHECK-NEXT: csel w11, w11, w8, lt
3502 ; CHECK-NEXT: cmn w11, #8, lsl #12 // =32768
3503 ; CHECK-NEXT: csel w11, w11, w9, gt
3504 ; CHECK-NEXT: cmp w12, w8
3505 ; CHECK-NEXT: csel w12, w12, w8, lt
3506 ; CHECK-NEXT: fmov s3, w11
3507 ; CHECK-NEXT: cmn w12, #8, lsl #12 // =32768
3508 ; CHECK-NEXT: csel w12, w12, w9, gt
3509 ; CHECK-NEXT: cmp w13, w8
3510 ; CHECK-NEXT: csel w13, w13, w8, lt
3511 ; CHECK-NEXT: mov v3.s[1], w10
3512 ; CHECK-NEXT: cmn w13, #8, lsl #12 // =32768
3513 ; CHECK-NEXT: csel w13, w13, w9, gt
3514 ; CHECK-NEXT: cmp w14, w8
3515 ; CHECK-NEXT: csel w14, w14, w8, lt
3516 ; CHECK-NEXT: fmov s2, w13
3517 ; CHECK-NEXT: cmn w14, #8, lsl #12 // =32768
3518 ; CHECK-NEXT: csel w14, w14, w9, gt
3519 ; CHECK-NEXT: cmp w15, w8
3520 ; CHECK-NEXT: csel w15, w15, w8, lt
3521 ; CHECK-NEXT: mov v2.s[1], w12
3522 ; CHECK-NEXT: cmn w15, #8, lsl #12 // =32768
3523 ; CHECK-NEXT: csel w15, w15, w9, gt
3524 ; CHECK-NEXT: cmp w16, w8
3525 ; CHECK-NEXT: csel w11, w16, w8, lt
3526 ; CHECK-NEXT: fmov s1, w15
3527 ; CHECK-NEXT: cmn w11, #8, lsl #12 // =32768
3528 ; CHECK-NEXT: csel w10, w11, w9, gt
3529 ; CHECK-NEXT: cmp w17, w8
3530 ; CHECK-NEXT: csel w8, w17, w8, lt
3531 ; CHECK-NEXT: mov v1.s[1], w14
3532 ; CHECK-NEXT: cmn w8, #8, lsl #12 // =32768
3533 ; CHECK-NEXT: csel w8, w8, w9, gt
3534 ; CHECK-NEXT: fmov s0, w8
3535 ; CHECK-NEXT: adrp x8, .LCPI84_0
3536 ; CHECK-NEXT: ldr q4, [x8, :lo12:.LCPI84_0]
3537 ; CHECK-NEXT: mov v0.s[1], w10
3538 ; CHECK-NEXT: tbl v0.16b, { v0.16b, v1.16b, v2.16b, v3.16b }, v4.16b
3540 %x = call <8 x i16> @llvm.fptosi.sat.v8f64.v8i16(<8 x double> %f)
3544 define <16 x i16> @test_signed_v16f64_v16i16(<16 x double> %f) {
3545 ; CHECK-LABEL: test_signed_v16f64_v16i16:
3547 ; CHECK-NEXT: mov d16, v3.d[1]
3548 ; CHECK-NEXT: mov w9, #32767 // =0x7fff
3549 ; CHECK-NEXT: fcvtzs w11, d3
3550 ; CHECK-NEXT: mov d3, v1.d[1]
3551 ; CHECK-NEXT: fcvtzs w14, d2
3552 ; CHECK-NEXT: fcvtzs w15, d1
3553 ; CHECK-NEXT: mov d1, v7.d[1]
3554 ; CHECK-NEXT: fcvtzs w18, d0
3555 ; CHECK-NEXT: fcvtzs w1, d7
3556 ; CHECK-NEXT: fcvtzs w2, d6
3557 ; CHECK-NEXT: fcvtzs w4, d5
3558 ; CHECK-NEXT: fcvtzs w6, d4
3559 ; CHECK-NEXT: fcvtzs w8, d16
3560 ; CHECK-NEXT: mov d16, v2.d[1]
3561 ; CHECK-NEXT: mov d2, v0.d[1]
3562 ; CHECK-NEXT: mov d0, v6.d[1]
3563 ; CHECK-NEXT: fcvtzs w0, d1
3564 ; CHECK-NEXT: cmp w8, w9
3565 ; CHECK-NEXT: fcvtzs w13, d16
3566 ; CHECK-NEXT: fcvtzs w17, d2
3567 ; CHECK-NEXT: csel w10, w8, w9, lt
3568 ; CHECK-NEXT: mov w8, #-32768 // =0xffff8000
3569 ; CHECK-NEXT: cmn w10, #8, lsl #12 // =32768
3570 ; CHECK-NEXT: csel w10, w10, w8, gt
3571 ; CHECK-NEXT: cmp w11, w9
3572 ; CHECK-NEXT: csel w11, w11, w9, lt
3573 ; CHECK-NEXT: cmn w11, #8, lsl #12 // =32768
3574 ; CHECK-NEXT: csel w12, w11, w8, gt
3575 ; CHECK-NEXT: cmp w13, w9
3576 ; CHECK-NEXT: csel w11, w13, w9, lt
3577 ; CHECK-NEXT: fcvtzs w13, d3
3578 ; CHECK-NEXT: cmn w11, #8, lsl #12 // =32768
3579 ; CHECK-NEXT: csel w11, w11, w8, gt
3580 ; CHECK-NEXT: cmp w14, w9
3581 ; CHECK-NEXT: csel w14, w14, w9, lt
3582 ; CHECK-NEXT: cmn w14, #8, lsl #12 // =32768
3583 ; CHECK-NEXT: csel w14, w14, w8, gt
3584 ; CHECK-NEXT: cmp w13, w9
3585 ; CHECK-NEXT: csel w13, w13, w9, lt
3586 ; CHECK-NEXT: cmn w13, #8, lsl #12 // =32768
3587 ; CHECK-NEXT: csel w13, w13, w8, gt
3588 ; CHECK-NEXT: cmp w15, w9
3589 ; CHECK-NEXT: csel w15, w15, w9, lt
3590 ; CHECK-NEXT: cmn w15, #8, lsl #12 // =32768
3591 ; CHECK-NEXT: csel w16, w15, w8, gt
3592 ; CHECK-NEXT: cmp w17, w9
3593 ; CHECK-NEXT: csel w15, w17, w9, lt
3594 ; CHECK-NEXT: cmn w15, #8, lsl #12 // =32768
3595 ; CHECK-NEXT: csel w15, w15, w8, gt
3596 ; CHECK-NEXT: cmp w18, w9
3597 ; CHECK-NEXT: csel w17, w18, w9, lt
3598 ; CHECK-NEXT: cmn w17, #8, lsl #12 // =32768
3599 ; CHECK-NEXT: csel w17, w17, w8, gt
3600 ; CHECK-NEXT: cmp w0, w9
3601 ; CHECK-NEXT: csel w18, w0, w9, lt
3602 ; CHECK-NEXT: fcvtzs w0, d0
3603 ; CHECK-NEXT: mov d0, v5.d[1]
3604 ; CHECK-NEXT: cmn w18, #8, lsl #12 // =32768
3605 ; CHECK-NEXT: csel w18, w18, w8, gt
3606 ; CHECK-NEXT: cmp w1, w9
3607 ; CHECK-NEXT: csel w1, w1, w9, lt
3608 ; CHECK-NEXT: cmn w1, #8, lsl #12 // =32768
3609 ; CHECK-NEXT: fcvtzs w3, d0
3610 ; CHECK-NEXT: mov d0, v4.d[1]
3611 ; CHECK-NEXT: csel w1, w1, w8, gt
3612 ; CHECK-NEXT: cmp w0, w9
3613 ; CHECK-NEXT: csel w0, w0, w9, lt
3614 ; CHECK-NEXT: fmov s7, w1
3615 ; CHECK-NEXT: cmn w0, #8, lsl #12 // =32768
3616 ; CHECK-NEXT: csel w0, w0, w8, gt
3617 ; CHECK-NEXT: cmp w2, w9
3618 ; CHECK-NEXT: fcvtzs w5, d0
3619 ; CHECK-NEXT: csel w2, w2, w9, lt
3620 ; CHECK-NEXT: fmov s3, w12
3621 ; CHECK-NEXT: mov v7.s[1], w18
3622 ; CHECK-NEXT: cmn w2, #8, lsl #12 // =32768
3623 ; CHECK-NEXT: csel w2, w2, w8, gt
3624 ; CHECK-NEXT: cmp w3, w9
3625 ; CHECK-NEXT: csel w3, w3, w9, lt
3626 ; CHECK-NEXT: mov v3.s[1], w10
3627 ; CHECK-NEXT: fmov s6, w2
3628 ; CHECK-NEXT: cmn w3, #8, lsl #12 // =32768
3629 ; CHECK-NEXT: fmov s2, w14
3630 ; CHECK-NEXT: csel w3, w3, w8, gt
3631 ; CHECK-NEXT: cmp w4, w9
3632 ; CHECK-NEXT: csel w4, w4, w9, lt
3633 ; CHECK-NEXT: mov v6.s[1], w0
3634 ; CHECK-NEXT: cmn w4, #8, lsl #12 // =32768
3635 ; CHECK-NEXT: mov v2.s[1], w11
3636 ; CHECK-NEXT: csel w12, w4, w8, gt
3637 ; CHECK-NEXT: cmp w5, w9
3638 ; CHECK-NEXT: fmov s1, w16
3639 ; CHECK-NEXT: csel w10, w5, w9, lt
3640 ; CHECK-NEXT: fmov s5, w12
3641 ; CHECK-NEXT: cmn w10, #8, lsl #12 // =32768
3642 ; CHECK-NEXT: csel w10, w10, w8, gt
3643 ; CHECK-NEXT: cmp w6, w9
3644 ; CHECK-NEXT: mov v1.s[1], w13
3645 ; CHECK-NEXT: csel w9, w6, w9, lt
3646 ; CHECK-NEXT: mov v5.s[1], w3
3647 ; CHECK-NEXT: fmov s0, w17
3648 ; CHECK-NEXT: cmn w9, #8, lsl #12 // =32768
3649 ; CHECK-NEXT: csel w8, w9, w8, gt
3650 ; CHECK-NEXT: fmov s4, w8
3651 ; CHECK-NEXT: mov v0.s[1], w15
3652 ; CHECK-NEXT: adrp x8, .LCPI85_0
3653 ; CHECK-NEXT: ldr q16, [x8, :lo12:.LCPI85_0]
3654 ; CHECK-NEXT: mov v4.s[1], w10
3655 ; CHECK-NEXT: tbl v0.16b, { v0.16b, v1.16b, v2.16b, v3.16b }, v16.16b
3656 ; CHECK-NEXT: tbl v1.16b, { v4.16b, v5.16b, v6.16b, v7.16b }, v16.16b
3658 %x = call <16 x i16> @llvm.fptosi.sat.v16f64.v16i16(<16 x double> %f)