Revert of [arm] Fix recognition of VNEG. (patchset #3 id:40001 of https://codereview.chromium.org/762493006/)

Reason for revert:
Breaks arm compilation.

Original issue's description:
> [arm] Fix recognition of VNEG.
>
> TEST=mjsunit,unittests
> R=svenpanne@chromium.org
>
> Committed: 2aed882fe7

TBR=svenpanne@chromium.org,bmeurer@chromium.org
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/751653004

Cr-Commit-Position: refs/heads/master@{#25514}
This commit is contained in:
machenbach 2014-11-26 03:07:08 -08:00 committed by Commit bot
parent 2aed882fe7
commit 86f6123ade
4 changed files with 13 additions and 41 deletions

View File

@ -854,16 +854,16 @@ void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
void InstructionSelector::VisitFloat64Add(Node* node) {
ArmOperandGenerator g(this);
Float64BinopMatcher m(node);
Int32BinopMatcher m(node);
if (m.left().IsFloat64Mul() && CanCover(node, m.left().node())) {
Float64BinopMatcher mleft(m.left().node());
Int32BinopMatcher mleft(m.left().node());
Emit(kArmVmlaF64, g.DefineSameAsFirst(node),
g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()),
g.UseRegister(mleft.right().node()));
return;
}
if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) {
Float64BinopMatcher mright(m.right().node());
Int32BinopMatcher mright(m.right().node());
Emit(kArmVmlaF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()),
g.UseRegister(mright.left().node()),
g.UseRegister(mright.right().node()));
@ -875,14 +875,9 @@ void InstructionSelector::VisitFloat64Add(Node* node) {
void InstructionSelector::VisitFloat64Sub(Node* node) {
ArmOperandGenerator g(this);
Float64BinopMatcher m(node);
if (m.left().IsMinusZero()) {
Emit(kArmVnegF64, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
Int32BinopMatcher m(node);
if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) {
Float64BinopMatcher mright(m.right().node());
Int32BinopMatcher mright(m.right().node());
Emit(kArmVmlsF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()),
g.UseRegister(mright.left().node()),
g.UseRegister(mright.right().node()));
@ -893,7 +888,13 @@ void InstructionSelector::VisitFloat64Sub(Node* node) {
void InstructionSelector::VisitFloat64Mul(Node* node) {
VisitRRRFloat64(this, kArmVmulF64, node);
ArmOperandGenerator g(this);
Float64BinopMatcher m(node);
if (m.right().Is(-1.0)) {
Emit(kArmVnegF64, g.DefineAsRegister(node), g.UseRegister(m.left().node()));
} else {
VisitRRRFloat64(this, kArmVmulF64, node);
}
}

View File

@ -5,8 +5,6 @@
#ifndef V8_COMPILER_NODE_MATCHERS_H_
#define V8_COMPILER_NODE_MATCHERS_H_
#include <cmath>
#include "src/compiler/generic-node.h"
#include "src/compiler/generic-node-inl.h"
#include "src/compiler/node.h"
@ -106,7 +104,6 @@ template <typename T, IrOpcode::Value kOpcode>
struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> {
explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
bool IsMinusZero() const { return this->Is(0.0) && signbit(this->Value()); }
bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); }
};
@ -170,7 +167,6 @@ typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher;
typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher;
typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher;
template <class BinopMatcher, IrOpcode::Value kAddOpcode,
IrOpcode::Value kMulOpcode, IrOpcode::Value kShiftOpcode>
struct AddMatcher : public BinopMatcher {

View File

@ -12,32 +12,22 @@ function Module(stdlib, foreign, heap) {
i = +i;
return +(-1 * i);
}
function f3(i) {
i = +i;
return +(-i);
}
return { f1: f1, f2: f2, f3: f3 };
return { f1: f1, f2: f2 };
}
var m = Module(this, {}, new ArrayBuffer(64 * 1024));
assertEquals(NaN, m.f1(NaN));
assertEquals(NaN, m.f2(NaN));
assertEquals(NaN, m.f3(NaN));
assertEquals(Infinity, 1 / m.f1(-0));
assertEquals(Infinity, 1 / m.f2(-0));
assertEquals(Infinity, 1 / m.f3(-0));
assertEquals(Infinity, m.f1(-Infinity));
assertEquals(Infinity, m.f2(-Infinity));
assertEquals(Infinity, m.f3(-Infinity));
assertEquals(-Infinity, 1 / m.f1(0));
assertEquals(-Infinity, 1 / m.f2(0));
assertEquals(-Infinity, 1 / m.f3(0));
assertEquals(-Infinity, m.f1(Infinity));
assertEquals(-Infinity, m.f2(Infinity));
assertEquals(-Infinity, m.f3(Infinity));
for (var i = -2147483648; i < 2147483648; i += 3999777) {
assertEquals(-i, m.f1(i));
assertEquals(-i, m.f2(i));
assertEquals(-i, m.f3(i));
}

View File

@ -1482,21 +1482,6 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
// Miscellaneous.
TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) {
StreamBuilder m(this, kMachFloat64, kMachFloat64);
Node* const p0 = m.Parameter(0);
Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmVnegF64, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Int32AddWithInt32Mul) {
{
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32, kMachInt32);