1; REQUIRES: spirv-as
2; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
3; RUN: spirv-val %t.spv
4; RUN: llvm-spirv %t.spv -r --spirv-target-env=SPV-IR -o - | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-SPV-IR
5; RUN: llvm-spirv %t.spv -r --spirv-target-env=CL2.0 -o - | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-CL20
6;
7; CHECK-LABEL: spir_kernel void @test
8;
9; CHECK-SPV-IR: call spir_func <2 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat2iPU3AS1Dh
10; CHECK-SPV-IR: call spir_func <3 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat3iPU3AS1Dh
11; CHECK-SPV-IR: call spir_func <4 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat4iPU3AS1Dh
12; CHECK-SPV-IR: call spir_func <8 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat8iPU3AS1Dh
13; CHECK-SPV-IR: call spir_func <16 x float> @_Z33__spirv_ocl_vloada_halfn_Rfloat16iPU3AS1Dh
14; CHECK-SPV-IR: call spir_func <2 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat2iPU3AS3Dh
15; CHECK-SPV-IR: call spir_func <3 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat3iPU3AS3Dh
16; CHECK-SPV-IR: call spir_func <4 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat4iPU3AS3Dh
17; CHECK-SPV-IR: call spir_func <8 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat8iPU3AS3Dh
18; CHECK-SPV-IR: call spir_func <16 x float> @_Z33__spirv_ocl_vloada_halfn_Rfloat16iPU3AS3Dh
19; CHECK-SPV-IR: call spir_func <2 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat2iPU3AS2Dh
20; CHECK-SPV-IR: call spir_func <3 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat3iPU3AS2Dh
21; CHECK-SPV-IR: call spir_func <4 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat4iPU3AS2Dh
22; CHECK-SPV-IR: call spir_func <8 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat8iPU3AS2Dh
23; CHECK-SPV-IR: call spir_func <16 x float> @_Z33__spirv_ocl_vloada_halfn_Rfloat16iPU3AS2Dh
24; CHECK-SPV-IR: call spir_func <2 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat2iPDh
25; CHECK-SPV-IR: call spir_func <3 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat3iPDh
26; CHECK-SPV-IR: call spir_func <4 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat4iPDh
27; CHECK-SPV-IR: call spir_func <8 x float> @_Z32__spirv_ocl_vloada_halfn_Rfloat8iPDh
28; CHECK-SPV-IR: call spir_func <16 x float> @_Z33__spirv_ocl_vloada_halfn_Rfloat16iPDh
29;
30; CHECK-CL20: call spir_func <2 x float> @_Z12vloada_half2jPU3AS1KDh
31; CHECK-CL20: call spir_func <3 x float> @_Z12vloada_half3jPU3AS1KDh
32; CHECK-CL20: call spir_func <4 x float> @_Z12vloada_half4jPU3AS1KDh
33; CHECK-CL20: call spir_func <8 x float> @_Z12vloada_half8jPU3AS1KDh
34; CHECK-CL20: call spir_func <16 x float> @_Z13vloada_half16jPU3AS1KDh
35; CHECK-CL20: call spir_func <2 x float> @_Z12vloada_half2jPU3AS3KDh
36; CHECK-CL20: call spir_func <3 x float> @_Z12vloada_half3jPU3AS3KDh
37; CHECK-CL20: call spir_func <4 x float> @_Z12vloada_half4jPU3AS3KDh
38; CHECK-CL20: call spir_func <8 x float> @_Z12vloada_half8jPU3AS3KDh
39; CHECK-CL20: call spir_func <16 x float> @_Z13vloada_half16jPU3AS3KDh
40; CHECK-CL20: call spir_func <2 x float> @_Z12vloada_half2jPU3AS2KDh
41; CHECK-CL20: call spir_func <3 x float> @_Z12vloada_half3jPU3AS2KDh
42; CHECK-CL20: call spir_func <4 x float> @_Z12vloada_half4jPU3AS2KDh
43; CHECK-CL20: call spir_func <8 x float> @_Z12vloada_half8jPU3AS2KDh
44; CHECK-CL20: call spir_func <16 x float> @_Z13vloada_half16jPU3AS2KDh
45; CHECK-CL20: call spir_func <2 x float> @_Z12vloada_half2jPKDh
46; CHECK-CL20: call spir_func <3 x float> @_Z12vloada_half3jPKDh
47; CHECK-CL20: call spir_func <4 x float> @_Z12vloada_half4jPKDh
48; CHECK-CL20: call spir_func <8 x float> @_Z12vloada_half8jPKDh
49; CHECK-CL20: call spir_func <16 x float> @_Z13vloada_half16jPKDh
50
51               OpCapability Addresses
52               OpCapability Kernel
53               OpCapability Vector16
54               OpCapability Float16Buffer
55          %1 = OpExtInstImport "OpenCL.std"
56               OpMemoryModel Physical32 OpenCL
57               OpEntryPoint Kernel %7 "test"
58         %43 = OpString "kernel_arg_type.test.half*,half*,"
59               OpSource OpenCL_C 200000
60       %uint = OpTypeInt 32 0
61     %uint_0 = OpConstant %uint 0
62       %void = OpTypeVoid
63       %half = OpTypeFloat 16
64%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
65%_ptr_Workgroup_half = OpTypePointer Workgroup %half
66          %6 = OpTypeFunction %void %_ptr_CrossWorkgroup_half %_ptr_Workgroup_half
67      %float = OpTypeFloat 32
68    %v2float = OpTypeVector %float 2
69    %v3float = OpTypeVector %float 3
70    %v4float = OpTypeVector %float 4
71    %v8float = OpTypeVector %float 8
72   %v16float = OpTypeVector %float 16
73%_ptr_UniformConstant_half = OpTypePointer UniformConstant %half
74%_ptr_Function_half = OpTypePointer Function %half
75         %30 = OpUndef %_ptr_UniformConstant_half
76         %37 = OpUndef %_ptr_Function_half
77          %7 = OpFunction %void None %6
78         %pg = OpFunctionParameter %_ptr_CrossWorkgroup_half
79         %pl = OpFunctionParameter %_ptr_Workgroup_half
80      %entry = OpLabel
81       %call = OpExtInst %v2float %1 vloada_halfn %uint_0 %pg 2
82      %call1 = OpExtInst %v3float %1 vloada_halfn %uint_0 %pg 3
83      %call2 = OpExtInst %v4float %1 vloada_halfn %uint_0 %pg 4
84      %call3 = OpExtInst %v8float %1 vloada_halfn %uint_0 %pg 8
85      %call4 = OpExtInst %v16float %1 vloada_halfn %uint_0 %pg 16
86      %call5 = OpExtInst %v2float %1 vloada_halfn %uint_0 %pl 2
87      %call6 = OpExtInst %v3float %1 vloada_halfn %uint_0 %pl 3
88      %call7 = OpExtInst %v4float %1 vloada_halfn %uint_0 %pl 4
89      %call8 = OpExtInst %v8float %1 vloada_halfn %uint_0 %pl 8
90      %call9 = OpExtInst %v16float %1 vloada_halfn %uint_0 %pl 16
91     %call10 = OpExtInst %v2float %1 vloada_halfn %uint_0 %30 2
92     %call11 = OpExtInst %v3float %1 vloada_halfn %uint_0 %30 3
93     %call12 = OpExtInst %v4float %1 vloada_halfn %uint_0 %30 4
94     %call13 = OpExtInst %v8float %1 vloada_halfn %uint_0 %30 8
95     %call14 = OpExtInst %v16float %1 vloada_halfn %uint_0 %30 16
96     %call15 = OpExtInst %v2float %1 vloada_halfn %uint_0 %37 2
97     %call16 = OpExtInst %v3float %1 vloada_halfn %uint_0 %37 3
98     %call17 = OpExtInst %v4float %1 vloada_halfn %uint_0 %37 4
99     %call18 = OpExtInst %v8float %1 vloada_halfn %uint_0 %37 8
100     %call19 = OpExtInst %v16float %1 vloada_halfn %uint_0 %37 16
101               OpReturn
102               OpFunctionEnd
103