Re: [PATCH 13/15] x86: add cmpxchg_flag() variant

From: H. Peter Anvin
Date: Wed Aug 24 2011 - 16:33:11 EST


On 08/24/2011 12:27 PM, Christoph Lameter wrote:
>
> Indeed for sete the size of the argument does not matter. Look at
> percpu_cmpxchg_double() and cmpxchg_double() in arch/x86/include for some
> of the functions I wrote. The sete is used to avoid the double word
> comparisons that would otherwise have been necessary.
>
> But still the solution with the flags would save another instruction and
> the generated code would not be as ugly. For not only do you have an
> additional sete you will then also have to check the result again. This
> means at least two additional instruction.
>

The sete is actually more expensive than the compare for the single-word
case. The double-word case is a different matter.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/