PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpblendvb-2.c
blobc0e1d71ea62d685bc7dfc33b8c2a4ae966439df4
1 /* { dg-do run } */
2 /* { dg-options "-mavx2 -O2" } */
3 /* { dg-require-effective-target avx2 } */
5 #include "avx2-check.h"
6 #include <string.h>
8 #define NUM 20
10 static void
11 init_pblendb (char *src1, char *src2, char *mask, int seed)
13 int i, sign = 1;
15 for (i = 0; i < 32; i++)
17 src1[i] = (i + seed) * (i + seed) * sign;
18 src2[i] = (i + seed + 20) * sign;
19 sign = -sign;
21 if (sign > 0)
22 mask[i] = 1 << 7;
23 else
24 mask[i] = 0;
28 static void
29 calc_pblendb (char *src1, char *src2, char *mask, char *dst)
31 int i;
33 memcpy (dst, src1, 32);
34 for (i = 0; i < 32; i++)
35 if (mask[i] & (1 << 7))
36 dst[i] = src2[i];
39 static void
40 avx2_test (void)
42 union256i_b src1, src2, mask, dst;
43 char dst_ref[32];
44 int i;
46 for (i = 0; i < NUM; i++)
48 init_pblendb (src1.a, src2.a, mask.a, i);
50 dst.x = _mm256_blendv_epi8 (src1.x, src2.x, mask.x);
51 calc_pblendb (src1.a, src2.a, mask.a, dst_ref);
53 if (check_union256i_b (dst, dst_ref))
54 abort ();