1 /* PR target/101384 */
2 /* { dg-do compile { target le } } */
3 /* { dg-options "-O2 -maltivec" } */
4 /* { dg-require-effective-target powerpc_altivec_ok } */
5 /* { dg-final { scan-assembler-times {\mvspltis[whb] [^\n\r]*,-1\M|\mxxspltib[^\n\r]*,255\M} 9 } } */
6 /* { dg-final { scan-assembler-times {\mvslw\M} 3 } } */
7 /* { dg-final { scan-assembler-times {\mvslh\M} 3 } } */
8 /* { dg-final { scan-assembler-times {\mvslb\M} 3 } } */
9
10 typedef unsigned char __attribute__((__vector_size__ (16))) U;
11 typedef unsigned short __attribute__((__vector_size__ (16))) V;
12 typedef unsigned int __attribute__((__vector_size__ (16))) W;
13
14 U u;
15 V v;
16 W w;
17
18 U
19 f1 (void)
20 {
21 U y = (U) { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 } + u;
22 return y;
23 }
24
25 U
26 f2 (void)
27 {
28 U y = (U) { 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80, 0, 0x80 } + u;
29 return y;
30 }
31
32 U
33 f3 (void)
34 {
35 U y = (U) { 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80, 0, 0, 0, 0x80 } + u;
36 return y;
37 }
38
39 V
40 f4 (void)
41 {
42 V y = (V) { 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080, 0x8080 } + v;
43 return y;
44 }
45
46 V
47 f5 (void)
48 {
49 V y = (V) { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 } + v;
50 return y;
51 }
52
53 V
54 f6 (void)
55 {
56 V y = (V) { 0, 0x8000, 0, 0x8000, 0, 0x8000, 0, 0x8000 } + v;
57 return y;
58 }
59
60 W
61 f7 (void)
62 {
63 W y = (W) { 0x80808080, 0x80808080, 0x80808080, 0x80808080 } + w;
64 return y;
65 }
66
67 W
68 f8 (void)
69 {
70 W y = (W) { 0x80008000, 0x80008000, 0x80008000, 0x80008000 } + w;
71 return y;
72 }
73
74 W
75 f9 (void)
76 {
77 W y = (W) { 0x80000000, 0x80000000, 0x80000000, 0x80000000 } + w;
78 return y;
79 }