[PATCH] D85044: Add __atomic_is_lock_free to compiler-rt

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 16:06:14 PST 2020


oontvoo added a comment.

In D85044#2426999 <https://reviews.llvm.org/D85044#2426999>, @ldionne wrote:

> I'm definitely naive w.r..t compiler-rt, but why is a simple approach like D92302 <https://reviews.llvm.org/D92302> not sufficient?

The implementation there provides the *right* answers for the cases that can be determined statically. 
There are cases where it can only be determined at runtime.
For eg., unaligned non-power of 2 sizes, or more importantly 16-byte atomic ops can have lock-free implementations on some but not all x86-64 .

Most of the gunk in this patch is to set up for  these checks to be extensible. 
Eg., for x86/x86-64, we wants to look for CMPXCHG8B/CMPXCHG16B

Then there's the actual making use of CMPXCHG8B/CMPXCHG16B when we know it's available in *_atomic_load/store.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85044/new/

https://reviews.llvm.org/D85044



More information about the llvm-commits mailing list