Shanks0224 opened a new pull request, #22185: URL: https://github.com/apache/nuttx/pull/22185
Add assembly-optimized implementations for Xtensa architecture: memcmp, memchr, strchr, strchrnul, strrchr, strncmp, strnlen, stpcpy, stpncpy, strcat. *Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Add optimized `memchr`, `memcmp`, `stpcpy`, `stpncpy`, `strcat`, `strchr`, `strchrnul`, `strncmp`, `strnlen` and `strrchr` for Xtensa, each with its own Kconfig option. ## Impact - Opt-in only; the default configuration is unchanged. - No impact on the build system, documentation or hardware. ## Testing Build host: Linux x86_64. Tested on an Xtensa HiFi4 core built with the Cadence xt-clang toolchain, running the libc string test. All functions pass the test on the target. Cycles for 128 byte buffers (64 bytes for `strcat`), generic C before this PR and the assembly after it: | function | before | after | speedup | |---|---|---|---| | memcmp | 1396 | 217 | 6.4x | | memchr | 205 | 87 | 2.4x | | strchr | 226 | 110 | 2.1x | | strncmp | 1523 | 610 | 2.5x | | strnlen | 20 | 10 | 2.0x | | stpcpy | 1018 | 274 | 3.7x | | strcat | 649 | 320 | 2.0x | | strrchr | 1145 | 689 | 1.7x | `strchrnul` is built from the `strchr` source and `stpncpy` is a byte-wise implementation; they have no separate measurement. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
