1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 target triple = "spir64-unknown-unknown"
6 ; CHECK-DAG: %[[Char:.*]] = OpTypeInt 8 0
7 ; CHECK-DAG: %[[CharVec2:.*]] = OpTypeVector %[[Char]] 2
8 ; CHECK-DAG: %[[CharVec3:.*]] = OpTypeVector %[[Char]] 3
10 ; CHECK-DAG: %[[Short:.*]] = OpTypeInt 16 0
11 ; CHECK-DAG: %[[ShortVec2:.*]] = OpTypeVector %[[Short]] 2
12 ; CHECK-DAG: %[[ShortVec3:.*]] = OpTypeVector %[[Short]] 3
14 ; CHECK-DAG: %[[Int:.*]] = OpTypeInt 32 0
15 ; CHECK-DAG: %[[IntVec2:.*]] = OpTypeVector %[[Int]] 2
16 ; CHECK-DAG: %[[IntVec3:.*]] = OpTypeVector %[[Int]] 3
18 ; CHECK-DAG: %[[Long:.*]] = OpTypeInt 64 0
19 ; CHECK-DAG: %[[LongVec2:.*]] = OpTypeVector %[[Long]] 2
20 ; CHECK-DAG: %[[LongVec3:.*]] = OpTypeVector %[[Long]] 3
23 ; CHECK: %[[Shuffle1:.*]] = OpVectorShuffle %[[CharVec2]] %[[#]] %[[#]] 1 -1
24 ; CHECK: %[[Added1:.*]] = OpIAdd %[[CharVec2]] %[[#]] %[[#]]
25 ; CHECK: %[[Vec2CharR:.*]] = OpCompositeExtract %[[Char]] %[[Added1]] 0
26 ; CHECK: OpReturnValue %[[Vec2CharR]]
27 ; CHECK: OpFunctionEnd
30 ; CHECK: %[[ParamVec3Char:.*]] = OpFunctionParameter %[[CharVec3]]
31 ; CHECK: %[[Vec3CharItem0:.*]] = OpCompositeExtract %[[Char]] %[[ParamVec3Char]] 0
32 ; CHECK: %[[Vec3CharItem1:.*]] = OpCompositeExtract %[[Char]] %[[ParamVec3Char]] 1
33 ; CHECK: %[[Vec3CharItem2:.*]] = OpCompositeExtract %[[Char]] %[[ParamVec3Char]] 2
34 ; CHECK: %[[Vec3CharR1:.*]] = OpIAdd %[[Char]] %[[Vec3CharItem0]] %[[Vec3CharItem1]]
35 ; CHECK: %[[Vec3CharR2:.*]] = OpIAdd %[[Char]] %[[Vec3CharR1]] %[[Vec3CharItem2]]
36 ; CHECK: OpReturnValue %[[Vec3CharR2]]
37 ; CHECK: OpFunctionEnd
40 ; CHECK: %[[Shuffle1:.*]] = OpVectorShuffle %[[ShortVec2]] %[[#]] %[[#]] 1 -1
41 ; CHECK: %[[Added1:.*]] = OpIAdd %[[ShortVec2]] %[[#]] %[[#]]
42 ; CHECK: %[[Vec2ShortR:.*]] = OpCompositeExtract %[[Short]] %[[Added1]] 0
43 ; CHECK: OpReturnValue %[[Vec2ShortR]]
44 ; CHECK: OpFunctionEnd
47 ; CHECK: %[[ParamVec3Short:.*]] = OpFunctionParameter %[[ShortVec3]]
48 ; CHECK: %[[Vec3ShortItem0:.*]] = OpCompositeExtract %[[Short]] %[[ParamVec3Short]] 0
49 ; CHECK: %[[Vec3ShortItem1:.*]] = OpCompositeExtract %[[Short]] %[[ParamVec3Short]] 1
50 ; CHECK: %[[Vec3ShortItem2:.*]] = OpCompositeExtract %[[Short]] %[[ParamVec3Short]] 2
51 ; CHECK: %[[Vec3ShortR1:.*]] = OpIAdd %[[Short]] %[[Vec3ShortItem0]] %[[Vec3ShortItem1]]
52 ; CHECK: %[[Vec3ShortR2:.*]] = OpIAdd %[[Short]] %[[Vec3ShortR1]] %[[Vec3ShortItem2]]
53 ; CHECK: OpReturnValue %[[Vec3ShortR2]]
54 ; CHECK: OpFunctionEnd
57 ; CHECK: %[[Shuffle1:.*]] = OpVectorShuffle %[[IntVec2]] %[[#]] %[[#]] 1 -1
58 ; CHECK: %[[Added1:.*]] = OpIAdd %[[IntVec2]] %[[#]] %[[#]]
59 ; CHECK: %[[Vec2IntR:.*]] = OpCompositeExtract %[[Int]] %[[Added1]] 0
60 ; CHECK: OpReturnValue %[[Vec2IntR]]
61 ; CHECK: OpFunctionEnd
64 ; CHECK: %[[ParamVec3Int:.*]] = OpFunctionParameter %[[IntVec3]]
65 ; CHECK: %[[Vec3IntItem0:.*]] = OpCompositeExtract %[[Int]] %[[ParamVec3Int]] 0
66 ; CHECK: %[[Vec3IntItem1:.*]] = OpCompositeExtract %[[Int]] %[[ParamVec3Int]] 1
67 ; CHECK: %[[Vec3IntItem2:.*]] = OpCompositeExtract %[[Int]] %[[ParamVec3Int]] 2
68 ; CHECK: %[[Vec3IntR1:.*]] = OpIAdd %[[Int]] %[[Vec3IntItem0]] %[[Vec3IntItem1]]
69 ; CHECK: %[[Vec3IntR2:.*]] = OpIAdd %[[Int]] %[[Vec3IntR1]] %[[Vec3IntItem2]]
70 ; CHECK: OpReturnValue %[[Vec3IntR2]]
71 ; CHECK: OpFunctionEnd
74 ; CHECK: %[[Shuffle1:.*]] = OpVectorShuffle %[[LongVec2]] %[[#]] %[[#]] 1 -1
75 ; CHECK: %[[Added1:.*]] = OpIAdd %[[LongVec2]] %[[#]] %[[#]]
76 ; CHECK: %[[Vec2LongR:.*]] = OpCompositeExtract %[[Long]] %[[Added1]] 0
77 ; CHECK: OpReturnValue %[[Vec2LongR]]
78 ; CHECK: OpFunctionEnd
81 ; CHECK: %[[ParamVec3Long:.*]] = OpFunctionParameter %[[LongVec3]]
82 ; CHECK: %[[Vec3LongItem0:.*]] = OpCompositeExtract %[[Long]] %[[ParamVec3Long]] 0
83 ; CHECK: %[[Vec3LongItem1:.*]] = OpCompositeExtract %[[Long]] %[[ParamVec3Long]] 1
84 ; CHECK: %[[Vec3LongItem2:.*]] = OpCompositeExtract %[[Long]] %[[ParamVec3Long]] 2
85 ; CHECK: %[[Vec3LongR1:.*]] = OpIAdd %[[Long]] %[[Vec3LongItem0]] %[[Vec3LongItem1]]
86 ; CHECK: %[[Vec3LongR2:.*]] = OpIAdd %[[Long]] %[[Vec3LongR1]] %[[Vec3LongItem2]]
87 ; CHECK: OpReturnValue %[[Vec3LongR2]]
88 ; CHECK: OpFunctionEnd
90 define spir_func i8 @test_vector_reduce_add_v2i8(<2 x i8> %v) {
92 %res = call i8 @llvm.vector.reduce.add.v2i8(<2 x i8> %v)
96 define spir_func i8 @test_vector_reduce_add_v3i8(<3 x i8> %v) {
98 %res = call i8 @llvm.vector.reduce.add.v3i8(<3 x i8> %v)
102 define spir_func i8 @test_vector_reduce_add_v4i8(<4 x i8> %v) {
104 %res = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> %v)
108 define spir_func i8 @test_vector_reduce_add_v8i8(<8 x i8> %v) {
110 %res = call i8 @llvm.vector.reduce.add.v8i8(<8 x i8> %v)
114 define spir_func i8 @test_vector_reduce_add_v16i8(<16 x i8> %v) {
116 %res = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> %v)
120 define spir_func i16 @test_vector_reduce_add_v2i16(<2 x i16> %v) {
122 %res = call i16 @llvm.vector.reduce.add.v2i16(<2 x i16> %v)
126 define spir_func i16 @test_vector_reduce_add_v3i16(<3 x i16> %v) {
128 %res = call i16 @llvm.vector.reduce.add.v3i16(<3 x i16> %v)
132 define spir_func i16 @test_vector_reduce_add_v4i16(<4 x i16> %v) {
134 %res = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> %v)
138 define spir_func i16 @test_vector_reduce_add_v8i16(<8 x i16> %v) {
140 %res = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> %v)
144 define spir_func i16 @test_vector_reduce_add_v16i16(<16 x i16> %v) {
146 %res = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> %v)
151 define spir_func i32 @test_vector_reduce_add_v2i32(<2 x i32> %v) {
153 %res = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %v)
157 define spir_func i32 @test_vector_reduce_add_v3i32(<3 x i32> %v) {
159 %res = call i32 @llvm.vector.reduce.add.v3i32(<3 x i32> %v)
163 define spir_func i32 @test_vector_reduce_add_v4i32(<4 x i32> %v) {
165 %res = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %v)
169 define spir_func i32 @test_vector_reduce_add_v8i32(<8 x i32> %v) {
171 %res = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %v)
175 define spir_func i32 @test_vector_reduce_add_v16i32(<16 x i32> %v) {
177 %res = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %v)
181 define spir_func i64 @test_vector_reduce_add_v2i64(<2 x i64> %v) {
183 %res = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %v)
187 define spir_func i64 @test_vector_reduce_add_v3i64(<3 x i64> %v) {
189 %res = call i64 @llvm.vector.reduce.add.v3i64(<3 x i64> %v)
193 define spir_func i64 @test_vector_reduce_add_v4i64(<4 x i64> %v) {
195 %res = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %v)
199 define spir_func i64 @test_vector_reduce_add_v8i64(<8 x i64> %v) {
201 %res = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> %v)
205 define spir_func i64 @test_vector_reduce_add_v16i64(<16 x i64> %v) {
207 %res = call i64 @llvm.vector.reduce.add.v16i64(<16 x i64> %v)
211 declare i8 @llvm.vector.reduce.add.v2i8(<2 x i8>)
212 declare i8 @llvm.vector.reduce.add.v3i8(<3 x i8>)
213 declare i8 @llvm.vector.reduce.add.v4i8(<4 x i8>)
214 declare i8 @llvm.vector.reduce.add.v8i8(<8 x i8>)
215 declare i8 @llvm.vector.reduce.add.v16i8(<16 x i8>)
217 declare i16 @llvm.vector.reduce.add.v2i16(<2 x i16>)
218 declare i16 @llvm.vector.reduce.add.v3i16(<3 x i16>)
219 declare i16 @llvm.vector.reduce.add.v4i16(<4 x i16>)
220 declare i16 @llvm.vector.reduce.add.v8i16(<8 x i16>)
221 declare i16 @llvm.vector.reduce.add.v16i16(<16 x i16>)
223 declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)
224 declare i32 @llvm.vector.reduce.add.v3i32(<3 x i32>)
225 declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>)
226 declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>)
227 declare i32 @llvm.vector.reduce.add.v16i32(<16 x i32>)
229 declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>)
230 declare i64 @llvm.vector.reduce.add.v3i64(<3 x i64>)
231 declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>)
232 declare i64 @llvm.vector.reduce.add.v8i64(<8 x i64>)
233 declare i64 @llvm.vector.reduce.add.v16i64(<16 x i64>)