2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-maltivec -O3" } */
5 /* This test should run the same on any target that supports altivec/dfp
6 instructions. Intentionally not specifying cpu in order to test
7 all code generation paths. */
11 extern void abort (void);
31 /* Test that indices > length of vector are applied modulo the vector
34 /* Test for vector residing in register. */
35 signed char c0 (vector
signed char v
)
37 return __builtin_vec_ext_v16qi (v
, 0);
40 signed char c9 (vector
signed char v
)
42 return __builtin_vec_ext_v16qi (v
, 9);
45 signed char c21 (vector
signed char v
)
47 return __builtin_vec_ext_v16qi (v
, 21);
50 signed char c30 (vector
signed char v
)
52 return __builtin_vec_ext_v16qi (v
, 30);
55 /* Test for vector residing in memory. */
56 signed char mc0 (vector
signed char *vp
)
58 return __builtin_vec_ext_v16qi (*vp
, 0);
61 signed char mc9 (vector
signed char *vp
)
63 return __builtin_vec_ext_v16qi (*vp
, 9);
66 signed char mc21 (vector
signed char *vp
)
68 return __builtin_vec_ext_v16qi (*vp
, 21);
71 signed char mc30 (vector
signed char *vp
)
73 return __builtin_vec_ext_v16qi (*vp
, 30);
76 /* Test the same with variable indices. */
78 /* Test for variable selector and vector residing in register. */
79 __attribute__((noinline
))
80 signed char ci (vector
signed char v
, int i
)
82 return __builtin_vec_ext_v16qi (v
, i
);
85 /* Test for variable selector and vector residing in memory. */
86 __attribute__((noinline
))
87 signed char mci(vector
signed char *vp
, int i
) {
88 return __builtin_vec_ext_v16qi (*vp
, i
);
92 int main (int argc
, char *argv
[]) {
93 vector
signed char cv
= { CONST0
, CONST1
, CONST2
, CONST3
,
94 CONST4
, CONST5
, CONST6
, CONST7
,
95 CONST8
, CONST9
, CONSTA
, CONSTB
,
96 CONSTC
, CONSTD
, CONSTE
, CONSTF
};