Author: rafael Date: Wed Oct 31 06:52:06 2007 New Revision: 43552 URL: http://llvm.org/viewvc/llvm-project?rev=43552&view=rev Log: 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. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMSubtarget.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86Subtarget.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=43552&r1=43551&r2=43552&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Oct 31 06:52:06 2007 @@ -1315,7 +1315,8 @@ // this once Thumb ldmia / stmia support is added. unsigned Size = I->getValue(); 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 LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); } Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=43552&r1=43551&r2=43552&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Wed Oct 31 06:52:06 2007 @@ -62,6 +62,7 @@ /// ARMSubtarget(const Module &M, const std::string &FS, bool thumb); + unsigned getMaxInlineSizeThreshold() const { return 64; } /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43552&r1=43551&r2=43552&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 31 06:52:06 2007 @@ -4332,7 +4332,7 @@ // The libc version is likely to be faster for these cases. It can use the // address value and run time information about the CPU. if ((Align & 3) != 0 || - (I && I->getValue() > Subtarget->getMinRepStrSizeThreshold())) { + (I && I->getValue() > Subtarget->getMaxInlineSizeThreshold())) { MVT::ValueType IntPtr = getPointerTy(); const Type *IntPtrTy = getTargetData()->getIntPtrType(); TargetLowering::ArgListTy Args; @@ -4510,7 +4510,7 @@ return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); // 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 LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=43552&r1=43551&r2=43552&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Wed Oct 31 06:52:06 2007 @@ -223,7 +223,7 @@ , HasX86_64(false) , stackAlignment(8) // FIXME: this is a known good value for Yonah. How about others? - , MinRepStrSizeThreshold(128) + , MaxInlineSizeThreshold(128) , Is64Bit(is64Bit) , HasLow4GUserAddress(true) , TargetType(isELF) { // Default to ELF unless otherwise specified. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=43552&r1=43551&r2=43552&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Wed Oct 31 06:52:06 2007 @@ -69,9 +69,9 @@ /// entry to the function and which must be maintained by every function. 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: /// Is64Bit - True if the processor supports 64-bit instructions and module @@ -97,11 +97,9 @@ /// function for this subtarget. unsigned getStackAlignment() const { return stackAlignment; } - /// getMinRepStrSizeThreshold - Returns the minimum memset / memcpy size - /// required to turn the operation into a X86 rep/movs or rep/stos - /// instruction. This is only used if the src / dst alignment is not DWORD - /// aligned. - unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; } + /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size + /// that still makes it profitable to inline the call. + unsigned getMaxInlineSizeThreshold() const { return MaxInlineSizeThreshold; } /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits