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 unsigned long long int e0 (vector
unsigned long long int v
)
22 return __builtin_vec_extract (v
, 0);
25 unsigned long long int e3 (vector
unsigned long long int v
)
27 return __builtin_vec_extract (v
, 3);
30 /* Test for vector residing in memory. */
31 unsigned long long int me0 (vector
unsigned long long int *vp
)
33 return __builtin_vec_extract (*vp
, 0);
36 unsigned long long int me3 (vector
unsigned long long int *vp
)
38 return __builtin_vec_extract (*vp
, 3);
41 /* Test the same with variable indices. */
43 /* Test for variable selector and vector residing in register. */
44 __attribute__((noinline
))
45 unsigned long long int ei (vector
unsigned long long int v
, int i
)
47 return __builtin_vec_extract (v
, i
);
50 /* Test for variable selector and vector residing in memory. */
51 unsigned long long int mei (vector
unsigned long long int *vp
, int i
)
53 return __builtin_vec_extract (*vp
, i
);
56 int main (int argc
, char *argv
[]) {
57 vector
unsigned long long int dv
= { CONST0
, CONST1
};
58 unsigned long long int d
;