1; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32 2; RUN: llc < %s -march=x86 -fast-isel -fast-isel-abort | FileCheck %s --check-prefix=CHECK-32 3; RUN: llc < %s -march=x86-64 | FileCheck %s --check-prefix=CHECK-64 4; RUN: llc < %s -march=x86-64 -fast-isel -fast-isel-abort | FileCheck %s --check-prefix=CHECK-64 5; RUN: llc < %s -mtriple=x86_64-gnux32 | FileCheck %s --check-prefix=CHECK-X32ABI 6; RUN: llc < %s -mtriple=x86_64-gnux32 -fast-isel -fast-isel-abort | FileCheck %s --check-prefix=CHECK-X32ABI 7; RUN: llc < %s -mtriple=x86_64-nacl | FileCheck %s --check-prefix=CHECK-NACL64 8; RUN: llc < %s -mtriple=x86_64-nacl -fast-isel -fast-isel-abort | FileCheck %s --check-prefix=CHECK-NACL64 9 10define i8* @test1() nounwind { 11entry: 12; CHECK-32-LABEL: test1 13; CHECK-32: push 14; CHECK-32-NEXT: movl %esp, %ebp 15; CHECK-32-NEXT: movl %ebp, %eax 16; CHECK-32-NEXT: pop 17; CHECK-32-NEXT: ret 18; CHECK-64-LABEL: test1 19; CHECK-64: push 20; CHECK-64-NEXT: movq %rsp, %rbp 21; CHECK-64-NEXT: movq %rbp, %rax 22; CHECK-64-NEXT: pop 23; CHECK-64-NEXT: ret 24; CHECK-X32ABI-LABEL: test1 25; CHECK-X32ABI: pushq %rbp 26; CHECK-X32ABI-NEXT: movl %esp, %ebp 27; CHECK-X32ABI-NEXT: movl %ebp, %eax 28; CHECK-X32ABI-NEXT: popq %rbp 29; CHECK-X32ABI-NEXT: ret 30; CHECK-NACL64-LABEL: test1 31; CHECK-NACL64: pushq %rbp 32; CHECK-NACL64-NEXT: movq %rsp, %rbp 33; CHECK-NACL64-NEXT: movl %ebp, %eax 34 %0 = tail call i8* @llvm.frameaddress(i32 0) 35 ret i8* %0 36} 37 38define i8* @test2() nounwind { 39entry: 40; CHECK-32-LABEL: test2 41; CHECK-32: push 42; CHECK-32-NEXT: movl %esp, %ebp 43; CHECK-32-NEXT: movl (%ebp), %eax 44; CHECK-32-NEXT: movl (%eax), %eax 45; CHECK-32-NEXT: pop 46; CHECK-32-NEXT: ret 47; CHECK-64-LABEL: test2 48; CHECK-64: push 49; CHECK-64-NEXT: movq %rsp, %rbp 50; CHECK-64-NEXT: movq (%rbp), %rax 51; CHECK-64-NEXT: movq (%rax), %rax 52; CHECK-64-NEXT: pop 53; CHECK-64-NEXT: ret 54; CHECK-X32ABI-LABEL: test2 55; CHECK-X32ABI: pushq %rbp 56; CHECK-X32ABI-NEXT: movl %esp, %ebp 57; CHECK-X32ABI-NEXT: movl (%ebp), %eax 58; CHECK-X32ABI-NEXT: movl (%eax), %eax 59; CHECK-X32ABI-NEXT: popq %rbp 60; CHECK-X32ABI-NEXT: ret 61; CHECK-NACL64-LABEL: test2 62; CHECK-NACL64: pushq %rbp 63; CHECK-NACL64-NEXT: movq %rsp, %rbp 64; CHECK-NACL64-NEXT: movl (%ebp), %eax 65; CHECK-NACL64-NEXT: movl (%eax), %eax 66 %0 = tail call i8* @llvm.frameaddress(i32 2) 67 ret i8* %0 68} 69 70declare i8* @llvm.frameaddress(i32) nounwind readnone 71