[llvm] [Transforms] Introduce BuildBuiltins.h atomic helpers (PR #134455)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 08:27:39 PDT 2025


================
@@ -462,11 +462,91 @@ TLI_DEFINE_ENUM_INTERNAL(atomic_load)
 TLI_DEFINE_STRING_INTERNAL("__atomic_load")
 TLI_DEFINE_SIG_INTERNAL(Void, SizeT, Ptr, Ptr, Int)
 
+/// int8_t __atomic_load_1(void *ptr, int memorder);
----------------
Meinersbur wrote:

This is the GCC-defined ABI, see https://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary#GCC_intrinsics for reference. 

`__atomic_load_N` returns the load value, possible due to having a known size that fits into a register (or pre-allocated stack slot, depending on calling convention). `__atomic_load` reads a dynamic number of bytes and hence cannot be pre-allocated/passed by register.

https://github.com/llvm/llvm-project/pull/134455


More information about the llvm-commits mailing list