PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpmulhw-2.c
blobea0bde2bea9aa615508890c3248491dbbaccdf84
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_pmulhw256 (short *s1, short *s2, short *r)
10 int i;
12 for (i = 0; i < 16; i++)
13 r[i] = (s1[i] * s2[i]) >> 16;
16 static void
17 avx2_test (void)
19 union256i_w s1, s2, res;
20 short res_ref[16];
21 int i, j, sign = 1;
22 int fail = 0;
24 for (i = 0; i < 10; i++)
26 for (j = 0; j < 16; j++)
28 s1.a[j] = i * j * sign;
29 s2.a[j] = (j + 20) * sign;
30 sign = -sign;
33 res.x = _mm256_mulhi_epi16 (s1.x, s2.x);
35 compute_pmulhw256 (s1.a, s2.a, res_ref);
37 fail += check_union256i_w (res, res_ref);
40 if (fail != 0)
41 abort ();