| 1 |
/* { dg-do run { target { ! ia32 } } } */ |
| 2 |
/* { dg-require-effective-target amx_avx512 } */ |
| 3 |
/* { dg-options "-O2 -march=x86-64-v3 -mamx-avx512 -mavx512fp16" } */ |
| 4 |
#define AMX_AVX512 |
| 5 |
#define DO_TEST test_amx_avx512_movrow |
| 6 |
void test_amx_avx512_movrow(); |
| 7 |
#include "amx-helper.h" |
| 8 |
|
| 9 |
int j, k; |
| 10 |
volatile __m512 cal_dst, cmp_dst; |
| 11 |
|
| 12 |
#define TEST_MOVROW(X, Y, EI, T, INTRIN) \ |
| 13 |
__m512 \ |
| 14 |
__attribute__((noinline, noclone, __target__("no-amx-avx512"))) \ |
| 15 |
calc_movrow##EI (__tile *src, T __A) \ |
| 16 |
{ \ |
| 17 |
uint8_t *src_buf = (uint8_t *)src->buf; \ |
| 18 |
int N = src->colsb; \ |
| 19 |
int vl = 512; \ |
| 20 |
int vl_bytes = vl >> 3; \ |
| 21 |
int row_index, row_chunk; \ |
| 22 |
__m512 res; \ |
| 23 |
if ((EI) == 'e') \ |
| 24 |
{ \ |
| 25 |
row_index = (__A) & 0xffff; \ |
| 26 |
row_chunk = (((__A) >> 16) & 0xffff) * vl_bytes; \ |
| 27 |
} \ |
| 28 |
else \ |
| 29 |
{ \ |
| 30 |
row_index = (__A) & 0x3f; \ |
| 31 |
row_chunk = ((__A) >> 6) * vl_bytes; \ |
| 32 |
} \ |
| 33 |
union512_ub tmp; \ |
| 34 |
for (j = 0; j < vl_bytes; j++) \ |
| 35 |
if (j + row_chunk >= N) \ |
| 36 |
tmp.u[j] = 0; \ |
| 37 |
else \ |
| 38 |
tmp.u[j] = src_buf[row_index * N + j + row_chunk]; \ |
| 39 |
res = tmp.m; \ |
| 40 |
return res; \ |
| 41 |
} \ |
| 42 |
cal_dst = calc_movrow##EI (X, Y); \ |
| 43 |
cmp_dst = _tile_##INTRIN (1, Y); \ |
| 44 |
COMPARE_ZMM(cal_dst, cmp_dst); |
| 45 |
|
| 46 |
void test_amx_avx512_movrow() |
| 47 |
{ |
| 48 |
__tilecfg_u cfg; |
| 49 |
__tile src; |
| 50 |
unsigned a = 2; |
| 51 |
char e = 'e', i = 'i'; |
| 52 |
|
| 53 |
init_tile_config (&cfg); |
| 54 |
init_tile_reg_and_src (1, src); |
| 55 |
|
| 56 |
TEST_MOVROW (&src, a, e, unsigned, movrow); |
| 57 |
TEST_MOVROW (&src, 1, i, const unsigned, movrowi); |
| 58 |
|
| 59 |
} |