[llvm] [RISCV] Use PromoteSetCCOperands to promote operands for UMAX/UMIN during type legalization. (PR #82716)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 09:17:41 PST 2024


================
@@ -1343,10 +1343,14 @@ SDValue DAGTypeLegalizer::PromoteIntRes_ZExtIntBinOp(SDNode *N) {
 }
 
 SDValue DAGTypeLegalizer::PromoteIntRes_UMINUMAX(SDNode *N) {
+  SDValue LHS = N->getOperand(0);
+  SDValue RHS = N->getOperand(1);
+
   // It doesn't matter if we sign extend or zero extend in the inputs. So do
-  // whatever is best for the target.
-  SDValue LHS = SExtOrZExtPromotedInteger(N->getOperand(0));
-  SDValue RHS = SExtOrZExtPromotedInteger(N->getOperand(1));
+  // whatever is best for the target and the promoted operands. We can reuse
+  // PromoteSetCCOperands by passing it an unsigned predicate.
+  PromoteSetCCOperands(LHS, RHS, ISD::SETUGT);
----------------
topperc wrote:

The current implementation of PromoteSetCCOperands only uses the condition code in calls to `ISD::isSignedIntSetCC/isUnsignedIntSetCC/isIntEqualitySetCC` so any of the 4 unsigned predicates should be the same.

https://github.com/llvm/llvm-project/pull/82716


More information about the llvm-commits mailing list