xref: /llvm-project/llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fmin.ll (revision 67d3ef74b31e1517d4f679e754cc2b3041c95901)
1; RUN: llc -verify-machineinstrs -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 %}
3
4target triple = "spir64-unknown-unknown"
5
6; CHECK-DAG: %[[Half:.*]] = OpTypeFloat 16
7; CHECK-DAG: %[[HalfVec2:.*]] = OpTypeVector %[[Half]] 2
8; CHECK-DAG: %[[HalfVec3:.*]] = OpTypeVector %[[Half]] 3
9
10; CHECK-DAG: %[[Float:.*]] = OpTypeFloat 32
11; CHECK-DAG: %[[FloatVec2:.*]] = OpTypeVector %[[Float]] 2
12; CHECK-DAG: %[[FloatVec3:.*]] = OpTypeVector %[[Float]] 3
13
14; CHECK-DAG: %[[Double:.*]] = OpTypeFloat 64
15; CHECK-DAG: %[[DoubleVec2:.*]] = OpTypeVector %[[Double]] 2
16; CHECK-DAG: %[[DoubleVec3:.*]] = OpTypeVector %[[Double]] 3
17
18; CHECK: OpFunction
19; CHECK: %[[ParamVec2Half:.*]] = OpFunctionParameter %[[HalfVec2]]
20; CHECK: %[[Vec2HalfItem0:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 0
21; CHECK: %[[Vec2HalfItem1:.*]] = OpCompositeExtract %[[Half]] %[[ParamVec2Half]] 1
22; CHECK: %[[Vec2HalfR1:.*]] = OpExtInst %[[Half]] %[[#]] fmin %[[Vec2HalfItem0]] %[[Vec2HalfItem1]]
23; CHECK: OpReturnValue %[[Vec2HalfR1]]
24; CHECK: OpFunctionEnd
25
26; CHECK: OpFunction
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]] %[[#]] fmin %[[Vec3HalfItem0]] %[[Vec3HalfItem1]]
32; CHECK: %[[Vec3HalfR2:.*]] = OpExtInst %[[Half]] %[[#]] fmin %[[Vec3HalfR1]] %[[Vec3HalfItem2]]
33; CHECK: OpReturnValue %[[Vec3HalfR2]]
34; CHECK: OpFunctionEnd
35
36; CHECK: OpFunction
37; CHECK: %[[ParamVec2Float:.*]] = OpFunctionParameter %[[FloatVec2]]
38; CHECK: %[[Vec2FloatItem0:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 0
39; CHECK: %[[Vec2FloatItem1:.*]] = OpCompositeExtract %[[Float]] %[[ParamVec2Float]] 1
40; CHECK: %[[Vec2FloatR1:.*]] = OpExtInst %[[Float]] %[[#]] fmin %[[Vec2FloatItem0]] %[[Vec2FloatItem1]]
41; CHECK: OpReturnValue %[[Vec2FloatR1]]
42; CHECK: OpFunctionEnd
43
44; CHECK: OpFunction
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]] %[[#]] fmin %[[Vec3FloatItem0]] %[[Vec3FloatItem1]]
50; CHECK: %[[Vec3FloatR2:.*]] = OpExtInst %[[Float]] %[[#]] fmin %[[Vec3FloatR1]] %[[Vec3FloatItem2]]
51; CHECK: OpReturnValue %[[Vec3FloatR2]]
52; CHECK: OpFunctionEnd
53
54; CHECK: OpFunction
55; CHECK: %[[ParamVec2Double:.*]] = OpFunctionParameter %[[DoubleVec2]]
56; CHECK: %[[Vec2DoubleItem0:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 0
57; CHECK: %[[Vec2DoubleItem1:.*]] = OpCompositeExtract %[[Double]] %[[ParamVec2Double]] 1
58; CHECK: %[[Vec2DoubleR1:.*]] = OpExtInst %[[Double]] %[[#]] fmin %[[Vec2DoubleItem0]] %[[Vec2DoubleItem1]]
59; CHECK: OpReturnValue %[[Vec2DoubleR1]]
60; CHECK: OpFunctionEnd
61
62; CHECK: OpFunction
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]] %[[#]] fmin %[[Vec3DoubleItem0]] %[[Vec3DoubleItem1]]
68; CHECK: %[[Vec3DoubleR2:.*]] = OpExtInst %[[Double]] %[[#]] fmin %[[Vec3DoubleR1]] %[[Vec3DoubleItem2]]
69; CHECK: OpReturnValue %[[Vec3DoubleR2]]
70; CHECK: OpFunctionEnd
71
72define spir_func half @test_vector_reduce_fmin_v2half(<2 x half> %v) {
73entry:
74  %res = call half @llvm.vector.reduce.fmin.v2half(<2 x half> %v)
75  ret half %res
76}
77
78define spir_func half @test_vector_reduce_fmin_v3half(<3 x half> %v) {
79entry:
80  %res = call half @llvm.vector.reduce.fmin.v3half(<3 x half> %v)
81  ret half %res
82}
83
84define spir_func half @test_vector_reduce_fmin_v4half(<4 x half> %v) {
85entry:
86  %res = call half @llvm.vector.reduce.fmin.v4half(<4 x half> %v)
87  ret half %res
88}
89
90define spir_func half @test_vector_reduce_fmin_v8half(<8 x half> %v) {
91entry:
92  %res = call half @llvm.vector.reduce.fmin.v8half(<8 x half> %v)
93  ret half %res
94}
95
96define spir_func half @test_vector_reduce_fmin_v16half(<16 x half> %v) {
97entry:
98  %res = call half @llvm.vector.reduce.fmin.v16half(<16 x half> %v)
99  ret half %res
100}
101
102define spir_func float @test_vector_reduce_fmin_v2float(<2 x float> %v) {
103entry:
104  %res = call float @llvm.vector.reduce.fmin.v2float(<2 x float> %v)
105  ret float %res
106}
107
108define spir_func float @test_vector_reduce_fmin_v3float(<3 x float> %v) {
109entry:
110  %res = call float @llvm.vector.reduce.fmin.v3float(<3 x float> %v)
111  ret float %res
112}
113
114define spir_func float @test_vector_reduce_fmin_v4float(<4 x float> %v) {
115entry:
116  %res = call float @llvm.vector.reduce.fmin.v4float(<4 x float> %v)
117  ret float %res
118}
119
120define spir_func float @test_vector_reduce_fmin_v8float(<8 x float> %v) {
121entry:
122  %res = call float @llvm.vector.reduce.fmin.v8float(<8 x float> %v)
123  ret float %res
124}
125
126define spir_func float @test_vector_reduce_fmin_v16float(<16 x float> %v) {
127entry:
128  %res = call float @llvm.vector.reduce.fmin.v16float(<16 x float> %v)
129  ret float %res
130}
131
132define spir_func double @test_vector_reduce_fmin_v2double(<2 x double> %v) {
133entry:
134  %res = call double @llvm.vector.reduce.fmin.v2double(<2 x double> %v)
135  ret double %res
136}
137
138define spir_func double @test_vector_reduce_fmin_v3double(<3 x double> %v) {
139entry:
140  %res = call double @llvm.vector.reduce.fmin.v3double(<3 x double> %v)
141  ret double %res
142}
143
144define spir_func double @test_vector_reduce_fmin_v4double(<4 x double> %v) {
145entry:
146  %res = call double @llvm.vector.reduce.fmin.v4double(<4 x double> %v)
147  ret double %res
148}
149
150define spir_func double @test_vector_reduce_fmin_v8double(<8 x double> %v) {
151entry:
152  %res = call double @llvm.vector.reduce.fmin.v8double(<8 x double> %v)
153  ret double %res
154}
155
156define spir_func double @test_vector_reduce_fmin_v16double(<16 x double> %v) {
157entry:
158  %res = call double @llvm.vector.reduce.fmin.v16double(<16 x double> %v)
159  ret double %res
160}
161
162declare half @llvm.vector.reduce.fmin.v2half(<2 x half>)
163declare half @llvm.vector.reduce.fmin.v3half(<3 x half>)
164declare half @llvm.vector.reduce.fmin.v4half(<4 x half>)
165declare half @llvm.vector.reduce.fmin.v8half(<8 x half>)
166declare half @llvm.vector.reduce.fmin.v16half(<16 x half>)
167declare float @llvm.vector.reduce.fmin.v2float(<2 x float>)
168declare float @llvm.vector.reduce.fmin.v3float(<3 x float>)
169declare float @llvm.vector.reduce.fmin.v4float(<4 x float>)
170declare float @llvm.vector.reduce.fmin.v8float(<8 x float>)
171declare float @llvm.vector.reduce.fmin.v16float(<16 x float>)
172declare double @llvm.vector.reduce.fmin.v2double(<2 x double>)
173declare double @llvm.vector.reduce.fmin.v3double(<3 x double>)
174declare double @llvm.vector.reduce.fmin.v4double(<4 x double>)
175declare double @llvm.vector.reduce.fmin.v8double(<8 x double>)
176declare double @llvm.vector.reduce.fmin.v16double(<16 x double>)
177