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;
|
||||
}
|
||||
|
||||
// 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.
|
||||
///
|
||||
/// 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();
|
||||
SmallVector<int, 16> ShuffleMask;
|
||||
SmallVector<SDValue, 16> ShuffleOps;
|
||||
bool IsUnary;
|
||||
|
||||
if (!getTargetShuffleMask(Op.getNode(), ShufVT, true, ShuffleOps,
|
||||
ShuffleMask, IsUnary))
|
||||
ShuffleMask))
|
||||
return SDValue();
|
||||
|
||||
int Elt = ShuffleMask[Index];
|
||||
@ -34433,11 +34439,9 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
|
||||
// Handle target shuffles.
|
||||
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
||||
if (isTargetShuffle(Opc)) {
|
||||
bool IsUnary;
|
||||
SmallVector<int, 64> Mask;
|
||||
SmallVector<SDValue, 2> Ops;
|
||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask,
|
||||
IsUnary)) {
|
||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask)) {
|
||||
unsigned NumOps = Ops.size();
|
||||
unsigned NumElts = VT.getVectorNumElements();
|
||||
if (Mask.size() == NumElts) {
|
||||
@ -34572,11 +34576,9 @@ unsigned X86TargetLowering::ComputeNumSignBitsForTargetNode(
|
||||
// Handle target shuffles.
|
||||
// TODO - use resolveTargetShuffleInputs once we can limit recursive depth.
|
||||
if (isTargetShuffle(Opcode)) {
|
||||
bool IsUnary;
|
||||
SmallVector<int, 64> Mask;
|
||||
SmallVector<SDValue, 2> Ops;
|
||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask,
|
||||
IsUnary)) {
|
||||
if (getTargetShuffleMask(Op.getNode(), VT.getSimpleVT(), true, Ops, Mask)) {
|
||||
unsigned NumOps = Ops.size();
|
||||
unsigned NumElts = VT.getVectorNumElements();
|
||||
if (Mask.size() == NumElts) {
|
||||
@ -36592,9 +36594,8 @@ static SmallVector<int, 4> getPSHUFShuffleMask(SDValue N) {
|
||||
MVT VT = N.getSimpleValueType();
|
||||
SmallVector<int, 4> Mask;
|
||||
SmallVector<SDValue, 2> Ops;
|
||||
bool IsUnary;
|
||||
bool HaveMask =
|
||||
getTargetShuffleMask(N.getNode(), VT, false, Ops, Mask, IsUnary);
|
||||
getTargetShuffleMask(N.getNode(), VT, false, Ops, Mask);
|
||||
(void)HaveMask;
|
||||
assert(HaveMask);
|
||||
|
||||
@ -41190,14 +41191,11 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &DAG,
|
||||
LHS.getOpcode() == X86ISD::PSHUFB && RHS.getOpcode() == X86ISD::PSHUFB &&
|
||||
LHS.hasOneUse() && RHS.hasOneUse()) {
|
||||
MVT SimpleVT = VT.getSimpleVT();
|
||||
bool LHSUnary, RHSUnary;
|
||||
SmallVector<SDValue, 1> LHSOps, RHSOps;
|
||||
SmallVector<int, 64> LHSMask, RHSMask, CondMask;
|
||||
if (createShuffleMaskFromVSELECT(CondMask, Cond) &&
|
||||
getTargetShuffleMask(LHS.getNode(), SimpleVT, true, LHSOps, LHSMask,
|
||||
LHSUnary) &&
|
||||
getTargetShuffleMask(RHS.getNode(), SimpleVT, true, RHSOps, RHSMask,
|
||||
RHSUnary)) {
|
||||
getTargetShuffleMask(LHS.getNode(), SimpleVT, true, LHSOps, LHSMask) &&
|
||||
getTargetShuffleMask(RHS.getNode(), SimpleVT, true, RHSOps, RHSMask)) {
|
||||
int NumElts = VT.getVectorNumElements();
|
||||
for (int i = 0; i != NumElts; ++i) {
|
||||
if (CondMask[i] < NumElts)
|
||||
@ -45740,13 +45738,12 @@ static bool isHorizontalBinOp(unsigned HOpcode, SDValue &LHS, SDValue &RHS,
|
||||
Op = Op.getOperand(0);
|
||||
UseSubVector = true;
|
||||
}
|
||||
bool IsUnary;
|
||||
SmallVector<SDValue, 2> SrcOps;
|
||||
SmallVector<int, 16> SrcShuffleMask;
|
||||
SDValue BC = peekThroughBitcasts(Op);
|
||||
if (isTargetShuffle(BC.getOpcode()) &&
|
||||
getTargetShuffleMask(BC.getNode(), BC.getSimpleValueType(), false,
|
||||
SrcOps, SrcShuffleMask, IsUnary)) {
|
||||
SrcOps, SrcShuffleMask)) {
|
||||
if (!UseSubVector && SrcShuffleMask.size() == NumElts &&
|
||||
SrcOps.size() <= 2) {
|
||||
N0 = SrcOps.size() > 0 ? SrcOps[0] : SDValue();
|
||||
@ -49311,11 +49308,10 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
|
||||
int NumSrcElts = OpVT.getVectorNumElements();
|
||||
SmallVector<int, 64> ConcatMask;
|
||||
for (unsigned i = 0; i != NumOps; ++i) {
|
||||
bool IsUnary;
|
||||
SmallVector<int, 64> SubMask;
|
||||
SmallVector<SDValue, 2> SubOps;
|
||||
if (!getTargetShuffleMask(Ops[i].getNode(), OpVT, false, SubOps,
|
||||
SubMask, IsUnary))
|
||||
SubMask))
|
||||
break;
|
||||
for (int M : SubMask) {
|
||||
if (0 <= M) {
|
||||
|
Loading…
Reference in New Issue
Block a user