diagnostics: move output formats from diagnostic.{c,h} to their own files
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pragma_power9.c
blob2fbc5fa17efddce5dc3c908682e8887c592ce5ed
1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power6 -maltivec -O2" } */
3 /* { dg-require-effective-target powerpc_altivec } */
4 /* { dg-require-effective-target lp64 } */
6 #include <altivec.h>
8 #ifdef _ARCH_PWR6
9 vector int
10 test1 (vector int a, vector int b)
12 return vec_add (a, b);
14 #else
15 #error failed on default power6 pragma target
16 #endif
18 #pragma GCC target ("cpu=power7")
19 #undef _ALTIVEC_H
20 #undef _RS6000_VECDEFINES_H
21 #include <altivec.h>
22 #ifdef _ARCH_PWR7
23 vector signed int
24 test2 (vector signed int a, vector signed int b)
26 return vec_sldw (a, b, 3);
28 #else
29 #error failed to set power7 pragma target
30 #endif
32 #pragma GCC target ("cpu=power8")
33 #undef _ALTIVEC_H
34 #undef _RS6000_VECDEFINES_H
35 #include <altivec.h>
36 #ifdef _ARCH_PWR8
37 vector int
38 test3 (vector int a, vector int b)
40 return vec_mergee (a, b);
43 typedef __attribute__((altivec(vector__))) long vec_t;
44 int
45 test3b (vec_t a, vec_t b)
47 return __builtin_vec_vcmpeq_p (2, a, b);
49 #else
50 #error failed to set power8 pragma target.
51 #endif
53 #pragma GCC target ("cpu=power9,power9-vector")
54 #undef _ALTIVEC_H
55 #undef _RS6000_VECDEFINES_H
56 #include <altivec.h>
57 #ifdef _ARCH_PWR9
58 vector bool int
59 test4 (vector signed int a, vector signed int b)
61 return vec_cmpnez (a, b);
63 #else
64 #error Failed to set cpu=power9 pragma target.
65 #endif