| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mavx512bf16 -O2" } */ |
| 3 |
/* { dg-final { scan-assembler-times "vdpbf16ps\[ \\t\]+\[^\{\n\]*\[^\{\n\]*%zmm\[0-9\]+\[^\n\r]*%zmm\[0-9\]+\{%k\[0-9\]\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */ |
| 4 |
|
| 5 |
#include <immintrin.h> |
| 6 |
|
| 7 |
typedef union |
| 8 |
{ |
| 9 |
__m512 x; |
| 10 |
float a[16]; |
| 11 |
} union512s; |
| 12 |
|
| 13 |
float res_ref[16]; |
| 14 |
union512s res; |
| 15 |
__m512bh x1, x2; |
| 16 |
__mmask16 m16; |
| 17 |
|
| 18 |
static void __attribute__((noinline, unused)) |
| 19 |
merge_masking_s (float *arr, unsigned long long mask, int size) |
| 20 |
{ |
| 21 |
int i; |
| 22 |
for (i = 0; i < size; i++) |
| 23 |
{ |
| 24 |
arr[i] = (mask & (1LL << i)) ? arr[i] : 117; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
static int __attribute__((noinline, unused)) |
| 29 |
check_union512s (union512s u, const float *v) |
| 30 |
{ |
| 31 |
int i; |
| 32 |
int err = 0; |
| 33 |
for (i = 0; i < (sizeof (u.a) / sizeof ((u.a)[0])); i++) |
| 34 |
if (u.a[i] != v[i]) |
| 35 |
{ |
| 36 |
err++; |
| 37 |
; |
| 38 |
} |
| 39 |
return err; |
| 40 |
} |
| 41 |
|
| 42 |
void extern |
| 43 |
avx512bf16_test (void) |
| 44 |
{ |
| 45 |
res.x = _mm512_mask_dpbf16_ps (res.x, m16, x1, x2); |
| 46 |
merge_masking_s (res_ref, m16, 16); |
| 47 |
if (check_union512s (res, res_ref)) |
| 48 |
abort (); |
| 49 |
} |