Skip to content

[MLIR][tblgen] Emit missing compund assignment operator for any BitEnum attribute’s enum type #158098

@amd-eochoalo

Description

@amd-eochoalo

When defining a BitEnumAttr and enum class is also generated. This enum class will have the following operators being defined:

// inline constexpr <enum-type> operator|(<enum-type> a, <enum-type> b);
// inline constexpr <enum-type> operator&(<enum-type> a, <enum-type> b);
// inline constexpr <enum-type> operator^(<enum-type> a, <enum-type> b);
// inline constexpr <enum-type> operator~(<enum-type> bits);

Adding missing compound assignment operators |=, &=, ^=, would be an improvement that would make some code more concise. For example, in the VectorToSPIRV lowering process, we have some lines of code that could be simplified from:

auto memoryAccess = spirv::MemoryAccess::None
memoryAccess = memoryAccess | spirv::MemoryAccess::Aligned;

to

memoryAccess |= spirv::MemoryAccess::Aligned;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions