mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-22 03:39:03 +00:00
Make ARM an X86 memcpy expansion more similar to each other.
Now both subtarget define getMaxInlineSizeThreshold and the expansion uses it. This should not change generated code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43552 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7169a2f9e8
commit
fc05f402ea
@ -1315,7 +1315,8 @@ SDOperand ARMTargetLowering::LowerMEMCPY(SDOperand Op, SelectionDAG &DAG,
|
|||||||
// this once Thumb ldmia / stmia support is added.
|
// this once Thumb ldmia / stmia support is added.
|
||||||
unsigned Size = I->getValue();
|
unsigned Size = I->getValue();
|
||||||
if (AlwaysInline ||
|
if (AlwaysInline ||
|
||||||
(!ST->isThumb() && Size < 64 && (Align & 3) == 0))
|
(!ST->isThumb() && Size <= Subtarget->getMaxInlineSizeThreshold() &&
|
||||||
|
(Align & 3) == 0))
|
||||||
return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
|
return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
|
||||||
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ protected:
|
|||||||
///
|
///
|
||||||
ARMSubtarget(const Module &M, const std::string &FS, bool thumb);
|
ARMSubtarget(const Module &M, const std::string &FS, bool thumb);
|
||||||
|
|
||||||
|
unsigned getMaxInlineSizeThreshold() const { return 64; }
|
||||||
/// ParseSubtargetFeatures - Parses features string setting specified
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
||||||
/// subtarget options. Definition of function is auto generated by tblgen.
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
||||||
void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
|
void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
|
||||||
|
@ -4332,7 +4332,7 @@ SDOperand X86TargetLowering::LowerMEMSET(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
// The libc version is likely to be faster for these cases. It can use the
|
// The libc version is likely to be faster for these cases. It can use the
|
||||||
// address value and run time information about the CPU.
|
// address value and run time information about the CPU.
|
||||||
if ((Align & 3) != 0 ||
|
if ((Align & 3) != 0 ||
|
||||||
(I && I->getValue() > Subtarget->getMinRepStrSizeThreshold())) {
|
(I && I->getValue() > Subtarget->getMaxInlineSizeThreshold())) {
|
||||||
MVT::ValueType IntPtr = getPointerTy();
|
MVT::ValueType IntPtr = getPointerTy();
|
||||||
const Type *IntPtrTy = getTargetData()->getIntPtrType();
|
const Type *IntPtrTy = getTargetData()->getIntPtrType();
|
||||||
TargetLowering::ArgListTy Args;
|
TargetLowering::ArgListTy Args;
|
||||||
@ -4510,7 +4510,7 @@ SDOperand X86TargetLowering::LowerMEMCPY(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
||||||
|
|
||||||
// If size is more than the threshold, call memcpy.
|
// If size is more than the threshold, call memcpy.
|
||||||
if (Size > Subtarget->getMinRepStrSizeThreshold())
|
if (Size > Subtarget->getMaxInlineSizeThreshold())
|
||||||
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG);
|
||||||
|
|
||||||
return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
|
return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG);
|
||||||
|
@ -223,7 +223,7 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
|
|||||||
, HasX86_64(false)
|
, HasX86_64(false)
|
||||||
, stackAlignment(8)
|
, stackAlignment(8)
|
||||||
// FIXME: this is a known good value for Yonah. How about others?
|
// FIXME: this is a known good value for Yonah. How about others?
|
||||||
, MinRepStrSizeThreshold(128)
|
, MaxInlineSizeThreshold(128)
|
||||||
, Is64Bit(is64Bit)
|
, Is64Bit(is64Bit)
|
||||||
, HasLow4GUserAddress(true)
|
, HasLow4GUserAddress(true)
|
||||||
, TargetType(isELF) { // Default to ELF unless otherwise specified.
|
, TargetType(isELF) { // Default to ELF unless otherwise specified.
|
||||||
|
@ -69,9 +69,9 @@ protected:
|
|||||||
/// entry to the function and which must be maintained by every function.
|
/// entry to the function and which must be maintained by every function.
|
||||||
unsigned stackAlignment;
|
unsigned stackAlignment;
|
||||||
|
|
||||||
/// Min. memset / memcpy size that is turned into rep/movs, rep/stos ops.
|
/// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
|
||||||
///
|
///
|
||||||
unsigned MinRepStrSizeThreshold;
|
unsigned MaxInlineSizeThreshold;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Is64Bit - True if the processor supports 64-bit instructions and module
|
/// Is64Bit - True if the processor supports 64-bit instructions and module
|
||||||
@ -97,11 +97,9 @@ public:
|
|||||||
/// function for this subtarget.
|
/// function for this subtarget.
|
||||||
unsigned getStackAlignment() const { return stackAlignment; }
|
unsigned getStackAlignment() const { return stackAlignment; }
|
||||||
|
|
||||||
/// getMinRepStrSizeThreshold - Returns the minimum memset / memcpy size
|
/// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
|
||||||
/// required to turn the operation into a X86 rep/movs or rep/stos
|
/// that still makes it profitable to inline the call.
|
||||||
/// instruction. This is only used if the src / dst alignment is not DWORD
|
unsigned getMaxInlineSizeThreshold() const { return MaxInlineSizeThreshold; }
|
||||||
/// aligned.
|
|
||||||
unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; }
|
|
||||||
|
|
||||||
/// ParseSubtargetFeatures - Parses features string setting specified
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
||||||
/// subtarget options. Definition of function is auto generated by tblgen.
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user