| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -march=x86-64-v3 -mavx10.2" } */ |
| 3 |
/* { dg-require-effective-target avx10_2 } */ |
| 4 |
|
| 5 |
#ifndef AVX10_2 |
| 6 |
#define AVX10_2 |
| 7 |
#define AVX10_2_512 |
| 8 |
#define AVX10_512BIT |
| 9 |
#endif |
| 10 |
#include "avx10-helper.h" |
| 11 |
#include <stdint.h> |
| 12 |
|
| 13 |
#define SIZE (AVX512F_LEN / 16) |
| 14 |
#include "avx512f-mask-type.h" |
| 15 |
|
| 16 |
static void |
| 17 |
CALC (_Float16 *res_ref, float *src1, float *src2) |
| 18 |
{ |
| 19 |
float fp32; |
| 20 |
int i; |
| 21 |
for (i = 0; i < SIZE / 2; i++) |
| 22 |
{ |
| 23 |
fp32 = (float) 2 * i + 7 + i * 0.5; |
| 24 |
res_ref[i] = fp32; |
| 25 |
src2[i] = fp32; |
| 26 |
} |
| 27 |
for (i = SIZE / 2; i < SIZE; i++) |
| 28 |
{ |
| 29 |
fp32 = (float)2 * i + 7 + i * 0.5; |
| 30 |
res_ref[i] = fp32; |
| 31 |
src1[i - (SIZE / 2)] = fp32; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
void |
| 36 |
TEST (void) |
| 37 |
{ |
| 38 |
int i; |
| 39 |
UNION_TYPE (AVX512F_LEN, h) res1, res2, res3; |
| 40 |
UNION_TYPE (AVX512F_LEN, ) src1, src2; |
| 41 |
MASK_TYPE mask = MASK_VALUE; |
| 42 |
_Float16 res_ref[SIZE]; |
| 43 |
|
| 44 |
for (i = 0; i < SIZE; i++) |
| 45 |
res2.a[i] = DEFAULT_VALUE; |
| 46 |
|
| 47 |
CALC (res_ref, src1.a, src2.a); |
| 48 |
|
| 49 |
res1.x = INTRINSIC (_cvtx2ps_ph) (src1.x, src2.x); |
| 50 |
if (UNION_CHECK (AVX512F_LEN, h) (res1, res_ref)) |
| 51 |
abort (); |
| 52 |
|
| 53 |
res2.x = INTRINSIC (_mask_cvtx2ps_ph) (res2.x, mask, src1.x, src2.x); |
| 54 |
MASK_MERGE (h) (res_ref, mask, SIZE); |
| 55 |
if (UNION_CHECK (AVX512F_LEN, h) (res2, res_ref)) |
| 56 |
abort (); |
| 57 |
|
| 58 |
res3.x = INTRINSIC (_maskz_cvtx2ps_ph) (mask, src1.x, src2.x); |
| 59 |
MASK_ZERO (h) (res_ref, mask, SIZE); |
| 60 |
if (UNION_CHECK (AVX512F_LEN, h) (res3, res_ref)) |
| 61 |
abort (); |
| 62 |
} |