forked from OSchip/llvm-project
Do not use movs{h|l}dup for a shuffle with a single non-undef node.
llvm-svn: 27718
This commit is contained in:
parent
39fac448d6
commit
65bb720a8b
|
@ -1724,12 +1724,14 @@ bool X86::isMOVSHDUPMask(SDNode *N) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Expect 1, 1, 3, 3
|
// Expect 1, 1, 3, 3
|
||||||
|
unsigned NumNodes = 0;
|
||||||
for (unsigned i = 0; i < 2; ++i) {
|
for (unsigned i = 0; i < 2; ++i) {
|
||||||
SDOperand Arg = N->getOperand(i);
|
SDOperand Arg = N->getOperand(i);
|
||||||
if (Arg.getOpcode() == ISD::UNDEF) continue;
|
if (Arg.getOpcode() == ISD::UNDEF) continue;
|
||||||
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
||||||
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
||||||
if (Val != 1) return false;
|
if (Val != 1) return false;
|
||||||
|
NumNodes++;
|
||||||
}
|
}
|
||||||
for (unsigned i = 2; i < 4; ++i) {
|
for (unsigned i = 2; i < 4; ++i) {
|
||||||
SDOperand Arg = N->getOperand(i);
|
SDOperand Arg = N->getOperand(i);
|
||||||
|
@ -1737,8 +1739,12 @@ bool X86::isMOVSHDUPMask(SDNode *N) {
|
||||||
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
||||||
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
||||||
if (Val != 3) return false;
|
if (Val != 3) return false;
|
||||||
|
NumNodes++;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
// Don't use movshdup if the resulting vector contains only one undef node.
|
||||||
|
// Use {p}shuf* instead.
|
||||||
|
return NumNodes > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isMOVSLDUPMask - Return true if the specified VECTOR_SHUFFLE operand
|
/// isMOVSLDUPMask - Return true if the specified VECTOR_SHUFFLE operand
|
||||||
|
@ -1750,12 +1756,14 @@ bool X86::isMOVSLDUPMask(SDNode *N) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Expect 0, 0, 2, 2
|
// Expect 0, 0, 2, 2
|
||||||
|
unsigned NumNodes = 0;
|
||||||
for (unsigned i = 0; i < 2; ++i) {
|
for (unsigned i = 0; i < 2; ++i) {
|
||||||
SDOperand Arg = N->getOperand(i);
|
SDOperand Arg = N->getOperand(i);
|
||||||
if (Arg.getOpcode() == ISD::UNDEF) continue;
|
if (Arg.getOpcode() == ISD::UNDEF) continue;
|
||||||
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
||||||
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
||||||
if (Val != 0) return false;
|
if (Val != 0) return false;
|
||||||
|
NumNodes++;
|
||||||
}
|
}
|
||||||
for (unsigned i = 2; i < 4; ++i) {
|
for (unsigned i = 2; i < 4; ++i) {
|
||||||
SDOperand Arg = N->getOperand(i);
|
SDOperand Arg = N->getOperand(i);
|
||||||
|
@ -1763,8 +1771,12 @@ bool X86::isMOVSLDUPMask(SDNode *N) {
|
||||||
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
|
||||||
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
|
||||||
if (Val != 2) return false;
|
if (Val != 2) return false;
|
||||||
|
NumNodes++;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
// Don't use movsldup if the resulting vector contains only one undef node.
|
||||||
|
// Use {p}shuf* instead.
|
||||||
|
return NumNodes > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isSplatMask - Return true if the specified VECTOR_SHUFFLE operand specifies
|
/// isSplatMask - Return true if the specified VECTOR_SHUFFLE operand specifies
|
||||||
|
|
Loading…
Reference in New Issue