2 /* { dg-require-effective-target vmx_hw } */
3 /* { dg-options "-maltivec -O3" } */
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);
23 /* Test that indices > length of vector are applied modulo the vector
26 /* Test for vector residing in register. */
27 short s3 (vector
short v
)
29 return __builtin_vec_ext_v8hi (v
, 3);
32 short s7 (vector
short v
)
34 return __builtin_vec_ext_v8hi (v
, 7);
37 short s21 (vector
short v
)
39 return __builtin_vec_ext_v8hi (v
, 21);
42 short s30 (vector
short v
)
44 return __builtin_vec_ext_v8hi (v
, 30);
47 /* Test for vector residing in memory. */
48 short ms3 (vector
short *vp
)
50 return __builtin_vec_ext_v8hi (*vp
, 3);
53 short ms7 (vector
short *vp
)
55 return __builtin_vec_ext_v8hi (*vp
, 7);
58 short ms21 (vector
short *vp
)
60 return __builtin_vec_ext_v8hi (*vp
, 21);
63 short ms30 (vector
short *vp
)
65 return __builtin_vec_ext_v8hi (*vp
, 30);
68 /* Test the same with variable indices. */
70 /* Test for variable selector and vector residing in register. */
71 __attribute__((noinline
))
72 short ci (vector
short v
, int i
)
74 return __builtin_vec_ext_v8hi (v
, i
);
77 /* Test for variable selector and vector residing in memory. */
78 __attribute__((noinline
))
79 short mci (vector
short *vp
, int i
)
81 return __builtin_vec_ext_v8hi (*vp
, i
);
85 int main (int argc
, short *argv
[]) {
87 CONST0
, CONST1
, CONST2
, CONST3
, CONST4
, CONST5
, CONST6
, CONST7
};