Skip to content

Commit 6bdd254

Browse files
authored
[AMDGPU] Simplify handling of renamed GFX12 image atomics. NFC. (llvm#120776)
1 parent 2d6d723 commit 6bdd254

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

llvm/lib/Target/AMDGPU/MIMGInstructions.td

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ class MIMG_Atomic_nsa_gfx11<mimgopc op, string opcode,
971971
}
972972

973973
class VIMAGE_Atomic_gfx12<mimgopc op, string opcode, RegisterClass DataRC,
974-
int num_addrs, bit enableDisasm = 0>
974+
int num_addrs, string renamed, bit enableDisasm = 0>
975975
: VIMAGE_gfx12<op.GFX12, (outs DataRC:$vdst), num_addrs,
976976
!if(enableDisasm, "GFX12", "")> {
977977
let Constraints = "$vdst = $vdata";
@@ -980,14 +980,10 @@ class VIMAGE_Atomic_gfx12<mimgopc op, string opcode, RegisterClass DataRC,
980980
AddrIns,
981981
(ins SReg_256:$rsrc, DMask:$dmask, Dim:$dim,
982982
CPol:$cpol, R128A16:$r128, A16:$a16, TFE:$tfe));
983-
let AsmString = opcode#" $vdata, "#AddrAsm#", $rsrc$dmask$dim$cpol$r128$a16$tfe";
983+
let AsmString = !if(!empty(renamed), opcode, renamed)#" $vdata, "#AddrAsm#
984+
", $rsrc$dmask$dim$cpol$r128$a16$tfe";
984985
}
985986

986-
class VIMAGE_Atomic_gfx12_Renamed<mimgopc op, string renamed,
987-
RegisterClass DataRC, int num_addrs,
988-
bit enableDisasm = 0>
989-
: VIMAGE_Atomic_gfx12<op, renamed, DataRC, num_addrs, enableDisasm>;
990-
991987
multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm,
992988
RegisterClass data_rc,
993989
bit enableDasm = 0,
@@ -1014,10 +1010,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm,
10141010
}
10151011
}
10161012
if op.HAS_GFX12 then {
1017-
if !empty(renamed) then
1018-
def _V1_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 1>;
1019-
else
1020-
def _V1_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 1>;
1013+
def _V1_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 1, renamed>;
10211014
}
10221015
}
10231016
let VAddrDwords = 2 in {
@@ -1039,10 +1032,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm,
10391032
}
10401033
}
10411034
if op.HAS_GFX12 then {
1042-
if !empty(renamed) then
1043-
def _V2_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 2, 0>;
1044-
else
1045-
def _V2_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 2, 0>;
1035+
def _V2_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 2, renamed>;
10461036
}
10471037
}
10481038
let VAddrDwords = 3 in {
@@ -1064,10 +1054,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm,
10641054
}
10651055
}
10661056
if op.HAS_GFX12 then {
1067-
if !empty(renamed) then
1068-
def _V3_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 3, 0>;
1069-
else
1070-
def _V3_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 3, 0>;
1057+
def _V3_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 3, renamed>;
10711058
}
10721059
}
10731060
let VAddrDwords = 4 in {
@@ -1089,10 +1076,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm,
10891076
}
10901077
}
10911078
if op.HAS_GFX12 then {
1092-
if !empty(renamed) then
1093-
def _V4_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 4, enableDasm>;
1094-
else
1095-
def _V4_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 4, enableDasm>;
1079+
def _V4_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 4, renamed, enableDasm>;
10961080
}
10971081
}
10981082
}

0 commit comments

Comments
 (0)