| 1 |
// RUN: %clang_cc1 -O1 -triple spir-unknown-unknown -cl-std=CL2.0 %s -finclude-default-header -emit-llvm-bc -o %t.bc -no-opaque-pointers |
| 2 |
// RUN: llvm-spirv %t.bc -opaque-pointers=0 -spirv-text -o %t.txt |
| 3 |
// RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV |
| 4 |
// RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv |
| 5 |
// RUN: spirv-val %t.spv |
| 6 |
// RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 |
// RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 8 |
|
| 9 |
void __kernel sample_kernel_read( __global float4 *results, |
| 10 |
read_only image2d_t image, |
| 11 |
sampler_t imageSampler, |
| 12 |
float2 coord, |
| 13 |
float2 dx, |
| 14 |
float2 dy) |
| 15 |
{ |
| 16 |
*results = read_imagef( image, imageSampler, coord); |
| 17 |
*results = read_imagef( image, imageSampler, coord, 3.14f); |
| 18 |
*results = read_imagef( image, imageSampler, coord, dx, dy); |
| 19 |
} |
| 20 |
|
| 21 |
// CHECK-SPIRV: TypeFloat [[float:[0-9]+]] 32 |
| 22 |
// CHECK-SPIRV: Constant [[float]] [[lodNull:[0-9]+]] 0 |
| 23 |
// CHECK-SPIRV: Constant [[float]] [[lod:[0-9]+]] 1078523331 |
| 24 |
// CHECK-SPIRV: FunctionParameter |
| 25 |
// CHECK-SPIRV: FunctionParameter |
| 26 |
// CHECK-SPIRV: FunctionParameter |
| 27 |
// CHECK-SPIRV: FunctionParameter |
| 28 |
// CHECK-SPIRV: FunctionParameter {{[0-9]+}} [[dx:[0-9]+]] |
| 29 |
// CHECK-SPIRV: FunctionParameter {{[0-9]+}} [[dy:[0-9]+]] |
| 30 |
|
| 31 |
// CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 2 [[lodNull]] |
| 32 |
// CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 2 [[lod]] |
| 33 |
// CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 4 [[dx]] [[dy]] |
| 34 |
|
| 35 |
// CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_f(%opencl.image2d_ro_t addrspace(1)* %image, %opencl.sampler_t addrspace(2)* %imageSampler, <2 x float> %coord) |
| 36 |
// CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_ff(%opencl.image2d_ro_t addrspace(1)* %image, %opencl.sampler_t addrspace(2)* %imageSampler, <2 x float> %coord, float 0x40091EB860000000) |
| 37 |
// CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef14ocl_image2d_ro11ocl_samplerDv2_fS1_S1_(%opencl.image2d_ro_t addrspace(1)* %image, %opencl.sampler_t addrspace(2)* %imageSampler, <2 x float> %coord, <2 x float> %dx, <2 x float> %dy) |