[Mlir-commits] [mlir] 7eb85cd - [mlir] Add convenience builders for EqualOp and NotEqualOp.

Adrian Kuegel llvmlistbot at llvm.org
Fri May 21 02:32:52 PDT 2021


Author: Adrian Kuegel
Date: 2021-05-21T11:32:25+02:00
New Revision: 7eb85cdb103e60582ec6a8dffa2f2d97da616ee0

URL: https://github.com/llvm/llvm-project/commit/7eb85cdb103e60582ec6a8dffa2f2d97da616ee0
DIFF: https://github.com/llvm/llvm-project/commit/7eb85cdb103e60582ec6a8dffa2f2d97da616ee0.diff

LOG: [mlir] Add convenience builders for EqualOp and NotEqualOp.

The result type is always I1. This additional builder allows to omit the result type.

Differential Revision: https://reviews.llvm.org/D102905

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
index bac349230a943..b9bf8e2a60aa2 100644
--- a/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
+++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexOps.td
@@ -166,6 +166,11 @@ def EqualOp : Complex_Op<"eq",
 
   let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
   let results = (outs I1:$result);
+  let builders = [
+    OpBuilder<(ins "Value":$lhs, "Value":$rhs), [{
+      build($_builder, $_state, IntegerType::get(lhs.getContext(), 1), lhs,
+            rhs);
+    }]>];
 
   let assemblyFormat = "$lhs `,` $rhs  attr-dict `:` type($lhs)";
 }
@@ -205,6 +210,11 @@ def NotEqualOp : Complex_Op<"neq",
 
   let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
   let results = (outs I1:$result);
+  let builders = [
+    OpBuilder<(ins "Value":$lhs, "Value":$rhs), [{
+      build($_builder, $_state, IntegerType::get(lhs.getContext(), 1), lhs,
+            rhs);
+    }]>];
 
   let assemblyFormat = "$lhs `,` $rhs  attr-dict `:` type($lhs)";
 }


        


More information about the Mlir-commits mailing list