[llvm] [AArch64][SVE] Generate asrd instruction for positive pow-2 divisors … (PR #137151)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 04:35:43 PDT 2025


================
@@ -18421,6 +18421,11 @@ AArch64TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
 
   EVT VT = N->getValueType(0);
 
+  // For negative divisor, this yeilds (ptrue + asrd + subr) which is not
+  // profitable as compared to Neon sequence (cmlt + usra + sshr).
----------------
paulwalker-arm wrote:

Is this conclusion the result of benchmarking? I ask because the ptrue can be reused by other similar divides and  is invariant so can be hoisted. Which means in real terms we're really comparing `cmlt + usra + sshr` to `asrd + subr`?

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


More information about the llvm-commits mailing list