Skip to content

[AMDGPU] Use get_BUF_ps to default real_name of BUF instructions. NFC. #84524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions llvm/lib/Target/AMDGPU/BUFInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -2484,26 +2484,27 @@ multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<bits<8> op, string real_name> :
MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>,
MUBUF_Real_AllAddr_gfx12_Impl2<op, real_name>;

multiclass MUBUF_Real_AllAddr_gfx11_Impl<bits<8> op, string real_name,
bit hasTFE = 1> {
multiclass MUBUF_Real_AllAddr_gfx11_Impl<bits<8> op, bit hasTFE,
string real_name = get_BUF_ps<NAME>.Mnemonic> {
defm NAME : MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>;
if hasTFE then
defm _TFE : MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>;
}

multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<8> op, string real_name,
bit hasTFE = 1> {
multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<8> op, bit hasTFE,
string real_name> {
defm NAME : MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<op, real_name>;
if hasTFE then
defm _TFE : MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<op, real_name>;
}

// Non-renamed, non-atomic gfx11/gfx12 mubuf instructions.
multiclass MUBUF_Real_AllAddr_gfx11<bits<8> op, bit hasTFE = 1> :
MUBUF_Real_AllAddr_gfx11_Impl<op, get_BUF_ps<NAME>.Mnemonic, hasTFE>;
MUBUF_Real_AllAddr_gfx11_Impl<op, hasTFE>;

multiclass MUBUF_Real_AllAddr_gfx11_gfx12<bits<8> op, string real_name = !tolower(NAME)> :
MUBUF_Real_AllAddr_gfx11_gfx12_Impl<op, real_name> {
multiclass MUBUF_Real_AllAddr_gfx11_gfx12<bits<8> op,
string real_name = get_BUF_ps<NAME>.Mnemonic> :
MUBUF_Real_AllAddr_gfx11_gfx12_Impl<op, /*hasTFE=*/1, real_name> {
defvar ps = get_BUF_ps<NAME>;
if !ne(ps.Mnemonic, real_name) then
def : Mnem_gfx11_gfx12<ps.Mnemonic, real_name>;
Expand All @@ -2519,7 +2520,7 @@ multiclass MUBUF_Real_Atomic_gfx11_impl<bits<8> op, bit is_return,
}

multiclass MUBUF_Real_Atomic_gfx12_impl<bits<8> op, bit is_return,
string real_name> {
string real_name = get_BUF_ps<NAME>.Mnemonic> {
defvar Rtn = !if(is_return, "_RTN", "");
defm _VBUFFER_BOTHEN#Rtn : VBUFFER_MUBUF_Real_gfx12<op, real_name>;
defm _VBUFFER_IDXEN#Rtn : VBUFFER_MUBUF_Real_gfx12<op, real_name>;
Expand All @@ -2533,16 +2534,19 @@ multiclass MUBUF_Real_Atomic_gfx11_gfx12_impl<bits<8> op, bit is_return,
MUBUF_Real_Atomic_gfx12_impl<op, is_return, real_name>;

multiclass MUBUF_Real_Atomic_gfx12<bits<8> op> :
MUBUF_Real_Atomic_gfx12_impl<op, 0, get_BUF_ps<NAME>.Mnemonic>,
MUBUF_Real_Atomic_gfx12_impl<op, 1, get_BUF_ps<NAME>.Mnemonic>;
MUBUF_Real_Atomic_gfx12_impl<op, 0>,
MUBUF_Real_Atomic_gfx12_impl<op, 1>;

multiclass MUBUF_Real_Atomic_gfx11<bits<8> op, string real_name> :
MUBUF_Real_Atomic_gfx11_impl<op, 0, real_name>,
MUBUF_Real_Atomic_gfx11_impl<op, 1, real_name> {
def : Mnem_gfx11_gfx12<get_BUF_ps<NAME>.Mnemonic, real_name>;
defvar ps = get_BUF_ps<NAME>;
def : Mnem_gfx11_gfx12<ps.Mnemonic, real_name>;
}

multiclass MUBUF_Real_Atomic_gfx11_gfx12<bits<8> op, string gfx12_name = !tolower(NAME), string gfx11_name = gfx12_name> :
multiclass MUBUF_Real_Atomic_gfx11_gfx12<bits<8> op,
string gfx12_name = get_BUF_ps<NAME>.Mnemonic,
string gfx11_name = gfx12_name> :
MUBUF_Real_Atomic_gfx11_impl<op, 0, gfx11_name>,
MUBUF_Real_Atomic_gfx11_impl<op, 1, gfx11_name>,
MUBUF_Real_Atomic_gfx12_impl<op, 0, gfx12_name>,
Expand Down Expand Up @@ -2887,7 +2891,8 @@ multiclass MTBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<4> op, string real_name> {
defm _VBUFFER_OFFSET : VBUFFER_MTBUF_Real_gfx12<op, real_name>;
}

multiclass MTBUF_Real_AllAddr_gfx11_gfx12<bits<4> op, string real_name = !tolower(NAME)>
multiclass MTBUF_Real_AllAddr_gfx11_gfx12<bits<4> op,
string real_name = get_BUF_ps<NAME>.Mnemonic>
: MTBUF_Real_AllAddr_gfx11_gfx12_Impl<op, real_name> {
defvar ps = get_BUF_ps<NAME>;
if !ne(ps.Mnemonic, real_name) then
Expand Down