From e5aaed5aca373ed5bcee1eedbb9832353e7b3607 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Fri, 21 Apr 2017 09:20:50 +0000 Subject: [PATCH] Rename FastString flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300959 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86.td | 13 ++++++++----- lib/Target/X86/X86InstrInfo.td | 2 +- lib/Target/X86/X86SelectionDAGInfo.cpp | 4 ++-- lib/Target/X86/X86Subtarget.cpp | 2 +- lib/Target/X86/X86Subtarget.h | 6 +++--- test/CodeGen/X86/memcpy-struct-by-value.ll | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/Target/X86/X86.td b/lib/Target/X86/X86.td index 99d6c6932ae..c6ded683ebc 100644 --- a/lib/Target/X86/X86.td +++ b/lib/Target/X86/X86.td @@ -273,11 +273,14 @@ def FeatureFastSHLDRotate "fast-shld-rotate", "HasFastSHLDRotate", "true", "SHLD can be used as a faster rotate">; -// String operations (e.g. REP MOVS) are fast. See "REP String Enhancement" in -// the Intel Software Development Manual. -def FeatureFastString +// Ivy Bridge and newer processors have enhanced REP MOVSB and STOSB (aka +// "string operations"). See "REP String Enhancement" in the Intel Software +// Development Manual. This feature essentially meanis that REP MOVSB will copy +// using the largest available size instead of copying bytes one by one, making +// it at least as fast as REPMOVS{W,D,Q}. +def FeatureERMSB : SubtargetFeature< - "fast-string", "HasFastString", "true", + "ermsb", "HasERMSB", "true", "REP MOVS/STOS are fast">; //===----------------------------------------------------------------------===// @@ -505,7 +508,7 @@ def HSWFeatures : ProcessorFeaturesslowIncDec()">; def HasFastMem32 : Predicate<"!Subtarget->isUnalignedMem32Slow()">; def HasFastLZCNT : Predicate<"Subtarget->hasFastLZCNT()">; def HasFastSHLDRotate : Predicate<"Subtarget->hasFastSHLDRotate()">; -def HasFastString : Predicate<"Subtarget->hasFastString()">; +def HasERMSB : Predicate<"Subtarget->hasERMSB()">; def HasMFence : Predicate<"Subtarget->hasMFence()">; //===----------------------------------------------------------------------===// diff --git a/lib/Target/X86/X86SelectionDAGInfo.cpp b/lib/Target/X86/X86SelectionDAGInfo.cpp index d893738d068..f09040bfe88 100644 --- a/lib/Target/X86/X86SelectionDAGInfo.cpp +++ b/lib/Target/X86/X86SelectionDAGInfo.cpp @@ -215,8 +215,8 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemcpy( return SDValue(); MVT AVT; - if (Subtarget.hasFastString()) - // If the target has fast strings, then it's at least as fast to use + if (Subtarget.hasERMSB()) + // If the target has enhanced REPMOVSB, then it's at least as fast to use // REP MOVSB instead of REP MOVS{W,D,Q}, and it avoids having to handle // BytesLeft. AVT = MVT::i8; diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 0bd29a5a27d..4154530d04e 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -303,7 +303,7 @@ void X86Subtarget::initializeEnvironment() { HasFastVectorFSQRT = false; HasFastLZCNT = false; HasFastSHLDRotate = false; - HasFastString = false; + HasERMSB = false; HasSlowDivide32 = false; HasSlowDivide64 = false; PadShortFunctions = false; diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 2b858c28e04..fd057f36c89 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -232,8 +232,8 @@ protected: /// True if SHLD based rotate is fast. bool HasFastSHLDRotate; - /// True if the processor has fast REP MOVS. - bool HasFastString; + /// True if the processor has enhanced REP MOVSB/STOSB. + bool HasERMSB; /// True if the short functions should be padded to prevent /// a stall when returning too early. @@ -475,7 +475,7 @@ public: bool hasFastVectorFSQRT() const { return HasFastVectorFSQRT; } bool hasFastLZCNT() const { return HasFastLZCNT; } bool hasFastSHLDRotate() const { return HasFastSHLDRotate; } - bool hasFastString() const { return HasFastString; } + bool hasERMSB() const { return HasERMSB; } bool hasSlowDivide32() const { return HasSlowDivide32; } bool hasSlowDivide64() const { return HasSlowDivide64; } bool padShortFunctions() const { return PadShortFunctions; } diff --git a/test/CodeGen/X86/memcpy-struct-by-value.ll b/test/CodeGen/X86/memcpy-struct-by-value.ll index 0537075aac3..bf889161023 100644 --- a/test/CodeGen/X86/memcpy-struct-by-value.ll +++ b/test/CodeGen/X86/memcpy-struct-by-value.ll @@ -1,5 +1,5 @@ -; RUN: llc -mtriple=x86_64-linux-gnu -mattr=-fast-string < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST -; RUN: llc -mtriple=x86_64-linux-gnu -mattr=+fast-string < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST +; RUN: llc -mtriple=x86_64-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST +; RUN: llc -mtriple=x86_64-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=haswell < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=HASWELL ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=generic < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC -- 2.11.0