History

Add ARM aeabi functions needed to run tcctest

Add implementation for float / integer conversion functions: __aeabi_d2lz, __aeabi_d2ulz, __aeabi_f2lz, __aeabi_f2ulz, __aeabi_l2d, __aeabi_l2f, __aeabi_ul2d, __aeabi_ul2f Add implementation for long long helper functions: __aeabi_ldivmod, __aeabi_uldivmod, __aeabi_llsl, __aeabi_llsr, __aeabi_lasr Add implementation for integer division functions: __aeabi_uidiv, __aeabi_uidivmod, __aeabi_idiv, __aeabi_idivmod,

Thomas Preud'homme committed 13 years ago

Commit f2dbcf71 parent 389c25c3 files · +509 −1Browse files

Showing the changes to tests (1 of 3 files). Show all

Unified · Split

tests/tcctest.c+67−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959
6060 #include "tcclib.h"
6161
62+void intdiv_test();
6263 void string_test();
6364 void expr_test();
6465 void macro_test();
@@ -167,6 +168,71 @@ int qq(int x) · 102 unmodified lines
167168 #define wq_spin_lock spin_lock
168169 #define TEST2() wq_spin_lock(a)
169170
171+#define UINT_MAX ((unsigned) -1)
172+
173+void intdiv_test(void)
174+{
175+ printf("18/21=%u\n", 18/21);
176+ printf("18%21=%u\n", 18%21);
177+ printf("41/21=%u\n", 41/21);
178+ printf("41%21=%u\n", 41%21);
179+ printf("42/21=%u\n", 42/21);
180+ printf("42%21=%u\n", 42%21);
181+ printf("43/21=%u\n", 43/21);
182+ printf("43%21=%u\n", 43%21);
183+ printf("126/21=%u\n", 126/21);
184+ printf("12%/21=%u\n", 126%21);
185+ printf("131/21=%u\n", 131/21);
186+ printf("131%21=%u\n", 131%21);
187+ printf("(UINT_MAX/2+3)/2=%u\n", (UINT_MAX/2+3)/2);
188+ printf("(UINT_MAX/2+3)%2=%u\n", (UINT_MAX/2+3)%2);
189+
190+ printf("18/-21=%u\n", 18/-21);
191+ printf("18%-21=%u\n", 18%-21);
192+ printf("41/-21=%u\n", 41/-21);
193+ printf("41%-21=%u\n", 41%-21);
194+ printf("42/-21=%u\n", 42/-21);
195+ printf("42%-21=%u\n", 42%-21);
196+ printf("43/-21=%u\n", 43/-21);
197+ printf("43%-21=%u\n", 43%-21);
198+ printf("126/-21=%u\n", 126/-21);
199+ printf("12%/-21=%u\n", 126%-21);
200+ printf("131/-21=%u\n", 131/-21);
201+ printf("131%-21=%u\n", 131%-21);
202+ printf("(UINT_MAX/2+3)/-2=%u\n", (UINT_MAX/2+3)/-2);
203+ printf("(UINT_MAX/2+3)%-2=%u\n", (UINT_MAX/2+3)%-2);
204+
205+ printf("-18/21=%u\n", -18/21);
206+ printf("-18%21=%u\n", -18%21);
207+ printf("-41/21=%u\n", -41/21);
208+ printf("-41%21=%u\n", -41%21);
209+ printf("-42/21=%u\n", -42/21);
210+ printf("-42%21=%u\n", -42%21);
211+ printf("-43/21=%u\n", -43/21);
212+ printf("-43%21=%u\n", -43%21);
213+ printf("-126/21=%u\n", -126/21);
214+ printf("-12%/21=%u\n", -126%21);
215+ printf("-131/21=%u\n", -131/21);
216+ printf("-131%21=%u\n", -131%21);
217+ printf("-(UINT_MAX/2+3)/2=%u\n", (0-(UINT_MAX/2+3))/2);
218+ printf("-(UINT_MAX/2+3)%2=%u\n", (0-(UINT_MAX/2+3))%2);
219+
220+ printf("-18/-21=%u\n", -18/-21);
221+ printf("-18%-21=%u\n", -18%-21);
222+ printf("-41/-21=%u\n", -41/-21);
223+ printf("-41%-21=%u\n", -41%-21);
224+ printf("-42/-21=%u\n", -42/-21);
225+ printf("-42%-21=%u\n", -42%-21);
226+ printf("-43/-21=%u\n", -43/-21);
227+ printf("-43%-21=%u\n", -43%-21);
228+ printf("-126/-21=%u\n", -126/-21);
229+ printf("-12%/-21=%u\n", -126%-21);
230+ printf("-131/-21=%u\n", -131/-21);
231+ printf("-131%-21=%u\n", -131%-21);
232+ printf("-(UINT_MAX/2+3)/-2=%u\n", (0-(UINT_MAX/2+3))/-2);
233+ printf("-(UINT_MAX/2+3)%-2=%u\n", (0-(UINT_MAX/2+3))%-2);
234+}
235+
170236 void macro_test(void)
171237 {
172238 printf("macro:\n");
@@ -619,6 +685,7 @@ int main(int argc, char **argv) · 446 unmodified lines
619685 math_cmp_test();
620686 callsave_test();
621687 builtin_frame_address_test();
688+ intdiv_test();
622689 return 0;
623690 }
624691

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t