OSDN Git Service

4eec55d04aa6c45b4d0f5fafae9656c8aaaf7412
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / sse2-pshufhw-1.c
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse2" } */
3
4 #ifndef CHECK_H
5 #define CHECK_H "sse2-check.h"
6 #endif
7
8 #ifndef TEST
9 #define TEST sse2_test
10 #endif
11
12 #define N 0xec
13
14 #include CHECK_H
15
16 #include <emmintrin.h>
17
18 static __m128i
19 __attribute__((noinline, unused))
20 test (__m128i s1)
21 {
22   return _mm_shufflehi_epi16 (s1, N); 
23 }
24
25 static void
26 TEST (void)
27 {
28   union128i_q s1;
29   union128i_w u;
30   short  e[8] = {0};
31   int i;
32   int m1[4] = {0x3, 0x3<<2, 0x3<<4, 0x3<<6};
33   int m2[4];
34   
35   s1.x = _mm_set_epi64x (0xabcde,0xef58a234);
36   u.x = test (s1.x);
37
38   for (i = 0; i < 4; i++)
39     e[i] = (s1.a[0]>>(16 * i)) & 0xffff;
40
41   for (i = 0; i < 4; i++)
42     m2[i] = (N & m1[i])>>(2*i);
43
44   for (i = 0; i < 4; i++)
45     e[i+4] = (s1.a[1] >> (16 * m2[i])) & 0xffff;
46
47   if (check_union128i_w(u, e))
48     abort ();
49 }