[llvm] [GlobalISel][AArch64][AMDGPU] Expand FPOWI into series of multiplication (PR #95217)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 11:11:30 PDT 2024
================
@@ -7356,6 +7356,38 @@ void CombinerHelper::applyBuildFnMO(const MachineOperand &MO,
Root->eraseFromParent();
}
+void CombinerHelper::applyExpandFPowI(MachineInstr &MI) {
+ auto [Dst, Base, Exp] = MI.getFirst3Regs();
+ LLT Ty = MRI.getType(Dst);
+
+ std::optional<int64_t> ConstantExpValue = getIConstantVRegSExtVal(Exp, MRI);
+ assert(ConstantExpValue && "matched non-const FPOWI?");
+
+ int64_t OriginalExprVal = *ConstantExpValue;
+ int64_t ExpVal = OriginalExprVal;
+
+ if (ExpVal == 0) {
+ Builder.buildFConstant(Dst, 1.0);
+ MI.removeFromParent();
+ return;
+ }
+
+ if (ExpVal < 0)
+ ExpVal = -ExpVal;
+
----------------
arsenm wrote:
Can you preserve the comment from the DAG version about "We use the simple binary decomposition method..."
https://github.com/llvm/llvm-project/pull/95217
More information about the llvm-commits
mailing list