Skip to content

Commit 8eb12f6

Browse files
authored
[AMDGPU] Support s_endpgm_ordered_ps_done on GFX11 (#119230)
Support assembly/disassembly of this instruction for compatibility with SP3, even though it has no use in GFX11. It is fully removed in GFX12.
1 parent 6c7e582 commit 8eb12f6

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,11 @@ def isGFX9GFX10 :
21362136
"Subtarget->getGeneration() == AMDGPUSubtarget::GFX10">,
21372137
AssemblerPredicate<(all_of FeatureGFX9Insts, (not FeatureGFX11Insts))>;
21382138

2139+
def isGFX9GFX10GFX11 :
2140+
Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9 &&"
2141+
"Subtarget->getGeneration() < AMDGPUSubtarget::GFX12">,
2142+
AssemblerPredicate<(all_of FeatureGFX9Insts, (not FeatureGFX12Insts))>;
2143+
21392144
def isGFX8GFX9GFX10 :
21402145
Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
21412146
"Subtarget->getGeneration() == AMDGPUSubtarget::GFX9 ||"

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,12 +1512,12 @@ def S_ENDPGM_SAVED : SOPP_Pseudo<"s_endpgm_saved", (ins)> {
15121512
let isReturn = 1;
15131513
}
15141514

1515-
let SubtargetPredicate = isGFX9GFX10 in {
1515+
let SubtargetPredicate = isGFX9GFX10GFX11 in {
15161516
let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
15171517
def S_ENDPGM_ORDERED_PS_DONE :
15181518
SOPP_Pseudo<"s_endpgm_ordered_ps_done", (ins)>;
15191519
} // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1
1520-
} // End SubtargetPredicate = isGFX9GFX10
1520+
} // End SubtargetPredicate = isGFX9GFX10GFX11
15211521

15221522
let SubtargetPredicate = isGFX10Plus in {
15231523
let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in {
@@ -2661,6 +2661,7 @@ defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx11<0x029>;
26612661
defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx11<0x02a>;
26622662
defm S_ENDPGM : SOPP_Real_32_gfx11_gfx12<0x030>;
26632663
defm S_ENDPGM_SAVED : SOPP_Real_32_gfx11_gfx12<0x031>;
2664+
defm S_ENDPGM_ORDERED_PS_DONE : SOPP_Real_32_gfx11<0x032>;
26642665
defm S_WAKEUP : SOPP_Real_32_gfx11_gfx12<0x034>;
26652666
defm S_SETPRIO : SOPP_Real_32_gfx11_gfx12<0x035>;
26662667
defm S_SENDMSG : SOPP_Real_32_gfx11_gfx12<0x036>;

llvm/test/MC/AMDGPU/gfx11_asm_sopp.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,6 @@ s_wait_event 0x3141
430430

431431
s_wait_event 0xc1d1
432432
// GFX11: s_wait_event 0xc1d1 ; encoding: [0xd1,0xc1,0x8b,0xbf]
433+
434+
s_endpgm_ordered_ps_done
435+
// GFX11: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0xb2,0xbf]

llvm/test/MC/AMDGPU/gfx12_err.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@ s_prefetch_inst s[14:15], 0xffffff, m0, 7
113113
// GFX12-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: expected a 24-bit signed offset
114114
// GFX12-ERR: s_prefetch_inst s[14:15], 0xffffff, m0, 7
115115
// GFX12-ERR: ^
116+
117+
s_endpgm_ordered_ps_done
118+
// GFX12-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU

llvm/test/MC/AMDGPU/sopk.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ s_endpgm_ordered_ps_done
478478
// GFX9: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0x9e,0xbf]
479479
// NOSICIVI: :[[@LINE-2]]:{{[0-9]+}}: error: instruction not supported on this GPU
480480
// GFX10: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0x9e,0xbf]
481-
// NOGFX11: :[[@LINE-4]]:{{[0-9]+}}: error: instruction not supported on this GPU
481+
// GFX11: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0xb2,0xbf]
482482

483483
s_call_b64 null, 12609
484484
// GFX10: s_call_b64 null, 12609 ; encoding: [0x41,0x31,0x7d,0xbb]

llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_sopp.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,6 @@
294294

295295
# GFX11: s_wait_event 0xc1d1 ; encoding: [0xd1,0xc1,0x8b,0xbf]
296296
0xd1,0xc1,0x8b,0xbf
297+
298+
# GFX11: s_endpgm_ordered_ps_done ; encoding: [0x00,0x00,0xb2,0xbf]
299+
0x00,0x00,0xb2,0xbf

0 commit comments

Comments
 (0)