23 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4; Image types may be represented in two ways while translating to SPIR-V:5; - OpenCL form, for example, '%opencl.image2d_ro_t',6; - SPIR-V form, for example, '%spirv.Image._void_1_0_0_0_0_0_0',7; but it is still one type which should be translated to one SPIR-V type.8;9; The test checks that the code below is successfully translated and only one10; SPIR-V type for images is generated (no duplicate OpTypeImage instructions).11 12; CHECK: %[[#]] = OpTypeImage %[[#]] 2D13; CHECK-NOT: %[[#]] = OpTypeImage %[[#]] 2D14 15declare spir_func <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_ff(ptr addrspace(1), ptr addrspace(2), <2 x float>, float)16 17define spir_kernel void @read_image(ptr addrspace(1) %srcimg, ptr addrspace(2) %sampler){18entry:19 %spirvimg.addr = alloca target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0), align 820 %val = call <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_ff(ptr addrspace(1) %srcimg, ptr addrspace(2) %sampler, <2 x float> zeroinitializer, float 0.0)21 ret void22}23