[cfe-commits] Some improvements to atomics

David Chisnall csdavec at swan.ac.uk
Thu Jan 5 09:53:48 PST 2012


Hi,

The attached patch makes some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types[1]
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type.  This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks.  The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Does anyone want to review it before I commit?

David

[1] Currently, these are all using a cmpxchg loop.  Addition and subtraction should be emitting the relevant atomicrmw instruction - this is the make it work patch, the make it fast patch will happen later...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic.diff
Type: application/octet-stream
Size: 29538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120105/8be507ec/attachment.obj>


More information about the cfe-commits mailing list