PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse2-vec-6.c
blob856c3e70cecc4d2b15e79faab2f8f594baf2f537
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse2" } */
3 /* { dg-require-effective-target sse2 } */
5 #include "sse2-check.h"
7 #include <emmintrin.h>
8 #include <string.h>
10 static void
11 sse2_test (void)
13 union
15 __m128i x;
16 char c[16];
17 short s[8];
18 int i[4];
19 long long ll[2];
20 } val1, res[16], tmp;
21 short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
22 int masks[8];
23 int i;
25 for (i = 0; i < 16; i++)
26 val1.c[i] = i;
28 res[0].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
29 ins[0], 0);
30 res[1].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
31 ins[0], 1);
32 res[2].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
33 ins[0], 2);
34 res[3].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
35 ins[0], 3);
36 res[4].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
37 ins[0], 4);
38 res[5].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
39 ins[0], 5);
40 res[6].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
41 ins[0], 6);
42 res[7].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
43 ins[0], 7);
45 for (i = 0; i < 8; i++)
46 masks[i] = i;
48 for (i = 0; i < 8; i++)
50 tmp.x = val1.x;
51 tmp.s[masks[i]] = ins[0];
52 if (memcmp (&tmp, &res[i], sizeof (tmp)))
53 abort ();
56 for (i = 0; i < 8; i++)
58 res[i].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
59 ins[i], 0);
60 masks[i] = 0;
63 for (i = 0; i < 8; i++)
65 tmp.x = val1.x;
66 tmp.s[masks[i]] = ins[i];
67 if (memcmp (&tmp, &res[i], sizeof (tmp)))
68 abort ();