|
374 | 374 | (umin ty x y)) |
375 | 375 |
|
376 | 376 |
|
| 377 | +;; These are the same rules as above, but when the operands for select are swapped |
| 378 | +(rule (simplify |
| 379 | + (select ty (icmp _ (IntCC.SignedLessThan) x y) y x)) |
| 380 | + (smax ty x y)) |
| 381 | +(rule (simplify |
| 382 | + (select ty (icmp _ (IntCC.SignedLessThanOrEqual) x y) y x)) |
| 383 | + (smax ty x y)) |
| 384 | +(rule (simplify |
| 385 | + (select ty (icmp _ (IntCC.UnsignedLessThan) x y) y x)) |
| 386 | + (umax ty x y)) |
| 387 | +(rule (simplify |
| 388 | + (select ty (icmp _ (IntCC.UnsignedLessThanOrEqual) x y) y x)) |
| 389 | + (umax ty x y)) |
| 390 | +(rule (simplify |
| 391 | + (select ty (icmp _ (IntCC.SignedGreaterThan) x y) y x)) |
| 392 | + (smin ty x y)) |
| 393 | +(rule (simplify |
| 394 | + (select ty (icmp _ (IntCC.SignedGreaterThanOrEqual) x y) y x)) |
| 395 | + (smin ty x y)) |
| 396 | +(rule (simplify |
| 397 | + (select ty (icmp _ (IntCC.UnsignedGreaterThan) x y) y x)) |
| 398 | + (umin ty x y)) |
| 399 | +(rule (simplify |
| 400 | + (select ty (icmp _ (IntCC.UnsignedGreaterThanOrEqual) x y) y x)) |
| 401 | + (umin ty x y)) |
| 402 | + |
377 | 403 | ;; Transform vselect-of-icmp into {u,s}{min,max} instructions where possible. |
378 | 404 | (rule (simplify |
379 | 405 | (vselect ty (icmp _ (IntCC.SignedGreaterThan) x y) x y)) |
|
400 | 426 | (vselect ty (icmp _ (IntCC.UnsignedLessThanOrEqual) x y) x y)) |
401 | 427 | (umin ty x y)) |
402 | 428 |
|
403 | | - |
| 429 | +;; These are the same rules as above, but when the operands for select are swapped |
| 430 | +(rule (simplify |
| 431 | + (vselect ty (icmp _ (IntCC.SignedLessThan) x y) y x)) |
| 432 | + (smax ty x y)) |
| 433 | +(rule (simplify |
| 434 | + (vselect ty (icmp _ (IntCC.SignedLessThanOrEqual) x y) y x)) |
| 435 | + (smax ty x y)) |
| 436 | +(rule (simplify |
| 437 | + (vselect ty (icmp _ (IntCC.UnsignedLessThan) x y) y x)) |
| 438 | + (umax ty x y)) |
| 439 | +(rule (simplify |
| 440 | + (vselect ty (icmp _ (IntCC.UnsignedLessThanOrEqual) x y) y x)) |
| 441 | + (umax ty x y)) |
| 442 | +(rule (simplify |
| 443 | + (vselect ty (icmp _ (IntCC.SignedGreaterThan) x y) y x)) |
| 444 | + (smin ty x y)) |
| 445 | +(rule (simplify |
| 446 | + (vselect ty (icmp _ (IntCC.SignedGreaterThanOrEqual) x y) y x)) |
| 447 | + (smin ty x y)) |
| 448 | +(rule (simplify |
| 449 | + (vselect ty (icmp _ (IntCC.UnsignedGreaterThan) x y) y x)) |
| 450 | + (umin ty x y)) |
| 451 | +(rule (simplify |
| 452 | + (vselect ty (icmp _ (IntCC.UnsignedGreaterThanOrEqual) x y) y x)) |
| 453 | + (umin ty x y)) |
404 | 454 |
|
405 | 455 | ;; For floats convert fcmp lt into pseudo_min and gt into pseudo_max |
406 | 456 | ;; |
|
0 commit comments