Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / fp-elim.ll
1 ; RUN: llc < %s -march=x86 -asm-verbose=false                           | FileCheck %s -check-prefix=FP-ELIM
2 ; RUN: llc < %s -march=x86 -asm-verbose=false -disable-fp-elim          | FileCheck %s -check-prefix=NO-ELIM
3
4 ; Implement -momit-leaf-frame-pointer
5 ; rdar://7886181
6
7 define i32 @t1() nounwind readnone {
8 entry:
9 ; FP-ELIM-LABEL:  t1:
10 ; FP-ELIM-NEXT:     movl
11 ; FP-ELIM-NEXT:     ret
12
13 ; NO-ELIM-LABEL:  t1:
14 ; NO-ELIM-NEXT:     pushl %ebp
15 ; NO-ELIM:          popl %ebp
16 ; NO-ELIM-NEXT:     ret
17   ret i32 10
18 }
19
20 define void @t2() nounwind {
21 entry:
22 ; FP-ELIM-LABEL:  t2:
23 ; FP-ELIM-NOT:      pushl %ebp
24 ; FP-ELIM:          ret
25
26 ; NO-ELIM-LABEL:  t2:
27 ; NO-ELIM-NEXT:     pushl %ebp
28 ; NO-ELIM:          popl %ebp
29 ; NO-ELIM-NEXT:     ret
30   tail call void @foo(i32 0) nounwind
31   ret void
32 }
33
34 define i32 @t3() "no-frame-pointer-elim-non-leaf" nounwind readnone {
35 entry:
36 ; FP-ELIM-LABEL:  t3:
37 ; FP-ELIM-NEXT:     movl
38 ; FP-ELIM-NEXT:     ret
39
40 ; NO-ELIM-LABEL:  t3:
41 ; NO-ELIM-NEXT:     pushl %ebp
42 ; NO-ELIM:          popl %ebp
43 ; NO-ELIM-NEXT:     ret
44   ret i32 10
45 }
46
47 define void @t4() "no-frame-pointer-elim-non-leaf" nounwind {
48 entry:
49 ; FP-ELIM-LABEL:  t4:
50 ; FP-ELIM-NEXT:     pushl %ebp
51 ; FP-ELIM:          popl %ebp
52 ; FP-ELIM-NEXT:     ret
53
54 ; NO-ELIM-LABEL:  t4:
55 ; NO-ELIM-NEXT:     pushl %ebp
56 ; NO-ELIM:          popl %ebp
57 ; NO-ELIM-NEXT:     ret
58   tail call void @foo(i32 0) nounwind
59   ret void
60 }
61
62 declare void @foo(i32)