[llvm] [KnownFPClass] Add KnownFPClass deductions for `pow` (PR #215592)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 11 08:53:11 PDT 2026
================
@@ -5562,6 +5562,34 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
break;
}
+ case Intrinsic::pow: {
+ if ((InterestedClasses & (fcNan | fcNegative)) == fcNone)
+ break;
+
+ FPClassTest InterestedLHS = fcNone;
+ FPClassTest InterestedRHS = fcNone;
+ if (InterestedClasses & fcNan) {
+ // pow may return NaN if one of the arguments is NaN. NaN may be
+ // produced from a non-zero-finite-negative base and a non-integer
+ // exponent.
+ InterestedLHS |= fcNan | fcNegNormal | fcNegSubnormal;
+ InterestedRHS |= fcNan;
+ }
+ if (InterestedClasses & fcNegative) {
+ // A negative result requires both a negative base and an odd integer
+ // exponent. Only normal values can be odd integers.
+ InterestedLHS |= fcNegative;
+ InterestedRHS |= fcNormal;
+ }
+
+ KnownFPClass KnownLHS, KnownRHS;
+ computeKnownFPClass(II->getArgOperand(0), DemandedElts, InterestedLHS,
+ KnownLHS, Q, Depth + 1);
+ computeKnownFPClass(II->getArgOperand(1), DemandedElts, InterestedRHS,
+ KnownRHS, Q, Depth + 1);
----------------
arsenm wrote:
Try RHS and early out if it's unknown?
https://github.com/llvm/llvm-project/pull/215592
More information about the llvm-commits
mailing list