aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangpeng Fang <changpeng.fang@amd.com>2024-03-05 15:32:32 -0800
committerGitHub <noreply@github.com>2024-03-05 15:32:32 -0800
commitd6c52c1e2d16ef79737c5666db46e872e943c18a (patch)
tree6b4cbaf55ce5e79be7e97909dafcda839c3449f6
parente77a473601314cc7e7aa912579982a38326d334c (diff)
downloadllvm-d6c52c1e2d16ef79737c5666db46e872e943c18a.zip
llvm-d6c52c1e2d16ef79737c5666db46e872e943c18a.tar.gz
llvm-d6c52c1e2d16ef79737c5666db46e872e943c18a.tar.bz2
AMDGPU: Define HasExpOrExportInsts for export instruction definitions. (#84083)
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPU.td3
-rw-r--r--llvm/lib/Target/AMDGPU/EXPInstructions.td6
-rw-r--r--llvm/lib/Target/AMDGPU/GCNSubtarget.h4
-rw-r--r--llvm/lib/Target/AMDGPU/SOPInstructions.td2
4 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 7c278fd..814ac0b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1874,6 +1874,9 @@ def D16PreservesUnusedBits :
def LDSRequiresM0Init : Predicate<"Subtarget->ldsRequiresM0Init()">;
def NotLDSRequiresM0Init : Predicate<"!Subtarget->ldsRequiresM0Init()">;
+def HasExpOrExportInsts : Predicate<"Subtarget->hasExpOrExportInsts()">,
+ AssemblerPredicate<(all_of (not FeatureGFX90AInsts))>;
+
def HasDSAddTid : Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
AssemblerPredicate<(all_of FeatureGFX9Insts)>;
diff --git a/llvm/lib/Target/AMDGPU/EXPInstructions.td b/llvm/lib/Target/AMDGPU/EXPInstructions.td
index 0a1e544..5e3f555 100644
--- a/llvm/lib/Target/AMDGPU/EXPInstructions.td
+++ b/llvm/lib/Target/AMDGPU/EXPInstructions.td
@@ -58,12 +58,12 @@ class EXP_Real_Row<string pseudo, int subtarget, string name = "exp", EXP_Pseudo
// DONE variants have mayLoad = 1.
// ROW variants have an implicit use of M0.
-let SubtargetPredicate = isNotGFX90APlus in {
+let SubtargetPredicate = HasExpOrExportInsts in {
def EXP : EXP_Pseudo<0, 0>;
def EXP_DONE : EXP_Pseudo<0, 1>;
def EXP_ROW : EXP_Pseudo<1, 0>;
def EXP_ROW_DONE : EXP_Pseudo<1, 1>;
-} // let SubtargetPredicate = isNotGFX90APlus
+} // let SubtargetPredicate = HasExpOrExportInsts
//===----------------------------------------------------------------------===//
// SI, VI, GFX10.
@@ -117,7 +117,7 @@ multiclass EXP_Real_gfx11 {
multiclass VEXPORT_Real_gfx12 {
defvar ps = !cast<EXP_Pseudo>(NAME);
def _gfx12 : EXP_Real_Row<NAME, SIEncodingFamily.GFX12, "export">,
- EXPe_Row, MnemonicAlias<"exp", "export">, Requires<[isGFX12Plus]> {
+ EXPe_Row, MnemonicAlias<"exp", "export">, Requires<[isGFX12Plus, HasExpOrExportInsts]> {
let AssemblerPredicate = isGFX12Only;
let DecoderNamespace = "GFX12";
let row = ps.row;
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index a933c16..bb0ccfce 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -647,6 +647,10 @@ public:
// BUFFER/FLAT/GLOBAL_ATOMIC_ADD/MIN/MAX_F64
bool hasBufferFlatGlobalAtomicsF64() const { return hasGFX90AInsts(); }
+ bool hasExpOrExportInsts() const {
+ return !hasGFX940Insts();
+ }
+
// DS_ADD_F64/DS_ADD_RTN_F64
bool hasLdsAtomicAddF64() const { return hasGFX90AInsts(); }
diff --git a/llvm/lib/Target/AMDGPU/SOPInstructions.td b/llvm/lib/Target/AMDGPU/SOPInstructions.td
index ff79538..e14f7f9 100644
--- a/llvm/lib/Target/AMDGPU/SOPInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SOPInstructions.td
@@ -1705,6 +1705,7 @@ let SubtargetPredicate = isGFX10Plus in {
} // End SubtargetPredicate = isGFX10Plus
let SubtargetPredicate = isGFX11Plus in {
+let OtherPredicates = [HasExpOrExportInsts] in
def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16),
"$simm16"> {
let hasSideEffects = 1;
@@ -1737,6 +1738,7 @@ let OtherPredicates = [HasImageInsts] in {
SOPP_Pseudo<"s_wait_bvhcnt", (ins s16imm:$simm16), "$simm16",
[(int_amdgcn_s_wait_bvhcnt timm:$simm16)]>;
} // End OtherPredicates = [HasImageInsts].
+let OtherPredicates = [HasExpOrExportInsts] in
def S_WAIT_EXPCNT :
SOPP_Pseudo<"s_wait_expcnt", (ins s16imm:$simm16), "$simm16",
[(int_amdgcn_s_wait_expcnt timm:$simm16)]>;