[llvm] [DAG] Add basic ISD::IS_FPCLASS constant/identity folds (PR #189944)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 05:21:38 PDT 2026
================
@@ -16012,6 +16014,26 @@ SDValue DAGCombiner::visitAssertAlign(SDNode *N) {
return SDValue();
}
+SDValue DAGCombiner::visitIS_FPCLASS(SDNode *N) {
+ SDValue Src = N->getOperand(0);
+ FPClassTest Mask = static_cast<FPClassTest>(N->getConstantOperandVal(1));
+ EVT VT = N->getValueType(0);
+ SDLoc DL(N);
+
+ KnownFPClass Known = DAG.computeKnownFPClass(Src, Mask);
+
+ // Clear test bits we know must be false from the source value.
+ // fp_class (nnan x), qnan|snan|other -> fp_class (nnan x), other
+ // fp_class (ninf x), ninf|pinf|other -> fp_class (ninf x), other
+ if ((Mask & Known.KnownFPClasses) != Mask)
----------------
arsenm wrote:
Braces
https://github.com/llvm/llvm-project/pull/189944
More information about the llvm-commits
mailing list