diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-09-10 21:39:07 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-09-10 21:39:07 +0000 |
| commit | 58c227bd09be8cc29d0158320da8453ccbaa7de1 (patch) | |
| tree | 8d8d105d104ecfd5411c362c18df2c34ff08265e /llvm/lib/CodeGen | |
| parent | 7a9935c31f128f19431ba54a535c76234eeeae4a (diff) | |
| download | bcm5719-llvm-58c227bd09be8cc29d0158320da8453ccbaa7de1.tar.gz bcm5719-llvm-58c227bd09be8cc29d0158320da8453ccbaa7de1.zip | |
Emit:
cmpl %eax, %ecx
setae %al
movzbl %al, %eax
instead of:
cmpl %eax, %ecx
setb %al
xorb $1, %al
movzbl %al, %eax
when using logical not of a C comparison.
llvm-svn: 41807
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index dae4e2102d6..32f81d38f26 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1941,6 +1941,16 @@ SDOperand DAGCombiner::visitXOR(SDNode *N) { assert(0 && "Unhandled SetCC Equivalent!"); abort(); } + // fold (not (zext (setcc x, y))) -> (zext (not (setcc x, y))) + if (N1C && N1C->getValue() == 1 && N0.getOpcode() == ISD::ZERO_EXTEND && + N0.Val->hasOneUse() && isSetCCEquivalent(N0.getOperand(0), LHS, RHS, CC)){ + SDOperand V = N0.getOperand(0); + V = DAG.getNode(ISD::XOR, V.getValueType(), V, + DAG.getConstant(V.getValueType(), 1)); + AddToWorkList(V.Val); + return DAG.getNode(ISD::ZERO_EXTEND, VT, V); + } + // fold !(x or y) -> (!x and !y) iff x or y are setcc if (N1C && N1C->getValue() == 1 && VT == MVT::i1 && (N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) { |

