[llvm] [WIP] [AMDGPU] [GlobalIsel] Combine Fmul with Select into ldexp instruction. (PR #120104)
Vikash Gupta via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 07:47:46 PST 2024
================
@@ -445,3 +445,75 @@ void AMDGPUCombinerHelper::applyExpandPromotedF16FMed3(MachineInstr &MI,
Builder.buildFMinNumIEEE(MI.getOperand(0), B1, C1);
MI.eraseFromParent();
}
+
+bool AMDGPUCombinerHelper::matchCombineFmulWithSelectToLdexp(
+ MachineInstr &MI, MachineInstr &Sel,
+ std::function<void(MachineIRBuilder &)> &MatchInfo) {
+ assert(MI.getOpcode() == TargetOpcode::G_FMUL);
+ assert(Sel.getOpcode() == TargetOpcode::G_SELECT);
+
+ Register Dst = MI.getOperand(0).getReg();
+ LLT DestTy = MRI.getType(Dst);
+ LLT ScalarDestTy = DestTy.getScalarType();
+
+ if ((ScalarDestTy == LLT::float64() || ScalarDestTy == LLT::float32() ||
----------------
vg0204 wrote:
> First case looks better, the bfloat case is too far removed from the final instructions do to all the promotion handling
You asked to go without this combine for bfloat as mentioned in the #104900, with the above comment after seeing assmebly with and without dagCombine.
https://github.com/llvm/llvm-project/pull/120104
More information about the llvm-commits
mailing list