[PATCH] D43394: [X86] Add 'sahf' CPU feature, and emit __LAHFSAHF__ for it

Dimitry Andric via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 09:07:49 PST 2018


dim created this revision.
dim added reviewers: craig.topper, coby, efriedma, rsmith.

Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
`+sahf` feature for the backend, for bug 36028 (Incorrect use of
pushf/popf enables/disables interrupts on amd64 kernels).  This was
originally submitted in bug 36037 by Jonathan Looney
<jonlooney at gmail.com>.

As described there, GCC also uses `-msahf` for this feature, and the
backend already recognizes the `+sahf` feature. All that is needed is to
teach clang to pass this on to the backend.

The mapping of feature support onto CPUs may not be complete; rather, it
was chosen to match LLVM's idea of which CPUs support this feature (see
lib/Target/X86/X86.td).

I also updated the affected test cases (CodeGen/attr-target-x86.c and
Preprocessor/predefined-arch-macros.c) to match the emitted output.


Repository:
  rC Clang

https://reviews.llvm.org/D43394

Files:
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  test/CodeGen/attr-target-x86.c
  test/Preprocessor/predefined-arch-macros.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43394.134642.patch
Type: text/x-patch
Size: 18950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180216/48f31560/attachment-0001.bin>


More information about the cfe-commits mailing list