Debian Codegraph @

llvm-project/llvm/projects/opencl-clang/tests/Manual/testsuite/read_image_attributes.cl

raw
1 /* 'testsuite/read_image_attributes.cl' */
2
3 // RUN: %occ-cli %s %cfg_path --cl-device=%cl_device --output=%t.bc
4 // RUN: llvm-dis %t.bc -o - | FileCheck %s
5
6 // CHECK-NOT: attributes{{.*}}readnone
7
8 const sampler_t smp =
9 CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
10
11 void ocl_read_image1d_attributes(__read_only image1d_t img,
12 __global float *resf, __global int *resi) {
13 *resf += read_imagef(img, 0).x;
14 *resf += read_imagef(img, .0f).x;
15 *resf += read_imagef(img, smp, 0).x;
16 *resf += read_imagef(img, smp, .0f).x;
17
18 *resi += read_imagei(img, 0).x;
19 *resi += read_imagei(img, .0f).x;
20 *resi += read_imagei(img, smp, 0).x;
21 *resi += read_imagei(img, smp, .0f).x;
22
23 *resi += read_imageui(img, 0).x;
24 *resi += read_imageui(img, .0f).x;
25 *resi += read_imageui(img, smp, 0).x;
26 *resi += read_imageui(img, smp, .0f).x;
27 }
28 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0:#[0-9]+]]
29 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
30 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
31 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
32 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
33 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
34 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
35 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
36 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
37
38 void ocl_read_image1d_buffer_attributes(__read_only image1d_buffer_t img,
39 __global float *resf,
40 __global int *resi) {
41 *resf += read_imagef(img, 0).x;
42 *resi += read_imagei(img, 0).x;
43 *resi += read_imageui(img, 0).x;
44 }
45 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
46 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
47 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
48
49 void ocl_read_image1d_arr_attributes(__read_only image1d_array_t img,
50 __global float *resf, __global int *resi) {
51 *resf += read_imagef(img, (int2)(0)).x;
52 *resf += read_imagef(img, smp, (int2)(0)).x;
53 *resf += read_imagef(img, smp, (float2)(0)).x;
54
55 *resi += read_imagei(img, (int2)(0)).x;
56 *resi += read_imagei(img, smp, (int2)(0)).x;
57 *resi += read_imagei(img, smp, (float2)(0)).x;
58
59 *resi += read_imageui(img, (int2)(0)).x;
60 *resi += read_imageui(img, smp, (int2)(0)).x;
61 *resi += read_imageui(img, smp, (float2)(0)).x;
62 }
63 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
64 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
65 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
66 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
67 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
68 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
69 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
70 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
71 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
72
73 void ocl_read_image2d_attributes(__read_only image2d_t img,
74 __global float *resf, __global int *resi) {
75 *resf += read_imagef(img, (int2)0).x;
76 *resf += read_imagef(img, smp, (int2)0).x;
77 *resf += read_imagef(img, smp, (float2).0f).x;
78
79 *resi += read_imagei(img, (int2)0).x;
80 *resi += read_imagei(img, smp, (int2)0).x;
81 *resi += read_imagei(img, smp, (float2).0f).x;
82
83 *resi += read_imageui(img, (int2)0).x;
84 *resi += read_imageui(img, smp, (int2)0).x;
85 *resi += read_imageui(img, smp, (float2).0f).x;
86 }
87 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
88 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
89 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
90 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
91 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
92 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
93 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
94 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
95 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
96
97 void ocl_read_image2d_array_attributes(__read_only image2d_array_t img,
98 __global float *resf,
99 __global int *resi) {
100 *resf += read_imagef(img, (int4)0).x;
101 *resf += read_imagef(img, smp, (int4)0).x;
102 *resf += read_imagef(img, smp, (float4).0f).x;
103
104 *resi += read_imagei(img, (int4)0).x;
105 *resi += read_imagei(img, smp, (int4)0).x;
106 *resi += read_imagei(img, smp, (float4).0f).x;
107
108 *resi += read_imageui(img, (int4)0).x;
109 *resi += read_imageui(img, smp, (int4)0).x;
110 *resi += read_imageui(img, smp, (float4).0f).x;
111 }
112 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
113 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
114 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
115 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
116 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
117 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
118 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
119 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
120 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
121
122 void ocl_read_image3d_attributes(__read_only image3d_t img,
123 __global float *resf, __global int *resi) {
124 *resf += read_imagef(img, (int4)0).x;
125 *resf += read_imagef(img, smp, (int4)0).x;
126 *resf += read_imagef(img, smp, (float4).0f).x;
127
128 *resi += read_imagei(img, (int4)0).x;
129 *resi += read_imagei(img, smp, (int4)0).x;
130 *resi += read_imagei(img, smp, (float4).0f).x;
131
132 *resi += read_imageui(img, (int4)0).x;
133 *resi += read_imageui(img, smp, (int4)0).x;
134 *resi += read_imageui(img, smp, (float4).0f).x;
135 }
136 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
137 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
138 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
139 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
140 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
141 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
142 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
143 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
144 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
145
146 void ocl_read_image2d_depth_attributes(__read_only image2d_depth_t img,
147 __global float *resf,
148 __global int *resi) {
149 *resf += read_imagef(img, (int2)0);
150 *resf += read_imagef(img, smp, (int2)0);
151 *resf += read_imagef(img, smp, (float2).0f);
152 }
153 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
154 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
155 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
156
157 void ocl_read_image2d_array_depth_attributes(
158 __read_only image2d_array_depth_t img, __global float *resf,
159 __global int *resi) {
160 *resf += read_imagef(img, (int4)0);
161 *resf += read_imagef(img, smp, (int4)0);
162 *resf += read_imagef(img, smp, (float4).0f);
163 }
164 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
165 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
166 // CHECK: declare{{.*}}read_image{{.*}}[[ATTRS0]]
167
168 // CHECK-DAG: attributes [[ATTRS0]]{{.*}}memory(read)