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

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 10:53:06 PDT 2015


On Mon, Aug 10, 2015 at 5:41 PM, Eli Friedman via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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.
>

Which CPUs don't support lahf/sahf, old ones or new ones? It's basically
the only safe way to copy into and out of eflags.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150812/62611978/attachment.html>


More information about the llvm-commits mailing list