| 1 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 2 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 3 |
|
| 4 |
; CHECK-SPIRV-DAG: %[[#RetID:]] = OpImageSampleExplicitLod %[[#RetType:]] %[[#]] %[[#]] Lod %[[#]] |
| 5 |
; CHECK-SPIRV-DAG: %[[#RetType]] = OpTypeVector %[[#]] 4 |
| 6 |
; CHECK-SPIRV: %[[#]] = OpCompositeExtract %[[#]] %[[#RetID]] 0 |
| 7 |
|
| 8 |
define spir_kernel void @sample_kernel(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %input, i32 %imageSampler, ptr addrspace(1) %xOffsets, ptr addrspace(1) %yOffsets, ptr addrspace(1) %results) { |
| 9 |
entry: |
| 10 |
%call = call spir_func i32 @_Z13get_global_idj(i32 0) |
| 11 |
%call1 = call spir_func i32 @_Z13get_global_idj(i32 1) |
| 12 |
%call2.tmp1 = call spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_depth_ro(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %input) |
| 13 |
%call2.old = extractelement <2 x i32> %call2.tmp1, i32 0 |
| 14 |
%mul = mul i32 %call1, %call2.old |
| 15 |
%add = add i32 %mul, %call |
| 16 |
%arrayidx = getelementptr inbounds float, ptr addrspace(1) %xOffsets, i32 %add |
| 17 |
%0 = load float, ptr addrspace(1) %arrayidx, align 4 |
| 18 |
%conv = fptosi float %0 to i32 |
| 19 |
%vecinit = insertelement <2 x i32> undef, i32 %conv, i32 0 |
| 20 |
%arrayidx3 = getelementptr inbounds float, ptr addrspace(1) %yOffsets, i32 %add |
| 21 |
%1 = load float, ptr addrspace(1) %arrayidx3, align 4 |
| 22 |
%conv4 = fptosi float %1 to i32 |
| 23 |
%vecinit5 = insertelement <2 x i32> %vecinit, i32 %conv4, i32 1 |
| 24 |
%call6.tmp.tmp = call spir_func float @_Z11read_imagef20ocl_image2d_depth_ro11ocl_samplerDv2_i(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %input, i32 %imageSampler, <2 x i32> %vecinit5) |
| 25 |
%arrayidx7 = getelementptr inbounds float, ptr addrspace(1) %results, i32 %add |
| 26 |
store float %call6.tmp.tmp, ptr addrspace(1) %arrayidx7, align 4 |
| 27 |
ret void |
| 28 |
} |
| 29 |
|
| 30 |
declare spir_func float @_Z11read_imagef20ocl_image2d_depth_ro11ocl_samplerDv2_i(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0), i32, <2 x i32>) |
| 31 |
|
| 32 |
declare spir_func i32 @_Z13get_global_idj(i32) |
| 33 |
|
| 34 |
declare spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_depth_ro(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0)) |