2 /* { dg-options "-O3 -mvsx -Wno-psabi" } */
3 /* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */
4 /* { dg-require-effective-target p8vector_hw } */
7 #define CHECK_H "ssse3-check.h"
11 #define TEST ssse3_test
16 #include "ssse3-vals.h"
18 #include <tmmintrin.h>
21 /* Test the 64-bit form */
23 ssse3_test_pshufb (__m64
*i1
, __m64
*i2
, __m64
*r
)
25 *r
= _mm_shuffle_pi8 (*i1
, *i2
);
30 /* Test the 128-bit form */
32 ssse3_test_pshufb128 (__m128i
*i1
, __m128i
*i2
, __m128i
*r
)
34 /* Assumes incoming pointers are 16-byte aligned */
35 *r
= _mm_shuffle_epi8 (*i1
, *i2
);
39 /* Routine to manually compute the results */
41 compute_correct_result_64 (signed char *i1
, signed char *i2
, signed char *r
)
46 for (i
= 0; i
< 16; i
++)
52 r
[i
] = i1
[select
& 0x7];
54 r
[i
] = i1
[8 + (select
& 0x7)];
60 compute_correct_result_128 (signed char *i1
, signed char *i2
, signed char *r
)
65 for (i
= 0; i
< 16; i
++)
71 r
[i
] = i1
[select
& 0xf];
79 union data r
__attribute__ ((aligned(16)));
83 for (i
= 0; i
< ARRAY_SIZE (vals
) - 1; i
++)
86 /* Manually compute the result */
87 compute_correct_result_64 (&vals
[i
+ 0].b
[0], &vals
[i
+ 1].b
[0], &ck
.b
[0]);
89 /* Run the 64-bit tests */
90 ssse3_test_pshufb (&vals
[i
+ 0].ll
[0], &vals
[i
+ 1].ll
[0], &r
.ll
[0]);
91 ssse3_test_pshufb (&vals
[i
+ 0].ll
[1], &vals
[i
+ 1].ll
[1], &r
.ll
[1]);
92 fail
+= chk_128 (ck
.m
[0], r
.m
[0]);
95 /* Recompute the result for 128-bits */
96 compute_correct_result_128 (&vals
[i
+ 0].b
[0], &vals
[i
+ 1].b
[0], &ck
.b
[0]);
98 /* Run the 128-bit tests */
99 ssse3_test_pshufb128 (&vals
[i
+ 0].m
[0], &vals
[i
+ 1].m
[0], &r
.m
[0]);
100 fail
+= chk_128 (ck
.m
[0], r
.m
[0]);