@@ -213,6 +213,49 @@ Intrinsic::ID getIntrinsicForCallSite(const CallBase &CB,
213213bool isSignBitCheck (ICmpInst::Predicate Pred, const APInt &RHS,
214214 bool &TrueIfSigned);
215215
216+ // / Returns a pair of values, which if passed to llvm.is.fpclass, returns the
217+ // / same result as an fcmp with the given operands.
218+ // /
219+ // / If \p LookThroughSrc is true, consider the input value when computing the
220+ // / mask.
221+ // /
222+ // / If \p LookThroughSrc is false, ignore the source value (i.e. the first pair
223+ // / element will always be LHS.
224+ std::pair<Value *, FPClassTest> fcmpToClassTest (CmpInst::Predicate Pred,
225+ const Function &F, Value *LHS,
226+ Value *RHS,
227+ bool LookThroughSrc = true );
228+ std::pair<Value *, FPClassTest> fcmpToClassTest (CmpInst::Predicate Pred,
229+ const Function &F, Value *LHS,
230+ const APFloat *ConstRHS,
231+ bool LookThroughSrc = true );
232+
233+ // / Compute the possible floating-point classes that \p LHS could be based on
234+ // / fcmp \Pred \p LHS, \p RHS.
235+ // /
236+ // / \returns { TestedValue, ClassesIfTrue, ClassesIfFalse }
237+ // /
238+ // / If the compare returns an exact class test, ClassesIfTrue == ~ClassesIfFalse
239+ // /
240+ // / This is a less exact version of fcmpToClassTest (e.g. fcmpToClassTest will
241+ // / only succeed for a test of x > 0 implies positive, but not x > 1).
242+ // /
243+ // / If \p LookThroughSrc is true, consider the input value when computing the
244+ // / mask. This may look through sign bit operations.
245+ // /
246+ // / If \p LookThroughSrc is false, ignore the source value (i.e. the first pair
247+ // / element will always be LHS.
248+ // /
249+ std::tuple<Value *, FPClassTest, FPClassTest>
250+ fcmpImpliesClass (CmpInst::Predicate Pred, const Function &F, Value *LHS,
251+ Value *RHS, bool LookThroughSrc = true );
252+ std::tuple<Value *, FPClassTest, FPClassTest>
253+ fcmpImpliesClass (CmpInst::Predicate Pred, const Function &F, Value *LHS,
254+ FPClassTest RHS, bool LookThroughSrc = true );
255+ std::tuple<Value *, FPClassTest, FPClassTest>
256+ fcmpImpliesClass (CmpInst::Predicate Pred, const Function &F, Value *LHS,
257+ const APFloat &RHS, bool LookThroughSrc = true );
258+
216259// / Determine which floating-point classes are valid for \p V, and return them
217260// / in KnownFPClass bit sets.
218261// /
0 commit comments