Skip to content

Commit f12059e

Browse files
authored
[AMDGPU] Fix llvm.amdgcn.s.wait.event.export.ready for GFX12 (#78191)
The meaning of bit 0 of the immediate operand of S_WAIT_EVENT has been flipped from GFX11.
1 parent e9e9d1b commit f12059e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,10 +1768,10 @@ def : GCNPat<
17681768
(S_SEXT_I32_I16 $src)
17691769
>;
17701770

1771-
def : GCNPat <
1772-
(int_amdgcn_s_wait_event_export_ready),
1773-
(S_WAIT_EVENT (i16 0))
1774-
>;
1771+
let SubtargetPredicate = isNotGFX12Plus in
1772+
def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 0))>;
1773+
let SubtargetPredicate = isGFX12Plus in
1774+
def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 1))>;
17751775

17761776
// The first 10 bits of the mode register are the core FP mode on all
17771777
// subtargets.

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.wait.event.ll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
; RUN: llc -global-isel=0 -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1100 < %s | FileCheck -check-prefix=GCN %s
2-
; RUN: llc -global-isel -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1100 < %s | FileCheck -check-prefix=GCN %s
1+
; RUN: llc -global-isel=0 -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GCN,GFX11 %s
2+
; RUN: llc -global-isel=1 -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GCN,GFX11 %s
3+
; RUN: llc -global-isel=0 -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1200 < %s | FileCheck -check-prefixes=GCN,GFX12 %s
4+
; RUN: llc -global-isel=1 -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1200 < %s | FileCheck -check-prefixes=GCN,GFX12 %s
35

46
; GCN-LABEL: {{^}}test_wait_event:
5-
; GCN: s_wait_event 0x0
7+
; GFX11: s_wait_event 0x0
8+
; GFX12: s_wait_event 0x1
69

710
define amdgpu_ps void @test_wait_event() #0 {
811
entry:

0 commit comments

Comments
 (0)