1 ; RUN: llc < %s -march=mipsel -mcpu=4ke | FileCheck %s -check-prefix=CHECK-MIPS32R2
2 ; RUN: llc < %s -march=mipsel | FileCheck %s -check-prefix=CHECK-MIPS1
4 @d2 = external global double
5 @d3 = external global double
7 define i32 @sel1(i32 %s, i32 %f0, i32 %f1) nounwind readnone {
11 %tobool = icmp ne i32 %s, 0
12 %cond = select i1 %tobool, i32 %f1, i32 %f0
16 define float @sel2(i32 %s, float %f0, float %f1) nounwind readnone {
18 ; CHECK-MIPS32R2: movn.s
20 %tobool = icmp ne i32 %s, 0
21 %cond = select i1 %tobool, float %f0, float %f1
25 define double @sel2_1(i32 %s, double %f0, double %f1) nounwind readnone {
27 ; CHECK-MIPS32R2: movn.d
29 %tobool = icmp ne i32 %s, 0
30 %cond = select i1 %tobool, double %f0, double %f1
34 define float @sel3(float %f0, float %f1, float %f2, float %f3) nounwind readnone {
36 ; CHECK-MIPS32R2: c.eq.s
37 ; CHECK-MIPS32R2: movt.s
40 %cmp = fcmp oeq float %f2, %f3
41 %cond = select i1 %cmp, float %f0, float %f1
45 define float @sel4(float %f0, float %f1, float %f2, float %f3) nounwind readnone {
47 ; CHECK-MIPS32R2: c.olt.s
48 ; CHECK-MIPS32R2: movt.s
49 ; CHECK-MIPS1: c.olt.s
51 %cmp = fcmp olt float %f2, %f3
52 %cond = select i1 %cmp, float %f0, float %f1
56 define float @sel5(float %f0, float %f1, float %f2, float %f3) nounwind readnone {
58 ; CHECK-MIPS32R2: c.ule.s
59 ; CHECK-MIPS32R2: movf.s
60 ; CHECK-MIPS1: c.ule.s
62 %cmp = fcmp ogt float %f2, %f3
63 %cond = select i1 %cmp, float %f0, float %f1
67 define double @sel5_1(double %f0, double %f1, float %f2, float %f3) nounwind readnone {
69 ; CHECK-MIPS32R2: c.ule.s
70 ; CHECK-MIPS32R2: movf.d
71 ; CHECK-MIPS1: c.ule.s
73 %cmp = fcmp ogt float %f2, %f3
74 %cond = select i1 %cmp, double %f0, double %f1
78 define double @sel6(double %f0, double %f1, double %f2, double %f3) nounwind readnone {
80 ; CHECK-MIPS32R2: c.eq.d
81 ; CHECK-MIPS32R2: movt.d
84 %cmp = fcmp oeq double %f2, %f3
85 %cond = select i1 %cmp, double %f0, double %f1
89 define double @sel7(double %f0, double %f1, double %f2, double %f3) nounwind readnone {
91 ; CHECK-MIPS32R2: c.olt.d
92 ; CHECK-MIPS32R2: movt.d
93 ; CHECK-MIPS1: c.olt.d
95 %cmp = fcmp olt double %f2, %f3
96 %cond = select i1 %cmp, double %f0, double %f1
100 define double @sel8(double %f0, double %f1, double %f2, double %f3) nounwind readnone {
102 ; CHECK-MIPS32R2: c.ule.d
103 ; CHECK-MIPS32R2: movf.d
104 ; CHECK-MIPS1: c.ule.d
106 %cmp = fcmp ogt double %f2, %f3
107 %cond = select i1 %cmp, double %f0, double %f1
111 define float @sel8_1(float %f0, float %f1, double %f2, double %f3) nounwind readnone {
113 ; CHECK-MIPS32R2: c.ule.d
114 ; CHECK-MIPS32R2: movf.s
115 ; CHECK-MIPS1: c.ule.d
117 %cmp = fcmp ogt double %f2, %f3
118 %cond = select i1 %cmp, float %f0, float %f1
122 define i32 @sel9(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone {
124 ; CHECK-MIPS32R2: c.eq.s
125 ; CHECK-MIPS32R2: movt
126 ; CHECK-MIPS1: c.eq.s
128 %cmp = fcmp oeq float %f2, %f3
129 %cond = select i1 %cmp, i32 %f0, i32 %f1
133 define i32 @sel10(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone {
135 ; CHECK-MIPS32R2: c.olt.s
136 ; CHECK-MIPS32R2: movt
137 ; CHECK-MIPS1: c.olt.s
139 %cmp = fcmp olt float %f2, %f3
140 %cond = select i1 %cmp, i32 %f0, i32 %f1
144 define i32 @sel11(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone {
146 ; CHECK-MIPS32R2: c.ule.s
147 ; CHECK-MIPS32R2: movf
148 ; CHECK-MIPS1: c.ule.s
150 %cmp = fcmp ogt float %f2, %f3
151 %cond = select i1 %cmp, i32 %f0, i32 %f1
155 define i32 @sel12(i32 %f0, i32 %f1) nounwind readonly {
157 ; CHECK-MIPS32R2: c.eq.d
158 ; CHECK-MIPS32R2: movt
159 ; CHECK-MIPS1: c.eq.d
161 %tmp = load double* @d2, align 8, !tbaa !0
162 %tmp1 = load double* @d3, align 8, !tbaa !0
163 %cmp = fcmp oeq double %tmp, %tmp1
164 %cond = select i1 %cmp, i32 %f0, i32 %f1
168 define i32 @sel13(i32 %f0, i32 %f1) nounwind readonly {
170 ; CHECK-MIPS32R2: c.olt.d
171 ; CHECK-MIPS32R2: movt
172 ; CHECK-MIPS1: c.olt.d
174 %tmp = load double* @d2, align 8, !tbaa !0
175 %tmp1 = load double* @d3, align 8, !tbaa !0
176 %cmp = fcmp olt double %tmp, %tmp1
177 %cond = select i1 %cmp, i32 %f0, i32 %f1
181 define i32 @sel14(i32 %f0, i32 %f1) nounwind readonly {
183 ; CHECK-MIPS32R2: c.ule.d
184 ; CHECK-MIPS32R2: movf
185 ; CHECK-MIPS1: c.ule.d
187 %tmp = load double* @d2, align 8, !tbaa !0
188 %tmp1 = load double* @d3, align 8, !tbaa !0
189 %cmp = fcmp ogt double %tmp, %tmp1
190 %cond = select i1 %cmp, i32 %f0, i32 %f1
194 !0 = metadata !{metadata !"double", metadata !1}
195 !1 = metadata !{metadata !"omnipotent char", metadata !2}
196 !2 = metadata !{metadata !"Simple C/C++ TBAA", null}