Debian Codegraph @

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

raw
1 /* { dg-do run { target { riscv_v } } } */
2
3 #include "strided_load-2.c"
4 #include <assert.h>
5
6 int
7 main (void)
8 {
9 #define RUN_LOOP(DATA_TYPE, BITS) \
10 DATA_TYPE dest_##DATA_TYPE##_##BITS[(BITS - 3) * (BITS + 13)]; \
11 DATA_TYPE dest2_##DATA_TYPE##_##BITS[(BITS - 3) * (BITS + 13)]; \
12 DATA_TYPE src_##DATA_TYPE##_##BITS[(BITS - 3) * (BITS + 13)]; \
13 INDEX##BITS stride_##DATA_TYPE##_##BITS = (BITS - 3); \
14 INDEX##BITS n_##DATA_TYPE##_##BITS = (BITS + 13); \
15 for (INDEX##BITS i = 0; \
16 i < stride_##DATA_TYPE##_##BITS * n_##DATA_TYPE##_##BITS; i++) \
17 { \
18 dest_##DATA_TYPE##_##BITS[i] \
19 = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
20 dest2_##DATA_TYPE##_##BITS[i] \
21 = (DATA_TYPE) ((i * 81 + 735) & (BITS - 1)); \
22 src_##DATA_TYPE##_##BITS[i] \
23 = (DATA_TYPE) ((i * 13 + 9107) & (BITS - 1)); \
24 } \
25 f_##DATA_TYPE##_##BITS (dest_##DATA_TYPE##_##BITS, src_##DATA_TYPE##_##BITS, \
26 stride_##DATA_TYPE##_##BITS, \
27 n_##DATA_TYPE##_##BITS); \
28 for (int i = 0; i < n_##DATA_TYPE##_##BITS; i++) \
29 { \
30 assert ( \
31 dest_##DATA_TYPE##_##BITS[i] \
32 == (dest2_##DATA_TYPE##_##BITS[i] \
33 + src_##DATA_TYPE##_##BITS[i * stride_##DATA_TYPE##_##BITS])); \
34 }
35
36 RUN_LOOP (int8_t, 8)
37 RUN_LOOP (uint8_t, 8)
38 RUN_LOOP (int16_t, 8)
39 RUN_LOOP (uint16_t, 8)
40 RUN_LOOP (_Float16, 8)
41 RUN_LOOP (int32_t, 8)
42 RUN_LOOP (uint32_t, 8)
43 RUN_LOOP (float, 8)
44 RUN_LOOP (int64_t, 8)
45 RUN_LOOP (uint64_t, 8)
46 RUN_LOOP (double, 8)
47
48 RUN_LOOP (int8_t, 16)
49 RUN_LOOP (uint8_t, 16)
50 RUN_LOOP (int16_t, 16)
51 RUN_LOOP (uint16_t, 16)
52 RUN_LOOP (_Float16, 16)
53 RUN_LOOP (int32_t, 16)
54 RUN_LOOP (uint32_t, 16)
55 RUN_LOOP (float, 16)
56 RUN_LOOP (int64_t, 16)
57 RUN_LOOP (uint64_t, 16)
58 RUN_LOOP (double, 16)
59
60 RUN_LOOP (int8_t, 32)
61 RUN_LOOP (uint8_t, 32)
62 RUN_LOOP (int16_t, 32)
63 RUN_LOOP (uint16_t, 32)
64 RUN_LOOP (_Float16, 32)
65 RUN_LOOP (int32_t, 32)
66 RUN_LOOP (uint32_t, 32)
67 RUN_LOOP (float, 32)
68 RUN_LOOP (int64_t, 32)
69 RUN_LOOP (uint64_t, 32)
70 RUN_LOOP (double, 32)
71
72 RUN_LOOP (int8_t, 64)
73 RUN_LOOP (uint8_t, 64)
74 RUN_LOOP (int16_t, 64)
75 RUN_LOOP (uint16_t, 64)
76 RUN_LOOP (_Float16, 64)
77 RUN_LOOP (int32_t, 64)
78 RUN_LOOP (uint32_t, 64)
79 RUN_LOOP (float, 64)
80 RUN_LOOP (int64_t, 64)
81 RUN_LOOP (uint64_t, 64)
82 RUN_LOOP (double, 64)
83 return 0;
84 }