| 1 |
// RUN: %clang_cc1 -triple spir64 -fdeclare-opencl-builtins -finclude-default-header -O0 -cl-std=CL2.0 -emit-llvm-bc %s -o %t.bc |
| 2 |
// RUN: llvm-spirv --spirv-max-version=1.3 %t.bc -o %t.spv |
| 3 |
// RUN: spirv-val %t.spv |
| 4 |
// RUN: llvm-spirv %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 5 |
// RUN: llvm-spirv -r %t.spv -o %t.rev.bc --spirv-target-env=SPV-IR |
| 6 |
// RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-LLVM |
| 7 |
// RUN: llvm-spirv --spirv-max-version=1.3 %t.rev.bc -o %t.rev.spv |
| 8 |
// RUN: spirv-val %t.rev.spv |
| 9 |
// RUN: llvm-spirv --spirv-max-version=1.3 %t.rev.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 10 |
|
| 11 |
// CHECK-SPIRV: TypeInt [[IntTy:[0-9]+]] 32 |
| 12 |
// CHECK-SPIRV: TypeVector [[IVecTy:[0-9]+]] [[IntTy]] |
| 13 |
// CHECK-SPIRV: TypeFloat [[FloatTy:[0-9]+]] |
| 14 |
// CHECK-SPIRV: TypeVector [[FVecTy:[0-9]+]] [[FloatTy]] |
| 15 |
// CHECK-SPIRV: ImageRead [[IVecTy]] |
| 16 |
// CHECK-SPIRV: ImageRead [[FVecTy]] |
| 17 |
|
| 18 |
// CHECK-SPV-LLVM: call spir_func <4 x i32> @_Z23__spirv_ImageRead_Rint4PU3AS133__spirv_Image__void_2_0_0_0_0_0_0Dv4_i(%spirv.Image._void_2_0_0_0_0_0_0 addrspace(1)* |
| 19 |
// CHECK-SPV-LLVM: call spir_func <4 x float> @_Z25__spirv_ImageRead_Rfloat4PU3AS133__spirv_Image__void_2_0_0_0_0_0_0Dv4_i(%spirv.Image._void_2_0_0_0_0_0_0 addrspace(1)* |
| 20 |
|
| 21 |
__kernel void kernelA(__read_only image3d_t input) { |
| 22 |
uint4 c = read_imageui(input, (int4)(0, 0, 0, 0)); |
| 23 |
} |
| 24 |
|
| 25 |
__kernel void kernelB(__read_only image3d_t input) { |
| 26 |
float4 f = read_imagef(input, (int4)(0, 0, 0, 0)); |
| 27 |
} |