PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpshufd-2.c
blob6bab108659daf40f43cf011e4fb5ed3cee864362
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
12 static void
13 CALC (int *s1, unsigned char imm, int *r)
15 int i, j, offset;
17 for (j = 0; j < SIZE / 4; j++)
19 offset = j * 4;
20 for (i = 0; i < 4; i++)
21 r[i + offset] =
22 s1[((imm & (0x3 << (2 * i))) >> (2 * i)) + offset];
26 void
27 TEST (void)
29 UNION_TYPE (AVX512F_LEN, i_d) s1, res1, res2, res3;
30 int res_ref[SIZE];
31 int j, sign = 1;
32 MASK_TYPE mask = MASK_VALUE;
34 for (j = 0; j < SIZE; j++)
36 s1.a[j] = j * sign;
37 res1.a[j] = DEFAULT_VALUE;
38 res2.a[j] = DEFAULT_VALUE;
39 res3.a[j] = DEFAULT_VALUE;
40 sign = -sign;
43 res1.x = INTRINSIC (_shuffle_epi32) (s1.x, 0xec);
44 res2.x = INTRINSIC (_mask_shuffle_epi32) (res2.x, mask, s1.x, 0xec);
45 res3.x = INTRINSIC (_maskz_shuffle_epi32) (mask, s1.x, 0xec);
47 CALC (s1.a, 0xec, res_ref);
49 if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
50 abort ();
52 MASK_MERGE (i_d) (res_ref, mask, SIZE);
53 if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
54 abort ();
56 MASK_ZERO (i_d) (res_ref, mask, SIZE);
57 if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
58 abort ();