Skip to content

[compiler-rt][AArch64] Provide basic implementations of SME memcpy/memmove in case of strictly aligned memory access #138250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

vhscampos
Copy link
Member

The existing implementations, written in assembly, make use of unaligned accesses for performance reasons. They are not compatible with strict aligned configurations, i.e. with -mno-unaligned-access.

If the functions are used in this scenario, an exception is raised due to unaligned memory accesses.

This patch reintroduces vanilla implementations for these functions to be used in strictly aligned configurations. The actual code is largely based on the code from #77496

Copy link
Contributor

@david-arm david-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

vhscampos added 2 commits June 3, 2025 09:34
…mmove in case of strictly aligned memory access

The existing implementations, written in assembly, make use of unaligned
accesses for performance reasons. They are not compatible with strict
aligned configurations, i.e. with `-mno-unaligned-access`.

If the functions are used in this scenario, an exception is raised due
to unaligned memory accesses.

This patch reintroduces vanilla implementations for these functions to
be used in strictly aligned configurations. The actual code is largely
based on the code from llvm#77496
- Split functions into separate files.
- Select which implementation to use based on target features. The
  selection is now done in CMake.
@vhscampos vhscampos force-pushed the sme-intrinsics-strict-alignment branch from ca036e8 to 3b20924 Compare June 3, 2025 08:46
@vhscampos vhscampos merged commit 75c3ff8 into llvm:main Jun 3, 2025
10 checks passed
@vhscampos vhscampos deleted the sme-intrinsics-strict-alignment branch June 3, 2025 09:59
@@ -600,9 +600,17 @@ if (COMPILER_RT_HAS_AARCH64_SME)
set_source_files_properties(aarch64/arm_apple_sme_abi.s PROPERTIES COMPILE_FLAGS -march=armv8a+sme)
message(STATUS "AArch64 Apple SME ABI routines enabled")
elseif (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND COMPILER_RT_AARCH64_FMV_USES_GLOBAL_CONSTRUCTOR)
list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-libc-mem-routines.S aarch64/sme-abi-assert.c aarch64/sme-libc-routines.c)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change inadvertently removed files from the build. I will fix it shortly.

rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…mmove in case of strictly aligned memory access (llvm#138250)

The existing implementations, written in assembly, make use of unaligned
accesses for performance reasons. They are not compatible with strict
aligned configurations, i.e. with `-mno-unaligned-access`.

If the functions are used in this scenario, an exception is raised due
to unaligned memory accesses.

This patch reintroduces vanilla implementations for these functions to
be used in strictly aligned configurations. The actual code is largely
based on the code from llvm#77496
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
…mmove in case of strictly aligned memory access (llvm#138250)

The existing implementations, written in assembly, make use of unaligned
accesses for performance reasons. They are not compatible with strict
aligned configurations, i.e. with `-mno-unaligned-access`.

If the functions are used in this scenario, an exception is raised due
to unaligned memory accesses.

This patch reintroduces vanilla implementations for these functions to
be used in strictly aligned configurations. The actual code is largely
based on the code from llvm#77496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants