Fix a bunch of issues found in a testcase from 400.perlbench.
[oota-llvm.git] / test / Transforms / SimplifyLibCalls / floor.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis > %t
2 ; RUN: not grep {call.*floor(} %t
3 ; RUN: grep {call.*floorf(} %t
4 ; RUN: not grep {call.*ceil(} %t
5 ; RUN: grep {call.*ceilf(} %t
6 ; RUN: not grep {call.*nearbyint(} %t
7 ; RUN: grep {call.*nearbyintf(} %t
8 ; XFAIL: sparc
9
10 declare double %floor(double)
11 declare double %ceil(double)
12 declare double %nearbyint(double)
13
14 float %test_floor(float %C) {
15         %D = cast float %C to double
16         %E = call double %floor(double %D)  ; --> floorf
17         %F = cast double %E to float
18         ret float %F
19 }
20
21 float %test_ceil(float %C) {
22         %D = cast float %C to double
23         %E = call double %ceil(double %D)  ; --> ceilf
24         %F = cast double %E to float
25         ret float %F
26 }
27
28 float %test_nearbyint(float %C) {
29         %D = cast float %C to double
30         %E = call double %nearbyint(double %D)  ; --> floorf
31         %F = cast double %E to float
32         ret float %F
33 }
34