fix: make all comparison intrinsics return i1
@@ -406,12 +406,12 @@ class eir_UnaryComparisonOp<Type type, string mnemonic, list<OpTrait> traits = [
}
class eir_BinaryComparisonOp<Type type, string mnemonic, list<OpTrait> traits = []>
- : eir_BinaryOperator<mnemonic, type, type, eir_BoolType, traits> {
+ : eir_BinaryOperator<mnemonic, type, type, I1, traits> {
let summary = "Compares two operands with the specified predicate.";
let arguments = (ins type:$lhs, type:$rhs, OptionalAttr<UnitAttr>:$is_strict);
- let results = (outs eir_BoolType:$result);
+ let results = (outs I1:$result);
let assemblyFormat = [{
`(` operands `)` (`strict` $is_strict^)? attr-dict `:` functional-type(operands, results)
@@ -429,7 +429,7 @@ class eir_BinaryComparisonOp<Type type, string mnemonic, list<OpTrait> traits =
OpBuilder<
"OpBuilder &builder, OperationState &result, Value lhs, Value rhs, bool strict = false",
[{
- auto boolType = builder.getType<eir::BooleanType>();
+ auto boolType = builder.getI1Type();
build(builder, result, boolType, lhs, rhs, strict ? builder.getUnitAttr() : nullptr);
}]>
];
@@ -439,7 +439,7 @@ def eir_CmpEqOp : eir_Op<"cmp.eq", [Commutative, NoSideEffect]> {
let summary = "term equality comparison operation";
let arguments = (ins AnyType:$lhs, AnyType:$rhs, OptionalAttr<UnitAttr>:$is_strict);
- let results = (outs eir_BoolType:$result);
+ let results = (outs I1:$result);
let assemblyFormat = [{
`(` operands `)` (`strict` $is_strict^)? attr-dict `:` functional-type(operands, results)
@@ -457,11 +457,11 @@ def eir_CmpEqOp : eir_Op<"cmp.eq", [Commutative, NoSideEffect]> {
let builders = [
OpBuilder<
- "OpBuilder &builder, OperationState &result, Type resultTy, Value lhs, Value rhs,"
+ "OpBuilder &builder, OperationState &result, Value lhs, Value rhs,"
"ArrayRef<NamedAttribute> attrs = {}",
[{
result.addOperands(ValueRange({lhs, rhs}));
- result.addTypes(resultTy);
+ result.addTypes(builder.getI1Type());
result.addAttributes(attrs);
}]>,
OpBuilder<
@@ -470,12 +470,12 @@ def eir_CmpEqOp : eir_Op<"cmp.eq", [Commutative, NoSideEffect]> {
assert(args.size() == 2 && "expected binary operator to receive 2 arguments");
Value lhs = args[0];
Value rhs = args[1];
- build(builder, result, lhs, rhs);
+ build(builder, result, lhs, rhs, /*strict=*/false);
}]>,
OpBuilder<
"OpBuilder &builder, OperationState &result, Value lhs, Value rhs, bool strict = false",
[{
- auto boolType = builder.getType<eir::BooleanType>();
+ auto boolType = builder.getI1Type();
build(builder, result, boolType, lhs, rhs, strict ? builder.getUnitAttr() : nullptr);
}]>
];
