1 /* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-require-effective-target powerpc_p9vector_ok } */
4 /* { dg-options "-mcpu=power9 -O2" } */
6 #include <altivec.h> // vector
13 vector
unsigned int vsir
, vsiexpt
;
14 vector
unsigned int vuia
, vuir
, vuiexpt
;
15 vector
signed long long vslla
;
16 vector
unsigned long long vsllr
, vsllexpt
;
17 vector
unsigned long long vulla
, vullr
, vullexpt
;
18 vector __int128_t vs128a
;
19 vector __uint128_t vs128r
, vs128expt
;
20 vector __uint128_t vu128a
, vu128r
, vu128expt
;
22 /* Returns a vector with each element containing the parity of the low-order
23 bit of each of the bytes in that element. Note results are always
24 returned in an unsinged type, per the ABI spec. */
25 vsia
= (vector
int) {0x10101010, 0x10101011, 0x10101111, 0x10111111};
26 vsiexpt
= (vector
unsigned int){0x0, 0x1, 0x0, 0x1};
28 vuia
= (vector
unsigned int) {0x000010000, 0x00010001,
29 0x10100000, 0x000010101};
30 vuiexpt
= (vector
unsigned int){0x1, 0x0, 0x0, 0x1};
32 vslla
= (vector
long long) {0x0000000000010000, 0x0001000100010000};
33 vsllexpt
= (vector
unsigned long long){0x1, 0x1};
35 vulla
= (vector
unsigned long long) {0x0000000000000001,
37 vullexpt
= (vector
unsigned long long){0x1, 0x0};
39 vs128a
= (vector __int128_t
) {0x0000000000001};
40 vs128expt
= (vector __uint128_t
) {0x1};
41 vu128a
= (vector __uint128_t
) {0x1000000000001};
42 vu128expt
= (vector __uint128_t
) {0x0};
44 vsir
= vec_parity_lsbb(vsia
);
45 vuir
= vec_parity_lsbb(vuia
);
46 vsllr
= vec_parity_lsbb(vslla
);
47 vullr
= vec_parity_lsbb(vulla
);
48 vs128r
= vec_parity_lsbb(vs128a
);
49 vu128r
= vec_parity_lsbb(vu128a
);
51 for(i
= 0; i
< 4; i
++) {
52 if (vsir
[i
] != vsiexpt
[i
])
55 if (vuir
[i
] != vuiexpt
[i
])
59 for(i
= 0; i
< 2; i
++) {
60 if (vsllr
[i
] != vsllexpt
[i
])
63 if (vullr
[i
] != vullexpt
[i
])
67 if (vs128r
[0] != vs128expt
[0])
70 if (vu128r
[0] != vu128expt
[0])