-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Create AMDGPUMnemonicAlias tablegen class #89288
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,12 +117,16 @@ multiclass EXP_Real_gfx11 { | |
multiclass VEXPORT_Real_gfx12 { | ||
defvar ps = !cast<EXP_Pseudo>(NAME); | ||
def _gfx12 : EXP_Real_Row<ps, SIEncodingFamily.GFX12, "export">, | ||
EXPe_Row, MnemonicAlias<"exp", "export">, Requires<[isGFX12Plus, HasExportInsts]> { | ||
EXPe_Row { | ||
let AssemblerPredicate = isGFX12Only; | ||
let DecoderNamespace = "GFX12"; | ||
let row = ps.row; | ||
let done = ps.done; | ||
} | ||
def : AMDGPUMnemonicAlias<"exp", "export"> { | ||
let AssemblerPredicate = isGFX12Plus; | ||
let OtherPredicates = [HasExportInsts]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #91602 removes this predicate. As a further cleanup this alias should be standalone, not inside |
||
} | ||
} | ||
|
||
defm EXP : EXP_Real_gfx11, VEXPORT_Real_gfx12; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -963,11 +963,10 @@ class VIMAGE_Atomic_gfx12<mimgopc op, string opcode, RegisterClass DataRC, | |
let AsmString = opcode#" $vdata, "#AddrAsm#", $rsrc$dmask$dim$cpol$r128$a16$tfe"; | ||
} | ||
|
||
class VIMAGE_Atomic_gfx12_Renamed<mimgopc op, string opcode, string renamed, | ||
class VIMAGE_Atomic_gfx12_Renamed<mimgopc op, string renamed, | ||
RegisterClass DataRC, int num_addrs, | ||
bit enableDisasm = 0> | ||
: VIMAGE_Atomic_gfx12<op, renamed, DataRC, num_addrs, enableDisasm>, | ||
MnemonicAlias<opcode, renamed>, Requires<[isGFX12Plus, HasImageInsts]>; | ||
: VIMAGE_Atomic_gfx12<op, renamed, DataRC, num_addrs, enableDisasm>; | ||
Sisyph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm, | ||
RegisterClass data_rc, | ||
|
@@ -998,7 +997,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm, | |
if !empty(renamed) then | ||
def _V1_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 1, enableDasm>; | ||
else | ||
def _V1_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, asm, renamed, data_rc, 1, enableDasm>; | ||
def _V1_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 1, enableDasm>; | ||
} | ||
} | ||
let VAddrDwords = 2 in { | ||
|
@@ -1023,7 +1022,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm, | |
if !empty(renamed) then | ||
def _V2_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 2, 0>; | ||
else | ||
def _V2_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, asm, renamed, data_rc, 2, 0>; | ||
def _V2_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 2, 0>; | ||
} | ||
} | ||
let VAddrDwords = 3 in { | ||
|
@@ -1048,7 +1047,7 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm, | |
if !empty(renamed) then | ||
def _V3_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 3, 0>; | ||
else | ||
def _V3_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, asm, renamed, data_rc, 3, 0>; | ||
def _V3_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 3, 0>; | ||
} | ||
} | ||
let VAddrDwords = 4 in { | ||
|
@@ -1073,10 +1072,18 @@ multiclass MIMG_Atomic_Addr_Helper_m <mimgopc op, string asm, | |
if !empty(renamed) then | ||
def _V4_gfx12 : VIMAGE_Atomic_gfx12 <op, asm, data_rc, 4, enableDasm>; | ||
else | ||
def _V4_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, asm, renamed, data_rc, 4, enableDasm>; | ||
def _V4_gfx12 : VIMAGE_Atomic_gfx12_Renamed <op, renamed, data_rc, 4, enableDasm>; | ||
} | ||
} | ||
} | ||
if !and(op.HAS_GFX12, !not(!empty(renamed))) then | ||
def : AMDGPUMnemonicAlias<asm, renamed> { | ||
let AssemblerPredicate = isGFX12Plus; | ||
let OtherPredicates = [HasImageInsts]; | ||
bit IsAtomicRet; // Unused | ||
MIMGBaseOpcode BaseOpcode; // Unused | ||
int VDataDwords; // Unused | ||
Comment on lines
+1083
to
+1085
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these lines needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as we use letDummies. The fields are set in an outer let on on MIMG_Atomic_Addr_Helper_m. I considered pushing this alias down a level in the class hierarchy, and also pushing it up one level. But neither option seemed cleaner. |
||
} | ||
} | ||
|
||
multiclass MIMG_Atomic <mimgopc op, string asm, bit isCmpSwap = 0, bit isFP = 0, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,14 +143,14 @@ multiclass VOP1Inst <string opName, VOPProfile P, | |
def _e64_dpp : VOP3_DPP_Pseudo <opName, P>; | ||
} // End SubtargetPredicate = isGFX11Plus | ||
|
||
def : MnemonicAlias<opName#"_e32", opName>, LetDummies; | ||
def : MnemonicAlias<opName#"_e64", opName>, LetDummies; | ||
def : LetDummies, AMDGPUMnemonicAlias<opName#"_e32", opName>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is LetDummies still required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are various fields set as outer lets such as isReMaterializable, mayRaiseFPException etc. set on VOP1Inst. I briefly tried to add LetDummies to AMDGPUMnemonicInst, but it was not trivial. |
||
def : LetDummies, AMDGPUMnemonicAlias<opName#"_e64", opName>; | ||
|
||
if P.HasExtSDWA then | ||
def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies; | ||
def : LetDummies, AMDGPUMnemonicAlias<opName#"_sdwa", opName>; | ||
|
||
if P.HasExtDPP then | ||
def : MnemonicAlias<opName#"_dpp", opName, AMDGPUAsmVariants.DPP>, LetDummies; | ||
def : LetDummies, AMDGPUMnemonicAlias<opName#"_dpp", opName, AMDGPUAsmVariants.DPP>; | ||
} | ||
|
||
multiclass VOP1Inst_t16<string opName, | ||
|
@@ -858,8 +858,9 @@ multiclass VOP1_Real_NO_VOP3_with_name_gfx11<bits<9> op, string opName, | |
VOP1_Real_dpp_with_name<GFX11Gen, op, opName, asmName>, | ||
VOP1_Real_dpp8_with_name<GFX11Gen, op, opName, asmName>; | ||
defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); | ||
def gfx11_alias : MnemonicAlias<ps.Mnemonic, asmName>, | ||
Requires<[isGFX11Plus]>; | ||
def gfx11_alias : AMDGPUMnemonicAlias<ps.Mnemonic, asmName> { | ||
let AssemblerPredicate = isGFX11Plus; | ||
} | ||
} | ||
|
||
multiclass VOP1_Real_NO_VOP3_with_name_gfx12<bits<9> op, string opName, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame that so many cases like this get longer not shorter.