1; RUN: llc < %s -march=mipsel | FileCheck %s -check-prefix=CHECK 2 3@d2 = external global double 4@d3 = external global double 5 6define i32 @sel1(i32 %s, i32 %f0, i32 %f1) nounwind readnone { 7entry: 8; CHECK: movn 9 %tobool = icmp ne i32 %s, 0 10 %cond = select i1 %tobool, i32 %f1, i32 %f0 11 ret i32 %cond 12} 13 14define float @sel2(i32 %s, float %f0, float %f1) nounwind readnone { 15entry: 16; CHECK: movn.s 17 %tobool = icmp ne i32 %s, 0 18 %cond = select i1 %tobool, float %f0, float %f1 19 ret float %cond 20} 21 22define double @sel2_1(i32 %s, double %f0, double %f1) nounwind readnone { 23entry: 24; CHECK: movn.d 25 %tobool = icmp ne i32 %s, 0 26 %cond = select i1 %tobool, double %f0, double %f1 27 ret double %cond 28} 29 30define float @sel3(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 31entry: 32; CHECK: c.eq.s 33; CHECK: movt.s 34 %cmp = fcmp oeq float %f2, %f3 35 %cond = select i1 %cmp, float %f0, float %f1 36 ret float %cond 37} 38 39define float @sel4(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 40entry: 41; CHECK: c.olt.s 42; CHECK: movt.s 43 %cmp = fcmp olt float %f2, %f3 44 %cond = select i1 %cmp, float %f0, float %f1 45 ret float %cond 46} 47 48define float @sel5(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 49entry: 50; CHECK: c.ule.s 51; CHECK: movf.s 52 %cmp = fcmp ogt float %f2, %f3 53 %cond = select i1 %cmp, float %f0, float %f1 54 ret float %cond 55} 56 57define double @sel5_1(double %f0, double %f1, float %f2, float %f3) nounwind readnone { 58entry: 59; CHECK: c.ule.s 60; CHECK: movf.d 61 %cmp = fcmp ogt float %f2, %f3 62 %cond = select i1 %cmp, double %f0, double %f1 63 ret double %cond 64} 65 66define double @sel6(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 67entry: 68; CHECK: c.eq.d 69; CHECK: movt.d 70 %cmp = fcmp oeq double %f2, %f3 71 %cond = select i1 %cmp, double %f0, double %f1 72 ret double %cond 73} 74 75define double @sel7(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 76entry: 77; CHECK: c.olt.d 78; CHECK: movt.d 79 %cmp = fcmp olt double %f2, %f3 80 %cond = select i1 %cmp, double %f0, double %f1 81 ret double %cond 82} 83 84define double @sel8(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 85entry: 86; CHECK: c.ule.d 87; CHECK: movf.d 88 %cmp = fcmp ogt double %f2, %f3 89 %cond = select i1 %cmp, double %f0, double %f1 90 ret double %cond 91} 92 93define float @sel8_1(float %f0, float %f1, double %f2, double %f3) nounwind readnone { 94entry: 95; CHECK: c.ule.d 96; CHECK: movf.s 97 %cmp = fcmp ogt double %f2, %f3 98 %cond = select i1 %cmp, float %f0, float %f1 99 ret float %cond 100} 101 102define i32 @sel9(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 103entry: 104; CHECK: c.eq.s 105; CHECK: movt 106 %cmp = fcmp oeq float %f2, %f3 107 %cond = select i1 %cmp, i32 %f0, i32 %f1 108 ret i32 %cond 109} 110 111define i32 @sel10(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 112entry: 113; CHECK: c.olt.s 114; CHECK: movt 115 %cmp = fcmp olt float %f2, %f3 116 %cond = select i1 %cmp, i32 %f0, i32 %f1 117 ret i32 %cond 118} 119 120define i32 @sel11(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 121entry: 122; CHECK: c.ule.s 123; CHECK: movf 124 %cmp = fcmp ogt float %f2, %f3 125 %cond = select i1 %cmp, i32 %f0, i32 %f1 126 ret i32 %cond 127} 128 129define i32 @sel12(i32 %f0, i32 %f1) nounwind readonly { 130entry: 131; CHECK: c.eq.d 132; CHECK: movt 133 %tmp = load double* @d2, align 8, !tbaa !0 134 %tmp1 = load double* @d3, align 8, !tbaa !0 135 %cmp = fcmp oeq double %tmp, %tmp1 136 %cond = select i1 %cmp, i32 %f0, i32 %f1 137 ret i32 %cond 138} 139 140define i32 @sel13(i32 %f0, i32 %f1) nounwind readonly { 141entry: 142; CHECK: c.olt.d 143; CHECK: movt 144 %tmp = load double* @d2, align 8, !tbaa !0 145 %tmp1 = load double* @d3, align 8, !tbaa !0 146 %cmp = fcmp olt double %tmp, %tmp1 147 %cond = select i1 %cmp, i32 %f0, i32 %f1 148 ret i32 %cond 149} 150 151define i32 @sel14(i32 %f0, i32 %f1) nounwind readonly { 152entry: 153; CHECK: c.ule.d 154; CHECK: movf 155 %tmp = load double* @d2, align 8, !tbaa !0 156 %tmp1 = load double* @d3, align 8, !tbaa !0 157 %cmp = fcmp ogt double %tmp, %tmp1 158 %cond = select i1 %cmp, i32 %f0, i32 %f1 159 ret i32 %cond 160} 161 162!0 = metadata !{metadata !"double", metadata !1} 163!1 = metadata !{metadata !"omnipotent char", metadata !2} 164!2 = metadata !{metadata !"Simple C/C++ TBAA", null} 165