[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / p8vector-builtin-5.c
blob35b7e2a189f9ad4345d04d7722129c88d3b97a4c
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2 -ftree-vectorize -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */
6 #include <altivec.h>
8 #ifndef SIZE
9 #define SIZE 1024
10 #endif
12 #ifndef ALIGN
13 #define ALIGN 32
14 #endif
16 #ifndef ATTR_ALIGN
17 #define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
18 #endif
20 #define DOIT(TYPE, PREFIX) \
21 TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
22 { \
23 return vec_eqv (a, b); \
24 } \
26 TYPE PREFIX ## _eqv_arith (TYPE a, TYPE b) \
27 { \
28 return ~(a ^ b); \
29 } \
31 TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
32 { \
33 return vec_nand (a, b); \
34 } \
36 TYPE PREFIX ## _nand_arith1 (TYPE a, TYPE b) \
37 { \
38 return ~(a & b); \
39 } \
41 TYPE PREFIX ## _nand_arith2 (TYPE a, TYPE b) \
42 { \
43 return (~a) | (~b); \
44 } \
46 TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
47 { \
48 return vec_orc (a, b); \
49 } \
51 TYPE PREFIX ## _orc_arith1 (TYPE a, TYPE b) \
52 { \
53 return (~ a) | b; \
54 } \
56 TYPE PREFIX ## _orc_arith2 (TYPE a, TYPE b) \
57 { \
58 return a | (~ b); \
61 #define DOIT_FLOAT(TYPE, PREFIX) \
62 TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
63 { \
64 return vec_eqv (a, b); \
65 } \
67 TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
68 { \
69 return vec_nand (a, b); \
70 } \
72 TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
73 { \
74 return vec_orc (a, b); \
77 typedef vector signed char sign_char_vec;
78 typedef vector short sign_short_vec;
79 typedef vector int sign_int_vec;
80 typedef vector long long sign_llong_vec;
82 typedef vector unsigned char uns_char_vec;
83 typedef vector unsigned short uns_short_vec;
84 typedef vector unsigned int uns_int_vec;
85 typedef vector unsigned long long uns_llong_vec;
87 typedef vector float float_vec;
88 typedef vector double double_vec;
90 DOIT(sign_char_vec, sign_char)
91 DOIT(sign_short_vec, sign_short)
92 DOIT(sign_int_vec, sign_int)
93 DOIT(sign_llong_vec, sign_llong)
95 DOIT(uns_char_vec, uns_char)
96 DOIT(uns_short_vec, uns_short)
97 DOIT(uns_int_vec, uns_int)
98 DOIT(uns_llong_vec, uns_llong)
100 DOIT_FLOAT(float_vec, float)
101 DOIT_FLOAT(double_vec, double)
103 /* { dg-final { scan-assembler-times "xxleqv" 18 } } */
104 /* { dg-final { scan-assembler-times "xxlnand" 26 } } */
105 /* { dg-final { scan-assembler-times "xxlorc" 26 } } */