xref: /llvm-project/llvm/test/CodeGen/RISCV/saverestore-scs.ll (revision 9e1ad3cff6a855fdfdc1d91323e2021726da04ea)
1;; Check that shadow call stack doesn't interfere with save/restore
2
3; RUN: llc -mtriple=riscv32 < %s | FileCheck %s -check-prefix=RV32I
4; RUN: llc -mtriple=riscv64 < %s | FileCheck %s -check-prefix=RV64I
5; RUN: llc -mtriple=riscv32 -mattr=+save-restore < %s | FileCheck %s -check-prefix=RV32I-SR
6; RUN: llc -mtriple=riscv64 -mattr=+save-restore < %s | FileCheck %s -check-prefix=RV64I-SR
7; RUN: llc -mtriple=riscv32 -mattr=+f,+save-restore -target-abi=ilp32f < %s | FileCheck %s -check-prefix=RV32I-FP-SR
8; RUN: llc -mtriple=riscv64 -mattr=+f,+d,+save-restore -target-abi=lp64d < %s | FileCheck %s -check-prefix=RV64I-FP-SR
9
10@var2 = global [30 x i32] zeroinitializer
11
12define void @callee_scs() nounwind shadowcallstack {
13; RV32I-LABEL: callee_scs:
14; RV32I-NOT:     call t0, __riscv_save
15; RV32I-NOT:     tail __riscv_restore
16;
17; RV64I-LABEL: callee_scs:
18; RV64I-NOT:     call t0, __riscv_save
19; RV64I-NOT:     tail __riscv_restore
20;
21; RV32I-SR-LABEL: callee_scs:
22; RV32I-SR:         call t0, __riscv_save_12
23; RV32I-SR:         tail __riscv_restore_12
24;
25; RV64I-SR-LABEL: callee_scs:
26; RV64I-SR:         call t0, __riscv_save_12
27; RV64I-SR:         tail __riscv_restore_12
28;
29; RV32I-FP-SR-LABEL: callee_scs:
30; RV32I-FP-SR:         call t0, __riscv_save_12
31; RV32I-FP-SR:         tail __riscv_restore_12
32;
33; RV64I-FP-SR-LABEL: callee_scs:
34; RV64I-FP-SR:         call t0, __riscv_save_12
35; RV64I-FP-SR:         tail __riscv_restore_12
36  %val = load [30 x i32], ptr @var2
37  store volatile [30 x i32] %val, ptr @var2
38  ret void
39}
40