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