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

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 08:45:24 PDT 2025


================
@@ -18421,6 +18421,12 @@ AArch64TargetLowering::BuildSDIVPow2(SDNode *N, const APInt &Divisor,
 
   EVT VT = N->getValueType(0);
 
+  // If SVE is available, we can generate
+  //  sdiv(x,y) -> ptrue + asrd          , where 'y' is positive pow-2 divisor.
+  //  sdiv(x,y) -> ptrue + asrd + subr   , where 'y' is negative pow-2 divisor.
+  if (Subtarget->hasSVE() && N->getValueType(0).isVector())
+    return SDValue(N, 0);
+
----------------
sushgokh wrote:

makes sense. Done.

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


More information about the llvm-commits mailing list