Hello cross-distro, I thought it a good idea to send an update on gcc support for LSE == Large System Extensions. These are a series of instructions introduced in Armv8.1 that allow one to atomically update values using a single instruction rather than as a sequence of: Load Exclusive + modify + store exclusive. This extension is optional, meaning that not all implementations support it. It has to be selected at runtime. As atomic operations are rather fundamental operations, existing mechanisms (such as ifunc resolvers) are not really suitable for runtime selection. glibc 2.28+ supports HWCAP_ATOMICS for runtime selection meaning .so's can be deployed in an "atomic" folder. The trouble with this approach is that it requires more building and testing work to deploy multiple .so's. Recently, in gcc 10, there is support for "-moutline-atomics". This flag prompts gcc to generate both exclusive monitor and LSE code for atomic operations and the pertinent routine is selected at runtime. The runtime selection process involves a conditional direct branch and has been found to only have a modest overhead. From gcc 10.1 upwards, -moutline-atomics is enabled by default (but can be disabled by -mno-outline-atomics) For those interested in backports of this functionality into older versions of gcc please see: GCC-8 aarch64: Add early clobber for aarch64_store_exclusive https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=512b0ffab3bc4f334cbb36c5981... aarch64: Simplify LSE cas generation https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=1bf932b1ab9002089ddd79d6453... aarch64: Improve cas generation https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=369a4d6dd2df645f1870506d8dd... aarch64: Improve swp generation https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=5d8ff6f1ff2cef121dc33d95453... aarch64: Improve atomic-op lse generation https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=f557aa1a836377d49fdbd4e7cec... aarch64: Remove early clobber from ATOMIC_LDOP scratch https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=5497bc389dca6a992aaa063df30... aarch64: Extend %R for integer registers https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=c7ae64412b6c9c7b966f3c0ab8e... aarch64: Implement TImode compare-and-swap https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=1101198f3d099af0555d7202a2a... Aarch64: Fix shrinkwrapping interactions with atomics (PR92692) https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=0b65e477890b7fe7f47a3dd8597... aarch64: Tidy aarch64_split_compare_and_swap https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=eccc28184d58dc27232d6710dc4... aarch64: Add out-of-line functions for LSE atomics https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=06f8058a8368f79e2cbf4659db5... Add visibility to libfunc constructors https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=36579491fa01039694ad12e673f... aarch64: Implement -moutline-atomics https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=ff54767725cd86e1d937cde50ec... aarch64: Fix store-exclusive in load-operate LSE helpers https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=4eaef24ba1f83ccfb54c9e473eb... aarch64: Configure for sys/auxv.h in libgcc for lse-init.c https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=5d44ad1e0a66651495ed964058c... aarch64: Fix up aarch64_compare_and_swaphi pattern [PR94368] https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=163e0d03f2cdc80de4968c4be46... aarch64: Fix bootstrap with old binutils [PR93053] https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=a69a60c4969cea06c1d44b5e3e4... aarch64: Fix ICE due to aarch64_gen_compare_reg_maybe_ze [PR94435] https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=1dbd821ee74e6c234e61e25b080... re PR target/90724 (ICE with __sync_bool_compare_and_swap with -march=armv8.2-a+sve) https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=69472d76d2456a447f61bc539bd... aarch64: Fix for PR target/94814 Backport of PR target/94518: Fix memmodel index in aarch64_store_exclusive_pair https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=034dfe065033a846761b0a5c35f... aarch64: Force TImode values into even registers https://gcc.gnu.org/git?p=gcc.git%3Ba=commit%3Bh=80c605c875fb394212164908151... [AArch64] Use __getauxval instead of getauxval in LSE detection code in libgcc https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=d0d2a937abf6ea0e03bfd7cb56... GCC-9 aarch64: Extend %R for integer registers https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=Ea7ffe1da05df28c8dd5c1f529... aarch64: Implement TImode compare-and-swap https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=53c1356515ac1357c341b59432... [AArch64] Fix shrinkwrapping interactions with atomics (PR92692) https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=Ea376dd471a3b006bc48945c1d... aarch64: Tidy aarch64_split_compare_and_swap https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=43e46197c10daad6e0aee839c8... aarch64: Add out-of-line functions for LSE atomics https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=b36f6a808e5ce7484c1039458f... aarch64: Implement -moutline-atomics https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=9cf2784a69e126283c33fdbcfb... aarch64: Fix store-exclusive in load-operate LSE helpers https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=bb9156ede009cfb572ab98c642... aarch64: Configure for sys/auxv.h in libgcc for lse-init.c https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=c15ff4d0803ffd02fdb9147e82... aarch64: Fix up aarch64_compare_and_swaphi pattern [PR94368] https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=13f6d5ac48a7d55b41927849ae... aarch64: Fix bootstrap with old binutils [PR93053] https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=bfe912a35c0c39a623ba6e0066... aarch64: Fix ICE due to aarch64_gen_compare_reg_maybe_ze [PR94435] https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=be64fc4cab7facee309447302b... re PR target/90724 (ICE with __sync_bool_compare_and_swap with -march=armv8.2-a+sve) https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=65709f4b93c74101440ab16bf4... [AArch64] PR target/94518: Fix memmodel index in aarch64_store_exclusive_pair https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=470626394ab7779cb663258048... [AArch64] Use __getauxval instead of getauxval in LSE detection code in libgcc https://gcc.gnu.org/git/?p=gcc.git%3Ba=commit%3Bh=b6dc99434abb6f5fa70ced8790... Cheers, -- Steve Capper IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.