[llvm] [InstCombine] Fold expression using basic properties of floor and ceiling function (PR #107107)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 04:29:59 PDT 2024
================
@@ -8178,6 +8178,105 @@ static Instruction *foldFCmpFSubIntoFCmp(FCmpInst &I, Instruction *LHSI,
return nullptr;
}
+static Instruction *foldFCmpWithFloorAndCeil(FCmpInst &I,
+ InstCombinerImpl &CI) {
+ Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
+ Type *OpType = LHS->getType();
+ const CmpInst::Predicate Pred = I.getPredicate();
+
+ bool floor_x = match(LHS, m_Intrinsic<Intrinsic::floor>(m_Specific(RHS)));
+ bool x_floor = match(RHS, m_Intrinsic<Intrinsic::floor>(m_Specific(LHS)));
+ bool ceil_x = match(LHS, m_Intrinsic<Intrinsic::ceil>(m_Specific(RHS)));
+ bool x_ceil = match(RHS, m_Intrinsic<Intrinsic::ceil>(m_Specific(LHS)));
----------------
c8ef wrote:
Done.
https://github.com/llvm/llvm-project/pull/107107
More information about the llvm-commits
mailing list