diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h --- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h +++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h @@ -339,6 +339,16 @@ /// consumer %0 ... : memref(16 * i + j)>> /// ``` bool canFoldIntoConsumerOp(MemRefCastOp castOp); + +// Compute `lhs` `pred` `rhs`, where `pred` is one of the known integer +// comparison predicates. +bool applyCmpPredicate(CmpIPredicate predicate, const APInt &lhs, + const APInt &rhs); + +/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known floating point +/// comparison predicates. +bool applyCmpPredicate(CmpFPredicate predicate, const APFloat &lhs, + const APFloat &rhs); } // end namespace mlir #endif // MLIR_DIALECT_IR_STANDARDOPS_IR_OPS_H diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -784,8 +784,8 @@ // Compute `lhs` `pred` `rhs`, where `pred` is one of the known integer // comparison predicates. -static bool applyCmpPredicate(CmpIPredicate predicate, const APInt &lhs, - const APInt &rhs) { +bool mlir::applyCmpPredicate(CmpIPredicate predicate, const APInt &lhs, + const APInt &rhs) { switch (predicate) { case CmpIPredicate::eq: return lhs.eq(rhs); @@ -838,8 +838,8 @@ /// Compute `lhs` `pred` `rhs`, where `pred` is one of the known floating point /// comparison predicates. -static bool applyCmpPredicate(CmpFPredicate predicate, const APFloat &lhs, - const APFloat &rhs) { +bool mlir::applyCmpPredicate(CmpFPredicate predicate, const APFloat &lhs, + const APFloat &rhs) { auto cmpResult = lhs.compare(rhs); switch (predicate) { case CmpFPredicate::AlwaysFalse: