[llvm] Fix non-splat vector SREM expansion when one of the divisors is a power of two. (PR #82706)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 15:43:44 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
----------------
topperc wrote:
theorem*
https://github.com/llvm/llvm-project/pull/82706
More information about the llvm-commits
mailing list