Reviewers: mtbrandyberry,
Message:
Catching up - next ppc port
Description:
PPC: Match -0 - x with sign bit flip.
Optimiation similar to what is done for x86
[email protected]
BUG=
Please review this at https://codereview.chromium.org/1072173002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+22, -10 lines):
M src/compiler/ppc/instruction-selector-ppc.cc
Index: src/compiler/ppc/instruction-selector-ppc.cc
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc
b/src/compiler/ppc/instruction-selector-ppc.cc
index
28a1649f8fc567c54c1c4753405a08dd655e0542..cf78cdea65da1b3715b259f46f72772edeb1b816
100644
--- a/src/compiler/ppc/instruction-selector-ppc.cc
+++ b/src/compiler/ppc/instruction-selector-ppc.cc
@@ -909,6 +909,13 @@ void InstructionSelector::VisitFloat64Add(Node* node) {
void InstructionSelector::VisitFloat32Sub(Node* node) {
+ PPCOperandGenerator g(this);
+ Float32BinopMatcher m(node);
+ if (m.left().IsMinusZero()) {
+ Emit(kPPC_NegDouble, g.DefineAsRegister(node),
+ g.UseRegister(m.right().node()));
+ return;
+ }
VisitRRR(this, kPPC_SubDouble, node);
}
@@ -917,18 +924,23 @@ void InstructionSelector::VisitFloat64Sub(Node* node)
{
// TODO(mbrandy): detect multiply-subtract
PPCOperandGenerator g(this);
Float64BinopMatcher m(node);
- if (m.left().IsMinusZero() && m.right().IsFloat64RoundDown() &&
- CanCover(m.node(), m.right().node())) {
- if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
- CanCover(m.right().node(), m.right().InputAt(0))) {
- Float64BinopMatcher mright0(m.right().InputAt(0));
- if (mright0.left().IsMinusZero()) {
- // -floor(-x) = ceil(x)
- Emit(kPPC_CeilDouble, g.DefineAsRegister(node),
- g.UseRegister(mright0.right().node()));
- return;
+ if (m.left().IsMinusZero()) {
+ if (m.right().IsFloat64RoundDown() &&
+ CanCover(m.node(), m.right().node())) {
+ if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
+ CanCover(m.right().node(), m.right().InputAt(0))) {
+ Float64BinopMatcher mright0(m.right().InputAt(0));
+ if (mright0.left().IsMinusZero()) {
+ // -floor(-x) = ceil(x)
+ Emit(kPPC_CeilDouble, g.DefineAsRegister(node),
+ g.UseRegister(mright0.right().node()));
+ return;
+ }
}
}
+ Emit(kPPC_NegDouble, g.DefineAsRegister(node),
+ g.UseRegister(m.right().node()));
+ return;
}
VisitRRR(this, kPPC_SubDouble, node);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.