[llvm] [CodeGen] Emit more efficient magic numbers for exact udivs (PR #87161)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 13 10:48:46 PDT 2024
================
@@ -5071,8 +5071,36 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
LLT ScalarShiftAmtTy = ShiftAmtTy.getScalarType();
auto &MIB = Builder;
+ bool UseSRL = false;
bool UseNPQ = false;
SmallVector<Register, 16> PreShifts, PostShifts, MagicFactors, NPQFactors;
+ SmallVector<Register, 16> Shifts, Factors;
+ auto *RHSDefInstr = cast<GenericMachineInstr>(getDefIgnoringCopies(RHS, MRI));
+ bool IsSplat = getIConstantSplatVal(*RHSDefInstr, MRI).has_value();
+
+ auto BuildExactUDIVPattern = [&](const Constant *C) {
+ // Don't recompute inverses for each splat element.
----------------
AtariDreams wrote:
No because we only support exact computation for splats
https://github.com/llvm/llvm-project/pull/87161
More information about the llvm-commits
mailing list