Protecting control dependencies with volatile_if()
Protecting control dependencies with volatile_if()
Posted Jun 21, 2021 11:56 UTC (Mon) by itsmycpu (guest, #139639)In reply to: Protecting control dependencies with volatile_if() by tialaramex
Parent article: Protecting control dependencies with volatile_if()
On none, as a hardware optimization I don't expect that to happen.
The question I'm asking is if and why (or why not), on any architecture (perhaps arm64), this:
volatile_if(READ_ONCE(A)) {
WRITE_ONCE(B,1);
}
might be faster than this:
if (load_acquire(A)) {
WRITE_ONCE(B,1);
}
especially if the latter is well optimized by a compiler. I have the tendency to think that the second form using load_acquire can be just as fast, at least if the compiler does a good job. However perhaps there are architectures on which that isn't true, and that is what my question is about.