Messages in this thread | | | Date | Tue, 23 Aug 2011 14:01:38 -0500 (CDT) | From | Christoph Lameter <> | Subject | Re: [PATCH 13/15] x86: add cmpxchg_flag() variant |
| |
On Mon, 22 Aug 2011, Jeremy Fitzhardinge wrote:
> Most callers of cmpxchg() direcly compare RETURN with OLD to see if it was > successful. This results in unnecessary conditional comparisons > and conditionals since the cmpxchg instruction directly sets the flags > to indicate success/failure.
> Add cmpxchg_flag() variants which return a boolean flag directly indicating > success. Unfortunately an asm() statement can't directly export status > status flags, but sete isn't too bad.
And so what happens through this patch is that a cmp with a value that is likely in a register is replaced by a sete. Is there really a benefit?
What I wish we would have is the actual use of the processor flag.
if (cmpxchg_flags(....)) { }
where the cmpxchg is followed immediately by a jump. I tried in the past to pass a goto label to cmpxchg but that did not work.
| |