| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx512f" } */ |
| 3 |
/* { dg-require-effective-target avx512f } */ |
| 4 |
|
| 5 |
#define AVX512F |
| 6 |
|
| 7 |
#include "avx512f-helper.h" |
| 8 |
|
| 9 |
#define SIZE (AVX512F_LEN / 32) |
| 10 |
#include "avx512f-mask-type.h" |
| 11 |
#include "string.h" |
| 12 |
|
| 13 |
void static |
| 14 |
CALC (UNION_TYPE (AVX512F_LEN,) s1, union128 s2, float *res_ref, int imm) |
| 15 |
{ |
| 16 |
memcpy (res_ref, s1.a, SIZE * sizeof (float)); |
| 17 |
memcpy (res_ref + imm * 4, s2.a, 16); |
| 18 |
} |
| 19 |
|
| 20 |
void |
| 21 |
TEST (void) |
| 22 |
{ |
| 23 |
UNION_TYPE (AVX512F_LEN,) s1, res1, res2, res3; |
| 24 |
union128 s2; |
| 25 |
float res_ref[SIZE]; |
| 26 |
int j; |
| 27 |
|
| 28 |
MASK_TYPE mask = 6 ^ (0xffd >> SIZE); |
| 29 |
|
| 30 |
for (j = 0; j < SIZE; j++) |
| 31 |
{ |
| 32 |
s1.a[j] = j * j / 10.2; |
| 33 |
res1.a[j] = DEFAULT_VALUE; |
| 34 |
res2.a[j] = DEFAULT_VALUE; |
| 35 |
res3.a[j] = DEFAULT_VALUE; |
| 36 |
} |
| 37 |
|
| 38 |
for (j = 0; j < 4; j++) |
| 39 |
s2.a[j] = j * j * j / 2.03; |
| 40 |
|
| 41 |
res1.x = INTRINSIC (_insertf32x4) (s1.x, s2.x, 1); |
| 42 |
res2.x = INTRINSIC (_mask_insertf32x4) (res2.x, mask, s1.x, s2.x, 1); |
| 43 |
res3.x = INTRINSIC (_maskz_insertf32x4) (mask, s1.x, s2.x, 1); |
| 44 |
|
| 45 |
CALC (s1, s2, res_ref, 1); |
| 46 |
|
| 47 |
if (UNION_CHECK (AVX512F_LEN,) (res1, res_ref)) |
| 48 |
abort (); |
| 49 |
|
| 50 |
MASK_MERGE () (res_ref, mask, SIZE); |
| 51 |
|
| 52 |
if (UNION_CHECK (AVX512F_LEN,) (res2, res_ref)) |
| 53 |
abort (); |
| 54 |
|
| 55 |
MASK_ZERO () (res_ref, mask, SIZE); |
| 56 |
|
| 57 |
if (UNION_CHECK (AVX512F_LEN,) (res3, res_ref)) |
| 58 |
abort (); |
| 59 |
} |