Skip to content

Commit d6c52c1

Browse files
authored
AMDGPU: Define HasExpOrExportInsts for export instruction definitions. (#84083)
1 parent e77a473 commit d6c52c1

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,9 @@ def D16PreservesUnusedBits :
18741874
def LDSRequiresM0Init : Predicate<"Subtarget->ldsRequiresM0Init()">;
18751875
def NotLDSRequiresM0Init : Predicate<"!Subtarget->ldsRequiresM0Init()">;
18761876

1877+
def HasExpOrExportInsts : Predicate<"Subtarget->hasExpOrExportInsts()">,
1878+
AssemblerPredicate<(all_of (not FeatureGFX90AInsts))>;
1879+
18771880
def HasDSAddTid : Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
18781881
AssemblerPredicate<(all_of FeatureGFX9Insts)>;
18791882

llvm/lib/Target/AMDGPU/EXPInstructions.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ class EXP_Real_Row<string pseudo, int subtarget, string name = "exp", EXP_Pseudo
5858

5959
// DONE variants have mayLoad = 1.
6060
// ROW variants have an implicit use of M0.
61-
let SubtargetPredicate = isNotGFX90APlus in {
61+
let SubtargetPredicate = HasExpOrExportInsts in {
6262
def EXP : EXP_Pseudo<0, 0>;
6363
def EXP_DONE : EXP_Pseudo<0, 1>;
6464
def EXP_ROW : EXP_Pseudo<1, 0>;
6565
def EXP_ROW_DONE : EXP_Pseudo<1, 1>;
66-
} // let SubtargetPredicate = isNotGFX90APlus
66+
} // let SubtargetPredicate = HasExpOrExportInsts
6767

6868
//===----------------------------------------------------------------------===//
6969
// SI, VI, GFX10.
@@ -117,7 +117,7 @@ multiclass EXP_Real_gfx11 {
117117
multiclass VEXPORT_Real_gfx12 {
118118
defvar ps = !cast<EXP_Pseudo>(NAME);
119119
def _gfx12 : EXP_Real_Row<NAME, SIEncodingFamily.GFX12, "export">,
120-
EXPe_Row, MnemonicAlias<"exp", "export">, Requires<[isGFX12Plus]> {
120+
EXPe_Row, MnemonicAlias<"exp", "export">, Requires<[isGFX12Plus, HasExpOrExportInsts]> {
121121
let AssemblerPredicate = isGFX12Only;
122122
let DecoderNamespace = "GFX12";
123123
let row = ps.row;

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
647647
// BUFFER/FLAT/GLOBAL_ATOMIC_ADD/MIN/MAX_F64
648648
bool hasBufferFlatGlobalAtomicsF64() const { return hasGFX90AInsts(); }
649649

650+
bool hasExpOrExportInsts() const {
651+
return !hasGFX940Insts();
652+
}
653+
650654
// DS_ADD_F64/DS_ADD_RTN_F64
651655
bool hasLdsAtomicAddF64() const { return hasGFX90AInsts(); }
652656

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,7 @@ let SubtargetPredicate = isGFX10Plus in {
17051705
} // End SubtargetPredicate = isGFX10Plus
17061706

17071707
let SubtargetPredicate = isGFX11Plus in {
1708+
let OtherPredicates = [HasExpOrExportInsts] in
17081709
def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16),
17091710
"$simm16"> {
17101711
let hasSideEffects = 1;
@@ -1737,6 +1738,7 @@ let OtherPredicates = [HasImageInsts] in {
17371738
SOPP_Pseudo<"s_wait_bvhcnt", (ins s16imm:$simm16), "$simm16",
17381739
[(int_amdgcn_s_wait_bvhcnt timm:$simm16)]>;
17391740
} // End OtherPredicates = [HasImageInsts].
1741+
let OtherPredicates = [HasExpOrExportInsts] in
17401742
def S_WAIT_EXPCNT :
17411743
SOPP_Pseudo<"s_wait_expcnt", (ins s16imm:$simm16), "$simm16",
17421744
[(int_amdgcn_s_wait_expcnt timm:$simm16)]>;

0 commit comments

Comments
 (0)