xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/x86-64-baseptr.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-pc-linux -stackrealign -stack-alignment=32 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -stackrealign -stack-alignment=32 < %s | FileCheck -check-prefix=X32ABI %s
3*9880d681SAndroid Build Coastguard Worker; This should run with NaCl as well ( -mtriple=x86_64-pc-nacl ) but currently doesn't due to PR22655
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Make sure the correct register gets set up as the base pointer
6*9880d681SAndroid Build Coastguard Worker; This should be rbx for x64 and 64-bit NaCl and ebx for x32
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: base
8*9880d681SAndroid Build Coastguard Worker; CHECK: subq $32, %rsp
9*9880d681SAndroid Build Coastguard Worker; CHECK: movq %rsp, %rbx
10*9880d681SAndroid Build Coastguard Worker; X32ABI-LABEL: base
11*9880d681SAndroid Build Coastguard Worker; X32ABI: subl $32, %esp
12*9880d681SAndroid Build Coastguard Worker; X32ABI: movl %esp, %ebx
13*9880d681SAndroid Build Coastguard Worker; NACL-LABEL: base
14*9880d681SAndroid Build Coastguard Worker; NACL: subq $32, %rsp
15*9880d681SAndroid Build Coastguard Worker; NACL: movq %rsp, %rbx
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdeclare i32 @helper() nounwind
18*9880d681SAndroid Build Coastguard Workerdefine void @base() #0 {
19*9880d681SAndroid Build Coastguard Workerentry:
20*9880d681SAndroid Build Coastguard Worker  %k = call i32 @helper()
21*9880d681SAndroid Build Coastguard Worker  %a = alloca i32, i32 %k, align 4
22*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %a, align 4
23*9880d681SAndroid Build Coastguard Worker  ret void
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"}
27