xref: /llvm-project/llvm/test/CodeGen/SPIRV/transcoding/OpImageWrite.ll (revision f9c98068c852c1bb1ec029c2c8df8ace9605f16f)
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
5; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
6
7; CHECK-SPIRV: %[[#VOID_TY:]] = OpTypeVoid
8; CHECK-SPIRV: %[[#IMG2D_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 0 0 0 0 Unknown WriteOnly
9; CHECK-SPIRV: %[[#IMG2D_RW_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 0 0 0 0 Unknown ReadWrite
10; CHECK-SPIRV: %[[#IMG2D_ARRAY_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 0 1 0 0 Unknown WriteOnly
11; CHECK-SPIRV: %[[#IMG2D_ARRAY_RW_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 0 1 0 0 Unknown ReadWrite
12; CHECK-SPIRV: %[[#IMG1D_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 1D 0 0 0 0 Unknown WriteOnly
13; CHECK-SPIRV: %[[#IMG1D_RW_TY:]] = OpTypeImage %[[#VOID_TY]] 1D 0 0 0 0 Unknown ReadWrite
14; CHECK-SPIRV: %[[#IMG1D_BUFFER_WO_TY:]] = OpTypeImage %[[#VOID_TY]] Buffer 0 0 0 0 Unknown WriteOnly
15; CHECK-SPIRV: %[[#IMG1D_BUFFER_RW_TY:]] = OpTypeImage %[[#VOID_TY]] Buffer 0 0 0 0 Unknown ReadWrite
16; CHECK-SPIRV: %[[#IMG1D_ARRAY_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 1D 0 1 0 0 Unknown WriteOnly
17; CHECK-SPIRV: %[[#IMG1D_ARRAY_RW_TY:]] = OpTypeImage %[[#VOID_TY]] 1D 0 1 0 0 Unknown ReadWrite
18; CHECK-SPIRV: %[[#IMG2D_DEPTH_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 1 0 0 0 Unknown WriteOnly
19; CHECK-SPIRV: %[[#IMG2D_ARRAY_DEPTH_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 2D 1 1 0 0 Unknown WriteOnly
20; CHECK-SPIRV: %[[#IMG3D_WO_TY:]] = OpTypeImage %[[#VOID_TY]] 3D 0 0 0 0 Unknown WriteOnly
21; CHECK-SPIRV: %[[#IMG3D_RW_TY:]] = OpTypeImage %[[#VOID_TY]] 3D 0 0 0 0 Unknown ReadWrite
22
23;; kernel void test_img2d(write_only image2d_t image_wo, read_write image2d_t image_rw)
24;; {
25;;     write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0));
26;;     write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0));
27;;     write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0));
28;;     write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0));
29;;
30    ;; LOD
31;;     write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0));
32;;     write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0));
33;; }
34
35; CHECK-SPIRV: %[[#IMG2D_WO:]] = OpFunctionParameter %[[#IMG2D_WO_TY]]
36; CHECK-SPIRV: %[[#IMG2D_RW:]] = OpFunctionParameter %[[#IMG2D_RW_TY]]
37
38; CHECK-SPIRV: OpImageWrite %[[#IMG2D_WO]]
39; CHECK-SPIRV: OpImageWrite %[[#IMG2D_WO]]
40; CHECK-SPIRV: OpImageWrite %[[#IMG2D_RW]]
41; CHECK-SPIRV: OpImageWrite %[[#IMG2D_RW]]
42; CHECK-SPIRV: OpImageWrite %[[#IMG2D_WO]]
43; CHECK-SPIRV: OpImageWrite %[[#IMG2D_WO]]
44
45define dso_local spir_kernel void @test_img2d(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
46entry:
47  call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
48  call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
49  call spir_func void @_Z12write_imagef14ocl_image2d_rwDv2_iDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2) %image_rw, <2 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
50  call spir_func void @_Z12write_imagei14ocl_image2d_rwDv2_iDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2) %image_rw, <2 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
51  call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iiDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, i32 noundef 0, <4 x float> noundef zeroinitializer)
52  call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iiDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, i32 noundef 0, <4 x i32> noundef zeroinitializer)
53  ret void
54}
55
56declare spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1), <2 x i32> noundef, <4 x float> noundef) local_unnamed_addr
57
58declare spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1), <2 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
59
60declare spir_func void @_Z12write_imagef14ocl_image2d_rwDv2_iDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2), <2 x i32> noundef, <4 x float> noundef) local_unnamed_addr
61
62declare spir_func void @_Z12write_imagei14ocl_image2d_rwDv2_iDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2), <2 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
63
64declare spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iiDv4_f(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1), <2 x i32> noundef, i32 noundef, <4 x float> noundef) local_unnamed_addr
65
66declare spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iiDv4_i(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 1), <2 x i32> noundef, i32 noundef, <4 x i32> noundef) local_unnamed_addr
67
68;; kernel void test_img2d_array(write_only image2d_array_t image_wo, read_write image2d_array_t image_rw)
69;; {
70;;     write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0));
71;;     write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0));
72;;     write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0));
73;;     write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0));
74;;
75    ;; LOD
76;;     write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0));
77;;     write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0));
78;; }
79
80; CHECK-SPIRV: %[[#IMG2D_ARRAY_WO:]] = OpFunctionParameter %[[#IMG2D_ARRAY_WO_TY]]
81; CHECK-SPIRV: %[[#IMG2D_ARRAY_RW:]] = OpFunctionParameter %[[#IMG2D_ARRAY_RW_TY]]
82
83; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_WO]]
84; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_WO]]
85; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_RW]]
86; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_RW]]
87; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_WO]]
88; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_WO]]
89
90define dso_local spir_kernel void @test_img2d_array(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
91entry:
92  call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
93  call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
94  call spir_func void @_Z12write_imagef20ocl_image2d_array_rwDv4_iDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 2) %image_rw, <4 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
95  call spir_func void @_Z12write_imagei20ocl_image2d_array_rwDv4_iS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 2) %image_rw, <4 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
96  call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iiDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, i32 noundef 0, <4 x float> noundef zeroinitializer)
97  call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iiS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, i32 noundef 0, <4 x i32> noundef zeroinitializer)
98  ret void
99}
100
101declare spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1), <4 x i32> noundef, <4 x float> noundef) local_unnamed_addr
102
103declare spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1), <4 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
104
105declare spir_func void @_Z12write_imagef20ocl_image2d_array_rwDv4_iDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 2), <4 x i32> noundef, <4 x float> noundef) local_unnamed_addr
106
107declare spir_func void @_Z12write_imagei20ocl_image2d_array_rwDv4_iS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 2), <4 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
108
109declare spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iiDv4_f(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1), <4 x i32> noundef, i32 noundef, <4 x float> noundef) local_unnamed_addr
110
111declare spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iiS0_(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 1), <4 x i32> noundef, i32 noundef, <4 x i32> noundef) local_unnamed_addr
112
113;; kernel void test_img1d(write_only image1d_t image_wo, read_write image1d_t image_rw)
114;; {
115;;     write_imagef(image_wo, 0, (float4)(0,0,0,0));
116;;     write_imagei(image_wo, 0, (int4)(0,0,0,0));
117;;     write_imagef(image_rw, 0, (float4)(0,0,0,0));
118;;     write_imagei(image_rw, 0, (int4)(0,0,0,0));
119;;
120    ;; LOD
121;;     write_imagef(image_wo, 0, 0, (float4)(0,0,0,0));
122;;     write_imagei(image_wo, 0, 0, (int4)(0,0,0,0));
123;; }
124
125; CHECK-SPIRV: %[[#IMG1D_WO:]] = OpFunctionParameter %[[#IMG1D_WO_TY]]
126; CHECK-SPIRV: %[[#IMG1D_RW:]] = OpFunctionParameter %[[#IMG1D_RW_TY]]
127
128; CHECK-SPIRV: OpImageWrite %[[#IMG1D_WO]]
129; CHECK-SPIRV: OpImageWrite %[[#IMG1D_WO]]
130; CHECK-SPIRV: OpImageWrite %[[#IMG1D_RW]]
131; CHECK-SPIRV: OpImageWrite %[[#IMG1D_RW]]
132; CHECK-SPIRV: OpImageWrite %[[#IMG1D_WO]]
133; CHECK-SPIRV: OpImageWrite %[[#IMG1D_WO]]
134
135define dso_local spir_kernel void @test_img1d(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
136entry:
137  call spir_func void @_Z12write_imagef14ocl_image1d_woiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, <4 x float> noundef zeroinitializer)
138  call spir_func void @_Z12write_imagei14ocl_image1d_woiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, <4 x i32> noundef zeroinitializer)
139  call spir_func void @_Z12write_imagef14ocl_image1d_rwiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2) %image_rw, i32 noundef 0, <4 x float> noundef zeroinitializer)
140  call spir_func void @_Z12write_imagei14ocl_image1d_rwiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2) %image_rw, i32 noundef 0, <4 x i32> noundef zeroinitializer)
141  call spir_func void @_Z12write_imagef14ocl_image1d_woiiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, i32 noundef 0, <4 x float> noundef zeroinitializer)
142  call spir_func void @_Z12write_imagei14ocl_image1d_woiiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, i32 noundef 0, <4 x i32> noundef zeroinitializer)
143  ret void
144}
145
146declare spir_func void @_Z12write_imagef14ocl_image1d_woiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1), i32 noundef, <4 x float> noundef) local_unnamed_addr
147
148declare spir_func void @_Z12write_imagei14ocl_image1d_woiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1), i32 noundef, <4 x i32> noundef) local_unnamed_addr
149
150declare spir_func void @_Z12write_imagef14ocl_image1d_rwiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2), i32 noundef, <4 x float> noundef) local_unnamed_addr
151
152declare spir_func void @_Z12write_imagei14ocl_image1d_rwiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 2), i32 noundef, <4 x i32> noundef) local_unnamed_addr
153
154declare spir_func void @_Z12write_imagef14ocl_image1d_woiiDv4_f(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1), i32 noundef, i32 noundef, <4 x float> noundef) local_unnamed_addr
155
156declare spir_func void @_Z12write_imagei14ocl_image1d_woiiDv4_i(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1), i32 noundef, i32 noundef, <4 x i32> noundef) local_unnamed_addr
157
158;; kernel void test_img1d_buffer(write_only image1d_buffer_t image_wo, read_write image1d_buffer_t image_rw)
159;; {
160;;     write_imagef(image_wo, 0, (float4)(0,0,0,0));
161;;     write_imagei(image_wo, 0, (int4)(0,0,0,0));
162;;     write_imagef(image_rw, 0, (float4)(0,0,0,0));
163;;     write_imagei(image_rw, 0, (int4)(0,0,0,0));
164;; }
165
166; CHECK-SPIRV: %[[#IMG1D_BUFFER_WO:]] = OpFunctionParameter %[[#IMG1D_BUFFER_WO_TY]]
167; CHECK-SPIRV: %[[#IMG1D_BUFFER_RW:]] = OpFunctionParameter %[[#IMG1D_BUFFER_RW_TY]]
168
169; CHECK-SPIRV: OpImageWrite %[[#IMG1D_BUFFER_WO]]
170; CHECK-SPIRV: OpImageWrite %[[#IMG1D_BUFFER_WO]]
171; CHECK-SPIRV: OpImageWrite %[[#IMG1D_BUFFER_RW]]
172; CHECK-SPIRV: OpImageWrite %[[#IMG1D_BUFFER_RW]]
173
174define dso_local spir_kernel void @test_img1d_buffer(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
175entry:
176  call spir_func void @_Z12write_imagef21ocl_image1d_buffer_woiDv4_f(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, <4 x float> noundef zeroinitializer)
177  call spir_func void @_Z12write_imagei21ocl_image1d_buffer_woiDv4_i(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 1) %image_wo, i32 noundef 0, <4 x i32> noundef zeroinitializer)
178  call spir_func void @_Z12write_imagef21ocl_image1d_buffer_rwiDv4_f(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 2) %image_rw, i32 noundef 0, <4 x float> noundef zeroinitializer)
179  call spir_func void @_Z12write_imagei21ocl_image1d_buffer_rwiDv4_i(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 2) %image_rw, i32 noundef 0, <4 x i32> noundef zeroinitializer)
180  ret void
181}
182
183declare spir_func void @_Z12write_imagef21ocl_image1d_buffer_woiDv4_f(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 1), i32 noundef, <4 x float> noundef) local_unnamed_addr
184
185declare spir_func void @_Z12write_imagei21ocl_image1d_buffer_woiDv4_i(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 1), i32 noundef, <4 x i32> noundef) local_unnamed_addr
186
187declare spir_func void @_Z12write_imagef21ocl_image1d_buffer_rwiDv4_f(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 2), i32 noundef, <4 x float> noundef) local_unnamed_addr
188
189declare spir_func void @_Z12write_imagei21ocl_image1d_buffer_rwiDv4_i(target("spirv.Image", void, 5, 0, 0, 0, 0, 0, 2), i32 noundef, <4 x i32> noundef) local_unnamed_addr
190
191;; kernel void test_img1d_array(write_only image1d_array_t image_wo, read_write image1d_array_t image_rw)
192;; {
193;;     write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0));
194;;     write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0));
195;;     write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0));
196;;     write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0));
197;;
198    ;; LOD
199;;     write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0));
200;;     write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0));
201;; }
202
203; CHECK-SPIRV: %[[#IMG1D_ARRAY_WO:]] = OpFunctionParameter %[[#IMG1D_ARRAY_WO_TY]]
204; CHECK-SPIRV: %[[#IMG1D_ARRAY_RW:]] = OpFunctionParameter %[[#IMG1D_ARRAY_RW_TY]]
205
206; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_WO]]
207; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_WO]]
208; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_RW]]
209; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_RW]]
210; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_WO]]
211; CHECK-SPIRV: OpImageWrite %[[#IMG1D_ARRAY_WO]]
212
213define dso_local spir_kernel void @test_img1d_array(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
214entry:
215  call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
216  call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
217  call spir_func void @_Z12write_imagef20ocl_image1d_array_rwDv2_iDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 2) %image_rw, <2 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
218  call spir_func void @_Z12write_imagei20ocl_image1d_array_rwDv2_iDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 2) %image_rw, <2 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
219  call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iiDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, i32 noundef 0, <4 x float> noundef zeroinitializer)
220  call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iiDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, i32 noundef 0, <4 x i32> noundef zeroinitializer)
221  ret void
222}
223
224declare spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1), <2 x i32> noundef, <4 x float> noundef) local_unnamed_addr
225
226declare spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1), <2 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
227
228declare spir_func void @_Z12write_imagef20ocl_image1d_array_rwDv2_iDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 2), <2 x i32> noundef, <4 x float> noundef) local_unnamed_addr
229
230declare spir_func void @_Z12write_imagei20ocl_image1d_array_rwDv2_iDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 2), <2 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
231
232declare spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iiDv4_f(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1), <2 x i32> noundef, i32 noundef, <4 x float> noundef) local_unnamed_addr
233
234declare spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iiDv4_i(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 1), <2 x i32> noundef, i32 noundef, <4 x i32> noundef) local_unnamed_addr
235
236;; kernel void test_img2d_depth(write_only image2d_depth_t image_wo)
237;; {
238;;     write_imagef(image_wo, (int2)(0,0), (float)(0));
239;;     write_imagef(image_wo, (int2)(0,0), (float)(0));
240;;
241    ;; LOD
242;;     write_imagef(image_wo, (int2)(0,0), 0, (float)(0));
243;; }
244
245; CHECK-SPIRV: %[[#IMG2D_DEPTH_WO:]] = OpFunctionParameter %[[#IMG2D_DEPTH_WO_TY]]
246
247; CHECK-SPIRV: OpImageWrite %[[#IMG2D_DEPTH_WO]]
248; CHECK-SPIRV: OpImageWrite %[[#IMG2D_DEPTH_WO]]
249; CHECK-SPIRV: OpImageWrite %[[#IMG2D_DEPTH_WO]]
250
251define dso_local spir_kernel void @test_img2d_depth(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1) %image_wo) local_unnamed_addr {
252entry:
253  call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, float noundef 0.000000e+00)
254  call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, float noundef 0.000000e+00)
255  call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_iif(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1) %image_wo, <2 x i32> noundef zeroinitializer, i32 noundef 0, float noundef 0.000000e+00)
256  ret void
257}
258
259declare spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1), <2 x i32> noundef, float noundef) local_unnamed_addr
260
261declare spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_iif(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 1), <2 x i32> noundef, i32 noundef, float noundef) local_unnamed_addr
262
263;; kernel void test_img2d_array_depth(write_only image2d_array_depth_t image_wo)
264;; {
265;;     write_imagef(image_wo, (int4)(0,0,0,0), (float)(0));
266;;     write_imagef(image_wo, (int4)(0,0,0,0), (float)(0));
267;;
268    ;; LOD
269;;     write_imagef(image_wo, (int4)(0,0,0,0), 0, (float)(0));
270;; }
271
272; CHECK-SPIRV: %[[#IMG2D_ARRAY_DEPTH_WO:]] = OpFunctionParameter %[[#IMG2D_ARRAY_DEPTH_WO_TY]]
273
274; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_DEPTH_WO]]
275; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_DEPTH_WO]]
276; CHECK-SPIRV: OpImageWrite %[[#IMG2D_ARRAY_DEPTH_WO]]
277
278define dso_local spir_kernel void @test_img2d_array_depth(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1) %image_wo) local_unnamed_addr {
279entry:
280  call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, float noundef 0.000000e+00)
281  call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, float noundef 0.000000e+00)
282  call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_iif(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, i32 noundef 0, float noundef 0.000000e+00)
283  ret void
284}
285
286declare spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1), <4 x i32> noundef, float noundef) local_unnamed_addr
287
288declare spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_iif(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 1), <4 x i32> noundef, i32 noundef, float noundef) local_unnamed_addr
289
290;; kernel void test_img3d(write_only image3d_t image_wo, read_write image3d_t image_rw)
291;; {
292;;     write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0));
293;;     write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0));
294;;     write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0));
295;;     write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0));
296;;
297    ;; LOD
298;;     write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0));
299;;     write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0));
300;; }
301
302; CHECK-SPIRV: %[[#IMG3D_WO:]] = OpFunctionParameter %[[#IMG3D_WO_TY]]
303; CHECK-SPIRV: %[[#IMG3D_RW:]] = OpFunctionParameter %[[#IMG3D_RW_TY]]
304
305; CHECK-SPIRV: OpImageWrite %[[#IMG3D_WO]]
306; CHECK-SPIRV: OpImageWrite %[[#IMG3D_WO]]
307; CHECK-SPIRV: OpImageWrite %[[#IMG3D_RW]]
308; CHECK-SPIRV: OpImageWrite %[[#IMG3D_RW]]
309; CHECK-SPIRV: OpImageWrite %[[#IMG3D_WO]]
310; CHECK-SPIRV: OpImageWrite %[[#IMG3D_WO]]
311
312define dso_local spir_kernel void @test_img3d(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1) %image_wo, target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 2) %image_rw) local_unnamed_addr {
313entry:
314  call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
315  call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
316  call spir_func void @_Z12write_imagef14ocl_image3d_rwDv4_iDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 2) %image_rw, <4 x i32> noundef zeroinitializer, <4 x float> noundef zeroinitializer)
317  call spir_func void @_Z12write_imagei14ocl_image3d_rwDv4_iS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 2) %image_rw, <4 x i32> noundef zeroinitializer, <4 x i32> noundef zeroinitializer)
318  call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iiDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, i32 noundef 0, <4 x float> noundef zeroinitializer)
319  call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iiS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1) %image_wo, <4 x i32> noundef zeroinitializer, i32 noundef 0, <4 x i32> noundef zeroinitializer)
320  ret void
321}
322
323declare spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1), <4 x i32> noundef, <4 x float> noundef) local_unnamed_addr
324
325declare spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1), <4 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
326
327declare spir_func void @_Z12write_imagef14ocl_image3d_rwDv4_iDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 2), <4 x i32> noundef, <4 x float> noundef) local_unnamed_addr
328
329declare spir_func void @_Z12write_imagei14ocl_image3d_rwDv4_iS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 2), <4 x i32> noundef, <4 x i32> noundef) local_unnamed_addr
330
331declare spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iiDv4_f(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1), <4 x i32> noundef, i32 noundef, <4 x float> noundef) local_unnamed_addr
332
333declare spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iiS0_(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 1), <4 x i32> noundef, i32 noundef, <4 x i32> noundef) local_unnamed_addr
334