@@ -614,6 +614,15 @@ def SExtOp : ExtOpBase<"sext"> {
614
614
// Expressions
615
615
//===----------------------------------------------------------------------===//
616
616
617
+ def UArrayCmpPredicateAttr : I64EnumAttr<
618
+ "UArrayCmpPredicate", "",
619
+ [
620
+ I64EnumAttrCase<"eq", 0>,
621
+ I64EnumAttrCase<"ne", 1>
622
+ ]> {
623
+ let cppNamespace = "circt::moore";
624
+ }
625
+
617
626
def NegOp : MooreOp<"neg", [Pure, SameOperandsAndResultType]> {
618
627
let summary = "Arithmetic negation";
619
628
let description = [{
@@ -889,6 +898,34 @@ def ShlOp : ShiftOpBase<"shl"> { let summary = "Logical left shift"; }
889
898
def ShrOp : ShiftOpBase<"shr"> { let summary = "Logical right shift"; }
890
899
def AShrOp : ShiftOpBase<"ashr"> { let summary = "Arithmetic right shift"; }
891
900
901
+ def UArrayCmpOp : MooreOp<"uarray_cmp", [
902
+ Pure,
903
+ Commutative,
904
+ SameTypeOperands,
905
+ ]> {
906
+ let description = [{
907
+ Performs an elementwise comparison of two unpacked arrays
908
+ using the specified predicate (for example, "eq" for equality or "ne" for inequality)
909
+ and returns a single bit result.
910
+ Its first argument is an attribute that defines which type of comparison is
911
+ performed. The following comparisons are supported:
912
+
913
+ - equal (mnemonic: `"eq"`; integer value: `0`)
914
+ - not equal (mnemonic: `"ne"`; integer value: `1`)
915
+
916
+ The result is `1` if the comparison is true and `0` otherwise.
917
+ }];
918
+ let arguments = (ins
919
+ UArrayCmpPredicateAttr:$predicate,
920
+ UnpackedArrayType:$lhs,
921
+ UnpackedArrayType:$rhs
922
+ );
923
+ let results = (outs BitType:$result);
924
+ let assemblyFormat = [{
925
+ $predicate $lhs `,` $rhs attr-dict `:` type($lhs) `->` type($result)
926
+ }];
927
+ }
928
+
892
929
class LogicalEqOpBase<string mnemonic> : MooreOp<mnemonic, [
893
930
Pure,
894
931
Commutative,
0 commit comments