2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpsrlvd128-2.c
blobc7674c02cb4094ac25f37ed026dc4db3f341908e
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 static void
9 compute_psrlvd128 (int *s1, int *s2, int *r)
11 int i, count;
13 for (i = 0; i < 4; ++i)
15 count = s2[i];
16 r[i] = ((unsigned) s1[i]) >> count;
21 void static
22 avx2_test (void)
24 union128i_d s1, s2, res;
25 int res_ref[4];
26 int i, j, sign;
27 int fail = 0;
29 for (i = 0; i < 10; i++)
31 for (j = 0; j < 4; j++)
33 s1.a[j] = j * i * sign;
34 s2.a[j] = (j + i) >> 2;
35 sign = -sign;
38 res.x = _mm_srlv_epi32 (s1.x, s2.x);
40 compute_psrlvd128 (s1.a, s2.a, res_ref);
42 fail += check_union128i_d (res, res_ref);
45 if (fail != 0)
46 abort ();