[llvm] r321002 - [Hexagon] Prefer to widen HVX vectors instead of promoting
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 10:21:01 PST 2017
Author: kparzysz
Date: Mon Dec 18 10:21:01 2017
New Revision: 321002
URL: http://llvm.org/viewvc/llvm-project?rev=321002&view=rev
Log:
[Hexagon] Prefer to widen HVX vectors instead of promoting
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=321002&r1=321001&r2=321002&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Mon Dec 18 10:21:01 2017
@@ -2323,6 +2323,18 @@ bool HexagonTargetLowering::isShuffleMas
return true;
}
+TargetLoweringBase::LegalizeTypeAction
+HexagonTargetLowering::getPreferredVectorAction(EVT VT) const {
+ if (Subtarget.useHVXOps()) {
+ // If the size of VT is at least half of the vector length,
+ // widen the vector. Note: the threshold was not selected in
+ // any scientific way.
+ if (VT.getSizeInBits() >= Subtarget.getVectorLength()*8/2)
+ return TargetLoweringBase::TypeWidenVector;
+ }
+ return TargetLowering::getPreferredVectorAction(VT);
+}
+
// Lower a vector shuffle (V1, V2, V3). V1 and V2 are the two vectors
// to select data from, V3 is the permutation.
SDValue
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h?rev=321002&r1=321001&r2=321002&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h Mon Dec 18 10:21:01 2017
@@ -122,6 +122,8 @@ namespace HexagonISD {
unsigned DefinedValues) const override;
bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
+ TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT)
+ const override;
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
const char *getTargetNodeName(unsigned Opcode) const override;
More information about the llvm-commits
mailing list