PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-valignd-2.c
blobe0cf231b6a818c9395c4dc473eeb4fd5addbd8ac
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 #define N (SIZE / 2)
14 static void
15 CALC (int *s1, int *s2, int *r)
17 int i;
18 int s[2 * SIZE];
20 for (i = 0; i < SIZE; i++)
22 s[i] = s2[i];
23 s[i + SIZE] = s1[i];
26 for (i = 0; i < SIZE; i++)
27 r[i] = s[i + N];
30 void
31 TEST (void)
33 UNION_TYPE (AVX512F_LEN, i_d) res1, res2, res3, s1, s2;
34 MASK_TYPE mask = MASK_VALUE;
35 int res_ref[SIZE];
36 int i;
38 for (i = 0; i < SIZE; i++)
40 s1.a[i] = 2 * i;
41 s2.a[i] = i;
42 res2.a[i] = DEFAULT_VALUE;
45 res1.x = INTRINSIC (_alignr_epi32) (s1.x, s2.x, N);
46 res2.x = INTRINSIC (_mask_alignr_epi32) (res2.x, mask, s1.x, s2.x, N);
47 res3.x = INTRINSIC (_maskz_alignr_epi32) (mask, s1.x, s2.x, N);
49 CALC (s1.a, s2.a, res_ref);
51 if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
52 abort ();
54 MASK_MERGE (i_d) (res_ref, mask, SIZE);
55 if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
56 abort ();
58 MASK_ZERO (i_d) (res_ref, mask, SIZE);
59 if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
60 abort ();