Skip to content

Commit b4dbb37

Browse files
committed
[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.
1 parent 1111678 commit b4dbb37

File tree

4 files changed

+58
-68
lines changed

4 files changed

+58
-68
lines changed

clang/lib/Basic/Targets/X86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,9 +1062,9 @@ void X86TargetInfo::getCPUSpecificCPUDispatchFeatures(
10621062
bool X86TargetInfo::validateCpuIs(StringRef FeatureStr) const {
10631063
return llvm::StringSwitch<bool>(FeatureStr)
10641064
#define X86_VENDOR(ENUM, STRING) .Case(STRING, true)
1065-
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, ALIAS) .Case(ALIAS, true)
1066-
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) .Case(STR, true)
1067-
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) .Case(STR, true)
1065+
#define X86_CPU_TYPE_ALIAS(ENUM, ALIAS) .Case(ALIAS, true)
1066+
#define X86_CPU_TYPE(ENUM, STR) .Case(STR, true)
1067+
#define X86_CPU_SUBTYPE(ENUM, STR) .Case(STR, true)
10681068
#include "llvm/Support/X86TargetParser.def"
10691069
.Default(false);
10701070
}

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11655,11 +11655,11 @@ Value *CodeGenFunction::EmitX86CpuIs(StringRef CPUStr) {
1165511655
std::tie(Index, Value) = StringSwitch<std::pair<unsigned, unsigned>>(CPUStr)
1165611656
#define X86_VENDOR(ENUM, STRING) \
1165711657
.Case(STRING, {0u, static_cast<unsigned>(llvm::X86::ENUM)})
11658-
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, ALIAS) \
11658+
#define X86_CPU_TYPE_ALIAS(ENUM, ALIAS) \
1165911659
.Case(ALIAS, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
11660-
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) \
11660+
#define X86_CPU_TYPE(ENUM, STR) \
1166111661
.Case(STR, {1u, static_cast<unsigned>(llvm::X86::ENUM)})
11662-
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) \
11662+
#define X86_CPU_SUBTYPE(ENUM, STR) \
1166311663
.Case(STR, {2u, static_cast<unsigned>(llvm::X86::ENUM)})
1166411664
#include "llvm/Support/X86TargetParser.def"
1166511665
.Default({0, 0});

llvm/include/llvm/Support/X86TargetParser.def

Lines changed: 50 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -20,80 +20,70 @@ X86_VENDOR(VENDOR_AMD, "amd")
2020
#undef X86_VENDOR
2121

2222
// This macro is used for cpu types present in compiler-rt/libgcc.
23-
#ifndef X86_CPU_TYPE_COMPAT
24-
#define X86_CPU_TYPE_COMPAT(ARCHNAME, ENUM, STR) X86_CPU_TYPE(ARCHNAME, ENUM)
25-
#endif
26-
2723
#ifndef X86_CPU_TYPE
28-
#define X86_CPU_TYPE(ARCHNAME, ENUM)
24+
#define X86_CPU_TYPE(ENUM, STR)
2925
#endif
3026

31-
#ifndef X86_CPU_TYPE_COMPAT_ALIAS
32-
#define X86_CPU_TYPE_COMPAT_ALIAS(ENUM, STR)
27+
#ifndef X86_CPU_TYPE_ALIAS
28+
#define X86_CPU_TYPE_ALIAS(ENUM, STR)
3329
#endif
3430

35-
// The first part of this list must match what is implemented in libgcc and
36-
// compilert-rt. Clang uses this to know how to implement __builtin_cpu_is.
37-
X86_CPU_TYPE_COMPAT("bonnell", INTEL_BONNELL, "bonnell")
38-
X86_CPU_TYPE_COMPAT("core2", INTEL_CORE2, "core2")
39-
X86_CPU_TYPE_COMPAT("nehalem", INTEL_COREI7, "corei7")
40-
X86_CPU_TYPE_COMPAT("amdfam10", AMDFAM10H, "amdfam10h")
41-
X86_CPU_TYPE_COMPAT("bdver1", AMDFAM15H, "amdfam15h")
42-
X86_CPU_TYPE_COMPAT("silvermont", INTEL_SILVERMONT, "silvermont")
43-
X86_CPU_TYPE_COMPAT("knl", INTEL_KNL, "knl")
44-
X86_CPU_TYPE_COMPAT("btver1", AMD_BTVER1, "btver1")
45-
X86_CPU_TYPE_COMPAT("btver2", AMD_BTVER2, "btver2")
46-
X86_CPU_TYPE_COMPAT("znver1", AMDFAM17H, "amdfam17h")
47-
X86_CPU_TYPE_COMPAT("knm", INTEL_KNM, "knm")
48-
X86_CPU_TYPE_COMPAT("goldmont", INTEL_GOLDMONT, "goldmont")
49-
X86_CPU_TYPE_COMPAT("goldmont-plus", INTEL_GOLDMONT_PLUS, "goldmont-plus")
50-
X86_CPU_TYPE_COMPAT("tremont", INTEL_TREMONT, "tremont")
31+
// This list must match what is implemented in libgcc and compilert-rt. Clang
32+
// uses this to know how to implement __builtin_cpu_is.
33+
X86_CPU_TYPE(INTEL_BONNELL, "bonnell")
34+
X86_CPU_TYPE(INTEL_CORE2, "core2")
35+
X86_CPU_TYPE(INTEL_COREI7, "corei7")
36+
X86_CPU_TYPE(AMDFAM10H, "amdfam10h")
37+
X86_CPU_TYPE(AMDFAM15H, "amdfam15h")
38+
X86_CPU_TYPE(INTEL_SILVERMONT, "silvermont")
39+
X86_CPU_TYPE(INTEL_KNL, "knl")
40+
X86_CPU_TYPE(AMD_BTVER1, "btver1")
41+
X86_CPU_TYPE(AMD_BTVER2, "btver2")
42+
X86_CPU_TYPE(AMDFAM17H, "amdfam17h")
43+
X86_CPU_TYPE(INTEL_KNM, "knm")
44+
X86_CPU_TYPE(INTEL_GOLDMONT, "goldmont")
45+
X86_CPU_TYPE(INTEL_GOLDMONT_PLUS, "goldmont-plus")
46+
X86_CPU_TYPE(INTEL_TREMONT, "tremont")
5147

5248
// Alternate names supported by __builtin_cpu_is and target multiversioning.
53-
X86_CPU_TYPE_COMPAT_ALIAS(INTEL_BONNELL, "atom")
54-
X86_CPU_TYPE_COMPAT_ALIAS(AMDFAM10H, "amdfam10")
55-
X86_CPU_TYPE_COMPAT_ALIAS(AMDFAM15H, "amdfam15")
56-
X86_CPU_TYPE_COMPAT_ALIAS(INTEL_SILVERMONT, "slm")
49+
X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom")
50+
X86_CPU_TYPE_ALIAS(AMDFAM10H, "amdfam10")
51+
X86_CPU_TYPE_ALIAS(AMDFAM15H, "amdfam15")
52+
X86_CPU_TYPE_ALIAS(INTEL_SILVERMONT, "slm")
5753

58-
#undef X86_CPU_TYPE_COMPAT_ALIAS
59-
#undef X86_CPU_TYPE_COMPAT
54+
#undef X86_CPU_TYPE_ALIAS
6055
#undef X86_CPU_TYPE
6156

6257
// This macro is used for cpu subtypes present in compiler-rt/libgcc.
63-
#ifndef X86_CPU_SUBTYPE_COMPAT
64-
#define X86_CPU_SUBTYPE_COMPAT(ARCHNAME, ENUM, STR) X86_CPU_SUBTYPE(ARCHNAME, ENUM)
65-
#endif
66-
6758
#ifndef X86_CPU_SUBTYPE
68-
#define X86_CPU_SUBTYPE(ARCHNAME, ENUM)
59+
#define X86_CPU_SUBTYPE(ENUM, STR)
6960
#endif
7061

71-
// The first part of this list must match what is implemented in libgcc and
72-
// compilert-rt. Clang uses this to know how to implement __builtin_cpu_is.
73-
X86_CPU_SUBTYPE_COMPAT("nehalem", INTEL_COREI7_NEHALEM, "nehalem")
74-
X86_CPU_SUBTYPE_COMPAT("westmere", INTEL_COREI7_WESTMERE, "westmere")
75-
X86_CPU_SUBTYPE_COMPAT("sandybridge", INTEL_COREI7_SANDYBRIDGE, "sandybridge")
76-
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_BARCELONA, "barcelona")
77-
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_SHANGHAI, "shanghai")
78-
X86_CPU_SUBTYPE_COMPAT("amdfam10", AMDFAM10H_ISTANBUL, "istanbul")
79-
X86_CPU_SUBTYPE_COMPAT("bdver1", AMDFAM15H_BDVER1, "bdver1")
80-
X86_CPU_SUBTYPE_COMPAT("bdver2", AMDFAM15H_BDVER2, "bdver2")
81-
X86_CPU_SUBTYPE_COMPAT("bdver3", AMDFAM15H_BDVER3, "bdver3")
82-
X86_CPU_SUBTYPE_COMPAT("bdver4", AMDFAM15H_BDVER4, "bdver4")
83-
X86_CPU_SUBTYPE_COMPAT("znver1", AMDFAM17H_ZNVER1, "znver1")
84-
X86_CPU_SUBTYPE_COMPAT("ivybridge", INTEL_COREI7_IVYBRIDGE, "ivybridge")
85-
X86_CPU_SUBTYPE_COMPAT("haswell", INTEL_COREI7_HASWELL, "haswell")
86-
X86_CPU_SUBTYPE_COMPAT("broadwell", INTEL_COREI7_BROADWELL, "broadwell")
87-
X86_CPU_SUBTYPE_COMPAT("skylake", INTEL_COREI7_SKYLAKE, "skylake")
88-
X86_CPU_SUBTYPE_COMPAT("skylake-avx512", INTEL_COREI7_SKYLAKE_AVX512, "skylake-avx512")
89-
X86_CPU_SUBTYPE_COMPAT("cannonlake", INTEL_COREI7_CANNONLAKE, "cannonlake")
90-
X86_CPU_SUBTYPE_COMPAT("icelake-client", INTEL_COREI7_ICELAKE_CLIENT, "icelake-client")
91-
X86_CPU_SUBTYPE_COMPAT("icelake-server", INTEL_COREI7_ICELAKE_SERVER, "icelake-server")
92-
X86_CPU_SUBTYPE_COMPAT("znver2", AMDFAM17H_ZNVER2, "znver2")
93-
X86_CPU_SUBTYPE_COMPAT("cascadelake", INTEL_COREI7_CASCADELAKE, "cascadelake")
94-
X86_CPU_SUBTYPE_COMPAT("tigerlake", INTEL_COREI7_TIGERLAKE, "tigerlake")
95-
X86_CPU_SUBTYPE_COMPAT("cooperlake", INTEL_COREI7_COOPERLAKE, "cooperlake")
96-
#undef X86_CPU_SUBTYPE_COMPAT
62+
// This list must match what is implemented in libgcc and compilert-rt. Clang
63+
// uses this to know how to implement __builtin_cpu_is.
64+
X86_CPU_SUBTYPE(INTEL_COREI7_NEHALEM, "nehalem")
65+
X86_CPU_SUBTYPE(INTEL_COREI7_WESTMERE, "westmere")
66+
X86_CPU_SUBTYPE(INTEL_COREI7_SANDYBRIDGE, "sandybridge")
67+
X86_CPU_SUBTYPE(AMDFAM10H_BARCELONA, "barcelona")
68+
X86_CPU_SUBTYPE(AMDFAM10H_SHANGHAI, "shanghai")
69+
X86_CPU_SUBTYPE(AMDFAM10H_ISTANBUL, "istanbul")
70+
X86_CPU_SUBTYPE(AMDFAM15H_BDVER1, "bdver1")
71+
X86_CPU_SUBTYPE(AMDFAM15H_BDVER2, "bdver2")
72+
X86_CPU_SUBTYPE(AMDFAM15H_BDVER3, "bdver3")
73+
X86_CPU_SUBTYPE(AMDFAM15H_BDVER4, "bdver4")
74+
X86_CPU_SUBTYPE(AMDFAM17H_ZNVER1, "znver1")
75+
X86_CPU_SUBTYPE(INTEL_COREI7_IVYBRIDGE, "ivybridge")
76+
X86_CPU_SUBTYPE(INTEL_COREI7_HASWELL, "haswell")
77+
X86_CPU_SUBTYPE(INTEL_COREI7_BROADWELL, "broadwell")
78+
X86_CPU_SUBTYPE(INTEL_COREI7_SKYLAKE, "skylake")
79+
X86_CPU_SUBTYPE(INTEL_COREI7_SKYLAKE_AVX512, "skylake-avx512")
80+
X86_CPU_SUBTYPE(INTEL_COREI7_CANNONLAKE, "cannonlake")
81+
X86_CPU_SUBTYPE(INTEL_COREI7_ICELAKE_CLIENT, "icelake-client")
82+
X86_CPU_SUBTYPE(INTEL_COREI7_ICELAKE_SERVER, "icelake-server")
83+
X86_CPU_SUBTYPE(AMDFAM17H_ZNVER2, "znver2")
84+
X86_CPU_SUBTYPE(INTEL_COREI7_CASCADELAKE, "cascadelake")
85+
X86_CPU_SUBTYPE(INTEL_COREI7_TIGERLAKE, "tigerlake")
86+
X86_CPU_SUBTYPE(INTEL_COREI7_COOPERLAKE, "cooperlake")
9787
#undef X86_CPU_SUBTYPE
9888

9989

llvm/include/llvm/Support/X86TargetParser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum ProcessorVendors : unsigned {
3434
// as a proxy for what's in libgcc/compiler-rt.
3535
enum ProcessorTypes : unsigned {
3636
CPU_TYPE_DUMMY,
37-
#define X86_CPU_TYPE(ARCHNAME, ENUM) \
37+
#define X86_CPU_TYPE(ENUM, STRING) \
3838
ENUM,
3939
#include "llvm/Support/X86TargetParser.def"
4040
CPU_TYPE_MAX
@@ -44,7 +44,7 @@ enum ProcessorTypes : unsigned {
4444
// as a proxy for what's in libgcc/compiler-rt.
4545
enum ProcessorSubtypes : unsigned {
4646
CPU_SUBTYPE_DUMMY,
47-
#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
47+
#define X86_CPU_SUBTYPE(ENUM, STRING) \
4848
ENUM,
4949
#include "llvm/Support/X86TargetParser.def"
5050
CPU_SUBTYPE_MAX

0 commit comments

Comments
 (0)