source: icGREP/icgrep-devel/llvm-3.8.0.src/test/CodeGen/AMDGPU/image-resource-id.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 16.6 KB
Line 
1; RUN: llc -march=r600 -mcpu=juniper < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2
3; === 1 image arg, read_only ===================================================
4
5; FUNC-LABEL: {{^}}test_2d_rd_1_0:
6; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
7; EG: MOV [[VAL]], literal.x
8; EG-NEXT: LSHR
9; EG-NEXT: 0(
10define void @test_2d_rd_1_0(%opencl.image2d_t addrspace(1)* %in, ; read_only
11                            i32 addrspace(1)* %out) {
12entry:
13  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
14      %opencl.image2d_t addrspace(1)* %in) #0
15  store i32 %0, i32 addrspace(1)* %out
16  ret void
17}
18
19; FUNC-LABEL: {{^}}test_3d_rd_1_0:
20; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
21; EG: MOV [[VAL]], literal.x
22; EG-NEXT: LSHR
23; EG-NEXT: 0(
24define void @test_3d_rd_1_0(%opencl.image3d_t addrspace(1)* %in, ; read_only
25                            i32 addrspace(1)* %out) {
26entry:
27  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
28      %opencl.image3d_t addrspace(1)* %in) #0
29  store i32 %0, i32 addrspace(1)* %out
30  ret void
31}
32
33; === 1 image arg, write_only ==================================================
34
35; FUNC-LABEL: {{^}}test_2d_wr_1_0:
36; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
37; EG: MOV [[VAL]], literal.x
38; EG-NEXT: LSHR
39; EG-NEXT: 0(
40define void @test_2d_wr_1_0(%opencl.image2d_t addrspace(1)* %in, ; write_only
41                            i32 addrspace(1)* %out) {
42entry:
43  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
44      %opencl.image2d_t addrspace(1)* %in) #0
45  store i32 %0, i32 addrspace(1)* %out
46  ret void
47}
48
49; FUNC-LABEL: {{^}}test_3d_wr_1_0:
50; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
51; EG: MOV [[VAL]], literal.x
52; EG-NEXT: LSHR
53; EG-NEXT: 0(
54define void @test_3d_wr_1_0(%opencl.image3d_t addrspace(1)* %in, ; write_only
55                            i32 addrspace(1)* %out) {
56entry:
57  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
58      %opencl.image3d_t addrspace(1)* %in) #0
59  store i32 %0, i32 addrspace(1)* %out
60  ret void
61}
62
63; === 2 image args, read_only ==================================================
64
65; FUNC-LABEL: {{^}}test_2d_rd_2_0:
66; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
67; EG: MOV [[VAL]], literal.x
68; EG-NEXT: LSHR
69; EG-NEXT: 0(
70define void @test_2d_rd_2_0(%opencl.image2d_t addrspace(1)* %in1, ; read_only
71                            %opencl.image2d_t addrspace(1)* %in2, ; read_only
72                            i32 addrspace(1)* %out) {
73entry:
74  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
75      %opencl.image2d_t addrspace(1)* %in1) #0
76  store i32 %0, i32 addrspace(1)* %out
77  ret void
78}
79
80; FUNC-LABEL: {{^}}test_2d_rd_2_1:
81; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
82; EG: MOV [[VAL]], literal.x
83; EG-NEXT: LSHR
84; EG-NEXT: 1(
85define void @test_2d_rd_2_1(%opencl.image2d_t addrspace(1)* %in1, ; read_only
86                            %opencl.image2d_t addrspace(1)* %in2, ; read_only
87                            i32 addrspace(1)* %out) {
88entry:
89  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
90      %opencl.image2d_t addrspace(1)* %in2) #0
91  store i32 %0, i32 addrspace(1)* %out
92  ret void
93}
94
95; FUNC-LABEL: {{^}}test_3d_rd_2_0:
96; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
97; EG: MOV [[VAL]], literal.x
98; EG-NEXT: LSHR
99; EG-NEXT: 0(
100define void @test_3d_rd_2_0(%opencl.image3d_t addrspace(1)* %in1, ; read_only
101                            %opencl.image3d_t addrspace(1)* %in2, ; read_only
102                            i32 addrspace(1)* %out) {
103entry:
104  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
105      %opencl.image3d_t addrspace(1)* %in1) #0
106  store i32 %0, i32 addrspace(1)* %out
107  ret void
108}
109
110; FUNC-LABEL: {{^}}test_3d_rd_2_1:
111; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
112; EG: MOV [[VAL]], literal.x
113; EG-NEXT: LSHR
114; EG-NEXT: 1(
115define void @test_3d_rd_2_1(%opencl.image3d_t addrspace(1)* %in1, ; read_only
116                            %opencl.image3d_t addrspace(1)* %in2, ; read_only
117                            i32 addrspace(1)* %out) {
118entry:
119  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
120      %opencl.image3d_t addrspace(1)* %in2) #0
121  store i32 %0, i32 addrspace(1)* %out
122  ret void
123}
124
125; === 2 image args, write_only =================================================
126
127; FUNC-LABEL: {{^}}test_2d_wr_2_0:
128; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
129; EG: MOV [[VAL]], literal.x
130; EG-NEXT: LSHR
131; EG-NEXT: 0(
132define void @test_2d_wr_2_0(%opencl.image2d_t addrspace(1)* %in1, ; write_only
133                            %opencl.image2d_t addrspace(1)* %in2, ; write_only
134                            i32 addrspace(1)* %out) {
135entry:
136  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
137      %opencl.image2d_t addrspace(1)* %in1) #0
138  store i32 %0, i32 addrspace(1)* %out
139  ret void
140}
141
142; FUNC-LABEL: {{^}}test_2d_wr_2_1:
143; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
144; EG: MOV [[VAL]], literal.x
145; EG-NEXT: LSHR
146; EG-NEXT: 1(
147define void @test_2d_wr_2_1(%opencl.image2d_t addrspace(1)* %in1, ; write_only
148                            %opencl.image2d_t addrspace(1)* %in2, ; write_only
149                            i32 addrspace(1)* %out) {
150entry:
151  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
152      %opencl.image2d_t addrspace(1)* %in2) #0
153  store i32 %0, i32 addrspace(1)* %out
154  ret void
155}
156
157; FUNC-LABEL: {{^}}test_3d_wr_2_0:
158; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
159; EG: MOV [[VAL]], literal.x
160; EG-NEXT: LSHR
161; EG-NEXT: 0(
162define void @test_3d_wr_2_0(%opencl.image3d_t addrspace(1)* %in1, ; write_only
163                            %opencl.image3d_t addrspace(1)* %in2, ; write_only
164                            i32 addrspace(1)* %out) {
165entry:
166  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
167      %opencl.image3d_t addrspace(1)* %in1) #0
168  store i32 %0, i32 addrspace(1)* %out
169  ret void
170}
171
172; FUNC-LABEL: {{^}}test_3d_wr_2_1:
173; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
174; EG: MOV [[VAL]], literal.x
175; EG-NEXT: LSHR
176; EG-NEXT: 1(
177define void @test_3d_wr_2_1(%opencl.image3d_t addrspace(1)* %in1, ; write_only
178                            %opencl.image3d_t addrspace(1)* %in2, ; write_only
179                            i32 addrspace(1)* %out) {
180entry:
181  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
182      %opencl.image3d_t addrspace(1)* %in2) #0
183  store i32 %0, i32 addrspace(1)* %out
184  ret void
185}
186
187; === 3 image args, read_only ==================================================
188
189; FUNC-LABEL: {{^}}test_2d_rd_3_0:
190; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
191; EG: MOV [[VAL]], literal.x
192; EG-NEXT: LSHR
193; EG-NEXT: 2(
194define void @test_2d_rd_3_0(%opencl.image2d_t addrspace(1)* %in1, ; read_only
195                            %opencl.image3d_t addrspace(1)* %in2, ; read_only
196                            %opencl.image2d_t addrspace(1)* %in3, ; read_only
197                            i32 addrspace(1)* %out) {
198entry:
199  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
200      %opencl.image2d_t addrspace(1)* %in3) #0
201  store i32 %0, i32 addrspace(1)* %out
202  ret void
203}
204
205
206; FUNC-LABEL: {{^}}test_3d_rd_3_0:
207; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
208; EG: MOV [[VAL]], literal.x
209; EG-NEXT: LSHR
210; EG-NEXT: 2(
211define void @test_3d_rd_3_0(%opencl.image3d_t addrspace(1)* %in1, ; read_only
212                            %opencl.image2d_t addrspace(1)* %in2, ; read_only
213                            %opencl.image3d_t addrspace(1)* %in3, ; read_only
214                            i32 addrspace(1)* %out) {
215entry:
216  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
217      %opencl.image3d_t addrspace(1)* %in3) #0
218  store i32 %0, i32 addrspace(1)* %out
219  ret void
220}
221
222; === 3 image args, write_only =================================================
223
224; FUNC-LABEL: {{^}}test_2d_wr_3_0:
225; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
226; EG: MOV [[VAL]], literal.x
227; EG-NEXT: LSHR
228; EG-NEXT: 2(
229define void @test_2d_wr_3_0(%opencl.image2d_t addrspace(1)* %in1, ; write_only
230                            %opencl.image3d_t addrspace(1)* %in2, ; write_only
231                            %opencl.image2d_t addrspace(1)* %in3, ; write_only
232                            i32 addrspace(1)* %out) {
233entry:
234  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
235      %opencl.image2d_t addrspace(1)* %in3) #0
236  store i32 %0, i32 addrspace(1)* %out
237  ret void
238}
239
240
241; FUNC-LABEL: {{^}}test_3d_wr_3_0:
242; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
243; EG: MOV [[VAL]], literal.x
244; EG-NEXT: LSHR
245; EG-NEXT: 2(
246define void @test_3d_wr_3_0(%opencl.image3d_t addrspace(1)* %in1, ; write_only
247                            %opencl.image2d_t addrspace(1)* %in2, ; write_only
248                            %opencl.image3d_t addrspace(1)* %in3, ; write_only
249                            i32 addrspace(1)* %out) {
250entry:
251  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
252      %opencl.image3d_t addrspace(1)* %in3) #0
253  store i32 %0, i32 addrspace(1)* %out
254  ret void
255}
256
257; === 3 image args, mixed ======================================================
258
259; FUNC-LABEL: {{^}}test_2d_mix_3_0:
260; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
261; EG: MOV [[VAL]], literal.x
262; EG-NEXT: LSHR
263; EG-NEXT: 1(
264define void @test_2d_mix_3_0(%opencl.image2d_t addrspace(1)* %in1, ; write_only
265                             %opencl.image3d_t addrspace(1)* %in2, ; read_only
266                             %opencl.image2d_t addrspace(1)* %in3, ; read_only
267                             i32 addrspace(1)* %out) {
268entry:
269  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
270      %opencl.image2d_t addrspace(1)* %in3) #0
271  store i32 %0, i32 addrspace(1)* %out
272  ret void
273}
274
275; FUNC-LABEL: {{^}}test_3d_mix_3_0:
276; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
277; EG: MOV [[VAL]], literal.x
278; EG-NEXT: LSHR
279; EG-NEXT: 1(
280define void @test_3d_mix_3_0(%opencl.image3d_t addrspace(1)* %in1, ; write_only
281                             %opencl.image2d_t addrspace(1)* %in2, ; read_only
282                             %opencl.image3d_t addrspace(1)* %in3, ; read_only
283                             i32 addrspace(1)* %out) {
284entry:
285  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
286      %opencl.image3d_t addrspace(1)* %in3) #0
287  store i32 %0, i32 addrspace(1)* %out
288  ret void
289}
290
291; FUNC-LABEL: {{^}}test_2d_mix_3_1:
292; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
293; EG: MOV [[VAL]], literal.x
294; EG-NEXT: LSHR
295; EG-NEXT: 1(
296define void @test_2d_mix_3_1(%opencl.image2d_t addrspace(1)* %in1, ; write_only
297                             %opencl.image3d_t addrspace(1)* %in2, ; read_only
298                             %opencl.image2d_t addrspace(1)* %in3, ; write_only
299                             i32 addrspace(1)* %out) {
300entry:
301  %0 = call i32 @llvm.OpenCL.image.get.resource.id.2d(
302      %opencl.image2d_t addrspace(1)* %in3) #0
303  store i32 %0, i32 addrspace(1)* %out
304  ret void
305}
306
307; FUNC-LABEL: {{^}}test_3d_mix_3_1:
308; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
309; EG: MOV [[VAL]], literal.x
310; EG-NEXT: LSHR
311; EG-NEXT: 1(
312define void @test_3d_mix_3_1(%opencl.image3d_t addrspace(1)* %in1, ; write_only
313                             %opencl.image2d_t addrspace(1)* %in2, ; read_only
314                             %opencl.image3d_t addrspace(1)* %in3, ; write_only
315                             i32 addrspace(1)* %out) {
316entry:
317  %0 = call i32 @llvm.OpenCL.image.get.resource.id.3d(
318      %opencl.image3d_t addrspace(1)* %in3) #0
319  store i32 %0, i32 addrspace(1)* %out
320  ret void
321}
322
323
324%opencl.image2d_t = type opaque
325%opencl.image3d_t = type opaque
326
327declare i32 @llvm.OpenCL.image.get.resource.id.2d(%opencl.image2d_t addrspace(1)*) #0
328declare i32 @llvm.OpenCL.image.get.resource.id.3d(%opencl.image3d_t addrspace(1)*) #0
329
330attributes #0 = { readnone }
331
332!opencl.kernels = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13,
333                    !14, !15, !16, !17, !18, !19}
334!0 = !{void (%opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_rd_1_0,
335       !110, !120, !130, !140, !150}
336!1 = !{void (%opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_rd_1_0,
337       !110, !120, !131, !141, !150}
338!2 = !{void (%opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_wr_1_0,
339       !110, !121, !130, !140, !150}
340!3 = !{void (%opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_wr_1_0,
341       !110, !121, !131, !141, !150}
342!110 = !{!"kernel_arg_addr_space", i32 1, i32 1}
343!120 = !{!"kernel_arg_access_qual", !"read_only", !"none"}
344!121 = !{!"kernel_arg_access_qual", !"write_only", !"none"}
345!130 = !{!"kernel_arg_type", !"image2d_t", !"int*"}
346!131 = !{!"kernel_arg_type", !"image3d_t", !"int*"}
347!140 = !{!"kernel_arg_base_type", !"image2d_t", !"int*"}
348!141 = !{!"kernel_arg_base_type", !"image3d_t", !"int*"}
349!150 = !{!"kernel_arg_type_qual", !"", !""}
350
351!4  = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
352              i32 addrspace(1)*)* @test_2d_rd_2_0, !112, !122, !132, !142, !152}
353!5  = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
354              i32 addrspace(1)*)* @test_2d_rd_2_1, !112, !122, !132, !142, !152}
355!6  = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
356              i32 addrspace(1)*)* @test_3d_rd_2_0, !112, !122, !133, !143, !152}
357!7  = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
358              i32 addrspace(1)*)* @test_3d_rd_2_1, !112, !122, !133, !143, !152}
359!8  = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
360              i32 addrspace(1)*)* @test_2d_wr_2_0, !112, !123, !132, !142, !152}
361!9  = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
362              i32 addrspace(1)*)* @test_2d_wr_2_1, !112, !123, !132, !142, !152}
363!10 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
364              i32 addrspace(1)*)* @test_3d_wr_2_0, !112, !123, !133, !143, !152}
365!11 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
366              i32 addrspace(1)*)* @test_3d_wr_2_1, !112, !123, !133, !143, !152}
367!112 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
368!122 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"none"}
369!123 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"none"}
370!132 = !{!"kernel_arg_type", !"image2d_t", !"image2d_t", !"int*"}
371!133 = !{!"kernel_arg_type", !"image3d_t", !"image3d_t", !"int*"}
372!142 = !{!"kernel_arg_base_type", !"image2d_t", !"image2d_t", !"int*"}
373!143 = !{!"kernel_arg_base_type", !"image3d_t", !"image3d_t", !"int*"}
374!152 = !{!"kernel_arg_type_qual", !"", !"", !""}
375
376!12 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
377              %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_rd_3_0,
378              !114, !124, !134, !144, !154}
379!13 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
380              %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_rd_3_0,
381              !114, !124, !135, !145, !154}
382!14 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
383              %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_wr_3_0,
384              !114, !125, !134, !144, !154}
385!15 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
386              %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_wr_3_0,
387              !114, !125, !135, !145, !154}
388!16 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
389              %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_mix_3_0,
390              !114, !126, !134, !144, !154}
391!17 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
392              %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_mix_3_0,
393              !114, !126, !135, !145, !154}
394!18 = !{void (%opencl.image2d_t addrspace(1)*, %opencl.image3d_t addrspace(1)*,
395              %opencl.image2d_t addrspace(1)*, i32 addrspace(1)*)* @test_2d_mix_3_1,
396              !114, !127, !134, !144, !154}
397!19 = !{void (%opencl.image3d_t addrspace(1)*, %opencl.image2d_t addrspace(1)*,
398              %opencl.image3d_t addrspace(1)*, i32 addrspace(1)*)* @test_3d_mix_3_1,
399              !114, !127, !135, !145, !154}
400!114 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1, i32 1}
401!124 = !{!"kernel_arg_access_qual", !"read_only", !"read_only", !"read_only", !"none"}
402!125 = !{!"kernel_arg_access_qual", !"write_only", !"write_only", !"write_only", !"none"}
403!126 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"read_only", !"none"}
404!127 = !{!"kernel_arg_access_qual", !"write_only", !"read_only", !"write_only", !"none"}
405!134 = !{!"kernel_arg_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
406!135 = !{!"kernel_arg_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
407!144 = !{!"kernel_arg_base_type", !"image2d_t", !"image3d_t", !"image2d_t", !"int*"}
408!145 = !{!"kernel_arg_base_type", !"image3d_t", !"image2d_t", !"image3d_t", !"int*"}
409!154 = !{!"kernel_arg_type_qual", !"", !"", !"", !""}
Note: See TracBrowser for help on using the repository browser.