mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Add a new target hook "predictableSelectIsExpensive".
This will be used to determine whether it's profitable to turn a select into a branch when the branch is likely to be predicted. Currently enabled for everything but Atom on X86 and Cortex-A9 devices on ARM. I'm not entirely happy with the name of this flag, suggestions welcome ;) llvm-svn: 156233
This commit is contained in:
parent
39afd32d88
commit
7a9528b540
@ -150,6 +150,12 @@ public:
|
||||
/// that should be avoided.
|
||||
bool isJumpExpensive() const { return JumpIsExpensive; }
|
||||
|
||||
/// isPredictableSelectExpensive - Return true if selects are only cheaper
|
||||
/// than branches if the branch is unlikely to be predicted right.
|
||||
bool isPredictableSelectExpensive() const {
|
||||
return predictableSelectIsExpensive;
|
||||
}
|
||||
|
||||
/// getSetCCResultType - Return the ValueType of the result of SETCC
|
||||
/// operations. Also used to obtain the target's preferred type for
|
||||
/// the condition operand of SELECT and BRCOND nodes. In the case of
|
||||
@ -2028,6 +2034,10 @@ protected:
|
||||
/// optimization.
|
||||
bool benefitFromCodePlacementOpt;
|
||||
|
||||
/// predictableSelectIsExpensive - Tells the code generator that select is
|
||||
/// more expensive than a branch if the branch is usually predicted right.
|
||||
bool predictableSelectIsExpensive;
|
||||
|
||||
private:
|
||||
/// isLegalRC - Return true if the value types that can be represented by the
|
||||
/// specified register class are all legal.
|
||||
|
@ -605,6 +605,7 @@ TargetLowering::TargetLowering(const TargetMachine &tm,
|
||||
IntDivIsCheap = false;
|
||||
Pow2DivIsCheap = false;
|
||||
JumpIsExpensive = false;
|
||||
predictableSelectIsExpensive = false;
|
||||
StackPointerRegisterToSaveRestore = 0;
|
||||
ExceptionPointerRegister = 0;
|
||||
ExceptionSelectorRegister = 0;
|
||||
|
@ -824,6 +824,9 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
|
||||
|
||||
benefitFromCodePlacementOpt = true;
|
||||
|
||||
// Prefer likely predicted branches to selects on out-of-order cores.
|
||||
predictableSelectIsExpensive = Subtarget->isCortexA9();
|
||||
|
||||
setMinFunctionAlignment(Subtarget->isThumb() ? 1 : 2);
|
||||
}
|
||||
|
||||
|
@ -1243,6 +1243,9 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
|
||||
setPrefLoopAlignment(4); // 2^4 bytes.
|
||||
benefitFromCodePlacementOpt = true;
|
||||
|
||||
// Predictable cmov don't hurt on atom because it's in-order.
|
||||
predictableSelectIsExpensive = !Subtarget->isAtom();
|
||||
|
||||
setPrefFunctionAlignment(4); // 2^4 bytes.
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user