2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-maltivec" } */
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);
18 /* Test that indices > length of vector are applied modulo the vector
21 /* Test for vector residing in register. */
24 return __builtin_vec_ext_v4si (v
, 3);
29 return __builtin_vec_ext_v4si (v
, 1);
32 int s21 (vector
int v
)
34 return __builtin_vec_ext_v4si (v
, 21);
37 int s30 (vector
int v
)
39 return __builtin_vec_ext_v4si (v
, 30);
42 /* Test for vector residing in memory. */
43 int ms3 (vector
int *vp
)
45 return __builtin_vec_ext_v4si (*vp
, 3);
48 int ms1(vector
int *vp
)
50 return __builtin_vec_ext_v4si (*vp
, 1);
53 int ms21(vector
int *vp
)
55 return __builtin_vec_ext_v4si (*vp
, 21);
58 int ms30(vector
int *vp
)
60 return __builtin_vec_ext_v4si (*vp
, 30);
63 /* Test the same with variable indices. */
65 /* Test for variable selector and vector residing in register. */
66 __attribute__((noinline
))
67 int ci (vector
int v
, int i
)
69 return __builtin_vec_ext_v4si (v
, i
);
72 /* Test for variable selector and vector residing in memory. */
73 __attribute__((noinline
))
74 int mci(vector
int *vp
, int i
)
76 return __builtin_vec_ext_v4si (*vp
, i
);
80 int main (int argc
, int *argv
[]) {
81 vector
int sv
= { CONST0
, CONST1
, CONST2
, CONST3
};