76 lines · plain
1; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4;; Types:5; CHECK-DAG: %[[#INT:]] = OpTypeInt 326; CHECK-DAG: %[[#VOID:]] = OpTypeVoid7; CHECK-DAG: %[[#IMAGE1D_T:]] = OpTypeImage %[[#VOID]] 1D 0 0 0 0 Unknown ReadOnly8; CHECK-DAG: %[[#IMAGE2D_T:]] = OpTypeImage %[[#VOID]] 2D 0 0 0 0 Unknown ReadOnly9; CHECK-DAG: %[[#IMAGE3D_T:]] = OpTypeImage %[[#VOID]] 3D 0 0 0 0 Unknown ReadOnly10; CHECK-DAG: %[[#IMAGE1D_ARRAY_T:]] = OpTypeImage %[[#VOID]] 1D 0 1 0 0 Unknown ReadOnly11; CHECK-DAG: %[[#IMAGE2D_ARRAY_T:]] = OpTypeImage %[[#VOID]] 2D 0 1 0 0 Unknown ReadOnly12; CHECK-DAG: %[[#IMAGE2D_DEPTH_T:]] = OpTypeImage %[[#VOID]] 2D 1 0 0 0 Unknown ReadOnly13; CHECK-DAG: %[[#IMAGE2D_ARRAY_DEPTH_T:]] = OpTypeImage %[[#VOID]] 2D 1 1 0 0 Unknown ReadOnly14;; Instructions:15; CHECK: %[[#IMAGE1D:]] = OpLoad %[[#IMAGE1D_T]]16; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE1D]]17; CHECK: %[[#IMAGE2D:]] = OpLoad %[[#IMAGE2D_T]]18; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE2D]]19; CHECK: %[[#IMAGE3D:]] = OpLoad %[[#IMAGE3D_T]]20; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE3D]]21; CHECK: %[[#IMAGE1D_ARRAY:]] = OpLoad %[[#IMAGE1D_ARRAY_T]]22; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE1D_ARRAY]]23; CHECK: %[[#IMAGE2D_ARRAY:]] = OpLoad %[[#IMAGE2D_ARRAY_T]]24; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE2D_ARRAY]]25; CHECK: %[[#IMAGE2D_DEPTH:]] = OpLoad %[[#IMAGE2D_DEPTH_T]]26; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE2D_DEPTH]]27; CHECK: %[[#IMAGE2D_ARRAY_DEPTH:]] = OpLoad %[[#IMAGE2D_ARRAY_DEPTH_T]]28; CHECK-NEXT: %[[#]] = OpImageQueryLevels %[[#INT]] %[[#IMAGE2D_ARRAY_DEPTH]]29 30define spir_func void @testimage1d(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0) %img1, target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %img2, target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %img3, target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0) %img4, target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0) %img5, target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %img6, target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0) %img7) {31entry:32 %img1.addr = alloca target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0), align 433 %img2.addr = alloca target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0), align 434 %img3.addr = alloca target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), align 435 %img4.addr = alloca target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0), align 436 %img5.addr = alloca target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0), align 437 %img6.addr = alloca target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0), align 438 %img7.addr = alloca target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0), align 439 store target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0) %img1, target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0)* %img1.addr, align 440 store target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %img2, target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0)* %img2.addr, align 441 store target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %img3, target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0)* %img3.addr, align 442 store target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0) %img4, target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0)* %img4.addr, align 443 store target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0) %img5, target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0)* %img5.addr, align 444 store target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %img6, target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0)* %img6.addr, align 445 store target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0) %img7, target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0)* %img7.addr, align 446 %0 = load target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0), target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0)* %img1.addr, align 447 %call = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image1d_ro(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0) %0)48 %1 = load target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0), target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0)* %img2.addr, align 449 %call1 = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image2d_ro(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %1)50 %2 = load target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0), target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0)* %img3.addr, align 451 %call2 = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image3d_ro(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0) %2)52 %3 = load target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0), target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0)* %img4.addr, align 453 %call3 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image1d_array_ro(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0) %3)54 %4 = load target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0), target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0)* %img5.addr, align 455 %call4 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_array_ro(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0) %4)56 %5 = load target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0), target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0)* %img6.addr, align 457 %call5 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_depth_ro(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0) %5)58 %6 = load target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0), target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0)* %img7.addr, align 459 %call6 = call spir_func i32 @_Z24get_image_num_mip_levels26ocl_image2d_array_depth_ro(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0) %6)60 ret void61}62 63declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image1d_ro(target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0))64 65declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image2d_ro(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0))66 67declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image3d_ro(target("spirv.Image", void, 2, 0, 0, 0, 0, 0, 0))68 69declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image1d_array_ro(target("spirv.Image", void, 0, 0, 1, 0, 0, 0, 0))70 71declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_array_ro(target("spirv.Image", void, 1, 0, 1, 0, 0, 0, 0))72 73declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_depth_ro(target("spirv.Image", void, 1, 1, 0, 0, 0, 0, 0))74 75declare spir_func i32 @_Z24get_image_num_mip_levels26ocl_image2d_array_depth_ro(target("spirv.Image", void, 1, 1, 1, 0, 0, 0, 0))76