• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 -mattr=+sse,+sse2 | FileCheck %s
2
3define float @min1(float %x, float %y) {
4; CHECK-LABEL: min1
5; CHECK: mins
6	%tmp = fcmp olt float %x, %y
7	%retval = select i1 %tmp, float %x, float %y
8	ret float %retval
9}
10
11define double @min2(double %x, double %y) {
12; CHECK-LABEL: min2
13; CHECK: mins
14	%tmp = fcmp olt double %x, %y
15	%retval = select i1 %tmp, double %x, double %y
16	ret double %retval
17}
18
19declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)
20define <4 x float> @min3(float %x, float %y) {
21; CHECK-LABEL: min3
22; CHECK: mins
23	%vec0 = insertelement <4 x float> undef, float %x, i32 0
24	%vec1 = insertelement <4 x float> undef, float %y, i32 0
25	%retval = tail call <4 x float> @llvm.x86.sse.min.ss(<4 x float> %vec0, <4 x float> %vec1)
26	ret <4 x float> %retval
27}
28
29define float @max1(float %x, float %y) {
30; CHECK-LABEL: max1
31; CHECK: maxs
32	%tmp = fcmp uge float %x, %y
33	%retval = select i1 %tmp, float %x, float %y
34	ret float %retval
35}
36
37define double @max2(double %x, double %y) {
38; CHECK-LABEL: max2
39; CHECK: maxs
40	%tmp = fcmp uge double %x, %y
41	%retval = select i1 %tmp, double %x, double %y
42	ret double %retval
43}
44
45declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)
46define <4 x float> @max3(float %x, float %y) {
47; CHECK-LABEL: max3
48; CHECK: maxs
49	%vec0 = insertelement <4 x float> undef, float %x, i32 0
50	%vec1 = insertelement <4 x float> undef, float %y, i32 0
51	%retval = tail call <4 x float> @llvm.x86.sse.max.ss(<4 x float> %vec0, <4 x float> %vec1)
52	ret <4 x float> %retval
53}
54