Debian Codegraph @

llvm/test/CodeGen/SPIRV/image_store.ll

raw
1 ; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2 ; 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 one
10 ; SPIR-V type for images is generated (no duplicate OpTypeImage instructions).
11
12 ; CHECK: %[[#]] = OpTypeImage %[[#]] 2D
13 ; CHECK-NOT: %[[#]] = OpTypeImage %[[#]] 2D
14
15 declare spir_func <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_ff(ptr addrspace(1), ptr addrspace(2), <2 x float>, float)
16
17 define spir_kernel void @read_image(ptr addrspace(1) %srcimg, ptr addrspace(2) %sampler){
18 entry:
19 %spirvimg.addr = alloca target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0), align 8
20 %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 void
22 }