[llvm] [AMDGPU] Fold fneg into select source modifiers (PR #201426)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 21:19:06 PDT 2026
================
@@ -5070,13 +5070,19 @@ AMDGPUTargetLowering::foldFreeOpFromSelect(TargetLowering::DAGCombinerInfo &DCI,
SDValue RHS = N.getOperand(2);
EVT VT = N.getValueType();
- if ((LHS.getOpcode() == ISD::FABS && RHS.getOpcode() == ISD::FABS) ||
- (LHS.getOpcode() == ISD::FNEG && RHS.getOpcode() == ISD::FNEG)) {
+ if (LHS.getOpcode() == ISD::FNEG && RHS.getOpcode() == ISD::FNEG) {
+ if (shouldFoldFNegIntoSrc(N.getNode(), SDValue()) &&
----------------
lijinpei-amd wrote:
code changed.
The twisted api was due to I want `shouldFoldFNegIntoSrc` to support both `fneg(op)` and `op(fneg)` query.
https://github.com/llvm/llvm-project/pull/201426
More information about the llvm-commits
mailing list