| 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 |
#define SIZE (AVX512F_LEN / 16) |
| 12 |
#include "avx512f-mask-type.h" |
| 13 |
|
| 14 |
void |
| 15 |
TEST (void) |
| 16 |
{ |
| 17 |
int i; |
| 18 |
UNION_TYPE (AVX512F_LEN, bf16_uw) res1, res2, res3, src1; |
| 19 |
MASK_TYPE mask = MASK_VALUE; |
| 20 |
unsigned short res_ref[SIZE], res_ref2[SIZE]; |
| 21 |
|
| 22 |
for (i = 0; i < SIZE; i++) |
| 23 |
{ |
| 24 |
res1.a[i] = 5.0; |
| 25 |
res2.a[i] = DEFAULT_VALUE; |
| 26 |
res3.a[i] = DEFAULT_VALUE; |
| 27 |
src1.a[i] = 0.5; |
| 28 |
float x = convert_bf16_to_fp32 (src1.a[i]); |
| 29 |
res_ref[i] = res_ref2[i] = convert_fp32_to_bf16 (getmant (x)); |
| 30 |
} |
| 31 |
|
| 32 |
res1.x = INTRINSIC (_getmant_pbh) (src1.x, _MM_MANT_NORM_1_2, |
| 33 |
_MM_MANT_SIGN_src); |
| 34 |
res2.x = INTRINSIC (_mask_getmant_pbh) (res2.x, mask, src1.x, |
| 35 |
_MM_MANT_NORM_1_2, |
| 36 |
_MM_MANT_SIGN_src); |
| 37 |
res3.x = INTRINSIC (_maskz_getmant_pbh) (mask, src1.x, |
| 38 |
_MM_MANT_NORM_1_2, |
| 39 |
_MM_MANT_SIGN_src); |
| 40 |
|
| 41 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res1, res_ref)) |
| 42 |
abort (); |
| 43 |
|
| 44 |
MASK_MERGE (bf16_uw) (res_ref2, mask, SIZE); |
| 45 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res2, res_ref2)) |
| 46 |
abort (); |
| 47 |
|
| 48 |
MASK_ZERO (bf16_uw) (res_ref2, mask, SIZE); |
| 49 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res3, res_ref2)) |
| 50 |
abort (); |
| 51 |
} |