[llvm] [GlobalISel][AArch64][AMDGPU] Expand FPOWI into series of multiplication (PR #95217)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 12:24:31 PDT 2024


================
@@ -7356,6 +7356,38 @@ void CombinerHelper::applyBuildFnMO(const MachineOperand &MO,
   Root->eraseFromParent();
 }
 
+void CombinerHelper::applyExpandFPowI(MachineInstr &MI, BuildFnTy &MatchInfo) {
+  auto [Dst, Base, Exp] = MI.getFirst3Regs();
+  LLT Ty = MRI.getType(Dst);
+
+  MachineRegisterInfo &MRI = *Builder.getMRI();
+  std::optional<int64_t> ConstantExpValue = getIConstantVRegSExtVal(Exp, MRI);
+  assert(ConstantExpValue && "matched non-const FPOWI?");
+
+  int64_t OriginalExprVal = *ConstantExpValue;
+  int64_t ExpVal = OriginalExprVal;
+
----------------
isuckatcs wrote:

Why is this needed? Why can't we optimize if there are multiple uses of Base?

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


More information about the llvm-commits mailing list