Page MenuHomeFreeBSD

arm64: Expand the use of Armv8.1-A atomics
ClosedPublic

Authored by andrew on Jul 26 2024, 9:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 18, 3:34 PM
Unknown Object (File)
Fri, Oct 18, 3:34 PM
Unknown Object (File)
Fri, Oct 18, 3:34 PM
Unknown Object (File)
Fri, Oct 18, 2:42 PM
Unknown Object (File)
Fri, Oct 18, 9:34 AM
Unknown Object (File)
Oct 4 2024, 5:37 PM
Unknown Object (File)
Oct 1 2024, 5:33 AM
Unknown Object (File)
Sep 23 2024, 5:17 AM
Subscribers

Details

Summary

When targeting Armv8.1 we can assume FEAT_LSE is available and can use
the atomic instructions this provides without needing to check for
support first.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jul 26 2024, 12:28 PM

Do we care about Arm 8.0? Or will __ARM_FEATURE_ATOMICS not be defined there?

Otherwise I like it.

https://developer.arm.com/documentation/101028/0010/Feature-test-macros

Large System Extensions

__ARM_FEATURE_ATOMICS is defined if the Large System Extensions introduced in the Armv8.1-A architecture are supported on this target. Note: It is strongly recommended that standardized C11/C++11 atomics are used to implement atomic operations in user code.

While it probably does not directly apply to this case, we should be very careful with similar constructions.
Clang is slightly schizophrenic and declare minimal common list of extension if -march is passed to the compiler, but maximal list of extensions (including optional ones) if -mcpu is passed to the compiler.
See https://github.com/llvm/llvm-project/issues/90365.
To my eyes this is a bug, nothing else.

So with the current behavior of Clang, we should consider ACLE as a definition for compiler supported extension instructions, not the target CPU.

In D46159#1052031, @imp wrote:

Do we care about Arm 8.0? Or will __ARM_FEATURE_ATOMICS not be defined there?

__ARM_FEATURE_ATOMICS is only defined when the atomic operations are available

This revision was automatically updated to reflect the committed changes.