annotate llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.init.ll @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
1 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
2 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
3 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
4 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
5 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
6 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,LOOP %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
7 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-SDAG %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
8 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-GISEL %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
9 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-SDAG %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
10 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-GISEL %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
11 ; RUN: llc -global-isel=0 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 -asm-verbose=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-SDAG %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
12 ; RUN: llc -global-isel=1 -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 -asm-verbose=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,NOLOOP,NOLOOP-GISEL %s
150
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 ; Minimum offset
anatofuz
parents:
diff changeset
15 ; GCN-LABEL: {{^}}gws_init_offset0:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
16 ; GCN-DAG: s_load_{{dword|b32}} [[BAR_NUM:s[0-9]+]]
150
anatofuz
parents:
diff changeset
17 ; GCN-DAG: s_mov_b32 m0, 0{{$}}
anatofuz
parents:
diff changeset
18 ; GCN: v_mov_b32_e32 v0, [[BAR_NUM]]
anatofuz
parents:
diff changeset
19 ; NOLOOP: ds_gws_init v0 gds{{$}}
anatofuz
parents:
diff changeset
20
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
21 ; LOOP: [[LOOP:.LBB[0-9]+_[0-9]+]]:
150
anatofuz
parents:
diff changeset
22 ; LOOP-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 8, 1), 0
anatofuz
parents:
diff changeset
23 ; LOOP-NEXT: ds_gws_init v0 gds
anatofuz
parents:
diff changeset
24 ; LOOP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
anatofuz
parents:
diff changeset
25 ; LOOP-NEXT: s_getreg_b32 [[GETREG:s[0-9]+]], hwreg(HW_REG_TRAPSTS, 8, 1)
anatofuz
parents:
diff changeset
26 ; LOOP-NEXT: s_cmp_lg_u32 [[GETREG]], 0
anatofuz
parents:
diff changeset
27 ; LOOP-NEXT: s_cbranch_scc1 [[LOOP]]
anatofuz
parents:
diff changeset
28 define amdgpu_kernel void @gws_init_offset0(i32 %val) #0 {
anatofuz
parents:
diff changeset
29 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 0)
anatofuz
parents:
diff changeset
30 ret void
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 ; Maximum offset
anatofuz
parents:
diff changeset
34 ; GCN-LABEL: {{^}}gws_init_offset63:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
35 ; NOLOOP-DAG: s_load_{{dword|b32}} [[BAR_NUM:s[0-9]+]]
150
anatofuz
parents:
diff changeset
36 ; NOLOOP-DAG: s_mov_b32 m0, 0{{$}}
anatofuz
parents:
diff changeset
37 ; NOLOOP-DAG: v_mov_b32_e32 v0, [[BAR_NUM]]
anatofuz
parents:
diff changeset
38 ; NOLOOP: ds_gws_init v0 offset:63 gds{{$}}
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 ; LOOP: s_mov_b32 m0, 0{{$}}
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
42 ; LOOP: [[LOOP:.LBB[0-9]+_[0-9]+]]:
150
anatofuz
parents:
diff changeset
43 ; LOOP-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 8, 1), 0
anatofuz
parents:
diff changeset
44 ; LOOP-NEXT: ds_gws_init v0 offset:63 gds
anatofuz
parents:
diff changeset
45 ; LOOP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
anatofuz
parents:
diff changeset
46 ; LOOP-NEXT: s_getreg_b32 [[GETREG:s[0-9]+]], hwreg(HW_REG_TRAPSTS, 8, 1)
anatofuz
parents:
diff changeset
47 ; LOOP-NEXT: s_cmp_lg_u32 [[GETREG]], 0
anatofuz
parents:
diff changeset
48 ; LOOP-NEXT: s_cbranch_scc1 [[LOOP]]
anatofuz
parents:
diff changeset
49 define amdgpu_kernel void @gws_init_offset63(i32 %val) #0 {
anatofuz
parents:
diff changeset
50 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 63)
anatofuz
parents:
diff changeset
51 ret void
anatofuz
parents:
diff changeset
52 }
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 ; FIXME: Should be able to shift directly into m0
anatofuz
parents:
diff changeset
55 ; GCN-LABEL: {{^}}gws_init_sgpr_offset:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
56 ; NOLOOP-DAG: s_load_{{dwordx2|b64}} s[[[BAR_NUM:[0-9]+]]:[[OFFSET:[0-9]+]]]
150
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 ; NOLOOP-SDAG-DAG: s_lshl_b32 [[SHL:s[0-9]+]], s[[OFFSET]], 16
anatofuz
parents:
diff changeset
59 ; NOLOOP-SDAG-DAG: s_mov_b32 m0, [[SHL]]{{$}}
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 ; NOLOOP-GISEL-DAG: s_lshl_b32 m0, s[[OFFSET]], 16
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 ; NOLOOP-DAG: v_mov_b32_e32 [[GWS_VAL:v[0-9]+]], s[[BAR_NUM]]
anatofuz
parents:
diff changeset
64 ; NOLOOP: ds_gws_init [[GWS_VAL]] gds{{$}}
anatofuz
parents:
diff changeset
65 define amdgpu_kernel void @gws_init_sgpr_offset(i32 %val, i32 %offset) #0 {
anatofuz
parents:
diff changeset
66 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 %offset)
anatofuz
parents:
diff changeset
67 ret void
anatofuz
parents:
diff changeset
68 }
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 ; Variable offset in SGPR with constant add
anatofuz
parents:
diff changeset
71 ; GCN-LABEL: {{^}}gws_init_sgpr_offset_add1:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
72 ; NOLOOP-DAG: s_load_{{dwordx2|b64}} s[[[BAR_NUM:[0-9]+]]:[[OFFSET:[0-9]+]]]
150
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 ; NOLOOP-SDAG-DAG: s_lshl_b32 [[SHL:s[0-9]+]], s[[OFFSET]], 16
anatofuz
parents:
diff changeset
75 ; NOLOOP-SDAG-DAG: s_mov_b32 m0, [[SHL]]{{$}}
anatofuz
parents:
diff changeset
76
anatofuz
parents:
diff changeset
77 ; NOLOOP-GISEL-DAG: s_lshl_b32 m0, s[[OFFSET]], 16
anatofuz
parents:
diff changeset
78
anatofuz
parents:
diff changeset
79 ; NOLOOP-DAG: v_mov_b32_e32 [[GWS_VAL:v[0-9]+]], s[[BAR_NUM]]
anatofuz
parents:
diff changeset
80 ; NOLOOP: ds_gws_init [[GWS_VAL]] offset:1 gds{{$}}
anatofuz
parents:
diff changeset
81 define amdgpu_kernel void @gws_init_sgpr_offset_add1(i32 %val, i32 %offset.base) #0 {
anatofuz
parents:
diff changeset
82 %offset = add i32 %offset.base, 1
anatofuz
parents:
diff changeset
83 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 %offset)
anatofuz
parents:
diff changeset
84 ret void
anatofuz
parents:
diff changeset
85 }
anatofuz
parents:
diff changeset
86
anatofuz
parents:
diff changeset
87 ; GCN-LABEL: {{^}}gws_init_vgpr_offset:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
88 ; NOLOOP-DAG: s_load_{{dword|b32}} [[BAR_NUM:s[0-9]+]]
150
anatofuz
parents:
diff changeset
89 ; NOLOOP-DAG: v_readfirstlane_b32 [[READLANE:s[0-9]+]], v0
anatofuz
parents:
diff changeset
90
anatofuz
parents:
diff changeset
91 ; NOLOOP-SDAG-DAG: s_lshl_b32 [[SHL:s[0-9]+]], [[READLANE]], 16
anatofuz
parents:
diff changeset
92 ; NOLOOP-SDAG-DAG: s_mov_b32 m0, [[SHL]]{{$}}
anatofuz
parents:
diff changeset
93
anatofuz
parents:
diff changeset
94 ; NOLOOP-GISEL-DAG: s_lshl_b32 m0, [[READLANE]], 16
anatofuz
parents:
diff changeset
95
anatofuz
parents:
diff changeset
96 ; NOLOOP-DAG: v_mov_b32_e32 v0, [[BAR_NUM]]
anatofuz
parents:
diff changeset
97 ; NOLOOP: ds_gws_init v0 gds{{$}}
anatofuz
parents:
diff changeset
98 define amdgpu_kernel void @gws_init_vgpr_offset(i32 %val) #0 {
anatofuz
parents:
diff changeset
99 %vgpr.offset = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
100 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 %vgpr.offset)
anatofuz
parents:
diff changeset
101 ret void
anatofuz
parents:
diff changeset
102 }
anatofuz
parents:
diff changeset
103
anatofuz
parents:
diff changeset
104 ; Variable offset in VGPR with constant add
anatofuz
parents:
diff changeset
105 ; GCN-LABEL: {{^}}gws_init_vgpr_offset_add:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
106 ; NOLOOP-DAG: s_load_{{dword|b32}} [[BAR_NUM:s[0-9]+]]
150
anatofuz
parents:
diff changeset
107 ; NOLOOP-DAG: v_readfirstlane_b32 [[READLANE:s[0-9]+]], v0
anatofuz
parents:
diff changeset
108
anatofuz
parents:
diff changeset
109 ; NOLOOP-SDAG-DAG: s_lshl_b32 [[SHL:s[0-9]+]], [[READLANE]], 16
anatofuz
parents:
diff changeset
110 ; NOLOOP-SDAG-DAG: s_mov_b32 m0, [[SHL]]{{$}}
anatofuz
parents:
diff changeset
111
anatofuz
parents:
diff changeset
112 ; NOLOOP-GISEL-DAG: s_lshl_b32 m0, [[READLANE]], 16
anatofuz
parents:
diff changeset
113
anatofuz
parents:
diff changeset
114 ; NOLOOP-DAG: v_mov_b32_e32 v0, [[BAR_NUM]]
anatofuz
parents:
diff changeset
115 ; NOLOOP: ds_gws_init v0 offset:3 gds{{$}}
anatofuz
parents:
diff changeset
116 define amdgpu_kernel void @gws_init_vgpr_offset_add(i32 %val) #0 {
anatofuz
parents:
diff changeset
117 %vgpr.offset.base = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
118 %vgpr.offset = add i32 %vgpr.offset.base, 3
anatofuz
parents:
diff changeset
119 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 %vgpr.offset)
anatofuz
parents:
diff changeset
120 ret void
anatofuz
parents:
diff changeset
121 }
anatofuz
parents:
diff changeset
122
anatofuz
parents:
diff changeset
123 @lds = internal unnamed_addr addrspace(3) global i32 undef
anatofuz
parents:
diff changeset
124
anatofuz
parents:
diff changeset
125 ; Check if m0 initialization is shared.
anatofuz
parents:
diff changeset
126 ; GCN-LABEL: {{^}}gws_init_save_m0_init_constant_offset:
anatofuz
parents:
diff changeset
127 ; NOLOOP: s_mov_b32 m0, 0
anatofuz
parents:
diff changeset
128 ; NOLOOP: ds_gws_init v{{[0-9]+}} offset:10 gds
anatofuz
parents:
diff changeset
129
anatofuz
parents:
diff changeset
130 ; LOOP: s_mov_b32 m0, -1
anatofuz
parents:
diff changeset
131 ; LOOP: ds_write_b32
anatofuz
parents:
diff changeset
132 ; LOOP: s_mov_b32 m0, 0
anatofuz
parents:
diff changeset
133 ; LOOP: s_setreg_imm32_b32
anatofuz
parents:
diff changeset
134 ; LOOP: ds_gws_init v{{[0-9]+}} offset:10 gds
anatofuz
parents:
diff changeset
135 ; LOOP: s_cbranch_scc1
anatofuz
parents:
diff changeset
136
anatofuz
parents:
diff changeset
137 ; LOOP: s_mov_b32 m0, -1
anatofuz
parents:
diff changeset
138 ; LOOP: ds_write_b32
anatofuz
parents:
diff changeset
139 define amdgpu_kernel void @gws_init_save_m0_init_constant_offset(i32 %val) #0 {
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
140 store volatile i32 1, ptr addrspace(3) @lds
150
anatofuz
parents:
diff changeset
141 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 10)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
142 store i32 2, ptr addrspace(3) @lds
150
anatofuz
parents:
diff changeset
143 ret void
anatofuz
parents:
diff changeset
144 }
anatofuz
parents:
diff changeset
145
anatofuz
parents:
diff changeset
146 ; GCN-LABEL: {{^}}gws_init_lgkmcnt:
anatofuz
parents:
diff changeset
147 ; NOLOOP: s_mov_b32 m0, 0{{$}}
anatofuz
parents:
diff changeset
148 ; NOLOOP: ds_gws_init v0 gds{{$}}
anatofuz
parents:
diff changeset
149 ; NOLOOP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
anatofuz
parents:
diff changeset
150 ; NOLOOP-NEXT: s_setpc_b64
anatofuz
parents:
diff changeset
151 define void @gws_init_lgkmcnt(i32 %val) {
anatofuz
parents:
diff changeset
152 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 0)
anatofuz
parents:
diff changeset
153 ret void
anatofuz
parents:
diff changeset
154 }
anatofuz
parents:
diff changeset
155
anatofuz
parents:
diff changeset
156 ; Does not imply memory fence on its own
anatofuz
parents:
diff changeset
157 ; GCN-LABEL: {{^}}gws_init_wait_before:
anatofuz
parents:
diff changeset
158 ; NOLOOP: s_waitcnt lgkmcnt(0)
anatofuz
parents:
diff changeset
159 ; NOLOOP-NOT: s_waitcnt
anatofuz
parents:
diff changeset
160 ; NOLOOP: ds_gws_init
anatofuz
parents:
diff changeset
161 ; NOLOOP-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
162 define amdgpu_kernel void @gws_init_wait_before(i32 %val, ptr addrspace(1) %ptr) #0 {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
163 store i32 0, ptr addrspace(1) %ptr
150
anatofuz
parents:
diff changeset
164 call void @llvm.amdgcn.ds.gws.init(i32 %val, i32 7)
anatofuz
parents:
diff changeset
165 ret void
anatofuz
parents:
diff changeset
166 }
anatofuz
parents:
diff changeset
167
anatofuz
parents:
diff changeset
168 declare void @llvm.amdgcn.ds.gws.init(i32, i32) #1
anatofuz
parents:
diff changeset
169 declare i32 @llvm.amdgcn.workitem.id.x() #2
anatofuz
parents:
diff changeset
170
anatofuz
parents:
diff changeset
171 attributes #0 = { nounwind }
anatofuz
parents:
diff changeset
172 attributes #1 = { convergent inaccessiblememonly nounwind writeonly }
anatofuz
parents:
diff changeset
173 attributes #2 = { nounwind readnone speculatable }