Subject: Re: [boost] [atomic] (op)_and_test naming
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-26 15:20:03
Andrey Semashev wrote:
> But my point is that optimizations like these are generally unreliable,
> and if you really want to have the best possible code then you should
> better write it in a way so the compiler has less opportunity to screw up.
If we adopt this philosophy, shouldn't there be `opaque_` and `_and_test`
increments and decrements, too? `lock inc [r]` instead of `lock add [r], 1`,
or even `mov eax, 1; lock add [r], eax` if the compiler can't be trusted to
optimize, which we assume.