Skip to content

Commit

Permalink
[AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622)
Browse files Browse the repository at this point in the history
As well as flipping the sense of the bit, GFX12 moved it from bit 0 to
bit 1 in the encoded simm16 operand.
  • Loading branch information
jayfoad committed Apr 23, 2024
1 parent a9e3fbf commit e0a763c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/SOPInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ def : GCNPat<
let SubtargetPredicate = isNotGFX12Plus in
def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 0))>;
let SubtargetPredicate = isGFX12Plus in
def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 1))>;
def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 2))>;

// The first 10 bits of the mode register are the core FP mode on all
// subtargets.
Expand Down
10 changes: 3 additions & 7 deletions llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@

; GCN-LABEL: {{^}}test_wait_event:
; GFX11: s_wait_event 0x0
; GFX12: s_wait_event 0x1
; GFX12: s_wait_event 0x2

define amdgpu_ps void @test_wait_event() #0 {
define amdgpu_ps void @test_wait_event() {
entry:
call void @llvm.amdgcn.s.wait.event.export.ready() #0
call void @llvm.amdgcn.s.wait.event.export.ready()
ret void
}

declare void @llvm.amdgcn.s.wait.event.export.ready() #0

attributes #0 = { nounwind }

0 comments on commit e0a763c

Please sign in to comment.