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 /* Define this after PR89424 is addressed. */
14 extern void abort (void);
16 #define CONST0 (((unsigned __int128) 31415926539) << 60)
18 /* Test that indices > length of vector are applied modulo the vector
21 /* Test for vector residing in register. */
22 unsigned __int128
e0 (vector
unsigned __int128 v
)
24 return __builtin_vec_extract (v
, 0);
27 unsigned __int128
e3 (vector
unsigned __int128 v
)
29 return __builtin_vec_extract (v
, 3);
32 /* Test for vector residing in memory. */
33 unsigned __int128
me0 (vector
unsigned __int128
*vp
)
35 return __builtin_vec_extract (*vp
, 0);
38 unsigned __int128
me3 (vector
unsigned __int128
*vp
)
40 return __builtin_vec_extract (*vp
, 3);
43 /* Test the same with variable indices. */
46 /* Test for variable selector and vector residing in register. */
47 __attribute__((noinline
))
48 unsigned __int128
ei (vector
unsigned __int128 v
, int i
)
50 return __builtin_vec_extract (v
, i
);
53 /* Test for variable selector and vector residing in memory. */
54 unsigned __int128
mei (vector
unsigned __int128
*vp
, int i
)
56 return __builtin_vec_extract (*vp
, i
);
60 int main (int argc
, char *argv
[]) {
61 vector
unsigned __int128 dv
= { CONST0
};