diagnostics: move output formats from diagnostic.{c,h} to their own files
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pragma_power8.c
blob43ea6dd406e555d937802918a43ee29922e939e6
1 /* { dg-do compile } */
2 /* { dg-require-effective-target lp64 } */
3 /* Ensure there is no explicit -mno-vsx etc., otherwise
4 the below bif __builtin_vec_vcmpeq_p replies on power8
5 vsx would fail. */
6 /* { dg-require-effective-target powerpc_vsx } */
7 /* { dg-options "-mdejagnu-cpu=power6 -maltivec -O2" } */
9 #include <altivec.h>
11 #pragma GCC target ("cpu=power6,altivec")
12 #ifdef _ARCH_PWR6
13 vector int
14 test1 (vector int a, vector int b)
16 return vec_add (a, b);
18 #else
19 #error failed power6 pragma target
20 #endif
22 #pragma GCC target ("cpu=power7")
23 /* Force a re-read of altivec.h with new cpu target. */
24 #undef _ALTIVEC_H
25 #undef _RS6000_VECDEFINES_H
26 #include <altivec.h>
27 #ifdef _ARCH_PWR7
28 vector signed int
29 test2 (vector signed int a, vector signed int b)
31 return vec_sldw (a, b, 3);
33 #else
34 #error failed to set power7 pragma target
35 #endif
37 #pragma GCC target ("cpu=power8")
38 /* Force a re-read of altivec.h with new cpu target. */
39 #undef _ALTIVEC_H
40 #undef _RS6000_VECDEFINES_H
41 #include <altivec.h>
42 #ifdef _ARCH_PWR8
43 vector int
44 test3 (vector int a, vector int b)
46 return vec_mergee (a, b);
48 typedef __attribute__((altivec(vector__))) long vec_t;
49 int
50 test3b (vec_t a, vec_t b)
52 return __builtin_vec_vcmpeq_p (2, a, b);
54 #else
55 #error failed to set power8 pragma target.
56 #endif