[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pragma_power9.c
blobe05f1f4ddfac0dbc1fce467fccb967e114827f0e
1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-options "-mdejagnu-cpu=power6 -maltivec -O2" } */
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