Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86] Add a def file to CPU vendor, type, and subtype encodings used …
…by Host.cpp Summary: I want to leverage this to clean up some of the code in clang. This will allow us to simplify D39521 which was trying to do some of the same. If we accurately keep the code in Host.cpp synced with new CPUs added to compile-rt/libgcc we should be able to use this file as a proxy for what's implemented in the libraries. The entries for the CPUs recognized by the libraries use separate macros that define additional parameters like the name for __builtin_cpu_is and an alias string for the couple cases where __builtin_cpu_is accepts two different names. All of the macros contain an ARCHNAME that is usually the same as the __builtin_cpu_is string, but sometimes isn't. This represents the name recognized by X86.td and -march. I'm following the precedent set by ARM and AArch64 and adding this information to lib/Support/TargetParser.cpp Reviewers: erichkeane, echristo, asbirlea Reviewed By: echristo Subscribers: llvm-commits, aemerson, kristof.beyls Differential Revision: https://reviews.llvm.org/D39782 llvm-svn: 317900
- Loading branch information
Showing
3 changed files
with
241 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
//===- X86TargetParser.def - X86 target parsing defines ---------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file provides defines to build up the X86 target parser's logic. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// NOTE: NO INCLUDE GUARD DESIRED! | ||
|
||
#ifndef X86_VENDOR | ||
#define X86_VENDOR(STRING, ENUM) | ||
#endif | ||
X86_VENDOR(VENDOR_INTEL, "intel") | ||
X86_VENDOR(VENDOR_AMD, "amd") | ||
#undef X86_VENDOR | ||
|
||
// This macro is used to implement CPU types that have an alias. As of now | ||
// there is only ever one alias. | ||
#ifndef X86_CPU_TYPE_COMPAT_WITH_ALIAS | ||
#define X86_CPU_TYPE_COMPAT_WITH_ALIAS(ARCHNAME, ENUM, STR, ALIAS) X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) | ||
#endif | ||
|
||
// This macro is used for cpu types present in compiler-rt/libgcc. | ||
#ifndef X86_CPU_TYPE_COMPAT | ||
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) X86_CPU_TYPE(ARCHNAME, ENUM) | ||
#endif | ||
|
||
#ifndef X86_CPU_TYPE | ||
#define X86_CPU_TYPE(ARCHNAME, ENUM) | ||
#endif | ||
X86_CPU_TYPE_COMPAT_WITH_ALIAS("bonnell", INTEL_BONNELL, "bonnell", "atom") | ||
X86_CPU_TYPE_COMPAT ("core2", INTEL_CORE2, "core2") | ||
X86_CPU_TYPE_COMPAT ("nehalem", INTEL_COREI7, "corei7") | ||
X86_CPU_TYPE_COMPAT_WITH_ALIAS("amdfam10", AMDFAM10H, "amdfam10h", "amdfam10") | ||
X86_CPU_TYPE_COMPAT_WITH_ALIAS("bdver1", AMDFAM15H, "amdfam15h", "amdfam15") | ||
X86_CPU_TYPE_COMPAT_WITH_ALIAS("silvermont", INTEL_SILVERMONT, "silvermont", "slm") | ||
X86_CPU_TYPE_COMPAT ("knl", INTEL_KNL, "knl") | ||
X86_CPU_TYPE_COMPAT ("btver1", AMD_BTVER1, "btver1") | ||
X86_CPU_TYPE_COMPAT ("btver2", AMD_BTVER2, "btver2") | ||
X86_CPU_TYPE_COMPAT ("znver1", AMDFAM17H, "amdfam17h") | ||
X86_CPU_TYPE_COMPAT ("knm", INTEL_KNM, "knm") | ||
// Entries below this are not in libgcc/compiler-rt. | ||
X86_CPU_TYPE ("i386", INTEL_i386) | ||
X86_CPU_TYPE ("i486", INTEL_i486) | ||
X86_CPU_TYPE ("pentium", INTEL_PENTIUM) | ||
X86_CPU_TYPE ("pentium-mmx", INTEL_PENTIUM_MMX) | ||
X86_CPU_TYPE ("pentium-pro", INTEL_PENTIUM_PRO) | ||
X86_CPU_TYPE ("pentium2", INTEL_PENTIUM_II) | ||
X86_CPU_TYPE ("pentium3", INTEL_PENTIUM_III) | ||
X86_CPU_TYPE ("pentium4", INTEL_PENTIUM_IV) | ||
X86_CPU_TYPE ("pentium-m", INTEL_PENTIUM_M) | ||
X86_CPU_TYPE ("yonah", INTEL_CORE_DUO) | ||
X86_CPU_TYPE ("nocona", INTEL_NOCONA) | ||
X86_CPU_TYPE ("prescott", INTEL_PRESCOTT) | ||
X86_CPU_TYPE ("i486", AMD_i486) | ||
X86_CPU_TYPE ("pentium", AMDPENTIUM) | ||
X86_CPU_TYPE ("athlon", AMD_ATHLON) | ||
X86_CPU_TYPE ("athlon-xp", AMD_ATHLON_XP) | ||
X86_CPU_TYPE ("k8", AMD_K8) | ||
X86_CPU_TYPE ("k8-sse3", AMD_K8SSE3) | ||
X86_CPU_TYPE ("goldmont", INTEL_GOLDMONT) | ||
#undef X86_CPU_TYPE_COMPAT_WITH_ALIAS | ||
#undef X86_CPU_TYPE_COMPAT | ||
#undef X86_CPU_TYPE | ||
|
||
// This macro is used for cpu subtypes present in compiler-rt/libgcc. | ||
#ifndef X86_CPU_SUBTYPE_COMPAT | ||
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) X86_CPU_SUBTYPE(ARCHNAME, ENUM) | ||
#endif | ||
|
||
#ifndef X86_CPU_SUBTYPE | ||
#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) | ||
#endif | ||
|
||
X86_CPU_SUBTYPE_COMPAT("nehalem", INTEL_COREI7_NEHALEM, "nehalem") | ||
X86_CPU_SUBTYPE_COMPAT("westmere", INTEL_COREI7_WESTMERE, "westmere") | ||
X86_CPU_SUBTYPE_COMPAT("sandybridge", INTEL_COREI7_SANDYBRIDGE, "sandybridge") | ||
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_BARCELONA, "barcelona") | ||
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_SHANGHAI, "shanghai") | ||
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_ISTANBUL, "istanbul") | ||
X86_CPU_SUBTYPE_COMPAT("bdver1", AMDFAM15H_BDVER1, "bdver1") | ||
X86_CPU_SUBTYPE_COMPAT("bdver2", AMDFAM15H_BDVER2, "bdver2") | ||
X86_CPU_SUBTYPE_COMPAT("bdver3", AMDFAM15H_BDVER3, "bdver3") | ||
X86_CPU_SUBTYPE_COMPAT("bdver4", AMDFAM15H_BDVER4, "bdver4") | ||
X86_CPU_SUBTYPE_COMPAT("znver1", AMDFAM17H_ZNVER1, "znver1") | ||
X86_CPU_SUBTYPE_COMPAT("ivybridge", INTEL_COREI7_IVYBRIDGE, "ivybridge") | ||
X86_CPU_SUBTYPE_COMPAT("haswell", INTEL_COREI7_HASWELL, "haswell") | ||
X86_CPU_SUBTYPE_COMPAT("broadwell", INTEL_COREI7_BROADWELL, "broadwell") | ||
X86_CPU_SUBTYPE_COMPAT("skylake", INTEL_COREI7_SKYLAKE, "skylake") | ||
X86_CPU_SUBTYPE_COMPAT("skylake-avx512", INTEL_COREI7_SKYLAKE_AVX512, "skylake-avx512") | ||
// Entries below this are not in libgcc/compiler-rt. | ||
X86_CPU_SUBTYPE ("core2", INTEL_CORE2_65) | ||
X86_CPU_SUBTYPE ("penryn", INTEL_CORE2_45) | ||
X86_CPU_SUBTYPE ("k6", AMDPENTIUM_K6) | ||
X86_CPU_SUBTYPE ("k6-2", AMDPENTIUM_K62) | ||
X86_CPU_SUBTYPE ("k6-3", AMDPENTIUM_K63) | ||
X86_CPU_SUBTYPE ("geode", AMDPENTIUM_GEODE) | ||
#undef X86_CPU_SUBTYPE_COMPAT | ||
#undef X86_CPU_SUBTYPE |
Oops, something went wrong.