Update tests.
[oota-llvm.git] / test / CodeGen / X86 / scalar_sse_minmax.ll
1 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse1,+sse2 | grep mins | wc -l | grep 3 &&
2 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse1,+sse2 | grep maxs | wc -l | grep 2
3
4 declare bool %llvm.isunordered.f64( double %x, double %y )
5 declare bool %llvm.isunordered.f32( float %x, float %y )
6
7 implementation
8
9 float %min1(float %x, float %y) {
10         %tmp = setlt float %x, %y               ; <bool> [#uses=1]
11         %retval = select bool %tmp, float %x, float %y          ; <float> [#uses=1]
12         ret float %retval
13 }
14 double %min2(double %x, double %y) {
15         %tmp = setlt double %x, %y
16         %retval = select bool %tmp, double %x, double %y
17         ret double %retval
18 }
19
20 float %max1(float %x, float %y) {
21         %tmp = setge float %x, %y               ; <bool> [#uses=1]
22         %tmp2 = tail call bool %llvm.isunordered.f32( float %x, float %y )
23         %tmp3 = or bool %tmp2, %tmp             ; <bool> [#uses=1]
24         %retval = select bool %tmp3, float %x, float %y         
25         ret float %retval
26 }
27
28 double %max2(double %x, double %y) {
29         %tmp = setge double %x, %y               ; <bool> [#uses=1]
30         %tmp2 = tail call bool %llvm.isunordered.f64( double %x, double %y )
31         %tmp3 = or bool %tmp2, %tmp             ; <bool> [#uses=1]
32         %retval = select bool %tmp3, double %x, double %y
33         ret double %retval
34 }
35
36 <4 x float> %min3(float %tmp37) {
37         %tmp375 = insertelement <4 x float> undef, float %tmp37, uint 0
38         %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > )
39         ret <4 x float> %tmp48
40 }
41
42 declare <4 x float> %llvm.x86.sse.min.ss(<4 x float>, <4 x float>)