aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-04-15 03:13:24 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-04-15 03:13:24 +0000
commit39fc1459953040a480e58142fb6adbfcc4082fe8 (patch)
tree73b718e4ebf608aa3d1a1e33c6028b31d0526daa /lib/Target
parentefb47359ff4bf59217985fd2fbcec295bc0239d2 (diff)
downloadexternal_llvm-39fc1459953040a480e58142fb6adbfcc4082fe8.zip
external_llvm-39fc1459953040a480e58142fb6adbfcc4082fe8.tar.gz
external_llvm-39fc1459953040a480e58142fb6adbfcc4082fe8.tar.bz2
Do not use movs{h|l}dup for a shuffle with a single non-undef node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27718 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 4d5b4da..409c39b 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -1724,12 +1724,14 @@ bool X86::isMOVSHDUPMask(SDNode *N) {
return false;
// Expect 1, 1, 3, 3
+ unsigned NumNodes = 0;
for (unsigned i = 0; i < 2; ++i) {
SDOperand Arg = N->getOperand(i);
if (Arg.getOpcode() == ISD::UNDEF) continue;
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
if (Val != 1) return false;
+ NumNodes++;
}
for (unsigned i = 2; i < 4; ++i) {
SDOperand Arg = N->getOperand(i);
@@ -1737,8 +1739,12 @@ bool X86::isMOVSHDUPMask(SDNode *N) {
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
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
@@ -1750,12 +1756,14 @@ bool X86::isMOVSLDUPMask(SDNode *N) {
return false;
// Expect 0, 0, 2, 2
+ unsigned NumNodes = 0;
for (unsigned i = 0; i < 2; ++i) {
SDOperand Arg = N->getOperand(i);
if (Arg.getOpcode() == ISD::UNDEF) continue;
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
if (Val != 0) return false;
+ NumNodes++;
}
for (unsigned i = 2; i < 4; ++i) {
SDOperand Arg = N->getOperand(i);
@@ -1763,8 +1771,12 @@ bool X86::isMOVSLDUPMask(SDNode *N) {
assert(isa<ConstantSDNode>(Arg) && "Invalid VECTOR_SHUFFLE mask!");
unsigned Val = cast<ConstantSDNode>(Arg)->getValue();
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