[llvm] [CodeGen] [AMDGPU] Attempt DAGCombine for fmul with select to ldexp (PR #111109)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 03:16:59 PDT 2024
================
@@ -14476,6 +14477,60 @@ SDValue SITargetLowering::performFDivCombine(SDNode *N,
return SDValue();
}
+SDValue SITargetLowering::performFMulCombine(SDNode *N,
+ DAGCombinerInfo &DCI) const {
+ SelectionDAG &DAG = DCI.DAG;
+ EVT VT = N->getValueType(0);
+ EVT i32VT = VT.changeElementType(MVT::i32);
+
+ SDLoc SL(N);
+ SDValue LHS = N->getOperand(0);
+ SDValue RHS = N->getOperand(1);
+
+ // ldexp(x, zext(i1 y)) -> fmul x, (select y, 2.0, 1.0)
+ // ldexp(x, sext(i1 y)) -> fmul x, (select y, 0.5, 1.0)
----------------
jayfoad wrote:
Explain where these transformations are done. Is it another DAG combine somewhere? If so, what stops your DAG combine from fighting with the other one?
https://github.com/llvm/llvm-project/pull/111109
More information about the llvm-commits
mailing list