Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-run.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-std=c99 -fno-vect-cost-model -mrvv-vector-bits=scalable" } */
3
4 #include "vfncvt-ftoi-template.h"
5
6 #define RUN(TYPE1, TYPE2, NUM) \
7 TYPE1 src##TYPE1##TYPE2##NUM[NUM]; \
8 TYPE2 dst##TYPE1##TYPE2##NUM[NUM]; \
9 for (int i = 0; i < NUM; i++) \
10 { \
11 src##TYPE1##TYPE2##NUM[i] = i * -3.1315926 - 92.947289; \
12 } \
13 vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
14 for (int i = 0; i < NUM; i++) \
15 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
16 __builtin_abort ();
17
18 #define RUN2(TYPE1, TYPE2, NUM) \
19 TYPE1 src##TYPE1##TYPE2##NUM[NUM]; \
20 TYPE2 dst##TYPE1##TYPE2##NUM[NUM]; \
21 for (int i = 0; i < NUM; i++) \
22 { \
23 src##TYPE1##TYPE2##NUM[i] = i * 3.1315926 + 92.947289; \
24 } \
25 vfncvt_##TYPE1##TYPE2 (dst##TYPE1##TYPE2##NUM, src##TYPE1##TYPE2##NUM, NUM); \
26 for (int i = 0; i < NUM; i++) \
27 if (dst##TYPE1##TYPE2##NUM[i] != (TYPE2) src##TYPE1##TYPE2##NUM[i]) \
28 __builtin_abort ();
29
30 int
31 main ()
32 {
33 RUN (float, int16_t, 3)
34 RUN (float, int16_t, 4)
35 RUN (float, int16_t, 7)
36 RUN (float, int16_t, 99)
37 RUN (float, int16_t, 119)
38 RUN (float, int16_t, 128)
39 RUN (float, int16_t, 256)
40 RUN (float, int16_t, 279)
41 RUN (float, int16_t, 555)
42 RUN (float, int16_t, 1024)
43 RUN (float, int16_t, 1389)
44 RUN (float, int16_t, 2048)
45 RUN (float, int16_t, 3989)
46 RUN (float, int16_t, 4096)
47 RUN (float, int16_t, 5975)
48
49 RUN2 (float, uint16_t, 3)
50 RUN2 (float, uint16_t, 4)
51 RUN2 (float, uint16_t, 7)
52 RUN2 (float, uint16_t, 99)
53 RUN2 (float, uint16_t, 119)
54 RUN2 (float, uint16_t, 128)
55 RUN2 (float, uint16_t, 256)
56 RUN2 (float, uint16_t, 279)
57 RUN2 (float, uint16_t, 555)
58 RUN2 (float, uint16_t, 1024)
59 RUN2 (float, uint16_t, 1389)
60 RUN2 (float, uint16_t, 2048)
61 RUN2 (float, uint16_t, 3989)
62 RUN2 (float, uint16_t, 4096)
63 RUN2 (float, uint16_t, 5975)
64
65 RUN (float, int8_t, 3)
66 RUN (float, int8_t, 4)
67 RUN (float, int8_t, 7)
68 RUN (float, int8_t, 99)
69 RUN (float, int8_t, 119)
70 RUN (float, int8_t, 128)
71 RUN (float, int8_t, 256)
72 RUN (float, int8_t, 279)
73 RUN (float, int8_t, 555)
74 RUN (float, int8_t, 1024)
75 RUN (float, int8_t, 1389)
76 RUN (float, int8_t, 2048)
77 RUN (float, int8_t, 3989)
78 RUN (float, int8_t, 4096)
79 RUN (float, int8_t, 5975)
80
81 RUN2 (float, uint8_t, 3)
82 RUN2 (float, uint8_t, 4)
83 RUN2 (float, uint8_t, 7)
84 RUN2 (float, uint8_t, 99)
85 RUN2 (float, uint8_t, 119)
86 RUN2 (float, uint8_t, 128)
87 RUN2 (float, uint8_t, 256)
88 RUN2 (float, uint8_t, 279)
89 RUN2 (float, uint8_t, 555)
90 RUN2 (float, uint8_t, 1024)
91 RUN2 (float, uint8_t, 1389)
92 RUN2 (float, uint8_t, 2048)
93 RUN2 (float, uint8_t, 3989)
94 RUN2 (float, uint8_t, 4096)
95 RUN2 (float, uint8_t, 5975)
96
97 RUN (double, int32_t, 3)
98 RUN (double, int32_t, 4)
99 RUN (double, int32_t, 7)
100 RUN (double, int32_t, 99)
101 RUN (double, int32_t, 119)
102 RUN (double, int32_t, 128)
103 RUN (double, int32_t, 256)
104 RUN (double, int32_t, 279)
105 RUN (double, int32_t, 555)
106 RUN (double, int32_t, 1024)
107 RUN (double, int32_t, 1389)
108 RUN (double, int32_t, 2048)
109 RUN (double, int32_t, 3989)
110 RUN (double, int32_t, 4096)
111 RUN (double, int32_t, 5975)
112
113 RUN2 (double, uint32_t, 3)
114 RUN2 (double, uint32_t, 4)
115 RUN2 (double, uint32_t, 7)
116 RUN2 (double, uint32_t, 99)
117 RUN2 (double, uint32_t, 119)
118 RUN2 (double, uint32_t, 128)
119 RUN2 (double, uint32_t, 256)
120 RUN2 (double, uint32_t, 279)
121 RUN2 (double, uint32_t, 555)
122 RUN2 (double, uint32_t, 1024)
123 RUN2 (double, uint32_t, 1389)
124 RUN2 (double, uint32_t, 2048)
125 RUN2 (double, uint32_t, 3989)
126 RUN2 (double, uint32_t, 4096)
127 RUN2 (double, uint32_t, 5975)
128
129 RUN (double, int16_t, 3)
130 RUN (double, int16_t, 4)
131 RUN (double, int16_t, 7)
132 RUN (double, int16_t, 99)
133 RUN (double, int16_t, 119)
134 RUN (double, int16_t, 128)
135 RUN (double, int16_t, 256)
136 RUN (double, int16_t, 279)
137 RUN (double, int16_t, 555)
138 RUN (double, int16_t, 1024)
139 RUN (double, int16_t, 1389)
140 RUN (double, int16_t, 2048)
141 RUN (double, int16_t, 3989)
142 RUN (double, int16_t, 4096)
143 RUN (double, int16_t, 5975)
144
145 RUN2 (double, uint16_t, 3)
146 RUN2 (double, uint16_t, 4)
147 RUN2 (double, uint16_t, 7)
148 RUN2 (double, uint16_t, 99)
149 RUN2 (double, uint16_t, 119)
150 RUN2 (double, uint16_t, 128)
151 RUN2 (double, uint16_t, 256)
152 RUN2 (double, uint16_t, 279)
153 RUN2 (double, uint16_t, 555)
154 RUN2 (double, uint16_t, 1024)
155 RUN2 (double, uint16_t, 1389)
156 RUN2 (double, uint16_t, 2048)
157 RUN2 (double, uint16_t, 3989)
158 RUN2 (double, uint16_t, 4096)
159 RUN2 (double, uint16_t, 5975)
160
161 RUN (double, int8_t, 3)
162 RUN (double, int8_t, 4)
163 RUN (double, int8_t, 7)
164 RUN (double, int8_t, 99)
165 RUN (double, int8_t, 119)
166 RUN (double, int8_t, 128)
167 RUN (double, int8_t, 256)
168 RUN (double, int8_t, 279)
169 RUN (double, int8_t, 555)
170 RUN (double, int8_t, 1024)
171 RUN (double, int8_t, 1389)
172 RUN (double, int8_t, 2048)
173 RUN (double, int8_t, 3989)
174 RUN (double, int8_t, 4096)
175 RUN (double, int8_t, 5975)
176
177 RUN2 (double, uint8_t, 3)
178 RUN2 (double, uint8_t, 4)
179 RUN2 (double, uint8_t, 7)
180 RUN2 (double, uint8_t, 99)
181 RUN2 (double, uint8_t, 119)
182 RUN2 (double, uint8_t, 128)
183 RUN2 (double, uint8_t, 256)
184 RUN2 (double, uint8_t, 279)
185 RUN2 (double, uint8_t, 555)
186 RUN2 (double, uint8_t, 1024)
187 RUN2 (double, uint8_t, 1389)
188 RUN2 (double, uint8_t, 2048)
189 RUN2 (double, uint8_t, 3989)
190 RUN2 (double, uint8_t, 4096)
191 RUN2 (double, uint8_t, 5975)
192 }