This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH, ARM] Improved strcmp for armv6/v7-a


This patch adds improved strcmp implementations for ARMv6 and ARMv7-a.
It also restructures the code for the various variants into separate
files.  The code is now sufficiently complex that having it all in one
file was becoming very confusing.

Benchmarking such a change is notoriously difficult, given the potential
number of variables that can affect performance and the number of
potential CPU implementations this can be used on, but across a range of
tests the improvements are often in the range of 10-50% and only very
rarely is there a regression of more than 1%.

Another feature of the new code is the (build-time) optional pre-check
on the strings.  If strcmp is likely to be used with a lot of random
strings, then checking the first character of each string can save a lot
of overhead, at the minor expense of having to do that work a second
time.  For some use cases, however, that check is likely to be rarely of
benefit (eg if you're normally using strcmp to validate a match in a
sparse hash table), so it is possible to disable it at compile time, by
defining STRCMP_NO_PRECHECK.  The pre-check is enabled by default since
it doesn't cost much and in general use it's more likely to be
beneficial than not.

A final minor change is that the ARMv7-a code now avoids any ARMv8
deprecated IT sequences.

	* libc/machine/arm/strcmp-arm-tiny.S: New file.
	* libc/machine/arm/strcmp-armv4.S: New file.
	* libc/machine/arm/strcmp-armv4t.S: New file.
	* libc/machine/arm/strcmp-armv6.S: New file.
	* libc/machine/arm/strcmp-armv7.S: New file.
	* libc/machine/arm/strcmp-armv7m.S: New file.
	* libc/machine/arm/strcmp.S: Replace with wrapper for various
	implementations.
	* libc/machine/arm/Makefile.am (strcmp.o, strcmp.obj): Add
	dependencies.
	* libc/machine/arm/Makefile.in: Regenerated.

I'll commit this momentarily.

R.

Attachment: strcmp.patch
Description: Text document


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