1 /* { dg-do run { target int128 } } */
2 /* { dg-require-effective-target vsx_hw } */
3 /* { dg-options "-mvsx -O3" } */
5 /* This test should run the same on any target that supports vsx
6 instructions. Intentionally not specifying cpu in order to test
7 all code generation paths. */
11 extern void abort (void);
13 #define CONST0 (31415926539LL)
14 #define CONST1 (2 * 31415926539LL)
16 /* Test that indices > length of vector are applied modulo the vector
19 /* Test for vector residing in register. */
20 long long int e0 (vector
long long int v
)
22 return __builtin_vec_ext_v2di (v
, 0);
25 long long int e3 (vector
long long int v
)
27 return __builtin_vec_ext_v2di (v
, 3);
30 /* Test for vector residing in memory. */
31 long long int me0 (vector
long long int *vp
)
33 return __builtin_vec_ext_v2di (*vp
, 0);
36 long long int me3 (vector
long long int *vp
)
38 return __builtin_vec_ext_v2di (*vp
, 3);
41 /* Test the same with variable indices. */
43 /* Test for variable selector and vector residing in register. */
44 __attribute__((noinline
))
45 long long int ei (vector
long long int v
, int i
)
47 return __builtin_vec_ext_v2di (v
, i
);
50 /* Test for variable selector and vector residing in memory. */
51 long long int mei (vector
long long int *vp
, int i
)
53 return __builtin_vec_ext_v2di (*vp
, i
);
56 int main (int argc
, char *argv
[]) {
57 vector
long long int dv
= { CONST0
, CONST1
};