| 1 |
; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -spirv-text -o %t.txt |
| 3 |
; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV |
| 4 |
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %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 |
|
| 8 |
; NOTE: access qualifier infomation is not preserved after round-trip conversion to LLVM |
| 9 |
; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef14ocl_image1d_rw11ocl_sampleri(%opencl.image1d_rw_t |
| 10 |
|
| 11 |
; CHECK-SPIRV-DAG: 2 Capability ImageBasic |
| 12 |
; CHECK-SPIRV-DAG: 2 Capability ImageReadWrite |
| 13 |
; CHECK-SPIRV-DAG: 2 Capability LiteralSampler |
| 14 |
; CHECK-SPIRV-DAG: 2 TypeVoid [[TyVoid:[0-9]+]] |
| 15 |
; CHECK-SPIRV-DAG: 10 TypeImage [[TyImageID:[0-9]+]] [[TyVoid]] 0 0 0 0 0 0 2 |
| 16 |
; CHECK-SPIRV-DAG: 3 TypeSampledImage [[TySampledImageID:[0-9]+]] [[TyImageID]] |
| 17 |
|
| 18 |
; CHECK-SPIRV-DAG: 5 SampledImage [[TySampledImageID]] [[ResID:[0-9]+]] |
| 19 |
; CHECK-SPIRV: 7 ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} [[ResID]] |
| 20 |
|
| 21 |
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" |
| 22 |
target triple = "spir-unknown-unknown" |
| 23 |
|
| 24 |
%opencl.image1d_rw_t = type opaque |
| 25 |
|
| 26 |
; Function Attrs: nounwind |
| 27 |
define spir_func void @sampFun(%opencl.image1d_rw_t addrspace(1)* %image) #0 { |
| 28 |
entry: |
| 29 |
%image.addr = alloca %opencl.image1d_rw_t addrspace(1)*, align 4 |
| 30 |
store %opencl.image1d_rw_t addrspace(1)* %image, %opencl.image1d_rw_t addrspace(1)** %image.addr, align 4 |
| 31 |
%0 = load %opencl.image1d_rw_t addrspace(1)*, %opencl.image1d_rw_t addrspace(1)** %image.addr, align 4 |
| 32 |
%call = call spir_func <4 x float> @_Z11read_imagef14ocl_image1d_rw11ocl_sampleri(%opencl.image1d_rw_t addrspace(1)* %0, i32 8, i32 2) #2 |
| 33 |
ret void |
| 34 |
} |
| 35 |
|
| 36 |
; Function Attrs: nounwind readnone |
| 37 |
declare spir_func <4 x float> @_Z11read_imagef14ocl_image1d_rw11ocl_sampleri(%opencl.image1d_rw_t addrspace(1)*, i32, i32) #1 |
| 38 |
|
| 39 |
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" } |
| 40 |
attributes #1 = { nounwind readnone "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" } |
| 41 |
attributes #2 = { nounwind readnone } |
| 42 |
|
| 43 |
!opencl.enable.FP_CONTRACT = !{} |
| 44 |
!opencl.spir.version = !{!0} |
| 45 |
!opencl.ocl.version = !{!1} |
| 46 |
!opencl.used.extensions = !{!2} |
| 47 |
!opencl.used.optional.core.features = !{!2} |
| 48 |
!opencl.compiler.options = !{!2} |
| 49 |
|
| 50 |
!0 = !{i32 1, i32 2} |
| 51 |
!1 = !{i32 2, i32 0} |
| 52 |
!2 = !{} |