x = atomic_load(&y, mo)
// ->
x = RANDOM;
atomic_compare_exchange(&y, &x, x, mo, mo);
This might be a difficult thing to angle in, because at the moment these loads tend not to appear in situations where we can easily just do this rewrite.
There may be a way to RMW stores, too, but I can't think of anything that's immediately obvious and wouldn't require a lot of extra dependency tracking. Except in dead code.
For example, of the form
This might be a difficult thing to angle in, because at the moment these loads tend not to appear in situations where we can easily just do this rewrite.
There may be a way to RMW stores, too, but I can't think of anything that's immediately obvious and wouldn't require a lot of extra dependency tracking. Except in dead code.