[PATCH] Fix __atomic to not implement atomic loads with CAS.

Tom de Vries Tom_deVries@mentor.com
Wed Apr 11 09:38:00 GMT 2018


On 01/30/2017 07:54 PM, Torvald Riegel wrote:
> This patch fixes the __atomic builtins to not implement supposedly
> lock-free atomic loads based on just a compare-and-swap operation.

Hi,

The internals doc still lists CAS ( 
https://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html#index-atomic_005floadmode-instruction-pattern 
):
...
‘atomic_loadmode’

     This pattern implements an atomic load operation with memory model 
semantics. Operand 1 is the memory address being loaded from. Operand 0 
is the result of the load. Operand 2 is the memory model to be used for 
the load operation.

     If not present, the __atomic_load built-in function will either 
resort to a normal load with memory barriers, or a compare-and-swap 
operation if a normal load would not be atomic.
...

Thanks,
- Tom



More information about the Gcc-patches mailing list