Skip to content

Commit 44ea81a

Browse files
committed
[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.
1 parent ef4cc70 commit 44ea81a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/include/llvm/Support/X86TargetParser.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ X86_FEATURE_COMPAT(AVX512VP2INTERSECT, "avx512vp2intersect")
173173
// Features below here are not in libgcc/compiler-rt.
174174
X86_FEATURE (3DNOW, "3dnow")
175175
X86_FEATURE (3DNOWA, "3dnowa")
176+
X86_FEATURE (64BIT, "64bit")
176177
X86_FEATURE (ADX, "adx")
177178
X86_FEATURE (AMX_BF16, "amx-bf16")
178179
X86_FEATURE (AMX_INT8, "amx-int8")
@@ -183,6 +184,9 @@ X86_FEATURE (CLWB, "clwb")
183184
X86_FEATURE (CLZERO, "clzero")
184185
X86_FEATURE (CMPXCHG16B, "cx16")
185186
X86_FEATURE (CMPXCHG8B, "cx8")
187+
// FIXME: Merge with 64BIT? Currently separate to be used to tell if CPU is
188+
// valid for 64-bit mode, but has empty string so it doesn't get added to
189+
// target attributes in IR.
186190
X86_FEATURE (EM64T, "")
187191
X86_FEATURE (ENQCMD, "enqcmd")
188192
X86_FEATURE (F16C, "f16c")
@@ -221,6 +225,7 @@ X86_FEATURE (XSAVEC, "xsavec")
221225
X86_FEATURE (XSAVEOPT, "xsaveopt")
222226
X86_FEATURE (XSAVES, "xsaves")
223227
// These features aren't really CPU features, but the frontend can set them.
228+
X86_FEATURE (RETPOLINE_EXTERNAL_THUNK, "retpoline-external-thunk")
224229
X86_FEATURE (RETPOLINE_INDIRECT_BRANCHES, "retpoline-indirect-branches")
225230
X86_FEATURE (RETPOLINE_INDIRECT_CALLS, "retpoline-indirect-calls")
226231
X86_FEATURE (LVI_CFI, "lvi-cfi")

llvm/lib/Support/X86TargetParser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ ProcessorFeatures llvm::X86::getKeyFeature(X86::CPUKind Kind) {
390390
}
391391

392392
// Features with no dependencies.
393+
static constexpr FeatureBitset ImpliedFeatures64BIT = {};
393394
static constexpr FeatureBitset ImpliedFeaturesADX = {};
394395
static constexpr FeatureBitset ImpliedFeaturesBMI = {};
395396
static constexpr FeatureBitset ImpliedFeaturesBMI2 = {};
@@ -435,6 +436,7 @@ static constexpr FeatureBitset ImpliedFeaturesXSAVE = {};
435436

436437
// Not really CPU features, but need to be in the table because clang uses
437438
// target features to communicate them to the backend.
439+
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK = {};
438440
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES = {};
439441
static constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS = {};
440442
static constexpr FeatureBitset ImpliedFeaturesLVI_CFI = {};
@@ -558,6 +560,8 @@ void llvm::X86::getImpliedFeatures(
558560
auto I = llvm::find_if(
559561
FeatureInfos, [&](const FeatureInfo &FI) { return FI.Name == Feature; });
560562
if (I == std::end(FeatureInfos)) {
563+
// FIXME: This shouldn't happen, but may not have all features in the table
564+
// yet.
561565
return;
562566
}
563567

0 commit comments

Comments
 (0)