1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -frame-pointer=all -O0 -mcpu=i486 | FileCheck %s
3 ;; magic constants are 3.999f and half of 3.999
5 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
6 target triple = "i686-apple-darwin8"
7 @.str = internal constant [13 x i8] c"%d %d %d %d\0A\00" ; <ptr> [#uses=1]
9 define i32 @quux() nounwind {
11 ; CHECK: ## %bb.0: ## %entry
12 ; CHECK-NEXT: pushl %ebp
13 ; CHECK-NEXT: movl %esp, %ebp
14 ; CHECK-NEXT: subl $8, %esp
15 ; CHECK-NEXT: movl %esp, %eax
16 ; CHECK-NEXT: movl $1082126238, (%eax) ## imm = 0x407FEF9E
17 ; CHECK-NEXT: calll _lrintf
18 ; CHECK-NEXT: cmpl $1, %eax
19 ; CHECK-NEXT: setl %al
20 ; CHECK-NEXT: andb $1, %al
21 ; CHECK-NEXT: movzbl %al, %eax
22 ; CHECK-NEXT: addl $8, %esp
23 ; CHECK-NEXT: popl %ebp
26 %tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 ) ; <i32> [#uses=1]
27 %tmp2 = icmp slt i32 %tmp1, 1 ; <i1> [#uses=1]
28 %tmp23 = zext i1 %tmp2 to i32 ; <i32> [#uses=1]
32 declare i32 @lrintf(float)
34 define i32 @foo() nounwind {
36 ; CHECK: ## %bb.0: ## %entry
37 ; CHECK-NEXT: pushl %ebp
38 ; CHECK-NEXT: movl %esp, %ebp
39 ; CHECK-NEXT: subl $8, %esp
40 ; CHECK-NEXT: movl %esp, %eax
41 ; CHECK-NEXT: movl $1074789875, 4(%eax) ## imm = 0x400FFDF3
42 ; CHECK-NEXT: movl $-1236950581, (%eax) ## imm = 0xB645A1CB
43 ; CHECK-NEXT: calll _lrint
44 ; CHECK-NEXT: cmpl $1, %eax
45 ; CHECK-NEXT: setl %al
46 ; CHECK-NEXT: andb $1, %al
47 ; CHECK-NEXT: movzbl %al, %eax
48 ; CHECK-NEXT: addl $8, %esp
49 ; CHECK-NEXT: popl %ebp
52 %tmp1 = tail call i32 @lrint( double 3.999000e+00 ) ; <i32> [#uses=1]
53 %tmp2 = icmp slt i32 %tmp1, 1 ; <i1> [#uses=1]
54 %tmp23 = zext i1 %tmp2 to i32 ; <i32> [#uses=1]
58 declare i32 @lrint(double)
60 define i32 @bar() nounwind {
62 ; CHECK: ## %bb.0: ## %entry
63 ; CHECK-NEXT: pushl %ebp
64 ; CHECK-NEXT: movl %esp, %ebp
65 ; CHECK-NEXT: subl $8, %esp
66 ; CHECK-NEXT: movl %esp, %eax
67 ; CHECK-NEXT: movl $1082126238, (%eax) ## imm = 0x407FEF9E
68 ; CHECK-NEXT: calll _lrintf
69 ; CHECK-NEXT: cmpl $1, %eax
70 ; CHECK-NEXT: setl %al
71 ; CHECK-NEXT: andb $1, %al
72 ; CHECK-NEXT: movzbl %al, %eax
73 ; CHECK-NEXT: addl $8, %esp
74 ; CHECK-NEXT: popl %ebp
77 %tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 ) ; <i32> [#uses=1]
78 %tmp2 = icmp slt i32 %tmp1, 1 ; <i1> [#uses=1]
79 %tmp23 = zext i1 %tmp2 to i32 ; <i32> [#uses=1]
83 define i32 @baz() nounwind {
85 ; CHECK: ## %bb.0: ## %entry
86 ; CHECK-NEXT: pushl %ebp
87 ; CHECK-NEXT: movl %esp, %ebp
88 ; CHECK-NEXT: subl $8, %esp
89 ; CHECK-NEXT: movl %esp, %eax
90 ; CHECK-NEXT: movl $1082126238, (%eax) ## imm = 0x407FEF9E
91 ; CHECK-NEXT: calll _lrintf
92 ; CHECK-NEXT: cmpl $1, %eax
93 ; CHECK-NEXT: setl %al
94 ; CHECK-NEXT: andb $1, %al
95 ; CHECK-NEXT: movzbl %al, %eax
96 ; CHECK-NEXT: addl $8, %esp
97 ; CHECK-NEXT: popl %ebp
100 %tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 ) ; <i32> [#uses=1]
101 %tmp2 = icmp slt i32 %tmp1, 1 ; <i1> [#uses=1]
102 %tmp23 = zext i1 %tmp2 to i32 ; <i32> [#uses=1]
106 define i32 @main() nounwind {
108 ; CHECK: ## %bb.0: ## %entry
109 ; CHECK-NEXT: pushl %ebp
110 ; CHECK-NEXT: movl %esp, %ebp
111 ; CHECK-NEXT: pushl %edi
112 ; CHECK-NEXT: pushl %esi
113 ; CHECK-NEXT: subl $32, %esp
114 ; CHECK-NEXT: calll _baz
115 ; CHECK-NEXT: movl %eax, %edi
116 ; CHECK-NEXT: calll _bar
117 ; CHECK-NEXT: movl %eax, %esi
118 ; CHECK-NEXT: calll _foo
119 ; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) ## 4-byte Spill
120 ; CHECK-NEXT: calll _quux
121 ; CHECK-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %edx ## 4-byte Reload
122 ; CHECK-NEXT: movl %eax, %ecx
123 ; CHECK-NEXT: movl %esp, %eax
124 ; CHECK-NEXT: movl %edi, 16(%eax)
125 ; CHECK-NEXT: movl %esi, 12(%eax)
126 ; CHECK-NEXT: movl %edx, 8(%eax)
127 ; CHECK-NEXT: movl %ecx, 4(%eax)
128 ; CHECK-NEXT: movl $_.str, (%eax)
129 ; CHECK-NEXT: calll _printf
130 ; CHECK-NEXT: ## implicit-def: $eax
131 ; CHECK-NEXT: addl $32, %esp
132 ; CHECK-NEXT: popl %esi
133 ; CHECK-NEXT: popl %edi
134 ; CHECK-NEXT: popl %ebp
137 %tmp = tail call i32 @baz( ) ; <i32> [#uses=1]
138 %tmp1 = tail call i32 @bar( ) ; <i32> [#uses=1]
139 %tmp2 = tail call i32 @foo( ) ; <i32> [#uses=1]
140 %tmp3 = tail call i32 @quux( ) ; <i32> [#uses=1]
141 %tmp5 = tail call i32 (ptr, ...) @printf( ptr @.str, i32 %tmp3, i32 %tmp2, i32 %tmp1, i32 %tmp ) ; <i32> [#uses=0]
145 declare i32 @printf(ptr, ...)