1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem | FileCheck %s 2 3 define double @test1(double %a, double %b, double %eps) { 4 %cmp = fcmp olt double %a, %eps 5 %cond = select i1 %cmp, double %b, double 0.000000e+00 6 ret double %cond 7 8 ; CHECK-LABEL: @test1 9 ; CHECK: cmpltsd %xmm2, %xmm0 10 ; CHECK-NEXT: andpd %xmm1, %xmm0 11 } 12 13 define double @test2(double %a, double %b, double %eps) { 14 %cmp = fcmp ole double %a, %eps 15 %cond = select i1 %cmp, double %b, double 0.000000e+00 16 ret double %cond 17 18 ; CHECK-LABEL: @test2 19 ; CHECK: cmplesd %xmm2, %xmm0 20 ; CHECK-NEXT: andpd %xmm1, %xmm0 21 } 22 23 define double @test3(double %a, double %b, double %eps) { 24 %cmp = fcmp ogt double %a, %eps 25 %cond = select i1 %cmp, double %b, double 0.000000e+00 26 ret double %cond 27 28 ; CHECK-LABEL: @test3 29 ; CHECK: cmpltsd %xmm0, %xmm2 30 ; CHECK-NEXT: andpd %xmm1, %xmm2 31 } 32 33 define double @test4(double %a, double %b, double %eps) { 34 %cmp = fcmp oge double %a, %eps 35 %cond = select i1 %cmp, double %b, double 0.000000e+00 36 ret double %cond 37 38 ; CHECK-LABEL: @test4 39 ; CHECK: cmplesd %xmm0, %xmm2 40 ; CHECK-NEXT: andpd %xmm1, %xmm2 41 } 42 43 define double @test5(double %a, double %b, double %eps) { 44 %cmp = fcmp olt double %a, %eps 45 %cond = select i1 %cmp, double 0.000000e+00, double %b 46 ret double %cond 47 48 ; CHECK-LABEL: @test5 49 ; CHECK: cmpltsd %xmm2, %xmm0 50 ; CHECK-NEXT: andnpd %xmm1, %xmm0 51 } 52 53 define double @test6(double %a, double %b, double %eps) { 54 %cmp = fcmp ole double %a, %eps 55 %cond = select i1 %cmp, double 0.000000e+00, double %b 56 ret double %cond 57 58 ; CHECK-LABEL: @test6 59 ; CHECK: cmplesd %xmm2, %xmm0 60 ; CHECK-NEXT: andnpd %xmm1, %xmm0 61 } 62 63 define double @test7(double %a, double %b, double %eps) { 64 %cmp = fcmp ogt double %a, %eps 65 %cond = select i1 %cmp, double 0.000000e+00, double %b 66 ret double %cond 67 68 ; CHECK-LABEL: @test7 69 ; CHECK: cmpltsd %xmm0, %xmm2 70 ; CHECK-NEXT: andnpd %xmm1, %xmm2 71 } 72 73 define double @test8(double %a, double %b, double %eps) { 74 %cmp = fcmp oge double %a, %eps 75 %cond = select i1 %cmp, double 0.000000e+00, double %b 76 ret double %cond 77 78 ; CHECK-LABEL: @test8 79 ; CHECK: cmplesd %xmm0, %xmm2 80 ; CHECK-NEXT: andnpd %xmm1, %xmm2 81 } 82 83 define float @test9(float %a, float %b, float %eps) { 84 %cmp = fcmp olt float %a, %eps 85 %cond = select i1 %cmp, float %b, float 0.000000e+00 86 ret float %cond 87 88 ; CHECK-LABEL: @test9 89 ; CHECK: cmpltss %xmm2, %xmm0 90 ; CHECK-NEXT: andps %xmm1, %xmm0 91 } 92 93 define float @test10(float %a, float %b, float %eps) { 94 %cmp = fcmp ole float %a, %eps 95 %cond = select i1 %cmp, float %b, float 0.000000e+00 96 ret float %cond 97 98 ; CHECK-LABEL: @test10 99 ; CHECK: cmpless %xmm2, %xmm0 100 ; CHECK-NEXT: andps %xmm1, %xmm0 101 } 102 103 define float @test11(float %a, float %b, float %eps) { 104 %cmp = fcmp ogt float %a, %eps 105 %cond = select i1 %cmp, float %b, float 0.000000e+00 106 ret float %cond 107 108 ; CHECK-LABEL: @test11 109 ; CHECK: cmpltss %xmm0, %xmm2 110 ; CHECK-NEXT: andps %xmm1, %xmm2 111 } 112 113 define float @test12(float %a, float %b, float %eps) { 114 %cmp = fcmp oge float %a, %eps 115 %cond = select i1 %cmp, float %b, float 0.000000e+00 116 ret float %cond 117 118 ; CHECK-LABEL: @test12 119 ; CHECK: cmpless %xmm0, %xmm2 120 ; CHECK-NEXT: andps %xmm1, %xmm2 121 } 122 123 define float @test13(float %a, float %b, float %eps) { 124 %cmp = fcmp olt float %a, %eps 125 %cond = select i1 %cmp, float 0.000000e+00, float %b 126 ret float %cond 127 128 ; CHECK-LABEL: @test13 129 ; CHECK: cmpltss %xmm2, %xmm0 130 ; CHECK-NEXT: andnps %xmm1, %xmm0 131 } 132 133 define float @test14(float %a, float %b, float %eps) { 134 %cmp = fcmp ole float %a, %eps 135 %cond = select i1 %cmp, float 0.000000e+00, float %b 136 ret float %cond 137 138 ; CHECK-LABEL: @test14 139 ; CHECK: cmpless %xmm2, %xmm0 140 ; CHECK-NEXT: andnps %xmm1, %xmm0 141 } 142 143 define float @test15(float %a, float %b, float %eps) { 144 %cmp = fcmp ogt float %a, %eps 145 %cond = select i1 %cmp, float 0.000000e+00, float %b 146 ret float %cond 147 148 ; CHECK-LABEL: @test15 149 ; CHECK: cmpltss %xmm0, %xmm2 150 ; CHECK-NEXT: andnps %xmm1, %xmm2 151 } 152 153 define float @test16(float %a, float %b, float %eps) { 154 %cmp = fcmp oge float %a, %eps 155 %cond = select i1 %cmp, float 0.000000e+00, float %b 156 ret float %cond 157 158 ; CHECK-LABEL: @test16 159 ; CHECK: cmpless %xmm0, %xmm2 160 ; CHECK-NEXT: andnps %xmm1, %xmm2 161 } 162 163 define float @test17(float %a, float %b, float %c, float %eps) { 164 %cmp = fcmp oge float %a, %eps 165 %cond = select i1 %cmp, float %c, float %b 166 ret float %cond 167 168 ; CHECK-LABEL: @test17 169 ; CHECK: cmpless %xmm0, %xmm3 170 ; CHECK-NEXT: andps %xmm3, %xmm2 171 ; CHECK-NEXT: andnps %xmm1, %xmm3 172 ; CHECK-NEXT: orps %xmm2, %xmm3 173 } 174 175 define double @test18(double %a, double %b, double %c, double %eps) { 176 %cmp = fcmp oge double %a, %eps 177 %cond = select i1 %cmp, double %c, double %b 178 ret double %cond 179 180 ; CHECK-LABEL: @test18 181 ; CHECK: cmplesd %xmm0, %xmm3 182 ; CHECK-NEXT: andpd %xmm3, %xmm2 183 ; CHECK-NEXT: andnpd %xmm1, %xmm3 184 ; CHECK-NEXT: orpd %xmm2, %xmm3 185 } 186