[X86] Rename X86_CPU_TYPE_COMPAT_ALIAS/X86_CPU_TYPE_COMPAT/X86_CPU_SUBTYPE_COMPAT macros. NFC

Remove _COMPAT. Drop the ARCHNAME. Remove the non-COMPAT versions
that are no longer needed.

We now only use these macros in places where we need compatibility
with libgcc/compiler-rt. So we don't need to call out _COMPAT
specifically.
This commit is contained in:
Craig Topper 2020-07-12 16:58:27 -07:00
parent 111167895d
commit b4dbb37f32
4 changed files with 58 additions and 68 deletions

View File

@ -1062,9 +1062,9 @@ void X86TargetInfo::getCPUSpecificCPUDispatchFeatures(
bool X86TargetInfo::validateCpuIs(StringRef FeatureStr) const {
return llvm::StringSwitch<bool>(FeatureStr)
#define X86_VENDOR(ENUM, STRING) .Case(STRING, true)
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, ALIAS) .Case(ALIAS, true)
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) .Case(STR, true)
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) .Case(STR, true)
#define X86_CPU_TYPE_ALIAS(ENUM, ALIAS) .Case(ALIAS, true)
#define X86_CPU_TYPE(ENUM, STR) .Case(STR, true)
#define X86_CPU_SUBTYPE(ENUM, STR) .Case(STR, true)
#include "llvm/Support/X86TargetParser.def"
.Default(false);
}

View File

@ -11655,11 +11655,11 @@ Value *CodeGenFunction::EmitX86CpuIs(StringRef CPUStr) {
std::tie(Index, Value) = StringSwitch<std::pair<unsigned, unsigned>>(CPUStr)
#define X86_VENDOR(ENUM, STRING) \
.Case(STRING, {0u, static_cast<unsigned>(llvm::X86::ENUM)})
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, ALIAS) \
#define X86_CPU_TYPE_ALIAS(ENUM, ALIAS) \
.Case(ALIAS, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) \
#define X86_CPU_TYPE(ENUM, STR) \
.Case(STR, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) \
#define X86_CPU_SUBTYPE(ENUM, STR) \
.Case(STR, {2u, static_cast<unsigned>(llvm::X86::ENUM)})
#include "llvm/Support/X86TargetParser.def"
.Default({0, 0});

View File

@ -20,80 +20,70 @@ X86_VENDOR(VENDOR_AMD, "amd")
#undef X86_VENDOR
// 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)
#define X86_CPU_TYPE(ENUM, STR)
#endif
#ifndef X86_CPU_TYPE_COMPAT_ALIAS
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, STR)
#ifndef X86_CPU_TYPE_ALIAS
#define X86_CPU_TYPE_ALIAS(ENUM, STR)
#endif
// The first part of this list must match what is implemented in libgcc and
// compilert-rt. Clang uses this to know how to implement __builtin_cpu_is.
X86_CPU_TYPE_COMPAT("bonnell", INTEL_BONNELL, "bonnell")
X86_CPU_TYPE_COMPAT("core2", INTEL_CORE2, "core2")
X86_CPU_TYPE_COMPAT("nehalem", INTEL_COREI7, "corei7")
X86_CPU_TYPE_COMPAT("amdfam10", AMDFAM10H, "amdfam10h")
X86_CPU_TYPE_COMPAT("bdver1", AMDFAM15H, "amdfam15h")
X86_CPU_TYPE_COMPAT("silvermont", INTEL_SILVERMONT, "silvermont")
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")
X86_CPU_TYPE_COMPAT("goldmont", INTEL_GOLDMONT, "goldmont")
X86_CPU_TYPE_COMPAT("goldmont-plus", INTEL_GOLDMONT_PLUS, "goldmont-plus")
X86_CPU_TYPE_COMPAT("tremont", INTEL_TREMONT, "tremont")
// This list must match what is implemented in libgcc and compilert-rt. Clang
// uses this to know how to implement __builtin_cpu_is.
X86_CPU_TYPE(INTEL_BONNELL, "bonnell")
X86_CPU_TYPE(INTEL_CORE2, "core2")
X86_CPU_TYPE(INTEL_COREI7, "corei7")
X86_CPU_TYPE(AMDFAM10H, "amdfam10h")
X86_CPU_TYPE(AMDFAM15H, "amdfam15h")
X86_CPU_TYPE(INTEL_SILVERMONT, "silvermont")
X86_CPU_TYPE(INTEL_KNL, "knl")
X86_CPU_TYPE(AMD_BTVER1, "btver1")
X86_CPU_TYPE(AMD_BTVER2, "btver2")
X86_CPU_TYPE(AMDFAM17H, "amdfam17h")
X86_CPU_TYPE(INTEL_KNM, "knm")
X86_CPU_TYPE(INTEL_GOLDMONT, "goldmont")
X86_CPU_TYPE(INTEL_GOLDMONT_PLUS, "goldmont-plus")
X86_CPU_TYPE(INTEL_TREMONT, "tremont")
// Alternate names supported by __builtin_cpu_is and target multiversioning.
X86_CPU_TYPE_COMPAT_ALIAS(INTEL_BONNELL, "atom")
X86_CPU_TYPE_COMPAT_ALIAS(AMDFAM10H, "amdfam10")
X86_CPU_TYPE_COMPAT_ALIAS(AMDFAM15H, "amdfam15")
X86_CPU_TYPE_COMPAT_ALIAS(INTEL_SILVERMONT, "slm")
X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom")
X86_CPU_TYPE_ALIAS(AMDFAM10H, "amdfam10")
X86_CPU_TYPE_ALIAS(AMDFAM15H, "amdfam15")
X86_CPU_TYPE_ALIAS(INTEL_SILVERMONT, "slm")
#undef X86_CPU_TYPE_COMPAT_ALIAS
#undef X86_CPU_TYPE_COMPAT
#undef X86_CPU_TYPE_ALIAS
#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)
#define X86_CPU_SUBTYPE(ENUM, STR)
#endif
// The first part of this list must match what is implemented in libgcc and
// compilert-rt. Clang uses this to know how to implement __builtin_cpu_is.
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")
X86_CPU_SUBTYPE_COMPAT("cannonlake", INTEL_COREI7_CANNONLAKE, "cannonlake")
X86_CPU_SUBTYPE_COMPAT("icelake-client", INTEL_COREI7_ICELAKE_CLIENT, "icelake-client")
X86_CPU_SUBTYPE_COMPAT("icelake-server", INTEL_COREI7_ICELAKE_SERVER, "icelake-server")
X86_CPU_SUBTYPE_COMPAT("znver2", AMDFAM17H_ZNVER2, "znver2")
X86_CPU_SUBTYPE_COMPAT("cascadelake", INTEL_COREI7_CASCADELAKE, "cascadelake")
X86_CPU_SUBTYPE_COMPAT("tigerlake", INTEL_COREI7_TIGERLAKE, "tigerlake")
X86_CPU_SUBTYPE_COMPAT("cooperlake", INTEL_COREI7_COOPERLAKE, "cooperlake")
#undef X86_CPU_SUBTYPE_COMPAT
// This list must match what is implemented in libgcc and compilert-rt. Clang
// uses this to know how to implement __builtin_cpu_is.
X86_CPU_SUBTYPE(INTEL_COREI7_NEHALEM, "nehalem")
X86_CPU_SUBTYPE(INTEL_COREI7_WESTMERE, "westmere")
X86_CPU_SUBTYPE(INTEL_COREI7_SANDYBRIDGE, "sandybridge")
X86_CPU_SUBTYPE(AMDFAM10H_BARCELONA, "barcelona")
X86_CPU_SUBTYPE(AMDFAM10H_SHANGHAI, "shanghai")
X86_CPU_SUBTYPE(AMDFAM10H_ISTANBUL, "istanbul")
X86_CPU_SUBTYPE(AMDFAM15H_BDVER1, "bdver1")
X86_CPU_SUBTYPE(AMDFAM15H_BDVER2, "bdver2")
X86_CPU_SUBTYPE(AMDFAM15H_BDVER3, "bdver3")
X86_CPU_SUBTYPE(AMDFAM15H_BDVER4, "bdver4")
X86_CPU_SUBTYPE(AMDFAM17H_ZNVER1, "znver1")
X86_CPU_SUBTYPE(INTEL_COREI7_IVYBRIDGE, "ivybridge")
X86_CPU_SUBTYPE(INTEL_COREI7_HASWELL, "haswell")
X86_CPU_SUBTYPE(INTEL_COREI7_BROADWELL, "broadwell")
X86_CPU_SUBTYPE(INTEL_COREI7_SKYLAKE, "skylake")
X86_CPU_SUBTYPE(INTEL_COREI7_SKYLAKE_AVX512, "skylake-avx512")
X86_CPU_SUBTYPE(INTEL_COREI7_CANNONLAKE, "cannonlake")
X86_CPU_SUBTYPE(INTEL_COREI7_ICELAKE_CLIENT, "icelake-client")
X86_CPU_SUBTYPE(INTEL_COREI7_ICELAKE_SERVER, "icelake-server")
X86_CPU_SUBTYPE(AMDFAM17H_ZNVER2, "znver2")
X86_CPU_SUBTYPE(INTEL_COREI7_CASCADELAKE, "cascadelake")
X86_CPU_SUBTYPE(INTEL_COREI7_TIGERLAKE, "tigerlake")
X86_CPU_SUBTYPE(INTEL_COREI7_COOPERLAKE, "cooperlake")
#undef X86_CPU_SUBTYPE

View File

@ -34,7 +34,7 @@ enum ProcessorVendors : unsigned {
// as a proxy for what's in libgcc/compiler-rt.
enum ProcessorTypes : unsigned {
CPU_TYPE_DUMMY,
#define X86_CPU_TYPE(ARCHNAME, ENUM) \
#define X86_CPU_TYPE(ENUM, STRING) \
ENUM,
#include "llvm/Support/X86TargetParser.def"
CPU_TYPE_MAX
@ -44,7 +44,7 @@ enum ProcessorTypes : unsigned {
// as a proxy for what's in libgcc/compiler-rt.
enum ProcessorSubtypes : unsigned {
CPU_SUBTYPE_DUMMY,
#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
#define X86_CPU_SUBTYPE(ENUM, STRING) \
ENUM,
#include "llvm/Support/X86TargetParser.def"
CPU_SUBTYPE_MAX