xref: /minix3/external/bsd/llvm/dist/llvm/test/CodeGen/X86/pr1489.ll (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc; RUN: llc < %s -disable-fp-elim -O0 -mcpu=i486 | grep 1082126238 | count 3
2*f4a2713aSLionel Sambuc; RUN: llc < %s -disable-fp-elim -O0 -mcpu=i486 | grep -- -1236950581 | count 1
3*f4a2713aSLionel Sambuc;; magic constants are 3.999f and half of 3.999
4*f4a2713aSLionel Sambuc; ModuleID = '1489.c'
5*f4a2713aSLionel Sambuctarget 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*f4a2713aSLionel Sambuctarget triple = "i686-apple-darwin8"
7*f4a2713aSLionel Sambuc@.str = internal constant [13 x i8] c"%d %d %d %d\0A\00"		; <[13 x i8]*> [#uses=1]
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambucdefine i32 @quux() nounwind {
10*f4a2713aSLionel Sambucentry:
11*f4a2713aSLionel Sambuc	%tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 )		; <i32> [#uses=1]
12*f4a2713aSLionel Sambuc	%tmp2 = icmp slt i32 %tmp1, 1		; <i1> [#uses=1]
13*f4a2713aSLionel Sambuc	%tmp23 = zext i1 %tmp2 to i32		; <i32> [#uses=1]
14*f4a2713aSLionel Sambuc	ret i32 %tmp23
15*f4a2713aSLionel Sambuc}
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambucdeclare i32 @lrintf(float)
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambucdefine i32 @foo() nounwind {
20*f4a2713aSLionel Sambucentry:
21*f4a2713aSLionel Sambuc	%tmp1 = tail call i32 @lrint( double 3.999000e+00 )		; <i32> [#uses=1]
22*f4a2713aSLionel Sambuc	%tmp2 = icmp slt i32 %tmp1, 1		; <i1> [#uses=1]
23*f4a2713aSLionel Sambuc	%tmp23 = zext i1 %tmp2 to i32		; <i32> [#uses=1]
24*f4a2713aSLionel Sambuc	ret i32 %tmp23
25*f4a2713aSLionel Sambuc}
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambucdeclare i32 @lrint(double)
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambucdefine i32 @bar() nounwind {
30*f4a2713aSLionel Sambucentry:
31*f4a2713aSLionel Sambuc	%tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 )		; <i32> [#uses=1]
32*f4a2713aSLionel Sambuc	%tmp2 = icmp slt i32 %tmp1, 1		; <i1> [#uses=1]
33*f4a2713aSLionel Sambuc	%tmp23 = zext i1 %tmp2 to i32		; <i32> [#uses=1]
34*f4a2713aSLionel Sambuc	ret i32 %tmp23
35*f4a2713aSLionel Sambuc}
36*f4a2713aSLionel Sambuc
37*f4a2713aSLionel Sambucdefine i32 @baz() nounwind {
38*f4a2713aSLionel Sambucentry:
39*f4a2713aSLionel Sambuc	%tmp1 = tail call i32 @lrintf( float 0x400FFDF3C0000000 )		; <i32> [#uses=1]
40*f4a2713aSLionel Sambuc	%tmp2 = icmp slt i32 %tmp1, 1		; <i1> [#uses=1]
41*f4a2713aSLionel Sambuc	%tmp23 = zext i1 %tmp2 to i32		; <i32> [#uses=1]
42*f4a2713aSLionel Sambuc	ret i32 %tmp23
43*f4a2713aSLionel Sambuc}
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambucdefine i32 @main() nounwind {
46*f4a2713aSLionel Sambucentry:
47*f4a2713aSLionel Sambuc	%tmp = tail call i32 @baz( )		; <i32> [#uses=1]
48*f4a2713aSLionel Sambuc	%tmp1 = tail call i32 @bar( )		; <i32> [#uses=1]
49*f4a2713aSLionel Sambuc	%tmp2 = tail call i32 @foo( )		; <i32> [#uses=1]
50*f4a2713aSLionel Sambuc	%tmp3 = tail call i32 @quux( )		; <i32> [#uses=1]
51*f4a2713aSLionel Sambuc	%tmp5 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 %tmp3, i32 %tmp2, i32 %tmp1, i32 %tmp )		; <i32> [#uses=0]
52*f4a2713aSLionel Sambuc	ret i32 undef
53*f4a2713aSLionel Sambuc}
54*f4a2713aSLionel Sambuc
55*f4a2713aSLionel Sambucdeclare i32 @printf(i8*, ...)
56