r212173 - X86: inline all atomic operations up to 128-bits.

Tim Northover tnorthover at apple.com
Tue Jan 13 09:18:56 PST 2015


> I've noticed that this causes Clang to emit calls to __sync_*16()
> functions. This is a unusual, as the intent is that Clang never emits
> __sync_*() calls for C11 atomics. It always generates __atomic_*
> calls.

Interesting; it actually sounds more like a platform issue than anything else. Emitting either without at least implicit ABI support is going to go badly (my Linux libgcc 4.9 seems not to contain either variant). Clang also seems to emit the __sync calls (both before and after) for _Atomic(whatever) types.

> In other words, this code will need to be patched in such a way that
> it only sets MaxAtomicPromoteWidth and MaxAtomicInlineWidth to 128 in
> case the backend is going to generate code that uses cmpxchg16b.

Sounds plausible, though I think that could be handled in the backend too. They look like a fairly basic extension to the __sync calls, just tacking on the memory order at the end.

Cheers.

Tim.




More information about the cfe-commits mailing list