[llvm] [AMDGPU] Split Dpp8FI and Dpp16FI operands (PR #82379)
Ivan Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 12:04:46 PST 2024
================
@@ -1092,7 +1092,20 @@ def DppBankMask : NamedIntOperand<i32, "bank_mask">;
}
def DppBoundCtrl : NamedIntOperand<i1, "bound_ctrl", 1,
"[this] (int64_t &BC) -> bool { return convertDppBoundCtrl(BC); }">;
-def DppFI : NamedIntOperand<i32, "fi">;
+
+def DppFI : AsmOperandClass {
+ let Name = "DppFI";
+ let ParserMethod = "[this](OperandVector &Operands) -> ParseStatus { return parseIntWithPrefix(\"fi\", Operands, AMDGPUOperand::ImmTyDppFI, nullptr); }";
+ let RenderMethod = "addImmOperands";
+ let IsOptional = true;
+ let DefaultMethod = "[this]() { return AMDGPUOperand::CreateImm(this, 0, SMLoc(), AMDGPUOperand::ImmTyDppFI); }";
+}
+let ParserMatchClass = DppFI, PrintMethod = "printDppFI" in {
+ def Dpp8FI : NamedIntOperand<i32, "fi"> {
+ let DecoderMethod = "decodeDpp8FI";
+ }
+ def Dpp16FI : NamedIntOperand<i32, "fi">;
+}
----------------
kosarev wrote:
TableGen treats identical instantiations as same records, so the operands implicitly generating identical `AsmOperandClass`es shouldn't be a problem.
With the `NamedIntOperand` class changed to support custom names, e.g.:
```
class NamedIntOperand<ValueType Type, string Prefix, bit Optional = 1,
string Name = NAME, string ConvertMethod = "nullptr">
: CustomOperand<Type, Optional, Name> {
```
I think it should be possible to just do something like:
```
let DecoderMethod = "decodeDpp8FI" in
def Dpp8FI : NamedIntOperand<i32, "fi", 1, "DppFI">;
def Dpp16FI : NamedIntOperand<i32, "fi", 1, "DppFI">;
```
https://github.com/llvm/llvm-project/pull/82379
More information about the llvm-commits
mailing list