[llvm] [GlobalISel][AArch64][AMDGPU] Expand FPOWI into series of multiplication (PR #95217)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 23 12:11:33 PDT 2024
================
@@ -7356,6 +7356,59 @@ void CombinerHelper::applyBuildFnMO(const MachineOperand &MO,
Root->eraseFromParent();
}
+// FIXME: This is ported from TargetLoweringBase::isBeneficialToExpandPowI,
+// consider moving the two to some common place.
+bool CombinerHelper::matchFPowIExpansion(MachineInstr &MI, int64_t Exponent) {
+ bool OptForSize = MI.getMF()->getFunction().hasOptSize();
+ if (Exponent < 0)
+ Exponent = -Exponent;
+ uint64_t E = static_cast<uint64_t>(Exponent);
+ return !OptForSize || (llvm::popcount(E) + Log2_64(E) < 7);
----------------
davemgreen wrote:
It should be able to call `getTargetLowering().isBeneficialToExpandPowI(Exponent, OptForSize);`. In case it changes in the future we can make sure they stay in sync.
https://github.com/llvm/llvm-project/pull/95217
More information about the llvm-commits
mailing list