testsuite: enable and fix swaps-p8 testcases
[gcc.git] / gcc / testsuite / gcc.target / powerpc / swaps-p8-46.c
1 /* { dg-do run { target le } } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -O2 " } */
4
5 typedef __attribute__ ((__aligned__ (8))) unsigned long long __m64;
6 typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
7
8 /* PR84033. Extracted from xmmintrin.h but with a pointer param to
9 allow swaps to happen when not inline. */
10 int __attribute__ ((__noinline__))
11 _mm_movemask_ps (__m128 *__A)
12 {
13 __vector __m64 result;
14 static const __vector unsigned int perm_mask =
15 {
16 0x00204060, 0x80808080, 0x80808080, 0x80808080
17 };
18
19 result = (__vector __m64)
20 __builtin_vec_vbpermq ((__vector unsigned char) (*__A),
21 (__vector unsigned char) perm_mask);
22 return result[1];
23 }
24
25 int
26 main (void)
27 {
28 union { unsigned int i[4]; __m128 m; } x
29 = { 0x80000000, 0x80000000, 0x7fffffff, 0x7fffffff };
30 if (_mm_movemask_ps (&x.m) != 3)
31 __builtin_abort ();
32 return 0;
33 }