1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=x86_64-pc-linux -stackrealign -stack-alignment=32 < %s | FileCheck %s 3; RUN: llc -mtriple=x86_64-pc-linux-gnux32 -stackrealign -stack-alignment=32 < %s | FileCheck -check-prefix=X32ABI %s 4 5; This should run with NaCl as well ( -mtriple=x86_64-pc-nacl ) but currently doesn't due to PR22655 6 7; Make sure the correct register gets set up as the base pointer 8; This should be rbx for x64 and 64-bit NaCl and ebx for x32 9; NACL-LABEL: base 10; NACL: subq $32, %rsp 11; NACL: movq %rsp, %rbx 12 13declare i32 @helper() nounwind 14define void @base() #0 { 15; CHECK-LABEL: base: 16; CHECK: # %bb.0: # %entry 17; CHECK-NEXT: pushq %rbp 18; CHECK-NEXT: movq %rsp, %rbp 19; CHECK-NEXT: pushq %rbx 20; CHECK-NEXT: andq $-32, %rsp 21; CHECK-NEXT: subq $32, %rsp 22; CHECK-NEXT: movq %rsp, %rbx 23; CHECK-NEXT: callq helper 24; CHECK-NEXT: movq %rsp, %rcx 25; CHECK-NEXT: movl %eax, %eax 26; CHECK-NEXT: leaq 31(,%rax,4), %rax 27; CHECK-NEXT: andq $-32, %rax 28; CHECK-NEXT: movq %rcx, %rdx 29; CHECK-NEXT: subq %rax, %rdx 30; CHECK-NEXT: movq %rdx, %rsp 31; CHECK-NEXT: negq %rax 32; CHECK-NEXT: movl $0, (%rcx,%rax) 33; CHECK-NEXT: leaq -8(%rbp), %rsp 34; CHECK-NEXT: popq %rbx 35; CHECK-NEXT: popq %rbp 36; CHECK-NEXT: retq 37; 38; X32ABI-LABEL: base: 39; X32ABI: # %bb.0: # %entry 40; X32ABI-NEXT: pushq %rbp 41; X32ABI-NEXT: movl %esp, %ebp 42; X32ABI-NEXT: pushq %rbx 43; X32ABI-NEXT: andl $-32, %esp 44; X32ABI-NEXT: subl $32, %esp 45; X32ABI-NEXT: movl %esp, %ebx 46; X32ABI-NEXT: callq helper 47; X32ABI-NEXT: # kill: def $eax killed $eax def $rax 48; X32ABI-NEXT: movl %esp, %ecx 49; X32ABI-NEXT: leal 31(,%rax,4), %eax 50; X32ABI-NEXT: andl $-32, %eax 51; X32ABI-NEXT: movl %ecx, %edx 52; X32ABI-NEXT: subl %eax, %edx 53; X32ABI-NEXT: movl %edx, %esp 54; X32ABI-NEXT: negl %eax 55; X32ABI-NEXT: movl $0, (%ecx,%eax) 56; X32ABI-NEXT: leal -8(%ebp), %esp 57; X32ABI-NEXT: popq %rbx 58; X32ABI-NEXT: popq %rbp 59; X32ABI-NEXT: retq 60entry: 61 %k = call i32 @helper() 62 %a = alloca i32, i32 %k, align 4 63 store i32 0, i32* %a, align 4 64 ret void 65} 66 67attributes #0 = { nounwind "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"} 68