On 1/19/21 12:33 PM, unlvsur unlvsur via Gcc wrote:
I think __builtin_memmove_inline, __builtin_memset_inline can also get
provided.
That allows better performance for small size copies
Manual tweaking like that seems a bit ridiculous except in very narrow
situations, and just letting GCC assume there is an implementation of
memset/memmove lets it do optimization based on copy size by default. I
guess there could be some value to such an extension for portably doing
such specific micro-optimizations manually, though.
and allowing memcpy to be usable without libc.
You can just define it yourself, don't worry, GCC won't mind (as long as
it has the correct semantics). Even for the narrow case of memmove,
which could be mildly inconvenient to implement in less than 10 lines on
a few systems that have non-trivial pointers (i.e. `source <
destination` doesn't work as expected), you're on freestanding, so you
should be able to make some kind of working implementation by using
non-standard stuff for that specific purpose.