Commit graph

86 commits

Author SHA1 Message Date
Lephenixnoir
cda27ac2db
string: add and test strspn and strcspn (DONE) 2021-05-23 18:02:38 +02:00
Lephenixnoir
8368ba70fd
string: split and fix strdup and strndup (DONE) 2021-05-23 17:58:04 +02:00
Lephenixnoir
b78cec4f6d
string: add and test strerror (DONE) 2021-05-23 17:44:37 +02:00
Lephenixnoir
3792bbd9d1
string: split strcat and strncat (DONE) 2021-05-23 17:28:48 +02:00
Lephenixnoir
5d345b8da2
string: split and fix strcpy and strncpy (DONE) 2021-05-23 17:28:20 +02:00
Lephenixnoir
d5ef8298ae
string: split strcmp and strncmp (DONE) 2021-05-23 17:27:58 +02:00
Lephenixnoir
ab8bcc6928
string: use gint's (not-so-optimized-yet) memmove (DONE) 2021-05-23 16:52:39 +02:00
Lephenixnoir
fd0d67191c
string: add memchr, memcmp, memmove for non-SuperH (TEST) 2021-05-23 16:52:39 +02:00
Lephenixnoir
5cfd2a7d85
string: use gint's optimized memcmp (DONE) 2021-05-23 16:52:35 +02:00
Lephenixnoir
a354e38ccf
string: use gint's optimized memcpy (DONE) 2021-05-23 16:52:33 +02:00
Lephenixnoir
b69e0fd299
string: use gint's optimized memset (DONE) 2021-05-23 16:52:29 +02:00
Lephenixnoir
bd344d5bb2
string: split strchr, strchrnul and strrchr (TEST) 2021-05-23 16:07:01 +02:00
Lephenixnoir
6021c536f7
string: split strnlen, optimize strlen in assembler (DONE)
This change provides an optimized hand-written strlen function for
SuperH targets. The original plan was to declare the C-based naive
version weak and just let the linker figure out the proper one to use,
but unfortunately static libraries don't work like that; ld
intentionally stops at the first version even if it's weak. Instead,
some #ifdef's are used in the C-based strlen to not compile it when
unneeded.

The optimized strlen uses 4-byte accesses and cmp/str.
2021-05-23 16:00:12 +02:00
Lephenixnoir
591e453717
sh-generic: add CPU capabilities for optimized SH4 code
On sh-generic targets, the headers <bits/cpucap.h> (in C) and
<bits/asm/cpucap.h> (in assembler) provide definitions to acces the
__cpucap symbol which provides information on the CPU.

Currently, a single capability __CPUCAP_SH4ALDSP is defined; it
represents the SH4 extended instructions together with the integrated
DSP instructions. The main uses of this capability are [movua.l]
(unaligned reads) and [ldrc] (built-in tight loops).

Capabilities are initialized to 0 (their safest default) and the runtime
can enable them based on what hardware is running.
2021-05-23 15:31:01 +02:00
Lephenixnoir
24c6873429
cmake: fix include bits/ not being installed
The file(EXISTS) command needs absolute paths.
2021-05-23 15:27:10 +02:00
Lephenixnoir
d6f606fa5c
string: add and test an optimized memchr (DONE)
This version works on both SH3 and SH4.
2021-05-23 14:30:35 +02:00
Lephenixnoir
f5cca84ae8
stdlib: add and test strtod, strtof and atof (DONE)
This uses a generic function strto_fp similar to strto_int that is used
for strtol and its derivatives.
2021-05-21 23:56:35 +02:00
Lephenixnoir
efb37cf783
stdlib: add and test strtold (DONE)
The method is rather naive - digits read as an integer, then multipled
by a power of 10 or 2. This does not always give exact results, but it's
close enough for now. A stub support for long double larger than 64 bits
is provided.
2021-05-21 22:49:55 +02:00
Lephenixnoir
cc03641522
inttypes: add strtoimax and strtoumax 2021-05-20 16:05:20 +02:00
Lephenixnoir
9de2f5c391
math, fenv, complex: add headers through OpenLibm 2021-05-20 11:35:14 +02:00
Lephenixnoir
99339ae9f4
cmake: add arch-specific support flags 2021-05-20 11:35:14 +02:00
Lephenixnoir
ade01b532e
stdlib: add atoi, atol and atoll 2021-05-20 11:35:14 +02:00
Lephenixnoir
06f975f75c
stdlib: add a test strtol, strtoul, strtoll (DONE)
The presumed bug where the value computed without the sign overflows
even though the negative result can be represented is not actually a
problem, because this only happens with signed results and the temporary
value is computed as unsigned (thus with extra range).
2021-05-20 11:03:19 +02:00
Lephenixnoir
5042236392
stdlib: reword strtoull into a generic strto_int
This new function will support strtol, strtoul, and strtoll as well.
2021-05-20 09:23:06 +02:00
Lephenixnoir
b1dc3e77de
stdlib: add and test strtoull (DONE) 2021-05-19 21:50:08 +02:00
Lephenixnoir
36b4854137
inttypes: add imaxabs and imaxdiv (TEST) 2021-05-18 21:31:00 +02:00
Lephenixnoir
73b536bbb6
stdlib: add abs, labs, llabs, div, ldiv, lldiv (TEST) 2021-05-18 21:25:45 +02:00
Lephenixnoir
5f48a6b4e0
errno: add the errno variable and base macros
A <bits/errno.h> file will likely by added later on for each target to
add more specific values.
2021-05-16 18:12:46 +02:00
Lephenixnoir
c87805ef10
ctype: add a simple implementation for the "C" locale (TEST) 2021-05-16 18:12:45 +02:00
Lephenixnoir
fdf32aeb97
locale: add a stub that supports only the "C" locale (TEST)
This is enough to support the standard and likely the C++ library and
external programs to port, but also the most we can do without a proper
locale data storage and more target-specific developments that aren't a
priority right now.
2021-05-16 18:12:45 +02:00
Lephenixnoir
676601b894
assert: add a partial assert implementation (LDEPS)
This currently does not link because fprintf, stderr and abort are
missing on most platforms. But the code is there.
2021-05-16 18:12:45 +02:00
Lephenixnoir
4933d9c19f
cmake: remove unneeded separators in install paths 2021-05-16 18:01:21 +02:00
Lephenixnoir
6275b3e73b
move bits/unistd_32.h to bits/asm on all targets
Only Vhex had it at the correct place previously.
2021-05-11 09:22:34 +02:00
Lephenixnoir
e719af2f63
update include hierarchy 2021-05-09 17:59:07 +02:00
Lephenixnoir
8993049f4e
update README and CMake install rules 2021-05-09 17:52:07 +02:00
Lephenixnoir
ad9f92873b
new build system and source file hierarchy 2021-05-09 14:56:08 +02:00