Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / upper-regs-df.c
blob0df579797ad22e74e6d8566c117230e303590f82
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target powerpc_vsx_ok } */
3 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power7 -O2" } */
7 /* Test to make sure double values are allocated to the Altivec registers as
8 well as the traditional FPR registers. */
10 #ifndef TYPE
11 #define TYPE double
12 #endif
14 #ifndef MASK_TYPE
15 #define MASK_TYPE unsigned long long
16 #endif
18 #define MASK_ONE ((MASK_TYPE)1)
19 #define ZERO ((TYPE) 0.0)
21 TYPE
22 test_add (const MASK_TYPE *add_mask, const TYPE *add_values,
23 const MASK_TYPE *sub_mask, const TYPE *sub_values,
24 const MASK_TYPE *mul_mask, const TYPE *mul_values,
25 const MASK_TYPE *div_mask, const TYPE *div_values,
26 const MASK_TYPE *eq0_mask, int *eq0_ptr)
28 TYPE value;
29 TYPE value00 = ZERO;
30 TYPE value01 = ZERO;
31 TYPE value02 = ZERO;
32 TYPE value03 = ZERO;
33 TYPE value04 = ZERO;
34 TYPE value05 = ZERO;
35 TYPE value06 = ZERO;
36 TYPE value07 = ZERO;
37 TYPE value08 = ZERO;
38 TYPE value09 = ZERO;
39 TYPE value10 = ZERO;
40 TYPE value11 = ZERO;
41 TYPE value12 = ZERO;
42 TYPE value13 = ZERO;
43 TYPE value14 = ZERO;
44 TYPE value15 = ZERO;
45 TYPE value16 = ZERO;
46 TYPE value17 = ZERO;
47 TYPE value18 = ZERO;
48 TYPE value19 = ZERO;
49 TYPE value20 = ZERO;
50 TYPE value21 = ZERO;
51 TYPE value22 = ZERO;
52 TYPE value23 = ZERO;
53 TYPE value24 = ZERO;
54 TYPE value25 = ZERO;
55 TYPE value26 = ZERO;
56 TYPE value27 = ZERO;
57 TYPE value28 = ZERO;
58 TYPE value29 = ZERO;
59 TYPE value30 = ZERO;
60 TYPE value31 = ZERO;
61 TYPE value32 = ZERO;
62 TYPE value33 = ZERO;
63 TYPE value34 = ZERO;
64 TYPE value35 = ZERO;
65 TYPE value36 = ZERO;
66 TYPE value37 = ZERO;
67 TYPE value38 = ZERO;
68 TYPE value39 = ZERO;
69 MASK_TYPE mask;
70 int eq0;
72 while ((mask = *add_mask++) != 0)
74 value = *add_values++;
76 __asm__ (" #reg %0" : "+d" (value));
78 if ((mask & (MASK_ONE << 0)) != 0)
79 value00 += value;
81 if ((mask & (MASK_ONE << 1)) != 0)
82 value01 += value;
84 if ((mask & (MASK_ONE << 2)) != 0)
85 value02 += value;
87 if ((mask & (MASK_ONE << 3)) != 0)
88 value03 += value;
90 if ((mask & (MASK_ONE << 4)) != 0)
91 value04 += value;
93 if ((mask & (MASK_ONE << 5)) != 0)
94 value05 += value;
96 if ((mask & (MASK_ONE << 6)) != 0)
97 value06 += value;
99 if ((mask & (MASK_ONE << 7)) != 0)
100 value07 += value;
102 if ((mask & (MASK_ONE << 8)) != 0)
103 value08 += value;
105 if ((mask & (MASK_ONE << 9)) != 0)
106 value09 += value;
108 if ((mask & (MASK_ONE << 10)) != 0)
109 value10 += value;
111 if ((mask & (MASK_ONE << 11)) != 0)
112 value11 += value;
114 if ((mask & (MASK_ONE << 12)) != 0)
115 value12 += value;
117 if ((mask & (MASK_ONE << 13)) != 0)
118 value13 += value;
120 if ((mask & (MASK_ONE << 14)) != 0)
121 value14 += value;
123 if ((mask & (MASK_ONE << 15)) != 0)
124 value15 += value;
126 if ((mask & (MASK_ONE << 16)) != 0)
127 value16 += value;
129 if ((mask & (MASK_ONE << 17)) != 0)
130 value17 += value;
132 if ((mask & (MASK_ONE << 18)) != 0)
133 value18 += value;
135 if ((mask & (MASK_ONE << 19)) != 0)
136 value19 += value;
138 if ((mask & (MASK_ONE << 20)) != 0)
139 value20 += value;
141 if ((mask & (MASK_ONE << 21)) != 0)
142 value21 += value;
144 if ((mask & (MASK_ONE << 22)) != 0)
145 value22 += value;
147 if ((mask & (MASK_ONE << 23)) != 0)
148 value23 += value;
150 if ((mask & (MASK_ONE << 24)) != 0)
151 value24 += value;
153 if ((mask & (MASK_ONE << 25)) != 0)
154 value25 += value;
156 if ((mask & (MASK_ONE << 26)) != 0)
157 value26 += value;
159 if ((mask & (MASK_ONE << 27)) != 0)
160 value27 += value;
162 if ((mask & (MASK_ONE << 28)) != 0)
163 value28 += value;
165 if ((mask & (MASK_ONE << 29)) != 0)
166 value29 += value;
168 if ((mask & (MASK_ONE << 30)) != 0)
169 value30 += value;
171 if ((mask & (MASK_ONE << 31)) != 0)
172 value31 += value;
174 if ((mask & (MASK_ONE << 32)) != 0)
175 value32 += value;
177 if ((mask & (MASK_ONE << 33)) != 0)
178 value33 += value;
180 if ((mask & (MASK_ONE << 34)) != 0)
181 value34 += value;
183 if ((mask & (MASK_ONE << 35)) != 0)
184 value35 += value;
186 if ((mask & (MASK_ONE << 36)) != 0)
187 value36 += value;
189 if ((mask & (MASK_ONE << 37)) != 0)
190 value37 += value;
192 if ((mask & (MASK_ONE << 38)) != 0)
193 value38 += value;
195 if ((mask & (MASK_ONE << 39)) != 0)
196 value39 += value;
199 while ((mask = *sub_mask++) != 0)
201 value = *sub_values++;
203 __asm__ (" #reg %0" : "+d" (value));
205 if ((mask & (MASK_ONE << 0)) != 0)
206 value00 -= value;
208 if ((mask & (MASK_ONE << 1)) != 0)
209 value01 -= value;
211 if ((mask & (MASK_ONE << 2)) != 0)
212 value02 -= value;
214 if ((mask & (MASK_ONE << 3)) != 0)
215 value03 -= value;
217 if ((mask & (MASK_ONE << 4)) != 0)
218 value04 -= value;
220 if ((mask & (MASK_ONE << 5)) != 0)
221 value05 -= value;
223 if ((mask & (MASK_ONE << 6)) != 0)
224 value06 -= value;
226 if ((mask & (MASK_ONE << 7)) != 0)
227 value07 -= value;
229 if ((mask & (MASK_ONE << 8)) != 0)
230 value08 -= value;
232 if ((mask & (MASK_ONE << 9)) != 0)
233 value09 -= value;
235 if ((mask & (MASK_ONE << 10)) != 0)
236 value10 -= value;
238 if ((mask & (MASK_ONE << 11)) != 0)
239 value11 -= value;
241 if ((mask & (MASK_ONE << 12)) != 0)
242 value12 -= value;
244 if ((mask & (MASK_ONE << 13)) != 0)
245 value13 -= value;
247 if ((mask & (MASK_ONE << 14)) != 0)
248 value14 -= value;
250 if ((mask & (MASK_ONE << 15)) != 0)
251 value15 -= value;
253 if ((mask & (MASK_ONE << 16)) != 0)
254 value16 -= value;
256 if ((mask & (MASK_ONE << 17)) != 0)
257 value17 -= value;
259 if ((mask & (MASK_ONE << 18)) != 0)
260 value18 -= value;
262 if ((mask & (MASK_ONE << 19)) != 0)
263 value19 -= value;
265 if ((mask & (MASK_ONE << 20)) != 0)
266 value20 -= value;
268 if ((mask & (MASK_ONE << 21)) != 0)
269 value21 -= value;
271 if ((mask & (MASK_ONE << 22)) != 0)
272 value22 -= value;
274 if ((mask & (MASK_ONE << 23)) != 0)
275 value23 -= value;
277 if ((mask & (MASK_ONE << 24)) != 0)
278 value24 -= value;
280 if ((mask & (MASK_ONE << 25)) != 0)
281 value25 -= value;
283 if ((mask & (MASK_ONE << 26)) != 0)
284 value26 -= value;
286 if ((mask & (MASK_ONE << 27)) != 0)
287 value27 -= value;
289 if ((mask & (MASK_ONE << 28)) != 0)
290 value28 -= value;
292 if ((mask & (MASK_ONE << 29)) != 0)
293 value29 -= value;
295 if ((mask & (MASK_ONE << 30)) != 0)
296 value30 -= value;
298 if ((mask & (MASK_ONE << 31)) != 0)
299 value31 -= value;
301 if ((mask & (MASK_ONE << 32)) != 0)
302 value32 -= value;
304 if ((mask & (MASK_ONE << 33)) != 0)
305 value33 -= value;
307 if ((mask & (MASK_ONE << 34)) != 0)
308 value34 -= value;
310 if ((mask & (MASK_ONE << 35)) != 0)
311 value35 -= value;
313 if ((mask & (MASK_ONE << 36)) != 0)
314 value36 -= value;
316 if ((mask & (MASK_ONE << 37)) != 0)
317 value37 -= value;
319 if ((mask & (MASK_ONE << 38)) != 0)
320 value38 -= value;
322 if ((mask & (MASK_ONE << 39)) != 0)
323 value39 -= value;
326 while ((mask = *mul_mask++) != 0)
328 value = *mul_values++;
330 __asm__ (" #reg %0" : "+d" (value));
332 if ((mask & (MASK_ONE << 0)) != 0)
333 value00 *= value;
335 if ((mask & (MASK_ONE << 1)) != 0)
336 value01 *= value;
338 if ((mask & (MASK_ONE << 2)) != 0)
339 value02 *= value;
341 if ((mask & (MASK_ONE << 3)) != 0)
342 value03 *= value;
344 if ((mask & (MASK_ONE << 4)) != 0)
345 value04 *= value;
347 if ((mask & (MASK_ONE << 5)) != 0)
348 value05 *= value;
350 if ((mask & (MASK_ONE << 6)) != 0)
351 value06 *= value;
353 if ((mask & (MASK_ONE << 7)) != 0)
354 value07 *= value;
356 if ((mask & (MASK_ONE << 8)) != 0)
357 value08 *= value;
359 if ((mask & (MASK_ONE << 9)) != 0)
360 value09 *= value;
362 if ((mask & (MASK_ONE << 10)) != 0)
363 value10 *= value;
365 if ((mask & (MASK_ONE << 11)) != 0)
366 value11 *= value;
368 if ((mask & (MASK_ONE << 12)) != 0)
369 value12 *= value;
371 if ((mask & (MASK_ONE << 13)) != 0)
372 value13 *= value;
374 if ((mask & (MASK_ONE << 14)) != 0)
375 value14 *= value;
377 if ((mask & (MASK_ONE << 15)) != 0)
378 value15 *= value;
380 if ((mask & (MASK_ONE << 16)) != 0)
381 value16 *= value;
383 if ((mask & (MASK_ONE << 17)) != 0)
384 value17 *= value;
386 if ((mask & (MASK_ONE << 18)) != 0)
387 value18 *= value;
389 if ((mask & (MASK_ONE << 19)) != 0)
390 value19 *= value;
392 if ((mask & (MASK_ONE << 20)) != 0)
393 value20 *= value;
395 if ((mask & (MASK_ONE << 21)) != 0)
396 value21 *= value;
398 if ((mask & (MASK_ONE << 22)) != 0)
399 value22 *= value;
401 if ((mask & (MASK_ONE << 23)) != 0)
402 value23 *= value;
404 if ((mask & (MASK_ONE << 24)) != 0)
405 value24 *= value;
407 if ((mask & (MASK_ONE << 25)) != 0)
408 value25 *= value;
410 if ((mask & (MASK_ONE << 26)) != 0)
411 value26 *= value;
413 if ((mask & (MASK_ONE << 27)) != 0)
414 value27 *= value;
416 if ((mask & (MASK_ONE << 28)) != 0)
417 value28 *= value;
419 if ((mask & (MASK_ONE << 29)) != 0)
420 value29 *= value;
422 if ((mask & (MASK_ONE << 30)) != 0)
423 value30 *= value;
425 if ((mask & (MASK_ONE << 31)) != 0)
426 value31 *= value;
428 if ((mask & (MASK_ONE << 32)) != 0)
429 value32 *= value;
431 if ((mask & (MASK_ONE << 33)) != 0)
432 value33 *= value;
434 if ((mask & (MASK_ONE << 34)) != 0)
435 value34 *= value;
437 if ((mask & (MASK_ONE << 35)) != 0)
438 value35 *= value;
440 if ((mask & (MASK_ONE << 36)) != 0)
441 value36 *= value;
443 if ((mask & (MASK_ONE << 37)) != 0)
444 value37 *= value;
446 if ((mask & (MASK_ONE << 38)) != 0)
447 value38 *= value;
449 if ((mask & (MASK_ONE << 39)) != 0)
450 value39 *= value;
453 while ((mask = *div_mask++) != 0)
455 value = *div_values++;
457 __asm__ (" #reg %0" : "+d" (value));
459 if ((mask & (MASK_ONE << 0)) != 0)
460 value00 /= value;
462 if ((mask & (MASK_ONE << 1)) != 0)
463 value01 /= value;
465 if ((mask & (MASK_ONE << 2)) != 0)
466 value02 /= value;
468 if ((mask & (MASK_ONE << 3)) != 0)
469 value03 /= value;
471 if ((mask & (MASK_ONE << 4)) != 0)
472 value04 /= value;
474 if ((mask & (MASK_ONE << 5)) != 0)
475 value05 /= value;
477 if ((mask & (MASK_ONE << 6)) != 0)
478 value06 /= value;
480 if ((mask & (MASK_ONE << 7)) != 0)
481 value07 /= value;
483 if ((mask & (MASK_ONE << 8)) != 0)
484 value08 /= value;
486 if ((mask & (MASK_ONE << 9)) != 0)
487 value09 /= value;
489 if ((mask & (MASK_ONE << 10)) != 0)
490 value10 /= value;
492 if ((mask & (MASK_ONE << 11)) != 0)
493 value11 /= value;
495 if ((mask & (MASK_ONE << 12)) != 0)
496 value12 /= value;
498 if ((mask & (MASK_ONE << 13)) != 0)
499 value13 /= value;
501 if ((mask & (MASK_ONE << 14)) != 0)
502 value14 /= value;
504 if ((mask & (MASK_ONE << 15)) != 0)
505 value15 /= value;
507 if ((mask & (MASK_ONE << 16)) != 0)
508 value16 /= value;
510 if ((mask & (MASK_ONE << 17)) != 0)
511 value17 /= value;
513 if ((mask & (MASK_ONE << 18)) != 0)
514 value18 /= value;
516 if ((mask & (MASK_ONE << 19)) != 0)
517 value19 /= value;
519 if ((mask & (MASK_ONE << 20)) != 0)
520 value20 /= value;
522 if ((mask & (MASK_ONE << 21)) != 0)
523 value21 /= value;
525 if ((mask & (MASK_ONE << 22)) != 0)
526 value22 /= value;
528 if ((mask & (MASK_ONE << 23)) != 0)
529 value23 /= value;
531 if ((mask & (MASK_ONE << 24)) != 0)
532 value24 /= value;
534 if ((mask & (MASK_ONE << 25)) != 0)
535 value25 /= value;
537 if ((mask & (MASK_ONE << 26)) != 0)
538 value26 /= value;
540 if ((mask & (MASK_ONE << 27)) != 0)
541 value27 /= value;
543 if ((mask & (MASK_ONE << 28)) != 0)
544 value28 /= value;
546 if ((mask & (MASK_ONE << 29)) != 0)
547 value29 /= value;
549 if ((mask & (MASK_ONE << 30)) != 0)
550 value30 /= value;
552 if ((mask & (MASK_ONE << 31)) != 0)
553 value31 /= value;
555 if ((mask & (MASK_ONE << 32)) != 0)
556 value32 /= value;
558 if ((mask & (MASK_ONE << 33)) != 0)
559 value33 /= value;
561 if ((mask & (MASK_ONE << 34)) != 0)
562 value34 /= value;
564 if ((mask & (MASK_ONE << 35)) != 0)
565 value35 /= value;
567 if ((mask & (MASK_ONE << 36)) != 0)
568 value36 /= value;
570 if ((mask & (MASK_ONE << 37)) != 0)
571 value37 /= value;
573 if ((mask & (MASK_ONE << 38)) != 0)
574 value38 /= value;
576 if ((mask & (MASK_ONE << 39)) != 0)
577 value39 /= value;
580 while ((mask = *eq0_mask++) != 0)
582 eq0 = 0;
584 if ((mask & (MASK_ONE << 0)) != 0)
585 eq0 |= (value00 == ZERO);
587 if ((mask & (MASK_ONE << 1)) != 0)
588 eq0 |= (value01 == ZERO);
590 if ((mask & (MASK_ONE << 2)) != 0)
591 eq0 |= (value02 == ZERO);
593 if ((mask & (MASK_ONE << 3)) != 0)
594 eq0 |= (value03 == ZERO);
596 if ((mask & (MASK_ONE << 4)) != 0)
597 eq0 |= (value04 == ZERO);
599 if ((mask & (MASK_ONE << 5)) != 0)
600 eq0 |= (value05 == ZERO);
602 if ((mask & (MASK_ONE << 6)) != 0)
603 eq0 |= (value06 == ZERO);
605 if ((mask & (MASK_ONE << 7)) != 0)
606 eq0 |= (value07 == ZERO);
608 if ((mask & (MASK_ONE << 8)) != 0)
609 eq0 |= (value08 == ZERO);
611 if ((mask & (MASK_ONE << 9)) != 0)
612 eq0 |= (value09 == ZERO);
614 if ((mask & (MASK_ONE << 10)) != 0)
615 eq0 |= (value10 == ZERO);
617 if ((mask & (MASK_ONE << 11)) != 0)
618 eq0 |= (value11 == ZERO);
620 if ((mask & (MASK_ONE << 12)) != 0)
621 eq0 |= (value12 == ZERO);
623 if ((mask & (MASK_ONE << 13)) != 0)
624 eq0 |= (value13 == ZERO);
626 if ((mask & (MASK_ONE << 14)) != 0)
627 eq0 |= (value14 == ZERO);
629 if ((mask & (MASK_ONE << 15)) != 0)
630 eq0 |= (value15 == ZERO);
632 if ((mask & (MASK_ONE << 16)) != 0)
633 eq0 |= (value16 == ZERO);
635 if ((mask & (MASK_ONE << 17)) != 0)
636 eq0 |= (value17 == ZERO);
638 if ((mask & (MASK_ONE << 18)) != 0)
639 eq0 |= (value18 == ZERO);
641 if ((mask & (MASK_ONE << 19)) != 0)
642 eq0 |= (value19 == ZERO);
644 if ((mask & (MASK_ONE << 20)) != 0)
645 eq0 |= (value20 == ZERO);
647 if ((mask & (MASK_ONE << 21)) != 0)
648 eq0 |= (value21 == ZERO);
650 if ((mask & (MASK_ONE << 22)) != 0)
651 eq0 |= (value22 == ZERO);
653 if ((mask & (MASK_ONE << 23)) != 0)
654 eq0 |= (value23 == ZERO);
656 if ((mask & (MASK_ONE << 24)) != 0)
657 eq0 |= (value24 == ZERO);
659 if ((mask & (MASK_ONE << 25)) != 0)
660 eq0 |= (value25 == ZERO);
662 if ((mask & (MASK_ONE << 26)) != 0)
663 eq0 |= (value26 == ZERO);
665 if ((mask & (MASK_ONE << 27)) != 0)
666 eq0 |= (value27 == ZERO);
668 if ((mask & (MASK_ONE << 28)) != 0)
669 eq0 |= (value28 == ZERO);
671 if ((mask & (MASK_ONE << 29)) != 0)
672 eq0 |= (value29 == ZERO);
674 if ((mask & (MASK_ONE << 30)) != 0)
675 eq0 |= (value30 == ZERO);
677 if ((mask & (MASK_ONE << 31)) != 0)
678 eq0 |= (value31 == ZERO);
680 if ((mask & (MASK_ONE << 32)) != 0)
681 eq0 |= (value32 == ZERO);
683 if ((mask & (MASK_ONE << 33)) != 0)
684 eq0 |= (value33 == ZERO);
686 if ((mask & (MASK_ONE << 34)) != 0)
687 eq0 |= (value34 == ZERO);
689 if ((mask & (MASK_ONE << 35)) != 0)
690 eq0 |= (value35 == ZERO);
692 if ((mask & (MASK_ONE << 36)) != 0)
693 eq0 |= (value36 == ZERO);
695 if ((mask & (MASK_ONE << 37)) != 0)
696 eq0 |= (value37 == ZERO);
698 if ((mask & (MASK_ONE << 38)) != 0)
699 eq0 |= (value38 == ZERO);
701 if ((mask & (MASK_ONE << 39)) != 0)
702 eq0 |= (value39 == ZERO);
704 *eq0_ptr++ = eq0;
707 return ( value00 + value01 + value02 + value03 + value04
708 + value05 + value06 + value07 + value08 + value09
709 + value10 + value11 + value12 + value13 + value14
710 + value15 + value16 + value17 + value18 + value19
711 + value20 + value21 + value22 + value23 + value24
712 + value25 + value26 + value27 + value28 + value29
713 + value30 + value31 + value32 + value33 + value34
714 + value35 + value36 + value37 + value38 + value39);
717 /* { dg-final { scan-assembler "fadd" } } */
718 /* { dg-final { scan-assembler "fsub" } } */
719 /* { dg-final { scan-assembler "fmul" } } */
720 /* { dg-final { scan-assembler "fdiv" } } */
721 /* { dg-final { scan-assembler "fcmpu" } } */
722 /* { dg-final { scan-assembler "xsadddp" } } */
723 /* { dg-final { scan-assembler "xssubdp" } } */
724 /* { dg-final { scan-assembler "xsmuldp" } } */
725 /* { dg-final { scan-assembler "xsdivdp" } } */
726 /* { dg-final { scan-assembler "xscmpudp" } } */