| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-mavx512f -O2" } */ |
| 3 |
/* { dg-require-effective-target avx512f } */ |
| 4 |
|
| 5 |
#include <math.h> |
| 6 |
#include "avx512f-check.h" |
| 7 |
#include "avx512f-helper.h" |
| 8 |
|
| 9 |
static void |
| 10 |
compute_vrsqrt14ss (float *s1, float *s2, float *r) |
| 11 |
{ |
| 12 |
r[0] = 1.0 / sqrt (s2[0]); |
| 13 |
r[1] = s1[1]; |
| 14 |
r[2] = s1[2]; |
| 15 |
r[3] = s1[3]; |
| 16 |
} |
| 17 |
|
| 18 |
static void |
| 19 |
avx512f_test (void) |
| 20 |
{ |
| 21 |
union128 s1, s2, res1, res2, res3; |
| 22 |
__mmask8 m = 0; |
| 23 |
float res_ref[4]; |
| 24 |
|
| 25 |
s1.x = _mm_set_ps (-24.43, 68.346, -43.35, 546.46); |
| 26 |
s2.x = _mm_set_ps (222.222, 333.333, 444.444, 4.0); |
| 27 |
|
| 28 |
res1.x = _mm_rsqrt14_ss (s1.x, s2.x); |
| 29 |
|
| 30 |
compute_vrsqrt14ss (s1.a, s2.a, res_ref); |
| 31 |
|
| 32 |
if (check_fp_union128 (res1, res_ref)) |
| 33 |
abort (); |
| 34 |
|
| 35 |
res2.x = _mm_set_ps (5.0, 6.0, 7.0, DEFAULT_VALUE); |
| 36 |
res2.x = _mm_mask_rsqrt14_ss(res2.x, m, s1.x, s2.x); |
| 37 |
|
| 38 |
MASK_MERGE () (res_ref, m, 1); |
| 39 |
if (checkVf (res2.a, res_ref, 4)) |
| 40 |
abort(); |
| 41 |
|
| 42 |
res3.x = _mm_maskz_rsqrt14_ss(m, s1.x, s2.x); |
| 43 |
|
| 44 |
MASK_ZERO () (res_ref, m, 1); |
| 45 |
if (checkVf (res3.a, res_ref, 4)) |
| 46 |
abort(); |
| 47 |
} |