Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_run-9.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2
3
4 #include "mask_scatter_store_64-9.c"
5 #include <assert.h>
6
7 int
8 main (void)
9 {
10 #define RUN_LOOP(DATA_TYPE, BITS) \
11 DATA_TYPE dest_##DATA_TYPE[128]; \
12 DATA_TYPE dest2_##DATA_TYPE[128]; \
13 DATA_TYPE src_##DATA_TYPE[128]; \
14 INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \
15 INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \
16 for (int i = 0; i < 128; i++) \
17 { \
18 dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
19 dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
20 src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \
21 indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \
22 cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \
23 } \
24 f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \
25 indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \
26 for (int i = 0; i < 128; i++) \
27 { \
28 if (cond_##DATA_TYPE##_##BITS[i]) \
29 assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \
30 == (src_##DATA_TYPE[i] + 1)); \
31 else \
32 assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \
33 == dest2_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]]); \
34 }
35
36 RUN_LOOP (int8_t, 64)
37 RUN_LOOP (uint8_t, 64)
38 RUN_LOOP (int16_t, 64)
39 RUN_LOOP (uint16_t, 64)
40 RUN_LOOP (_Float16, 64)
41 RUN_LOOP (int32_t, 64)
42 RUN_LOOP (uint32_t, 64)
43 RUN_LOOP (float, 64)
44 RUN_LOOP (int64_t, 64)
45 RUN_LOOP (uint64_t, 64)
46 RUN_LOOP (double, 64)
47 return 0;
48 }