================
@@ -5553,6 +5553,48 @@ void computeKnownFPClass(const Value *V, const APInt
&DemandedElts,
// TODO: Copy inf handling from instructions
break;
+ case Intrinsic::amdgcn_rsq: {
+ KnownFPClass KnownSrc;
+ // The only negative value that can be returned is -inf for -0 inputs.
+ Known.knownNot(fcNegZero | fcNegSubnormal | fcNegNormal);
+
+ computeKnownFPClass(II->getArgOperand(0), DemandedElts,
InterestedClasses,
+ KnownSrc, Q, Depth + 1);
+
+ // Negative -> nan
+ if (KnownSrc.isKnownNeverNaN() && KnownSrc.cannotBeOrderedLessThanZero())
+ Known.knownNot(fcNan);
+ else if (KnownSrc.isKnownNever(fcSNan))
+ Known.knownNot(fcSNan);
+
+ // -inf -> -0
+ if (KnownSrc.isKnownNeverNegInfinity())
+ Known.knownNot(fcNegZero);
----------------
dtcxzyw wrote:
```suggestion
```
`rsq(-inf) = nan`
<img width="1366" height="754" alt="image"
src="https://github.com/user-attachments/assets/4c25b96a-ebf1-4b33-98cb-6ec66b0e7a60"
/>
https://github.com/llvm/llvm-project/pull/171837
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits