1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -enable-ppc-gen-scalar-mass -verify-machineinstrs -O3 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck --check-prefix=CHECK-LNX %s
3 ; RUN: llc -enable-ppc-gen-scalar-mass -verify-machineinstrs -O3 -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck --check-prefix=CHECK-AIX %s
5 declare float @llvm.pow.f32 (float, float);
6 declare double @llvm.pow.f64 (double, double);
8 ; fast-math powf with 0.25
9 ; TODO: pow->sqrt conversion for AIX
10 define float @llvmintr_powf_f32_fast025(float %a) #1 {
11 ; CHECK-LNX-LABEL: llvmintr_powf_f32_fast025:
12 ; CHECK-LNX: # %bb.0: # %entry
13 ; CHECK-LNX-NEXT: xsrsqrtesp 2, 1
14 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI0_0@toc@ha
15 ; CHECK-LNX-NEXT: vspltisw 2, -3
16 ; CHECK-LNX-NEXT: lfs 0, .LCPI0_0@toc@l(3)
17 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI0_1@toc@ha
18 ; CHECK-LNX-NEXT: xxlxor 5, 5, 5
19 ; CHECK-LNX-NEXT: xsmulsp 3, 1, 2
20 ; CHECK-LNX-NEXT: xsabsdp 1, 1
21 ; CHECK-LNX-NEXT: xsmulsp 4, 3, 0
22 ; CHECK-LNX-NEXT: xsmulsp 2, 3, 2
23 ; CHECK-LNX-NEXT: xvcvsxwdp 3, 34
24 ; CHECK-LNX-NEXT: xsaddsp 2, 2, 3
25 ; CHECK-LNX-NEXT: xsmulsp 2, 4, 2
26 ; CHECK-LNX-NEXT: lfs 4, .LCPI0_1@toc@l(3)
27 ; CHECK-LNX-NEXT: xssubsp 1, 1, 4
28 ; CHECK-LNX-NEXT: fsel 1, 1, 2, 5
29 ; CHECK-LNX-NEXT: xsrsqrtesp 2, 1
30 ; CHECK-LNX-NEXT: xsmulsp 6, 1, 2
31 ; CHECK-LNX-NEXT: xsabsdp 1, 1
32 ; CHECK-LNX-NEXT: xsmulsp 2, 6, 2
33 ; CHECK-LNX-NEXT: xsmulsp 0, 6, 0
34 ; CHECK-LNX-NEXT: xssubsp 1, 1, 4
35 ; CHECK-LNX-NEXT: xsaddsp 2, 2, 3
36 ; CHECK-LNX-NEXT: xsmulsp 0, 0, 2
37 ; CHECK-LNX-NEXT: fsel 1, 1, 0, 5
40 ; CHECK-AIX-LABEL: llvmintr_powf_f32_fast025:
41 ; CHECK-AIX: # %bb.0: # %entry
42 ; CHECK-AIX-NEXT: mflr 0
43 ; CHECK-AIX-NEXT: stwu 1, -64(1)
44 ; CHECK-AIX-NEXT: lwz 3, L..C0(2) # %const.0
45 ; CHECK-AIX-NEXT: stw 0, 72(1)
46 ; CHECK-AIX-NEXT: lfs 2, 0(3)
47 ; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]
49 ; CHECK-AIX-NEXT: addi 1, 1, 64
50 ; CHECK-AIX-NEXT: lwz 0, 8(1)
51 ; CHECK-AIX-NEXT: mtlr 0
54 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 2.500000e-01)
58 ; fast-math pow with 0.25
59 ; TODO: pow->sqrt conversion for AIX
60 define double @llvmintr_pow_f64_fast025(double %a) #1 {
61 ; CHECK-LNX-LABEL: llvmintr_pow_f64_fast025:
62 ; CHECK-LNX: # %bb.0: # %entry
63 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
64 ; CHECK-LNX-NEXT: vspltisw 2, -3
65 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI1_0@toc@ha
66 ; CHECK-LNX-NEXT: xvcvsxwdp 2, 34
67 ; CHECK-LNX-NEXT: lfs 0, .LCPI1_0@toc@l(3)
68 ; CHECK-LNX-NEXT: bc 12, 2, .LBB1_3
69 ; CHECK-LNX-NEXT: # %bb.1: # %entry
70 ; CHECK-LNX-NEXT: xsrsqrtedp 3, 1
71 ; CHECK-LNX-NEXT: xsmuldp 5, 1, 3
72 ; CHECK-LNX-NEXT: xsmuldp 4, 3, 0
73 ; CHECK-LNX-NEXT: xsmuldp 3, 5, 3
74 ; CHECK-LNX-NEXT: xsadddp 3, 3, 2
75 ; CHECK-LNX-NEXT: xsmuldp 3, 4, 3
76 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 3
77 ; CHECK-LNX-NEXT: xsmuldp 3, 1, 3
78 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 0
79 ; CHECK-LNX-NEXT: xsadddp 3, 3, 2
80 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 3
81 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
82 ; CHECK-LNX-NEXT: bc 4, 2, .LBB1_4
83 ; CHECK-LNX-NEXT: .LBB1_2:
84 ; CHECK-LNX-NEXT: xssqrtdp 1, 1
86 ; CHECK-LNX-NEXT: .LBB1_3:
87 ; CHECK-LNX-NEXT: xssqrtdp 1, 1
88 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
89 ; CHECK-LNX-NEXT: bc 12, 2, .LBB1_2
90 ; CHECK-LNX-NEXT: .LBB1_4: # %entry
91 ; CHECK-LNX-NEXT: xsrsqrtedp 3, 1
92 ; CHECK-LNX-NEXT: xsmuldp 4, 1, 3
93 ; CHECK-LNX-NEXT: xsmuldp 4, 4, 3
94 ; CHECK-LNX-NEXT: xsmuldp 3, 3, 0
95 ; CHECK-LNX-NEXT: xsadddp 4, 4, 2
96 ; CHECK-LNX-NEXT: xsmuldp 3, 3, 4
97 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 3
98 ; CHECK-LNX-NEXT: xsmuldp 3, 1, 3
99 ; CHECK-LNX-NEXT: xsmuldp 0, 1, 0
100 ; CHECK-LNX-NEXT: xsadddp 2, 3, 2
101 ; CHECK-LNX-NEXT: xsmuldp 1, 0, 2
102 ; CHECK-LNX-NEXT: blr
104 ; CHECK-AIX-LABEL: llvmintr_pow_f64_fast025:
105 ; CHECK-AIX: # %bb.0: # %entry
106 ; CHECK-AIX-NEXT: mflr 0
107 ; CHECK-AIX-NEXT: stwu 1, -64(1)
108 ; CHECK-AIX-NEXT: lwz 3, L..C1(2) # %const.0
109 ; CHECK-AIX-NEXT: stw 0, 72(1)
110 ; CHECK-AIX-NEXT: lfs 2, 0(3)
111 ; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]
112 ; CHECK-AIX-NEXT: nop
113 ; CHECK-AIX-NEXT: addi 1, 1, 64
114 ; CHECK-AIX-NEXT: lwz 0, 8(1)
115 ; CHECK-AIX-NEXT: mtlr 0
116 ; CHECK-AIX-NEXT: blr
118 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 2.500000e-01)
122 ; fast-math powf with 0.75
123 ; TODO: pow->sqrt conversion for AIX
124 define float @llvmintr_powf_f32_fast075(float %a) #1 {
125 ; CHECK-LNX-LABEL: llvmintr_powf_f32_fast075:
126 ; CHECK-LNX: # %bb.0: # %entry
127 ; CHECK-LNX-NEXT: xsrsqrtesp 2, 1
128 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI2_0@toc@ha
129 ; CHECK-LNX-NEXT: vspltisw 2, -3
130 ; CHECK-LNX-NEXT: lfs 0, .LCPI2_0@toc@l(3)
131 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI2_1@toc@ha
132 ; CHECK-LNX-NEXT: xxlxor 5, 5, 5
133 ; CHECK-LNX-NEXT: xsmulsp 3, 1, 2
134 ; CHECK-LNX-NEXT: xsabsdp 1, 1
135 ; CHECK-LNX-NEXT: xsmulsp 4, 3, 0
136 ; CHECK-LNX-NEXT: xsmulsp 2, 3, 2
137 ; CHECK-LNX-NEXT: xvcvsxwdp 3, 34
138 ; CHECK-LNX-NEXT: xsaddsp 2, 2, 3
139 ; CHECK-LNX-NEXT: xsmulsp 2, 4, 2
140 ; CHECK-LNX-NEXT: lfs 4, .LCPI2_1@toc@l(3)
141 ; CHECK-LNX-NEXT: xssubsp 1, 1, 4
142 ; CHECK-LNX-NEXT: fsel 1, 1, 2, 5
143 ; CHECK-LNX-NEXT: xsrsqrtesp 2, 1
144 ; CHECK-LNX-NEXT: xsmulsp 6, 1, 2
145 ; CHECK-LNX-NEXT: xsmulsp 2, 6, 2
146 ; CHECK-LNX-NEXT: xsmulsp 0, 6, 0
147 ; CHECK-LNX-NEXT: xsaddsp 2, 2, 3
148 ; CHECK-LNX-NEXT: xsmulsp 0, 0, 2
149 ; CHECK-LNX-NEXT: xsabsdp 2, 1
150 ; CHECK-LNX-NEXT: xssubsp 2, 2, 4
151 ; CHECK-LNX-NEXT: fsel 0, 2, 0, 5
152 ; CHECK-LNX-NEXT: xsmulsp 1, 1, 0
153 ; CHECK-LNX-NEXT: blr
155 ; CHECK-AIX-LABEL: llvmintr_powf_f32_fast075:
156 ; CHECK-AIX: # %bb.0: # %entry
157 ; CHECK-AIX-NEXT: mflr 0
158 ; CHECK-AIX-NEXT: stwu 1, -64(1)
159 ; CHECK-AIX-NEXT: lwz 3, L..C2(2) # %const.0
160 ; CHECK-AIX-NEXT: stw 0, 72(1)
161 ; CHECK-AIX-NEXT: lfs 2, 0(3)
162 ; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]
163 ; CHECK-AIX-NEXT: nop
164 ; CHECK-AIX-NEXT: addi 1, 1, 64
165 ; CHECK-AIX-NEXT: lwz 0, 8(1)
166 ; CHECK-AIX-NEXT: mtlr 0
167 ; CHECK-AIX-NEXT: blr
169 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 7.500000e-01)
173 ; fast-math pow with 0.75
174 ; TODO: pow->sqrt conversion for AIX
175 define double @llvmintr_pow_f64_fast075(double %a) #1 {
176 ; CHECK-LNX-LABEL: llvmintr_pow_f64_fast075:
177 ; CHECK-LNX: # %bb.0: # %entry
178 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
179 ; CHECK-LNX-NEXT: vspltisw 2, -3
180 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI3_0@toc@ha
181 ; CHECK-LNX-NEXT: xvcvsxwdp 2, 34
182 ; CHECK-LNX-NEXT: lfs 0, .LCPI3_0@toc@l(3)
183 ; CHECK-LNX-NEXT: bc 12, 2, .LBB3_3
184 ; CHECK-LNX-NEXT: # %bb.1: # %entry
185 ; CHECK-LNX-NEXT: xsrsqrtedp 3, 1
186 ; CHECK-LNX-NEXT: xsmuldp 5, 1, 3
187 ; CHECK-LNX-NEXT: xsmuldp 4, 3, 0
188 ; CHECK-LNX-NEXT: xsmuldp 3, 5, 3
189 ; CHECK-LNX-NEXT: xsadddp 3, 3, 2
190 ; CHECK-LNX-NEXT: xsmuldp 3, 4, 3
191 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 3
192 ; CHECK-LNX-NEXT: xsmuldp 3, 1, 3
193 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 0
194 ; CHECK-LNX-NEXT: xsadddp 3, 3, 2
195 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 3
196 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
197 ; CHECK-LNX-NEXT: bc 4, 2, .LBB3_4
198 ; CHECK-LNX-NEXT: .LBB3_2:
199 ; CHECK-LNX-NEXT: xssqrtdp 0, 1
200 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 0
201 ; CHECK-LNX-NEXT: blr
202 ; CHECK-LNX-NEXT: .LBB3_3:
203 ; CHECK-LNX-NEXT: xssqrtdp 1, 1
204 ; CHECK-LNX-NEXT: xstsqrtdp 0, 1
205 ; CHECK-LNX-NEXT: bc 12, 2, .LBB3_2
206 ; CHECK-LNX-NEXT: .LBB3_4: # %entry
207 ; CHECK-LNX-NEXT: xsrsqrtedp 3, 1
208 ; CHECK-LNX-NEXT: xsmuldp 4, 1, 3
209 ; CHECK-LNX-NEXT: xsmuldp 4, 4, 3
210 ; CHECK-LNX-NEXT: xsmuldp 3, 3, 0
211 ; CHECK-LNX-NEXT: xsadddp 4, 4, 2
212 ; CHECK-LNX-NEXT: xsmuldp 3, 3, 4
213 ; CHECK-LNX-NEXT: xsmuldp 4, 1, 3
214 ; CHECK-LNX-NEXT: xsmuldp 3, 4, 3
215 ; CHECK-LNX-NEXT: xsmuldp 0, 4, 0
216 ; CHECK-LNX-NEXT: xsadddp 2, 3, 2
217 ; CHECK-LNX-NEXT: xsmuldp 0, 0, 2
218 ; CHECK-LNX-NEXT: xsmuldp 1, 1, 0
219 ; CHECK-LNX-NEXT: blr
221 ; CHECK-AIX-LABEL: llvmintr_pow_f64_fast075:
222 ; CHECK-AIX: # %bb.0: # %entry
223 ; CHECK-AIX-NEXT: mflr 0
224 ; CHECK-AIX-NEXT: stwu 1, -64(1)
225 ; CHECK-AIX-NEXT: lwz 3, L..C3(2) # %const.0
226 ; CHECK-AIX-NEXT: stw 0, 72(1)
227 ; CHECK-AIX-NEXT: lfs 2, 0(3)
228 ; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]
229 ; CHECK-AIX-NEXT: nop
230 ; CHECK-AIX-NEXT: addi 1, 1, 64
231 ; CHECK-AIX-NEXT: lwz 0, 8(1)
232 ; CHECK-AIX-NEXT: mtlr 0
233 ; CHECK-AIX-NEXT: blr
235 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 7.500000e-01)
239 ; fast-math powf with 0.50
240 ; TODO: pow->sqrt conversion for LinuxLE and AIX
241 define float @llvmintr_powf_f32_fast050(float %a) #1 {
242 ; CHECK-LNX-LABEL: llvmintr_powf_f32_fast050:
243 ; CHECK-LNX: # %bb.0: # %entry
244 ; CHECK-LNX-NEXT: mflr 0
245 ; CHECK-LNX-NEXT: stdu 1, -32(1)
246 ; CHECK-LNX-NEXT: std 0, 48(1)
247 ; CHECK-LNX-NEXT: .cfi_def_cfa_offset 32
248 ; CHECK-LNX-NEXT: .cfi_offset lr, 16
249 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI4_0@toc@ha
250 ; CHECK-LNX-NEXT: lfs 2, .LCPI4_0@toc@l(3)
251 ; CHECK-LNX-NEXT: bl __xl_powf_finite
252 ; CHECK-LNX-NEXT: nop
253 ; CHECK-LNX-NEXT: addi 1, 1, 32
254 ; CHECK-LNX-NEXT: ld 0, 16(1)
255 ; CHECK-LNX-NEXT: mtlr 0
256 ; CHECK-LNX-NEXT: blr
258 ; CHECK-AIX-LABEL: llvmintr_powf_f32_fast050:
259 ; CHECK-AIX: # %bb.0: # %entry
260 ; CHECK-AIX-NEXT: mflr 0
261 ; CHECK-AIX-NEXT: stwu 1, -64(1)
262 ; CHECK-AIX-NEXT: lwz 3, L..C4(2) # %const.0
263 ; CHECK-AIX-NEXT: stw 0, 72(1)
264 ; CHECK-AIX-NEXT: lfs 2, 0(3)
265 ; CHECK-AIX-NEXT: bl .__xl_powf_finite[PR]
266 ; CHECK-AIX-NEXT: nop
267 ; CHECK-AIX-NEXT: addi 1, 1, 64
268 ; CHECK-AIX-NEXT: lwz 0, 8(1)
269 ; CHECK-AIX-NEXT: mtlr 0
270 ; CHECK-AIX-NEXT: blr
272 %call = tail call nnan ninf afn nsz float @llvm.pow.f32(float %a, float 5.000000e-01)
276 ; fast-math pow with 0.50
277 ; TODO: pow->sqrt conversion for LinuxLE and AIX
278 define double @llvmintr_pow_f64_fast050(double %a) #1 {
279 ; CHECK-LNX-LABEL: llvmintr_pow_f64_fast050:
280 ; CHECK-LNX: # %bb.0: # %entry
281 ; CHECK-LNX-NEXT: mflr 0
282 ; CHECK-LNX-NEXT: stdu 1, -32(1)
283 ; CHECK-LNX-NEXT: std 0, 48(1)
284 ; CHECK-LNX-NEXT: .cfi_def_cfa_offset 32
285 ; CHECK-LNX-NEXT: .cfi_offset lr, 16
286 ; CHECK-LNX-NEXT: addis 3, 2, .LCPI5_0@toc@ha
287 ; CHECK-LNX-NEXT: lfs 2, .LCPI5_0@toc@l(3)
288 ; CHECK-LNX-NEXT: bl __xl_pow_finite
289 ; CHECK-LNX-NEXT: nop
290 ; CHECK-LNX-NEXT: addi 1, 1, 32
291 ; CHECK-LNX-NEXT: ld 0, 16(1)
292 ; CHECK-LNX-NEXT: mtlr 0
293 ; CHECK-LNX-NEXT: blr
295 ; CHECK-AIX-LABEL: llvmintr_pow_f64_fast050:
296 ; CHECK-AIX: # %bb.0: # %entry
297 ; CHECK-AIX-NEXT: mflr 0
298 ; CHECK-AIX-NEXT: stwu 1, -64(1)
299 ; CHECK-AIX-NEXT: lwz 3, L..C5(2) # %const.0
300 ; CHECK-AIX-NEXT: stw 0, 72(1)
301 ; CHECK-AIX-NEXT: lfs 2, 0(3)
302 ; CHECK-AIX-NEXT: bl .__xl_pow_finite[PR]
303 ; CHECK-AIX-NEXT: nop
304 ; CHECK-AIX-NEXT: addi 1, 1, 64
305 ; CHECK-AIX-NEXT: lwz 0, 8(1)
306 ; CHECK-AIX-NEXT: mtlr 0
307 ; CHECK-AIX-NEXT: blr
309 %call = tail call nnan ninf afn nsz double @llvm.pow.f64(double %a, double 5.000000e-01)
312 attributes #1 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "approx-func-fp-math"="true" }