On Thu, Mar 21, 2019 at 10:25 AM Denys Vlasenko <dvlas...@redhat.com> wrote: > > > > > But iirc pushf/popf isn't really that expensive - in fact I think it's > > pretty cheap when system flags don't change. > > I did not see evidence of this. In my testing, > POPF is always ~20 cycles, even if popped flags are identical to current > state of flags.
It may have been an artifact on just some older CPU's. I have this distinct memory of popf that changed IF being more expensive, but maybe that was the Pentium 4 days. Or maybe it's just that my memory is garbage. Linus