You're going to have to give a much clearer set of examples and justifications. I've had to CAS on bit masks, but not enough that it would make sense to introduce a new operation for it. I just CAS and spin if it fails and the bitmask is still valid.
all right, I am doing a sort of a copy-on-write thing here. So the idea is that I only want to update the pointer if the record it points to is "unlocked"
You're going to have to give a much clearer set of examples and justifications. I've had to CAS on bit masks, but not enough that it would make sense to introduce a new operation for it. I just CAS and spin if it fails and the bitmask is still valid.
all right, I am doing a sort of a copy-on-write thing here. So the idea is that I only want to update the pointer if the record it points to is "unlocked"
What hardware are you running on where the cost of a relaxed 64 bit load and a branch is significant compared to a (possibly contended) cas?
You could always use ldset on arm for this.