2 /* { dg-require-effective-target vsx_hw } */
3 /* { dg-options "-O2 -mvsx" } */
9 #define ELEMENTS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 127, -1, -128
12 vector
signed char sv
= (vector
signed char) { ELEMENTS
};
13 vector
signed char splat
= (vector
signed char) { SPLAT
, SPLAT
, SPLAT
, SPLAT
,
14 SPLAT
, SPLAT
, SPLAT
, SPLAT
,
15 SPLAT
, SPLAT
, SPLAT
, SPLAT
,
16 SPLAT
, SPLAT
, SPLAT
, SPLAT
};
17 vector
signed char sv_global
, sp_global
;
18 static vector
signed char sv_static
, sp_static
;
19 static signed char expected
[] = { ELEMENTS
};
20 static signed char splat_expected
= SPLAT
;
22 extern void check (vector
signed char a
)
23 __attribute__((__noinline__
));
25 extern void check_splat (vector
signed char a
)
26 __attribute__((__noinline__
));
28 extern vector
signed char pack_reg (signed char a
, signed char b
,
29 signed char c
, signed char d
,
30 signed char e
, signed char f
,
31 signed char g
, signed char h
,
32 signed char i
, signed char j
,
33 signed char k
, signed char l
,
34 signed char m
, signed char n
,
35 signed char o
, signed char p
)
36 __attribute__((__noinline__
));
38 extern vector
signed char pack_from_ptr (signed char *p_a
, signed char *p_b
,
39 signed char *p_c
, signed char *p_d
,
40 signed char *p_e
, signed char *p_f
,
41 signed char *p_g
, signed char *p_h
,
42 signed char *p_i
, signed char *p_j
,
43 signed char *p_k
, signed char *p_l
,
44 signed char *p_m
, signed char *p_n
,
45 signed char *p_o
, signed char *p_p
)
46 __attribute__((__noinline__
));
48 extern vector
signed char pack_const (void)
49 __attribute__((__noinline__
));
51 extern void pack_ptr (vector
signed char *q
,
52 signed char a
, signed char b
, signed char c
, signed char d
,
53 signed char e
, signed char f
, signed char g
, signed char h
,
54 signed char i
, signed char j
, signed char k
, signed char l
,
55 signed char m
, signed char n
, signed char o
, signed char p
)
56 __attribute__((__noinline__
));
58 extern void pack_static (signed char a
, signed char b
, signed char c
, signed char d
,
59 signed char e
, signed char f
, signed char g
, signed char h
,
60 signed char i
, signed char j
, signed char k
, signed char l
,
61 signed char m
, signed char n
, signed char o
, signed char p
)
62 __attribute__((__noinline__
));
64 extern void pack_global (signed char a
, signed char b
, signed char c
, signed char d
,
65 signed char e
, signed char f
, signed char g
, signed char h
,
66 signed char i
, signed char j
, signed char k
, signed char l
,
67 signed char m
, signed char n
, signed char o
, signed char p
)
68 __attribute__((__noinline__
));
70 extern vector
signed char splat_reg (signed char a
)
71 __attribute__((__noinline__
));
73 extern vector
signed char splat_from_ptr (signed char *p_a
)
74 __attribute__((__noinline__
));
76 extern vector
signed char splat_const (void)
77 __attribute__((__noinline__
));
79 extern void splat_ptr (vector
signed char *p
, signed char a
)
80 __attribute__((__noinline__
));
82 extern void splat_static (signed char a
)
83 __attribute__((__noinline__
));
85 extern void splat_global (signed char a
)
86 __attribute__((__noinline__
));
89 check (vector
signed char a
)
93 for (i
= 0; i
< 16; i
++)
94 if (vec_extract (a
, i
) != expected
[i
])
99 check_splat (vector
signed char a
)
103 for (i
= 0; i
< 16; i
++)
104 if (vec_extract (a
, i
) != SPLAT
)
109 pack_reg (signed char a
, signed char b
, signed char c
, signed char d
,
110 signed char e
, signed char f
, signed char g
, signed char h
,
111 signed char i
, signed char j
, signed char k
, signed char l
,
112 signed char m
, signed char n
, signed char o
, signed char p
)
114 return (vector
signed char) { a
, b
, c
, d
, e
, f
, g
, h
,
115 i
, j
, k
, l
, m
, n
, o
, p
};
119 pack_from_ptr (signed char *p_a
, signed char *p_b
, signed char *p_c
, signed char *p_d
,
120 signed char *p_e
, signed char *p_f
, signed char *p_g
, signed char *p_h
,
121 signed char *p_i
, signed char *p_j
, signed char *p_k
, signed char *p_l
,
122 signed char *p_m
, signed char *p_n
, signed char *p_o
, signed char *p_p
)
124 return (vector
signed char) { *p_a
, *p_b
, *p_c
, *p_d
,
125 *p_e
, *p_f
, *p_g
, *p_h
,
126 *p_i
, *p_j
, *p_k
, *p_l
,
127 *p_m
, *p_n
, *p_o
, *p_p
};
134 return (vector
signed char) { ELEMENTS
};
138 pack_ptr (vector
signed char *q
,
139 signed char a
, signed char b
, signed char c
, signed char d
,
140 signed char e
, signed char f
, signed char g
, signed char h
,
141 signed char i
, signed char j
, signed char k
, signed char l
,
142 signed char m
, signed char n
, signed char o
, signed char p
)
144 *q
= (vector
signed char) { a
, b
, c
, d
, e
, f
, g
, h
,
145 i
, j
, k
, l
, m
, n
, o
, p
};
149 pack_static (signed char a
, signed char b
, signed char c
, signed char d
,
150 signed char e
, signed char f
, signed char g
, signed char h
,
151 signed char i
, signed char j
, signed char k
, signed char l
,
152 signed char m
, signed char n
, signed char o
, signed char p
)
154 sv_static
= (vector
signed char) { a
, b
, c
, d
, e
, f
, g
, h
,
155 i
, j
, k
, l
, m
, n
, o
, p
};
159 pack_global (signed char a
, signed char b
, signed char c
, signed char d
,
160 signed char e
, signed char f
, signed char g
, signed char h
,
161 signed char i
, signed char j
, signed char k
, signed char l
,
162 signed char m
, signed char n
, signed char o
, signed char p
)
164 sv_global
= (vector
signed char) { a
, b
, c
, d
, e
, f
, g
, h
,
165 i
, j
, k
, l
, m
, n
, o
, p
};
169 splat_reg (signed char a
)
171 return (vector
signed char) { a
, a
, a
, a
, a
, a
, a
, a
,
172 a
, a
, a
, a
, a
, a
, a
, a
};
176 splat_from_ptr (signed char *p_a
)
178 return (vector
signed char) { *p_a
, *p_a
, *p_a
, *p_a
,
179 *p_a
, *p_a
, *p_a
, *p_a
,
180 *p_a
, *p_a
, *p_a
, *p_a
,
181 *p_a
, *p_a
, *p_a
, *p_a
};
187 return (vector
signed char) { SPLAT
, SPLAT
, SPLAT
, SPLAT
,
188 SPLAT
, SPLAT
, SPLAT
, SPLAT
,
189 SPLAT
, SPLAT
, SPLAT
, SPLAT
,
190 SPLAT
, SPLAT
, SPLAT
, SPLAT
};
194 splat_ptr (vector
signed char *p
, signed char a
)
196 *p
= (vector
signed char) { a
, a
, a
, a
, a
, a
, a
, a
,
197 a
, a
, a
, a
, a
, a
, a
, a
};
201 splat_static (signed char a
)
203 sp_static
= (vector
signed char) { a
, a
, a
, a
, a
, a
, a
, a
,
204 a
, a
, a
, a
, a
, a
, a
, a
};
208 splat_global (signed char a
)
210 sp_global
= (vector
signed char) { a
, a
, a
, a
, a
, a
, a
, a
,
211 a
, a
, a
, a
, a
, a
, a
, a
};
216 vector
signed char sv2
, sv3
;
220 check (pack_reg (ELEMENTS
));
222 check (pack_from_ptr (&expected
[0], &expected
[1], &expected
[2],
223 &expected
[3], &expected
[4], &expected
[5],
224 &expected
[6], &expected
[7], &expected
[8],
225 &expected
[9], &expected
[10], &expected
[11],
226 &expected
[12], &expected
[13], &expected
[14],
229 check (pack_const ());
231 pack_ptr (&sv2
, ELEMENTS
);
234 pack_static (ELEMENTS
);
237 pack_global (ELEMENTS
);
242 check_splat (splat_reg (SPLAT
));
244 check_splat (splat_from_ptr (&splat_expected
));
246 check_splat (splat_const ());
248 splat_ptr (&sv2
, SPLAT
);
251 splat_static (SPLAT
);
252 check_splat (sp_static
);
254 splat_global (SPLAT
);
255 check_splat (sp_global
);