[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
This commit is contained in:
Adrian Kuegel 2021-05-21 10:32:41 +02:00
parent ebd25fde5e
commit 7eb85cdb10
1 changed files with 10 additions and 0 deletions

View File

@ -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)";
}