mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
[X86] Provide lighter weight getTargetShuffleMask wrapper. NFCI.
Most callers to getTargetShuffleMask don't use the IsUnary flag.
This commit is contained in:
parent
81b44f54a3
commit
ddbea9a58f
@ -7216,6 +7216,14 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper for getTargetShuffleMask with InUnary;
|
||||||
|
static bool getTargetShuffleMask(SDNode *N, MVT VT, bool AllowSentinelZero,
|
||||||
|
SmallVectorImpl<SDValue> &Ops,
|
||||||
|
SmallVectorImpl<int> &Mask) {
|
||||||
|
bool IsUnary;
|
||||||
|
return getTargetShuffleMask(N, VT, AllowSentinelZero, Ops, Mask, IsUnary);
|
||||||
|
}
|
||||||
|
|
||||||
/// Compute whether each element of a shuffle is zeroable.
|
/// Compute whether each element of a shuffle is zeroable.
|
||||||
///
|
///
|
||||||
/// A "zeroable" vector shuffle element is one which can be lowered to zero.
|
/// A "zeroable" vector shuffle element is one which can be lowered to zero.
|
||||||
@ -7956,10 +7964,8 @@ static SDValue getShuffleScalarElt(SDValue Op, unsigned Index,
|
|||||||
int NumElems = (int)ShufVT.getVectorNumElements();
|
int NumElems = (int)ShufVT.getVectorNumElements();
|
||||||
SmallVector<int, 16> ShuffleMask;
|
SmallVector<int, 16> ShuffleMask;
|
||||||
SmallVector<SDValue, 16> ShuffleOps;
|
SmallVector<SDValue, 16> ShuffleOps;
|
||||||
bool IsUnary;
|
|
||||||
|
|
||||||
if (!getTargetShuffleMask(Op.getNode(), ShufVT, true, ShuffleOps,
|
if (!getTargetShuffleMask(Op.getNode(), ShufVT, true, ShuffleOps,
|
||||||
ShuffleMask, IsUnary))
|
ShuffleMask))
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
int Elt = ShuffleMask[Index];
|
int Elt = ShuffleMask[Index];
|
||||||
@ -34433,11 +34439,9 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
|
|||||||
// Handle target shuffles.
|
// Handle target shuffles.
|
||||||
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
||||||
if (isTargetShuffle(Opc)) {
|
if (isTargetShuffle(Opc)) {
|
||||||
bool IsUnary;
|
|
||||||
SmallVector<int, 64> Mask;
|
SmallVector<int, 64> Mask;
|
||||||
SmallVector<SDValue, 2> Ops;
|
SmallVector<SDValue, 2> Ops;
|
||||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask,
|
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask)) {
|
||||||
IsUnary)) {
|
|
||||||
unsigned NumOps = Ops.size();
|
unsigned NumOps = Ops.size();
|
||||||
unsigned NumElts = VT.getVectorNumElements();
|
unsigned NumElts = VT.getVectorNumElements();
|
||||||
if (Mask.size() == NumElts) {
|
if (Mask.size() == NumElts) {
|
||||||
@ -34572,11 +34576,9 @@ unsigned X86TargetLowering::ComputeNumSignBitsForTargetNode(
|
|||||||
// Handle target shuffles.
|
// Handle target shuffles.
|
||||||
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
||||||
if (isTargetShuffle(Opcode)) {
|
if (isTargetShuffle(Opcode)) {
|
||||||
bool IsUnary;
|
|
||||||
SmallVector<int, 64> Mask;
|
SmallVector<int, 64> Mask;
|
||||||
SmallVector<SDValue, 2> Ops;
|
SmallVector<SDValue, 2> Ops;
|
||||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask,
|
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask)) {
|
||||||
IsUnary)) {
|
|
||||||
unsigned NumOps = Ops.size();
|
unsigned NumOps = Ops.size();
|
||||||
unsigned NumElts = VT.getVectorNumElements();
|
unsigned NumElts = VT.getVectorNumElements();
|
||||||
if (Mask.size() == NumElts) {
|
if (Mask.size() == NumElts) {
|
||||||
@ -36592,9 +36594,8 @@ static SmallVector<int, 4> getPSHUFShuffleMask(SDValue N) {
|
|||||||
MVT VT = N.getSimpleValueType();
|
MVT VT = N.getSimpleValueType();
|
||||||
SmallVector<int, 4> Mask;
|
SmallVector<int, 4> Mask;
|
||||||
SmallVector<SDValue, 2> Ops;
|
SmallVector<SDValue, 2> Ops;
|
||||||
bool IsUnary;
|
|
||||||
bool HaveMask =
|
bool HaveMask =
|
||||||
getTargetShuffleMask(N.getNode(), VT, false, Ops, Mask, IsUnary);
|
getTargetShuffleMask(N.getNode(), VT, false, Ops, Mask);
|
||||||
(void)HaveMask;
|
(void)HaveMask;
|
||||||
assert(HaveMask);
|
assert(HaveMask);
|
||||||
|
|
||||||
@ -41190,14 +41191,11 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
|
|||||||
LHS.getOpcode() == X86ISD::PSHUFB && RHS.getOpcode() == X86ISD::PSHUFB &&
|
LHS.getOpcode() == X86ISD::PSHUFB && RHS.getOpcode() == X86ISD::PSHUFB &&
|
||||||
LHS.hasOneUse() && RHS.hasOneUse()) {
|
LHS.hasOneUse() && RHS.hasOneUse()) {
|
||||||
MVT SimpleVT = VT.getSimpleVT();
|
MVT SimpleVT = VT.getSimpleVT();
|
||||||
bool LHSUnary, RHSUnary;
|
|
||||||
SmallVector<SDValue, 1> LHSOps, RHSOps;
|
SmallVector<SDValue, 1> LHSOps, RHSOps;
|
||||||
SmallVector<int, 64> LHSMask, RHSMask, CondMask;
|
SmallVector<int, 64> LHSMask, RHSMask, CondMask;
|
||||||
if (createShuffleMaskFromVSELECT(CondMask, Cond) &&
|
if (createShuffleMaskFromVSELECT(CondMask, Cond) &&
|
||||||
getTargetShuffleMask(LHS.getNode(), SimpleVT, true, LHSOps, LHSMask,
|
getTargetShuffleMask(LHS.getNode(), SimpleVT, true, LHSOps, LHSMask) &&
|
||||||
LHSUnary) &&
|
getTargetShuffleMask(RHS.getNode(), SimpleVT, true, RHSOps, RHSMask)) {
|
||||||
getTargetShuffleMask(RHS.getNode(), SimpleVT, true, RHSOps, RHSMask,
|
|
||||||
RHSUnary)) {
|
|
||||||
int NumElts = VT.getVectorNumElements();
|
int NumElts = VT.getVectorNumElements();
|
||||||
for (int i = 0; i != NumElts; ++i) {
|
for (int i = 0; i != NumElts; ++i) {
|
||||||
if (CondMask[i] < NumElts)
|
if (CondMask[i] < NumElts)
|
||||||
@ -45740,13 +45738,12 @@ static bool isHorizontalBinOp(unsigned HOpcode, SDValue &LHS, SDValue &RHS,
|
|||||||
Op = Op.getOperand(0);
|
Op = Op.getOperand(0);
|
||||||
UseSubVector = true;
|
UseSubVector = true;
|
||||||
}
|
}
|
||||||
bool IsUnary;
|
|
||||||
SmallVector<SDValue, 2> SrcOps;
|
SmallVector<SDValue, 2> SrcOps;
|
||||||
SmallVector<int, 16> SrcShuffleMask;
|
SmallVector<int, 16> SrcShuffleMask;
|
||||||
SDValue BC = peekThroughBitcasts(Op);
|
SDValue BC = peekThroughBitcasts(Op);
|
||||||
if (isTargetShuffle(BC.getOpcode()) &&
|
if (isTargetShuffle(BC.getOpcode()) &&
|
||||||
getTargetShuffleMask(BC.getNode(), BC.getSimpleValueType(), false,
|
getTargetShuffleMask(BC.getNode(), BC.getSimpleValueType(), false,
|
||||||
SrcOps, SrcShuffleMask, IsUnary)) {
|
SrcOps, SrcShuffleMask)) {
|
||||||
if (!UseSubVector && SrcShuffleMask.size() == NumElts &&
|
if (!UseSubVector && SrcShuffleMask.size() == NumElts &&
|
||||||
SrcOps.size() <= 2) {
|
SrcOps.size() <= 2) {
|
||||||
N0 = SrcOps.size() > 0 ? SrcOps[0] : SDValue();
|
N0 = SrcOps.size() > 0 ? SrcOps[0] : SDValue();
|
||||||
@ -49311,11 +49308,10 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
|
|||||||
int NumSrcElts = OpVT.getVectorNumElements();
|
int NumSrcElts = OpVT.getVectorNumElements();
|
||||||
SmallVector<int, 64> ConcatMask;
|
SmallVector<int, 64> ConcatMask;
|
||||||
for (unsigned i = 0; i != NumOps; ++i) {
|
for (unsigned i = 0; i != NumOps; ++i) {
|
||||||
bool IsUnary;
|
|
||||||
SmallVector<int, 64> SubMask;
|
SmallVector<int, 64> SubMask;
|
||||||
SmallVector<SDValue, 2> SubOps;
|
SmallVector<SDValue, 2> SubOps;
|
||||||
if (!getTargetShuffleMask(Ops[i].getNode(), OpVT, false, SubOps,
|
if (!getTargetShuffleMask(Ops[i].getNode(), OpVT, false, SubOps,
|
||||||
SubMask, IsUnary))
|
SubMask))
|
||||||
break;
|
break;
|
||||||
for (int M : SubMask) {
|
for (int M : SubMask) {
|
||||||
if (0 <= M) {
|
if (0 <= M) {
|
||||||
|
Loading…
Reference in New Issue
Block a user