PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpmaxub-2.c
blobf0654e03277997b133ef0add1e0555a001f70b4f
1 /* { dg-do run } */
2 /* { dg-options "-mavx2 -O2" } */
3 /* { dg-require-effective-target avx2 } */
5 #include "avx2-check.h"
7 static void
8 compute_pmaxub256 (unsigned char *s1, unsigned char *s2, unsigned char *r)
10 int i;
12 for (i = 0; i < 32; i++)
13 r[i] = s1[i] > s2[i] ? s1[i] : s2[i];
16 static void
17 avx2_test (void)
19 union256i_b s1, s2, res;
20 unsigned char res_ref[32];
21 int i, j;
22 int fail = 0;
24 for (i = 0; i < 10; i++)
26 for (j = 0; j < 32; j++)
28 s1.a[j] = j * i;
29 s2.a[j] = i + 200;
32 res.x = _mm256_max_epu8 (s1.x, s2.x);
34 compute_pmaxub256 ((unsigned char *) s1.a,
35 (unsigned char *) s2.a, (unsigned char *) res_ref);
37 fail += check_union256i_b (res, res_ref);
40 if (fail != 0)
41 abort ();