PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / vperm-v4si-1.c
blob4667f9556bfc65b27b4cc8c6203ca4e388015989
1 /* { dg-do run } */
2 /* { dg-options "-O -msse2" } */
3 /* { dg-require-effective-target sse2 } */
5 #include "isa-check.h"
6 #include "sse-os-support.h"
8 typedef int S;
9 typedef int V __attribute__((vector_size(16)));
10 typedef int IV __attribute__((vector_size(16)));
11 typedef union { S s[4]; V v; } U;
13 static U i[2], b, c;
15 extern int memcmp (const void *, const void *, __SIZE_TYPE__);
16 #define assert(T) ((T) || (__builtin_trap (), 0))
18 #define TEST(E0, E1, E2, E3) \
19 b.v = __builtin_shuffle (i[0].v, i[1].v, (IV){E0, E1, E2, E3}); \
20 c.s[0] = i[0].s[E0]; \
21 c.s[1] = i[0].s[E1]; \
22 c.s[2] = i[0].s[E2]; \
23 c.s[3] = i[0].s[E3]; \
24 __asm__("" : : : "memory"); \
25 assert (memcmp (&b, &c, sizeof(c)) == 0);
27 #include "vperm-4-1.inc"
29 int main()
31 check_isa ();
33 if (!sse_os_support ())
34 exit (0);
36 i[0].s[0] = 0;
37 i[0].s[1] = 1;
38 i[0].s[2] = 2;
39 i[0].s[3] = 3;
40 i[0].s[4] = 4;
41 i[0].s[5] = 5;
42 i[0].s[6] = 6;
43 i[0].s[7] = 7;
45 check();
46 return 0;