72 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \3; RUN: | FileCheck -check-prefix=RV32I %s4; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \5; RUN: | FileCheck -check-prefix=RV64I %s6; RUN: llc -mtriple=riscv64 -mattr=+experimental-zicfilp -verify-machineinstrs < %s \7; RUN: | FileCheck -check-prefix=RV64I-ZICFILP %s8; RUN: not llc -mtriple=riscv64 -target-abi=lp64e -mattr=+experimental-zicfilp \9; RUN: -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=LP64E-ZICFILP %s10 11; Tests that the 'nest' parameter attribute causes the relevant parameter to be12; passed in the right register.13 14define ptr @nest_receiver(ptr nest %arg) nounwind {15; RV32I-LABEL: nest_receiver:16; RV32I: # %bb.0:17; RV32I-NEXT: mv a0, t218; RV32I-NEXT: ret19;20; RV64I-LABEL: nest_receiver:21; RV64I: # %bb.0:22; RV64I-NEXT: mv a0, t223; RV64I-NEXT: ret24;25; RV64I-ZICFILP-LABEL: nest_receiver:26; RV64I-ZICFILP: # %bb.0:27; RV64I-ZICFILP-NEXT: lpad 028; RV64I-ZICFILP-NEXT: mv a0, t329; RV64I-ZICFILP-NEXT: ret30 ret ptr %arg31}32 33define ptr @nest_caller(ptr %arg) nounwind {34; RV32I-LABEL: nest_caller:35; RV32I: # %bb.0:36; RV32I-NEXT: addi sp, sp, -1637; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill38; RV32I-NEXT: mv t2, a039; RV32I-NEXT: call nest_receiver40; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload41; RV32I-NEXT: addi sp, sp, 1642; RV32I-NEXT: ret43;44; RV64I-LABEL: nest_caller:45; RV64I: # %bb.0:46; RV64I-NEXT: addi sp, sp, -1647; RV64I-NEXT: sd ra, 8(sp) # 8-byte Folded Spill48; RV64I-NEXT: mv t2, a049; RV64I-NEXT: call nest_receiver50; RV64I-NEXT: ld ra, 8(sp) # 8-byte Folded Reload51; RV64I-NEXT: addi sp, sp, 1652; RV64I-NEXT: ret53;54; RV64I-ZICFILP-LABEL: nest_caller:55; RV64I-ZICFILP: # %bb.0:56; RV64I-ZICFILP-NEXT: lpad 057; RV64I-ZICFILP-NEXT: addi sp, sp, -1658; RV64I-ZICFILP-NEXT: sd ra, 8(sp) # 8-byte Folded Spill59; RV64I-ZICFILP-NEXT: mv t3, a060; RV64I-ZICFILP-NEXT: call nest_receiver61; RV64I-ZICFILP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload62; RV64I-ZICFILP-NEXT: addi sp, sp, 1663; RV64I-ZICFILP-NEXT: ret64 %result = call ptr @nest_receiver(ptr nest %arg)65 ret ptr %result66}67 68; LP64E-ZICFILP: LLVM ERROR: Nested functions with control flow protection are not usable with ILP32E or LP64E ABI.69!llvm.module.flags = !{!0}70 71!0 = !{i32 8, !"cf-protection-branch", i32 1}72