[llvm] [PreISelIntrinsicLowering] Expand binary elementwise intrinsics (#193552) (PR #193580)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 24 05:56:22 PDT 2026
================
@@ -810,6 +810,22 @@ bool PreISelIntrinsicLowering::lowerIntrinsics(Module &M) const {
return lowerUnaryVectorIntrinsicAsLoop(M, CI);
});
break;
+ case Intrinsic::atan2:
+ case Intrinsic::ldexp:
+ case Intrinsic::pow:
+ case Intrinsic::powi:
+ Changed |= forEachCall(F, [&](CallInst *CI) {
+ Type *Ty = CI->getArgOperand(0)->getType();
+ if (!TM || !isa<ScalableVectorType>(Ty))
+ return false;
+ const TargetLowering *TL = TM->getSubtargetImpl(F)->getTargetLowering();
+ unsigned Op = TL->IntrinsicIDToISD(F.getIntrinsicID());
+ assert(Op != ISD::DELETED_NODE && "unsupported intrinsic");
+ if (!TL->isOperationExpand(Op, EVT::getEVT(Ty)))
----------------
david-arm wrote:
I'm not sure this is right. When SVE is available in the AArch64 backend we mark ISD::FPOW as EXPAND, however this doesn't mean the code will really be unrolled when a vector math library is available. See this code in `VectorLegalizer::Expand`:
```
case ISD::FPOW: {
RTLIB::Libcall LC = RTLIB::getPOW(Node->getValueType(0));
if (tryExpandVecMathCall(Node, LC, Results))
return;
// TODO: Try to see if there's a narrower call available to use before
// scalarizing.
break;
}
```
I need to confirm, but I suspect this may lead to regressions.
https://github.com/llvm/llvm-project/pull/193580
More information about the llvm-commits
mailing list