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

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 18:02:07 PDT 2015


Ha, you're right. Thanks for pointing it out.

How about I add a FeatureLAHFSAHF, and continue using PUSHF/POPF if
unsupported?

On Mon, Aug 10, 2015 at 5:41 PM, Eli Friedman <eli.friedman at gmail.com>
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.
>
> -Eli
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150810/27e78fc8/attachment.html>


More information about the llvm-commits mailing list