Skip to content

Commit

Permalink
[X86] Add FeatureFast7ByteNOP flag
Browse files Browse the repository at this point in the history
Lets us remove another SLM proc family flag usage.

This is NFC, but we should probably check whether atom/glm/knl? should be using this flag as well...
  • Loading branch information
RKSimon committed Mar 12, 2020
1 parent 966cad0 commit 1e686d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Expand Up @@ -924,7 +924,7 @@ bool X86AsmBackend::writeNopData(raw_ostream &OS, uint64_t Count) const {
// 15-bytes is the longest single NOP instruction, but 10-bytes is
// commonly the longest that can be efficiently decoded.
uint64_t MaxNopLength = 10;
if (STI.getFeatureBits()[X86::ProcIntelSLM])
if (STI.getFeatureBits()[X86::FeatureFast7ByteNOP])
MaxNopLength = 7;
else if (STI.getFeatureBits()[X86::FeatureFast15ByteNOP])
MaxNopLength = 15;
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/X86/X86.td
Expand Up @@ -329,6 +329,11 @@ def FeatureFastLZCNT
: SubtargetFeature<
"fast-lzcnt", "HasFastLZCNT", "true",
"LZCNT instructions are as fast as most simple integer ops">;
// If the target can efficiently decode NOPs upto 7-bytes in length.
def FeatureFast7ByteNOP
: SubtargetFeature<
"fast-7bytenop", "HasFast7ByteNOP", "true",
"Target can quickly decode up to 7 byte NOPs">;
// If the target can efficiently decode NOPs upto 11-bytes in length.
def FeatureFast11ByteNOP
: SubtargetFeature<
Expand Down Expand Up @@ -728,6 +733,7 @@ def ProcessorFeatures {
list<SubtargetFeature> SLMSpecificFeatures = [ProcIntelSLM,
FeatureSlowDivide64,
FeatureSlowPMULLD,
FeatureFast7ByteNOP,
FeaturePOPCNTFalseDeps];
list<SubtargetFeature> SLMInheritableFeatures =
!listconcat(AtomInheritableFeatures, SLMAdditionalFeatures);
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/X86/X86Subtarget.h
Expand Up @@ -257,6 +257,10 @@ class X86Subtarget final : public X86GenSubtargetInfo {
/// ymm or zmm registers.
bool InsertVZEROUPPER = false;

/// True if there is no performance penalty for writing NOPs with up to
/// 7 bytes.
bool HasFast7ByteNOP = false;

/// True if there is no performance penalty for writing NOPs with up to
/// 11 bytes.
bool HasFast11ByteNOP = false;
Expand Down

0 comments on commit 1e686d2

Please sign in to comment.