xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/stack-align.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workerdeclare void @stack_realign_helper(i32 %a, i32* %b)
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@foo = global i32 1
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker;; This is a function where we have a local variable of 64-byte
7*9880d681SAndroid Build Coastguard Worker;; alignment.  We want to see that the stack is aligned (the initial
8*9880d681SAndroid Build Coastguard Worker;; andn), that the local var is accessed via stack pointer (to %o0), and that
9*9880d681SAndroid Build Coastguard Worker;; the argument is accessed via frame pointer not stack pointer (to %o1).
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker;; CHECK-LABEL: stack_realign:
12*9880d681SAndroid Build Coastguard Worker;; CHECK:      andn %sp, 63, %sp
13*9880d681SAndroid Build Coastguard Worker;; CHECK-NEXT: ld [%fp+92], %o0
14*9880d681SAndroid Build Coastguard Worker;; CHECK-NEXT: call stack_realign_helper
15*9880d681SAndroid Build Coastguard Worker;; CHECK-NEXT: add %sp, 128, %o1
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @stack_realign(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g) {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker  %aligned = alloca i32, align 64
20*9880d681SAndroid Build Coastguard Worker  call void @stack_realign_helper(i32 %g, i32* %aligned)
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker}
23