PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpunpckhwd-2.c
blob59c4ed89c8efa26b1e3faaf6fdacaf375e21fcab
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
5 #include <string.h>
6 #include "avx2-check.h"
8 #define N 0x5
10 static void
11 compute_punpckhwd256 (short *s1, short *s2, short *r)
13 int i;
15 for (i = 0; i < 4; i++)
17 r[2 * i] = s1[i + 4];
18 r[2 * i + 1] = s2[i + 4];
20 r[2 * i + 8] = s1[i + 4 + 8];
21 r[2 * i + 8 + 1] = s2[i + 4 + 8];
25 void static
26 avx2_test (void)
28 union256i_w s1, s2, res;
29 short res_ref[16];
30 int i, j;
31 int fail = 0;
33 for (i = 0; i < 10; i++)
35 for (j = 0; j < 16; j++)
37 s1.a[j] = j * i;
38 s2.a[j] = j + 20;
41 res.x = _mm256_unpackhi_epi16 (s1.x, s2.x);
43 compute_punpckhwd256 (s1.a, s2.a, res_ref);
45 fail += check_union256i_w (res, res_ref);
48 if (fail != 0)
49 abort ();