2 /* { dg-require-effective-target ssse3 } */
3 /* { dg-options "-O2 -mssse3" } */
5 #include "ssse3-check.h"
6 #include "ssse3-vals.h"
10 /* Test the 64-bit form */
12 ssse3_test_pabsw (int *i1
, int *r
)
14 __m64 t1
= *(__m64
*) i1
;
15 *(__m64
*) r
= _mm_abs_pi16 (t1
);
19 /* Test the 128-bit form */
21 ssse3_test_pabsw128 (int *i1
, int *r
)
23 /* Assumes incoming pointers are 16-byte aligned */
24 __m128i t1
= *(__m128i
*) i1
;
25 *(__m128i
*) r
= _mm_abs_epi16 (t1
);
28 /* Routine to manually compute the results */
30 compute_correct_result (int *i1
, int *r
)
32 short *s1
= (short *) i1
;
33 short *sout
= (short *) r
;
36 for (i
= 0; i
< 8; i
++)
47 int r
[4] __attribute__ ((aligned(16)));
51 for (i
= 0; i
< 256; i
+= 4)
53 /* Manually compute the result */
54 compute_correct_result (&vals
[i
+ 0], ck
);
56 /* Run the 64-bit tests */
57 ssse3_test_pabsw (&vals
[i
+ 0], &r
[0]);
58 ssse3_test_pabsw (&vals
[i
+ 2], &r
[2]);
59 fail
+= chk_128 (ck
, r
);
61 /* Run the 128-bit tests */
62 ssse3_test_pabsw128 (&vals
[i
+ 0], r
);
63 fail
+= chk_128 (ck
, r
);