[AMDGPU] Simplify tablegen files. NFC.

There is no need to cast records to strings before comparing them.
This commit is contained in:
Jay Foad 2021-07-06 17:46:39 +01:00
parent c2d4d6a1fd
commit ce098ccc1c
2 changed files with 11 additions and 15 deletions

View File

@ -83,8 +83,7 @@ def FalsePredicate : Predicate<"false">;
// Add a predicate to the list if does not already exist to deduplicate it. // Add a predicate to the list if does not already exist to deduplicate it.
class PredConcat<list<Predicate> lst, Predicate pred> { class PredConcat<list<Predicate> lst, Predicate pred> {
list<Predicate> ret = list<Predicate> ret =
!listconcat([pred], !filter(item, lst, !listconcat([pred], !filter(item, lst, !ne(item, pred)));
!ne(!cast<string>(item), !cast<string>(pred))));
} }
class PredicateControl { class PredicateControl {

View File

@ -436,14 +436,11 @@ class getMUBUFInsDA<list<RegisterClass> vdataList,
} }
class getMUBUFElements<ValueType vt> { class getMUBUFElements<ValueType vt> {
// eq does not support ValueType for some reason.
string vtAsStr = !cast<string>(vt);
int ret = int ret =
!if(!eq(vtAsStr, "f16"), 1, !if(!eq(vt, f16), 1,
!if(!eq(vtAsStr, "v2f16"), 2, !if(!eq(vt, v2f16), 2,
!if(!eq(vtAsStr, "v3f16"), 3, !if(!eq(vt, v3f16), 3,
!if(!eq(vtAsStr, "v4f16"), 4, !if(!eq(vt, v4f16), 4,
!if(!eq(vt.Size, 32), 1, !if(!eq(vt.Size, 32), 1,
!if(!eq(vt.Size, 64), 2, !if(!eq(vt.Size, 64), 2,
!if(!eq(vt.Size, 96), 3, !if(!eq(vt.Size, 96), 3,
@ -548,7 +545,7 @@ multiclass MUBUF_Pseudo_Loads<string opName,
bit TiedDest = 0, bit TiedDest = 0,
bit isLds = 0> { bit isLds = 0> {
defvar legal_load_vt = !if(!eq(!cast<string>(load_vt), !cast<string>(v3f16)), v4f16, load_vt); defvar legal_load_vt = !if(!eq(load_vt, v3f16), v4f16, load_vt);
def _OFFSET : MUBUF_Load_Pseudo <opName, BUFAddrKind.Offset, legal_load_vt, TiedDest, isLds>, def _OFFSET : MUBUF_Load_Pseudo <opName, BUFAddrKind.Offset, legal_load_vt, TiedDest, isLds>,
MUBUFAddr64Table<0, NAME # !if(isLds, "_LDS", "")>; MUBUFAddr64Table<0, NAME # !if(isLds, "_LDS", "")>;
@ -598,7 +595,7 @@ multiclass MUBUF_Pseudo_Stores<string opName,
ValueType store_vt = i32, ValueType store_vt = i32,
SDPatternOperator st = null_frag> { SDPatternOperator st = null_frag> {
defvar legal_store_vt = !if(!eq(!cast<string>(store_vt), !cast<string>(v3f16)), v4f16, store_vt); defvar legal_store_vt = !if(!eq(store_vt, v3f16), v4f16, store_vt);
def _OFFSET : MUBUF_Store_Pseudo <opName, BUFAddrKind.Offset, legal_store_vt, def _OFFSET : MUBUF_Store_Pseudo <opName, BUFAddrKind.Offset, legal_store_vt,
[(st legal_store_vt:$vdata, (MUBUFOffset v4i32:$srsrc, i32:$soffset, [(st legal_store_vt:$vdata, (MUBUFOffset v4i32:$srsrc, i32:$soffset,
@ -1212,7 +1209,7 @@ let SubtargetPredicate = isGFX10Plus in {
multiclass MUBUF_LoadIntrinsicPat<SDPatternOperator name, ValueType vt, multiclass MUBUF_LoadIntrinsicPat<SDPatternOperator name, ValueType vt,
string opcode, ValueType memoryVt = vt> { string opcode, ValueType memoryVt = vt> {
defvar st = !if(!eq(!cast<string>(memoryVt), !cast<string>(vt)), name, mubuf_intrinsic_load<name, memoryVt>); defvar st = !if(!eq(memoryVt, vt), name, mubuf_intrinsic_load<name, memoryVt>);
def : GCNPat< def : GCNPat<
(vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset,
@ -1294,7 +1291,7 @@ defm : MUBUF_LoadIntrinsicPat<SIbuffer_load_ushort, i32, "BUFFER_LOAD_USHORT">;
multiclass MUBUF_StoreIntrinsicPat<SDPatternOperator name, ValueType vt, multiclass MUBUF_StoreIntrinsicPat<SDPatternOperator name, ValueType vt,
string opcode, ValueType memoryVt = vt> { string opcode, ValueType memoryVt = vt> {
defvar st = !if(!eq(!cast<string>(memoryVt), !cast<string>(vt)), name, mubuf_intrinsic_store<name, memoryVt>); defvar st = !if(!eq(memoryVt, vt), name, mubuf_intrinsic_store<name, memoryVt>);
def : GCNPat< def : GCNPat<
(st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset,
@ -1757,7 +1754,7 @@ defm : MUBUFScratchStorePat <BUFFER_STORE_BYTE_D16_HI_OFFEN, BUFFER_STORE_BYTE_D
multiclass MTBUF_LoadIntrinsicPat<SDPatternOperator name, ValueType vt, multiclass MTBUF_LoadIntrinsicPat<SDPatternOperator name, ValueType vt,
string opcode, ValueType memoryVt = vt> { string opcode, ValueType memoryVt = vt> {
defvar st = !if(!eq(!cast<string>(memoryVt), !cast<string>(vt)), name, mtbuf_intrinsic_load<name, memoryVt>); defvar st = !if(!eq(memoryVt, vt), name, mtbuf_intrinsic_load<name, memoryVt>);
def : GCNPat< def : GCNPat<
(vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset,
@ -1821,7 +1818,7 @@ let SubtargetPredicate = HasPackedD16VMem in {
multiclass MTBUF_StoreIntrinsicPat<SDPatternOperator name, ValueType vt, multiclass MTBUF_StoreIntrinsicPat<SDPatternOperator name, ValueType vt,
string opcode, ValueType memoryVt = vt> { string opcode, ValueType memoryVt = vt> {
defvar st = !if(!eq(!cast<string>(memoryVt), !cast<string>(vt)), name, mtbuf_intrinsic_store<name, memoryVt>); defvar st = !if(!eq(memoryVt, vt), name, mtbuf_intrinsic_store<name, memoryVt>);
def : GCNPat< def : GCNPat<
(st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset,