[llvm] SelectionDAG: Support nofpclass with zero/pzero/nzero (PR #137305)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 26 00:14:44 PDT 2025
================
@@ -8603,7 +8603,11 @@ SDValue TargetLowering::expandFMINIMUM_FMAXIMUM(SDNode *N,
// fminimum/fmaximum requires -0.0 less than +0.0
if (!MinMaxMustRespectOrderedZero && !N->getFlags().hasNoSignedZeros() &&
- !DAG.isKnownNeverZeroFloat(RHS) && !DAG.isKnownNeverZeroFloat(LHS)) {
+ !DAG.isKnownNeverZeroFloat(RHS) && !DAG.isKnownNeverZeroFloat(LHS) &&
+ !(DAG.isKnownNeverZeroFloat(RHS, fcNegZero) &&
+ DAG.isKnownNeverZeroFloat(LHS, fcNegZero)) &&
+ !(DAG.isKnownNeverZeroFloat(RHS, fcPosZero) &&
+ DAG.isKnownNeverZeroFloat(LHS, fcPosZero))) {
----------------
arsenm wrote:
This part is beyond the scope of the patch title. Is there some existing use of the call you can use to check this?
This condition is more complicated and less precise than the equivalent logic in ValueTracking. Ideally we would just have the same interface as computeKnownFPClass here. Short of that, you could replace isKnownNeverZeroFloat return which type of 0 it could be. You should at most need 4 conditions, not 6
https://github.com/llvm/llvm-project/pull/137305
More information about the llvm-commits
mailing list