| 1 |
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 3 |
|
| 4 |
; CHECK-DAG: OpCapability Float16 |
| 5 |
; CHECK-DAG: OpCapability ImageBasic |
| 6 |
; CHECK-DAG: OpCapability ImageReadWrite |
| 7 |
; CHECK-DAG: OpCapability Pipes |
| 8 |
; CHECK-DAG: OpCapability DeviceEnqueue |
| 9 |
|
| 10 |
; CHECK-DAG: %[[#VOID:]] = OpTypeVoid |
| 11 |
; CHECK-DAG: %[[#INT:]] = OpTypeInt 32 0 |
| 12 |
; CHECK-DAG: %[[#HALF:]] = OpTypeFloat 16 |
| 13 |
; CHECK-DAG: %[[#FLOAT:]] = OpTypeFloat 32 |
| 14 |
; CHECK-DAG: %[[#PIPE_RD:]] = OpTypePipe ReadOnly |
| 15 |
; CHECK-DAG: %[[#PIPE_WR:]] = OpTypePipe WriteOnly |
| 16 |
; CHECK-DAG: %[[#IMG1D_RD:]] = OpTypeImage %[[#VOID]] 1D 0 0 0 0 Unknown ReadOnly |
| 17 |
; CHECK-DAG: %[[#IMG2D_RD:]] = OpTypeImage %[[#INT]] 2D 0 0 0 0 |
| 18 |
; CHECK-DAG: %[[#IMG3D_RD:]] = OpTypeImage %[[#INT]] 3D 0 0 0 0 |
| 19 |
; CHECK-DAG: %[[#IMG2DA_RD:]] = OpTypeImage %[[#HALF]] 2D 0 1 0 0 |
| 20 |
; CHECK-DAG: %[[#IMG2DD_RD:]] = OpTypeImage %[[#FLOAT]] Buffer 0 0 0 |
| 21 |
; CHECK-DAG: %[[#IMG1D_WR:]] = OpTypeImage %[[#VOID]] 1D 0 0 0 0 Unknown WriteOnly |
| 22 |
; CHECK-DAG: %[[#IMG2D_RW:]] = OpTypeImage %[[#VOID]] 2D 0 0 0 0 Unknown ReadWrite |
| 23 |
; CHECK-DAG: %[[#IMG1DB_RD:]] = OpTypeImage %[[#FLOAT]] 2D 1 0 0 0 |
| 24 |
|
| 25 |
; CHECK-DAG: %[[#DEVEVENT:]] = OpTypeDeviceEvent |
| 26 |
; CHECK-DAG: %[[#EVENT:]] = OpTypeEvent |
| 27 |
; CHECK-DAG: %[[#QUEUE:]] = OpTypeQueue |
| 28 |
; CHECK-DAG: %[[#RESID:]] = OpTypeReserveId |
| 29 |
; CHECK-DAG: %[[#SAMP:]] = OpTypeSampler |
| 30 |
; CHECK-DAG: %[[#SAMPIMG:]] = OpTypeSampledImage %[[#IMG1DB_RD]] |
| 31 |
|
| 32 |
; CHECK-DAG: %[[#]] = OpFunction %[[#VOID]] |
| 33 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#PIPE_RD]] |
| 34 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#PIPE_WR]] |
| 35 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG1D_RD]] |
| 36 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG2D_RD]] |
| 37 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG3D_RD]] |
| 38 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG2DA_RD]] |
| 39 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG2DD_RD]] |
| 40 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG1D_WR]] |
| 41 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#IMG2D_RW]] |
| 42 |
|
| 43 |
define spir_kernel void @foo( |
| 44 |
target("spirv.Pipe", 0) %a, |
| 45 |
target("spirv.Pipe", 1) %b, |
| 46 |
target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0) %c1, |
| 47 |
target("spirv.Image", i32, 1, 0, 0, 0, 0, 0, 0) %d1, |
| 48 |
target("spirv.Image", i32, 2, 0, 0, 0, 0, 0, 0) %e1, |
| 49 |
target("spirv.Image", half, 1, 0, 1, 0, 0, 0, 0) %f1, |
| 50 |
target("spirv.Image", float, 5, 0, 0, 0, 0, 0, 0) %g1, |
| 51 |
target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 1) %c2, |
| 52 |
target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 2) %d3) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { |
| 53 |
entry: |
| 54 |
ret void |
| 55 |
} |
| 56 |
|
| 57 |
; CHECK-DAG: %[[#]] = OpFunction |
| 58 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#DEVEVENT]] |
| 59 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#EVENT]] |
| 60 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#QUEUE]] |
| 61 |
; CHECK-DAG: %[[#]] = OpFunctionParameter %[[#RESID]] |
| 62 |
|
| 63 |
; CHECK-DAG: %[[#IMARG:]] = OpFunctionParameter %[[#IMG1DB_RD]] |
| 64 |
; CHECK-DAG: %[[#SAMARG:]] = OpFunctionParameter %[[#SAMP]] |
| 65 |
; CHECK-DAG: %[[#SAMPIMVAR:]] = OpSampledImage %[[#SAMPIMG]] %[[#IMARG]] %[[#SAMARG]] |
| 66 |
; CHECK-DAG: %[[#]] = OpImageSampleExplicitLod %[[#]] %[[#SAMPIMVAR]] |
| 67 |
|
| 68 |
define spir_func void @bar( |
| 69 |
target("spirv.DeviceEvent") %a, |
| 70 |
target("spirv.Event") %b, |
| 71 |
target("spirv.Queue") %c, |
| 72 |
target("spirv.ReserveId") %d) { |
| 73 |
ret void |
| 74 |
} |
| 75 |
|
| 76 |
define spir_func void @test_sampler(target("spirv.Image", float, 1, 1, 0, 0, 0, 0, 0) %srcimg.coerce, |
| 77 |
target("spirv.Sampler") %s.coerce) { |
| 78 |
%1 = tail call spir_func target("spirv.SampledImage", float, 1, 1, 0, 0, 0, 0, 0) @_Z20__spirv_SampledImagePU3AS1K34__spirv_Image__float_1_1_0_0_0_0_0PU3AS1K15__spirv_Sampler(target("spirv.Image", float, 1, 1, 0, 0, 0, 0, 0) %srcimg.coerce, target("spirv.Sampler") %s.coerce) #1 |
| 79 |
%2 = tail call spir_func <4 x float> @_Z38__spirv_ImageSampleExplicitLod_Rfloat4PU3AS120__spirv_SampledImageDv4_iif(target("spirv.SampledImage", float, 1, 1, 0, 0, 0, 0, 0) %1, <4 x i32> zeroinitializer, i32 2, float 1.000000e+00) #1 |
| 80 |
ret void |
| 81 |
} |
| 82 |
|
| 83 |
declare spir_func target("spirv.SampledImage", float, 1, 1, 0, 0, 0, 0, 0) @_Z20__spirv_SampledImagePU3AS1K34__spirv_Image__float_1_1_0_0_0_0_0PU3AS1K15__spirv_Sampler(target("spirv.Image", float, 1, 1, 0, 0, 0, 0, 0), target("spirv.Sampler")) |
| 84 |
|
| 85 |
declare spir_func <4 x float> @_Z38__spirv_ImageSampleExplicitLod_Rfloat4PU3AS120__spirv_SampledImageDv4_iif(target("spirv.SampledImage", float, 1, 1, 0, 0, 0, 0, 0), <4 x i32>, i32, float) |
| 86 |
|
| 87 |
attributes #0 = { 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" } |
| 88 |
|
| 89 |
!opencl.enable.FP_CONTRACT = !{} |
| 90 |
!opencl.spir.version = !{!6} |
| 91 |
!opencl.ocl.version = !{!7} |
| 92 |
!opencl.used.extensions = !{!8} |
| 93 |
!opencl.used.optional.core.features = !{!9} |
| 94 |
!opencl.compiler.options = !{!8} |
| 95 |
|
| 96 |
!1 = !{i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1} |
| 97 |
!2 = !{!"read_only", !"write_only", !"read_only", !"read_only", !"read_only", !"read_only", !"read_only", !"write_only", !"read_write"} |
| 98 |
!3 = !{!"int", !"int", !"image1d_t", !"image2d_t", !"image3d_t", !"image2d_array_t", !"image1d_buffer_t", !"image1d_t", !"image2d_t"} |
| 99 |
!4 = !{!"int", !"int", !"image1d_t", !"image2d_t", !"image3d_t", !"image2d_array_t", !"image1d_buffer_t", !"image1d_t", !"image2d_t"} |
| 100 |
!5 = !{!"pipe", !"pipe", !"", !"", !"", !"", !"", !"", !""} |
| 101 |
!6 = !{i32 1, i32 2} |
| 102 |
!7 = !{i32 2, i32 0} |
| 103 |
!8 = !{!"cl_khr_fp16"} |
| 104 |
!9 = !{!"cl_images"} |