1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+zfh -verify-machineinstrs < %s \
3 ; RUN: -target-abi=ilp32f | FileCheck -check-prefixes=CHECKIZFH,RV32IZFH %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs < %s \
5 ; RUN: -target-abi=lp64f | FileCheck -check-prefixes=CHECKIZFH,RV64IZFH %s
7 define signext i8 @test_floor_si8(half %x) {
8 ; RV32IZFH-LABEL: test_floor_si8:
10 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rdn
13 ; RV64IZFH-LABEL: test_floor_si8:
15 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn
17 %a = call half @llvm.floor.f16(half %x)
18 %b = fptosi half %a to i8
22 define signext i16 @test_floor_si16(half %x) {
23 ; RV32IZFH-LABEL: test_floor_si16:
25 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rdn
28 ; RV64IZFH-LABEL: test_floor_si16:
30 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn
32 %a = call half @llvm.floor.f16(half %x)
33 %b = fptosi half %a to i16
37 define signext i32 @test_floor_si32(half %x) {
38 ; CHECKIZFH-LABEL: test_floor_si32:
40 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rdn
42 %a = call half @llvm.floor.f16(half %x)
43 %b = fptosi half %a to i32
47 define i64 @test_floor_si64(half %x) {
48 ; RV32IZFH-LABEL: test_floor_si64:
50 ; RV32IZFH-NEXT: addi sp, sp, -16
51 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
52 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
53 ; RV32IZFH-NEXT: .cfi_offset ra, -4
54 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
55 ; RV32IZFH-NEXT: call floorf@plt
56 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
57 ; RV32IZFH-NEXT: call __fixhfdi@plt
58 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
59 ; RV32IZFH-NEXT: addi sp, sp, 16
62 ; RV64IZFH-LABEL: test_floor_si64:
64 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rdn
66 %a = call half @llvm.floor.f16(half %x)
67 %b = fptosi half %a to i64
71 define zeroext i8 @test_floor_ui8(half %x) {
72 ; RV32IZFH-LABEL: test_floor_ui8:
74 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rdn
77 ; RV64IZFH-LABEL: test_floor_ui8:
79 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn
81 %a = call half @llvm.floor.f16(half %x)
82 %b = fptoui half %a to i8
86 define zeroext i16 @test_floor_ui16(half %x) {
87 ; RV32IZFH-LABEL: test_floor_ui16:
89 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rdn
92 ; RV64IZFH-LABEL: test_floor_ui16:
94 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn
96 %a = call half @llvm.floor.f16(half %x)
97 %b = fptoui half %a to i16
101 define signext i32 @test_floor_ui32(half %x) {
102 ; CHECKIZFH-LABEL: test_floor_ui32:
103 ; CHECKIZFH: # %bb.0:
104 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rdn
105 ; CHECKIZFH-NEXT: ret
106 %a = call half @llvm.floor.f16(half %x)
107 %b = fptoui half %a to i32
111 define i64 @test_floor_ui64(half %x) {
112 ; RV32IZFH-LABEL: test_floor_ui64:
114 ; RV32IZFH-NEXT: addi sp, sp, -16
115 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
116 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
117 ; RV32IZFH-NEXT: .cfi_offset ra, -4
118 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
119 ; RV32IZFH-NEXT: call floorf@plt
120 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
121 ; RV32IZFH-NEXT: call __fixunshfdi@plt
122 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
123 ; RV32IZFH-NEXT: addi sp, sp, 16
126 ; RV64IZFH-LABEL: test_floor_ui64:
128 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rdn
130 %a = call half @llvm.floor.f16(half %x)
131 %b = fptoui half %a to i64
135 define signext i8 @test_ceil_si8(half %x) {
136 ; RV32IZFH-LABEL: test_ceil_si8:
138 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rup
141 ; RV64IZFH-LABEL: test_ceil_si8:
143 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup
145 %a = call half @llvm.ceil.f16(half %x)
146 %b = fptosi half %a to i8
150 define signext i16 @test_ceil_si16(half %x) {
151 ; RV32IZFH-LABEL: test_ceil_si16:
153 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rup
156 ; RV64IZFH-LABEL: test_ceil_si16:
158 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup
160 %a = call half @llvm.ceil.f16(half %x)
161 %b = fptosi half %a to i16
165 define signext i32 @test_ceil_si32(half %x) {
166 ; CHECKIZFH-LABEL: test_ceil_si32:
167 ; CHECKIZFH: # %bb.0:
168 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rup
169 ; CHECKIZFH-NEXT: ret
170 %a = call half @llvm.ceil.f16(half %x)
171 %b = fptosi half %a to i32
175 define i64 @test_ceil_si64(half %x) {
176 ; RV32IZFH-LABEL: test_ceil_si64:
178 ; RV32IZFH-NEXT: addi sp, sp, -16
179 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
180 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
181 ; RV32IZFH-NEXT: .cfi_offset ra, -4
182 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
183 ; RV32IZFH-NEXT: call ceilf@plt
184 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
185 ; RV32IZFH-NEXT: call __fixhfdi@plt
186 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
187 ; RV32IZFH-NEXT: addi sp, sp, 16
190 ; RV64IZFH-LABEL: test_ceil_si64:
192 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rup
194 %a = call half @llvm.ceil.f16(half %x)
195 %b = fptosi half %a to i64
199 define zeroext i8 @test_ceil_ui8(half %x) {
200 ; RV32IZFH-LABEL: test_ceil_ui8:
202 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rup
205 ; RV64IZFH-LABEL: test_ceil_ui8:
207 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup
209 %a = call half @llvm.ceil.f16(half %x)
210 %b = fptoui half %a to i8
214 define zeroext i16 @test_ceil_ui16(half %x) {
215 ; RV32IZFH-LABEL: test_ceil_ui16:
217 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rup
220 ; RV64IZFH-LABEL: test_ceil_ui16:
222 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup
224 %a = call half @llvm.ceil.f16(half %x)
225 %b = fptoui half %a to i16
229 define signext i32 @test_ceil_ui32(half %x) {
230 ; CHECKIZFH-LABEL: test_ceil_ui32:
231 ; CHECKIZFH: # %bb.0:
232 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rup
233 ; CHECKIZFH-NEXT: ret
234 %a = call half @llvm.ceil.f16(half %x)
235 %b = fptoui half %a to i32
239 define i64 @test_ceil_ui64(half %x) {
240 ; RV32IZFH-LABEL: test_ceil_ui64:
242 ; RV32IZFH-NEXT: addi sp, sp, -16
243 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
244 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
245 ; RV32IZFH-NEXT: .cfi_offset ra, -4
246 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
247 ; RV32IZFH-NEXT: call ceilf@plt
248 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
249 ; RV32IZFH-NEXT: call __fixunshfdi@plt
250 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
251 ; RV32IZFH-NEXT: addi sp, sp, 16
254 ; RV64IZFH-LABEL: test_ceil_ui64:
256 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rup
258 %a = call half @llvm.ceil.f16(half %x)
259 %b = fptoui half %a to i64
263 define signext i8 @test_trunc_si8(half %x) {
264 ; RV32IZFH-LABEL: test_trunc_si8:
266 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rtz
269 ; RV64IZFH-LABEL: test_trunc_si8:
271 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
273 %a = call half @llvm.trunc.f16(half %x)
274 %b = fptosi half %a to i8
278 define signext i16 @test_trunc_si16(half %x) {
279 ; RV32IZFH-LABEL: test_trunc_si16:
281 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rtz
284 ; RV64IZFH-LABEL: test_trunc_si16:
286 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
288 %a = call half @llvm.trunc.f16(half %x)
289 %b = fptosi half %a to i16
293 define signext i32 @test_trunc_si32(half %x) {
294 ; CHECKIZFH-LABEL: test_trunc_si32:
295 ; CHECKIZFH: # %bb.0:
296 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rtz
297 ; CHECKIZFH-NEXT: ret
298 %a = call half @llvm.trunc.f16(half %x)
299 %b = fptosi half %a to i32
303 define i64 @test_trunc_si64(half %x) {
304 ; RV32IZFH-LABEL: test_trunc_si64:
306 ; RV32IZFH-NEXT: addi sp, sp, -16
307 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
308 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
309 ; RV32IZFH-NEXT: .cfi_offset ra, -4
310 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
311 ; RV32IZFH-NEXT: call truncf@plt
312 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
313 ; RV32IZFH-NEXT: call __fixhfdi@plt
314 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
315 ; RV32IZFH-NEXT: addi sp, sp, 16
318 ; RV64IZFH-LABEL: test_trunc_si64:
320 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rtz
322 %a = call half @llvm.trunc.f16(half %x)
323 %b = fptosi half %a to i64
327 define zeroext i8 @test_trunc_ui8(half %x) {
328 ; RV32IZFH-LABEL: test_trunc_ui8:
330 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
333 ; RV64IZFH-LABEL: test_trunc_ui8:
335 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
337 %a = call half @llvm.trunc.f16(half %x)
338 %b = fptoui half %a to i8
342 define zeroext i16 @test_trunc_ui16(half %x) {
343 ; RV32IZFH-LABEL: test_trunc_ui16:
345 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rtz
348 ; RV64IZFH-LABEL: test_trunc_ui16:
350 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
352 %a = call half @llvm.trunc.f16(half %x)
353 %b = fptoui half %a to i16
357 define signext i32 @test_trunc_ui32(half %x) {
358 ; CHECKIZFH-LABEL: test_trunc_ui32:
359 ; CHECKIZFH: # %bb.0:
360 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rtz
361 ; CHECKIZFH-NEXT: ret
362 %a = call half @llvm.trunc.f16(half %x)
363 %b = fptoui half %a to i32
367 define i64 @test_trunc_ui64(half %x) {
368 ; RV32IZFH-LABEL: test_trunc_ui64:
370 ; RV32IZFH-NEXT: addi sp, sp, -16
371 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
372 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
373 ; RV32IZFH-NEXT: .cfi_offset ra, -4
374 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
375 ; RV32IZFH-NEXT: call truncf@plt
376 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
377 ; RV32IZFH-NEXT: call __fixunshfdi@plt
378 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
379 ; RV32IZFH-NEXT: addi sp, sp, 16
382 ; RV64IZFH-LABEL: test_trunc_ui64:
384 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rtz
386 %a = call half @llvm.trunc.f16(half %x)
387 %b = fptoui half %a to i64
391 define signext i8 @test_round_si8(half %x) {
392 ; RV32IZFH-LABEL: test_round_si8:
394 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rmm
397 ; RV64IZFH-LABEL: test_round_si8:
399 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm
401 %a = call half @llvm.round.f16(half %x)
402 %b = fptosi half %a to i8
406 define signext i16 @test_round_si16(half %x) {
407 ; RV32IZFH-LABEL: test_round_si16:
409 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rmm
412 ; RV64IZFH-LABEL: test_round_si16:
414 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm
416 %a = call half @llvm.round.f16(half %x)
417 %b = fptosi half %a to i16
421 define signext i32 @test_round_si32(half %x) {
422 ; CHECKIZFH-LABEL: test_round_si32:
423 ; CHECKIZFH: # %bb.0:
424 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rmm
425 ; CHECKIZFH-NEXT: ret
426 %a = call half @llvm.round.f16(half %x)
427 %b = fptosi half %a to i32
431 define i64 @test_round_si64(half %x) {
432 ; RV32IZFH-LABEL: test_round_si64:
434 ; RV32IZFH-NEXT: addi sp, sp, -16
435 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
436 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
437 ; RV32IZFH-NEXT: .cfi_offset ra, -4
438 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
439 ; RV32IZFH-NEXT: call roundf@plt
440 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
441 ; RV32IZFH-NEXT: call __fixhfdi@plt
442 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
443 ; RV32IZFH-NEXT: addi sp, sp, 16
446 ; RV64IZFH-LABEL: test_round_si64:
448 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rmm
450 %a = call half @llvm.round.f16(half %x)
451 %b = fptosi half %a to i64
455 define zeroext i8 @test_round_ui8(half %x) {
456 ; RV32IZFH-LABEL: test_round_ui8:
458 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rmm
461 ; RV64IZFH-LABEL: test_round_ui8:
463 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm
465 %a = call half @llvm.round.f16(half %x)
466 %b = fptoui half %a to i8
470 define zeroext i16 @test_round_ui16(half %x) {
471 ; RV32IZFH-LABEL: test_round_ui16:
473 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rmm
476 ; RV64IZFH-LABEL: test_round_ui16:
478 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm
480 %a = call half @llvm.round.f16(half %x)
481 %b = fptoui half %a to i16
485 define signext i32 @test_round_ui32(half %x) {
486 ; CHECKIZFH-LABEL: test_round_ui32:
487 ; CHECKIZFH: # %bb.0:
488 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rmm
489 ; CHECKIZFH-NEXT: ret
490 %a = call half @llvm.round.f16(half %x)
491 %b = fptoui half %a to i32
495 define i64 @test_round_ui64(half %x) {
496 ; RV32IZFH-LABEL: test_round_ui64:
498 ; RV32IZFH-NEXT: addi sp, sp, -16
499 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
500 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
501 ; RV32IZFH-NEXT: .cfi_offset ra, -4
502 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
503 ; RV32IZFH-NEXT: call roundf@plt
504 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
505 ; RV32IZFH-NEXT: call __fixunshfdi@plt
506 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
507 ; RV32IZFH-NEXT: addi sp, sp, 16
510 ; RV64IZFH-LABEL: test_round_ui64:
512 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rmm
514 %a = call half @llvm.round.f16(half %x)
515 %b = fptoui half %a to i64
519 define signext i8 @test_roundeven_si8(half %x) {
520 ; RV32IZFH-LABEL: test_roundeven_si8:
522 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rne
525 ; RV64IZFH-LABEL: test_roundeven_si8:
527 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne
529 %a = call half @llvm.roundeven.f16(half %x)
530 %b = fptosi half %a to i8
534 define signext i16 @test_roundeven_si16(half %x) {
535 ; RV32IZFH-LABEL: test_roundeven_si16:
537 ; RV32IZFH-NEXT: fcvt.w.h a0, fa0, rne
540 ; RV64IZFH-LABEL: test_roundeven_si16:
542 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne
544 %a = call half @llvm.roundeven.f16(half %x)
545 %b = fptosi half %a to i16
549 define signext i32 @test_roundeven_si32(half %x) {
550 ; CHECKIZFH-LABEL: test_roundeven_si32:
551 ; CHECKIZFH: # %bb.0:
552 ; CHECKIZFH-NEXT: fcvt.w.h a0, fa0, rne
553 ; CHECKIZFH-NEXT: ret
554 %a = call half @llvm.roundeven.f16(half %x)
555 %b = fptosi half %a to i32
559 define i64 @test_roundeven_si64(half %x) {
560 ; RV32IZFH-LABEL: test_roundeven_si64:
562 ; RV32IZFH-NEXT: addi sp, sp, -16
563 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
564 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
565 ; RV32IZFH-NEXT: .cfi_offset ra, -4
566 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
567 ; RV32IZFH-NEXT: call roundevenf@plt
568 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
569 ; RV32IZFH-NEXT: call __fixhfdi@plt
570 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
571 ; RV32IZFH-NEXT: addi sp, sp, 16
574 ; RV64IZFH-LABEL: test_roundeven_si64:
576 ; RV64IZFH-NEXT: fcvt.l.h a0, fa0, rne
578 %a = call half @llvm.roundeven.f16(half %x)
579 %b = fptosi half %a to i64
583 define zeroext i8 @test_roundeven_ui8(half %x) {
584 ; RV32IZFH-LABEL: test_roundeven_ui8:
586 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rne
589 ; RV64IZFH-LABEL: test_roundeven_ui8:
591 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne
593 %a = call half @llvm.roundeven.f16(half %x)
594 %b = fptoui half %a to i8
598 define zeroext i16 @test_roundeven_ui16(half %x) {
599 ; RV32IZFH-LABEL: test_roundeven_ui16:
601 ; RV32IZFH-NEXT: fcvt.wu.h a0, fa0, rne
604 ; RV64IZFH-LABEL: test_roundeven_ui16:
606 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne
608 %a = call half @llvm.roundeven.f16(half %x)
609 %b = fptoui half %a to i16
613 define signext i32 @test_roundeven_ui32(half %x) {
614 ; CHECKIZFH-LABEL: test_roundeven_ui32:
615 ; CHECKIZFH: # %bb.0:
616 ; CHECKIZFH-NEXT: fcvt.wu.h a0, fa0, rne
617 ; CHECKIZFH-NEXT: ret
618 %a = call half @llvm.roundeven.f16(half %x)
619 %b = fptoui half %a to i32
623 define i64 @test_roundeven_ui64(half %x) {
624 ; RV32IZFH-LABEL: test_roundeven_ui64:
626 ; RV32IZFH-NEXT: addi sp, sp, -16
627 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
628 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
629 ; RV32IZFH-NEXT: .cfi_offset ra, -4
630 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
631 ; RV32IZFH-NEXT: call roundevenf@plt
632 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
633 ; RV32IZFH-NEXT: call __fixunshfdi@plt
634 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
635 ; RV32IZFH-NEXT: addi sp, sp, 16
638 ; RV64IZFH-LABEL: test_roundeven_ui64:
640 ; RV64IZFH-NEXT: fcvt.lu.h a0, fa0, rne
642 %a = call half @llvm.roundeven.f16(half %x)
643 %b = fptoui half %a to i64
647 define half @test_floor_half(half %x) {
648 ; RV32IFD-LABEL: test_floor_half:
650 ; RV32IFD-NEXT: addi sp, sp, -16
651 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
652 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
653 ; RV32IFD-NEXT: .cfi_offset ra, -4
654 ; RV32IFD-NEXT: call floor@plt
655 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
656 ; RV32IFD-NEXT: addi sp, sp, 16
659 ; RV64IFD-LABEL: test_floor_half:
661 ; RV64IFD-NEXT: addi sp, sp, -16
662 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
663 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
664 ; RV64IFD-NEXT: .cfi_offset ra, -8
665 ; RV64IFD-NEXT: call floor@plt
666 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
667 ; RV64IFD-NEXT: addi sp, sp, 16
669 ; RV32IZFH-LABEL: test_floor_half:
671 ; RV32IZFH-NEXT: addi sp, sp, -16
672 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
673 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
674 ; RV32IZFH-NEXT: .cfi_offset ra, -4
675 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
676 ; RV32IZFH-NEXT: call floorf@plt
677 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
678 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
679 ; RV32IZFH-NEXT: addi sp, sp, 16
682 ; RV64IZFH-LABEL: test_floor_half:
684 ; RV64IZFH-NEXT: addi sp, sp, -16
685 ; RV64IZFH-NEXT: .cfi_def_cfa_offset 16
686 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
687 ; RV64IZFH-NEXT: .cfi_offset ra, -8
688 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
689 ; RV64IZFH-NEXT: call floorf@plt
690 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
691 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
692 ; RV64IZFH-NEXT: addi sp, sp, 16
694 %a = call half @llvm.floor.f16(half %x)
698 define half @test_ceil_half(half %x) {
699 ; RV32IFD-LABEL: test_ceil_half:
701 ; RV32IFD-NEXT: addi sp, sp, -16
702 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
703 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
704 ; RV32IFD-NEXT: .cfi_offset ra, -4
705 ; RV32IFD-NEXT: call ceil@plt
706 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
707 ; RV32IFD-NEXT: addi sp, sp, 16
710 ; RV64IFD-LABEL: test_ceil_half:
712 ; RV64IFD-NEXT: addi sp, sp, -16
713 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
714 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
715 ; RV64IFD-NEXT: .cfi_offset ra, -8
716 ; RV64IFD-NEXT: call ceil@plt
717 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
718 ; RV64IFD-NEXT: addi sp, sp, 16
720 ; RV32IZFH-LABEL: test_ceil_half:
722 ; RV32IZFH-NEXT: addi sp, sp, -16
723 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
724 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
725 ; RV32IZFH-NEXT: .cfi_offset ra, -4
726 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
727 ; RV32IZFH-NEXT: call ceilf@plt
728 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
729 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
730 ; RV32IZFH-NEXT: addi sp, sp, 16
733 ; RV64IZFH-LABEL: test_ceil_half:
735 ; RV64IZFH-NEXT: addi sp, sp, -16
736 ; RV64IZFH-NEXT: .cfi_def_cfa_offset 16
737 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
738 ; RV64IZFH-NEXT: .cfi_offset ra, -8
739 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
740 ; RV64IZFH-NEXT: call ceilf@plt
741 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
742 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
743 ; RV64IZFH-NEXT: addi sp, sp, 16
745 %a = call half @llvm.ceil.f16(half %x)
749 define half @test_trunc_half(half %x) {
750 ; RV32IFD-LABEL: test_trunc_half:
752 ; RV32IFD-NEXT: addi sp, sp, -16
753 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
754 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
755 ; RV32IFD-NEXT: .cfi_offset ra, -4
756 ; RV32IFD-NEXT: call trunc@plt
757 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
758 ; RV32IFD-NEXT: addi sp, sp, 16
761 ; RV64IFD-LABEL: test_trunc_half:
763 ; RV64IFD-NEXT: addi sp, sp, -16
764 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
765 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
766 ; RV64IFD-NEXT: .cfi_offset ra, -8
767 ; RV64IFD-NEXT: call trunc@plt
768 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
769 ; RV64IFD-NEXT: addi sp, sp, 16
771 ; RV32IZFH-LABEL: test_trunc_half:
773 ; RV32IZFH-NEXT: addi sp, sp, -16
774 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
775 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
776 ; RV32IZFH-NEXT: .cfi_offset ra, -4
777 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
778 ; RV32IZFH-NEXT: call truncf@plt
779 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
780 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
781 ; RV32IZFH-NEXT: addi sp, sp, 16
784 ; RV64IZFH-LABEL: test_trunc_half:
786 ; RV64IZFH-NEXT: addi sp, sp, -16
787 ; RV64IZFH-NEXT: .cfi_def_cfa_offset 16
788 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
789 ; RV64IZFH-NEXT: .cfi_offset ra, -8
790 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
791 ; RV64IZFH-NEXT: call truncf@plt
792 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
793 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
794 ; RV64IZFH-NEXT: addi sp, sp, 16
796 %a = call half @llvm.trunc.f16(half %x)
800 define half @test_round_half(half %x) {
801 ; RV32IFD-LABEL: test_round_half:
803 ; RV32IFD-NEXT: addi sp, sp, -16
804 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
805 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
806 ; RV32IFD-NEXT: .cfi_offset ra, -4
807 ; RV32IFD-NEXT: call round@plt
808 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
809 ; RV32IFD-NEXT: addi sp, sp, 16
812 ; RV64IFD-LABEL: test_round_half:
814 ; RV64IFD-NEXT: addi sp, sp, -16
815 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
816 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
817 ; RV64IFD-NEXT: .cfi_offset ra, -8
818 ; RV64IFD-NEXT: call round@plt
819 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
820 ; RV64IFD-NEXT: addi sp, sp, 16
822 ; RV32IZFH-LABEL: test_round_half:
824 ; RV32IZFH-NEXT: addi sp, sp, -16
825 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
826 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
827 ; RV32IZFH-NEXT: .cfi_offset ra, -4
828 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
829 ; RV32IZFH-NEXT: call roundf@plt
830 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
831 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
832 ; RV32IZFH-NEXT: addi sp, sp, 16
835 ; RV64IZFH-LABEL: test_round_half:
837 ; RV64IZFH-NEXT: addi sp, sp, -16
838 ; RV64IZFH-NEXT: .cfi_def_cfa_offset 16
839 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
840 ; RV64IZFH-NEXT: .cfi_offset ra, -8
841 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
842 ; RV64IZFH-NEXT: call roundf@plt
843 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
844 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
845 ; RV64IZFH-NEXT: addi sp, sp, 16
847 %a = call half @llvm.round.f16(half %x)
851 define half @test_roundeven_half(half %x) {
852 ; RV32IFD-LABEL: test_roundeven_half:
854 ; RV32IFD-NEXT: addi sp, sp, -16
855 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
856 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
857 ; RV32IFD-NEXT: .cfi_offset ra, -4
858 ; RV32IFD-NEXT: call roundeven@plt
859 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
860 ; RV32IFD-NEXT: addi sp, sp, 16
863 ; RV64IFD-LABEL: test_roundeven_half:
865 ; RV64IFD-NEXT: addi sp, sp, -16
866 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
867 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
868 ; RV64IFD-NEXT: .cfi_offset ra, -8
869 ; RV64IFD-NEXT: call roundeven@plt
870 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
871 ; RV64IFD-NEXT: addi sp, sp, 16
873 ; RV32IZFH-LABEL: test_roundeven_half:
875 ; RV32IZFH-NEXT: addi sp, sp, -16
876 ; RV32IZFH-NEXT: .cfi_def_cfa_offset 16
877 ; RV32IZFH-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
878 ; RV32IZFH-NEXT: .cfi_offset ra, -4
879 ; RV32IZFH-NEXT: fcvt.s.h fa0, fa0
880 ; RV32IZFH-NEXT: call roundevenf@plt
881 ; RV32IZFH-NEXT: fcvt.h.s fa0, fa0
882 ; RV32IZFH-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
883 ; RV32IZFH-NEXT: addi sp, sp, 16
886 ; RV64IZFH-LABEL: test_roundeven_half:
888 ; RV64IZFH-NEXT: addi sp, sp, -16
889 ; RV64IZFH-NEXT: .cfi_def_cfa_offset 16
890 ; RV64IZFH-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
891 ; RV64IZFH-NEXT: .cfi_offset ra, -8
892 ; RV64IZFH-NEXT: fcvt.s.h fa0, fa0
893 ; RV64IZFH-NEXT: call roundevenf@plt
894 ; RV64IZFH-NEXT: fcvt.h.s fa0, fa0
895 ; RV64IZFH-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
896 ; RV64IZFH-NEXT: addi sp, sp, 16
898 %a = call half @llvm.roundeven.f16(half %x)
902 declare half @llvm.floor.f16(half)
903 declare half @llvm.ceil.f16(half)
904 declare half @llvm.trunc.f16(half)
905 declare half @llvm.round.f16(half)
906 declare half @llvm.roundeven.f16(half)