2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vphsubd-2.c
blobba493679228684636d3c82a7cb2f9dddaf01258f
1 /* { dg-do run } */
2 /* { dg-options "-mavx2 -O2" } */
3 /* { dg-require-effective-target avx2 } */
5 #include "avx2-check.h"
6 #include "ssse3-vals.h"
8 static void
9 compute_phsubd256 (int *i1, int *i2, int *r)
11 int i;
13 for (i = 0; i < 2; i++)
14 r[i + 0] = i1[2 * i] - i1[2 * i + 1];
16 for (i = 0; i < 2; i++)
17 r[i + 2] = i2[2 * i] - i2[2 * i + 1];
19 for (i = 0; i < 2; i++)
20 r[i + 4] = i1[2 * i + 4] - i1[2 * i + 5];
22 for (i = 0; i < 2; i++)
23 r[i + 6] = i2[2 * i + 4] - i2[2 * i + 5];
26 static void
27 avx2_test (void)
29 union256i_d s1, s2, res;
30 int res_ref[8];
31 int i, j;
32 int fail = 0;
35 for (i = 0; i < 256; i += 16)
37 s1.x = _mm256_loadu_si256 ((__m256i *) & vals[i]);
38 s2.x = _mm256_loadu_si256 ((__m256i *) & vals[i + 8]);
40 res.x = _mm256_hsub_epi32 (s1.x, s2.x);
42 compute_phsubd256 (s1.a, s2.a, res_ref);
44 fail += check_union256i_d (res, res_ref);
47 if (fail != 0)
48 abort ();