1 /* { dg-do compile { target powerpc*-*-* } } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power6" } } */
4 /* { dg-options "-mcpu=power6 -maltivec" } */
5
6 vector unsigned char
foo_char(void)7 foo_char (void)
8 {
9 return (vector unsigned char) {
10 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
11 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
12 };
13 }
14
15 vector unsigned short
foo_short(void)16 foo_short (void)
17 {
18 return (vector unsigned short) {
19 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000
20 };
21 }
22
23 vector unsigned int
foo_int(void)24 foo_int (void)
25 {
26 return (vector unsigned int) {
27 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u,
28 };
29 }
30
31 /* { dg-final { scan-assembler-times "vspltisw" 3 } } */
32 /* { dg-final { scan-assembler-times "vslb" 1 } } */
33 /* { dg-final { scan-assembler-times "vslh" 1 } } */
34 /* { dg-final { scan-assembler-times "vslw" 1 } } */
35