1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
6 define half @faddv_nxv2f16(half %init, <vscale x 2 x half> %a) {
7 ; CHECK-LABEL: faddv_nxv2f16:
9 ; CHECK-NEXT: ptrue p0.d
10 ; CHECK-NEXT: faddv h1, p0, z1.h
11 ; CHECK-NEXT: fadd h0, h0, h1
13 %res = call fast half @llvm.vector.reduce.fadd.nxv2f16(half %init, <vscale x 2 x half> %a)
17 define half @faddv_nxv4f16(half %init, <vscale x 4 x half> %a) {
18 ; CHECK-LABEL: faddv_nxv4f16:
20 ; CHECK-NEXT: ptrue p0.s
21 ; CHECK-NEXT: faddv h1, p0, z1.h
22 ; CHECK-NEXT: fadd h0, h0, h1
24 %res = call fast half @llvm.vector.reduce.fadd.nxv4f16(half %init, <vscale x 4 x half> %a)
28 define half @faddv_nxv8f16(half %init, <vscale x 8 x half> %a) {
29 ; CHECK-LABEL: faddv_nxv8f16:
31 ; CHECK-NEXT: ptrue p0.h
32 ; CHECK-NEXT: faddv h1, p0, z1.h
33 ; CHECK-NEXT: fadd h0, h0, h1
35 %res = call fast half @llvm.vector.reduce.fadd.nxv8f16(half %init, <vscale x 8 x half> %a)
39 define float @faddv_nxv2f32(float %init, <vscale x 2 x float> %a) {
40 ; CHECK-LABEL: faddv_nxv2f32:
42 ; CHECK-NEXT: ptrue p0.d
43 ; CHECK-NEXT: faddv s1, p0, z1.s
44 ; CHECK-NEXT: fadd s0, s0, s1
46 %res = call fast float @llvm.vector.reduce.fadd.nxv2f32(float %init, <vscale x 2 x float> %a)
50 define float @faddv_nxv4f32(float %init, <vscale x 4 x float> %a) {
51 ; CHECK-LABEL: faddv_nxv4f32:
53 ; CHECK-NEXT: ptrue p0.s
54 ; CHECK-NEXT: faddv s1, p0, z1.s
55 ; CHECK-NEXT: fadd s0, s0, s1
57 %res = call fast float @llvm.vector.reduce.fadd.nxv4f32(float %init, <vscale x 4 x float> %a)
61 define double @faddv_nxv2f64(double %init, <vscale x 2 x double> %a) {
62 ; CHECK-LABEL: faddv_nxv2f64:
64 ; CHECK-NEXT: ptrue p0.d
65 ; CHECK-NEXT: faddv d1, p0, z1.d
66 ; CHECK-NEXT: fadd d0, d0, d1
68 %res = call fast double @llvm.vector.reduce.fadd.nxv2f64(double %init, <vscale x 2 x double> %a)
74 define half @fmaxv_nxv2f16(<vscale x 2 x half> %a) {
75 ; CHECK-LABEL: fmaxv_nxv2f16:
77 ; CHECK-NEXT: ptrue p0.d
78 ; CHECK-NEXT: fmaxnmv h0, p0, z0.h
79 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
81 %res = call half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half> %a)
85 define half @fmaxv_nxv4f16(<vscale x 4 x half> %a) {
86 ; CHECK-LABEL: fmaxv_nxv4f16:
88 ; CHECK-NEXT: ptrue p0.s
89 ; CHECK-NEXT: fmaxnmv h0, p0, z0.h
90 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
92 %res = call half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half> %a)
96 define half @fmaxv_nxv8f16(<vscale x 8 x half> %a) {
97 ; CHECK-LABEL: fmaxv_nxv8f16:
99 ; CHECK-NEXT: ptrue p0.h
100 ; CHECK-NEXT: fmaxnmv h0, p0, z0.h
101 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
103 %res = call half @llvm.vector.reduce.fmax.nxv8f16(<vscale x 8 x half> %a)
107 define float @fmaxv_nxv2f32(<vscale x 2 x float> %a) {
108 ; CHECK-LABEL: fmaxv_nxv2f32:
110 ; CHECK-NEXT: ptrue p0.d
111 ; CHECK-NEXT: fmaxnmv s0, p0, z0.s
112 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
114 %res = call float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float> %a)
118 define float @fmaxv_nxv4f32(<vscale x 4 x float> %a) {
119 ; CHECK-LABEL: fmaxv_nxv4f32:
121 ; CHECK-NEXT: ptrue p0.s
122 ; CHECK-NEXT: fmaxnmv s0, p0, z0.s
123 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
125 %res = call float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float> %a)
129 define double @fmaxv_nxv2f64(<vscale x 2 x double> %a) {
130 ; CHECK-LABEL: fmaxv_nxv2f64:
132 ; CHECK-NEXT: ptrue p0.d
133 ; CHECK-NEXT: fmaxnmv d0, p0, z0.d
134 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
136 %res = call double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double> %a)
142 define half @fminv_nxv2f16(<vscale x 2 x half> %a) {
143 ; CHECK-LABEL: fminv_nxv2f16:
145 ; CHECK-NEXT: ptrue p0.d
146 ; CHECK-NEXT: fminnmv h0, p0, z0.h
147 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
149 %res = call half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half> %a)
153 define half @fminv_nxv4f16(<vscale x 4 x half> %a) {
154 ; CHECK-LABEL: fminv_nxv4f16:
156 ; CHECK-NEXT: ptrue p0.s
157 ; CHECK-NEXT: fminnmv h0, p0, z0.h
158 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
160 %res = call half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half> %a)
164 define half @fminv_nxv8f16(<vscale x 8 x half> %a) {
165 ; CHECK-LABEL: fminv_nxv8f16:
167 ; CHECK-NEXT: ptrue p0.h
168 ; CHECK-NEXT: fminnmv h0, p0, z0.h
169 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
171 %res = call half @llvm.vector.reduce.fmin.nxv8f16(<vscale x 8 x half> %a)
175 define float @fminv_nxv2f32(<vscale x 2 x float> %a) {
176 ; CHECK-LABEL: fminv_nxv2f32:
178 ; CHECK-NEXT: ptrue p0.d
179 ; CHECK-NEXT: fminnmv s0, p0, z0.s
180 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
182 %res = call float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float> %a)
186 define float @fminv_nxv4f32(<vscale x 4 x float> %a) {
187 ; CHECK-LABEL: fminv_nxv4f32:
189 ; CHECK-NEXT: ptrue p0.s
190 ; CHECK-NEXT: fminnmv s0, p0, z0.s
191 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
193 %res = call float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float> %a)
197 define double @fminv_nxv2f64(<vscale x 2 x double> %a) {
198 ; CHECK-LABEL: fminv_nxv2f64:
200 ; CHECK-NEXT: ptrue p0.d
201 ; CHECK-NEXT: fminnmv d0, p0, z0.d
202 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
204 %res = call double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double> %a)
213 define half @fmaximumv_nxv2f16(<vscale x 2 x half> %a) {
214 ; CHECK-LABEL: fmaximumv_nxv2f16:
216 ; CHECK-NEXT: ptrue p0.d
217 ; CHECK-NEXT: fmaxv h0, p0, z0.h
218 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
220 %res = call half @llvm.vector.reduce.fmaximum.nxv2f16(<vscale x 2 x half> %a)
224 define half @fmaximumv_nxv4f16(<vscale x 4 x half> %a) {
225 ; CHECK-LABEL: fmaximumv_nxv4f16:
227 ; CHECK-NEXT: ptrue p0.s
228 ; CHECK-NEXT: fmaxv h0, p0, z0.h
229 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
231 %res = call half @llvm.vector.reduce.fmaximum.nxv4f16(<vscale x 4 x half> %a)
235 define half @fmaximumv_nxv8f16(<vscale x 8 x half> %a) {
236 ; CHECK-LABEL: fmaximumv_nxv8f16:
238 ; CHECK-NEXT: ptrue p0.h
239 ; CHECK-NEXT: fmaxv h0, p0, z0.h
240 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
242 %res = call half @llvm.vector.reduce.fmaximum.nxv8f16(<vscale x 8 x half> %a)
246 define float @fmaximumv_nxv2f32(<vscale x 2 x float> %a) {
247 ; CHECK-LABEL: fmaximumv_nxv2f32:
249 ; CHECK-NEXT: ptrue p0.d
250 ; CHECK-NEXT: fmaxv s0, p0, z0.s
251 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
253 %res = call float @llvm.vector.reduce.fmaximum.nxv2f32(<vscale x 2 x float> %a)
257 define float @fmaximumv_nxv4f32(<vscale x 4 x float> %a) {
258 ; CHECK-LABEL: fmaximumv_nxv4f32:
260 ; CHECK-NEXT: ptrue p0.s
261 ; CHECK-NEXT: fmaxv s0, p0, z0.s
262 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
264 %res = call float @llvm.vector.reduce.fmaximum.nxv4f32(<vscale x 4 x float> %a)
268 define double @fmaximumv_nxv2f64(<vscale x 2 x double> %a) {
269 ; CHECK-LABEL: fmaximumv_nxv2f64:
271 ; CHECK-NEXT: ptrue p0.d
272 ; CHECK-NEXT: fmaxv d0, p0, z0.d
273 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
275 %res = call double @llvm.vector.reduce.fmaximum.nxv2f64(<vscale x 2 x double> %a)
281 define half @fminimumv_nxv2f16(<vscale x 2 x half> %a) {
282 ; CHECK-LABEL: fminimumv_nxv2f16:
284 ; CHECK-NEXT: ptrue p0.d
285 ; CHECK-NEXT: fminv h0, p0, z0.h
286 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
288 %res = call half @llvm.vector.reduce.fminimum.nxv2f16(<vscale x 2 x half> %a)
292 define half @fminimumv_nxv4f16(<vscale x 4 x half> %a) {
293 ; CHECK-LABEL: fminimumv_nxv4f16:
295 ; CHECK-NEXT: ptrue p0.s
296 ; CHECK-NEXT: fminv h0, p0, z0.h
297 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
299 %res = call half @llvm.vector.reduce.fminimum.nxv4f16(<vscale x 4 x half> %a)
303 define half @fminimumv_nxv8f16(<vscale x 8 x half> %a) {
304 ; CHECK-LABEL: fminimumv_nxv8f16:
306 ; CHECK-NEXT: ptrue p0.h
307 ; CHECK-NEXT: fminv h0, p0, z0.h
308 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
310 %res = call half @llvm.vector.reduce.fminimum.nxv8f16(<vscale x 8 x half> %a)
314 define float @fminimumv_nxv2f32(<vscale x 2 x float> %a) {
315 ; CHECK-LABEL: fminimumv_nxv2f32:
317 ; CHECK-NEXT: ptrue p0.d
318 ; CHECK-NEXT: fminv s0, p0, z0.s
319 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
321 %res = call float @llvm.vector.reduce.fminimum.nxv2f32(<vscale x 2 x float> %a)
325 define float @fminimumv_nxv4f32(<vscale x 4 x float> %a) {
326 ; CHECK-LABEL: fminimumv_nxv4f32:
328 ; CHECK-NEXT: ptrue p0.s
329 ; CHECK-NEXT: fminv s0, p0, z0.s
330 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
332 %res = call float @llvm.vector.reduce.fminimum.nxv4f32(<vscale x 4 x float> %a)
336 define double @fminimumv_nxv2f64(<vscale x 2 x double> %a) {
337 ; CHECK-LABEL: fminimumv_nxv2f64:
339 ; CHECK-NEXT: ptrue p0.d
340 ; CHECK-NEXT: fminv d0, p0, z0.d
341 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
343 %res = call double @llvm.vector.reduce.fminimum.nxv2f64(<vscale x 2 x double> %a)
347 define float @fadd_reduct_reassoc_v4v8f32(<vscale x 4 x float> %a, <vscale x 8 x float> %b) {
348 ; CHECK-LABEL: fadd_reduct_reassoc_v4v8f32:
350 ; CHECK-NEXT: fadd z1.s, z1.s, z2.s
351 ; CHECK-NEXT: ptrue p0.s
352 ; CHECK-NEXT: fadd z0.s, z0.s, z1.s
353 ; CHECK-NEXT: faddv s0, p0, z0.s
354 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
356 %r1 = call fast float @llvm.vector.reduce.fadd.nxv4f32(float -0.0, <vscale x 4 x float> %a)
357 %r2 = call fast float @llvm.vector.reduce.fadd.nxv8f32(float -0.0, <vscale x 8 x float> %b)
358 %r = fadd fast float %r1, %r2
362 declare half @llvm.vector.reduce.fadd.nxv2f16(half, <vscale x 2 x half>)
363 declare half @llvm.vector.reduce.fadd.nxv4f16(half, <vscale x 4 x half>)
364 declare half @llvm.vector.reduce.fadd.nxv8f16(half, <vscale x 8 x half>)
365 declare half @llvm.vector.reduce.fadd.nxv6f16(half, <vscale x 6 x half>)
366 declare half @llvm.vector.reduce.fadd.nxv10f16(half, <vscale x 10 x half>)
367 declare half @llvm.vector.reduce.fadd.nxv12f16(half, <vscale x 12 x half>)
368 declare float @llvm.vector.reduce.fadd.nxv2f32(float, <vscale x 2 x float>)
369 declare float @llvm.vector.reduce.fadd.nxv4f32(float, <vscale x 4 x float>)
370 declare float @llvm.vector.reduce.fadd.nxv8f32(float, <vscale x 8 x float>)
371 declare double @llvm.vector.reduce.fadd.nxv2f64(double, <vscale x 2 x double>)
373 declare half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half>)
374 declare half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half>)
375 declare half @llvm.vector.reduce.fmax.nxv8f16(<vscale x 8 x half>)
376 declare float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float>)
377 declare float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float>)
378 declare double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double>)
380 declare half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half>)
381 declare half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half>)
382 declare half @llvm.vector.reduce.fmin.nxv8f16(<vscale x 8 x half>)
383 declare float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float>)
384 declare float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float>)
385 declare double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double>)
387 declare half @llvm.vector.reduce.fmaximum.nxv2f16(<vscale x 2 x half>)
388 declare half @llvm.vector.reduce.fmaximum.nxv4f16(<vscale x 4 x half>)
389 declare half @llvm.vector.reduce.fmaximum.nxv8f16(<vscale x 8 x half>)
390 declare float @llvm.vector.reduce.fmaximum.nxv2f32(<vscale x 2 x float>)
391 declare float @llvm.vector.reduce.fmaximum.nxv4f32(<vscale x 4 x float>)
392 declare double @llvm.vector.reduce.fmaximum.nxv2f64(<vscale x 2 x double>)
394 declare half @llvm.vector.reduce.fminimum.nxv2f16(<vscale x 2 x half>)
395 declare half @llvm.vector.reduce.fminimum.nxv4f16(<vscale x 4 x half>)
396 declare half @llvm.vector.reduce.fminimum.nxv8f16(<vscale x 8 x half>)
397 declare float @llvm.vector.reduce.fminimum.nxv2f32(<vscale x 2 x float>)
398 declare float @llvm.vector.reduce.fminimum.nxv4f32(<vscale x 4 x float>)
399 declare double @llvm.vector.reduce.fminimum.nxv2f64(<vscale x 2 x double>)