On arm/aarch64 (and possibly other targets), compare_exchange (_strong) will effectively generate an additional check loop on top of compare_exchange_weak codegen. As spurious failures are relatively uncommon, we may as well combine those loops in code if they don't do too much work to setup the new value.
On arm/aarch64 (and possibly other targets),
compare_exchange
(_strong
) will effectively generate an additional check loop on top ofcompare_exchange_weak
codegen. As spurious failures are relatively uncommon, we may as well combine those loops in code if they don't do too much work to setup the new value.On x86, the codegen should be exactly the same.