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,
Showing the changes to tests (1 of 3 files). Show all
Unified · Split
| @@ -59,6 +59,7 @@ · 58 unmodified lines | |||
| 59 | 59 | ||
| 60 | #include "tcclib.h" | 60 | #include "tcclib.h" |
| 61 | 61 | ||
| 62 | void intdiv_test(); | ||
| 62 | void string_test(); | 63 | void string_test(); |
| 63 | void expr_test(); | 64 | void expr_test(); |
| 64 | void macro_test(); | 65 | void macro_test(); |
| @@ -167,6 +168,71 @@ int qq(int x) · 102 unmodified lines | |||
| 167 | #define wq_spin_lock spin_lock | 168 | #define wq_spin_lock spin_lock |
| 168 | #define TEST2() wq_spin_lock(a) | 169 | #define TEST2() wq_spin_lock(a) |
| 169 | 170 | ||
| 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 | |||
| 170 | void macro_test(void) | 236 | void macro_test(void) |
| 171 | { | 237 | { |
| 172 | printf("macro:\n"); | 238 | printf("macro:\n"); |
| @@ -619,6 +685,7 @@ int main(int argc, char **argv) · 446 unmodified lines | |||
| 619 | math_cmp_test(); | 685 | math_cmp_test(); |
| 620 | callsave_test(); | 686 | callsave_test(); |
| 621 | builtin_frame_address_test(); | 687 | builtin_frame_address_test(); |
| 688 | intdiv_test(); | ||
| 622 | return 0; | 689 | return 0; |
| 623 | } | 690 | } |
| 624 | 691 | ||