[PATCH] D135541: [TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 15:03:42 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:7327
   APInt Mod = APInt::getSignedMinValue(BitWidth + 1);
   APInt MulFactor = Divisor.zext(BitWidth + 1);
   MulFactor = MulFactor.multiplicativeInverse(Mod);
----------------
jrtc27 wrote:
> Should this not be using the original divisor (whether by shifting back by TrailingZeros or making a copy you use elsewhere instead of doing an lshrInPlace)?
Yes! Thank you, that's probably the bug.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135541/new/

https://reviews.llvm.org/D135541



More information about the llvm-commits mailing list