1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV64I %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi lp64f \
5 ; RUN: -verify-machineinstrs < %s \
6 ; RUN: | FileCheck -check-prefix=RV64I %s
8 ; This file contains tests that should have identical output for the lp64 and
9 ; lp64f ABIs. It doesn't check codegen when frame pointer elimination is
10 ; disabled, as there is sufficient coverage for this case in other files.
12 define i64 @callee_double_in_regs(i64 %a, double %b) nounwind {
13 ; RV64I-LABEL: callee_double_in_regs:
15 ; RV64I-NEXT: addi sp, sp, -16
16 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
17 ; RV64I-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
18 ; RV64I-NEXT: mv s0, a0
19 ; RV64I-NEXT: mv a0, a1
20 ; RV64I-NEXT: call __fixdfdi
21 ; RV64I-NEXT: add a0, s0, a0
22 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
23 ; RV64I-NEXT: ld s0, 0(sp) # 8-byte Folded Reload
24 ; RV64I-NEXT: addi sp, sp, 16
26 %b_fptosi = fptosi double %b to i64
27 %1 = add i64 %a, %b_fptosi
31 define i64 @caller_double_in_regs() nounwind {
32 ; RV64I-LABEL: caller_double_in_regs:
34 ; RV64I-NEXT: addi sp, sp, -16
35 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
36 ; RV64I-NEXT: li a1, 1
37 ; RV64I-NEXT: slli a1, a1, 62
38 ; RV64I-NEXT: li a0, 1
39 ; RV64I-NEXT: call callee_double_in_regs
40 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
41 ; RV64I-NEXT: addi sp, sp, 16
43 %1 = call i64 @callee_double_in_regs(i64 1, double 2.0)
47 define double @callee_double_ret() nounwind {
48 ; RV64I-LABEL: callee_double_ret:
50 ; RV64I-NEXT: li a0, 1023
51 ; RV64I-NEXT: slli a0, a0, 52
56 define i64 @caller_double_ret() nounwind {
57 ; RV64I-LABEL: caller_double_ret:
59 ; RV64I-NEXT: addi sp, sp, -16
60 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
61 ; RV64I-NEXT: call callee_double_ret
62 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
63 ; RV64I-NEXT: addi sp, sp, 16
65 %1 = call double @callee_double_ret()
66 %2 = bitcast double %1 to i64