1 ; RUN: llc < %s -mtriple=aarch64-eabi -aarch64-neon-syntax=generic -asm-verbose=0 -mattr=+fullfp16 | FileCheck %s
2 ; RUN: llc < %s -mtriple=aarch64-eabi -aarch64-neon-syntax=generic -asm-verbose=0 | FileCheck %s --check-prefix=CHECKNOFP16
4 define float @add_HalfS(<2 x float> %bin.rdx) {
5 ; CHECK-LABEL: add_HalfS:
6 ; CHECK: faddp s0, v0.2s
8 %r = call fast float @llvm.experimental.vector.reduce.v2.fadd.f32.v2f32(float 0.0, <2 x float> %bin.rdx)
12 define half @add_HalfH(<4 x half> %bin.rdx) {
13 ; CHECK-LABEL: add_HalfH:
14 ; CHECK: mov h3, v0.h[1]
15 ; CHECK-NEXT: mov h1, v0.h[3]
16 ; CHECK-NEXT: mov h2, v0.h[2]
17 ; CHECK-NEXT: fadd h0, h0, h3
18 ; CHECK-NEXT: fadd h0, h0, h2
19 ; CHECK-NEXT: fadd h0, h0, h1
21 ; CHECKNOFP16-LABEL: add_HalfH:
22 ; CHECKNOFP16-NOT: faddp
23 ; CHECKNOFP16-NOT: fadd h{{[0-9]+}}
24 ; CHECKNOFP16-NOT: fadd v{{[0-9]+}}.{{[0-9]}}h
26 %r = call fast half @llvm.experimental.vector.reduce.v2.fadd.f16.v4f16(half 0.0, <4 x half> %bin.rdx)
31 define half @add_H(<8 x half> %bin.rdx) {
33 ; CHECK: ext v1.16b, v0.16b, v0.16b, #8
34 ; CHECK-NEXT: fadd v0.4h, v0.4h, v1.4h
35 ; CHECK-NEXT: mov h1, v0.h[1]
36 ; CHECK-NEXT: mov h2, v0.h[2]
37 ; CHECK-NEXT: fadd h1, h0, h1
38 ; CHECK-NEXT: fadd h1, h1, h2
39 ; CHECK-NEXT: mov h0, v0.h[3]
40 ; CHECK-NEXT: fadd h0, h1, h0
43 ; CHECKNOFP16-LABEL: add_H:
44 ; CHECKNOFP16-NOT: faddp
45 ; CHECKNOFP16-NOT: fadd h{{[0-9]+}}
46 ; CHECKNOFP16-NOT: fadd v{{[0-9]+}}.{{[0-9]}}h
48 %r = call fast half @llvm.experimental.vector.reduce.v2.fadd.f16.v8f16(half 0.0, <8 x half> %bin.rdx)
52 define float @add_S(<4 x float> %bin.rdx) {
54 ; CHECK: ext v1.16b, v0.16b, v0.16b, #8
55 ; CHECK-NEXT: fadd v0.2s, v0.2s, v1.2s
56 ; CHECK-NEXT: faddp s0, v0.2s
58 %r = call fast float @llvm.experimental.vector.reduce.v2.fadd.f32.v4f32(float 0.0, <4 x float> %bin.rdx)
62 define double @add_D(<2 x double> %bin.rdx) {
64 ; CHECK: faddp d0, v0.2d
66 %r = call fast double @llvm.experimental.vector.reduce.v2.fadd.f64.v2f64(double 0.0, <2 x double> %bin.rdx)
70 define half @add_2H(<16 x half> %bin.rdx) {
71 ; CHECK-LABEL: add_2H:
72 ; CHECK: fadd v0.8h, v0.8h, v1.8h
73 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
74 ; CHECK-NEXT: fadd v0.4h, v0.4h, v1.4h
75 ; CHECK-NEXT: mov h1, v0.h[1]
76 ; CHECK-NEXT: mov h2, v0.h[2]
77 ; CHECK-NEXT: fadd h1, h0, h1
78 ; CHECK-NEXT: fadd h1, h1, h2
79 ; CHECK-NEXT: mov h0, v0.h[3]
80 ; CHECK-NEXT: fadd h0, h1, h0
82 ; CHECKNOFP16-LABEL: add_2H:
83 ; CHECKNOFP16-NOT: faddp
84 ; CHECKNOFP16-NOT: fadd h{{[0-9]+}}
85 ; CHECKNOFP16-NOT: fadd v{{[0-9]+}}.{{[0-9]}}h
87 %r = call fast half @llvm.experimental.vector.reduce.v2.fadd.f16.v16f16(half 0.0, <16 x half> %bin.rdx)
91 define float @add_2S(<8 x float> %bin.rdx) {
92 ; CHECK-LABEL: add_2S:
93 ; CHECK: fadd v0.4s, v0.4s, v1.4s
94 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #8
95 ; CHECK-NEXT: fadd v0.2s, v0.2s, v1.2s
96 ; CHECK-NEXT: faddp s0, v0.2s
98 %r = call fast float @llvm.experimental.vector.reduce.v2.fadd.f32.v8f32(float 0.0, <8 x float> %bin.rdx)
102 define double @add_2D(<4 x double> %bin.rdx) {
103 ; CHECK-LABEL: add_2D:
104 ; CHECK: fadd v0.2d, v0.2d, v1.2d
105 ; CHECK-NEXT: faddp d0, v0.2d
107 %r = call fast double @llvm.experimental.vector.reduce.v2.fadd.f64.v4f64(double 0.0, <4 x double> %bin.rdx)
111 ; Function Attrs: nounwind readnone
112 declare half @llvm.experimental.vector.reduce.v2.fadd.f16.v4f16(half, <4 x half>)
113 declare half @llvm.experimental.vector.reduce.v2.fadd.f16.v8f16(half, <8 x half>)
114 declare half @llvm.experimental.vector.reduce.v2.fadd.f16.v16f16(half, <16 x half>)
115 declare float @llvm.experimental.vector.reduce.v2.fadd.f32.v2f32(float, <2 x float>)
116 declare float @llvm.experimental.vector.reduce.v2.fadd.f32.v4f32(float, <4 x float>)
117 declare float @llvm.experimental.vector.reduce.v2.fadd.f32.v8f32(float, <8 x float>)
118 declare double @llvm.experimental.vector.reduce.v2.fadd.f64.v2f64(double, <2 x double>)
119 declare double @llvm.experimental.vector.reduce.v2.fadd.f64.v4f64(double, <4 x double>)