summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2013-03-28 23:38:52 +0000
committerMichael Liao <michael.liao@intel.com>2013-03-28 23:38:52 +0000
commit5fff5c7b2679da199bd566cd80c5d058c7fc3d86 (patch)
tree74d2353ead4c29fcbbdb4837f0301fe06d88c012 /llvm/lib
parent4b04e66c4fd8e3b0ef37de17d7af0beb959ff349 (diff)
downloadbcm5719-llvm-5fff5c7b2679da199bd566cd80c5d058c7fc3d86.tar.gz
bcm5719-llvm-5fff5c7b2679da199bd566cd80c5d058c7fc3d86.zip
Enhance boolean simplification to handle 16-/64-bit RDRAND
- RDRAND always clears the destination value when a random value is not available (i.e. CF == 0). This value is truncated or zero-extended as the false boolean value to be returned. Boolean simplification needs to skip this 'zext' or 'trunc' node. llvm-svn: 178312
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 709e9e8aaee..e0f87c03b7c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -15821,8 +15821,9 @@ static SDValue checkBoolTestSetCCCombine(SDValue Cmp, X86::CondCode &CC) {
// Quit if the constant is neither 0 or 1.
return SDValue();
- // Skip 'zext' node.
- if (SetCC.getOpcode() == ISD::ZERO_EXTEND)
+ // Skip 'zext' or 'trunc' node.
+ if (SetCC.getOpcode() == ISD::ZERO_EXTEND ||
+ SetCC.getOpcode() == ISD::TRUNCATE)
SetCC = SetCC.getOperand(0);
switch (SetCC.getOpcode()) {
@@ -15841,9 +15842,13 @@ static SDValue checkBoolTestSetCCCombine(SDValue Cmp, X86::CondCode &CC) {
return SDValue();
// Quit if false value is not a constant.
if (!FVal) {
- // A special case for rdrand, where 0 is set if false cond is found.
SDValue Op = SetCC.getOperand(0);
- if (Op.getOpcode() != X86ISD::RDRAND)
+ // Skip 'zext' or 'trunc' node.
+ if (Op.getOpcode() == ISD::ZERO_EXTEND ||
+ Op.getOpcode() == ISD::TRUNCATE)
+ Op = Op.getOperand(0);
+ // A special case for rdrand, where 0 is set if false cond is found.
+ if (Op.getOpcode() != X86ISD::RDRAND || Op.getResNo() != 0)
return SDValue();
}
// Quit if false value is not the constant 0 or 1.
OpenPOWER on IntegriCloud