1 /* { dg-do compile { target powerpc*-*-* } } */
2 /* { dg-require-effective-target powerpc_altivec_ok } */
3 /* { dg-options "-mdejagnu-cpu=power6 -maltivec" } */
4
5
6 vector unsigned char
7 foo_char (void)
8 {
9 return (vector unsigned char) {
10 #if __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__
11 0x80, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
12 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
13 #else
14 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
15 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x80
16 #endif
17 };
18 }
19
20 vector unsigned short
21 foo_short (void)
22 {
23 return (vector unsigned short) {
24 #if __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__
25 0x8000, 0x8000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
26 #else
27 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x8000, 0x8000
28 #endif
29 };
30 }
31
32 vector unsigned int
33 foo_int (void)
34 {
35 return (vector unsigned int) {
36 #if __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__
37 0x80000000u, 0x80000000u, 0xffffffffu, 0xffffffffu,
38 #else
39 0xffffffffu, 0xffffffffu, 0x80000000u, 0x80000000u,
40 #endif
41 };
42 }
43
44 /* { dg-final { scan-assembler-times "vslb" 1 } } */
45 /* { dg-final { scan-assembler-times "vslh" 1 } } */
46 /* { dg-final { scan-assembler-times "vslw" 1 } } */
47 /* { dg-final { scan-assembler-times "vsldoi" 3 } } */