[llvm] r244503 - x86: Emit LAHF/SAHF instead of PUSHF/POPF

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 17:41:23 PDT 2015


On Mon, Aug 10, 2015 at 1:59 PM, JF Bastien via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: jfb
> Date: Mon Aug 10 15:59:36 2015
> New Revision: 244503
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244503&view=rev
> Log:
> x86: Emit LAHF/SAHF instead of PUSHF/POPF
>
> NaCl's sandbox doesn't allow PUSHF/POPF out of security concerns
> (priviledged emulators have forgotten to mask system bits in the past, and
> EFLAGS's DF bit is a constant source of hilarity). Commit r220529 fixed
> PR20376 by saving cmpxchg's flags result using EFLAGS, this commit now
> generated LAHF/SAHF instead, for all of x86 (not just NaCl) because it
> leads to an overall performance gain over PUSHF/POPF.
>

There's a problem with this: not all x86 CPUs support lahf/sahf in 64-bit
mode.

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150810/a194b296/attachment.html>


More information about the llvm-commits mailing list