[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Apr 25 14:03:42 PDT 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.92 -> 1.93
---
Log message:
Codegen x < 0 | y < 0 as (x|y) < 0. This allows us to compile this to:
_foo:
or r2, r4, r3
srwi r3, r2, 31
blr
instead of:
_foo:
srwi r2, r4, 31
srwi r3, r3, 31
or r3, r2, r3
blr
---
Diffs of the changes: (+4 -1)
SelectionDAG.cpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.92 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.93
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.92 Thu Apr 21 23:01:18 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Apr 25 16:03:25 2005
@@ -809,6 +809,7 @@
return MaskedValueIsZero(Op.getOperand(0), NewVal, TLI);
}
return false;
+ // TODO we could handle some SRA cases here.
default: break;
}
@@ -1061,11 +1062,13 @@
// (X != 0) | (Y != 0) -> (X|Y != 0)
// (X == 0) & (Y == 0) -> (X|Y == 0)
+ // (X < 0) | (Y < 0) -> (X|Y < 0)
if (LR == RR && isa<ConstantSDNode>(LR) &&
cast<ConstantSDNode>(LR)->getValue() == 0 &&
Op2 == LHS->getCondition() && MVT::isInteger(LL.getValueType())) {
if ((Op2 == ISD::SETEQ && Opcode == ISD::AND) ||
- (Op2 == ISD::SETNE && Opcode == ISD::OR))
+ (Op2 == ISD::SETNE && Opcode == ISD::OR) ||
+ (Op2 == ISD::SETLT && Opcode == ISD::OR))
return getSetCC(Op2, VT,
getNode(ISD::OR, LR.getValueType(), LL, RL), LR);
}
More information about the llvm-commits
mailing list