Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse4_1-pextrb.c
blob15d08fad8091bde914472960f02aae63b56c345c
1 /* { dg-do run } */
2 /* { dg-require-effective-target sse4 } */
3 /* { dg-options "-O2 -msse4.1" } */
5 #include "sse4_1-check.h"
7 #include <smmintrin.h>
9 #define msk0 0
10 #define msk1 1
11 #define msk2 2
12 #define msk3 3
13 #define msk4 4
14 #define msk5 5
15 #define msk6 6
16 #define msk7 7
17 #define msk8 8
18 #define msk9 9
19 #define msk10 10
20 #define msk11 11
21 #define msk12 12
22 #define msk13 13
23 #define msk14 14
24 #define msk15 15
26 static void
27 sse4_1_test (void)
29 union
31 __m128i x;
32 int i[4];
33 char c[16];
34 } val1;
35 int res[16], masks[16];
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_epi8 (val1.x, msk0);
44 res[1] = _mm_extract_epi8 (val1.x, msk1);
45 res[2] = _mm_extract_epi8 (val1.x, msk2);
46 res[3] = _mm_extract_epi8 (val1.x, msk3);
47 res[4] = _mm_extract_epi8 (val1.x, msk4);
48 res[5] = _mm_extract_epi8 (val1.x, msk5);
49 res[6] = _mm_extract_epi8 (val1.x, msk6);
50 res[7] = _mm_extract_epi8 (val1.x, msk7);
51 res[8] = _mm_extract_epi8 (val1.x, msk8);
52 res[9] = _mm_extract_epi8 (val1.x, msk9);
53 res[10] = _mm_extract_epi8 (val1.x, msk10);
54 res[11] = _mm_extract_epi8 (val1.x, msk11);
55 res[12] = _mm_extract_epi8 (val1.x, msk12);
56 res[13] = _mm_extract_epi8 (val1.x, msk13);
57 res[14] = _mm_extract_epi8 (val1.x, msk14);
58 res[15] = _mm_extract_epi8 (val1.x, msk15);
60 masks[0] = msk0;
61 masks[1] = msk1;
62 masks[2] = msk2;
63 masks[3] = msk3;
64 masks[4] = msk4;
65 masks[5] = msk5;
66 masks[6] = msk6;
67 masks[7] = msk7;
68 masks[8] = msk8;
69 masks[9] = msk9;
70 masks[10] = msk10;
71 masks[11] = msk11;
72 masks[12] = msk12;
73 masks[13] = msk13;
74 masks[14] = msk14;
75 masks[15] = msk15;
77 for (i = 0; i < 16; i++)
78 if (res[i] != val1.c [masks[i]])
79 abort ();