1 ; RUN: llc < %s -march=mipsel | FileCheck %s -check-prefix=CHECK 2 3 @d2 = external global double 4 @d3 = external global double 5 6 define i32 @sel1(i32 %s, i32 %f0, i32 %f1) nounwind readnone { 7 entry: 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 14 define float @sel2(i32 %s, float %f0, float %f1) nounwind readnone { 15 entry: 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 22 define double @sel2_1(i32 %s, double %f0, double %f1) nounwind readnone { 23 entry: 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 30 define float @sel3(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 31 entry: 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 39 define float @sel4(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 40 entry: 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 48 define float @sel5(float %f0, float %f1, float %f2, float %f3) nounwind readnone { 49 entry: 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 57 define double @sel5_1(double %f0, double %f1, float %f2, float %f3) nounwind readnone { 58 entry: 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 66 define double @sel6(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 67 entry: 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 75 define double @sel7(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 76 entry: 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 84 define double @sel8(double %f0, double %f1, double %f2, double %f3) nounwind readnone { 85 entry: 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 93 define float @sel8_1(float %f0, float %f1, double %f2, double %f3) nounwind readnone { 94 entry: 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 102 define i32 @sel9(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 103 entry: 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 111 define i32 @sel10(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 112 entry: 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 120 define i32 @sel11(i32 %f0, i32 %f1, float %f2, float %f3) nounwind readnone { 121 entry: 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 129 define i32 @sel12(i32 %f0, i32 %f1) nounwind readonly { 130 entry: 131 ; CHECK: c.eq.d 132 ; CHECK: movt 133 %tmp = load double* @d2, align 8 134 %tmp1 = load double* @d3, align 8 135 %cmp = fcmp oeq double %tmp, %tmp1 136 %cond = select i1 %cmp, i32 %f0, i32 %f1 137 ret i32 %cond 138 } 139 140 define i32 @sel13(i32 %f0, i32 %f1) nounwind readonly { 141 entry: 142 ; CHECK: c.olt.d 143 ; CHECK: movt 144 %tmp = load double* @d2, align 8 145 %tmp1 = load double* @d3, align 8 146 %cmp = fcmp olt double %tmp, %tmp1 147 %cond = select i1 %cmp, i32 %f0, i32 %f1 148 ret i32 %cond 149 } 150 151 define i32 @sel14(i32 %f0, i32 %f1) nounwind readonly { 152 entry: 153 ; CHECK: c.ule.d 154 ; CHECK: movf 155 %tmp = load double* @d2, align 8 156 %tmp1 = load double* @d3, align 8 157 %cmp = fcmp ogt double %tmp, %tmp1 158 %cond = select i1 %cmp, i32 %f0, i32 %f1 159 ret i32 %cond 160 } 161