[llvm] [AMDGPU] Rename get_MUBUF_ps and use it for MTBUF too. NFC. (PR #83991)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 03:12:34 PST 2024
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/83991
This allows removing a couple of MTBUF helper (multi)classes.
>From e0e4a93315f0dd1602ff19ea3c606ddb20ea64de Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Tue, 5 Mar 2024 11:09:19 +0000
Subject: [PATCH] [AMDGPU] Rename get_MUBUF_ps and use it for MTBUF too. NFC.
This allows removing a couple of MTBUF helper (multi)classes.
---
llvm/lib/Target/AMDGPU/BUFInstructions.td | 37 +++++++++++------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td
index 7bb92256fbddd0..a2ff56d68218cd 100644
--- a/llvm/lib/Target/AMDGPU/BUFInstructions.td
+++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td
@@ -2431,10 +2431,10 @@ class VBUFFER_MTBUF_Real_gfx12<bits<4> op, MTBUF_Pseudo ps,
// MUBUF - GFX11, GFX12.
//===----------------------------------------------------------------------===//
-// Shortcut to default Mnemonic from MUBUF_Pseudo. Hides the cast to the
+// Shortcut to default Mnemonic from BUF_Pseudo. Hides the cast to the
// specific pseudo (bothen in this case) since any of them will work.
-class get_MUBUF_ps<string name> {
- string Mnemonic = !cast<MUBUF_Pseudo>(name # "_BOTHEN").Mnemonic;
+class get_BUF_ps<string name> {
+ string Mnemonic = !cast<BUF_Pseudo>(name # "_BOTHEN").Mnemonic;
}
// gfx11 instruction that accept both old and new assembler name.
@@ -2487,14 +2487,14 @@ multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<bits<8> op, string real_n
// Non-renamed, non-atomic gfx11/gfx12 mubuf instructions.
multiclass MUBUF_Real_AllAddr_gfx11<bits<8> op, bit hasTFE = 1> :
- MUBUF_Real_AllAddr_gfx11_Renamed_Impl<op, get_MUBUF_ps<NAME>.Mnemonic, hasTFE>;
+ MUBUF_Real_AllAddr_gfx11_Renamed_Impl<op, get_BUF_ps<NAME>.Mnemonic, hasTFE>;
multiclass MUBUF_Real_AllAddr_gfx11_gfx12<bits<8> op, bit hasTFE = 1> :
- MUBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, get_MUBUF_ps<NAME>.Mnemonic, hasTFE>;
+ MUBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, get_BUF_ps<NAME>.Mnemonic, hasTFE>;
multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Renamed<bits<8> op, string real_name> :
MUBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, real_name> {
- def : Mnem_gfx11_gfx12<get_MUBUF_ps<NAME>.Mnemonic, real_name>;
+ def : Mnem_gfx11_gfx12<get_BUF_ps<NAME>.Mnemonic, real_name>;
}
class MUBUF_Real_Atomic_gfx11_impl<bits<8> op, string ps_name,
@@ -2538,23 +2538,23 @@ multiclass MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<bits<8> op, bit is_return,
// Non-renamed gfx11/gfx12 mubuf atomic.
multiclass MUBUF_Real_Atomic_gfx11_gfx12<bits<8> op> :
- MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 0, get_MUBUF_ps<NAME>.Mnemonic>,
- MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 1, get_MUBUF_ps<NAME>.Mnemonic>;
+ MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 0, get_BUF_ps<NAME>.Mnemonic>,
+ MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 1, get_BUF_ps<NAME>.Mnemonic>;
multiclass MUBUF_Real_Atomic_gfx12<bits<8> op> :
- MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 0, get_MUBUF_ps<NAME>.Mnemonic>,
- MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 1, get_MUBUF_ps<NAME>.Mnemonic>;
+ MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 0, get_BUF_ps<NAME>.Mnemonic>,
+ MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 1, get_BUF_ps<NAME>.Mnemonic>;
multiclass MUBUF_Real_Atomic_gfx11_Renamed<bits<8> op, string real_name> :
MUBUF_Real_Atomic_gfx11_Renamed_impl<op, 0, real_name>,
MUBUF_Real_Atomic_gfx11_Renamed_impl<op, 1, real_name> {
- def : Mnem_gfx11_gfx12<get_MUBUF_ps<NAME>.Mnemonic, real_name>;
+ def : Mnem_gfx11_gfx12<get_BUF_ps<NAME>.Mnemonic, real_name>;
}
multiclass MUBUF_Real_Atomic_gfx11_gfx12_Renamed<bits<8> op, string real_name> :
MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 0, real_name>,
MUBUF_Real_Atomic_gfx11_gfx12_Renamed_impl<op, 1, real_name> {
- def : Mnem_gfx11_gfx12<get_MUBUF_ps<NAME>.Mnemonic, real_name>;
+ def : Mnem_gfx11_gfx12<get_BUF_ps<NAME>.Mnemonic, real_name>;
}
multiclass MUBUF_Real_Atomic_gfx11_gfx12_Renamed_gfx12_Renamed<bits<8> op, string gfx12_name, string gfx11_name> :
@@ -2562,8 +2562,8 @@ multiclass MUBUF_Real_Atomic_gfx11_gfx12_Renamed_gfx12_Renamed<bits<8> op, strin
MUBUF_Real_Atomic_gfx11_Renamed_impl<op, 1, gfx11_name>,
MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 0, gfx12_name>,
MUBUF_Real_Atomic_gfx12_Renamed_impl<op, 1, gfx12_name> {
- def : Mnem_gfx11<get_MUBUF_ps<NAME>.Mnemonic, gfx11_name>;
- def : Mnem_gfx12<get_MUBUF_ps<NAME>.Mnemonic, gfx12_name>;
+ def : Mnem_gfx11<get_BUF_ps<NAME>.Mnemonic, gfx11_name>;
+ def : Mnem_gfx12<get_BUF_ps<NAME>.Mnemonic, gfx12_name>;
def : Mnem_gfx12<gfx11_name, gfx12_name>;
}
@@ -2944,17 +2944,14 @@ multiclass MTBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<bits<4> op, string real_n
VBUFFER_MTBUF_Real_gfx12<op, !cast<MTBUF_Pseudo>(NAME#"_VBUFFER_OFFSET"), real_name>;
}
-multiclass MTBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<4> op, MTBUF_Pseudo ps>
- : MTBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, ps.Mnemonic>;
multiclass MTBUF_Real_AllAddr_gfx11_gfx12<bits<4> op>
- : MTBUF_Real_AllAddr_gfx11_gfx12_Impl<op, !cast<MTBUF_Pseudo>(NAME#"_BOTHEN")>;
+ : MTBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, get_BUF_ps<NAME>.Mnemonic>;
-class Pre_gfx11_MTBUF_Name <MTBUF_Pseudo ps, string real_name>
- : MnemonicAlias<ps.Mnemonic, real_name>, Requires<[isGFX11Plus]>;
multiclass MTBUF_Real_AllAddr_gfx11_gfx12_Renamed<bits<4> op, string real_name>
: MTBUF_Real_AllAddr_gfx11_gfx12_Renamed_Impl<op, real_name> {
- def : Pre_gfx11_MTBUF_Name<!cast<MTBUF_Pseudo>(NAME#"_BOTHEN"), real_name>;
+ defvar ps = get_BUF_ps<NAME>;
+ def : MnemonicAlias<ps.Mnemonic, real_name>, Requires<[isGFX11Plus]>;
}
defm TBUFFER_LOAD_FORMAT_D16_X : MTBUF_Real_AllAddr_gfx11_gfx12_Renamed<0x008, "tbuffer_load_d16_format_x">;
More information about the llvm-commits
mailing list