[llvm] expandIS_FPCLASS: Support fcNegative and fcPositive (PR #184788)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 03:33:56 PST 2026
================
@@ -9306,6 +9306,67 @@ SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op,
// Tests that involve more than one class should be processed first.
SDValue PartialRes;
+ // Handle sign bit tests first (fcPositive/fcNegative).
+ // These test only the sign bit, if not NaN.
+ // On 32-bit platforms with 64-bit floats, we need to be careful about
+ // integer comparisons. We use FP_ROUND to convert to a smaller float type
+ // that matches ResultVT's size, then compare with 0.
+ if (Test == fcPositive || Test == fcNegative) {
+ SDValue SignBitResult;
+ unsigned MaxLegalIntBits = 32;
+ if (isTypeLegal(MVT::i64))
+ MaxLegalIntBits = 64;
----------------
arsenm wrote:
Don't hardcode this, query from the legal type functions
https://github.com/llvm/llvm-project/pull/184788
More information about the llvm-commits
mailing list