[PATCH] D140750: [TargetLowering] Teach BuildUDIV to take advantage of leading zeros in the dividend.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 11:54:02 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/unittests/Support/DivisionByConstantTest.cpp:101-102
+APInt UnsignedDivideUsingMagic(const APInt &Numerator, const APInt &Divisor,
                                bool AllowEvenDivisorOptimization, bool ForceNPQ,
+                               bool LZOptimization,
                                UnsignedDivisionByConstantInfo Magics) {
----------------
It happens first, so let's place it first


================
Comment at: llvm/unittests/Support/DivisionByConstantTest.cpp:173
       continue; // Not supported by `UnsignedDivisionByConstantInfo::get()`.
     if (Bits > 11)
       continue; // Unreasonably slow.
----------------



================
Comment at: llvm/unittests/Support/DivisionByConstantTest.cpp:182-206
         for (bool AllowEvenDivisorOptimization : {true, false}) {
           for (bool ForceNPQ : {false, true}) {
             APInt MagicResult = UnsignedDivideUsingMagic(
                 Numerator, Divisor, AllowEvenDivisorOptimization, ForceNPQ,
-                Magics);
+                false/*LZOptimization*/, Magics);
             ASSERT_EQ(MagicResult, NativeResult)
                 << " ... given the operation:  urem i" << Bits << " "
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140750



More information about the llvm-commits mailing list