Debian Codegraph @

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

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* For some reason we exceed
3 the default code model's +-2 GiB limits. We should investigate why and
4 add a proper description here. For now just make sure the test case
5 compiles properly. */
6 /* { dg-additional-options "-mcmodel=medany" } */
7
8 #include "mask_scatter_store_64-8.c"
9 #include <assert.h>
10
11 int
12 main (void)
13 {
14 #define RUN_LOOP(DATA_TYPE, BITS) \
15 DATA_TYPE dest_##DATA_TYPE[128]; \
16 DATA_TYPE dest2_##DATA_TYPE[128]; \
17 DATA_TYPE src_##DATA_TYPE[128]; \
18 INDEX##BITS indices_##DATA_TYPE##_##BITS[128]; \
19 INDEX##BITS cond_##DATA_TYPE##_##BITS[128] = {0}; \
20 for (int i = 0; i < 128; i++) \
21 { \
22 dest_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
23 dest2_##DATA_TYPE[i] = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
24 src_##DATA_TYPE[i] = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \
25 indices_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i * 3 + 67) % 128); \
26 cond_##DATA_TYPE##_##BITS[i] = (DATA_TYPE) ((i & 0x3) == 3); \
27 } \
28 f_##DATA_TYPE (dest_##DATA_TYPE, src_##DATA_TYPE, \
29 indices_##DATA_TYPE##_##BITS, cond_##DATA_TYPE##_##BITS); \
30 for (int i = 0; i < 128; i++) \
31 { \
32 if (cond_##DATA_TYPE##_##BITS[i]) \
33 assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \
34 == (src_##DATA_TYPE[i] + 1)); \
35 else \
36 assert (dest_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]] \
37 == dest2_##DATA_TYPE[indices_##DATA_TYPE##_##BITS[i]]); \
38 }
39
40 RUN_LOOP (int8_t, 32)
41 RUN_LOOP (uint8_t, 32)
42 RUN_LOOP (int16_t, 32)
43 RUN_LOOP (uint16_t, 32)
44 RUN_LOOP (_Float16, 32)
45 RUN_LOOP (int32_t, 32)
46 RUN_LOOP (uint32_t, 32)
47 RUN_LOOP (float, 32)
48 RUN_LOOP (int64_t, 32)
49 RUN_LOOP (uint64_t, 32)
50 RUN_LOOP (double, 32)
51 return 0;
52 }