[Mlir-commits] [mlir] [mlir][emitc] arith.negf to EmitC conversion (PR #95372)
Tina Jung
llvmlistbot at llvm.org
Thu Jun 13 06:30:25 PDT 2024
================
@@ -288,6 +288,29 @@ class CmpIOpConversion : public OpConversionPattern<arith::CmpIOp> {
}
};
+class NegFOpConversion : public OpConversionPattern<arith::NegFOp> {
+public:
+ using OpConversionPattern::OpConversionPattern;
+
+ LogicalResult
+ matchAndRewrite(arith::NegFOp op, OpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+
+ auto adaptedOp = adaptor.getOperand();
+ auto adaptedOpType = adaptedOp.getType();
+
+ if (!isa<FloatType>(adaptedOpType)) {
+ return rewriter.notifyMatchFailure(op.getLoc(),
+ "negf currently only supported on "
+ "floats, not tensors/vectors thereof");
+ }
+
----------------
TinaAMD wrote:
Very good point, I adapted the check.
https://github.com/llvm/llvm-project/pull/95372
More information about the Mlir-commits
mailing list