Debian Codegraph @

gcc/testsuite/gcc.target/i386/amxavx512-cvtrowd2ps-2.c

raw
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_cvtrowd2ps
6 void test_amx_avx512_cvtrowd2ps();
7 #include "amx-helper.h"
8
9 volatile __m512 cal_dst, cmp_dst;
10
11 #define DEFINE_TEST_CVTROWD2PS(EI, T) \
12 __m512 \
13 __attribute__((noinline, noclone, __target__("no-amx-avx512"))) \
14 calc_cvtrowd2ps##EI (__tile *src, T __A) \
15 { \
16 uint32_t *src_buf = (uint32_t *)src->buf; \
17 int N = src->colsb / 4; \
18 int vl = 512; \
19 int vl_bytes = vl >> 3; \
20 int row_index, row_chunk, j; \
21 __m512 res; \
22 if ((#EI) == "e") \
23 { \
24 row_index = (__A) & 0xffff; \
25 row_chunk = (((__A) >> 16) & 0xffff) * vl_bytes; \
26 } \
27 else \
28 { \
29 row_index = (__A) & 0x3f; \
30 row_chunk = ((__A) >> 6) * vl_bytes; \
31 } \
32 for (j = 0; j < vl_bytes / 4; j++) \
33 if (j + row_chunk / 4 >= N) \
34 res[j] = 0; \
35 else \
36 res[j] = (float) (int) src_buf[row_index * N + j + row_chunk / 4]; \
37 return res; \
38 }
39
40 DEFINE_TEST_CVTROWD2PS(e, unsigned)
41 DEFINE_TEST_CVTROWD2PS(i, const unsigned)
42
43 #define TEST_CVTROWD2PS(X, Y, EI, T, INTRIN) \
44 cal_dst = calc_cvtrowd2ps##EI (X, Y); \
45 cmp_dst = _tile_##INTRIN (1, Y); \
46 COMPARE_ZMM(cal_dst, cmp_dst);
47
48 void test_amx_avx512_cvtrowd2ps()
49 {
50 __tilecfg_u cfg;
51 __tile src;
52 uint8_t tmp_dst_buf[1024];
53 unsigned a = 2;
54
55 init_int32_max_tile_buffer (tmp_dst_buf);
56
57 init_tile_config (&cfg);
58 init_tile_reg_and_src_with_buffer (1, src, tmp_dst_buf);
59
60 TEST_CVTROWD2PS (&src, a, e, unsigned, cvtrowd2ps);
61 TEST_CVTROWD2PS (&src, 1, i, const unsigned, cvtrowd2psi);
62 }