[PATCH] D27653: Make check for atomic alignment target dependent

Yichao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 13:38:44 PST 2016


yuyichao added a comment.

Ref https://gcc.gnu.org/ml/gcc/2016-11/txt6ZlA_JS27i.txt .

While the instruction may guarantee atomicity without requiring alignment, I think there's still question whether the platform ABI (i.e. libatomic ABI linked above) allows it. I did not find any clear mention of the inlineability of unaligned i64 atomic on 32bit x86 but it does include other examples where the atomic is not inlineable when it's not properly aligned (e.g. in the _Atomic struct section).

Given that the draft is more or less a documentation and refinement of the current libatomic + clang/gcc behavior, I just checked what does it do on 32bit x86 for a 4bytes aligned i64 and it seems to be using the locking path. Unless that is changed and required, inlining 4bytes aligned i64 atomic will likely violate the libatomic ABI.


https://reviews.llvm.org/D27653





More information about the llvm-commits mailing list