Messages in this thread | | | Date | Wed, 24 Aug 2011 16:04:32 -0700 | From | "H. Peter Anvin" <> | Subject | Re: [PATCH 13/15] x86: add cmpxchg_flag() variant |
| |
On 08/24/2011 01:38 PM, Jeremy Fitzhardinge wrote: > On 08/24/2011 01:31 PM, H. Peter Anvin wrote: >> The sete is actually more expensive than the compare for the single-word >> case. The double-word case is a different matter. > > Hm, setcc has a longer latency but a higher throughput, is that > correct? Still, its recommended where you can use it to avoid a branch.
Yes, but you don't know when that is (the compiler does, of course.)
> I was also thinking that using it reduces register pressure, since you > don't need to keep the "old" value around, so it dies sooner.
... but you burn a register for the intermediate flag value, so you're just as bad off.
-hpa
| |