[Mlir-commits] [mlir] [mlir][emitc] arith.negf to EmitC conversion (PR #95372)
Simon Camphausen
llvmlistbot at llvm.org
Mon Jun 17 04:19:22 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");
+ }
+
----------------
simon-camp wrote:
Yes, the error is confusing when the type is a scalar f80 for example.
https://github.com/llvm/llvm-project/pull/95372
More information about the Mlir-commits
mailing list