Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / sse4_1-pextrw.c
blob2a0f03c07dcc6e9abdf79b65c5d73b6495d1ce6a
1 /* { dg-do run } */
2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O2 -msse4.1" } */
5 #ifndef CHECK_H
6 #define CHECK_H "sse4_1-check.h"
7 #endif
9 #ifndef TEST
10 #define TEST sse4_1_test
11 #endif
13 #include CHECK_H
15 #include <smmintrin.h>
17 #define msk0 0
18 #define msk1 1
19 #define msk2 2
20 #define msk3 3
21 #define msk4 4
22 #define msk5 5
23 #define msk6 6
24 #define msk7 7
26 static void
27 TEST (void)
29 union
31 __m128i x;
32 int i[4];
33 short s[8];
34 } val1;
35 int res[8], masks[8];
36 int i;
38 val1.i[0] = 0x04030201;
39 val1.i[1] = 0x08070605;
40 val1.i[2] = 0x0C0B0A09;
41 val1.i[3] = 0x100F0E0D;
43 res[0] = _mm_extract_epi16 (val1.x, msk0);
44 res[1] = _mm_extract_epi16 (val1.x, msk1);
45 res[2] = _mm_extract_epi16 (val1.x, msk2);
46 res[3] = _mm_extract_epi16 (val1.x, msk3);
47 res[4] = _mm_extract_epi16 (val1.x, msk4);
48 res[5] = _mm_extract_epi16 (val1.x, msk5);
49 res[6] = _mm_extract_epi16 (val1.x, msk6);
50 res[7] = _mm_extract_epi16 (val1.x, msk7);
52 masks[0] = msk0;
53 masks[1] = msk1;
54 masks[2] = msk2;
55 masks[3] = msk3;
56 masks[4] = msk4;
57 masks[5] = msk5;
58 masks[6] = msk6;
59 masks[7] = msk7;
61 for (i = 0; i < 8; i++)
62 if (res[i] != val1.s [masks[i]])
63 abort ();