1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
4 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64I %s
7 ; Tests that the 'nest' parameter attribute causes the relevant parameter to be
8 ; passed in the right register.
10 define ptr @nest_receiver(ptr nest %arg) nounwind {
11 ; RV32I-LABEL: nest_receiver:
13 ; RV32I-NEXT: mv a0, t2
16 ; RV64I-LABEL: nest_receiver:
18 ; RV64I-NEXT: mv a0, t2
23 define ptr @nest_caller(ptr %arg) nounwind {
24 ; RV32I-LABEL: nest_caller:
26 ; RV32I-NEXT: addi sp, sp, -16
27 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
28 ; RV32I-NEXT: mv t2, a0
29 ; RV32I-NEXT: call nest_receiver
30 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
31 ; RV32I-NEXT: addi sp, sp, 16
34 ; RV64I-LABEL: nest_caller:
36 ; RV64I-NEXT: addi sp, sp, -16
37 ; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
38 ; RV64I-NEXT: mv t2, a0
39 ; RV64I-NEXT: call nest_receiver
40 ; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
41 ; RV64I-NEXT: addi sp, sp, 16
43 %result = call ptr @nest_receiver(ptr nest %arg)