Re: RFC: Petition Intel/AMD to add POPF_IF insn

From: Linus Torvalds
Date: Wed Aug 17 2016 - 15:43:25 EST


On Wed, Aug 17, 2016 at 12:26 PM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
>
> Exactly. And more:

All of which is ENTIRELY IRRELEVANT.

The 2-page pseudo-code is about behavior. It's trivial to
short-circuit. There are obvious optimizations, which involve just
making the rare cases go slow and have a trivial "if those bits didn't
change, don't go through the expense of testing them".

The problem is that IF is almost certainly right now in that rare case
mask, and so popf is stupidly slow for IF.

That in no way means that it *has* to be slow for IF, and more
importantly, the other flags don't even come into play. Forget about
them.

Linus