Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/gather_load_run-2.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2
3
4 #include "gather_load_64-2.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 for (int i = 0; i < 128; i++) \
16 { \
17 dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
18 dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
19 src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \
20 indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \
21 } \
22 f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \
23 indices_##DATA_TYPE##_##BITS); \
24 for (int i = 0; i < 128; i++) \
25 assert (dest_##DATA_TYPE[i] \
26 == (dest2_##DATA_TYPE[i] \
27 + src_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]]));
28
29 RUN_LOOP (int8_t, 8)
30 RUN_LOOP (uint8_t, 8)
31 RUN_LOOP (int16_t, 16)
32 RUN_LOOP (uint16_t, 16)
33 RUN_LOOP (_Float16, 16)
34 RUN_LOOP (int32_t, 32)
35 RUN_LOOP (uint32_t, 32)
36 RUN_LOOP (float, 32)
37 RUN_LOOP (int64_t, 64)
38 RUN_LOOP (uint64_t, 64)
39 RUN_LOOP (double, 64)
40 return 0;
41 }