[llvm] [DAG] computeKnownFPClass - add ISD::SQRT handling + test coverage (PR #195405)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat May 2 03:10:21 PDT 2026
================
@@ -6075,6 +6073,34 @@ KnownFPClass SelectionDAG::computeKnownFPClass(SDValue Op,
Known.fneg();
break;
}
+ case ISD::FSQRT: {
+ FPClassTest InterestedSrcs = InterestedClasses;
+ if (InterestedClasses & fcNan)
+ InterestedSrcs |= KnownFPClass::OrderedLessThanZeroMask;
+
+ KnownFPClass KnownSrc = computeKnownFPClass(Op.getOperand(0), DemandedElts,
+ InterestedSrcs, Depth + 1);
+
+ DenormalMode Mode = DenormalMode::getDynamic();
+
+ bool HasNSZ = Op->getFlags().hasNoSignedZeros();
+ bool nnan = Op->getFlags().hasNoNaNs();
+
+ if (!HasNSZ) {
+ const fltSemantics &FltSem =
+ Op.getValueType().getScalarType().getFltSemantics();
+ Mode = getMachineFunction().getDenormalMode(FltSem);
+ }
+
+ Known = KnownFPClass::sqrt(KnownSrc, Mode);
+
+ if (HasNSZ)
----------------
arsenm wrote:
Can't promote nsz into a poison returning value. I'm surprised we handle it this way in the IR Version, but that has the additional special predicate in the InstrInfoQuery
https://github.com/llvm/llvm-project/pull/195405
More information about the llvm-commits
mailing list