This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: bzero/bcopy/bcmp/mempcpy (was: Improve strncpy performance further)


> Joseph Myers wrote:
> On Wed, 4 Feb 2015, Wilco Dijkstra wrote:
> 
> > That is certainly a good idea - I added _memclr to armcc a long time ago
> > as 99% of uses of memset set it to zero and don't use the return value
> > (and the cost of save/restore the return value inside memcpy/memset is
> > higher than just recomputing it on most targets).
> 
> On ARM there's __aeabi_memclr (and __aeabi_memclr4 and __aeabi_memclr8),
> but the __aeabi_mem* functions are mostly currently implemented as
> wrappers (__aeabi_memcpy* as aliases for __memcpy_arm in the
> armv7/multiarch case, to avoid clobbering NEON registers) and there's no
> GCC support for generating calls to those functions (which would only be
> useful with glibc if they were actually more efficient rather than
> wrappers).

Indeed it's unfortunate that these as well as the generic __bzero are
inefficient. Would it be possible for GCC to detect a modern GLIBC from the
headers and only emit calls to __bzero (or say a new __memclr symbol) if a
target provides an optimized version? Not sure whether there is already a way
to do this, or whether such trickery is discouraged...

Wilco




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]