summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2014-07-23 20:41:38 +0000
committerJim Grosbach <grosbach@apple.com>2014-07-23 20:41:38 +0000
commit8f6f0858ec4db02dd115fc52b0c04d4c68cb9434 (patch)
treedd64c94b92182ddee64b8c5406f6aaf306a57efe /llvm/lib
parent19dd3088c088ecd1bddfcaab46a95d8ac21accc2 (diff)
downloadbcm5719-llvm-8f6f0858ec4db02dd115fc52b0c04d4c68cb9434.tar.gz
bcm5719-llvm-8f6f0858ec4db02dd115fc52b0c04d4c68cb9434.zip
X86: restrict combine to when type sizes are safe.
The folding of unary operations through a vector compare and mask operation is only safe if the unary operation result is of the same size as its input. For example, it's not safe for [su]itofp from v4i32 to v4f64. llvm-svn: 213799
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64ISelLowering.cpp8
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp8
2 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index ac4f206c41d..9b8ff72dded 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -6492,11 +6492,13 @@ static SDValue performVectorCompareAndMaskUnaryOpCombine(SDNode *N,
// AND(VECTOR_CMP(x,y), constant2)
// constant2 = UNARYOP(constant)
- // Early exit if this isn't a vector operation or if the operand of the
- // unary operation isn't a bitwise AND.
+ // Early exit if this isn't a vector operation, the operand of the
+ // unary operation isn't a bitwise AND, or if the sizes of the operations
+ // aren't the same.
EVT VT = N->getValueType(0);
if (!VT.isVector() || N->getOperand(0)->getOpcode() != ISD::AND ||
- N->getOperand(0)->getOperand(0)->getOpcode() != ISD::SETCC)
+ N->getOperand(0)->getOperand(0)->getOpcode() != ISD::SETCC ||
+ VT.getSizeInBits() != N->getOperand(0)->getValueType(0).getSizeInBits())
return SDValue();
// Now check that the other operand of the AND is a constant splat. We could
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index cba145208da..95666a47da8 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -21806,11 +21806,13 @@ static SDValue performVectorCompareAndMaskUnaryOpCombine(SDNode *N,
// AND(VECTOR_CMP(x,y), constant2)
// constant2 = UNARYOP(constant)
- // Early exit if this isn't a vector operation or if the operand of the
- // unary operation isn't a bitwise AND.
+ // Early exit if this isn't a vector operation, the operand of the
+ // unary operation isn't a bitwise AND, or if the sizes of the operations
+ // aren't the same.
EVT VT = N->getValueType(0);
if (!VT.isVector() || N->getOperand(0)->getOpcode() != ISD::AND ||
- N->getOperand(0)->getOperand(0)->getOpcode() != ISD::SETCC)
+ N->getOperand(0)->getOperand(0)->getOpcode() != ISD::SETCC ||
+ VT.getSizeInBits() != N->getOperand(0)->getValueType(0).getSizeInBits())
return SDValue();
// Now check that the other operand of the AND is a constant splat. We could
OpenPOWER on IntegriCloud