[llvm] Fix non-splat vector SREM expansion when one of the divisors is a power of two. (PR #82706)

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 17:03:59 PST 2024


================
@@ -6813,6 +6814,17 @@ TargetLowering::prepareSREMEqFold(EVT SETCCVT, SDValue REMNode,
   // - A = bitwiseand(floor((2^(W - 1) - 1) / D0), (-(2^k)))
   // - Q = floor((2 * A) / (2^K))
   // where W is the width of the common type of N and D.
+  //
+  // When D is a power of two (and thus D0 is 1), the normal
+  // formula for A and Q don't apply, because the derivation
+  // depends on D not dividing 2^(W-1), and thus theoroem ZRS
----------------
resistor wrote:

Done.

https://github.com/llvm/llvm-project/pull/82706


More information about the llvm-commits mailing list