blob: 6c1ca252bb9740f8a8d574caf980fc2a14df85e1 [file] [log] [blame]
Stephen Hinesc6a4f5e2014-07-21 00:45:20 -07001; 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
6define i8* @test1() nounwind {
7entry:
8; CHECK-32-LABEL: test1
9; CHECK-32: push
10; CHECK-32-NEXT: movl %esp, %ebp
11; CHECK-32-NEXT: movl %ebp, %eax
12; CHECK-32-NEXT: pop
13; CHECK-32-NEXT: ret
14; CHECK-64-LABEL: test1
15; CHECK-64: push
16; CHECK-64-NEXT: movq %rsp, %rbp
17; CHECK-64-NEXT: movq %rbp, %rax
18; CHECK-64-NEXT: pop
19; CHECK-64-NEXT: ret
20 %0 = tail call i8* @llvm.frameaddress(i32 0)
21 ret i8* %0
22}
23
24define i8* @test2() nounwind {
25entry:
26; CHECK-32-LABEL: test2
27; CHECK-32: push
28; CHECK-32-NEXT: movl %esp, %ebp
29; CHECK-32-NEXT: movl (%ebp), %eax
30; CHECK-32-NEXT: movl (%eax), %eax
31; CHECK-32-NEXT: pop
32; CHECK-32-NEXT: ret
33; CHECK-64-LABEL: test2
34; CHECK-64: push
35; CHECK-64-NEXT: movq %rsp, %rbp
36; CHECK-64-NEXT: movq (%rbp), %rax
37; CHECK-64-NEXT: movq (%rax), %rax
38; CHECK-64-NEXT: pop
39; CHECK-64-NEXT: ret
40 %0 = tail call i8* @llvm.frameaddress(i32 2)
41 ret i8* %0
42}
43
44declare i8* @llvm.frameaddress(i32) nounwind readnone