2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512er-vrcp28pd-2.c
blob609aeaa31c699f3acc0409da4a84683600c41142
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512er } */
3 /* { dg-options "-O2 -mavx512er" } */
5 #include "avx512er-check.h"
6 #include "avx512f-mask-type.h"
7 #include "avx512f-helper.h"
9 void static
10 compute_vrcp28pd (double *s, double *r)
12 int i;
13 for (i = 0; i < 8; i++)
14 r[i] = 1.0 / s[i];
17 void static
18 avx512er_test (void)
20 union512d src, res1, res2, res3;
21 __mmask8 mask = MASK_VALUE;
22 double res_ref[8];
23 int i;
25 for (i = 0; i < 8; i++)
27 src.a[i] = 179.345 - 6.5645 * i;
28 res2.a[i] = DEFAULT_VALUE;
31 res1.x = _mm512_rcp28_pd (src.x);
32 res2.x = _mm512_mask_rcp28_pd (res2.x, mask, src.x);
33 res3.x = _mm512_maskz_rcp28_pd (mask, src.x);
35 compute_vrcp28pd (src.a, res_ref);
37 if (check_rough_union512d (res1, res_ref, 0.0001))
38 abort ();
40 MASK_MERGE (d) (res_ref, mask, 8);
41 if (check_rough_union512d (res2, res_ref, 0.0001))
42 abort ();
44 MASK_ZERO (d) (res_ref, mask, 8);
45 if (check_rough_union512d (res3, res_ref, 0.0001))
46 abort ();