| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target avx512f } */ |
| 3 |
/* { dg-options "-O2 -mavx512f" } */ |
| 4 |
|
| 5 |
#include <string.h> |
| 6 |
#include "avx512f-check.h" |
| 7 |
#include "avx512f-helper.h" |
| 8 |
|
| 9 |
void static |
| 10 |
avx512f_test (void) |
| 11 |
{ |
| 12 |
union512d s1; |
| 13 |
union256d res1, res2, res3; |
| 14 |
__mmask8 mask = 0xBA; |
| 15 |
double res_ref[4]; |
| 16 |
int j; |
| 17 |
|
| 18 |
for (j = 0; j < 8; j++) |
| 19 |
{ |
| 20 |
s1.a[j] = j * j / 4.56; |
| 21 |
} |
| 22 |
|
| 23 |
for (j = 0; j < 4; j++) |
| 24 |
{ |
| 25 |
res1.a[j] = DEFAULT_VALUE; |
| 26 |
res2.a[j] = DEFAULT_VALUE; |
| 27 |
res3.a[j] = DEFAULT_VALUE; |
| 28 |
} |
| 29 |
|
| 30 |
res1.x = _mm512_extractf64x4_pd (s1.x, 0); |
| 31 |
res2.x = _mm512_mask_extractf64x4_pd (res2.x, mask, s1.x, 0); |
| 32 |
res3.x = _mm512_maskz_extractf64x4_pd (mask, s1.x, 0); |
| 33 |
|
| 34 |
memset (res_ref, 0, 32); |
| 35 |
memcpy (res_ref, s1.a, 32); |
| 36 |
|
| 37 |
if (check_union256d (res1, res_ref)) |
| 38 |
abort (); |
| 39 |
|
| 40 |
MASK_MERGE (d) (res_ref, mask, 4); |
| 41 |
if (check_union256d (res2, res_ref)) |
| 42 |
abort (); |
| 43 |
|
| 44 |
MASK_ZERO (d) (res_ref, mask, 4); |
| 45 |
if (check_union256d (res3, res_ref)) |
| 46 |
abort (); |
| 47 |
|
| 48 |
res1.x = _mm512_extractf64x4_pd (s1.x, 1); |
| 49 |
res2.x = _mm512_mask_extractf64x4_pd (res2.x, mask, s1.x, 1); |
| 50 |
res3.x = _mm512_maskz_extractf64x4_pd (mask, s1.x, 1); |
| 51 |
|
| 52 |
memset (res_ref, 0, 32); |
| 53 |
memcpy (res_ref, s1.a + 4, 32); |
| 54 |
|
| 55 |
if (check_union256d (res1, res_ref)) |
| 56 |
abort (); |
| 57 |
|
| 58 |
MASK_MERGE (d) (res_ref, mask, 4); |
| 59 |
if (check_union256d (res2, res_ref)) |
| 60 |
abort (); |
| 61 |
|
| 62 |
MASK_ZERO (d) (res_ref, mask, 4); |
| 63 |
if (check_union256d (res3, res_ref)) |
| 64 |
abort (); |
| 65 |
} |