| 1 |
; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv |
| 3 |
; RUN: spirv-val %t.spv |
| 4 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 5 |
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 6 |
|
| 7 |
; ModuleID = 'image_builtins.cl' |
| 8 |
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" |
| 9 |
target triple = "spir-unknown-unknown" |
| 10 |
|
| 11 |
%opencl.image2d_ro_t = type opaque |
| 12 |
%opencl.sampler_t = type opaque |
| 13 |
%opencl.image2d_wo_t = type opaque |
| 14 |
|
| 15 |
; CHECK-LLVM-LABEL: @nosamp |
| 16 |
; CHECK-LLVM: call spir_func <4 x half> @_Z11read_imageh14ocl_image2d_roDv2_i( |
| 17 |
|
| 18 |
; CHECK-LLVM-LABEL: @withsamp |
| 19 |
; CHECK-LLVM: call spir_func <4 x half> @_Z11read_imageh14ocl_image2d_ro11ocl_samplerDv2_i( |
| 20 |
|
| 21 |
; CHECK-LLVM-LABEL: @writehalf |
| 22 |
; CHECK-LLVM: call spir_func void @_Z12write_imageh14ocl_image2d_woDv2_iDv4_Dh( |
| 23 |
|
| 24 |
; Function Attrs: convergent nounwind |
| 25 |
define spir_kernel void @nosamp(%opencl.image2d_ro_t addrspace(1)* %im, <2 x i32> %coord, <4 x half> addrspace(1)* nocapture %res) local_unnamed_addr #0 !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 !kernel_arg_type !5 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { |
| 26 |
entry: |
| 27 |
%call = tail call spir_func <4 x half> @_Z11read_imageh14ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)* %im, <2 x i32> %coord) #3 |
| 28 |
store <4 x half> %call, <4 x half> addrspace(1)* %res, align 8, !tbaa !8 |
| 29 |
ret void |
| 30 |
} |
| 31 |
|
| 32 |
; Function Attrs: convergent nounwind readonly |
| 33 |
declare spir_func <4 x half> @_Z11read_imageh14ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 34 |
|
| 35 |
; Function Attrs: convergent nounwind |
| 36 |
define spir_kernel void @withsamp(%opencl.image2d_ro_t addrspace(1)* %im, %opencl.sampler_t addrspace(2)* %smp, <2 x i32> %coord, <4 x half> addrspace(1)* nocapture %res) local_unnamed_addr #0 !kernel_arg_addr_space !11 !kernel_arg_access_qual !12 !kernel_arg_type !13 !kernel_arg_base_type !14 !kernel_arg_type_qual !15 { |
| 37 |
entry: |
| 38 |
%call = tail call spir_func <4 x half> @_Z11read_imageh14ocl_image2d_ro11ocl_samplerDv2_i(%opencl.image2d_ro_t addrspace(1)* %im, %opencl.sampler_t addrspace(2)* %smp, <2 x i32> %coord) #3 |
| 39 |
store <4 x half> %call, <4 x half> addrspace(1)* %res, align 8, !tbaa !8 |
| 40 |
ret void |
| 41 |
} |
| 42 |
|
| 43 |
; Function Attrs: convergent nounwind readonly |
| 44 |
declare spir_func <4 x half> @_Z11read_imageh14ocl_image2d_ro11ocl_samplerDv2_i(%opencl.image2d_ro_t addrspace(1)*, %opencl.sampler_t addrspace(2)*, <2 x i32>) local_unnamed_addr #1 |
| 45 |
|
| 46 |
; Function Attrs: convergent nounwind |
| 47 |
define spir_kernel void @writehalf(%opencl.image2d_wo_t addrspace(1)* %im, <2 x i32> %coord, <4 x half> addrspace(1)* nocapture readonly %val) local_unnamed_addr #0 !kernel_arg_addr_space !3 !kernel_arg_access_qual !16 !kernel_arg_type !5 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { |
| 48 |
entry: |
| 49 |
%0 = load <4 x half>, <4 x half> addrspace(1)* %val, align 8, !tbaa !8 |
| 50 |
tail call spir_func void @_Z12write_imageh14ocl_image2d_woDv2_iDv4_Dh(%opencl.image2d_wo_t addrspace(1)* %im, <2 x i32> %coord, <4 x half> %0) #4 |
| 51 |
ret void |
| 52 |
} |
| 53 |
|
| 54 |
; Function Attrs: convergent |
| 55 |
declare spir_func void @_Z12write_imageh14ocl_image2d_woDv2_iDv4_Dh(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <4 x half>) local_unnamed_addr #2 |
| 56 |
|
| 57 |
attributes #0 = { convergent nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="64" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 58 |
attributes #1 = { convergent nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 59 |
attributes #2 = { convergent "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 60 |
attributes #3 = { convergent nounwind readonly } |
| 61 |
attributes #4 = { convergent nounwind } |
| 62 |
|
| 63 |
!llvm.module.flags = !{!0} |
| 64 |
!opencl.ocl.version = !{!1} |
| 65 |
!opencl.spir.version = !{!1} |
| 66 |
!llvm.ident = !{!2} |
| 67 |
|
| 68 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 69 |
!1 = !{i32 2, i32 0} |
| 70 |
!2 = !{!"clang version 8.0.0"} |
| 71 |
!3 = !{i32 1, i32 0, i32 1} |
| 72 |
!4 = !{!"read_only", !"none", !"none"} |
| 73 |
!5 = !{!"image2d_t", !"int2", !"half4*"} |
| 74 |
!6 = !{!"image2d_t", !"int __attribute__((ext_vector_type(2)))", !"half __attribute__((ext_vector_type(4)))*"} |
| 75 |
!7 = !{!"", !"", !""} |
| 76 |
!8 = !{!9, !9, i64 0} |
| 77 |
!9 = !{!"omnipotent char", !10, i64 0} |
| 78 |
!10 = !{!"Simple C/C++ TBAA"} |
| 79 |
!11 = !{i32 1, i32 0, i32 0, i32 1} |
| 80 |
!12 = !{!"read_only", !"none", !"none", !"none"} |
| 81 |
!13 = !{!"image2d_t", !"sampler_t", !"int2", !"half4*"} |
| 82 |
!14 = !{!"image2d_t", !"sampler_t", !"int __attribute__((ext_vector_type(2)))", !"half __attribute__((ext_vector_type(4)))*"} |
| 83 |
!15 = !{!"", !"", !"", !""} |
| 84 |
!16 = !{!"write_only", !"none", !"none"} |