1; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -mattr=+neon | FileCheck %s
2
3define float @frecp0(float %x) #0 {
4  %div = fdiv fast float 1.0, %x
5  ret float %div
6
7; CHECK-LABEL: frecp0:
8; CHECK-NEXT: %bb.0
9; CHECK-NEXT: fmov
10; CHECK-NEXT: fdiv
11}
12
13define float @frecp1(float %x) #1 {
14  %div = fdiv fast float 1.0, %x
15  ret float %div
16
17; CHECK-LABEL: frecp1:
18; CHECK-NEXT: %bb.0
19; CHECK-NEXT: frecpe [[R:s[0-7]]]
20; CHECK-NEXT: frecps {{s[0-7](, s[0-7])?}}, [[R]]
21; CHECK: frecps {{s[0-7]}}, {{s[0-7]}}, {{s[0-7]}}
22; CHECK-NOT: frecps {{s[0-7]}}, {{s[0-7]}}, {{s[0-7]}}
23}
24
25define <2 x float> @f2recp0(<2 x float> %x) #0 {
26  %div = fdiv fast <2 x float> <float 1.0, float 1.0>, %x
27  ret <2 x float> %div
28
29; CHECK-LABEL: f2recp0:
30; CHECK-NEXT: %bb.0
31; CHECK-NEXT: fmov
32; CHECK-NEXT: fdiv
33}
34
35define <2 x float> @f2recp1(<2 x float> %x) #1 {
36  %div = fdiv fast <2 x float> <float 1.0, float 1.0>, %x
37  ret <2 x float> %div
38
39; CHECK-LABEL: f2recp1:
40; CHECK-NEXT: %bb.0
41; CHECK-NEXT: frecpe [[R:v[0-7]\.2s]]
42; CHECK-NEXT: frecps {{v[0-7]\.2s(, v[0-7].2s)?}}, [[R]]
43; CHECK: frecps {{v[0-7]\.2s}}, {{v[0-7]\.2s}}, {{v[0-7]\.2s}}
44; CHECK-NOT: frecps {{v[0-7]\.2s}}, {{v[0-7]\.2s}}, {{v[0-7]\.2s}}
45}
46
47define <4 x float> @f4recp0(<4 x float> %x) #0 {
48  %div = fdiv fast <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, %x
49  ret <4 x float> %div
50
51; CHECK-LABEL: f4recp0:
52; CHECK-NEXT: %bb.0
53; CHECK-NEXT: fmov
54; CHECK-NEXT: fdiv
55}
56
57define <4 x float> @f4recp1(<4 x float> %x) #1 {
58  %div = fdiv fast <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, %x
59  ret <4 x float> %div
60
61; CHECK-LABEL: f4recp1:
62; CHECK-NEXT: %bb.0
63; CHECK-NEXT: frecpe [[R:v[0-7]\.4s]]
64; CHECK-NEXT: frecps {{v[0-7]\.4s(, v[0-7].4s)?}}, [[R]]
65; CHECK: frecps {{v[0-7]\.4s}}, {{v[0-7]\.4s}}, {{v[0-7]\.4s}}
66; CHECK-NOT: frecps {{v[0-7]\.4s}}, {{v[0-7]\.4s}}, {{v[0-7]\.4s}}
67}
68
69define <8 x float> @f8recp0(<8 x float> %x) #0 {
70  %div = fdiv fast <8 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>, %x
71  ret <8 x float> %div
72
73; CHECK-LABEL: f8recp0:
74; CHECK-NEXT: %bb.0
75; CHECK-NEXT: fmov
76; CHECK-NEXT: fdiv
77; CHECK-NEXT: fdiv
78}
79
80define <8 x float> @f8recp1(<8 x float> %x) #1 {
81  %div = fdiv fast <8 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>, %x
82  ret <8 x float> %div
83
84; CHECK-LABEL: f8recp1:
85; CHECK-NEXT: %bb.0
86; CHECK-NEXT: frecpe [[R:v[0-7]\.4s]]
87; CHECK: frecps {{v[0-7]\.4s(, v[0-7].4s)?}}, [[R]]
88; CHECK: frecps {{v[0-7]\.4s(, v[0-7].4s)?}}, {{v[0-7]\.4s}}
89; CHECK: frecps {{v[0-7]\.4s}}, {{v[0-7]\.4s}}, {{v[0-7]\.4s}}
90; CHECK: frecps {{v[0-7]\.4s}}, {{v[0-7]\.4s}}, {{v[0-7]\.4s}}
91; CHECK-NOT: frecps {{v[0-7]\.4s}}, {{v[0-7]\.4s}}, {{v[0-7]\.4s}}
92}
93
94define double @drecp0(double %x) #0 {
95  %div = fdiv fast double 1.0, %x
96  ret double %div
97
98; CHECK-LABEL: drecp0:
99; CHECK-NEXT: %bb.0
100; CHECK-NEXT: fmov
101; CHECK-NEXT: fdiv
102}
103
104define double @drecp1(double %x) #1 {
105  %div = fdiv fast double 1.0, %x
106  ret double %div
107
108; CHECK-LABEL: drecp1:
109; CHECK-NEXT: %bb.0
110; CHECK-NEXT: frecpe [[R:d[0-7]]]
111; CHECK-NEXT: frecps {{d[0-7](, d[0-7])?}}, [[R]]
112; CHECK: frecps {{d[0-7]}}, {{d[0-7]}}, {{d[0-7]}}
113; CHECK: frecps {{d[0-7]}}, {{d[0-7]}}, {{d[0-7]}}
114; CHECK-NOT: frecps {{d[0-7]}}, {{d[0-7]}}, {{d[0-7]}}
115}
116
117define <2 x double> @d2recp0(<2 x double> %x) #0 {
118  %div = fdiv fast <2 x double> <double 1.0, double 1.0>, %x
119  ret <2 x double> %div
120
121; CHECK-LABEL: d2recp0:
122; CHECK-NEXT: %bb.0
123; CHECK-NEXT: fmov
124; CHECK-NEXT: fdiv
125}
126
127define <2 x double> @d2recp1(<2 x double> %x) #1 {
128  %div = fdiv fast <2 x double> <double 1.0, double 1.0>, %x
129  ret <2 x double> %div
130
131; CHECK-LABEL: d2recp1:
132; CHECK-NEXT: %bb.0
133; CHECK-NEXT: frecpe [[R:v[0-7]\.2d]]
134; CHECK-NEXT: frecps {{v[0-7]\.2d(, v[0-7].2d)?}}, [[R]]
135; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
136; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
137; CHECK-NOT: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
138}
139
140define <4 x double> @d4recp0(<4 x double> %x) #0 {
141  %div = fdiv fast <4 x double> <double 1.0, double 1.0, double 1.0, double 1.0>, %x
142  ret <4 x double> %div
143
144; CHECK-LABEL: d4recp0:
145; CHECK-NEXT: %bb.0
146; CHECK-NEXT: fmov
147; CHECK-NEXT: fdiv
148; CHECK-NEXT: fdiv
149}
150
151define <4 x double> @d4recp1(<4 x double> %x) #1 {
152  %div = fdiv fast <4 x double> <double 1.0, double 1.0, double 1.0, double 1.0>, %x
153  ret <4 x double> %div
154
155; CHECK-LABEL: d4recp1:
156; CHECK-NEXT: %bb.0
157; CHECK-NEXT: frecpe [[R:v[0-7]\.2d]]
158; CHECK: frecps {{v[0-7]\.2d(, v[0-7].2d)?}}, [[R]]
159; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
160; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
161; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
162; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
163; CHECK: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
164; CHECK-NOT: frecps {{v[0-7]\.2d}}, {{v[0-7]\.2d}}, {{v[0-7]\.2d}}
165}
166
167attributes #0 = { nounwind "unsafe-fp-math"="true" }
168attributes #1 = { nounwind "unsafe-fp-math"="true" "reciprocal-estimates"="div,vec-div" }
169