[LLVMdev] llvm atomics on 64-bit values

David Chisnall David.Chisnall at cl.cam.ac.uk
Wed Jun 4 01:12:46 PDT 2014


On 4 Jun 2014, at 00:53, Reid Kleckner <rnk at google.com> wrote:

> I'd use it for pointer-sized values.  I probably wouldn't use it on uint64_t, since that'll probably give some 32-bit toolchain somewhere heartburn.

It should work for uint64_t, for anything that supports C++11, but don't necessarily expect it to be fast.  PowerPC32 doesn't have 64-bit atomics, so will get a call out to a helper function that will acquire a lock, do the operation, and then release the lock.  This is quite a bit more expensive than a 32-bit atomic, which will be three instructions.  

On x86-32, you may still get the call to the runtime function, but if your system targets i586+ then the implementation will be a simple atomic operation.  

David





More information about the llvm-dev mailing list