]> granicus.if.org Git - clang/commit
[X86] Add 'sahf' CPU feature to frontend
authorDimitry Andric <dimitry@andric.com>
Sat, 17 Feb 2018 21:04:35 +0000 (21:04 +0000)
committerDimitry Andric <dimitry@andric.com>
Sat, 17 Feb 2018 21:04:35 +0000 (21:04 +0000)
commit4bc099ffd7c59c0a4a65b36d2426b8790c1df3c9
tree0157365941b002bcf0a53b5a9c6b66b65838f152
parent53d982bea4e15405c228fd90afc486c36d71feed
[X86] Add 'sahf' CPU feature to frontend

Summary:
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@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 case (CodeGen/attr-target-x86.c) to
match the emitted output.

Reviewers: craig.topper, coby, efriedma, rsmith

Reviewed By: craig.topper

Subscribers: emaste, cfe-commits

Differential Revision: https://reviews.llvm.org/D43394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325446 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/Options.td
lib/Basic/Targets/X86.cpp
lib/Basic/Targets/X86.h
test/CodeGen/attr-target-x86.c