#include "mlir/Dialect/Arith/Transforms/Passes.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
namespace mlir {
namespace arith {
#define GEN_PASS_DEF_ARITHEXPANDOPSPASS
#include "mlir/Dialect/Arith/Transforms/Passes.h.inc"
}
}
usingnamespacemlir;
static Value createConst(Location loc, Type type, int value,
PatternRewriter &rewriter) { … }
namespace {
struct CeilDivUIOpConverter : public OpRewritePattern<arith::CeilDivUIOp> { … };
struct CeilDivSIOpConverter : public OpRewritePattern<arith::CeilDivSIOp> { … };
struct FloorDivSIOpConverter : public OpRewritePattern<arith::FloorDivSIOp> { … };
template <typename OpTy, arith::CmpIPredicate pred>
struct MaxMinIOpConverter : public OpRewritePattern<OpTy> { … };
template <typename OpTy, arith::CmpFPredicate pred>
struct MaximumMinimumFOpConverter : public OpRewritePattern<OpTy> { … };
template <typename OpTy, arith::CmpFPredicate pred>
struct MaxNumMinNumFOpConverter : public OpRewritePattern<OpTy> { … };
struct BFloat16ExtFOpConverter : public OpRewritePattern<arith::ExtFOp> { … };
struct BFloat16TruncFOpConverter : public OpRewritePattern<arith::TruncFOp> { … };
struct ArithExpandOpsPass
: public arith::impl::ArithExpandOpsPassBase<ArithExpandOpsPass> { … };
}
void mlir::arith::populateCeilFloorDivExpandOpsPatterns(
RewritePatternSet &patterns) { … }
void mlir::arith::populateExpandBFloat16Patterns(RewritePatternSet &patterns) { … }
void mlir::arith::populateArithExpandOpsPatterns(RewritePatternSet &patterns) { … }