annotate llvm/test/CodeGen/AMDGPU/atomic_optimizations_struct_buffer.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 0572611fdcc8
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -mtriple=amdgcn---amdgiz -amdgpu-atomic-optimizations=true -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN64,GFX7LESS %s
anatofuz
parents:
diff changeset
2 ; RUN: llc -march=amdgcn -mtriple=amdgcn---amdgiz -mcpu=tonga -mattr=-flat-for-global -amdgpu-atomic-optimizations=true -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN64,GFX8MORE,GFX8MORE64,DPPCOMB %s
anatofuz
parents:
diff changeset
3 ; RUN: llc -march=amdgcn -mtriple=amdgcn---amdgiz -mcpu=gfx900 -mattr=-flat-for-global -amdgpu-atomic-optimizations=true -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN64,GFX8MORE,GFX8MORE64,DPPCOMB %s
anatofuz
parents:
diff changeset
4 ; RUN: llc -march=amdgcn -mtriple=amdgcn---amdgiz -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -mattr=-flat-for-global -amdgpu-atomic-optimizations=true -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN64,GFX8MORE,GFX8MORE64 %s
anatofuz
parents:
diff changeset
5 ; RUN: llc -march=amdgcn -mtriple=amdgcn---amdgiz -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 -mattr=-flat-for-global -amdgpu-atomic-optimizations=true -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN32,GFX8MORE,GFX8MORE32 %s
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 declare i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
8 declare i32 @llvm.amdgcn.struct.buffer.atomic.add(i32, <4 x i32>, i32, i32, i32, i32)
anatofuz
parents:
diff changeset
9 declare i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32, <4 x i32>, i32, i32, i32, i32)
anatofuz
parents:
diff changeset
10
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
11 ; Show what the atomic optimization pass will do for struct buffers.
150
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 ; GCN-LABEL: add_i32_constant:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
14 ; GCN32: s_mov_b32 s[[exec_lo:[0-9]+]], exec_lo
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
15 ; GCN64: s_mov_b64 s{{\[}}[[exec_lo:[0-9]+]]:[[exec_hi:[0-9]+]]{{\]}}, exec
150
anatofuz
parents:
diff changeset
16 ; GCN: v_mbcnt_lo_u32_b32{{(_e[0-9]+)?}} v[[mbcnt:[0-9]+]], s[[exec_lo]], 0
anatofuz
parents:
diff changeset
17 ; GCN64: v_mbcnt_hi_u32_b32{{(_e[0-9]+)?}} v[[mbcnt]], s[[exec_hi]], v[[mbcnt]]
anatofuz
parents:
diff changeset
18 ; GCN: v_cmp_eq_u32{{(_e[0-9]+)?}} vcc{{(_lo)?}}, 0, v[[mbcnt]]
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
19 ; GCN: s_and_saveexec_b{{32|64}} s[[exec:\[?[0-9:]+\]?]], vcc
150
anatofuz
parents:
diff changeset
20 ; GCN32: s_bcnt1_i32_b32 s[[popcount:[0-9]+]], s[[exec_lo]]
anatofuz
parents:
diff changeset
21 ; GCN64: s_bcnt1_i32_b64 s[[popcount:[0-9]+]], s{{\[}}[[exec_lo]]:[[exec_hi]]{{\]}}
anatofuz
parents:
diff changeset
22 ; GCN: v_mul_u32_u24{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[popcount]], 5
anatofuz
parents:
diff changeset
23 ; GCN: buffer_atomic_add v[[value]]
anatofuz
parents:
diff changeset
24 define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
25 entry:
anatofuz
parents:
diff changeset
26 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.add(i32 5, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
27 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
28 ret void
anatofuz
parents:
diff changeset
29 }
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 ; GCN-LABEL: add_i32_uniform:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
32 ; GCN32: s_mov_b32 s[[exec_lo:[0-9]+]], exec_lo
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
33 ; GCN64: s_mov_b64 s{{\[}}[[exec_lo:[0-9]+]]:[[exec_hi:[0-9]+]]{{\]}}, exec
150
anatofuz
parents:
diff changeset
34 ; GCN: v_mbcnt_lo_u32_b32{{(_e[0-9]+)?}} v[[mbcnt:[0-9]+]], s[[exec_lo]], 0
anatofuz
parents:
diff changeset
35 ; GCN64: v_mbcnt_hi_u32_b32{{(_e[0-9]+)?}} v[[mbcnt]], s[[exec_hi]], v[[mbcnt]]
anatofuz
parents:
diff changeset
36 ; GCN: v_cmp_eq_u32{{(_e[0-9]+)?}} vcc{{(_lo)?}}, 0, v[[mbcnt]]
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
37 ; GCN: s_and_saveexec_b{{32|64}} s[[exec:\[?[0-9:]+\]?]], vcc
150
anatofuz
parents:
diff changeset
38 ; GCN32: s_bcnt1_i32_b32 s[[popcount:[0-9]+]], s[[exec_lo]]
anatofuz
parents:
diff changeset
39 ; GCN64: s_bcnt1_i32_b64 s[[popcount:[0-9]+]], s{{\[}}[[exec_lo]]:[[exec_hi]]{{\]}}
anatofuz
parents:
diff changeset
40 ; GCN: s_mul_i32 s[[scalar_value:[0-9]+]], s{{[0-9]+}}, s[[popcount]]
anatofuz
parents:
diff changeset
41 ; GCN: v_mov_b32{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[scalar_value]]
anatofuz
parents:
diff changeset
42 ; GCN: buffer_atomic_add v[[value]]
anatofuz
parents:
diff changeset
43 define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, <4 x i32> %inout, i32 %additive) {
anatofuz
parents:
diff changeset
44 entry:
anatofuz
parents:
diff changeset
45 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.add(i32 %additive, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
46 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
47 ret void
anatofuz
parents:
diff changeset
48 }
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 ; GCN-LABEL: add_i32_varying_vdata:
anatofuz
parents:
diff changeset
51 ; GFX7LESS-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
52 ; GFX7LESS-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
53 ; GFX7LESS-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
54 ; GFX7LESS: buffer_atomic_add v{{[0-9]+}}
anatofuz
parents:
diff changeset
55 ; DPPCOMB: v_add_u32_dpp
anatofuz
parents:
diff changeset
56 ; DPPCOMB: v_add_u32_dpp
anatofuz
parents:
diff changeset
57 ; GFX8MORE32: v_readlane_b32 s[[scalar_value:[0-9]+]], v{{[0-9]+}}, 31
anatofuz
parents:
diff changeset
58 ; GFX8MORE64: v_readlane_b32 s[[scalar_value:[0-9]+]], v{{[0-9]+}}, 63
anatofuz
parents:
diff changeset
59 ; GFX8MORE: v_mov_b32{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[scalar_value]]
anatofuz
parents:
diff changeset
60 ; GFX8MORE: buffer_atomic_add v[[value]]
anatofuz
parents:
diff changeset
61 define amdgpu_kernel void @add_i32_varying_vdata(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
62 entry:
anatofuz
parents:
diff changeset
63 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
64 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.add(i32 %lane, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
65 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
66 ret void
anatofuz
parents:
diff changeset
67 }
anatofuz
parents:
diff changeset
68
anatofuz
parents:
diff changeset
69 ; GCN-LABEL: add_i32_varying_vindex:
anatofuz
parents:
diff changeset
70 ; GCN-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
71 ; GCN-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
72 ; GCN-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
73 ; GCN: buffer_atomic_add v{{[0-9]+}}
anatofuz
parents:
diff changeset
74 define amdgpu_kernel void @add_i32_varying_vindex(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
75 entry:
anatofuz
parents:
diff changeset
76 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
77 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.add(i32 1, <4 x i32> %inout, i32 %lane, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
78 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
79 ret void
anatofuz
parents:
diff changeset
80 }
anatofuz
parents:
diff changeset
81
anatofuz
parents:
diff changeset
82 ; GCN-LABEL: add_i32_varying_offset:
anatofuz
parents:
diff changeset
83 ; GCN-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
84 ; GCN-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
85 ; GCN-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
86 ; GCN: buffer_atomic_add v{{[0-9]+}}
anatofuz
parents:
diff changeset
87 define amdgpu_kernel void @add_i32_varying_offset(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
88 entry:
anatofuz
parents:
diff changeset
89 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
90 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.add(i32 1, <4 x i32> %inout, i32 0, i32 %lane, i32 0, i32 0)
anatofuz
parents:
diff changeset
91 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
92 ret void
anatofuz
parents:
diff changeset
93 }
anatofuz
parents:
diff changeset
94
anatofuz
parents:
diff changeset
95 ; GCN-LABEL: sub_i32_constant:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
96 ; GCN32: s_mov_b32 s[[exec_lo:[0-9]+]], exec_lo
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
97 ; GCN64: s_mov_b64 s{{\[}}[[exec_lo:[0-9]+]]:[[exec_hi:[0-9]+]]{{\]}}, exec
150
anatofuz
parents:
diff changeset
98 ; GCN: v_mbcnt_lo_u32_b32{{(_e[0-9]+)?}} v[[mbcnt:[0-9]+]], s[[exec_lo]], 0
anatofuz
parents:
diff changeset
99 ; GCN64: v_mbcnt_hi_u32_b32{{(_e[0-9]+)?}} v[[mbcnt]], s[[exec_hi]], v[[mbcnt]]
anatofuz
parents:
diff changeset
100 ; GCN: v_cmp_eq_u32{{(_e[0-9]+)?}} vcc{{(_lo)?}}, 0, v[[mbcnt]]
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
101 ; GCN: s_and_saveexec_b{{32|64}} s[[exec:\[?[0-9:]+\]?]], vcc
150
anatofuz
parents:
diff changeset
102 ; GCN32: s_bcnt1_i32_b32 s[[popcount:[0-9]+]], s[[exec_lo]]
anatofuz
parents:
diff changeset
103 ; GCN64: s_bcnt1_i32_b64 s[[popcount:[0-9]+]], s{{\[}}[[exec_lo]]:[[exec_hi]]{{\]}}
anatofuz
parents:
diff changeset
104 ; GCN: v_mul_u32_u24{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[popcount]], 5
anatofuz
parents:
diff changeset
105 ; GCN: buffer_atomic_sub v[[value]]
anatofuz
parents:
diff changeset
106 define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
107 entry:
anatofuz
parents:
diff changeset
108 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32 5, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
109 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
110 ret void
anatofuz
parents:
diff changeset
111 }
anatofuz
parents:
diff changeset
112
anatofuz
parents:
diff changeset
113 ; GCN-LABEL: sub_i32_uniform:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
114 ; GCN32: s_mov_b32 s[[exec_lo:[0-9]+]], exec_lo
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
115 ; GCN64: s_mov_b64 s{{\[}}[[exec_lo:[0-9]+]]:[[exec_hi:[0-9]+]]{{\]}}, exec
150
anatofuz
parents:
diff changeset
116 ; GCN: v_mbcnt_lo_u32_b32{{(_e[0-9]+)?}} v[[mbcnt:[0-9]+]], s[[exec_lo]], 0
anatofuz
parents:
diff changeset
117 ; GCN64: v_mbcnt_hi_u32_b32{{(_e[0-9]+)?}} v[[mbcnt]], s[[exec_hi]], v[[mbcnt]]
anatofuz
parents:
diff changeset
118 ; GCN: v_cmp_eq_u32{{(_e[0-9]+)?}} vcc{{(_lo)?}}, 0, v[[mbcnt]]
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
119 ; GCN: s_and_saveexec_b{{32|64}} s[[exec:\[?[0-9:]+\]?]], vcc
150
anatofuz
parents:
diff changeset
120 ; GCN32: s_bcnt1_i32_b32 s[[popcount:[0-9]+]], s[[exec_lo]]
anatofuz
parents:
diff changeset
121 ; GCN64: s_bcnt1_i32_b64 s[[popcount:[0-9]+]], s{{\[}}[[exec_lo]]:[[exec_hi]]{{\]}}
anatofuz
parents:
diff changeset
122 ; GCN: s_mul_i32 s[[scalar_value:[0-9]+]], s{{[0-9]+}}, s[[popcount]]
anatofuz
parents:
diff changeset
123 ; GCN: v_mov_b32{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[scalar_value]]
anatofuz
parents:
diff changeset
124 ; GCN: buffer_atomic_sub v[[value]]
anatofuz
parents:
diff changeset
125 define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, <4 x i32> %inout, i32 %subitive) {
anatofuz
parents:
diff changeset
126 entry:
anatofuz
parents:
diff changeset
127 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32 %subitive, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
128 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
129 ret void
anatofuz
parents:
diff changeset
130 }
anatofuz
parents:
diff changeset
131
anatofuz
parents:
diff changeset
132 ; GCN-LABEL: sub_i32_varying_vdata:
anatofuz
parents:
diff changeset
133 ; GFX7LESS-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
134 ; GFX7LESS-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
135 ; GFX7LESS-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
136 ; GFX7LESS: buffer_atomic_sub v{{[0-9]+}}
anatofuz
parents:
diff changeset
137 ; DPPCOMB: v_add_u32_dpp
anatofuz
parents:
diff changeset
138 ; DPPCOMB: v_add_u32_dpp
anatofuz
parents:
diff changeset
139 ; GFX8MORE32: v_readlane_b32 s[[scalar_value:[0-9]+]], v{{[0-9]+}}, 31
anatofuz
parents:
diff changeset
140 ; GFX8MORE64: v_readlane_b32 s[[scalar_value:[0-9]+]], v{{[0-9]+}}, 63
anatofuz
parents:
diff changeset
141 ; GFX8MORE: v_mov_b32{{(_e[0-9]+)?}} v[[value:[0-9]+]], s[[scalar_value]]
anatofuz
parents:
diff changeset
142 ; GFX8MORE: buffer_atomic_sub v[[value]]
anatofuz
parents:
diff changeset
143 define amdgpu_kernel void @sub_i32_varying_vdata(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
144 entry:
anatofuz
parents:
diff changeset
145 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
146 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32 %lane, <4 x i32> %inout, i32 0, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
147 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
148 ret void
anatofuz
parents:
diff changeset
149 }
anatofuz
parents:
diff changeset
150
anatofuz
parents:
diff changeset
151 ; GCN-LABEL: sub_i32_varying_vindex:
anatofuz
parents:
diff changeset
152 ; GCN-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
153 ; GCN-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
154 ; GCN-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
155 ; GCN: buffer_atomic_sub v{{[0-9]+}}
anatofuz
parents:
diff changeset
156 define amdgpu_kernel void @sub_i32_varying_vindex(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
157 entry:
anatofuz
parents:
diff changeset
158 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
159 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32 1, <4 x i32> %inout, i32 %lane, i32 0, i32 0, i32 0)
anatofuz
parents:
diff changeset
160 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
161 ret void
anatofuz
parents:
diff changeset
162 }
anatofuz
parents:
diff changeset
163
anatofuz
parents:
diff changeset
164 ; GCN-LABEL: sub_i32_varying_offset:
anatofuz
parents:
diff changeset
165 ; GCN-NOT: v_mbcnt_lo_u32_b32
anatofuz
parents:
diff changeset
166 ; GCN-NOT: v_mbcnt_hi_u32_b32
anatofuz
parents:
diff changeset
167 ; GCN-NOT: s_bcnt1_i32_b64
anatofuz
parents:
diff changeset
168 ; GCN: buffer_atomic_sub v{{[0-9]+}}
anatofuz
parents:
diff changeset
169 define amdgpu_kernel void @sub_i32_varying_offset(i32 addrspace(1)* %out, <4 x i32> %inout) {
anatofuz
parents:
diff changeset
170 entry:
anatofuz
parents:
diff changeset
171 %lane = call i32 @llvm.amdgcn.workitem.id.x()
anatofuz
parents:
diff changeset
172 %old = call i32 @llvm.amdgcn.struct.buffer.atomic.sub(i32 1, <4 x i32> %inout, i32 0, i32 %lane, i32 0, i32 0)
anatofuz
parents:
diff changeset
173 store i32 %old, i32 addrspace(1)* %out
anatofuz
parents:
diff changeset
174 ret void
anatofuz
parents:
diff changeset
175 }