Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / mmx-packuswb-1.c
blobde8ff5bc7a4362b17f3cf3b52260ab01d4db0e09
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target p8vector_hw } */
6 #define NO_WARN_X86_INTRINSICS 1
8 #ifndef CHECK_H
9 #define CHECK_H "mmx-check.h"
10 #endif
12 #ifndef TEST
13 #define TEST mmx_test
14 #endif
16 #include CHECK_H
18 #include <mmintrin.h>
20 static __m64
21 __attribute__((noinline, unused))
22 test (__m64 s1, __m64 s2)
24 return _mm_packs_pu16 (s1, s2);
27 static void
28 TEST (void)
30 __m64_union s1, s2;
31 __m64_union u;
32 __m64_union e;
33 int i, tmp;
35 s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4);
36 s2.as_m64 = _mm_set_pi16 (-9, -10, -11, -12);
37 u.as_m64 = test (s1.as_m64, s2.as_m64);
39 for (i=0; i<4; i++)
41 tmp = s1.as_short[i]<0 ? 0 : s1.as_short[i];
42 tmp = tmp>255 ? 255 : tmp;
43 e.as_char[i] = tmp;
45 tmp = s2.as_short[i]<0 ? 0 : s2.as_short[i];
46 tmp = tmp>255 ? 255 : tmp;
47 e.as_char[i+4] = tmp;
50 if (u.as_m64 != e.as_m64)
51 abort ();