1 /* { dg-do run { target int128 } } */
2 /* { dg-require-effective-target vsx_hw } */
3 /* { dg-options "-mvsx" } */
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 (3.1415926539)
14 #define CONST1 (3.1415926539 * 2)
17 /* Test that indices > length of vector are applied modulo the vector
20 /* Test for vector residing in register. */
21 double e0(vector
double v
){ return __builtin_vec_ext_v2df (v
, 0); }
22 double e1(vector
double v
){ return __builtin_vec_ext_v2df (v
, 1); }
23 double e2(vector
double v
){ return __builtin_vec_ext_v2df (v
, 2); }
24 double e3(vector
double v
){ return __builtin_vec_ext_v2df (v
, 3); }
26 /* Test for vector residing in memory. */
27 double me0(vector
double *vp
){ return __builtin_vec_ext_v2df (*vp
, 0); }
28 double me1(vector
double *vp
){ return __builtin_vec_ext_v2df (*vp
, 1); }
29 double me2(vector
double *vp
){ return __builtin_vec_ext_v2df (*vp
, 2); }
30 double me3(vector
double *vp
){ return __builtin_vec_ext_v2df (*vp
, 3); }
32 /* Test the same with variable indices. */
34 /* Test for variable selector and vector residing in register. */
35 __attribute__((noinline
))
36 double ei(vector
double v
, int i
){ return __builtin_vec_ext_v2df (v
, i
); }
38 /* Test for variable selector and vector residing in memory. */
39 double mei(vector
double *vp
, int i
){ return __builtin_vec_ext_v2df (*vp
, i
); }
42 int main (int argc
, char *argv
[]) {