[llvm] [SelectionDAG] Widen even 33-bit-magic udiv on free-zext targets (PR #207634)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 20:48:20 PDT 2026
================
@@ -6921,6 +6921,12 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
isOperationLegalOrCustom(ISD::UMUL_LOHI, WideSVT, IsAfterLegalization);
const bool AllowWiden = (HasWideMULHU || HasWideUMUL_LOHI);
+ // For even divisors with a 33-bit magic number, the widened high-multiply
+ // path is only worthwhile over the even-divisor rewrite on targets that
+ // zero-extend i32 to i64 for free (e.g. x86-64 and AArch64). Elsewhere (e.g.
+ // RISC-V) keep the even-divisor rewrite, which avoids the explicit extension.
+ const bool AllowEvenToWiden = AllowWiden && isZExtFree(MVT::i32, WideSVT);
----------------
topperc wrote:
I understand why. I was just suggesting to replace MVT::i32 with VT.
https://github.com/llvm/llvm-project/pull/207634
More information about the llvm-commits
mailing list