diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-04-07 17:02:57 +0200 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2013-12-11 10:15:30 +0800 |
| commit | f2dbcf7594887ddfdec646ab2a85f4e2358ec209 (patch) | |
| tree | 228e60ee5f0d9d20380c5e727c7a26e53e971a27 /tests | |
| parent | 389c25c4b9006b16138094b110e4c50b78432905 (diff) | |
| download | tinycc-f2dbcf7594887ddfdec646ab2a85f4e2358ec209.tar.gz tinycc-f2dbcf7594887ddfdec646ab2a85f4e2358ec209.tar.bz2 | |
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,
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tcctest.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index c5a3e73..eb284f0 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -59,6 +59,7 @@ #include "tcclib.h" +void intdiv_test(); void string_test(); void expr_test(); void macro_test(); @@ -167,6 +168,71 @@ int qq(int x) #define wq_spin_lock spin_lock #define TEST2() wq_spin_lock(a) +#define UINT_MAX ((unsigned) -1) + +void intdiv_test(void) +{ + printf("18/21=%u\n", 18/21); + printf("18%21=%u\n", 18%21); + printf("41/21=%u\n", 41/21); + printf("41%21=%u\n", 41%21); + printf("42/21=%u\n", 42/21); + printf("42%21=%u\n", 42%21); + printf("43/21=%u\n", 43/21); + printf("43%21=%u\n", 43%21); + printf("126/21=%u\n", 126/21); + printf("12%/21=%u\n", 126%21); + printf("131/21=%u\n", 131/21); + printf("131%21=%u\n", 131%21); + printf("(UINT_MAX/2+3)/2=%u\n", (UINT_MAX/2+3)/2); + printf("(UINT_MAX/2+3)%2=%u\n", (UINT_MAX/2+3)%2); + + printf("18/-21=%u\n", 18/-21); + printf("18%-21=%u\n", 18%-21); + printf("41/-21=%u\n", 41/-21); + printf("41%-21=%u\n", 41%-21); + printf("42/-21=%u\n", 42/-21); + printf("42%-21=%u\n", 42%-21); + printf("43/-21=%u\n", 43/-21); + printf("43%-21=%u\n", 43%-21); + printf("126/-21=%u\n", 126/-21); + printf("12%/-21=%u\n", 126%-21); + printf("131/-21=%u\n", 131/-21); + printf("131%-21=%u\n", 131%-21); + printf("(UINT_MAX/2+3)/-2=%u\n", (UINT_MAX/2+3)/-2); + printf("(UINT_MAX/2+3)%-2=%u\n", (UINT_MAX/2+3)%-2); + + printf("-18/21=%u\n", -18/21); + printf("-18%21=%u\n", -18%21); + printf("-41/21=%u\n", -41/21); + printf("-41%21=%u\n", -41%21); + printf("-42/21=%u\n", -42/21); + printf("-42%21=%u\n", -42%21); + printf("-43/21=%u\n", -43/21); + printf("-43%21=%u\n", -43%21); + printf("-126/21=%u\n", -126/21); + printf("-12%/21=%u\n", -126%21); + printf("-131/21=%u\n", -131/21); + printf("-131%21=%u\n", -131%21); + printf("-(UINT_MAX/2+3)/2=%u\n", (0-(UINT_MAX/2+3))/2); + printf("-(UINT_MAX/2+3)%2=%u\n", (0-(UINT_MAX/2+3))%2); + + printf("-18/-21=%u\n", -18/-21); + printf("-18%-21=%u\n", -18%-21); + printf("-41/-21=%u\n", -41/-21); + printf("-41%-21=%u\n", -41%-21); + printf("-42/-21=%u\n", -42/-21); + printf("-42%-21=%u\n", -42%-21); + printf("-43/-21=%u\n", -43/-21); + printf("-43%-21=%u\n", -43%-21); + printf("-126/-21=%u\n", -126/-21); + printf("-12%/-21=%u\n", -126%-21); + printf("-131/-21=%u\n", -131/-21); + printf("-131%-21=%u\n", -131%-21); + printf("-(UINT_MAX/2+3)/-2=%u\n", (0-(UINT_MAX/2+3))/-2); + printf("-(UINT_MAX/2+3)%-2=%u\n", (0-(UINT_MAX/2+3))%-2); +} + void macro_test(void) { printf("macro:\n");
@@ -619,6 +685,7 @@ int main(int argc, char **argv) math_cmp_test(); callsave_test(); builtin_frame_address_test(); + intdiv_test(); return 0; } |
