Repository navigation
Add basic scalar __arm_sc_* implementations - #94
Merged
Merged
Conversation
There was a problem hiding this comment.
Thank you for your contribution to Arm's optimized routines. Contribution to this repository does require a signed contributor's license agreement. See contributor-agreement.pdf for details
rockdreamer
force-pushed
the
add_arm_sc
branch
2 times, most recently
from
June 9, 2026 15:37
7c4fb40 to
1d4dd2d
Compare
Wilco1
requested changes
Jun 9, 2026
Wilco1
reviewed
Jun 11, 2026
Wilco1
reviewed
Jun 11, 2026
Wilco1
reviewed
Jun 11, 2026
Wilco1
requested changes
Jun 11, 2026
Wilco1
left a comment
Contributor
There was a problem hiding this comment.
Starting to look good, just a few more issues
We can reuse the aarch64 implementation of memmove and memcpy for their streaming compatible versions as none of them make use of incompatible instructions and perform quite well. Memset is based on the current aarch64 implementation but does not make use of AdvSIMD instructions. Memchr is an implementation of the algorithm described in the Hacker's delight book.
faraz-mtk
pushed a commit
to MediaTek-Labs/gcc
that referenced
this pull request
Jun 29, 2026
… libgcc
The ACLE[1] specified the following four functions in "Streaming-compatible
versions of standard routines" as having "the same behavior as the standard C
functions that they are named after" and external linkage.
- void *__arm_sc_memcpy(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memmove(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memset(void *s, int c, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memchr(void *s, int c, size_t n)
__arm_streaming_compatible;
Declarations for these are already available in arm_sme.h
This patch provides implementations for these based entirely on scalar
operations, along with basic tests that exercise the code both in streaming and
non-streaming mode.
See also [2] for further testing.
[1] https://arm-software.github.io/acle/main/acle.html
[2] ARM-software/optimized-routines#94
libgcc/ChangeLog:
* config/aarch64/__arm_sc_memchr_scalar.S: New file.
* config/aarch64/__arm_sc_memcpy_scalar.S: Likewise.
* config/aarch64/__arm_sc_memset_scalar.S: Likewise.
* config/aarch64/libgcc-sme.ver (GCC_17.0): Export
__arm_sc_memchr, __arm_sc_memcpy, __arm_sc_memmove and
__arm_sc_memset.
* config/aarch64/t-aarch64: Add new files.
* config/aarch64/aarch64-asm.h: Add ENTRY_ALIAS.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/acle/arm_sc_memchr.c: New file.
* gcc.target/aarch64/acle/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memset.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memchr.c: New file.
* gcc.target/aarch64/sme/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memset.c: Likewise.
jthillard
pushed a commit
to fpetrot/riscv-gcc
that referenced
this pull request
Jul 13, 2026
… libgcc
The ACLE[1] specified the following four functions in "Streaming-compatible
versions of standard routines" as having "the same behavior as the standard C
functions that they are named after" and external linkage.
- void *__arm_sc_memcpy(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memmove(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memset(void *s, int c, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memchr(void *s, int c, size_t n)
__arm_streaming_compatible;
Declarations for these are already available in arm_sme.h
This patch provides implementations for these based entirely on scalar
operations, along with basic tests that exercise the code both in streaming and
non-streaming mode.
See also [2] for further testing.
[1] https://arm-software.github.io/acle/main/acle.html
[2] ARM-software/optimized-routines#94
libgcc/ChangeLog:
* config/aarch64/__arm_sc_memchr_scalar.S: New file.
* config/aarch64/__arm_sc_memcpy_scalar.S: Likewise.
* config/aarch64/__arm_sc_memset_scalar.S: Likewise.
* config/aarch64/libgcc-sme.ver (GCC_17.0): Export
__arm_sc_memchr, __arm_sc_memcpy, __arm_sc_memmove and
__arm_sc_memset.
* config/aarch64/t-aarch64: Add new files.
* config/aarch64/aarch64-asm.h: Add ENTRY_ALIAS.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/acle/arm_sc_memchr.c: New file.
* gcc.target/aarch64/acle/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memset.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memchr.c: New file.
* gcc.target/aarch64/sme/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memset.c: Likewise.
jthillard
pushed a commit
to fpetrot/riscv-gcc
that referenced
this pull request
Jul 15, 2026
… libgcc
The ACLE[1] specified the following four functions in "Streaming-compatible
versions of standard routines" as having "the same behavior as the standard C
functions that they are named after" and external linkage.
- void *__arm_sc_memcpy(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memmove(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memset(void *s, int c, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memchr(void *s, int c, size_t n)
__arm_streaming_compatible;
Declarations for these are already available in arm_sme.h
This patch provides implementations for these based entirely on scalar
operations, along with basic tests that exercise the code both in streaming and
non-streaming mode.
See also [2] for further testing.
[1] https://arm-software.github.io/acle/main/acle.html
[2] ARM-software/optimized-routines#94
libgcc/ChangeLog:
* config/aarch64/__arm_sc_memchr_scalar.S: New file.
* config/aarch64/__arm_sc_memcpy_scalar.S: Likewise.
* config/aarch64/__arm_sc_memset_scalar.S: Likewise.
* config/aarch64/libgcc-sme.ver (GCC_17.0): Export
__arm_sc_memchr, __arm_sc_memcpy, __arm_sc_memmove and
__arm_sc_memset.
* config/aarch64/t-aarch64: Add new files.
* config/aarch64/aarch64-asm.h: Add ENTRY_ALIAS.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/acle/arm_sc_memchr.c: New file.
* gcc.target/aarch64/acle/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memset.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memchr.c: New file.
* gcc.target/aarch64/sme/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memset.c: Likewise.
jthillard
pushed a commit
to fpetrot/riscv-gcc
that referenced
this pull request
Jul 15, 2026
… libgcc
The ACLE[1] specified the following four functions in "Streaming-compatible
versions of standard routines" as having "the same behavior as the standard C
functions that they are named after" and external linkage.
- void *__arm_sc_memcpy(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memmove(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memset(void *s, int c, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memchr(void *s, int c, size_t n)
__arm_streaming_compatible;
Declarations for these are already available in arm_sme.h
This patch provides implementations for these based entirely on scalar
operations, along with basic tests that exercise the code both in streaming and
non-streaming mode.
See also [2] for further testing.
[1] https://arm-software.github.io/acle/main/acle.html
[2] ARM-software/optimized-routines#94
libgcc/ChangeLog:
* config/aarch64/__arm_sc_memchr_scalar.S: New file.
* config/aarch64/__arm_sc_memcpy_scalar.S: Likewise.
* config/aarch64/__arm_sc_memset_scalar.S: Likewise.
* config/aarch64/libgcc-sme.ver (GCC_17.0): Export
__arm_sc_memchr, __arm_sc_memcpy, __arm_sc_memmove and
__arm_sc_memset.
* config/aarch64/t-aarch64: Add new files.
* config/aarch64/aarch64-asm.h: Add ENTRY_ALIAS.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/acle/arm_sc_memchr.c: New file.
* gcc.target/aarch64/acle/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memset.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memchr.c: New file.
* gcc.target/aarch64/sme/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memset.c: Likewise.
jthillard
pushed a commit
to fpetrot/riscv-gcc
that referenced
this pull request
Jul 15, 2026
… libgcc
The ACLE[1] specified the following four functions in "Streaming-compatible
versions of standard routines" as having "the same behavior as the standard C
functions that they are named after" and external linkage.
- void *__arm_sc_memcpy(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memmove(void *dest, const void *src, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memset(void *s, int c, size_t n)
__arm_streaming_compatible;
- void *__arm_sc_memchr(void *s, int c, size_t n)
__arm_streaming_compatible;
Declarations for these are already available in arm_sme.h
This patch provides implementations for these based entirely on scalar
operations, along with basic tests that exercise the code both in streaming and
non-streaming mode.
See also [2] for further testing.
[1] https://arm-software.github.io/acle/main/acle.html
[2] ARM-software/optimized-routines#94
libgcc/ChangeLog:
* config/aarch64/__arm_sc_memchr_scalar.S: New file.
* config/aarch64/__arm_sc_memcpy_scalar.S: Likewise.
* config/aarch64/__arm_sc_memset_scalar.S: Likewise.
* config/aarch64/libgcc-sme.ver (GCC_17.0): Export
__arm_sc_memchr, __arm_sc_memcpy, __arm_sc_memmove and
__arm_sc_memset.
* config/aarch64/t-aarch64: Add new files.
* config/aarch64/aarch64-asm.h: Add ENTRY_ALIAS.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/acle/arm_sc_memchr.c: New file.
* gcc.target/aarch64/acle/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/acle/arm_sc_memset.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memchr.c: New file.
* gcc.target/aarch64/sme/arm_sc_memcpy.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memmove.c: Likewise.
* gcc.target/aarch64/sme/arm_sc_memset.c: Likewise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.