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

YunQiang Su via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 20:48:44 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:

We need to get a bitsize, with which, both float and int are legal.

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


More information about the llvm-commits mailing list