| 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, src2; |
| 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] = 0; |
| 25 |
res2.a[i] = DEFAULT_VALUE; |
| 26 |
res3.a[i] = DEFAULT_VALUE; |
| 27 |
float x = (float) (2 * (i % 7) + 7); |
| 28 |
float y = (float) (3 * (i % 7) - 5); |
| 29 |
float res; |
| 30 |
src2.a[i] = convert_fp32_to_bf16 (y); |
| 31 |
src1.a[i] = convert_fp32_to_bf16 (x); |
| 32 |
res = x / y; |
| 33 |
res_ref[i] = res_ref2[i] = convert_fp32_to_bf16_ne (res); |
| 34 |
} |
| 35 |
|
| 36 |
res1.x = INTRINSIC (_div_pbh) (src1.x, src2.x); |
| 37 |
res2.x = INTRINSIC (_mask_div_pbh) (res2.x, mask, src1.x, src2.x); |
| 38 |
res3.x = INTRINSIC (_maskz_div_pbh) (mask, src1.x, src2.x); |
| 39 |
|
| 40 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res1, res_ref)) |
| 41 |
abort (); |
| 42 |
|
| 43 |
MASK_MERGE (bf16_uw) (res_ref2, mask, SIZE); |
| 44 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res2, res_ref2)) |
| 45 |
abort (); |
| 46 |
|
| 47 |
MASK_ZERO (bf16_uw) (res_ref2, mask, SIZE); |
| 48 |
if (UNION_CHECK (AVX512F_LEN, bf16_uw) (res3, res_ref2)) |
| 49 |
abort (); |
| 50 |
} |