[llvm] SelectionDAG: Support nofpclass with zero/pzero/nzero (PR #137305)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 26 01:09:37 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))) {
----------------
wzssyqa 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?
>
Here is the most simple usage of `isKnownNeverZeroFloat`.
> 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
Here, `KnowNever` is much simple than `KnownIs`. May be what you want is something like `computePossibleFPClass`.
If fact I think that the implementation of `computePossibleFPClass` may be too complicated.
https://github.com/llvm/llvm-project/pull/137305
More information about the llvm-commits
mailing list