[llvm] expandIS_FPCLASS: Support fcNegative and fcPositive (PR #184788)

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 20:47:38 PDT 2026


================
@@ -9391,6 +9391,61 @@ static std::optional<bool> isFCmpEqualZero(FPClassTest Test,
   return std::nullopt;
 }
 
+static SDValue getFloatSign(EVT ResultVT, bool &NeedFPTrunc, SDValue Op,
+                            SelectionDAG &DAG, const SDLoc &DL,
+                            const TargetLowering &TLI) {
+  EVT OperandVT = Op.getValueType();
+  unsigned BitSize = OperandVT.getScalarSizeInBits();
+  EVT IntVT = OperandVT.changeElementType(
+      *DAG.getContext(), EVT::getIntegerVT(*DAG.getContext(), BitSize));
+  SDValue OpAsInt = DAG.getBitcast(IntVT, Op);
+  SDValue SignBitResult = DAG.getSetCC(
+      DL, ResultVT, OpAsInt, DAG.getConstant(0, DL, IntVT), ISD::SETLT);
+
+  NeedFPTrunc = false;
+  EVT TruncFloatVT = OperandVT;
+  EVT TruncIntVT = IntVT;
+  do {
----------------
wzssyqa wrote:

The real problem is that we cannot be sure that IntType is legal when fp type is legal.
The cases include 64bit float on 32bit GPR, or 32bit float on 16bit GPR etc.

https://github.com/llvm/llvm-project/pull/184788


More information about the llvm-commits mailing list