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