Add new file lib/builtin.c Modify include/tccdefs.h, lib/Makefile to compile it. Update tests/tcctest.c to test it.
Showing the changes to include (1 of 4 files). Show all
Unified · Split
| @@ -309,4 +309,19 @@ · 308 unmodified lines | |||
| 309 | #undef __MAYBE_REDIR | 309 | #undef __MAYBE_REDIR |
| 310 | #undef __RENAME | 310 | #undef __RENAME |
| 311 | 311 | ||
| 312 | #if !defined _WIN32 | ||
| 313 | #define __BUILTIN_EXTERN(name,u) \ | ||
| 314 | int __builtin_##name(u int); \ | ||
| 315 | int __builtin_##name##l(u long); \ | ||
| 316 | int __builtin_##name##ll(u long long); | ||
| 317 | |||
| 318 | __BUILTIN_EXTERN(ffs,) | ||
| 319 | __BUILTIN_EXTERN(clz, unsigned) | ||
| 320 | __BUILTIN_EXTERN(ctz, unsigned) | ||
| 321 | __BUILTIN_EXTERN(clrsb,) | ||
| 322 | __BUILTIN_EXTERN(popcount, unsigned) | ||
| 323 | __BUILTIN_EXTERN(parity, unsigned) | ||
| 324 | #undef __BUILTIN_EXTERN | ||
| 325 | #endif | ||
| 326 | |||
| 312 | #endif /* ndef __TCC_PP__ */ | 327 | #endif /* ndef __TCC_PP__ */ |