| 1 |
; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc |
| 2 |
; RUN: llvm-spirv -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 3 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 4 |
; RUN: spirv-val %t.spv |
| 5 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 6 |
; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 7 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc --spirv-target-env=SPV-IR |
| 8 |
; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR |
| 9 |
; RUN: llvm-spirv -spirv-text %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 10 |
|
| 11 |
; Generated from the following OpenCL C code: |
| 12 |
; #pragma OPENCL EXTENSION cl_khr_mipmap_image : enable |
| 13 |
; void test(image1d_t img1, |
| 14 |
; image2d_t img2, |
| 15 |
; image3d_t img3, |
| 16 |
; image1d_array_t img4, |
| 17 |
; image2d_array_t img5, |
| 18 |
; image2d_depth_t img6, |
| 19 |
; image2d_array_depth_t img7) |
| 20 |
; { |
| 21 |
; get_image_num_mip_levels(img1); |
| 22 |
; get_image_num_mip_levels(img2); |
| 23 |
; get_image_num_mip_levels(img3); |
| 24 |
; get_image_num_mip_levels(img4); |
| 25 |
; get_image_num_mip_levels(img5); |
| 26 |
; get_image_num_mip_levels(img6); |
| 27 |
; get_image_num_mip_levels(img7); |
| 28 |
; } |
| 29 |
|
| 30 |
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" |
| 31 |
target triple = "spir-unknown-unknown" |
| 32 |
|
| 33 |
%opencl.image1d_ro_t = type opaque |
| 34 |
%opencl.image2d_ro_t = type opaque |
| 35 |
%opencl.image3d_ro_t = type opaque |
| 36 |
%opencl.image1d_array_ro_t = type opaque |
| 37 |
%opencl.image2d_array_ro_t = type opaque |
| 38 |
%opencl.image2d_depth_ro_t = type opaque |
| 39 |
%opencl.image2d_array_depth_ro_t = type opaque |
| 40 |
|
| 41 |
; CHECK-SPIRV: TypeInt [[INT:[0-9]+]] 32 |
| 42 |
; CHECK-SPIRV: TypeVoid [[VOID:[0-9]+]] |
| 43 |
; CHECK-SPIRV: TypeImage [[IMAGE1D_T:[0-9]+]] [[VOID]] 0 0 0 0 0 0 0 |
| 44 |
; CHECK-SPIRV: TypeImage [[IMAGE2D_T:[0-9]+]] [[VOID]] 1 0 0 0 0 0 0 |
| 45 |
; CHECK-SPIRV: TypeImage [[IMAGE3D_T:[0-9]+]] [[VOID]] 2 0 0 0 0 0 0 |
| 46 |
; CHECK-SPIRV: TypeImage [[IMAGE1D_ARRAY_T:[0-9]+]] [[VOID]] 0 0 1 0 0 0 0 |
| 47 |
; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_T:[0-9]+]] [[VOID]] 1 0 1 0 0 0 0 |
| 48 |
; CHECK-SPIRV: TypeImage [[IMAGE2D_DEPTH_T:[0-9]+]] [[VOID]] 1 1 0 0 0 0 0 |
| 49 |
; CHECK-SPIRV: TypeImage [[IMAGE2D_ARRAY_DEPTH_T:[0-9]+]] [[VOID]] 1 1 1 0 0 0 0 |
| 50 |
|
| 51 |
; CHECK-LLVM: %opencl.image1d_ro_t = type opaque |
| 52 |
; CHECK-LLVM: %opencl.image2d_ro_t = type opaque |
| 53 |
; CHECK-LLVM: %opencl.image3d_ro_t = type opaque |
| 54 |
; CHECK-LLVM: %opencl.image1d_array_ro_t = type opaque |
| 55 |
; CHECK-LLVM: %opencl.image2d_array_ro_t = type opaque |
| 56 |
; CHECK-LLVM: %opencl.image2d_depth_ro_t = type opaque |
| 57 |
; CHECK-LLVM: %opencl.image2d_array_depth_ro_t = type opaque |
| 58 |
|
| 59 |
; CHECK-SPV-IR: %spirv.Image._void_0_0_0_0_0_0_0 = type opaque |
| 60 |
; CHECK-SPV-IR: %spirv.Image._void_1_0_0_0_0_0_0 = type opaque |
| 61 |
; CHECK-SPV-IR: %spirv.Image._void_2_0_0_0_0_0_0 = type opaque |
| 62 |
; CHECK-SPV-IR: %spirv.Image._void_0_0_1_0_0_0_0 = type opaque |
| 63 |
; CHECK-SPV-IR: %spirv.Image._void_1_0_1_0_0_0_0 = type opaque |
| 64 |
; CHECK-SPV-IR: %spirv.Image._void_1_1_0_0_0_0_0 = type opaque |
| 65 |
; CHECK-SPV-IR: %spirv.Image._void_1_1_1_0_0_0_0 = type opaque |
| 66 |
|
| 67 |
; Function Attrs: convergent noinline norecurse nounwind optnone |
| 68 |
define dso_local spir_func void @testimage1d(%opencl.image1d_ro_t addrspace(1)* %img1, %opencl.image2d_ro_t addrspace(1)* %img2, %opencl.image3d_ro_t addrspace(1)* %img3, %opencl.image1d_array_ro_t addrspace(1)* %img4, %opencl.image2d_array_ro_t addrspace(1)* %img5, %opencl.image2d_depth_ro_t addrspace(1)* %img6, %opencl.image2d_array_depth_ro_t addrspace(1)* %img7) #0 { |
| 69 |
entry: |
| 70 |
%img1.addr = alloca %opencl.image1d_ro_t addrspace(1)*, align 4 |
| 71 |
%img2.addr = alloca %opencl.image2d_ro_t addrspace(1)*, align 4 |
| 72 |
%img3.addr = alloca %opencl.image3d_ro_t addrspace(1)*, align 4 |
| 73 |
%img4.addr = alloca %opencl.image1d_array_ro_t addrspace(1)*, align 4 |
| 74 |
%img5.addr = alloca %opencl.image2d_array_ro_t addrspace(1)*, align 4 |
| 75 |
%img6.addr = alloca %opencl.image2d_depth_ro_t addrspace(1)*, align 4 |
| 76 |
%img7.addr = alloca %opencl.image2d_array_depth_ro_t addrspace(1)*, align 4 |
| 77 |
store %opencl.image1d_ro_t addrspace(1)* %img1, %opencl.image1d_ro_t addrspace(1)** %img1.addr, align 4 |
| 78 |
store %opencl.image2d_ro_t addrspace(1)* %img2, %opencl.image2d_ro_t addrspace(1)** %img2.addr, align 4 |
| 79 |
store %opencl.image3d_ro_t addrspace(1)* %img3, %opencl.image3d_ro_t addrspace(1)** %img3.addr, align 4 |
| 80 |
store %opencl.image1d_array_ro_t addrspace(1)* %img4, %opencl.image1d_array_ro_t addrspace(1)** %img4.addr, align 4 |
| 81 |
store %opencl.image2d_array_ro_t addrspace(1)* %img5, %opencl.image2d_array_ro_t addrspace(1)** %img5.addr, align 4 |
| 82 |
store %opencl.image2d_depth_ro_t addrspace(1)* %img6, %opencl.image2d_depth_ro_t addrspace(1)** %img6.addr, align 4 |
| 83 |
store %opencl.image2d_array_depth_ro_t addrspace(1)* %img7, %opencl.image2d_array_depth_ro_t addrspace(1)** %img7.addr, align 4 |
| 84 |
%0 = load %opencl.image1d_ro_t addrspace(1)*, %opencl.image1d_ro_t addrspace(1)** %img1.addr, align 4 |
| 85 |
%call = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image1d_ro(%opencl.image1d_ro_t addrspace(1)* %0) #2 |
| 86 |
%1 = load %opencl.image2d_ro_t addrspace(1)*, %opencl.image2d_ro_t addrspace(1)** %img2.addr, align 4 |
| 87 |
%call1 = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)* %1) #2 |
| 88 |
%2 = load %opencl.image3d_ro_t addrspace(1)*, %opencl.image3d_ro_t addrspace(1)** %img3.addr, align 4 |
| 89 |
%call2 = call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image3d_ro(%opencl.image3d_ro_t addrspace(1)* %2) #2 |
| 90 |
%3 = load %opencl.image1d_array_ro_t addrspace(1)*, %opencl.image1d_array_ro_t addrspace(1)** %img4.addr, align 4 |
| 91 |
%call3 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image1d_array_ro(%opencl.image1d_array_ro_t addrspace(1)* %3) #2 |
| 92 |
%4 = load %opencl.image2d_array_ro_t addrspace(1)*, %opencl.image2d_array_ro_t addrspace(1)** %img5.addr, align 4 |
| 93 |
%call4 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)* %4) #2 |
| 94 |
%5 = load %opencl.image2d_depth_ro_t addrspace(1)*, %opencl.image2d_depth_ro_t addrspace(1)** %img6.addr, align 4 |
| 95 |
%call5 = call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_depth_ro(%opencl.image2d_depth_ro_t addrspace(1)* %5) #2 |
| 96 |
%6 = load %opencl.image2d_array_depth_ro_t addrspace(1)*, %opencl.image2d_array_depth_ro_t addrspace(1)** %img7.addr, align 4 |
| 97 |
%call6 = call spir_func i32 @_Z24get_image_num_mip_levels26ocl_image2d_array_depth_ro(%opencl.image2d_array_depth_ro_t addrspace(1)* %6) #2 |
| 98 |
ret void |
| 99 |
} |
| 100 |
|
| 101 |
; CHECK-SPIRV: Load [[IMAGE1D_T]] [[IMAGE1D:[0-9]+]] |
| 102 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE1D]] |
| 103 |
; CHECK-SPIRV: Load [[IMAGE2D_T]] [[IMAGE2D:[0-9]+]] |
| 104 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE2D]] |
| 105 |
; CHECK-SPIRV: Load [[IMAGE3D_T]] [[IMAGE3D:[0-9]+]] |
| 106 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE3D]] |
| 107 |
; CHECK-SPIRV: Load [[IMAGE1D_ARRAY_T]] [[IMAGE1D_ARRAY:[0-9]+]] |
| 108 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE1D_ARRAY]] |
| 109 |
; CHECK-SPIRV: Load [[IMAGE2D_ARRAY_T]] [[IMAGE2D_ARRAY:[0-9]+]] |
| 110 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE2D_ARRAY]] |
| 111 |
; CHECK-SPIRV: Load [[IMAGE2D_DEPTH_T]] [[IMAGE2D_DEPTH:[0-9]+]] |
| 112 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE2D_DEPTH]] |
| 113 |
; CHECK-SPIRV: Load [[IMAGE2D_ARRAY_DEPTH_T]] [[IMAGE2D_ARRAY_DEPTH:[0-9]+]] |
| 114 |
; CHECK-SPIRV: ImageQueryLevels [[INT]] {{[0-9]+}} [[IMAGE2D_ARRAY_DEPTH]] |
| 115 |
|
| 116 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image1d_ro(%opencl.image1d_ro_t addrspace(1)* |
| 117 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)* |
| 118 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels14ocl_image3d_ro(%opencl.image3d_ro_t addrspace(1)* |
| 119 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image1d_array_ro(%opencl.image1d_array_ro_t addrspace(1)* |
| 120 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)* |
| 121 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_depth_ro(%opencl.image2d_depth_ro_t addrspace(1)* |
| 122 |
; CHECK-LLVM: call spir_func i32 @_Z24get_image_num_mip_levels26ocl_image2d_array_depth_ro(%opencl.image2d_array_depth_ro_t addrspace(1)* |
| 123 |
|
| 124 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_0_0_0_0_0_0_0(%spirv.Image._void_0_0_0_0_0_0_0 addrspace(1)* |
| 125 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_1_0_0_0_0_0_0(%spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)* |
| 126 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_2_0_0_0_0_0_0(%spirv.Image._void_2_0_0_0_0_0_0 addrspace(1)* |
| 127 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_0_0_1_0_0_0_0(%spirv.Image._void_0_0_1_0_0_0_0 addrspace(1)* |
| 128 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_1_0_1_0_0_0_0(%spirv.Image._void_1_0_1_0_0_0_0 addrspace(1)* |
| 129 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_1_1_0_0_0_0_0(%spirv.Image._void_1_1_0_0_0_0_0 addrspace(1)* |
| 130 |
; CHECK-SPV-IR: call spir_func i32 @_Z24__spirv_ImageQueryLevelsPU3AS133__spirv_Image__void_1_1_1_0_0_0_0(%spirv.Image._void_1_1_1_0_0_0_0 addrspace(1)* |
| 131 |
|
| 132 |
; Function Attrs: convergent |
| 133 |
declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image1d_ro(%opencl.image1d_ro_t addrspace(1)*) #1 |
| 134 |
|
| 135 |
; Function Attrs: convergent |
| 136 |
declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image2d_ro(%opencl.image2d_ro_t addrspace(1)*) #1 |
| 137 |
|
| 138 |
; Function Attrs: convergent |
| 139 |
declare spir_func i32 @_Z24get_image_num_mip_levels14ocl_image3d_ro(%opencl.image3d_ro_t addrspace(1)*) #1 |
| 140 |
|
| 141 |
; Function Attrs: convergent |
| 142 |
declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image1d_array_ro(%opencl.image1d_array_ro_t addrspace(1)*) #1 |
| 143 |
|
| 144 |
; Function Attrs: convergent |
| 145 |
declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)*) #1 |
| 146 |
|
| 147 |
; Function Attrs: convergent |
| 148 |
declare spir_func i32 @_Z24get_image_num_mip_levels20ocl_image2d_depth_ro(%opencl.image2d_depth_ro_t addrspace(1)*) #1 |
| 149 |
|
| 150 |
; Function Attrs: convergent |
| 151 |
declare spir_func i32 @_Z24get_image_num_mip_levels26ocl_image2d_array_depth_ro(%opencl.image2d_array_depth_ro_t addrspace(1)*) #1 |
| 152 |
|
| 153 |
attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 154 |
attributes #1 = { convergent "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 155 |
attributes #2 = { convergent } |
| 156 |
|
| 157 |
!llvm.module.flags = !{!0} |
| 158 |
!opencl.ocl.version = !{!1} |
| 159 |
!opencl.spir.version = !{!1} |
| 160 |
|
| 161 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 162 |
!1 = !{i32 2, i32 0} |