[X86] Add 64bit and retpoline-external-thunk to list of featuers in X86TargetParser.def.

'64bit' shows up from -march=native on 64-bit capable CPUs.
'retpoline-eternal-thunk' isn't a real feature but shows up
when -mretpoline-external-thunk is passed to clang.
This commit is contained in:
Craig Topper 2020-07-07 00:27:50 -07:00
parent ef4cc70f3e
commit 44ea81acb6
2 changed files with 9 additions and 0 deletions

View File

@ -173,6 +173,7 @@ X86_FEATURE_COMPAT(AVX512VP2INTERSECT, "avx512vp2intersect")
// Features below here are not in libgcc/compiler-rt.
X86_FEATURE (3DNOW, "3dnow")
X86_FEATURE (3DNOWA, "3dnowa")
X86_FEATURE (64BIT, "64bit")
X86_FEATURE (ADX, "adx")
X86_FEATURE (AMX_BF16, "amx-bf16")
X86_FEATURE (AMX_INT8, "amx-int8")
@ -183,6 +184,9 @@ X86_FEATURE (CLWB, "clwb")
X86_FEATURE (CLZERO, "clzero")
X86_FEATURE (CMPXCHG16B, "cx16")
X86_FEATURE (CMPXCHG8B, "cx8")
// FIXME: Merge with 64BIT? Currently separate to be used to tell if CPU is
// valid for 64-bit mode, but has empty string so it doesn't get added to
// target attributes in IR.
X86_FEATURE (EM64T, "")
X86_FEATURE (ENQCMD, "enqcmd")
X86_FEATURE (F16C, "f16c")
@ -221,6 +225,7 @@ X86_FEATURE (XSAVEC, "xsavec")
X86_FEATURE (XSAVEOPT, "xsaveopt")
X86_FEATURE (XSAVES, "xsaves")
// These features aren't really CPU features, but the frontend can set them.
X86_FEATURE (RETPOLINE_EXTERNAL_THUNK, "retpoline-external-thunk")
X86_FEATURE (RETPOLINE_INDIRECT_BRANCHES, "retpoline-indirect-branches")
X86_FEATURE (RETPOLINE_INDIRECT_CALLS, "retpoline-indirect-calls")
X86_FEATURE (LVI_CFI, "lvi-cfi")

View File

@ -390,6 +390,7 @@ ProcessorFeatures llvm::X86::getKeyFeature(X86::CPUKind Kind) {
}
// Features with no dependencies.
static constexpr FeatureBitset ImpliedFeatures64BIT = {};
static constexpr FeatureBitset ImpliedFeaturesADX = {};
static constexpr FeatureBitset ImpliedFeaturesBMI = {};
static constexpr FeatureBitset ImpliedFeaturesBMI2 = {};
@ -435,6 +436,7 @@ static constexpr FeatureBitset ImpliedFeaturesXSAVE = {};
// Not really CPU features, but need to be in the table because clang uses
// target features to communicate them to the backend.
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK = {};
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES = {};
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS = {};
static constexpr FeatureBitset ImpliedFeaturesLVI_CFI = {};
@ -558,6 +560,8 @@ void llvm::X86::getImpliedFeatures(
auto I = llvm::find_if(
FeatureInfos, [&](const FeatureInfo &FI) { return FI.Name == Feature; });
if (I == std::end(FeatureInfos)) {
// FIXME: This shouldn't happen, but may not have all features in the table
// yet.
return;
}