[PATCH] D68360: PR41162 Implement LKK remainder and divisibility algorithms [urem]

Tim Gymnich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 15:18:40 PDT 2019


TG908 marked 2 inline comments as done.
TG908 added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:4941-4943
+    if (!D.isStrictlyPositive() || D.isMaxValue() || D.isOneValue() ||
+        D.isPowerOf2()) {
+      // Divisor must be in the range of (1,2^N)
----------------
lebedev.ri wrote:
> There is no such restriction.
What do you mean?
In my code?
In LKK?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:4944-4945
+      // Divisor must be in the range of (1,2^N)
+      // We can lower remainder of division by powers of two much better
+      // elsewhere.
+      return false;
----------------
lebedev.ri wrote:
> I believe what you want to do, is to check whether *all* divisors are powers of two, and avoid *this* fold then.
> If at least one of them is not a power of two this should still be good.
> That being said many of the test changes look like regressions.
Yeah. 
I think the regressions came from changing the way I was checking if MUL is available.


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

https://reviews.llvm.org/D68360





More information about the llvm-commits mailing list