summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-01-28 09:45:01 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-01-28 09:45:01 +0000
commitd3b78430d1112dec60dfe13b349bb629bc960874 (patch)
tree154c098f11e53f22c485d6eaf34cb72e598e142f /llvm
parent7d6c5f19f1b4739f185b4654a1402eb0c1c5dc8d (diff)
downloadbcm5719-llvm-d3b78430d1112dec60dfe13b349bb629bc960874.tar.gz
bcm5719-llvm-d3b78430d1112dec60dfe13b349bb629bc960874.zip
[X86][SSE] Move setTargetShuffleZeroElements closer to getTargetShuffleMask. NFCI.
Keep target shuffle mask helper functions closer together. llvm-svn: 259034
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp93
1 files changed, 47 insertions, 46 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index b6a3dd2f370..bf16beb66e3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -5107,6 +5107,53 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
return true;
}
+/// Check a target shuffle mask's inputs to see if we can set any values to
+/// SM_SentinelZero - this is for elements that are known to be zero
+/// (not just zeroable) from their inputs.
+/// Returns true if the target shuffle mask was decoded.
+static bool setTargetShuffleZeroElements(SDValue N,
+ SmallVectorImpl<int> &Mask) {
+ bool IsUnary;
+ if (!isTargetShuffle(N.getOpcode()))
+ return false;
+ if (!getTargetShuffleMask(N.getNode(), N.getSimpleValueType(), true, Mask,
+ IsUnary))
+ return false;
+
+ SDValue V1 = N.getOperand(0);
+ SDValue V2 = IsUnary ? V1 : N.getOperand(1);
+
+ while (V1.getOpcode() == ISD::BITCAST)
+ V1 = V1->getOperand(0);
+ while (V2.getOpcode() == ISD::BITCAST)
+ V2 = V2->getOperand(0);
+
+ for (int i = 0, Size = Mask.size(); i != Size; ++i) {
+ int M = Mask[i];
+
+ // Already decoded as SM_SentinelZero / SM_SentinelUndef.
+ if (M < 0)
+ continue;
+
+ SDValue V = M < Size ? V1 : V2;
+
+ // We are referencing an UNDEF input.
+ if (V.isUndef()) {
+ Mask[i] = SM_SentinelUndef;
+ continue;
+ }
+
+ // TODO - handle the Size != (int)V.getNumOperands() cases in future.
+ if (V.getOpcode() != ISD::BUILD_VECTOR || Size != (int)V.getNumOperands())
+ continue;
+ if (!X86::isZeroNode(V.getOperand(M % Size)))
+ continue;
+ Mask[i] = SM_SentinelZero;
+ }
+
+ return true;
+}
+
/// Returns the scalar element that will make up the ith
/// element of the result of the vector shuffle.
static SDValue getShuffleScalarElt(SDNode *N, unsigned Index, SelectionDAG &DAG,
@@ -23838,52 +23885,6 @@ static bool combineRedundantHalfShuffle(SDValue N, MutableArrayRef<int> Mask,
return true;
}
-/// Check a target shuffle mask's inputs to see if we can set any values to
-/// SM_SentinelZero - this is for elements that are known to be zero
-/// (not just zeroable) from their inputs.
-static bool setTargetShuffleZeroElements(SDValue N,
- SmallVectorImpl<int> &Mask) {
- bool IsUnary;
- if (!isTargetShuffle(N.getOpcode()))
- return false;
- if (!getTargetShuffleMask(N.getNode(), N.getSimpleValueType(), true, Mask,
- IsUnary))
- return false;
-
- SDValue V1 = N.getOperand(0);
- SDValue V2 = IsUnary ? V1 : N.getOperand(1);
-
- while (V1.getOpcode() == ISD::BITCAST)
- V1 = V1->getOperand(0);
- while (V2.getOpcode() == ISD::BITCAST)
- V2 = V2->getOperand(0);
-
- for (int i = 0, Size = Mask.size(); i != Size; ++i) {
- int M = Mask[i];
-
- // Already decoded as SM_SentinelZero / SM_SentinelUndef.
- if (M < 0)
- continue;
-
- SDValue V = M < Size ? V1 : V2;
-
- // We are referencing an UNDEF input.
- if (V.isUndef()) {
- Mask[i] = SM_SentinelUndef;
- continue;
- }
-
- // TODO - handle the Size != (int)V.getNumOperands() cases in future.
- if (V.getOpcode() != ISD::BUILD_VECTOR || Size != (int)V.getNumOperands())
- continue;
- if (!X86::isZeroNode(V.getOperand(M % Size)))
- continue;
- Mask[i] = SM_SentinelZero;
- }
-
- return true;
-}
-
/// \brief Try to combine x86 target specific shuffles.
static SDValue PerformTargetShuffleCombine(SDValue N, SelectionDAG &DAG,
TargetLowering::DAGCombinerInfo &DCI,
OpenPOWER on IntegriCloud