1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ; CHECK-SPIRV: OpCapability StorageImageReadWithoutFormat
5 ; CHECK-SPIRV: %[[#IntTy:]] = OpTypeInt
6 ; CHECK-SPIRV: %[[#IVecTy:]] = OpTypeVector %[[#IntTy]]
7 ; CHECK-SPIRV: %[[#FloatTy:]] = OpTypeFloat
8 ; CHECK-SPIRV: %[[#FVecTy:]] = OpTypeVector %[[#FloatTy]]
9 ; CHECK-SPIRV: OpImageRead %[[#IVecTy]]
10 ; CHECK-SPIRV: OpImageRead %[[#FVecTy]]
12 ;; __kernel void kernelA(__read_only image3d_t input) {
13 ;; uint4 c = read_imageui(input, (int4)(0, 0, 0, 0));
16 ;; __kernel void kernelB(__read_only image3d_t input) {
17 ;; float4 f = read_imagef(input, (int4)(0, 0, 0, 0));
20 define dso_local spir_kernel void @kernelA(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %input) {
22 %input.addr = alloca target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), align 8
23 %c = alloca <4 x i32>, align 16
24 %.compoundliteral = alloca <4 x i32>, align 16
25 store target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %input, ptr %input.addr, align 8
26 %0 = load target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), ptr %input.addr, align 8
27 store <4 x i32> zeroinitializer, ptr %.compoundliteral, align 16
28 %1 = load <4 x i32>, ptr %.compoundliteral, align 16
29 %call = call spir_func <4 x i32> @_Z12read_imageui14ocl_image3d_roDv4_i(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %0, <4 x i32> noundef %1)
30 store <4 x i32> %call, ptr %c, align 16
34 declare spir_func <4 x i32> @_Z12read_imageui14ocl_image3d_roDv4_i(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %0, <4 x i32> noundef %1)
36 define dso_local spir_kernel void @kernelB(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %input) {
38 %input.addr = alloca target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), align 8
39 %f = alloca <4 x float>, align 16
40 %.compoundliteral = alloca <4 x i32>, align 16
41 store target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %input, ptr %input.addr, align 8
42 %0 = load target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), ptr %input.addr, align 8
43 store <4 x i32> zeroinitializer, ptr %.compoundliteral, align 16
44 %1 = load <4 x i32>, ptr %.compoundliteral, align 16
45 %call = call spir_func <4 x float> @_Z11read_imagef14ocl_image3d_roDv4_i(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %0, <4 x i32> noundef %1)
46 store <4 x float> %call, ptr %f, align 16
50 declare spir_func <4 x float> @_Z11read_imagef14ocl_image3d_roDv4_i(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %0, <4 x i32> noundef %1)