Home | History | Annotate | Download | only in transcoding
      1 ; RUN: llvm-as %s -o %t.bc
      2 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
      3 ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
      4 ; RUN: llvm-spirv %t.bc -o %t.spv
      5 ; RUN: llvm-spirv -r %t.spv -o %t.bc
      6 ; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
      7 
      8 
      9 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"
     10 target triple = "spir-unknown-unknown"
     11 
     12 %opencl.image2d_t = type opaque
     13 ; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[DataTypeOffsetId:[0-9]+]] 4304
     14 ; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[OrderOffsetId:[0-9]+]] 4272 
     15 
     16 ; Function Attrs: nounwind
     17 define spir_kernel void @f(%opencl.image2d_t addrspace(1)* %img, i32 addrspace(1)* nocapture %type, i32 addrspace(1)* nocapture %order) #0 {
     18 ; CHECK-LLVM-DAG: [[DTCALL:%.+]] ={{.*}} call spir_func i32 @_Z27get_image_channel_data_type11ocl_image2d
     19 ; CHECK-LLVM: [[DTSUB:%.+]] = sub i32 [[DTCALL]], 4304
     20 ; CHECK-LLVM: [[DTADD:%.+]] = add i32 [[DTSUB]], 4304
     21 ; CHECK-LLVM: store i32 [[DTADD]]
     22 ; CHECK-SPIRV: 4 ImageQueryFormat {{[0-9]+}} [[DataTypeID:[0-9]+]]
     23 ; CHECK-SPIRV: 5 IAdd {{[0-9]+}} [[DTAddID:[0-9]+]] [[DataTypeID]] [[DataTypeOffsetId]]
     24 ; CHECK-SPIRV: 5 Store {{[0-9]+}} [[DTAddID]]
     25   %1 = tail call spir_func i32 @_Z27get_image_channel_data_type11ocl_image2d(%opencl.image2d_t addrspace(1)* %img) #2
     26   store i32 %1, i32 addrspace(1)* %type, align 4
     27 ; CHECK-LLVM-DAG: [[OCALL:%.+]] ={{.*}} call spir_func i32 @_Z23get_image_channel_order11ocl_image2d
     28 ; CHECK-LLVM: [[OSUB:%.+]] = sub i32 [[OCALL]], 4272
     29 ; CHECK-LLVM: [[OADD:%.+]] = add i32 [[OSUB]], 4272
     30 ; CHECK-LLVM: store i32 [[OADD]]
     31 ; CHECK-SPIRV: 4 ImageQueryOrder {{[0-9]+}} [[OrderID:[0-9]+]]
     32 ; CHECK-SPIRV: 5 IAdd {{[0-9]+}} [[OrderAddID:[0-9]+]] [[OrderID]] [[OrderOffsetId]]
     33 ; CHECK-SPIRV: 5 Store {{[0-9]+}} [[OrderAddID]]
     34   %2 = tail call spir_func i32 @_Z23get_image_channel_order11ocl_image2d(%opencl.image2d_t addrspace(1)* %img) #2
     35   store i32 %2, i32 addrspace(1)* %order, align 4
     36   ret void
     37 }
     38 
     39 declare spir_func i32 @_Z27get_image_channel_data_type11ocl_image2d(%opencl.image2d_t addrspace(1)*) #1
     40 
     41 declare spir_func i32 @_Z23get_image_channel_order11ocl_image2d(%opencl.image2d_t addrspace(1)*) #1
     42 
     43 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
     44 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
     45 attributes #2 = { nounwind }
     46 
     47 !opencl.kernels = !{!0}
     48 !opencl.spir.version = !{!6}
     49 !opencl.ocl.version = !{!7}
     50 !opencl.used.extensions = !{!8}
     51 !opencl.used.optional.core.features = !{!9}
     52 !opencl.compiler.options = !{!8}
     53 
     54 !0 = !{void (%opencl.image2d_t addrspace(1)*, i32 addrspace(1)*, i32 addrspace(1)*)* @f, !1, !2, !3, !4, !5}
     55 !1 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1}
     56 !2 = !{!"kernel_arg_access_qual", !"read_only", !"none", !"none"}
     57 !3 = !{!"kernel_arg_type", !"image2d_t", !"int*", !"int*"}
     58 !4 = !{!"kernel_arg_base_type", !"image2d_t", !"int*", !"int*"}
     59 !5 = !{!"kernel_arg_type_qual", !"", !"", !""}
     60 !6 = !{i32 1, i32 2}
     61 !7 = !{i32 2, i32 0}
     62 !8 = !{}
     63 !9 = !{!"cl_images"}
     64