1 /* { dg-do run } */
2 /* { dg-options "-O3 -mpower8-vector" } */
3 /* { dg-require-effective-target p8vector_hw } */
4
5 #define NO_WARN_X86_INTRINSICS 1
6
7 #ifndef CHECK_H
8 #define CHECK_H "sse-check.h"
9 #endif
10
11 #include CHECK_H
12
13 #ifndef TEST
14 #define TEST sse_test_psadbw_1
15 #endif
16
17 #include <xmmintrin.h>
18
19 static __m64
20 __attribute__((noinline, unused))
test(__m64 s1,__m64 s2)21 test (__m64 s1, __m64 s2)
22 {
23 return _mm_sad_pu8 (s1, s2);
24 }
25
26 static void
TEST(void)27 TEST (void)
28 {
29 __m64_union u, e, s1, s2;
30 unsigned char tmp[8];
31 int i;
32
33 e.as_m64 = 0;
34 s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 5, 6, 7, 8);
35 s2.as_m64 = _mm_set_pi8 (8, 7, 6, 5, 4, 3, 2, 1);
36 u.as_m64 = test (s1.as_m64, s2.as_m64);
37
38 for (i = 0; i < 8; i++)
39 tmp [i] = __builtin_abs (s1.as_char[i] - s2.as_char[i]);
40
41 for (i = 0; i < 8; i++)
42 e.as_short[0] += tmp[i];
43
44 if (u.as_m64 != e.as_m64)
45 abort ();
46 }
47