Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_run-11.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-mcmodel=medany" } */
3
4 #include "mask_gather_load_64-11.c"
5 #include <assert.h>
6
7 int
8 main (void)
9 {
10 #define RUN_LOOP(DATA_TYPE, INDEX_TYPE) \
11 DATA_TYPE dest_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \
12 DATA_TYPE dest2_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \
13 DATA_TYPE src_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \
14 INDEX_TYPE index_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \
15 INDEX_TYPE cond_##DATA_TYPE##_##INDEX_TYPE[202] = {0}; \
16 for (int i = 0; i < 202; i++) \
17 { \
18 src_##DATA_TYPE##_##INDEX_TYPE[i] \
19 = (DATA_TYPE) ((i * 19 + 735) & (sizeof (DATA_TYPE) * 7 - 1)); \
20 dest_##DATA_TYPE##_##INDEX_TYPE[i] \
21 = (DATA_TYPE) ((i * 7 + 666) & (sizeof (DATA_TYPE) * 5 - 1)); \
22 dest2_##DATA_TYPE##_##INDEX_TYPE[i] \
23 = (DATA_TYPE) ((i * 7 + 666) & (sizeof (DATA_TYPE) * 5 - 1)); \
24 index_##DATA_TYPE##_##INDEX_TYPE[i] = (i * 7) % (55); \
25 cond_##DATA_TYPE##_##INDEX_TYPE[i] = (INDEX_TYPE) ((i & 0x3) == 3); \
26 } \
27 f_##DATA_TYPE##_##INDEX_TYPE (dest_##DATA_TYPE##_##INDEX_TYPE, \
28 src_##DATA_TYPE##_##INDEX_TYPE, \
29 index_##DATA_TYPE##_##INDEX_TYPE, \
30 cond_##DATA_TYPE##_##INDEX_TYPE); \
31 for (int i = 0; i < 100; i++) \
32 { \
33 if (cond_##DATA_TYPE##_##INDEX_TYPE[i * 2]) \
34 assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \
35 == (src_##DATA_TYPE##_##INDEX_TYPE \
36 [index_##DATA_TYPE##_##INDEX_TYPE[i * 2]] \
37 + 1)); \
38 else \
39 assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2] \
40 == dest2_##DATA_TYPE##_##INDEX_TYPE[i * 2]); \
41 if (cond_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]) \
42 assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \
43 == (src_##DATA_TYPE##_##INDEX_TYPE \
44 [index_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]] \
45 + 2)); \
46 else \
47 assert (dest_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1] \
48 == dest2_##DATA_TYPE##_##INDEX_TYPE[i * 2 + 1]); \
49 }
50
51 RUN_LOOP (int8_t, int8_t)
52 RUN_LOOP (uint8_t, int8_t)
53 RUN_LOOP (int16_t, int8_t)
54 RUN_LOOP (uint16_t, int8_t)
55 RUN_LOOP (int32_t, int8_t)
56 RUN_LOOP (uint32_t, int8_t)
57 RUN_LOOP (int64_t, int8_t)
58 RUN_LOOP (uint64_t, int8_t)
59 RUN_LOOP (_Float16, int8_t)
60 RUN_LOOP (float, int8_t)
61 RUN_LOOP (double, int8_t)
62 RUN_LOOP (int8_t, int16_t)
63 RUN_LOOP (uint8_t, int16_t)
64 RUN_LOOP (int16_t, int16_t)
65 RUN_LOOP (uint16_t, int16_t)
66 RUN_LOOP (int32_t, int16_t)
67 RUN_LOOP (uint32_t, int16_t)
68 RUN_LOOP (int64_t, int16_t)
69 RUN_LOOP (uint64_t, int16_t)
70 RUN_LOOP (_Float16, int16_t)
71 RUN_LOOP (float, int16_t)
72 RUN_LOOP (double, int16_t)
73 RUN_LOOP (int8_t, int32_t)
74 RUN_LOOP (uint8_t, int32_t)
75 RUN_LOOP (int16_t, int32_t)
76 RUN_LOOP (uint16_t, int32_t)
77 RUN_LOOP (int32_t, int32_t)
78 RUN_LOOP (uint32_t, int32_t)
79 RUN_LOOP (int64_t, int32_t)
80 RUN_LOOP (uint64_t, int32_t)
81 RUN_LOOP (_Float16, int32_t)
82 RUN_LOOP (float, int32_t)
83 RUN_LOOP (double, int32_t)
84 RUN_LOOP (int8_t, int64_t)
85 RUN_LOOP (uint8_t, int64_t)
86 RUN_LOOP (int16_t, int64_t)
87 RUN_LOOP (uint16_t, int64_t)
88 RUN_LOOP (int32_t, int64_t)
89 RUN_LOOP (uint32_t, int64_t)
90 RUN_LOOP (int64_t, int64_t)
91 RUN_LOOP (uint64_t, int64_t)
92 RUN_LOOP (_Float16, int64_t)
93 RUN_LOOP (float, int64_t)
94 RUN_LOOP (double, int64_t)
95 RUN_LOOP (int8_t, uint8_t)
96 RUN_LOOP (uint8_t, uint8_t)
97 RUN_LOOP (int16_t, uint8_t)
98 RUN_LOOP (uint16_t, uint8_t)
99 RUN_LOOP (int32_t, uint8_t)
100 RUN_LOOP (uint32_t, uint8_t)
101 RUN_LOOP (int64_t, uint8_t)
102 RUN_LOOP (uint64_t, uint8_t)
103 RUN_LOOP (_Float16, uint8_t)
104 RUN_LOOP (float, uint8_t)
105 RUN_LOOP (double, uint8_t)
106 RUN_LOOP (int8_t, uint16_t)
107 RUN_LOOP (uint8_t, uint16_t)
108 RUN_LOOP (int16_t, uint16_t)
109 RUN_LOOP (uint16_t, uint16_t)
110 RUN_LOOP (int32_t, uint16_t)
111 RUN_LOOP (uint32_t, uint16_t)
112 RUN_LOOP (int64_t, uint16_t)
113 RUN_LOOP (uint64_t, uint16_t)
114 RUN_LOOP (_Float16, uint16_t)
115 RUN_LOOP (float, uint16_t)
116 RUN_LOOP (double, uint16_t)
117 RUN_LOOP (int8_t, uint32_t)
118 RUN_LOOP (uint8_t, uint32_t)
119 RUN_LOOP (int16_t, uint32_t)
120 RUN_LOOP (uint16_t, uint32_t)
121 RUN_LOOP (int32_t, uint32_t)
122 RUN_LOOP (uint32_t, uint32_t)
123 RUN_LOOP (int64_t, uint32_t)
124 RUN_LOOP (uint64_t, uint32_t)
125 RUN_LOOP (_Float16, uint32_t)
126 RUN_LOOP (float, uint32_t)
127 RUN_LOOP (double, uint32_t)
128 RUN_LOOP (int8_t, uint64_t)
129 RUN_LOOP (uint8_t, uint64_t)
130 RUN_LOOP (int16_t, uint64_t)
131 RUN_LOOP (uint16_t, uint64_t)
132 RUN_LOOP (int32_t, uint64_t)
133 RUN_LOOP (uint32_t, uint64_t)
134 RUN_LOOP (int64_t, uint64_t)
135 RUN_LOOP (uint64_t, uint64_t)
136 RUN_LOOP (_Float16, uint64_t)
137 RUN_LOOP (float, uint64_t)
138 RUN_LOOP (double, uint64_t)
139 return 0;
140 }