| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: llc < %s -mtriple=riscv32 -mattr=+save-restore -enable-ipra | FileCheck %s --check-prefixes=CHECK,RV32 | |
| ; RUN: llc < %s -mtriple=riscv64 -mattr=+save-restore -enable-ipra | FileCheck %s --check-prefixes=CHECK,RV64 | |
| define internal void @callee() noinline nounwind { | |
| ; CHECK-LABEL: callee: | |
| ; CHECK: # %bb.0: | |
| ; CHECK-NEXT: call t0, __riscv_save_5 | |
| ; CHECK-NEXT: #APP | |
| ; CHECK-NEXT: # clobber s0-s4 | |
| ; CHECK-NEXT: #NO_APP | |
| ; CHECK-NEXT: tail __riscv_restore_5 | |
| call void asm sideeffect "# clobber s0-s4", "~{x8},~{x9},~{x18},~{x19},~{x20}"() | |
| ret void | |
| } | |
| define void @caller() nounwind { | |
| ; RV32-LABEL: caller: | |
| ; RV32: # %bb.0: | |
| ; RV32-NEXT: call t0, __riscv_save_0 | |
| ; RV32-NEXT: #APP | |
| ; RV32-NEXT: li t1, 42 | |
| ; RV32-NEXT: #NO_APP | |
| ; RV32-NEXT: mv a0, t1 | |
| ; RV32-NEXT: mv a1, t2 | |
| ; RV32-NEXT: call callee | |
| ; RV32-NEXT: mv t1, a0 | |
| ; RV32-NEXT: mv t2, a1 | |
| ; RV32-NEXT: #APP | |
| ; RV32-NEXT: # use t1 | |
| ; RV32-NEXT: #NO_APP | |
| ; RV32-NEXT: tail __riscv_restore_0 | |
| ; | |
| ; RV64-LABEL: caller: | |
| ; RV64: # %bb.0: | |
| ; RV64-NEXT: call t0, __riscv_save_0 | |
| ; RV64-NEXT: #APP | |
| ; RV64-NEXT: li t1, 42 | |
| ; RV64-NEXT: #NO_APP | |
| ; RV64-NEXT: mv a0, t1 | |
| ; RV64-NEXT: call callee | |
| ; RV64-NEXT: mv t1, a0 | |
| ; RV64-NEXT: #APP | |
| ; RV64-NEXT: # use t1 | |
| ; RV64-NEXT: #NO_APP | |
| ; RV64-NEXT: tail __riscv_restore_0 | |
| %x = call i64 asm sideeffect "li $0, 42", "={x6}"() | |
| call void @callee() | |
| call void asm sideeffect "# use $0", "{x6}"(i64 %x) | |
| ret void | |
| } |