Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512er-vrsqrt28ps-2.c
bloba92472e61917b6503c24cae5fc761fdbfd1fcf8d
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"
8 #include <math.h>
10 void static
11 compute_vrsqrt28ps (float *s, float *r)
13 int i;
14 for (i = 0; i < 16; i++)
15 r[i] = 1.0 / sqrt (s[i]);
18 void static
19 avx512er_test (void)
21 union512 src, res1, res2, res3;
22 __mmask16 mask = MASK_VALUE;
23 float res_ref[16];
24 int i;
26 for (i = 0; i < 16; i++)
28 src.a[i] = 179.345 - 6.5645 * i;
29 res2.a[i] = DEFAULT_VALUE;
32 res1.x = _mm512_rsqrt28_ps (src.x);
33 res2.x = _mm512_mask_rsqrt28_ps (res2.x, mask, src.x);
34 res3.x = _mm512_maskz_rsqrt28_ps (mask, src.x);
36 compute_vrsqrt28ps (src.a, res_ref);
38 if (check_rough_union512 (res1, res_ref, 0.0001))
39 abort ();
41 MASK_MERGE ()(res_ref, mask, 16);
42 if (check_rough_union512 (res2, res_ref, 0.0001))
43 abort ();
45 MASK_ZERO ()(res_ref, mask, 16);
46 if (check_rough_union512 (res3, res_ref, 0.0001))
47 abort ();