1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- -fp-contract=fast \
3 ; RUN: -mattr=-vsx -disable-ppc-vsx-fma-mutation=false | FileCheck %s
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-ibm-aix-xcoff -fp-contract=fast \
5 ; RUN: -mattr=-vsx -disable-ppc-vsx-fma-mutation=false | FileCheck %s
6 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu \
7 ; RUN: -fp-contract=fast -mattr=+vsx -disable-ppc-vsx-fma-mutation=false \
8 ; RUN: -mcpu=pwr7 | FileCheck -check-prefix=CHECK-VSX %s
9 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff \
10 ; RUN: -fp-contract=fast -mattr=+vsx -disable-ppc-vsx-fma-mutation=false \
11 ; RUN: -mcpu=pwr7 -vec-extabi | FileCheck -check-prefix=CHECK-VSX %s
13 define double @test_FMADD_ASSOC1(double %A, double %B, double %C,
14 ; CHECK-LABEL: test_FMADD_ASSOC1:
16 ; CHECK-NEXT: fmul 0, 3, 4
17 ; CHECK-NEXT: fmadd 0, 1, 2, 0
18 ; CHECK-NEXT: fadd 1, 0, 5
21 ; CHECK-VSX-LABEL: test_FMADD_ASSOC1:
23 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
24 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
25 ; CHECK-VSX-NEXT: xsadddp 1, 0, 5
27 double %D, double %E) {
28 %F = fmul double %A, %B ; <double> [#uses=1]
29 %G = fmul double %C, %D ; <double> [#uses=1]
30 %H = fadd double %F, %G ; <double> [#uses=1]
31 %I = fadd double %H, %E ; <double> [#uses=1]
35 define double @test_FMADD_ASSOC2(double %A, double %B, double %C,
36 ; CHECK-LABEL: test_FMADD_ASSOC2:
38 ; CHECK-NEXT: fmul 0, 3, 4
39 ; CHECK-NEXT: fmadd 0, 1, 2, 0
40 ; CHECK-NEXT: fadd 1, 5, 0
43 ; CHECK-VSX-LABEL: test_FMADD_ASSOC2:
45 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
46 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
47 ; CHECK-VSX-NEXT: xsadddp 1, 5, 0
49 double %D, double %E) {
50 %F = fmul double %A, %B ; <double> [#uses=1]
51 %G = fmul double %C, %D ; <double> [#uses=1]
52 %H = fadd double %F, %G ; <double> [#uses=1]
53 %I = fadd double %E, %H ; <double> [#uses=1]
57 define double @test_FMSUB_ASSOC1(double %A, double %B, double %C,
58 ; CHECK-LABEL: test_FMSUB_ASSOC1:
60 ; CHECK-NEXT: fmul 0, 3, 4
61 ; CHECK-NEXT: fmadd 0, 1, 2, 0
62 ; CHECK-NEXT: fsub 1, 0, 5
65 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC1:
67 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
68 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
69 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5
71 double %D, double %E) {
72 %F = fmul double %A, %B ; <double> [#uses=1]
73 %G = fmul double %C, %D ; <double> [#uses=1]
74 %H = fadd double %F, %G ; <double> [#uses=1]
75 %I = fsub double %H, %E ; <double> [#uses=1]
79 define double @test_FMSUB_ASSOC2(double %A, double %B, double %C,
80 ; CHECK-LABEL: test_FMSUB_ASSOC2:
82 ; CHECK-NEXT: fmul 0, 3, 4
83 ; CHECK-NEXT: fmadd 0, 1, 2, 0
84 ; CHECK-NEXT: fsub 1, 5, 0
87 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC2:
89 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
90 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
91 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0
93 double %D, double %E) {
94 %F = fmul double %A, %B ; <double> [#uses=1]
95 %G = fmul double %C, %D ; <double> [#uses=1]
96 %H = fadd double %F, %G ; <double> [#uses=1]
97 %I = fsub double %E, %H ; <double> [#uses=1]
101 define double @test_FMADD_ASSOC_EXT1(float %A, float %B, double %C,
102 ; CHECK-LABEL: test_FMADD_ASSOC_EXT1:
104 ; CHECK-NEXT: fmadd 0, 1, 2, 5
105 ; CHECK-NEXT: fmadd 1, 3, 4, 0
108 ; CHECK-VSX-LABEL: test_FMADD_ASSOC_EXT1:
109 ; CHECK-VSX: # %bb.0:
110 ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5
111 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4
112 ; CHECK-VSX-NEXT: blr
113 double %D, double %E) {
114 %F = fmul float %A, %B ; <float> [#uses=1]
115 %G = fpext float %F to double ; <double> [#uses=1]
116 %H = fmul double %C, %D ; <double> [#uses=1]
117 %I = fadd double %H, %G ; <double> [#uses=1]
118 %J = fadd double %I, %E ; <double> [#uses=1]
122 define double @test_FMADD_ASSOC_EXT2(float %A, float %B, float %C,
123 ; CHECK-LABEL: test_FMADD_ASSOC_EXT2:
125 ; CHECK-NEXT: fmadd 0, 3, 4, 5
126 ; CHECK-NEXT: fmadd 1, 1, 2, 0
129 ; CHECK-VSX-LABEL: test_FMADD_ASSOC_EXT2:
130 ; CHECK-VSX: # %bb.0:
131 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
132 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
133 ; CHECK-VSX-NEXT: fmr 1, 3
134 ; CHECK-VSX-NEXT: blr
135 float %D, double %E) {
136 %F = fmul float %A, %B ; <float> [#uses=1]
137 %G = fmul float %C, %D ; <float> [#uses=1]
138 %H = fadd float %F, %G ; <float> [#uses=1]
139 %I = fpext float %H to double ; <double> [#uses=1]
140 %J = fadd double %I, %E ; <double> [#uses=1]
144 define double @test_FMADD_ASSOC_EXT3(float %A, float %B, double %C,
145 ; CHECK-LABEL: test_FMADD_ASSOC_EXT3:
147 ; CHECK-NEXT: fmadd 0, 1, 2, 5
148 ; CHECK-NEXT: fmadd 1, 3, 4, 0
151 ; CHECK-VSX-LABEL: test_FMADD_ASSOC_EXT3:
152 ; CHECK-VSX: # %bb.0:
153 ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5
154 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4
155 ; CHECK-VSX-NEXT: blr
156 double %D, double %E) {
157 %F = fmul float %A, %B ; <float> [#uses=1]
158 %G = fpext float %F to double ; <double> [#uses=1]
159 %H = fmul double %C, %D ; <double> [#uses=1]
160 %I = fadd double %H, %G ; <double> [#uses=1]
161 %J = fadd double %E, %I ; <double> [#uses=1]
165 define double @test_FMADD_ASSOC_EXT4(float %A, float %B, float %C,
166 ; CHECK-LABEL: test_FMADD_ASSOC_EXT4:
168 ; CHECK-NEXT: fmadd 0, 3, 4, 5
169 ; CHECK-NEXT: fmadd 1, 1, 2, 0
172 ; CHECK-VSX-LABEL: test_FMADD_ASSOC_EXT4:
173 ; CHECK-VSX: # %bb.0:
174 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
175 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
176 ; CHECK-VSX-NEXT: fmr 1, 3
177 ; CHECK-VSX-NEXT: blr
178 float %D, double %E) {
179 %F = fmul float %A, %B ; <float> [#uses=1]
180 %G = fmul float %C, %D ; <float> [#uses=1]
181 %H = fadd float %F, %G ; <float> [#uses=1]
182 %I = fpext float %H to double ; <double> [#uses=1]
183 %J = fadd double %E, %I ; <double> [#uses=1]
187 define double @test_FMSUB_ASSOC_EXT1(float %A, float %B, double %C,
188 ; CHECK-LABEL: test_FMSUB_ASSOC_EXT1:
190 ; CHECK-NEXT: fmuls 0, 1, 2
191 ; CHECK-NEXT: fmadd 0, 3, 4, 0
192 ; CHECK-NEXT: fsub 1, 0, 5
195 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC_EXT1:
196 ; CHECK-VSX: # %bb.0:
197 ; CHECK-VSX-NEXT: fmuls 0, 1, 2
198 ; CHECK-VSX-NEXT: xsmaddadp 0, 3, 4
199 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5
200 ; CHECK-VSX-NEXT: blr
201 double %D, double %E) {
202 %F = fmul float %A, %B ; <float> [#uses=1]
203 %G = fpext float %F to double ; <double> [#uses=1]
204 %H = fmul double %C, %D ; <double> [#uses=1]
205 %I = fadd double %H, %G ; <double> [#uses=1]
206 %J = fsub double %I, %E ; <double> [#uses=1]
210 define double @test_FMSUB_ASSOC_EXT2(float %A, float %B, float %C,
211 ; CHECK-LABEL: test_FMSUB_ASSOC_EXT2:
213 ; CHECK-NEXT: fmuls 0, 3, 4
214 ; CHECK-NEXT: fmadds 0, 1, 2, 0
215 ; CHECK-NEXT: fsub 1, 0, 5
218 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC_EXT2:
219 ; CHECK-VSX: # %bb.0:
220 ; CHECK-VSX-NEXT: fmuls 0, 3, 4
221 ; CHECK-VSX-NEXT: fmadds 0, 1, 2, 0
222 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5
223 ; CHECK-VSX-NEXT: blr
224 float %D, double %E) {
225 %F = fmul float %A, %B ; <float> [#uses=1]
226 %G = fmul float %C, %D ; <float> [#uses=1]
227 %H = fadd float %F, %G ; <float> [#uses=1]
228 %I = fpext float %H to double ; <double> [#uses=1]
229 %J = fsub double %I, %E ; <double> [#uses=1]
233 define double @test_FMSUB_ASSOC_EXT3(float %A, float %B, double %C,
234 ; CHECK-LABEL: test_FMSUB_ASSOC_EXT3:
236 ; CHECK-NEXT: fmuls 0, 1, 2
237 ; CHECK-NEXT: fmadd 0, 3, 4, 0
238 ; CHECK-NEXT: fsub 1, 5, 0
241 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC_EXT3:
242 ; CHECK-VSX: # %bb.0:
243 ; CHECK-VSX-NEXT: fmuls 0, 1, 2
244 ; CHECK-VSX-NEXT: xsmaddadp 0, 3, 4
245 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0
246 ; CHECK-VSX-NEXT: blr
247 double %D, double %E) {
248 %F = fmul float %A, %B ; <float> [#uses=1]
249 %G = fpext float %F to double ; <double> [#uses=1]
250 %H = fmul double %C, %D ; <double> [#uses=1]
251 %I = fadd double %H, %G ; <double> [#uses=1]
252 %J = fsub double %E, %I ; <double> [#uses=1]
256 define double @test_FMSUB_ASSOC_EXT4(float %A, float %B, float %C,
257 ; CHECK-LABEL: test_FMSUB_ASSOC_EXT4:
259 ; CHECK-NEXT: fmuls 0, 3, 4
260 ; CHECK-NEXT: fmadds 0, 1, 2, 0
261 ; CHECK-NEXT: fsub 1, 5, 0
264 ; CHECK-VSX-LABEL: test_FMSUB_ASSOC_EXT4:
265 ; CHECK-VSX: # %bb.0:
266 ; CHECK-VSX-NEXT: fmuls 0, 3, 4
267 ; CHECK-VSX-NEXT: fmadds 0, 1, 2, 0
268 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0
269 ; CHECK-VSX-NEXT: blr
270 float %D, double %E) {
271 %F = fmul float %A, %B ; <float> [#uses=1]
272 %G = fmul float %C, %D ; <float> [#uses=1]
273 %H = fadd float %F, %G ; <float> [#uses=1]
274 %I = fpext float %H to double ; <double> [#uses=1]
275 %J = fsub double %E, %I ; <double> [#uses=1]
279 define double @test_reassoc_FMADD_ASSOC1(double %A, double %B, double %C,
280 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC1:
282 ; CHECK-NEXT: fmadd 0, 3, 4, 5
283 ; CHECK-NEXT: fmadd 1, 1, 2, 0
286 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC1:
287 ; CHECK-VSX: # %bb.0:
288 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
289 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
290 ; CHECK-VSX-NEXT: fmr 1, 3
291 ; CHECK-VSX-NEXT: blr
292 double %D, double %E) {
293 %F = fmul reassoc double %A, %B ; <double> [#uses=1]
294 %G = fmul reassoc double %C, %D ; <double> [#uses=1]
295 %H = fadd reassoc double %F, %G ; <double> [#uses=1]
296 %I = fadd reassoc double %H, %E ; <double> [#uses=1]
300 define double @test_reassoc_FMADD_ASSOC2(double %A, double %B, double %C,
301 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC2:
303 ; CHECK-NEXT: fmadd 0, 3, 4, 5
304 ; CHECK-NEXT: fmadd 1, 1, 2, 0
307 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC2:
308 ; CHECK-VSX: # %bb.0:
309 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
310 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
311 ; CHECK-VSX-NEXT: fmr 1, 3
312 ; CHECK-VSX-NEXT: blr
313 double %D, double %E) {
314 %F = fmul reassoc double %A, %B ; <double> [#uses=1]
315 %G = fmul reassoc double %C, %D ; <double> [#uses=1]
316 %H = fadd reassoc double %F, %G ; <double> [#uses=1]
317 %I = fadd reassoc double %E, %H ; <double> [#uses=1]
321 ; FIXME: -ffp-contract=fast does NOT work here?
322 define double @test_reassoc_FMSUB_ASSOC1(double %A, double %B, double %C,
323 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC1:
325 ; CHECK-NEXT: fmul 0, 3, 4
326 ; CHECK-NEXT: fmadd 0, 1, 2, 0
327 ; CHECK-NEXT: fsub 1, 0, 5
330 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC1:
331 ; CHECK-VSX: # %bb.0:
332 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
333 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
334 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5
335 ; CHECK-VSX-NEXT: blr
336 double %D, double %E) {
337 %F = fmul reassoc double %A, %B ; <double> [#uses=1]
338 %G = fmul reassoc double %C, %D ; <double> [#uses=1]
339 %H = fadd reassoc double %F, %G ; <double> [#uses=1]
340 %I = fsub reassoc double %H, %E ; <double> [#uses=1]
344 define double @test_reassoc_FMSUB_ASSOC11(double %A, double %B, double %C,
345 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC11:
347 ; CHECK-NEXT: fmsub 0, 3, 4, 5
348 ; CHECK-NEXT: fmadd 1, 1, 2, 0
351 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC11:
352 ; CHECK-VSX: # %bb.0:
353 ; CHECK-VSX-NEXT: xsmsubmdp 3, 4, 5
354 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
355 ; CHECK-VSX-NEXT: fmr 1, 3
356 ; CHECK-VSX-NEXT: blr
357 double %D, double %E) {
358 %F = fmul contract reassoc double %A, %B ; <double> [#uses=1]
359 %G = fmul contract reassoc double %C, %D ; <double> [#uses=1]
360 %H = fadd contract reassoc double %F, %G ; <double> [#uses=1]
361 %I = fsub contract reassoc double %H, %E ; <double> [#uses=1]
366 define double @test_reassoc_FMSUB_ASSOC2(double %A, double %B, double %C,
367 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC2:
369 ; CHECK-NEXT: fmul 0, 3, 4
370 ; CHECK-NEXT: fmadd 0, 1, 2, 0
371 ; CHECK-NEXT: fsub 1, 5, 0
374 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC2:
375 ; CHECK-VSX: # %bb.0:
376 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
377 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
378 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0
379 ; CHECK-VSX-NEXT: blr
380 double %D, double %E) {
381 %F = fmul reassoc double %A, %B ; <double> [#uses=1]
382 %G = fmul reassoc double %C, %D ; <double> [#uses=1]
383 %H = fadd reassoc double %F, %G ; <double> [#uses=1]
384 %I = fsub reassoc double %E, %H ; <double> [#uses=1]
388 define double @test_fast_FMSUB_ASSOC2(double %A, double %B, double %C,
389 ; CHECK-LABEL: test_fast_FMSUB_ASSOC2:
391 ; CHECK-NEXT: fmul 0, 3, 4
392 ; CHECK-NEXT: fmadd 0, 1, 2, 0
393 ; CHECK-NEXT: fsub 1, 5, 0
396 ; CHECK-VSX-LABEL: test_fast_FMSUB_ASSOC2:
397 ; CHECK-VSX: # %bb.0:
398 ; CHECK-VSX-NEXT: xsmuldp 0, 3, 4
399 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
400 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0
401 ; CHECK-VSX-NEXT: blr
402 double %D, double %E) {
403 %F = fmul reassoc double %A, %B ; <double> [#uses=1]
404 %G = fmul reassoc double %C, %D ; <double> [#uses=1]
405 %H = fadd reassoc double %F, %G ; <double> [#uses=1]
406 %I = fsub reassoc nsz double %E, %H ; <double> [#uses=1]
410 define double @test_reassoc_FMADD_ASSOC_EXT1(float %A, float %B, double %C,
411 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC_EXT1:
413 ; CHECK-NEXT: fmadd 0, 1, 2, 5
414 ; CHECK-NEXT: fmadd 1, 3, 4, 0
417 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC_EXT1:
418 ; CHECK-VSX: # %bb.0:
419 ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5
420 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4
421 ; CHECK-VSX-NEXT: blr
422 double %D, double %E) {
423 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
424 %G = fpext float %F to double ; <double> [#uses=1]
425 %H = fmul reassoc double %C, %D ; <double> [#uses=1]
426 %I = fadd reassoc double %H, %G ; <double> [#uses=1]
427 %J = fadd reassoc double %I, %E ; <double> [#uses=1]
431 define double @test_reassoc_FMADD_ASSOC_EXT2(float %A, float %B, float %C,
432 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC_EXT2:
434 ; CHECK-NEXT: fmadd 0, 3, 4, 5
435 ; CHECK-NEXT: fmadd 1, 1, 2, 0
438 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC_EXT2:
439 ; CHECK-VSX: # %bb.0:
440 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
441 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
442 ; CHECK-VSX-NEXT: fmr 1, 3
443 ; CHECK-VSX-NEXT: blr
444 float %D, double %E) {
445 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
446 %G = fmul reassoc float %C, %D ; <float> [#uses=1]
447 %H = fadd reassoc float %F, %G ; <float> [#uses=1]
448 %I = fpext float %H to double ; <double> [#uses=1]
449 %J = fadd reassoc double %I, %E ; <double> [#uses=1]
453 define double @test_reassoc_FMADD_ASSOC_EXT3(float %A, float %B, double %C,
454 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC_EXT3:
456 ; CHECK-NEXT: fmadd 0, 1, 2, 5
457 ; CHECK-NEXT: fmadd 1, 3, 4, 0
460 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC_EXT3:
461 ; CHECK-VSX: # %bb.0:
462 ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5
463 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4
464 ; CHECK-VSX-NEXT: blr
465 double %D, double %E) {
466 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
467 %G = fpext float %F to double ; <double> [#uses=1]
468 %H = fmul reassoc double %C, %D ; <double> [#uses=1]
469 %I = fadd reassoc double %H, %G ; <double> [#uses=1]
470 %J = fadd reassoc double %E, %I ; <double> [#uses=1]
474 define double @test_reassoc_FMADD_ASSOC_EXT4(float %A, float %B, float %C,
475 ; CHECK-LABEL: test_reassoc_FMADD_ASSOC_EXT4:
477 ; CHECK-NEXT: fmadd 0, 3, 4, 5
478 ; CHECK-NEXT: fmadd 1, 1, 2, 0
481 ; CHECK-VSX-LABEL: test_reassoc_FMADD_ASSOC_EXT4:
482 ; CHECK-VSX: # %bb.0:
483 ; CHECK-VSX-NEXT: xsmaddmdp 3, 4, 5
484 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
485 ; CHECK-VSX-NEXT: fmr 1, 3
486 ; CHECK-VSX-NEXT: blr
487 float %D, double %E) {
488 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
489 %G = fmul reassoc float %C, %D ; <float> [#uses=1]
490 %H = fadd reassoc float %F, %G ; <float> [#uses=1]
491 %I = fpext float %H to double ; <double> [#uses=1]
492 %J = fadd reassoc double %E, %I ; <double> [#uses=1]
496 define double @test_reassoc_FMSUB_ASSOC_EXT1(float %A, float %B, double %C,
497 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC_EXT1:
499 ; CHECK-NEXT: fmsub 0, 1, 2, 5
500 ; CHECK-NEXT: fmadd 1, 3, 4, 0
503 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC_EXT1:
504 ; CHECK-VSX: # %bb.0:
505 ; CHECK-VSX-NEXT: xsmsubmdp 1, 2, 5
506 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4
507 ; CHECK-VSX-NEXT: blr
508 double %D, double %E) {
509 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
510 %G = fpext float %F to double ; <double> [#uses=1]
511 %H = fmul reassoc double %C, %D ; <double> [#uses=1]
512 %I = fadd reassoc double %H, %G ; <double> [#uses=1]
513 %J = fsub reassoc double %I, %E ; <double> [#uses=1]
517 define double @test_reassoc_FMSUB_ASSOC_EXT2(float %A, float %B, float %C,
518 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC_EXT2:
520 ; CHECK-NEXT: fmsub 0, 3, 4, 5
521 ; CHECK-NEXT: fmadd 1, 1, 2, 0
524 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC_EXT2:
525 ; CHECK-VSX: # %bb.0:
526 ; CHECK-VSX-NEXT: xsmsubmdp 3, 4, 5
527 ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2
528 ; CHECK-VSX-NEXT: fmr 1, 3
529 ; CHECK-VSX-NEXT: blr
530 float %D, double %E) {
531 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
532 %G = fmul reassoc float %C, %D ; <float> [#uses=1]
533 %H = fadd reassoc float %F, %G ; <float> [#uses=1]
534 %I = fpext float %H to double ; <double> [#uses=1]
535 %J = fsub reassoc double %I, %E ; <double> [#uses=1]
539 define double @test_reassoc_FMSUB_ASSOC_EXT3(float %A, float %B, double %C,
540 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC_EXT3:
542 ; CHECK-NEXT: fneg 0, 1
543 ; CHECK-NEXT: fmadd 0, 0, 2, 5
544 ; CHECK-NEXT: fneg 1, 3
545 ; CHECK-NEXT: fmadd 1, 1, 4, 0
548 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC_EXT3:
549 ; CHECK-VSX: # %bb.0:
550 ; CHECK-VSX-NEXT: xsnegdp 1, 1
551 ; CHECK-VSX-NEXT: xsnegdp 0, 3
552 ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5
553 ; CHECK-VSX-NEXT: xsmaddadp 1, 0, 4
554 ; CHECK-VSX-NEXT: blr
555 double %D, double %E) {
556 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
557 %G = fpext float %F to double ; <double> [#uses=1]
558 %H = fmul reassoc double %C, %D ; <double> [#uses=1]
559 %I = fadd reassoc double %H, %G ; <double> [#uses=1]
560 %J = fsub reassoc double %E, %I ; <double> [#uses=1]
564 ; fnmsub/xsnmsubadp may affect the sign of zero, we need nsz flag
565 ; to ensure generating them
566 define double @test_fast_FMSUB_ASSOC_EXT3(float %A, float %B, double %C,
567 ; CHECK-LABEL: test_fast_FMSUB_ASSOC_EXT3:
569 ; CHECK-NEXT: fnmsub 0, 1, 2, 5
570 ; CHECK-NEXT: fnmsub 1, 3, 4, 0
573 ; CHECK-VSX-LABEL: test_fast_FMSUB_ASSOC_EXT3:
574 ; CHECK-VSX: # %bb.0:
575 ; CHECK-VSX-NEXT: xsnmsubmdp 1, 2, 5
576 ; CHECK-VSX-NEXT: xsnmsubadp 1, 3, 4
577 ; CHECK-VSX-NEXT: blr
578 double %D, double %E) {
579 %F = fmul reassoc float %A, %B
580 %G = fpext float %F to double
581 %H = fmul reassoc double %C, %D
582 %I = fadd reassoc nsz double %H, %G
583 %J = fsub reassoc nsz double %E, %I
587 define double @test_reassoc_FMSUB_ASSOC_EXT4(float %A, float %B, float %C,
588 ; CHECK-LABEL: test_reassoc_FMSUB_ASSOC_EXT4:
590 ; CHECK-NEXT: fneg 0, 3
591 ; CHECK-NEXT: fmadd 0, 0, 4, 5
592 ; CHECK-NEXT: fneg 1, 1
593 ; CHECK-NEXT: fmadd 1, 1, 2, 0
596 ; CHECK-VSX-LABEL: test_reassoc_FMSUB_ASSOC_EXT4:
597 ; CHECK-VSX: # %bb.0:
598 ; CHECK-VSX-NEXT: xsnegdp 0, 3
599 ; CHECK-VSX-NEXT: xsnegdp 1, 1
600 ; CHECK-VSX-NEXT: xsmaddmdp 0, 4, 5
601 ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2
602 ; CHECK-VSX-NEXT: fmr 1, 0
603 ; CHECK-VSX-NEXT: blr
604 float %D, double %E) {
605 %F = fmul reassoc float %A, %B ; <float> [#uses=1]
606 %G = fmul reassoc float %C, %D ; <float> [#uses=1]
607 %H = fadd reassoc float %F, %G ; <float> [#uses=1]
608 %I = fpext float %H to double ; <double> [#uses=1]
609 %J = fsub reassoc double %E, %I ; <double> [#uses=1]
613 define double @test_fast_FMSUB_ASSOC_EXT4(float %A, float %B, float %C,
614 ; CHECK-LABEL: test_fast_FMSUB_ASSOC_EXT4:
616 ; CHECK-NEXT: fnmsub 0, 3, 4, 5
617 ; CHECK-NEXT: fnmsub 1, 1, 2, 0
620 ; CHECK-VSX-LABEL: test_fast_FMSUB_ASSOC_EXT4:
621 ; CHECK-VSX: # %bb.0:
622 ; CHECK-VSX-NEXT: xsnmsubmdp 3, 4, 5
623 ; CHECK-VSX-NEXT: xsnmsubadp 3, 1, 2
624 ; CHECK-VSX-NEXT: fmr 1, 3
625 ; CHECK-VSX-NEXT: blr
626 float %D, double %E) {
627 %F = fmul reassoc float %A, %B
628 %G = fmul reassoc float %C, %D
629 %H = fadd reassoc nsz float %F, %G
630 %I = fpext float %H to double
631 %J = fsub reassoc nsz double %E, %I