Commit 10b38df2 authored by danno's avatar danno Committed by Commit bot

[turbofan]: Fix x64 regression during ia32 lea port

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

Cr-Commit-Position: refs/heads/master@{#25807}
parent a32291fa
...@@ -39,10 +39,9 @@ struct NodeMatcher { ...@@ -39,10 +39,9 @@ struct NodeMatcher {
// A pattern matcher for abitrary value constants. // A pattern matcher for abitrary value constants.
template <typename T, IrOpcode::Value kMatchOpcode> template <typename T, IrOpcode::Value kOpcode>
struct ValueMatcher : public NodeMatcher { struct ValueMatcher : public NodeMatcher {
typedef T ValueType; typedef T ValueType;
static const IrOpcode::Value kOpcode = kMatchOpcode;
explicit ValueMatcher(Node* node) explicit ValueMatcher(Node* node)
: NodeMatcher(node), value_(), has_value_(opcode() == kOpcode) { : NodeMatcher(node), value_(), has_value_(opcode() == kOpcode) {
...@@ -71,6 +70,33 @@ struct ValueMatcher : public NodeMatcher { ...@@ -71,6 +70,33 @@ struct ValueMatcher : public NodeMatcher {
}; };
template <>
inline ValueMatcher<int64_t, IrOpcode::kInt64Constant>::ValueMatcher(Node* node)
: NodeMatcher(node), value_(), has_value_(false) {
if (opcode() == IrOpcode::kInt32Constant) {
value_ = OpParameter<int32_t>(node);
has_value_ = true;
} else if (opcode() == IrOpcode::kInt64Constant) {
value_ = OpParameter<int64_t>(node);
has_value_ = true;
}
}
template <>
inline ValueMatcher<uint64_t, IrOpcode::kInt64Constant>::ValueMatcher(
Node* node)
: NodeMatcher(node), value_(), has_value_(false) {
if (opcode() == IrOpcode::kInt32Constant) {
value_ = OpParameter<uint32_t>(node);
has_value_ = true;
} else if (opcode() == IrOpcode::kInt64Constant) {
value_ = OpParameter<uint64_t>(node);
has_value_ = true;
}
}
// A pattern matcher for integer constants. // A pattern matcher for integer constants.
template <typename T, IrOpcode::Value kOpcode> template <typename T, IrOpcode::Value kOpcode>
struct IntMatcher FINAL : public ValueMatcher<T, kOpcode> { struct IntMatcher FINAL : public ValueMatcher<T, kOpcode> {
......
...@@ -390,6 +390,9 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ...@@ -390,6 +390,9 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) {
const Operator* d15_op = common()->Int64Constant(15); const Operator* d15_op = common()->Int64Constant(15);
Node* d15 = graph()->NewNode(d15_op); Node* d15 = graph()->NewNode(d15_op);
USE(d15); USE(d15);
const Operator* d15_32_op = common()->Int32Constant(15);
Node* d15_32 = graph()->NewNode(d15_32_op);
USE(d15_32);
const Operator* b0_op = common()->Parameter(0); const Operator* b0_op = common()->Parameter(0);
Node* b0 = graph()->NewNode(b0_op, graph()->start()); Node* b0 = graph()->NewNode(b0_op, graph()->start());
...@@ -451,6 +454,10 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) { ...@@ -451,6 +454,10 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) {
BaseWithIndexAndDisplacement64Matcher match2(graph()->NewNode(a_op, b0, d15)); BaseWithIndexAndDisplacement64Matcher match2(graph()->NewNode(a_op, b0, d15));
CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15); CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15);
BaseWithIndexAndDisplacement64Matcher match2_32(
graph()->NewNode(a_op, b0, d15_32));
CheckBaseWithIndexAndDisplacement(&match2_32, NULL, 0, b0, d15_32);
// (D15 + B0) -> [NULL, 0, B0, D15] // (D15 + B0) -> [NULL, 0, B0, D15]
BaseWithIndexAndDisplacement64Matcher match3(graph()->NewNode(a_op, d15, b0)); BaseWithIndexAndDisplacement64Matcher match3(graph()->NewNode(a_op, d15, b0));
CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15); CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment