@@ -9122,8 +9122,17 @@ SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op,
91229122 ; // Detect finite numbers of f80 by checking individual classes because
91239123 // they have different settings of the explicit integer bit.
91249124 else if ((Test & fcFinite) == fcFinite) {
9125- // finite(V) ==> abs(V) < exp_mask
9126- PartialRes = DAG.getSetCC (DL, ResultVT, AbsV, ExpMaskV, ISD::SETLT);
9125+ // finite(V) ==> (a << 1) < (inf << 1)
9126+ //
9127+ // See https://github.com/llvm/llvm-project/issues/169270, this slightly shorter than
9128+ // the `finite(V) ==> abs(V) < exp_mask` formula used before.
9129+ EVT ShVT = getShiftAmountTy (IntVT, DAG.getDataLayout ());
9130+ SDValue One = DAG.getConstant (1 , DL, ShVT);
9131+
9132+ SDValue TwiceOp = DAG.getNode (ISD::SHL, DL, IntVT, OpAsInt, One);
9133+ SDValue TwiceInf = DAG.getNode (ISD::SHL, DL, IntVT, ExpMaskV, One);
9134+
9135+ PartialRes = DAG.getSetCC (DL, ResultVT, TwiceOp, TwiceInf, ISD::SETULT);
91279136 Test &= ~fcFinite;
91289137 } else if ((Test & fcFinite) == fcPosFinite) {
91299138 // finite(V) && V > 0 ==> V < exp_mask
0 commit comments