[llvm] [Legalizer] Check full condition for UMIN and UMAX just like the code below does for SMIN and SMAX (PR #87932)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue May 28 06:35:58 PDT 2024
================
@@ -3943,7 +3943,7 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT LowerHintTy) {
// target can override this with custom lowering and calling the
// implementation functions.
LLT Ty = MRI.getType(MI.getOperand(0).getReg());
- if (LI.isLegalOrCustom({G_UMIN, Ty}))
+ if (LI.isLegalOrCustom({G_UMIN, Ty}) && LI.isLegalOrCustom({G_UMAX, Ty}))
----------------
jayfoad wrote:
No, the unsigned expansion only uses umin not umax. Check out the comments in `lowerAddSubSatToMinMax`:
```
// uadd.sat(a, b) -> a + umin(~a, b)
// usub.sat(a, b) -> a - umin(a, b)
```
Please revert.
https://github.com/llvm/llvm-project/pull/87932
More information about the llvm-commits
mailing list