__sync_swap* with acq/rel/full memory barrier semantics

Richard Henderson rth@redhat.com
Fri Jun 3 14:27:00 GMT 2011


On 06/02/2011 02:52 PM, Aldy Hernandez wrote:
> On 06/02/11 14:25, Jakub Jelinek wrote:
> 
>>> +    case MEMMODEL_SEQ_CST:
>>> +      op = sync_mem_exchange_seq_cst_optab;
>>> +      break;
>>> +    case MEMMODEL_ACQUIRE:
>>> +      op = sync_mem_exchange_acq_optab;
>>> +      break;
>>> +    case MEMMODEL_RELEASE:
>>> +      op = sync_mem_exchange_rel_optab;
>>> +      break;
>>> +    case MEMMODEL_ACQ_REL:
>>> +      op = sync_mem_exchange_acq_rel_optab;
>>> +      break;
>>
>> Wouldn't it be better to pass the model (as an extra CONST_INT
>> operand) to the expanders?  Targets where atomic instructions always act
>> as full barriers could just ignore that argument, other could decide what
>> to do based on the value.
> 
> *shrug* I don't care.  Whatever everyone agrees on.

Let's do that.  Many of the targets will be expanding these to
a somewhat longer sequence at some stage, and they'll all be
95% identical.  The extra operand ought to make for less
boiler-plate code.


r~



More information about the Gcc-patches mailing list