1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem -asm-verbose=false | FileCheck %s 2 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem -asm-verbose=false -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck -check-prefix=UNSAFE %s 3 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem -asm-verbose=false -enable-no-nans-fp-math | FileCheck -check-prefix=FINITE %s 4 5 ; Some of these patterns can be matched as SSE min or max. Some of 6 ; them can be matched provided that the operands are swapped. 7 ; Some of them can't be matched at all and require a comparison 8 ; and a conditional branch. 9 10 ; The naming convention is {,x_,y_}{o,u}{gt,lt,ge,le}{,_inverse} 11 ; _x: use 0.0 instead of %y 12 ; _y: use -0.0 instead of %y 13 ; _inverse : swap the arms of the select. 14 15 ; CHECK-LABEL: ogt: 16 ; CHECK-NEXT: maxsd %xmm1, %xmm0 17 ; CHECK-NEXT: ret 18 ; UNSAFE-LABEL: ogt: 19 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 20 ; UNSAFE-NEXT: ret 21 ; FINITE-LABEL: ogt: 22 ; FINITE-NEXT: maxsd %xmm1, %xmm0 23 ; FINITE-NEXT: ret 24 define double @ogt(double %x, double %y) nounwind { 25 %c = fcmp ogt double %x, %y 26 %d = select i1 %c, double %x, double %y 27 ret double %d 28 } 29 30 ; CHECK-LABEL: olt: 31 ; CHECK-NEXT: minsd %xmm1, %xmm0 32 ; CHECK-NEXT: ret 33 ; UNSAFE-LABEL: olt: 34 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 35 ; UNSAFE-NEXT: ret 36 ; FINITE-LABEL: olt: 37 ; FINITE-NEXT: minsd %xmm1, %xmm0 38 ; FINITE-NEXT: ret 39 define double @olt(double %x, double %y) nounwind { 40 %c = fcmp olt double %x, %y 41 %d = select i1 %c, double %x, double %y 42 ret double %d 43 } 44 45 ; CHECK-LABEL: ogt_inverse: 46 ; CHECK-NEXT: minsd %xmm0, %xmm1 47 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 48 ; CHECK-NEXT: ret 49 ; UNSAFE-LABEL: ogt_inverse: 50 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 51 ; UNSAFE-NEXT: ret 52 ; FINITE-LABEL: ogt_inverse: 53 ; FINITE-NEXT: minsd %xmm0, %xmm1 54 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 55 ; FINITE-NEXT: ret 56 define double @ogt_inverse(double %x, double %y) nounwind { 57 %c = fcmp ogt double %x, %y 58 %d = select i1 %c, double %y, double %x 59 ret double %d 60 } 61 62 ; CHECK-LABEL: olt_inverse: 63 ; CHECK-NEXT: maxsd %xmm0, %xmm1 64 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 65 ; CHECK-NEXT: ret 66 ; UNSAFE-LABEL: olt_inverse: 67 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 68 ; UNSAFE-NEXT: ret 69 ; FINITE-LABEL: olt_inverse: 70 ; FINITE-NEXT: maxsd %xmm0, %xmm1 71 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 72 ; FINITE-NEXT: ret 73 define double @olt_inverse(double %x, double %y) nounwind { 74 %c = fcmp olt double %x, %y 75 %d = select i1 %c, double %y, double %x 76 ret double %d 77 } 78 79 ; CHECK-LABEL: oge: 80 ; CHECK: cmplesd %xmm0 81 ; UNSAFE-LABEL: oge: 82 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 83 ; UNSAFE-NEXT: ret 84 ; FINITE-LABEL: oge: 85 ; FINITE-NEXT: maxsd %xmm1, %xmm0 86 ; FINITE-NEXT: ret 87 define double @oge(double %x, double %y) nounwind { 88 %c = fcmp oge double %x, %y 89 %d = select i1 %c, double %x, double %y 90 ret double %d 91 } 92 93 ; CHECK-LABEL: ole: 94 ; CHECK: cmplesd %xmm1 95 ; UNSAFE-LABEL: ole: 96 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 97 ; FINITE-LABEL: ole: 98 ; FINITE-NEXT: minsd %xmm1, %xmm0 99 define double @ole(double %x, double %y) nounwind { 100 %c = fcmp ole double %x, %y 101 %d = select i1 %c, double %x, double %y 102 ret double %d 103 } 104 105 ; CHECK-LABEL: oge_inverse: 106 ; CHECK: cmplesd %xmm0 107 ; UNSAFE-LABEL: oge_inverse: 108 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 109 ; UNSAFE-NEXT: ret 110 ; FINITE-LABEL: oge_inverse: 111 ; FINITE-NEXT: minsd %xmm0, %xmm1 112 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 113 ; FINITE-NEXT: ret 114 define double @oge_inverse(double %x, double %y) nounwind { 115 %c = fcmp oge double %x, %y 116 %d = select i1 %c, double %y, double %x 117 ret double %d 118 } 119 120 ; CHECK-LABEL: ole_inverse: 121 ; CHECK: cmplesd %xmm1 122 ; UNSAFE-LABEL: ole_inverse: 123 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 124 ; UNSAFE-NEXT: ret 125 ; FINITE-LABEL: ole_inverse: 126 ; FINITE-NEXT: maxsd %xmm0, %xmm1 127 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 128 ; FINITE-NEXT: ret 129 define double @ole_inverse(double %x, double %y) nounwind { 130 %c = fcmp ole double %x, %y 131 %d = select i1 %c, double %y, double %x 132 ret double %d 133 } 134 135 ; CHECK-LABEL: ogt_x: 136 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 137 ; CHECK-NEXT: maxsd %xmm1, %xmm0 138 ; CHECK-NEXT: ret 139 ; UNSAFE-LABEL: ogt_x: 140 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 141 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 142 ; UNSAFE-NEXT: ret 143 ; FINITE-LABEL: ogt_x: 144 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 145 ; FINITE-NEXT: maxsd %xmm1, %xmm0 146 ; FINITE-NEXT: ret 147 define double @ogt_x(double %x) nounwind { 148 %c = fcmp ogt double %x, 0.000000e+00 149 %d = select i1 %c, double %x, double 0.000000e+00 150 ret double %d 151 } 152 153 ; CHECK-LABEL: olt_x: 154 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 155 ; CHECK-NEXT: minsd %xmm1, %xmm0 156 ; CHECK-NEXT: ret 157 ; UNSAFE-LABEL: olt_x: 158 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 159 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 160 ; UNSAFE-NEXT: ret 161 ; FINITE-LABEL: olt_x: 162 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 163 ; FINITE-NEXT: minsd %xmm1, %xmm0 164 ; FINITE-NEXT: ret 165 define double @olt_x(double %x) nounwind { 166 %c = fcmp olt double %x, 0.000000e+00 167 %d = select i1 %c, double %x, double 0.000000e+00 168 ret double %d 169 } 170 171 ; CHECK-LABEL: ogt_inverse_x: 172 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 173 ; CHECK-NEXT: minsd %xmm0, %xmm1 174 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 175 ; CHECK-NEXT: ret 176 ; UNSAFE-LABEL: ogt_inverse_x: 177 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 178 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 179 ; UNSAFE-NEXT: ret 180 ; FINITE-LABEL: ogt_inverse_x: 181 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 182 ; FINITE-NEXT: minsd %xmm0, %xmm1 183 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 184 ; FINITE-NEXT: ret 185 define double @ogt_inverse_x(double %x) nounwind { 186 %c = fcmp ogt double %x, 0.000000e+00 187 %d = select i1 %c, double 0.000000e+00, double %x 188 ret double %d 189 } 190 191 ; CHECK-LABEL: olt_inverse_x: 192 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 193 ; CHECK-NEXT: maxsd %xmm0, %xmm1 194 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 195 ; CHECK-NEXT: ret 196 ; UNSAFE-LABEL: olt_inverse_x: 197 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 198 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 199 ; UNSAFE-NEXT: ret 200 ; FINITE-LABEL: olt_inverse_x: 201 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 202 ; FINITE-NEXT: maxsd %xmm0, %xmm1 203 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 204 ; FINITE-NEXT: ret 205 define double @olt_inverse_x(double %x) nounwind { 206 %c = fcmp olt double %x, 0.000000e+00 207 %d = select i1 %c, double 0.000000e+00, double %x 208 ret double %d 209 } 210 211 ; CHECK-LABEL: oge_x: 212 ; CHECK: cmplesd %xmm 213 ; CHECK-NEXT: andpd 214 ; UNSAFE-LABEL: oge_x: 215 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 216 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 217 ; UNSAFE-NEXT: ret 218 ; FINITE-LABEL: oge_x: 219 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 220 ; FINITE-NEXT: maxsd %xmm1, %xmm0 221 ; FINITE-NEXT: ret 222 define double @oge_x(double %x) nounwind { 223 %c = fcmp oge double %x, 0.000000e+00 224 %d = select i1 %c, double %x, double 0.000000e+00 225 ret double %d 226 } 227 228 ; CHECK-LABEL: ole_x: 229 ; CHECK: cmplesd %xmm 230 ; CHECK-NEXT: andpd 231 ; UNSAFE-LABEL: ole_x: 232 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 233 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 234 ; UNSAFE-NEXT: ret 235 ; FINITE-LABEL: ole_x: 236 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 237 ; FINITE-NEXT: minsd %xmm1, %xmm0 238 ; FINITE-NEXT: ret 239 define double @ole_x(double %x) nounwind { 240 %c = fcmp ole double %x, 0.000000e+00 241 %d = select i1 %c, double %x, double 0.000000e+00 242 ret double %d 243 } 244 245 ; CHECK-LABEL: oge_inverse_x: 246 ; CHECK: cmplesd %xmm 247 ; CHECK-NEXT: andnpd 248 ; UNSAFE-LABEL: oge_inverse_x: 249 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 250 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 251 ; UNSAFE-NEXT: ret 252 ; FINITE-LABEL: oge_inverse_x: 253 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 254 ; FINITE-NEXT: minsd %xmm0, %xmm1 255 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 256 ; FINITE-NEXT: ret 257 define double @oge_inverse_x(double %x) nounwind { 258 %c = fcmp oge double %x, 0.000000e+00 259 %d = select i1 %c, double 0.000000e+00, double %x 260 ret double %d 261 } 262 263 ; CHECK-LABEL: ole_inverse_x: 264 ; CHECK: cmplesd %xmm 265 ; UNSAFE-LABEL: ole_inverse_x: 266 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 267 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 268 ; UNSAFE-NEXT: ret 269 ; FINITE-LABEL: ole_inverse_x: 270 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 271 ; FINITE-NEXT: maxsd %xmm0, %xmm1 272 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 273 ; FINITE-NEXT: ret 274 define double @ole_inverse_x(double %x) nounwind { 275 %c = fcmp ole double %x, 0.000000e+00 276 %d = select i1 %c, double 0.000000e+00, double %x 277 ret double %d 278 } 279 280 ; CHECK-LABEL: ugt: 281 ; CHECK: cmpnlesd %xmm1 282 ; UNSAFE-LABEL: ugt: 283 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 284 ; UNSAFE-NEXT: ret 285 ; FINITE-LABEL: ugt: 286 ; FINITE-NEXT: maxsd %xmm1, %xmm0 287 ; FINITE-NEXT: ret 288 define double @ugt(double %x, double %y) nounwind { 289 %c = fcmp ugt double %x, %y 290 %d = select i1 %c, double %x, double %y 291 ret double %d 292 } 293 294 ; CHECK-LABEL: ult: 295 ; CHECK: cmpnlesd %xmm0 296 ; UNSAFE-LABEL: ult: 297 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 298 ; UNSAFE-NEXT: ret 299 ; FINITE-LABEL: ult: 300 ; FINITE-NEXT: minsd %xmm1, %xmm0 301 ; FINITE-NEXT: ret 302 define double @ult(double %x, double %y) nounwind { 303 %c = fcmp ult double %x, %y 304 %d = select i1 %c, double %x, double %y 305 ret double %d 306 } 307 308 ; CHECK-LABEL: ugt_inverse: 309 ; CHECK: cmpnlesd %xmm1 310 ; UNSAFE-LABEL: ugt_inverse: 311 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 312 ; UNSAFE-NEXT: ret 313 ; FINITE-LABEL: ugt_inverse: 314 ; FINITE-NEXT: minsd %xmm0, %xmm1 315 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 316 ; FINITE-NEXT: ret 317 define double @ugt_inverse(double %x, double %y) nounwind { 318 %c = fcmp ugt double %x, %y 319 %d = select i1 %c, double %y, double %x 320 ret double %d 321 } 322 323 ; CHECK-LABEL: ult_inverse: 324 ; CHECK: cmpnlesd %xmm0 325 ; UNSAFE-LABEL: ult_inverse: 326 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 327 ; UNSAFE-NEXT: ret 328 ; FINITE-LABEL: ult_inverse: 329 ; FINITE-NEXT: maxsd %xmm0, %xmm1 330 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 331 ; FINITE-NEXT: ret 332 define double @ult_inverse(double %x, double %y) nounwind { 333 %c = fcmp ult double %x, %y 334 %d = select i1 %c, double %y, double %x 335 ret double %d 336 } 337 338 ; CHECK-LABEL: uge: 339 ; CHECK-NEXT: maxsd %xmm0, %xmm1 340 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 341 ; CHECK-NEXT: ret 342 ; UNSAFE-LABEL: uge: 343 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 344 ; UNSAFE-NEXT: ret 345 ; FINITE-LABEL: uge: 346 ; FINITE-NEXT: maxsd %xmm1, %xmm0 347 ; FINITE-NEXT: ret 348 define double @uge(double %x, double %y) nounwind { 349 %c = fcmp uge double %x, %y 350 %d = select i1 %c, double %x, double %y 351 ret double %d 352 } 353 354 ; CHECK-LABEL: ule: 355 ; CHECK-NEXT: minsd %xmm0, %xmm1 356 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 357 ; CHECK-NEXT: ret 358 ; UNSAFE-LABEL: ule: 359 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 360 ; UNSAFE-NEXT: ret 361 ; FINITE-LABEL: ule: 362 ; FINITE-NEXT: minsd %xmm1, %xmm0 363 ; FINITE-NEXT: ret 364 define double @ule(double %x, double %y) nounwind { 365 %c = fcmp ule double %x, %y 366 %d = select i1 %c, double %x, double %y 367 ret double %d 368 } 369 370 ; CHECK-LABEL: uge_inverse: 371 ; CHECK-NEXT: minsd %xmm1, %xmm0 372 ; CHECK-NEXT: ret 373 ; UNSAFE-LABEL: uge_inverse: 374 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 375 ; UNSAFE-NEXT: ret 376 ; FINITE-LABEL: uge_inverse: 377 ; FINITE-NEXT: minsd %xmm0, %xmm1 378 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 379 ; FINITE-NEXT: ret 380 define double @uge_inverse(double %x, double %y) nounwind { 381 %c = fcmp uge double %x, %y 382 %d = select i1 %c, double %y, double %x 383 ret double %d 384 } 385 386 ; CHECK-LABEL: ule_inverse: 387 ; CHECK-NEXT: maxsd %xmm1, %xmm0 388 ; CHECK-NEXT: ret 389 ; UNSAFE-LABEL: ule_inverse: 390 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 391 ; UNSAFE-NEXT: ret 392 ; FINITE-LABEL: ule_inverse: 393 ; FINITE-NEXT: maxsd %xmm0, %xmm1 394 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 395 ; FINITE-NEXT: ret 396 define double @ule_inverse(double %x, double %y) nounwind { 397 %c = fcmp ule double %x, %y 398 %d = select i1 %c, double %y, double %x 399 ret double %d 400 } 401 402 ; CHECK-LABEL: ugt_x: 403 ; CHECK: cmpnlesd %xmm 404 ; CHECK-NEXT: andpd 405 ; UNSAFE-LABEL: ugt_x: 406 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 407 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 408 ; UNSAFE-NEXT: ret 409 ; FINITE-LABEL: ugt_x: 410 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 411 ; FINITE-NEXT: maxsd %xmm1, %xmm0 412 ; FINITE-NEXT: ret 413 define double @ugt_x(double %x) nounwind { 414 %c = fcmp ugt double %x, 0.000000e+00 415 %d = select i1 %c, double %x, double 0.000000e+00 416 ret double %d 417 } 418 419 ; CHECK-LABEL: ult_x: 420 ; CHECK: cmpnlesd %xmm 421 ; CHECK-NEXT: andpd 422 ; UNSAFE-LABEL: ult_x: 423 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 424 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 425 ; UNSAFE-NEXT: ret 426 ; FINITE-LABEL: ult_x: 427 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 428 ; FINITE-NEXT: minsd %xmm1, %xmm0 429 ; FINITE-NEXT: ret 430 define double @ult_x(double %x) nounwind { 431 %c = fcmp ult double %x, 0.000000e+00 432 %d = select i1 %c, double %x, double 0.000000e+00 433 ret double %d 434 } 435 436 ; CHECK-LABEL: ugt_inverse_x: 437 ; CHECK: cmpnlesd %xmm 438 ; CHECK-NEXT: andnpd 439 ; UNSAFE-LABEL: ugt_inverse_x: 440 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 441 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 442 ; UNSAFE-NEXT: ret 443 ; FINITE-LABEL: ugt_inverse_x: 444 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 445 ; FINITE-NEXT: minsd %xmm0, %xmm1 446 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 447 ; FINITE-NEXT: ret 448 define double @ugt_inverse_x(double %x) nounwind { 449 %c = fcmp ugt double %x, 0.000000e+00 450 %d = select i1 %c, double 0.000000e+00, double %x 451 ret double %d 452 } 453 454 ; CHECK-LABEL: ult_inverse_x: 455 ; CHECK: cmpnlesd %xmm 456 ; CHECK-NEXT: andnpd 457 ; UNSAFE-LABEL: ult_inverse_x: 458 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 459 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 460 ; UNSAFE-NEXT: ret 461 ; FINITE-LABEL: ult_inverse_x: 462 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 463 ; FINITE-NEXT: maxsd %xmm0, %xmm1 464 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 465 ; FINITE-NEXT: ret 466 define double @ult_inverse_x(double %x) nounwind { 467 %c = fcmp ult double %x, 0.000000e+00 468 %d = select i1 %c, double 0.000000e+00, double %x 469 ret double %d 470 } 471 472 ; CHECK-LABEL: uge_x: 473 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 474 ; CHECK-NEXT: maxsd %xmm0, %xmm1 475 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 476 ; CHECK-NEXT: ret 477 ; UNSAFE-LABEL: uge_x: 478 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 479 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 480 ; UNSAFE-NEXT: ret 481 ; FINITE-LABEL: uge_x: 482 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 483 ; FINITE-NEXT: maxsd %xmm1, %xmm0 484 ; FINITE-NEXT: ret 485 define double @uge_x(double %x) nounwind { 486 %c = fcmp uge double %x, 0.000000e+00 487 %d = select i1 %c, double %x, double 0.000000e+00 488 ret double %d 489 } 490 491 ; CHECK-LABEL: ule_x: 492 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 493 ; CHECK-NEXT: minsd %xmm0, %xmm1 494 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 495 ; CHECK-NEXT: ret 496 ; UNSAFE-LABEL: ule_x: 497 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 498 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 499 ; UNSAFE-NEXT: ret 500 ; FINITE-LABEL: ule_x: 501 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 502 ; FINITE-NEXT: minsd %xmm1, %xmm0 503 ; FINITE-NEXT: ret 504 define double @ule_x(double %x) nounwind { 505 %c = fcmp ule double %x, 0.000000e+00 506 %d = select i1 %c, double %x, double 0.000000e+00 507 ret double %d 508 } 509 510 ; CHECK-LABEL: uge_inverse_x: 511 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 512 ; CHECK-NEXT: minsd %xmm1, %xmm0 513 ; CHECK-NEXT: ret 514 ; UNSAFE-LABEL: uge_inverse_x: 515 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 516 ; UNSAFE-NEXT: minsd %xmm1, %xmm0 517 ; UNSAFE-NEXT: ret 518 ; FINITE-LABEL: uge_inverse_x: 519 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 520 ; FINITE-NEXT: minsd %xmm0, %xmm1 521 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 522 ; FINITE-NEXT: ret 523 define double @uge_inverse_x(double %x) nounwind { 524 %c = fcmp uge double %x, 0.000000e+00 525 %d = select i1 %c, double 0.000000e+00, double %x 526 ret double %d 527 } 528 529 ; CHECK-LABEL: ule_inverse_x: 530 ; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 531 ; CHECK-NEXT: maxsd %xmm1, %xmm0 532 ; CHECK-NEXT: ret 533 ; UNSAFE-LABEL: ule_inverse_x: 534 ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 535 ; UNSAFE-NEXT: maxsd %xmm1, %xmm0 536 ; UNSAFE-NEXT: ret 537 ; FINITE-LABEL: ule_inverse_x: 538 ; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 539 ; FINITE-NEXT: maxsd %xmm0, %xmm1 540 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 541 ; FINITE-NEXT: ret 542 define double @ule_inverse_x(double %x) nounwind { 543 %c = fcmp ule double %x, 0.000000e+00 544 %d = select i1 %c, double 0.000000e+00, double %x 545 ret double %d 546 } 547 548 ; CHECK-LABEL: ogt_y: 549 ; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0 550 ; CHECK-NEXT: ret 551 ; UNSAFE-LABEL: ogt_y: 552 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 553 ; UNSAFE-NEXT: ret 554 ; FINITE-LABEL: ogt_y: 555 ; FINITE-NEXT: maxsd {{[^,]*}}, %xmm0 556 ; FINITE-NEXT: ret 557 define double @ogt_y(double %x) nounwind { 558 %c = fcmp ogt double %x, -0.000000e+00 559 %d = select i1 %c, double %x, double -0.000000e+00 560 ret double %d 561 } 562 563 ; CHECK-LABEL: olt_y: 564 ; CHECK-NEXT: minsd {{[^,]*}}, %xmm0 565 ; CHECK-NEXT: ret 566 ; UNSAFE-LABEL: olt_y: 567 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 568 ; UNSAFE-NEXT: ret 569 ; FINITE-LABEL: olt_y: 570 ; FINITE-NEXT: minsd {{[^,]*}}, %xmm0 571 ; FINITE-NEXT: ret 572 define double @olt_y(double %x) nounwind { 573 %c = fcmp olt double %x, -0.000000e+00 574 %d = select i1 %c, double %x, double -0.000000e+00 575 ret double %d 576 } 577 578 ; CHECK-LABEL: ogt_inverse_y: 579 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 580 ; CHECK-NEXT: minsd %xmm0, %xmm1 581 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 582 ; CHECK-NEXT: ret 583 ; UNSAFE-LABEL: ogt_inverse_y: 584 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 585 ; UNSAFE-NEXT: ret 586 ; FINITE-LABEL: ogt_inverse_y: 587 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 588 ; FINITE-NEXT: minsd %xmm0, %xmm1 589 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 590 ; FINITE-NEXT: ret 591 define double @ogt_inverse_y(double %x) nounwind { 592 %c = fcmp ogt double %x, -0.000000e+00 593 %d = select i1 %c, double -0.000000e+00, double %x 594 ret double %d 595 } 596 597 ; CHECK-LABEL: olt_inverse_y: 598 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 599 ; CHECK-NEXT: maxsd %xmm0, %xmm1 600 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 601 ; CHECK-NEXT: ret 602 ; UNSAFE-LABEL: olt_inverse_y: 603 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 604 ; UNSAFE-NEXT: ret 605 ; FINITE-LABEL: olt_inverse_y: 606 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 607 ; FINITE-NEXT: maxsd %xmm0, %xmm1 608 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 609 ; FINITE-NEXT: ret 610 define double @olt_inverse_y(double %x) nounwind { 611 %c = fcmp olt double %x, -0.000000e+00 612 %d = select i1 %c, double -0.000000e+00, double %x 613 ret double %d 614 } 615 616 ; CHECK-LABEL: oge_y: 617 ; CHECK: cmplesd %xmm0 618 ; UNSAFE-LABEL: oge_y: 619 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 620 ; UNSAFE-NEXT: ret 621 ; FINITE-LABEL: oge_y: 622 ; FINITE-NEXT: maxsd {{[^,]*}}, %xmm0 623 ; FINITE-NEXT: ret 624 define double @oge_y(double %x) nounwind { 625 %c = fcmp oge double %x, -0.000000e+00 626 %d = select i1 %c, double %x, double -0.000000e+00 627 ret double %d 628 } 629 630 ; CHECK-LABEL: ole_y: 631 ; CHECK: cmplesd %xmm 632 ; UNSAFE-LABEL: ole_y: 633 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 634 ; UNSAFE-NEXT: ret 635 ; FINITE-LABEL: ole_y: 636 ; FINITE-NEXT: minsd {{[^,]*}}, %xmm0 637 ; FINITE-NEXT: ret 638 define double @ole_y(double %x) nounwind { 639 %c = fcmp ole double %x, -0.000000e+00 640 %d = select i1 %c, double %x, double -0.000000e+00 641 ret double %d 642 } 643 644 ; CHECK-LABEL: oge_inverse_y: 645 ; CHECK: cmplesd %xmm0 646 ; UNSAFE-LABEL: oge_inverse_y: 647 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 648 ; UNSAFE-NEXT: ret 649 ; FINITE-LABEL: oge_inverse_y: 650 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 651 ; FINITE-NEXT: minsd %xmm0, %xmm1 652 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 653 ; FINITE-NEXT: ret 654 define double @oge_inverse_y(double %x) nounwind { 655 %c = fcmp oge double %x, -0.000000e+00 656 %d = select i1 %c, double -0.000000e+00, double %x 657 ret double %d 658 } 659 660 ; CHECK-LABEL: ole_inverse_y: 661 ; CHECK: cmplesd %xmm 662 ; UNSAFE-LABEL: ole_inverse_y: 663 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 664 ; UNSAFE-NEXT: ret 665 ; FINITE-LABEL: ole_inverse_y: 666 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 667 ; FINITE-NEXT: maxsd %xmm0, %xmm1 668 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 669 ; FINITE-NEXT: ret 670 define double @ole_inverse_y(double %x) nounwind { 671 %c = fcmp ole double %x, -0.000000e+00 672 %d = select i1 %c, double -0.000000e+00, double %x 673 ret double %d 674 } 675 676 ; CHECK-LABEL: ugt_y: 677 ; CHECK: cmpnlesd %xmm 678 ; UNSAFE-LABEL: ugt_y: 679 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 680 ; UNSAFE-NEXT: ret 681 ; FINITE-LABEL: ugt_y: 682 ; FINITE-NEXT: maxsd {{[^,]*}}, %xmm0 683 ; FINITE-NEXT: ret 684 define double @ugt_y(double %x) nounwind { 685 %c = fcmp ugt double %x, -0.000000e+00 686 %d = select i1 %c, double %x, double -0.000000e+00 687 ret double %d 688 } 689 690 ; CHECK-LABEL: ult_y: 691 ; CHECK: cmpnlesd %xmm0 692 ; UNSAFE-LABEL: ult_y: 693 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 694 ; UNSAFE-NEXT: ret 695 ; FINITE-LABEL: ult_y: 696 ; FINITE-NEXT: minsd {{[^,]*}}, %xmm0 697 ; FINITE-NEXT: ret 698 define double @ult_y(double %x) nounwind { 699 %c = fcmp ult double %x, -0.000000e+00 700 %d = select i1 %c, double %x, double -0.000000e+00 701 ret double %d 702 } 703 704 ; CHECK-LABEL: ugt_inverse_y: 705 ; CHECK: cmpnlesd %xmm 706 ; UNSAFE-LABEL: ugt_inverse_y: 707 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 708 ; UNSAFE-NEXT: ret 709 ; FINITE-LABEL: ugt_inverse_y: 710 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 711 ; FINITE-NEXT: minsd %xmm0, %xmm1 712 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 713 ; FINITE-NEXT: ret 714 define double @ugt_inverse_y(double %x) nounwind { 715 %c = fcmp ugt double %x, -0.000000e+00 716 %d = select i1 %c, double -0.000000e+00, double %x 717 ret double %d 718 } 719 720 ; CHECK-LABEL: ult_inverse_y: 721 ; CHECK: cmpnlesd %xmm 722 ; UNSAFE-LABEL: ult_inverse_y: 723 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 724 ; UNSAFE-NEXT: ret 725 ; FINITE-LABEL: ult_inverse_y: 726 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 727 ; FINITE-NEXT: maxsd %xmm0, %xmm1 728 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 729 ; FINITE-NEXT: ret 730 define double @ult_inverse_y(double %x) nounwind { 731 %c = fcmp ult double %x, -0.000000e+00 732 %d = select i1 %c, double -0.000000e+00, double %x 733 ret double %d 734 } 735 736 ; CHECK-LABEL: uge_y: 737 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 738 ; CHECK-NEXT: maxsd %xmm0, %xmm1 739 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 740 ; CHECK-NEXT: ret 741 ; UNSAFE-LABEL: uge_y: 742 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 743 ; UNSAFE-NEXT: ret 744 ; FINITE-LABEL: uge_y: 745 ; FINITE-NEXT: maxsd {{[^,]*}}, %xmm0 746 ; FINITE-NEXT: ret 747 define double @uge_y(double %x) nounwind { 748 %c = fcmp uge double %x, -0.000000e+00 749 %d = select i1 %c, double %x, double -0.000000e+00 750 ret double %d 751 } 752 753 ; CHECK-LABEL: ule_y: 754 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 755 ; CHECK-NEXT: minsd %xmm0, %xmm1 756 ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 757 ; CHECK-NEXT: ret 758 ; UNSAFE-LABEL: ule_y: 759 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 760 ; UNSAFE-NEXT: ret 761 ; FINITE-LABEL: ule_y: 762 ; FINITE-NEXT: minsd {{[^,]*}}, %xmm0 763 ; FINITE-NEXT: ret 764 define double @ule_y(double %x) nounwind { 765 %c = fcmp ule double %x, -0.000000e+00 766 %d = select i1 %c, double %x, double -0.000000e+00 767 ret double %d 768 } 769 770 ; CHECK-LABEL: uge_inverse_y: 771 ; CHECK-NEXT: minsd {{[^,]*}}, %xmm0 772 ; CHECK-NEXT: ret 773 ; UNSAFE-LABEL: uge_inverse_y: 774 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 775 ; UNSAFE-NEXT: ret 776 ; FINITE-LABEL: uge_inverse_y: 777 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 778 ; FINITE-NEXT: minsd %xmm0, %xmm1 779 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 780 ; FINITE-NEXT: ret 781 define double @uge_inverse_y(double %x) nounwind { 782 %c = fcmp uge double %x, -0.000000e+00 783 %d = select i1 %c, double -0.000000e+00, double %x 784 ret double %d 785 } 786 787 ; CHECK-LABEL: ule_inverse_y: 788 ; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0 789 ; CHECK-NEXT: ret 790 ; UNSAFE-LABEL: ule_inverse_y: 791 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 792 ; UNSAFE-NEXT: ret 793 ; FINITE-LABEL: ule_inverse_y: 794 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 795 ; FINITE-NEXT: maxsd %xmm0, %xmm1 796 ; FINITE-NEXT: movap{{[sd]}} %xmm1, %xmm0 797 ; FINITE-NEXT: ret 798 define double @ule_inverse_y(double %x) nounwind { 799 %c = fcmp ule double %x, -0.000000e+00 800 %d = select i1 %c, double -0.000000e+00, double %x 801 ret double %d 802 } 803 ; Test a few more misc. cases. 804 805 ; CHECK-LABEL: clampTo3k_a: 806 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 807 ; CHECK-NEXT: minsd %xmm0, %xmm1 808 ; CHECK-NEXT: movapd %xmm1, %xmm0 809 ; CHECK-NEXT: ret 810 ; UNSAFE-LABEL: clampTo3k_a: 811 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 812 ; UNSAFE-NEXT: ret 813 ; FINITE-LABEL: clampTo3k_a: 814 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 815 ; FINITE-NEXT: minsd %xmm0, %xmm1 816 ; FINITE-NEXT: movapd %xmm1, %xmm0 817 ; FINITE-NEXT: ret 818 define double @clampTo3k_a(double %x) nounwind readnone { 819 entry: 820 %0 = fcmp ogt double %x, 3.000000e+03 ; <i1> [#uses=1] 821 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 822 ret double %x_addr.0 823 } 824 825 ; CHECK-LABEL: clampTo3k_b: 826 ; CHECK-NEXT: minsd {{[^,]*}}, %xmm0 827 ; CHECK-NEXT: ret 828 ; UNSAFE-LABEL: clampTo3k_b: 829 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 830 ; UNSAFE-NEXT: ret 831 ; FINITE-LABEL: clampTo3k_b: 832 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 833 ; FINITE-NEXT: minsd %xmm0, %xmm1 834 ; FINITE-NEXT: movapd %xmm1, %xmm0 835 ; FINITE-NEXT: ret 836 define double @clampTo3k_b(double %x) nounwind readnone { 837 entry: 838 %0 = fcmp uge double %x, 3.000000e+03 ; <i1> [#uses=1] 839 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 840 ret double %x_addr.0 841 } 842 843 ; CHECK-LABEL: clampTo3k_c: 844 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 845 ; CHECK-NEXT: maxsd %xmm0, %xmm1 846 ; CHECK-NEXT: movapd %xmm1, %xmm0 847 ; CHECK-NEXT: ret 848 ; UNSAFE-LABEL: clampTo3k_c: 849 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 850 ; UNSAFE-NEXT: ret 851 ; FINITE-LABEL: clampTo3k_c: 852 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 853 ; FINITE-NEXT: maxsd %xmm0, %xmm1 854 ; FINITE-NEXT: movapd %xmm1, %xmm0 855 ; FINITE-NEXT: ret 856 define double @clampTo3k_c(double %x) nounwind readnone { 857 entry: 858 %0 = fcmp olt double %x, 3.000000e+03 ; <i1> [#uses=1] 859 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 860 ret double %x_addr.0 861 } 862 863 ; CHECK-LABEL: clampTo3k_d: 864 ; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0 865 ; CHECK-NEXT: ret 866 ; UNSAFE-LABEL: clampTo3k_d: 867 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 868 ; UNSAFE-NEXT: ret 869 ; FINITE-LABEL: clampTo3k_d: 870 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 871 ; FINITE-NEXT: maxsd %xmm0, %xmm1 872 ; FINITE-NEXT: movapd %xmm1, %xmm0 873 ; FINITE-NEXT: ret 874 define double @clampTo3k_d(double %x) nounwind readnone { 875 entry: 876 %0 = fcmp ule double %x, 3.000000e+03 ; <i1> [#uses=1] 877 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 878 ret double %x_addr.0 879 } 880 881 ; CHECK-LABEL: clampTo3k_e: 882 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 883 ; CHECK-NEXT: maxsd %xmm0, %xmm1 884 ; CHECK-NEXT: movapd %xmm1, %xmm0 885 ; CHECK-NEXT: ret 886 ; UNSAFE-LABEL: clampTo3k_e: 887 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 888 ; UNSAFE-NEXT: ret 889 ; FINITE-LABEL: clampTo3k_e: 890 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 891 ; FINITE-NEXT: maxsd %xmm0, %xmm1 892 ; FINITE-NEXT: movapd %xmm1, %xmm0 893 ; FINITE-NEXT: ret 894 define double @clampTo3k_e(double %x) nounwind readnone { 895 entry: 896 %0 = fcmp olt double %x, 3.000000e+03 ; <i1> [#uses=1] 897 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 898 ret double %x_addr.0 899 } 900 901 ; CHECK-LABEL: clampTo3k_f: 902 ; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0 903 ; CHECK-NEXT: ret 904 ; UNSAFE-LABEL: clampTo3k_f: 905 ; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0 906 ; UNSAFE-NEXT: ret 907 ; FINITE-LABEL: clampTo3k_f: 908 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 909 ; FINITE-NEXT: maxsd %xmm0, %xmm1 910 ; FINITE-NEXT: movapd %xmm1, %xmm0 911 ; FINITE-NEXT: ret 912 define double @clampTo3k_f(double %x) nounwind readnone { 913 entry: 914 %0 = fcmp ule double %x, 3.000000e+03 ; <i1> [#uses=1] 915 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 916 ret double %x_addr.0 917 } 918 919 ; CHECK-LABEL: clampTo3k_g: 920 ; CHECK-NEXT: movsd {{[^,]*}}, %xmm1 921 ; CHECK-NEXT: minsd %xmm0, %xmm1 922 ; CHECK-NEXT: movapd %xmm1, %xmm0 923 ; CHECK-NEXT: ret 924 ; UNSAFE-LABEL: clampTo3k_g: 925 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 926 ; UNSAFE-NEXT: ret 927 ; FINITE-LABEL: clampTo3k_g: 928 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 929 ; FINITE-NEXT: minsd %xmm0, %xmm1 930 ; FINITE-NEXT: movapd %xmm1, %xmm0 931 ; FINITE-NEXT: ret 932 define double @clampTo3k_g(double %x) nounwind readnone { 933 entry: 934 %0 = fcmp ogt double %x, 3.000000e+03 ; <i1> [#uses=1] 935 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 936 ret double %x_addr.0 937 } 938 939 ; CHECK-LABEL: clampTo3k_h: 940 ; CHECK-NEXT: minsd {{[^,]*}}, %xmm0 941 ; CHECK-NEXT: ret 942 ; UNSAFE-LABEL: clampTo3k_h: 943 ; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0 944 ; UNSAFE-NEXT: ret 945 ; FINITE-LABEL: clampTo3k_h: 946 ; FINITE-NEXT: movsd {{[^,]*}}, %xmm1 947 ; FINITE-NEXT: minsd %xmm0, %xmm1 948 ; FINITE-NEXT: movapd %xmm1, %xmm0 949 ; FINITE-NEXT: ret 950 define double @clampTo3k_h(double %x) nounwind readnone { 951 entry: 952 %0 = fcmp uge double %x, 3.000000e+03 ; <i1> [#uses=1] 953 %x_addr.0 = select i1 %0, double 3.000000e+03, double %x ; <double> [#uses=1] 954 ret double %x_addr.0 955 } 956 957 ; UNSAFE-LABEL: test_maxpd: 958 ; UNSAFE-NEXT: maxpd %xmm1, %xmm0 959 ; UNSAFE-NEXT: ret 960 define <2 x double> @test_maxpd(<2 x double> %x, <2 x double> %y) nounwind { 961 %max_is_x = fcmp oge <2 x double> %x, %y 962 %max = select <2 x i1> %max_is_x, <2 x double> %x, <2 x double> %y 963 ret <2 x double> %max 964 } 965 966 ; UNSAFE-LABEL: test_minpd: 967 ; UNSAFE-NEXT: minpd %xmm1, %xmm0 968 ; UNSAFE-NEXT: ret 969 define <2 x double> @test_minpd(<2 x double> %x, <2 x double> %y) nounwind { 970 %min_is_x = fcmp ole <2 x double> %x, %y 971 %min = select <2 x i1> %min_is_x, <2 x double> %x, <2 x double> %y 972 ret <2 x double> %min 973 } 974 975 ; UNSAFE-LABEL: test_maxps: 976 ; UNSAFE-NEXT: maxps %xmm1, %xmm0 977 ; UNSAFE-NEXT: ret 978 define <4 x float> @test_maxps(<4 x float> %x, <4 x float> %y) nounwind { 979 %max_is_x = fcmp oge <4 x float> %x, %y 980 %max = select <4 x i1> %max_is_x, <4 x float> %x, <4 x float> %y 981 ret <4 x float> %max 982 } 983 984 ; UNSAFE-LABEL: test_minps: 985 ; UNSAFE-NEXT: minps %xmm1, %xmm0 986 ; UNSAFE-NEXT: ret 987 define <4 x float> @test_minps(<4 x float> %x, <4 x float> %y) nounwind { 988 %min_is_x = fcmp ole <4 x float> %x, %y 989 %min = select <4 x i1> %min_is_x, <4 x float> %x, <4 x float> %y 990 ret <4 x float> %min 991 } 992 993 ; UNSAFE-LABEL: test_maxps_illegal_v2f32: 994 ; UNSAFE-NEXT: maxps %xmm1, %xmm0 995 ; UNSAFE-NEXT: ret 996 define <2 x float> @test_maxps_illegal_v2f32(<2 x float> %x, <2 x float> %y) nounwind { 997 %max_is_x = fcmp oge <2 x float> %x, %y 998 %max = select <2 x i1> %max_is_x, <2 x float> %x, <2 x float> %y 999 ret <2 x float> %max 1000 } 1001 1002 ; UNSAFE-LABEL: test_minps_illegal_v2f32: 1003 ; UNSAFE-NEXT: minps %xmm1, %xmm0 1004 ; UNSAFE-NEXT: ret 1005 define <2 x float> @test_minps_illegal_v2f32(<2 x float> %x, <2 x float> %y) nounwind { 1006 %min_is_x = fcmp ole <2 x float> %x, %y 1007 %min = select <2 x i1> %min_is_x, <2 x float> %x, <2 x float> %y 1008 ret <2 x float> %min 1009 } 1010 1011 ; UNSAFE-LABEL: test_maxps_illegal_v3f32: 1012 ; UNSAFE-NEXT: maxps %xmm1, %xmm0 1013 ; UNSAFE-NEXT: ret 1014 define <3 x float> @test_maxps_illegal_v3f32(<3 x float> %x, <3 x float> %y) nounwind { 1015 %max_is_x = fcmp oge <3 x float> %x, %y 1016 %max = select <3 x i1> %max_is_x, <3 x float> %x, <3 x float> %y 1017 ret <3 x float> %max 1018 } 1019 1020 ; UNSAFE-LABEL: test_minps_illegal_v3f32: 1021 ; UNSAFE-NEXT: minps %xmm1, %xmm0 1022 ; UNSAFE-NEXT: ret 1023 define <3 x float> @test_minps_illegal_v3f32(<3 x float> %x, <3 x float> %y) nounwind { 1024 %min_is_x = fcmp ole <3 x float> %x, %y 1025 %min = select <3 x i1> %min_is_x, <3 x float> %x, <3 x float> %y 1026 ret <3 x float> %min 1027 } 1028