xref: /llvm-project/llvm/test/CodeGen/RISCV/rv64-double-convert-strict.ll (revision 768b0b4eb83e8ca62cc504ba3f0f9a0c46eea7b6)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64 \
3; RUN:   -disable-strictnode-mutation < %s | FileCheck %s -check-prefixes=CHECK,RV64I
4; RUN: llc -mtriple=riscv64 -mattr=+d -verify-machineinstrs -target-abi=lp64d \
5; RUN:   -disable-strictnode-mutation < %s | FileCheck %s -check-prefixes=CHECK,RV64ID
6; RUN: llc -mtriple=riscv64 -mattr=+zdinx -verify-machineinstrs -target-abi=lp64 \
7; RUN:   -disable-strictnode-mutation < %s | FileCheck %s -check-prefixes=CHECK,RV64IDINX
8
9define i128 @fptosi_f64_to_i128(double %a) nounwind strictfp {
10; CHECK-LABEL: fptosi_f64_to_i128:
11; CHECK:       # %bb.0:
12; CHECK-NEXT:    addi sp, sp, -16
13; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
14; CHECK-NEXT:    call __fixdfti
15; CHECK-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
16; CHECK-NEXT:    addi sp, sp, 16
17; CHECK-NEXT:    ret
18  %1 = call i128 @llvm.experimental.constrained.fptosi.i128.f64(double %a, metadata !"fpexcept.strict")
19  ret i128 %1
20}
21
22define i128 @fptoui_f64_to_i128(double %a) nounwind strictfp {
23; CHECK-LABEL: fptoui_f64_to_i128:
24; CHECK:       # %bb.0:
25; CHECK-NEXT:    addi sp, sp, -16
26; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
27; CHECK-NEXT:    call __fixunsdfti
28; CHECK-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
29; CHECK-NEXT:    addi sp, sp, 16
30; CHECK-NEXT:    ret
31  %1 = call i128 @llvm.experimental.constrained.fptoui.i128.f64(double %a, metadata !"fpexcept.strict")
32  ret i128 %1
33}
34
35define double @sitofp_i128_to_f64(i128 %a) nounwind strictfp {
36; CHECK-LABEL: sitofp_i128_to_f64:
37; CHECK:       # %bb.0:
38; CHECK-NEXT:    addi sp, sp, -16
39; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
40; CHECK-NEXT:    call __floattidf
41; CHECK-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
42; CHECK-NEXT:    addi sp, sp, 16
43; CHECK-NEXT:    ret
44  %1 = call double @llvm.experimental.constrained.sitofp.f64.i128(i128 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
45  ret double %1
46}
47
48define double @uitofp_i128_to_f64(i128 %a) nounwind strictfp {
49; CHECK-LABEL: uitofp_i128_to_f64:
50; CHECK:       # %bb.0:
51; CHECK-NEXT:    addi sp, sp, -16
52; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
53; CHECK-NEXT:    call __floatuntidf
54; CHECK-NEXT:    ld ra, 8(sp) # 8-byte Folded Reload
55; CHECK-NEXT:    addi sp, sp, 16
56; CHECK-NEXT:    ret
57  %1 = call double @llvm.experimental.constrained.uitofp.f64.i128(i128 %a, metadata !"round.dynamic", metadata !"fpexcept.strict")
58  ret double %1
59}
60;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
61; RV64I: {{.*}}
62; RV64ID: {{.*}}
63; RV64IDINX: {{.*}}
64