blob: bc0356a8a3a4859d9bbf164ab1f12603253bf53f [file] [log] [blame]
Nicolai Haehnle2f5a7382018-04-04 10:58:54 +00001; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}atomic_swap_1d:
4; GCN: image_atomic_swap v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
5define amdgpu_ps float @atomic_swap_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
6main_body:
7 %v = call i32 @llvm.amdgcn.image.atomic.swap.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
8 %out = bitcast i32 %v to float
9 ret float %out
10}
11
12; GCN-LABEL: {{^}}atomic_add_1d:
13; GCN: image_atomic_add v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
14define amdgpu_ps float @atomic_add_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
15main_body:
16 %v = call i32 @llvm.amdgcn.image.atomic.add.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
17 %out = bitcast i32 %v to float
18 ret float %out
19}
20
21; GCN-LABEL: {{^}}atomic_sub_1d:
22; GCN: image_atomic_sub v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
23define amdgpu_ps float @atomic_sub_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
24main_body:
25 %v = call i32 @llvm.amdgcn.image.atomic.sub.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
26 %out = bitcast i32 %v to float
27 ret float %out
28}
29
30; GCN-LABEL: {{^}}atomic_smin_1d:
31; GCN: image_atomic_smin v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
32define amdgpu_ps float @atomic_smin_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
33main_body:
34 %v = call i32 @llvm.amdgcn.image.atomic.smin.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
35 %out = bitcast i32 %v to float
36 ret float %out
37}
38
39; GCN-LABEL: {{^}}atomic_umin_1d:
40; GCN: image_atomic_umin v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
41define amdgpu_ps float @atomic_umin_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
42main_body:
43 %v = call i32 @llvm.amdgcn.image.atomic.umin.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
44 %out = bitcast i32 %v to float
45 ret float %out
46}
47
48; GCN-LABEL: {{^}}atomic_smax_1d:
49; GCN: image_atomic_smax v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
50define amdgpu_ps float @atomic_smax_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
51main_body:
52 %v = call i32 @llvm.amdgcn.image.atomic.smax.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
53 %out = bitcast i32 %v to float
54 ret float %out
55}
56
57; GCN-LABEL: {{^}}atomic_umax_1d:
58; GCN: image_atomic_umax v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
59define amdgpu_ps float @atomic_umax_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
60main_body:
61 %v = call i32 @llvm.amdgcn.image.atomic.umax.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
62 %out = bitcast i32 %v to float
63 ret float %out
64}
65
66; GCN-LABEL: {{^}}atomic_and_1d:
67; GCN: image_atomic_and v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
68define amdgpu_ps float @atomic_and_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
69main_body:
70 %v = call i32 @llvm.amdgcn.image.atomic.and.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
71 %out = bitcast i32 %v to float
72 ret float %out
73}
74
75; GCN-LABEL: {{^}}atomic_or_1d:
76; GCN: image_atomic_or v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
77define amdgpu_ps float @atomic_or_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
78main_body:
79 %v = call i32 @llvm.amdgcn.image.atomic.or.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
80 %out = bitcast i32 %v to float
81 ret float %out
82}
83
84; GCN-LABEL: {{^}}atomic_xor_1d:
85; GCN: image_atomic_xor v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
86define amdgpu_ps float @atomic_xor_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
87main_body:
88 %v = call i32 @llvm.amdgcn.image.atomic.xor.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
89 %out = bitcast i32 %v to float
90 ret float %out
91}
92
93; GCN-LABEL: {{^}}atomic_inc_1d:
94; GCN: image_atomic_inc v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
95define amdgpu_ps float @atomic_inc_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
96main_body:
97 %v = call i32 @llvm.amdgcn.image.atomic.inc.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
98 %out = bitcast i32 %v to float
99 ret float %out
100}
101
102; GCN-LABEL: {{^}}atomic_dec_1d:
103; GCN: image_atomic_dec v0, v1, s[0:7] dmask:0x1 unorm glc{{$}}
104define amdgpu_ps float @atomic_dec_1d(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
105main_body:
106 %v = call i32 @llvm.amdgcn.image.atomic.dec.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
107 %out = bitcast i32 %v to float
108 ret float %out
109}
110
111; GCN-LABEL: {{^}}atomic_cmpswap_1d:
112; GCN: image_atomic_cmpswap v[0:1], v2, s[0:7] dmask:0x3 unorm glc{{$}}
113define amdgpu_ps float @atomic_cmpswap_1d(<8 x i32> inreg %rsrc, i32 %cmp, i32 %swap, i32 %s) {
114main_body:
115 %v = call i32 @llvm.amdgcn.image.atomic.cmpswap.1d.i32.i32(i32 %cmp, i32 %swap, i32 %s, <8 x i32> %rsrc, i32 0, i32 0)
116 %out = bitcast i32 %v to float
117 ret float %out
118}
119
120; GCN-LABEL: {{^}}atomic_add_2d:
121; GCN: image_atomic_add v0, v[1:2], s[0:7] dmask:0x1 unorm glc{{$}}
122define amdgpu_ps float @atomic_add_2d(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t) {
123main_body:
124 %v = call i32 @llvm.amdgcn.image.atomic.add.2d.i32.i32(i32 %data, i32 %s, i32 %t, <8 x i32> %rsrc, i32 0, i32 0)
125 %out = bitcast i32 %v to float
126 ret float %out
127}
128
129; GCN-LABEL: {{^}}atomic_add_3d:
130; GCN: image_atomic_add v0, v[1:4], s[0:7] dmask:0x1 unorm glc{{$}}
131define amdgpu_ps float @atomic_add_3d(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t, i32 %r) {
132main_body:
133 %v = call i32 @llvm.amdgcn.image.atomic.add.3d.i32.i32(i32 %data, i32 %s, i32 %t, i32 %r, <8 x i32> %rsrc, i32 0, i32 0)
134 %out = bitcast i32 %v to float
135 ret float %out
136}
137
138; GCN-LABEL: {{^}}atomic_add_cube:
139; GCN: image_atomic_add v0, v[1:4], s[0:7] dmask:0x1 unorm glc da{{$}}
140define amdgpu_ps float @atomic_add_cube(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t, i32 %face) {
141main_body:
142 %v = call i32 @llvm.amdgcn.image.atomic.add.cube.i32.i32(i32 %data, i32 %s, i32 %t, i32 %face, <8 x i32> %rsrc, i32 0, i32 0)
143 %out = bitcast i32 %v to float
144 ret float %out
145}
146
147; GCN-LABEL: {{^}}atomic_add_1darray:
148; GCN: image_atomic_add v0, v[1:2], s[0:7] dmask:0x1 unorm glc da{{$}}
149define amdgpu_ps float @atomic_add_1darray(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %slice) {
150main_body:
151 %v = call i32 @llvm.amdgcn.image.atomic.add.1darray.i32.i32(i32 %data, i32 %s, i32 %slice, <8 x i32> %rsrc, i32 0, i32 0)
152 %out = bitcast i32 %v to float
153 ret float %out
154}
155
156; GCN-LABEL: {{^}}atomic_add_2darray:
157; GCN: image_atomic_add v0, v[1:4], s[0:7] dmask:0x1 unorm glc da{{$}}
158define amdgpu_ps float @atomic_add_2darray(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t, i32 %slice) {
159main_body:
160 %v = call i32 @llvm.amdgcn.image.atomic.add.2darray.i32.i32(i32 %data, i32 %s, i32 %t, i32 %slice, <8 x i32> %rsrc, i32 0, i32 0)
161 %out = bitcast i32 %v to float
162 ret float %out
163}
164
165; GCN-LABEL: {{^}}atomic_add_2dmsaa:
166; GCN: image_atomic_add v0, v[1:4], s[0:7] dmask:0x1 unorm glc{{$}}
167define amdgpu_ps float @atomic_add_2dmsaa(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t, i32 %fragid) {
168main_body:
169 %v = call i32 @llvm.amdgcn.image.atomic.add.2dmsaa.i32.i32(i32 %data, i32 %s, i32 %t, i32 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
170 %out = bitcast i32 %v to float
171 ret float %out
172}
173
174; GCN-LABEL: {{^}}atomic_add_2darraymsaa:
175; GCN: image_atomic_add v0, v[1:4], s[0:7] dmask:0x1 unorm glc da{{$}}
176define amdgpu_ps float @atomic_add_2darraymsaa(<8 x i32> inreg %rsrc, i32 %data, i32 %s, i32 %t, i32 %slice, i32 %fragid) {
177main_body:
178 %v = call i32 @llvm.amdgcn.image.atomic.add.2darraymsaa.i32.i32(i32 %data, i32 %s, i32 %t, i32 %slice, i32 %fragid, <8 x i32> %rsrc, i32 0, i32 0)
179 %out = bitcast i32 %v to float
180 ret float %out
181}
182
183; GCN-LABEL: {{^}}atomic_add_1d_slc:
184; GCN: image_atomic_add v0, v1, s[0:7] dmask:0x1 unorm glc slc{{$}}
185define amdgpu_ps float @atomic_add_1d_slc(<8 x i32> inreg %rsrc, i32 %data, i32 %s) {
186main_body:
187 %v = call i32 @llvm.amdgcn.image.atomic.add.1d.i32.i32(i32 %data, i32 %s, <8 x i32> %rsrc, i32 0, i32 2)
188 %out = bitcast i32 %v to float
189 ret float %out
190}
191
192declare i32 @llvm.amdgcn.image.atomic.swap.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
193declare i32 @llvm.amdgcn.image.atomic.add.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
194declare i32 @llvm.amdgcn.image.atomic.sub.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
195declare i32 @llvm.amdgcn.image.atomic.smin.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
196declare i32 @llvm.amdgcn.image.atomic.umin.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
197declare i32 @llvm.amdgcn.image.atomic.smax.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
198declare i32 @llvm.amdgcn.image.atomic.umax.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
199declare i32 @llvm.amdgcn.image.atomic.and.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
200declare i32 @llvm.amdgcn.image.atomic.or.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
201declare i32 @llvm.amdgcn.image.atomic.xor.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
202declare i32 @llvm.amdgcn.image.atomic.inc.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
203declare i32 @llvm.amdgcn.image.atomic.dec.1d.i32.i32(i32, i32, <8 x i32>, i32, i32) #0
204declare i32 @llvm.amdgcn.image.atomic.cmpswap.1d.i32.i32(i32, i32, i32, <8 x i32>, i32, i32) #0
205
206declare i32 @llvm.amdgcn.image.atomic.add.2d.i32.i32(i32, i32, i32, <8 x i32>, i32, i32) #0
207declare i32 @llvm.amdgcn.image.atomic.add.3d.i32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0
208declare i32 @llvm.amdgcn.image.atomic.add.cube.i32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0
209declare i32 @llvm.amdgcn.image.atomic.add.1darray.i32.i32(i32, i32, i32, <8 x i32>, i32, i32) #0
210declare i32 @llvm.amdgcn.image.atomic.add.2darray.i32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0
211declare i32 @llvm.amdgcn.image.atomic.add.2dmsaa.i32.i32(i32, i32, i32, i32, <8 x i32>, i32, i32) #0
212declare i32 @llvm.amdgcn.image.atomic.add.2darraymsaa.i32.i32(i32, i32, i32, i32, i32, <8 x i32>, i32, i32) #0
213
214attributes #0 = { nounwind }
215attributes #1 = { nounwind readonly }
216attributes #2 = { nounwind readnone }