| 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 |
|
| 8 |
#define SIZE (128 / 64) |
| 9 |
#include "avx512f-mask-type.h" |
| 10 |
|
| 11 |
static void |
| 12 |
compute_sqrtsd (double *s1, double *s2, double *r) |
| 13 |
{ |
| 14 |
r[0] = sqrt(s2[0]); |
| 15 |
r[1] = s1[1]; |
| 16 |
} |
| 17 |
|
| 18 |
void static |
| 19 |
avx512f_test (void) |
| 20 |
{ |
| 21 |
union128d res1, res2, res3, res4, res5; |
| 22 |
union128d s1, s2; |
| 23 |
double res_ref[SIZE]; |
| 24 |
MASK_TYPE mask = MASK_VALUE; |
| 25 |
int i; |
| 26 |
|
| 27 |
for (i = 0; i < SIZE; i++) |
| 28 |
{ |
| 29 |
s1.a[i] = 11.5 * (i + 1); |
| 30 |
s2.a[i] = 10.5 * (i + 1); |
| 31 |
res_ref[i] = 9.5 * (i + 1); |
| 32 |
res1.a[i] = DEFAULT_VALUE; |
| 33 |
res2.a[i] = DEFAULT_VALUE; |
| 34 |
res3.a[i] = DEFAULT_VALUE; |
| 35 |
res4.a[i] = DEFAULT_VALUE; |
| 36 |
res5.a[i] = DEFAULT_VALUE; |
| 37 |
} |
| 38 |
|
| 39 |
res1.x = _mm_sqrt_round_sd (s1.x, s2.x, |
| 40 |
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); |
| 41 |
res2.x = _mm_mask_sqrt_round_sd (s1.x, mask, s1.x, s2.x, |
| 42 |
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); |
| 43 |
res3.x = _mm_maskz_sqrt_round_sd (mask, s1.x, s2.x, |
| 44 |
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); |
| 45 |
res4.x = _mm_mask_sqrt_sd (s1.x, mask, s1.x, s2.x); |
| 46 |
res5.x = _mm_maskz_sqrt_sd (mask, s1.x, s2.x); |
| 47 |
|
| 48 |
compute_sqrtsd (s1.a, s2.a, res_ref); |
| 49 |
|
| 50 |
if (check_union128d (res1, res_ref)) |
| 51 |
abort (); |
| 52 |
|
| 53 |
MASK_MERGE (d) (res_ref, mask, 1); |
| 54 |
|
| 55 |
if (check_union128d (res2, res_ref)) |
| 56 |
abort (); |
| 57 |
|
| 58 |
if (check_union128d (res4, res_ref)) |
| 59 |
abort (); |
| 60 |
|
| 61 |
MASK_ZERO (d) (res_ref, mask, 1); |
| 62 |
|
| 63 |
if (check_union128d (res3, res_ref)) |
| 64 |
abort (); |
| 65 |
|
| 66 |
if (check_union128d (res5, res_ref)) |
| 67 |
abort (); |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|