On 11/28/2011 06:01 AM, David Gilbert wrote:
> Hi Rchard,
> Can you explain the code:
>
> + if (mod_f != MEMMODEL_RELAXED)
> + emit_label (label2);
> +
> + arm_post_atomic_barrier (mod_s);
> +
> + if (mod_f == MEMMODEL_RELAXED)
> + emit_label (label2);
> +}
>
> in the case of the existing __sync_* will it always end up doing the
> label and the sync as
> Michael's pr 48126 indicated and my patch moved it?
This is a new feature of the user-level interface: one can specify both the
memory model to be enforced on success and the memory model to be enforced on
failure:
bool
compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s,
memory_order __f) noexcept
{
return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f);
}
with the constraint that the failure model __f cannot be stronger than success
model __s.
What the quoted code does is skip any final barrier if and only if the failure
model is RELAXED.
r~