efriedma added a comment. > Have we verified that this is the rule that GCC uses? Is it true even if e.g. > the pointer expression is the address of a variable with a known alignment, > or if the pointer has an explicitly-aligned type (e.g. with an aligned > typedef)?
As far as I can tell, if the type's size is a power of two, and there's an inline atomic sequence available, gcc will use an inline sequence that assumes the address is naturally aligned. Otherwise, it makes the libcall. I've tried a variety of ways of writing the operation; alignment doesn't matter at all, no matter what the alignment actually is. Oddly, `__atomic_is_lock_free`/`__atomic_always_lock_free` do care about the alignment, though. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123642/new/ https://reviews.llvm.org/D123642 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits