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: %[[Half:.*]] = OpTypeFloat 16
7 ; CHECK-DAG: %[[HalfVec2:.*]] = OpTypeVector %[[Half]] 2
8 ; CHECK-DAG: %[[HalfVec3:.*]] = OpTypeVector %[[Half]] 3
10 ; CHECK-DAG: %[[Float:.*]] = OpTypeFloat 32
11 ; CHECK-DAG: %[[FloatVec2:.*]] = OpTypeVector %[[Float]] 2
12 ; CHECK-DAG: %[[FloatVec3:.*]] = OpTypeVector %[[Float]] 3
14 ; CHECK-DAG: %[[Double:.*]] = OpTypeFloat 64
15 ; CHECK-DAG: %[[DoubleVec2:.*]] = OpTypeVector %[[Double]] 2
16 ; CHECK-DAG: %[[DoubleVec3:.*]] = OpTypeVector %[[Double]] 3
19 ; CHECK: %[[ParamVec2Half:.*]] = OpFunctionParameter %[[HalfVec2]]
20 ; CHECK: %[[Vec2HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 0
21 ; CHECK: %[[Vec2HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 1
22 ; CHECK: %[[Vec2HalfR1:.*]] = OpExtInst %[[Half]] %[[#]] fmax %[[Vec2HalfItem0]] %[[Vec2HalfItem1]]
23 ; CHECK: OpReturnValue %[[Vec2HalfR1]]
24 ; CHECK: OpFunctionEnd
27 ; CHECK: %[[ParamVec3Half:.*]] = OpFunctionParameter %[[HalfVec3]]
28 ; CHECK: %[[Vec3HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 0
29 ; CHECK: %[[Vec3HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 1
30 ; CHECK: %[[Vec3HalfItem2:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec3Half]] 2
31 ; CHECK: %[[Vec3HalfR1:.*]] = OpExtInst %[[Half]] %[[#]] fmax %[[Vec3HalfItem0]] %[[Vec3HalfItem1]]
32 ; CHECK: %[[Vec3HalfR2:.*]] = OpExtInst %[[Half]] %[[#]] fmax %[[Vec3HalfR1]] %[[Vec3HalfItem2]]
33 ; CHECK: OpReturnValue %[[Vec3HalfR2]]
34 ; CHECK: OpFunctionEnd
37 ; CHECK: %[[ParamVec2Float:.*]] = OpFunctionParameter %[[FloatVec2]]
38 ; CHECK: %[[Vec2FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 0
39 ; CHECK: %[[Vec2FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 1
40 ; CHECK: %[[Vec2FloatR1:.*]] = OpExtInst %[[Float]] %[[#]] fmax %[[Vec2FloatItem0]] %[[Vec2FloatItem1]]
41 ; CHECK: OpReturnValue %[[Vec2FloatR1]]
42 ; CHECK: OpFunctionEnd
45 ; CHECK: %[[ParamVec3Float:.*]] = OpFunctionParameter %[[FloatVec3]]
46 ; CHECK: %[[Vec3FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 0
47 ; CHECK: %[[Vec3FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 1
48 ; CHECK: %[[Vec3FloatItem2:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec3Float]] 2
49 ; CHECK: %[[Vec3FloatR1:.*]] = OpExtInst %[[Float]] %[[#]] fmax %[[Vec3FloatItem0]] %[[Vec3FloatItem1]]
50 ; CHECK: %[[Vec3FloatR2:.*]] = OpExtInst %[[Float]] %[[#]] fmax %[[Vec3FloatR1]] %[[Vec3FloatItem2]]
51 ; CHECK: OpReturnValue %[[Vec3FloatR2]]
52 ; CHECK: OpFunctionEnd
55 ; CHECK: %[[ParamVec2Double:.*]] = OpFunctionParameter %[[DoubleVec2]]
56 ; CHECK: %[[Vec2DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 0
57 ; CHECK: %[[Vec2DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 1
58 ; CHECK: %[[Vec2DoubleR1:.*]] = OpExtInst %[[Double]] %[[#]] fmax %[[Vec2DoubleItem0]] %[[Vec2DoubleItem1]]
59 ; CHECK: OpReturnValue %[[Vec2DoubleR1]]
60 ; CHECK: OpFunctionEnd
63 ; CHECK: %[[ParamVec3Double:.*]] = OpFunctionParameter %[[DoubleVec3]]
64 ; CHECK: %[[Vec3DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 0
65 ; CHECK: %[[Vec3DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 1
66 ; CHECK: %[[Vec3DoubleItem2:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec3Double]] 2
67 ; CHECK: %[[Vec3DoubleR1:.*]] = OpExtInst %[[Double]] %[[#]] fmax %[[Vec3DoubleItem0]] %[[Vec3DoubleItem1]]
68 ; CHECK: %[[Vec3DoubleR2:.*]] = OpExtInst %[[Double]] %[[#]] fmax %[[Vec3DoubleR1]] %[[Vec3DoubleItem2]]
69 ; CHECK: OpReturnValue %[[Vec3DoubleR2]]
70 ; CHECK: OpFunctionEnd
72 define spir_func half @test_vector_reduce_fmax_v2half(<2 x half> %v) {
74 %res = call half @llvm.vector.reduce.fmax.v2half(<2 x half> %v)
78 define spir_func half @test_vector_reduce_fmax_v3half(<3 x half> %v) {
80 %res = call half @llvm.vector.reduce.fmax.v3half(<3 x half> %v)
84 define spir_func half @test_vector_reduce_fmax_v4half(<4 x half> %v) {
86 %res = call half @llvm.vector.reduce.fmax.v4half(<4 x half> %v)
90 define spir_func half @test_vector_reduce_fmax_v8half(<8 x half> %v) {
92 %res = call half @llvm.vector.reduce.fmax.v8half(<8 x half> %v)
96 define spir_func half @test_vector_reduce_fmax_v16half(<16 x half> %v) {
98 %res = call half @llvm.vector.reduce.fmax.v16half(<16 x half> %v)
102 define spir_func float @test_vector_reduce_fmax_v2float(<2 x float> %v) {
104 %res = call float @llvm.vector.reduce.fmax.v2float(<2 x float> %v)
108 define spir_func float @test_vector_reduce_fmax_v3float(<3 x float> %v) {
110 %res = call float @llvm.vector.reduce.fmax.v3float(<3 x float> %v)
114 define spir_func float @test_vector_reduce_fmax_v4float(<4 x float> %v) {
116 %res = call float @llvm.vector.reduce.fmax.v4float(<4 x float> %v)
120 define spir_func float @test_vector_reduce_fmax_v8float(<8 x float> %v) {
122 %res = call float @llvm.vector.reduce.fmax.v8float(<8 x float> %v)
126 define spir_func float @test_vector_reduce_fmax_v16float(<16 x float> %v) {
128 %res = call float @llvm.vector.reduce.fmax.v16float(<16 x float> %v)
133 define spir_func double @test_vector_reduce_fmax_v2double(<2 x double> %v) {
135 %res = call double @llvm.vector.reduce.fmax.v2double(<2 x double> %v)
139 define spir_func double @test_vector_reduce_fmax_v3double(<3 x double> %v) {
141 %res = call double @llvm.vector.reduce.fmax.v3double(<3 x double> %v)
145 define spir_func double @test_vector_reduce_fmax_v4double(<4 x double> %v) {
147 %res = call double @llvm.vector.reduce.fmax.v4double(<4 x double> %v)
151 define spir_func double @test_vector_reduce_fmax_v8double(<8 x double> %v) {
153 %res = call double @llvm.vector.reduce.fmax.v8double(<8 x double> %v)
157 define spir_func double @test_vector_reduce_fmax_v16double(<16 x double> %v) {
159 %res = call double @llvm.vector.reduce.fmax.v16double(<16 x double> %v)
163 declare half @llvm.vector.reduce.fmax.v2half(<2 x half>)
164 declare half @llvm.vector.reduce.fmax.v3half(<3 x half>)
165 declare half @llvm.vector.reduce.fmax.v4half(<4 x half>)
166 declare half @llvm.vector.reduce.fmax.v8half(<8 x half>)
167 declare half @llvm.vector.reduce.fmax.v16half(<16 x half>)
168 declare float @llvm.vector.reduce.fmax.v2float(<2 x float>)
169 declare float @llvm.vector.reduce.fmax.v3float(<3 x float>)
170 declare float @llvm.vector.reduce.fmax.v4float(<4 x float>)
171 declare float @llvm.vector.reduce.fmax.v8float(<8 x float>)
172 declare float @llvm.vector.reduce.fmax.v16float(<16 x float>)
173 declare double @llvm.vector.reduce.fmax.v2double(<2 x double>)
174 declare double @llvm.vector.reduce.fmax.v3double(<3 x double>)
175 declare double @llvm.vector.reduce.fmax.v4double(<4 x double>)
176 declare double @llvm.vector.reduce.fmax.v8double(<8 x double>)
177 declare double @llvm.vector.reduce.fmax.v16double(<16 x double>)