1 /* { dg-do compile } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-require-effective-target int128 } */
4 /* { dg-options "-mpower8-vector -O2" } */
8 /* Test POWER8 vector built-ins added for version 1.1 of ELFv2 ABI. */
10 vector
unsigned char vuca
, vucb
, vucc
;
11 vector
bool char vbca
, vbcb
;
12 vector
unsigned short vusa
, vusb
;
13 vector
bool short vbsa
, vbsb
;
14 vector
unsigned int vuia
, vuib
;
15 vector
bool int vbia
, vbib
;
16 vector
signed long long vsla
, vslb
;
17 vector
unsigned long long vula
, vulb
, vulc
;
18 vector
bool long long vbla
, vblb
, vblc
;
19 vector
signed __int128 vsxa
, vsxb
, vsxc
;
20 vector
unsigned __int128 vuxa
, vuxb
, vuxc
;
21 vector
double vda
, vdb
;
23 void foo (vector
unsigned char *vucr
,
24 vector
bool char *vbcr
,
25 vector
unsigned short *vusr
,
26 vector
bool short *vbsr
,
27 vector
unsigned int *vuir
,
28 vector
bool int *vbir
,
29 vector
unsigned long long *vulr
,
30 vector
bool long long *vblr
,
31 vector
signed __int128
*vsxr
,
32 vector
unsigned __int128
*vuxr
,
35 *vsxr
++ = vec_addc (vsxa
, vsxb
);
36 *vuxr
++ = vec_addc (vuxa
, vuxb
);
37 *vsxr
++ = vec_adde (vsxa
, vsxb
, vsxc
);
38 *vuxr
++ = vec_adde (vuxa
, vuxb
, vuxc
);
39 *vsxr
++ = vec_addec (vsxa
, vsxb
, vsxc
);
40 *vuxr
++ = vec_addec (vuxa
, vuxb
, vuxc
);
41 *vucr
++ = vec_bperm (vuca
, vucb
);
42 *vulr
++ = vec_bperm (vuxa
, vucb
);
43 *vbcr
++ = vec_eqv (vbca
, vbcb
);
44 *vbir
++ = vec_eqv (vbia
, vbib
);
45 *vblr
++ = vec_eqv (vbla
, vblb
);
46 *vbsr
++ = vec_eqv (vbsa
, vbsb
);
47 *vucr
++ = vec_gb (vuca
);
48 *vbcr
++ = vec_nand (vbca
, vbcb
);
49 *vbir
++ = vec_nand (vbia
, vbib
);
50 *vblr
++ = vec_nand (vbla
, vblb
);
51 *vbsr
++ = vec_nand (vbsa
, vbsb
);
52 *vbcr
++ = vec_orc (vbca
, vbcb
);
53 *vbir
++ = vec_orc (vbia
, vbib
);
54 *vblr
++ = vec_orc (vbla
, vblb
);
55 *vbsr
++ = vec_orc (vbsa
, vbsb
);
56 *vblr
++ = vec_perm (vbla
, vblb
, vucc
);
57 *vusr
++ = vec_pmsum_be (vuca
, vucb
);
58 *vuir
++ = vec_pmsum_be (vusa
, vusb
);
59 *vulr
++ = vec_pmsum_be (vuia
, vuib
);
60 *vuxr
++ = vec_pmsum_be (vula
, vulb
);
61 *vuir
++ = vec_shasigma_be (vuia
, 0, 1);
62 *vulr
++ = vec_shasigma_be (vula
, 0, 1);
65 /* { dg-final { scan-assembler-times "vaddcuq" 2 } } */
66 /* { dg-final { scan-assembler-times "vaddeuqm" 2 } } */
67 /* { dg-final { scan-assembler-times "vaddecuq" 2 } } */
68 /* { dg-final { scan-assembler-times "vbpermq" 2 } } */
69 /* { dg-final { scan-assembler-times "xxleqv" 4 } } */
70 /* { dg-final { scan-assembler-times "vgbbd" 1 } } */
71 /* { dg-final { scan-assembler-times "xxlnand" 4 } } */
72 /* { dg-final { scan-assembler-times "xxlorc" 4 } } */
73 /* { dg-final { scan-assembler-times "vperm" 1 } } */
74 /* { dg-final { scan-assembler-times "vpmsumb" 1 } } */
75 /* { dg-final { scan-assembler-times "vpmsumh" 1 } } */
76 /* { dg-final { scan-assembler-times "vpmsumw" 1 } } */
77 /* { dg-final { scan-assembler-times "vpmsumd" 1 } } */
78 /* { dg-final { scan-assembler-times "vshasigmaw" 1 } } */
79 /* { dg-final { scan-assembler-times "vshasigmad" 1 } } */