summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-01-03 07:36:39 +0000
committerCraig Topper <craig.topper@gmail.com>2017-01-03 07:36:39 +0000
commit785e58fdc9845d79920be41dbb5a63d2b13a9ce6 (patch)
tree97ddd66b0ae185e104cecddd03289721d68c52fb
parent9496e3f916f896da0c9959b36115b91d293c0fdd (diff)
downloadbcm5719-llvm-785e58fdc9845d79920be41dbb5a63d2b13a9ce6.tar.gz
bcm5719-llvm-785e58fdc9845d79920be41dbb5a63d2b13a9ce6.zip
[AVX-512] Simplify the code added in r290870 to recognized 256-bit subvector inserts and avoid calling isShuffleEquivalent on a widened mask.
llvm-svn: 290871
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6e6edce4de7..36e39c16e75 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -12590,8 +12590,8 @@ static SDValue lower256BitVectorShuffle(const SDLoc &DL, ArrayRef<int> Mask,
}
}
-/// \brief Try to lower a vector shuffle as a 256-bit shuffle.
-static SDValue lowerV2X256VectorShuffle(const SDLoc &DL, MVT VT,
+/// \brief Try to lower a vector shuffle as a 128-bit shuffles.
+static SDValue lowerV4X128VectorShuffle(const SDLoc &DL, MVT VT,
ArrayRef<int> Mask, SDValue V1,
SDValue V2, SelectionDAG &DAG) {
assert(VT.getScalarSizeInBits() == 64 &&
@@ -12601,16 +12601,16 @@ static SDValue lowerV2X256VectorShuffle(const SDLoc &DL, MVT VT,
// function lowerV2X128VectorShuffle() is better solution.
assert(VT.is512BitVector() && "Unexpected vector size for 512bit shuffle.");
- assert(Mask.size() == 4 && "Expect mask to already be widened to 128-bits.");
-
- SmallVector<int, 2> WidenedMask;
+ SmallVector<int, 4> WidenedMask;
if (!canWidenShuffleElements(Mask, WidenedMask))
return SDValue();
// Check for patterns which can be matched with a single insert of a 256-bit
// subvector.
- bool OnlyUsesV1 = isShuffleEquivalent(V1, V2, WidenedMask, {0, 0});
- if (OnlyUsesV1 || isShuffleEquivalent(V1, V2, WidenedMask, {0, 2})) {
+ bool OnlyUsesV1 = isShuffleEquivalent(V1, V2, Mask,
+ {0, 1, 2, 3, 0, 1, 2, 3});
+ if (OnlyUsesV1 || isShuffleEquivalent(V1, V2, Mask,
+ {0, 1, 2, 3, 8, 9, 10, 11})) {
MVT SubVT = MVT::getVectorVT(VT.getVectorElementType(),
VT.getVectorNumElements() / 2);
SDValue LoV = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, SubVT, V1,
@@ -12621,29 +12621,6 @@ static SDValue lowerV2X256VectorShuffle(const SDLoc &DL, MVT VT,
return DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, LoV, HiV);
}
- return SDValue();
-}
-
-/// \brief Try to lower a vector shuffle as a 128-bit shuffles.
-static SDValue lowerV4X128VectorShuffle(const SDLoc &DL, MVT VT,
- ArrayRef<int> Mask, SDValue V1,
- SDValue V2, SelectionDAG &DAG) {
- assert(VT.getScalarSizeInBits() == 64 &&
- "Unexpected element type size for 128bit shuffle.");
-
- // To handle 256 bit vector requires VLX and most probably
- // function lowerV2X128VectorShuffle() is better solution.
- assert(VT.is512BitVector() && "Unexpected vector size for 512bit shuffle.");
-
- SmallVector<int, 4> WidenedMask;
- if (!canWidenShuffleElements(Mask, WidenedMask))
- return SDValue();
-
- // See if we can widen even further to a 256-bit element.
- if (SDValue Shuf256 = lowerV2X256VectorShuffle(DL, VT, WidenedMask, V1, V2,
- DAG))
- return Shuf256;
-
SDValue Ops[2] = {DAG.getUNDEF(VT), DAG.getUNDEF(VT)};
// Insure elements came from the same Op.
int MaxOp1Index = VT.getVectorNumElements()/2 - 1;
OpenPOWER on IntegriCloud