diff --git a/test/complex-constexpr.ll b/test/complex-constexpr.ll index 1b5351c0ad..a12a9622be 100644 --- a/test/complex-constexpr.ll +++ b/test/complex-constexpr.ll @@ -10,6 +10,12 @@ target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" target triple = "spir64" +; CHECK-SPIRV: TypeInt [[Int_Ty:[0-9]+]] 8 0 +; CHECK-SPIRV: TypeVoid [[Void_Ty:[0-9]+]] +; CHECK-SPIRV: TypeFunction [[Func_Ty1:[0-9]+]] [[Void_Ty]] +; CHECK-SPIRV: TypePointer [[Ptr_Ty:[0-9]+]] 8 [[Int_Ty]] +; CHECK-SPIRV: TypeFunction [[Func_Ty2:[0-9]+]] [[Void_Ty]] [[Ptr_Ty]] [[Ptr_Ty]] + @.str.1 = private unnamed_addr addrspace(1) constant [1 x i8] zeroinitializer, align 1 define linkonce_odr hidden spir_func void @foo() { @@ -22,7 +28,7 @@ entry: ; CHECK-SPIRV: IEqual {{[0-9]+}} [[IEq:[0-9]+]] [[PtrToU1]] [[PtrToU2]] ; CHECK-SPIRV: ConvertUToPtr {{[0-9]+}} [[UToPtr:[0-9]+]] ; CHECK-SPIRV: Select {{[0-9]+}} [[Sel:[0-9]+]] [[IEq]] [[UToPtr]] [[Gep1]] -; CHECK-SPIRV: FunctionCall 9 31 28 [[Gep]] [[Sel]] +; CHECK-SPIRV: FunctionCall [[Void_Ty]] {{[0-9]+}} [[Func:[0-9]+]] [[Gep]] [[Sel]] ; CHECK-LLVM: %[[Cast:[0-9]+]] = addrspacecast [1 x i8] addrspace(1)* @.str.1 to [1 x i8] addrspace(4)* ; CHECK-LLVM: %[[Gep:[0-9]+]] = getelementptr inbounds [1 x i8], [1 x i8] addrspace(4)* %0, i64 0, i64 0 ; CHECK-LLVM: %[[Gep1:[0-9]+]] = getelementptr inbounds [1 x i8], [1 x i8] addrspace(4)* %0, i64 0, i64 0 @@ -36,6 +42,8 @@ entry: ret void } +; CHECK-SPIRV: Function [[Void_Ty]] [[Func]] 0 [[Func_Ty2]] + define linkonce_odr hidden spir_func void @bar(i8 addrspace(4)* %__beg, i8 addrspace(4)* %__end) { entry: ret void diff --git a/test/image.ll b/test/image.ll index cf33f1e571..581232dc50 100644 --- a/test/image.ll +++ b/test/image.ll @@ -8,9 +8,10 @@ ; RUN: llvm-spirv %t.rev.bc -o %t.rev.spv ; RUN: spirv-val %t.rev.spv -; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} 6 1 0 0 0 0 0 0 -; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} 6 1 0 0 0 0 0 1 -; CHECK-SPIRV-NOT: 10 TypeImage {{[0-9]*}} 6 1 0 0 0 0 0 0 +; CHECK-SPIRV: 2 TypeVoid [[VOID_TY:[0-9]+]] +; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 0 +; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 1 +; CHECK-SPIRV-NOT: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 0 ; CHECK-SPIRV: ImageSampleExplicitLod ; CHECK-SPIRV: ImageWrite diff --git a/test/llvm-intrinsics/ceil.ll b/test/llvm-intrinsics/ceil.ll index 6bad58ab28..f0303abbc6 100644 --- a/test/llvm-intrinsics/ceil.ll +++ b/test/llvm-intrinsics/ceil.ll @@ -10,7 +10,7 @@ target triple = "spir64-unknown-unknown" ; CHECK: 3 TypeFloat [[var1:[0-9]+]] 32 ; CHECK: 3 TypeFloat [[var2:[0-9]+]] 64 -; CHECK: 4 TypeVector [[var3:[0-9]+]] 2 4 +; CHECK: 4 TypeVector [[var3:[0-9]+]] [[var1]] 4 ; CHECK: Function ; CHECK: 6 ExtInst [[var1]] {{[0-9]+}} [[extinst_id]] ceil diff --git a/test/transcoding/OpImageWrite.cl b/test/transcoding/OpImageWrite.cl index 6e77b4f8e1..90ba4cbcc3 100644 --- a/test/transcoding/OpImageWrite.cl +++ b/test/transcoding/OpImageWrite.cl @@ -1,275 +1,276 @@ -// RUN: %clang_cc1 -O1 -triple spir-unknown-unknown -cl-std=CL2.0 %s -finclude-default-header -emit-llvm-bc -o %t.bc -// RUN: llvm-spirv %t.bc -spirv-text -o %t.txt -// RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV -// RUN: llvm-spirv %t.bc -o %t.spv -// RUN: llvm-spirv -r %t.spv -o %t.rev.bc -// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM -// RUN: llvm-spirv -r %t.spv -o %t.rev.bc --spirv-target-env=SPV-IR -// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR - -// CHECK-SPIRV: TypeImage [[IMG2D_WO_TY:[0-9]+]] 2 1 0 0 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG2D_RW_TY:[0-9]+]] 2 1 0 0 0 0 0 2 -// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_WO_TY:[0-9]+]] 2 1 0 1 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_RW_TY:[0-9]+]] 2 1 0 1 0 0 0 2 -// CHECK-SPIRV: TypeImage [[IMG1D_WO_TY:[0-9]+]] 2 0 0 0 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG1D_RW_TY:[0-9]+]] 2 0 0 0 0 0 0 2 -// CHECK-SPIRV: TypeImage [[IMG1D_BUFFER_WO_TY:[0-9]+]] 2 5 0 0 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG1D_BUFFER_RW_TY:[0-9]+]] 2 5 0 0 0 0 0 2 -// CHECK-SPIRV: TypeImage [[IMG1D_ARRAY_WO_TY:[0-9]+]] 2 0 0 1 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG1D_ARRAY_RW_TY:[0-9]+]] 2 0 0 1 0 0 0 2 -// CHECK-SPIRV: TypeImage [[IMG2D_DEPTH_WO_TY:[0-9]+]] 2 1 1 0 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_DEPTH_WO_TY:[0-9]+]] 2 1 1 1 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG3D_WO_TY:[0-9]+]] 2 2 0 0 0 0 0 1 -// CHECK-SPIRV: TypeImage [[IMG3D_RW_TY:[0-9]+]] 2 2 0 0 0 0 0 2 - -kernel void test_img2d(write_only image2d_t image_wo, read_write image2d_t image_rw) -{ - write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0)); - write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0)); - write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0)); - write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0)); - - // LOD - write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0)); - write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG2D_WO_TY]] [[IMG2D_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG2D_RW_TY]] [[IMG2D_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG2D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_rwDv2_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_rwDv2_iDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iiDv4_i - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_2Dv2_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_2Dv2_iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_fii -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_iii - -kernel void test_img2d_array(write_only image2d_array_t image_wo, read_write image2d_array_t image_rw) -{ - write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0)); - write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0)); - write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0)); - write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0)); - - // LOD - write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0)); - write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_WO_TY]] [[IMG2D_ARRAY_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_RW_TY]] [[IMG2D_ARRAY_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_RW]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_RW]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iS0_ -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_rwDv4_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_rwDv4_iS0_ -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iiS0_ - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iS2_ -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_2Dv4_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_2Dv4_iS2_ -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iDv4_fii -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iS2_ii - -kernel void test_img1d(write_only image1d_t image_wo, read_write image1d_t image_rw) -{ - write_imagef(image_wo, 0, (float4)(0,0,0,0)); - write_imagei(image_wo, 0, (int4)(0,0,0,0)); - write_imagef(image_rw, 0, (float4)(0,0,0,0)); - write_imagei(image_rw, 0, (int4)(0,0,0,0)); - - // LOD - write_imagef(image_wo, 0, 0, (float4)(0,0,0,0)); - write_imagei(image_wo, 0, 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG1D_WO_TY]] [[IMG1D_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG1D_RW_TY]] [[IMG1D_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG1D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_woiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_woiDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_rwiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_rwiDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_woiiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_woiiDv4_i - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_2iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_2iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_fii -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_iii - -kernel void test_img1d_buffer(write_only image1d_buffer_t image_wo, read_write image1d_buffer_t image_rw) -{ - write_imagef(image_wo, 0, (float4)(0,0,0,0)); - write_imagei(image_wo, 0, (int4)(0,0,0,0)); - write_imagef(image_rw, 0, (float4)(0,0,0,0)); - write_imagei(image_rw, 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG1D_BUFFER_WO_TY]] [[IMG1D_BUFFER_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG1D_BUFFER_RW_TY]] [[IMG1D_BUFFER_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_RW]] -// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_RW]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef21ocl_image1d_buffer_woiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei21ocl_image1d_buffer_woiDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef21ocl_image1d_buffer_rwiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei21ocl_image1d_buffer_rwiDv4_i - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_1iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_1iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_2iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_2iDv4_i - -kernel void test_img1d_array(write_only image1d_array_t image_wo, read_write image1d_array_t image_rw) -{ - write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0)); - write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0)); - write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0)); - write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0)); - - // LOD - write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0)); - write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG1D_ARRAY_WO_TY]] [[IMG1D_ARRAY_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG1D_ARRAY_RW_TY]] [[IMG1D_ARRAY_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_RW]] -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_RW]] -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] -// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_rwDv2_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_rwDv2_iDv4_i -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iiDv4_i - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_2Dv2_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_2Dv2_iDv4_i -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_fii -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_iii - -kernel void test_img2d_depth(write_only image2d_depth_t image_wo) -{ - write_imagef(image_wo, (int2)(0,0), (float)(0)); - write_imagef(image_wo, (int2)(0,0), (float)(0)); - - // LOD - write_imagef(image_wo, (int2)(0,0), 0, (float)(0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG2D_DEPTH_WO_TY]] [[IMG2D_DEPTH_WO:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if -// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_iif - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_if -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_if -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_ifii - -kernel void test_img2d_array_depth(write_only image2d_array_depth_t image_wo) -{ - write_imagef(image_wo, (int4)(0,0,0,0), (float)(0)); - write_imagef(image_wo, (int4)(0,0,0,0), (float)(0)); - - // LOD - write_imagef(image_wo, (int4)(0,0,0,0), 0, (float)(0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_DEPTH_WO_TY]] [[IMG2D_ARRAY_DEPTH_WO:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] -// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if -// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if -// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_iif - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_if -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_if -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_ifii - -kernel void test_img3d(write_only image3d_t image_wo, read_write image3d_t image_rw) -{ - write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0)); - write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0)); - write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0)); - write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0)); - - // LOD - write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0)); - write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0)); -} - -// CHECK-SPIRV: FunctionParameter [[IMG3D_WO_TY]] [[IMG3D_WO:[0-9]+]] -// CHECK-SPIRV: FunctionParameter [[IMG3D_RW_TY]] [[IMG3D_RW:[0-9]+]] - -// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG3D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG3D_RW]] -// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] -// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] - -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iS0_ -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_rwDv4_iDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_rwDv4_iS0_ -// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iiDv4_f -// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iiS0_ - -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_ -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_2Dv4_iDv4_f -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_2Dv4_iS2_ -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iDv4_fii -// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_ii +// RUN: %clang_cc1 -O1 -triple spir-unknown-unknown -cl-std=CL2.0 %s -finclude-default-header -emit-llvm-bc -o %t.bc +// RUN: llvm-spirv %t.bc -spirv-text -o %t.txt +// RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV +// RUN: llvm-spirv %t.bc -o %t.spv +// RUN: llvm-spirv -r %t.spv -o %t.rev.bc +// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM +// RUN: llvm-spirv -r %t.spv -o %t.rev.bc --spirv-target-env=SPV-IR +// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR + +// CHECK-SPIRV: TypeVoid [[VOID_TY:[0-9]+]] +// CHECK-SPIRV: TypeImage [[IMG2D_WO_TY:[0-9]+]] [[VOID_TY]] 1 0 0 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG2D_RW_TY:[0-9]+]] [[VOID_TY]] 1 0 0 0 0 0 2 +// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_WO_TY:[0-9]+]] [[VOID_TY]] 1 0 1 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_RW_TY:[0-9]+]] [[VOID_TY]] 1 0 1 0 0 0 2 +// CHECK-SPIRV: TypeImage [[IMG1D_WO_TY:[0-9]+]] [[VOID_TY]] 0 0 0 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG1D_RW_TY:[0-9]+]] [[VOID_TY]] 0 0 0 0 0 0 2 +// CHECK-SPIRV: TypeImage [[IMG1D_BUFFER_WO_TY:[0-9]+]] [[VOID_TY]] 5 0 0 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG1D_BUFFER_RW_TY:[0-9]+]] [[VOID_TY]] 5 0 0 0 0 0 2 +// CHECK-SPIRV: TypeImage [[IMG1D_ARRAY_WO_TY:[0-9]+]] [[VOID_TY]] 0 0 1 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG1D_ARRAY_RW_TY:[0-9]+]] [[VOID_TY]] 0 0 1 0 0 0 2 +// CHECK-SPIRV: TypeImage [[IMG2D_DEPTH_WO_TY:[0-9]+]] [[VOID_TY]] 1 1 0 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG2D_ARRAY_DEPTH_WO_TY:[0-9]+]] [[VOID_TY]] 1 1 1 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG3D_WO_TY:[0-9]+]] [[VOID_TY]] 2 0 0 0 0 0 1 +// CHECK-SPIRV: TypeImage [[IMG3D_RW_TY:[0-9]+]] [[VOID_TY]] 2 0 0 0 0 0 2 + +kernel void test_img2d(write_only image2d_t image_wo, read_write image2d_t image_rw) +{ + write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0)); + write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0)); + write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0)); + write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0)); + + // LOD + write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0)); + write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG2D_WO_TY]] [[IMG2D_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG2D_RW_TY]] [[IMG2D_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG2D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_rwDv2_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_rwDv2_iDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image2d_woDv2_iiDv4_i + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_2Dv2_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_2Dv2_iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_fii +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_iii + +kernel void test_img2d_array(write_only image2d_array_t image_wo, read_write image2d_array_t image_rw) +{ + write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0)); + write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0)); + write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0)); + write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0)); + + // LOD + write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0)); + write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_WO_TY]] [[IMG2D_ARRAY_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_RW_TY]] [[IMG2D_ARRAY_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_RW]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_RW]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iS0_ +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_rwDv4_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_rwDv4_iS0_ +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_array_woDv4_iiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image2d_array_woDv4_iiS0_ + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iS2_ +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_2Dv4_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_2Dv4_iS2_ +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iDv4_fii +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_1_0_0_0_1Dv4_iS2_ii + +kernel void test_img1d(write_only image1d_t image_wo, read_write image1d_t image_rw) +{ + write_imagef(image_wo, 0, (float4)(0,0,0,0)); + write_imagei(image_wo, 0, (int4)(0,0,0,0)); + write_imagef(image_rw, 0, (float4)(0,0,0,0)); + write_imagei(image_rw, 0, (int4)(0,0,0,0)); + + // LOD + write_imagef(image_wo, 0, 0, (float4)(0,0,0,0)); + write_imagei(image_wo, 0, 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG1D_WO_TY]] [[IMG1D_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG1D_RW_TY]] [[IMG1D_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG1D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_woiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_woiDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_rwiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_rwiDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image1d_woiiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image1d_woiiDv4_i + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_2iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_2iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_fii +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_0_0_0_0_1iDv4_iii + +kernel void test_img1d_buffer(write_only image1d_buffer_t image_wo, read_write image1d_buffer_t image_rw) +{ + write_imagef(image_wo, 0, (float4)(0,0,0,0)); + write_imagei(image_wo, 0, (int4)(0,0,0,0)); + write_imagef(image_rw, 0, (float4)(0,0,0,0)); + write_imagei(image_rw, 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG1D_BUFFER_WO_TY]] [[IMG1D_BUFFER_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG1D_BUFFER_RW_TY]] [[IMG1D_BUFFER_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_RW]] +// CHECK-SPIRV: ImageWrite [[IMG1D_BUFFER_RW]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef21ocl_image1d_buffer_woiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei21ocl_image1d_buffer_woiDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef21ocl_image1d_buffer_rwiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei21ocl_image1d_buffer_rwiDv4_i + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_1iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_1iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_2iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_5_0_0_0_0_0_2iDv4_i + +kernel void test_img1d_array(write_only image1d_array_t image_wo, read_write image1d_array_t image_rw) +{ + write_imagef(image_wo, (int2)(0,0), (float4)(0,0,0,0)); + write_imagei(image_wo, (int2)(0,0), (int4)(0,0,0,0)); + write_imagef(image_rw, (int2)(0,0), (float4)(0,0,0,0)); + write_imagei(image_rw, (int2)(0,0), (int4)(0,0,0,0)); + + // LOD + write_imagef(image_wo, (int2)(0,0), 0, (float4)(0,0,0,0)); + write_imagei(image_wo, (int2)(0,0), 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG1D_ARRAY_WO_TY]] [[IMG1D_ARRAY_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG1D_ARRAY_RW_TY]] [[IMG1D_ARRAY_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_RW]] +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_RW]] +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] +// CHECK-SPIRV: ImageWrite [[IMG1D_ARRAY_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_rwDv2_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_rwDv2_iDv4_i +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image1d_array_woDv2_iiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei20ocl_image1d_array_woDv2_iiDv4_i + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_2Dv2_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_2Dv2_iDv4_i +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_fii +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_0_0_1_0_0_0_1Dv2_iDv4_iii + +kernel void test_img2d_depth(write_only image2d_depth_t image_wo) +{ + write_imagef(image_wo, (int2)(0,0), (float)(0)); + write_imagef(image_wo, (int2)(0,0), (float)(0)); + + // LOD + write_imagef(image_wo, (int2)(0,0), 0, (float)(0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG2D_DEPTH_WO_TY]] [[IMG2D_DEPTH_WO:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_DEPTH_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_if +// CHECK-LLVM: call spir_func void @_Z12write_imagef20ocl_image2d_depth_woDv2_iif + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_if +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_if +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_0_0_0_0_1Dv2_ifii + +kernel void test_img2d_array_depth(write_only image2d_array_depth_t image_wo) +{ + write_imagef(image_wo, (int4)(0,0,0,0), (float)(0)); + write_imagef(image_wo, (int4)(0,0,0,0), (float)(0)); + + // LOD + write_imagef(image_wo, (int4)(0,0,0,0), 0, (float)(0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG2D_ARRAY_DEPTH_WO_TY]] [[IMG2D_ARRAY_DEPTH_WO:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] +// CHECK-SPIRV: ImageWrite [[IMG2D_ARRAY_DEPTH_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if +// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_if +// CHECK-LLVM: call spir_func void @_Z12write_imagef26ocl_image2d_array_depth_woDv4_iif + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_if +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_if +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_1_1_0_0_0_1Dv4_ifii + +kernel void test_img3d(write_only image3d_t image_wo, read_write image3d_t image_rw) +{ + write_imagef(image_wo, (int4)(0,0,0,0), (float4)(0,0,0,0)); + write_imagei(image_wo, (int4)(0,0,0,0), (int4)(0,0,0,0)); + write_imagef(image_rw, (int4)(0,0,0,0), (float4)(0,0,0,0)); + write_imagei(image_rw, (int4)(0,0,0,0), (int4)(0,0,0,0)); + + // LOD + write_imagef(image_wo, (int4)(0,0,0,0), 0, (float4)(0,0,0,0)); + write_imagei(image_wo, (int4)(0,0,0,0), 0, (int4)(0,0,0,0)); +} + +// CHECK-SPIRV: FunctionParameter [[IMG3D_WO_TY]] [[IMG3D_WO:[0-9]+]] +// CHECK-SPIRV: FunctionParameter [[IMG3D_RW_TY]] [[IMG3D_RW:[0-9]+]] + +// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG3D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG3D_RW]] +// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] +// CHECK-SPIRV: ImageWrite [[IMG3D_WO]] + +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iS0_ +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_rwDv4_iDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_rwDv4_iS0_ +// CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image3d_woDv4_iiDv4_f +// CHECK-LLVM: call spir_func void @_Z12write_imagei14ocl_image3d_woDv4_iiS0_ + +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_ +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_2Dv4_iDv4_f +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_2Dv4_iS2_ +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iDv4_fii +// CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_2_0_0_0_0_0_1Dv4_iS2_ii diff --git a/test/transcoding/OpMin.ll b/test/transcoding/OpMin.ll index 342bcdba9b..2185eef1d5 100644 --- a/test/transcoding/OpMin.ll +++ b/test/transcoding/OpMin.ll @@ -6,11 +6,12 @@ ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM +; CHECK-SPIRV: 5 ExtInstImport [[SetInstID:[0-9]+]] "OpenCL.std" ; CHECK-SPIRV: 4 TypeInt [[IntTypeID:[0-9]+]] 32 {{[0-9]+}} ; CHECK-SPIRV: 4 TypeVector [[Int2TypeID:[0-9]+]] [[IntTypeID]] 2 ; CHECK-SPIRV: 6 CompositeInsert [[Int2TypeID]] [[CompositeID:[0-9]+]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} ; CHECK-SPIRV: 7 VectorShuffle [[Int2TypeID]] [[ShuffleID:[0-9]+]] [[CompositeID]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} -; CHECK-SPIRV: 7 ExtInst [[Int2TypeID]] {{[0-9]+}} 1 s_min {{[0-9]+}} [[ShuffleID]] +; CHECK-SPIRV: 7 ExtInst [[Int2TypeID]] {{[0-9]+}} [[SetInstID]] s_min {{[0-9]+}} [[ShuffleID]] ; CHECK-LLVM: call spir_func <2 x i32> @_Z3minDv2_iS_( diff --git a/test/transcoding/OpVariable_Initializer.ll b/test/transcoding/OpVariable_Initializer.ll index 717332648c..a84a41e94e 100644 --- a/test/transcoding/OpVariable_Initializer.ll +++ b/test/transcoding/OpVariable_Initializer.ll @@ -9,7 +9,8 @@ ; CHECK-LLVM: @test_atomic_fn.L = internal addrspace(3) global [64 x i32] undef, align 4 ; CHECK-SPIRV-NOT: undef -; CHECK-SPIRV: 4 Variable 5 6 4 +; CHECK-SPIRV: 4 TypePointer [[PtrT:[0-9]+]] 4 +; CHECK-SPIRV: 4 Variable [[PtrT]] {{[0-9]+}} 4 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" target triple = "spir-unknown-unknown" diff --git a/test/transcoding/get_image_num_mip_levels.ll b/test/transcoding/get_image_num_mip_levels.ll index 04bbe478e1..d44a042a48 100644 --- a/test/transcoding/get_image_num_mip_levels.ll +++ b/test/transcoding/get_image_num_mip_levels.ll @@ -39,13 +39,14 @@ target triple = "spir-unknown-unknown" %opencl.image2d_array_depth_ro_t = type opaque ; CHECK-SPIRV: TypeInt [[INT:[0-9]+]] 32 -; CHECK-SPIRV: TypeImage [[IMAGE1D_T:[0-9]+]] 2 0 0 0 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE2D_T:[0-9]+]] 2 1 0 0 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE3D_T:[0-9]+]] 2 2 0 0 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE1D_ARRAY_T:[0-9]+]] 2 0 0 1 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_T:[0-9]+]] 2 1 0 1 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE2D_DEPTH_T:[0-9]+]] 2 1 1 0 0 0 0 0 -; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_DEPTH_T:[0-9]+]] 2 1 1 1 0 0 0 0 +; CHECK-SPIRV: TypeVoid [[VOID:[0-9]+]] +; CHECK-SPIRV: TypeImage [[IMAGE1D_T:[0-9]+]] [[VOID]] 0 0 0 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE2D_T:[0-9]+]] [[VOID]] 1 0 0 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE3D_T:[0-9]+]] [[VOID]] 2 0 0 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE1D_ARRAY_T:[0-9]+]] [[VOID]] 0 0 1 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_T:[0-9]+]] [[VOID]] 1 0 1 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE2D_DEPTH_T:[0-9]+]] [[VOID]] 1 1 0 0 0 0 0 +; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_DEPTH_T:[0-9]+]] [[VOID]] 1 1 1 0 0 0 0 ; CHECK-LLVM: %opencl.image1d_ro_t = type opaque ; CHECK-LLVM: %opencl.image2d_ro_t = type opaque diff --git a/test/transcoding/image_with_access_qualifiers.ll b/test/transcoding/image_with_access_qualifiers.ll index 8ca694870d..bd71da5e8a 100644 --- a/test/transcoding/image_with_access_qualifiers.ll +++ b/test/transcoding/image_with_access_qualifiers.ll @@ -11,7 +11,8 @@ ; CHECK-SPIRV-DAG: 2 Capability ImageBasic ; CHECK-SPIRV-DAG: 2 Capability ImageReadWrite ; CHECK-SPIRV-DAG: 2 Capability LiteralSampler -; CHECK-SPIRV-DAG: 10 TypeImage [[TyImageID:[0-9]+]] 2 0 0 0 0 0 0 2 +; CHECK-SPIRV-DAG: 2 TypeVoid [[TyVoid:[0-9]+]] +; CHECK-SPIRV-DAG: 10 TypeImage [[TyImageID:[0-9]+]] [[TyVoid]] 0 0 0 0 0 0 2 ; CHECK-SPIRV-DAG: 3 TypeSampledImage [[TySampledImageID:[0-9]+]] [[TyImageID]] ; CHECK-SPIRV-DAG: 5 SampledImage [[TySampledImageID]] [[ResID:[0-9]+]]