annotate llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.init.ll @ 206:f17a3b42b08b

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