aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-02-07 16:10:15 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-02-07 16:10:15 +0000
commit66f535a273e52d56199c7ce8f975796017b6cbb2 (patch)
tree42cd2d2b4c2353fc5e93d2dc27081f33e4107774 /lib/Target
parent7db31f100793cd4588de8f71b00a26784dd97c86 (diff)
downloadexternal_llvm-66f535a273e52d56199c7ce8f975796017b6cbb2.zip
external_llvm-66f535a273e52d56199c7ce8f975796017b6cbb2.tar.gz
external_llvm-66f535a273e52d56199c7ce8f975796017b6cbb2.tar.bz2
ARM cost model: Add costs for vector selects
Vector selects are cheap on NEON. They get lowered to a vbsl instruction. radar://13158753 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/ARMTargetTransformInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMTargetTransformInfo.cpp b/lib/Target/ARM/ARMTargetTransformInfo.cpp
index bf83d51..1f91e0e 100644
--- a/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -117,6 +117,8 @@ public:
unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
Type *Src) const;
+ unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy) const;
+
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index) const;
/// @}
};
@@ -311,3 +313,16 @@ unsigned ARMTTI::getVectorInstrCost(unsigned Opcode, Type *ValTy,
return TargetTransformInfo::getVectorInstrCost(Opcode, ValTy, Index);
}
+
+unsigned ARMTTI::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
+ Type *CondTy) const {
+
+ int ISD = TLI->InstructionOpcodeToISD(Opcode);
+ // On NEON a a vector select gets lowered to vbsl.
+ if (ST->hasNEON() && ValTy->isVectorTy() && ISD == ISD::SELECT) {
+ std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(ValTy);
+ return LT.first;
+ }
+
+ return TargetTransformInfo::getCmpSelInstrCost(Opcode, ValTy, CondTy);
+}