]> granicus.if.org Git - clang/commit
Add support for the x86 builtin __builtin_cpu_supports.
authorEric Christopher <echristo@gmail.com>
Mon, 29 Jun 2015 21:00:05 +0000 (21:00 +0000)
committerEric Christopher <echristo@gmail.com>
Mon, 29 Jun 2015 21:00:05 +0000 (21:00 +0000)
commit75230d16352bdb4118444df045467e3514aa8110
tree2f83f7fe675fc3c1a0f58cc454d05a4b7a2626b9
parent029eb4a6d97d4e3e21b4a7d42c403857f1724572
Add support for the x86 builtin __builtin_cpu_supports.

This matches the implementation of the gcc support for the same
feature, including checking the values set up by libgcc at runtime.
The structure looks like this:

  unsigned int __cpu_vendor;
  unsigned int __cpu_type;
  unsigned int __cpu_subtype;
  unsigned int __cpu_features[1];

with a set of enums to match various fields that are field out after
parsing the output of the cpuid instruction.
This also adds a set of errors checking for valid input (and cpu).

compiler-rt support for this and the other builtins in this family
(__builtin_cpu_init and __builtin_cpu_is) are forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240994 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/BuiltinsX86.def
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/TargetInfo.h
include/clang/Sema/Sema.h
lib/Basic/Targets.cpp
lib/CodeGen/CGBuiltin.cpp
lib/Sema/SemaChecking.cpp
test/CodeGen/builtin-cpu-supports.c [new file with mode: 0644]
test/Sema/builtin-cpu-supports.c [new file with mode: 0644]