
# Autogenerated by mlir-tblgen; don't manually edit.

from enum import IntEnum, auto, IntFlag
from ._ods_common import _cext as _ods_cext
from ..ir import register_attribute_builder
_ods_ir = _ods_cext.ir

class IndexCmpPredicate(IntEnum):
    """index comparison predicate kind"""

    EQ = 0
    NE = 1
    SLT = 2
    SLE = 3
    SGT = 4
    SGE = 5
    ULT = 6
    ULE = 7
    UGT = 8
    UGE = 9

    def __str__(self):
        if self is IndexCmpPredicate.EQ:
            return "eq"
        if self is IndexCmpPredicate.NE:
            return "ne"
        if self is IndexCmpPredicate.SLT:
            return "slt"
        if self is IndexCmpPredicate.SLE:
            return "sle"
        if self is IndexCmpPredicate.SGT:
            return "sgt"
        if self is IndexCmpPredicate.SGE:
            return "sge"
        if self is IndexCmpPredicate.ULT:
            return "ult"
        if self is IndexCmpPredicate.ULE:
            return "ule"
        if self is IndexCmpPredicate.UGT:
            return "ugt"
        if self is IndexCmpPredicate.UGE:
            return "uge"
        raise ValueError("Unknown IndexCmpPredicate enum entry.")



@register_attribute_builder("IndexCmpPredicate", allow_existing=True)
def _indexcmppredicate(x, context):
    return _ods_ir.IntegerAttr.get(_ods_ir.IntegerType.get_signless(32, context=context), int(x))

@register_attribute_builder("index.IndexCmpPredicateAttr")
def _indexcmppredicateattr(x, context):
    return _ods_ir.Attribute.parse(f'#index<cmp_predicate {str(x)}>', context=context)

