[llvm] [DAG] computeKnownFPClass - add ISD::SINT_TO_FP/UINT_TO_FP handling (PR #190539)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 03:40:28 PDT 2026
================
@@ -6103,6 +6103,34 @@ KnownFPClass SelectionDAG::computeKnownFPClass(SDValue Op,
Known = computeKnownFPClass(Op.getOperand(0), InterestedClasses, Depth + 1);
break;
}
+ case ISD::SINT_TO_FP:
+ case ISD::UINT_TO_FP: {
+ // Cannot produce nan
+ Known.knownNot(fcNan);
+
+ // Integers cannot be subnormal
+ Known.knownNot(fcSubnormal);
+
+ // sitofp and uitofp turn into +0.0 for zero.
+ Known.knownNot(fcNegZero);
+
+ // UIToFP is always non-negative regardless of known bits.
+ if (Opcode == ISD::UINT_TO_FP)
+ Known.signBitMustBeZero();
+
+ if (!(InterestedClasses & (fcPosZero | fcNormal | fcInf)))
+ break;
----------------
RKSimon wrote:
I realise this is useful for compile time performance (and it shold stay) - but if there's any chance that KnownFPClass::sitofp/uitofp are used on their own we should make sure that they mask the Nan/Subnormal/NegZero cases again.
https://github.com/llvm/llvm-project/pull/190539
More information about the llvm-commits
mailing list