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