From 8bb25dfcf8986abb8acc62f2cfec2f719481a0b4 Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Tue, 6 Jul 2021 17:46:39 +0100 Subject: [PATCH] [AMDGPU] Simplify tablegen files. NFC. There is no need to cast records to strings before comparing them. --- lib/Target/AMDGPU/AMDGPUInstructions.td | 3 +-- lib/Target/AMDGPU/BUFInstructions.td | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/Target/AMDGPU/AMDGPUInstructions.td b/lib/Target/AMDGPU/AMDGPUInstructions.td index fcf0d77d52d..119c4089d6c 100644 --- a/lib/Target/AMDGPU/AMDGPUInstructions.td +++ b/lib/Target/AMDGPU/AMDGPUInstructions.td @@ -83,8 +83,7 @@ def FalsePredicate : Predicate<"false">; // Add a predicate to the list if does not already exist to deduplicate it. class PredConcat lst, Predicate pred> { list ret = - !listconcat([pred], !filter(item, lst, - !ne(!cast(item), !cast(pred)))); + !listconcat([pred], !filter(item, lst, !ne(item, pred))); } class PredicateControl { diff --git a/lib/Target/AMDGPU/BUFInstructions.td b/lib/Target/AMDGPU/BUFInstructions.td index 48492bf8de3..5f43aa8388e 100644 --- a/lib/Target/AMDGPU/BUFInstructions.td +++ b/lib/Target/AMDGPU/BUFInstructions.td @@ -436,14 +436,11 @@ class getMUBUFInsDA vdataList, } class getMUBUFElements { - // eq does not support ValueType for some reason. - string vtAsStr = !cast(vt); - int ret = - !if(!eq(vtAsStr, "f16"), 1, - !if(!eq(vtAsStr, "v2f16"), 2, - !if(!eq(vtAsStr, "v3f16"), 3, - !if(!eq(vtAsStr, "v4f16"), 4, + !if(!eq(vt, f16), 1, + !if(!eq(vt, v2f16), 2, + !if(!eq(vt, v3f16), 3, + !if(!eq(vt, v4f16), 4, !if(!eq(vt.Size, 32), 1, !if(!eq(vt.Size, 64), 2, !if(!eq(vt.Size, 96), 3, @@ -548,7 +545,7 @@ multiclass MUBUF_Pseudo_Loads { - defvar legal_load_vt = !if(!eq(!cast(load_vt), !cast(v3f16)), v4f16, load_vt); + defvar legal_load_vt = !if(!eq(load_vt, v3f16), v4f16, load_vt); def _OFFSET : MUBUF_Load_Pseudo , MUBUFAddr64Table<0, NAME # !if(isLds, "_LDS", "")>; @@ -598,7 +595,7 @@ multiclass MUBUF_Pseudo_Stores { - defvar legal_store_vt = !if(!eq(!cast(store_vt), !cast(v3f16)), v4f16, store_vt); + defvar legal_store_vt = !if(!eq(store_vt, v3f16), v4f16, store_vt); def _OFFSET : MUBUF_Store_Pseudo { - defvar st = !if(!eq(!cast(memoryVt), !cast(vt)), name, mubuf_intrinsic_load); + defvar st = !if(!eq(memoryVt, vt), name, mubuf_intrinsic_load); def : GCNPat< (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, @@ -1294,7 +1291,7 @@ defm : MUBUF_LoadIntrinsicPat; multiclass MUBUF_StoreIntrinsicPat { - defvar st = !if(!eq(!cast(memoryVt), !cast(vt)), name, mubuf_intrinsic_store); + defvar st = !if(!eq(memoryVt, vt), name, mubuf_intrinsic_store); def : GCNPat< (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, @@ -1757,7 +1754,7 @@ defm : MUBUFScratchStorePat { - defvar st = !if(!eq(!cast(memoryVt), !cast(vt)), name, mtbuf_intrinsic_load); + defvar st = !if(!eq(memoryVt, vt), name, mtbuf_intrinsic_load); def : GCNPat< (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, @@ -1821,7 +1818,7 @@ let SubtargetPredicate = HasPackedD16VMem in { multiclass MTBUF_StoreIntrinsicPat { - defvar st = !if(!eq(!cast(memoryVt), !cast(vt)), name, mtbuf_intrinsic_store); + defvar st = !if(!eq(memoryVt, vt), name, mtbuf_intrinsic_store); def : GCNPat< (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset,