Add support for uint64 compares to TurboFan.

R=bmeurer@chromium.org, titzer@chromium.org
TEST=compiler-unittests/MachineOperatorTest

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24348 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 67383fe7
...@@ -572,6 +572,8 @@ void InstructionSelector::VisitNode(Node* node) { ...@@ -572,6 +572,8 @@ void InstructionSelector::VisitNode(Node* node) {
return VisitInt64LessThan(node); return VisitInt64LessThan(node);
case IrOpcode::kInt64LessThanOrEqual: case IrOpcode::kInt64LessThanOrEqual:
return VisitInt64LessThanOrEqual(node); return VisitInt64LessThanOrEqual(node);
case IrOpcode::kUint64LessThan:
return VisitUint64LessThan(node);
case IrOpcode::kChangeFloat32ToFloat64: case IrOpcode::kChangeFloat32ToFloat64:
return MarkAsDouble(node), VisitChangeFloat32ToFloat64(node); return MarkAsDouble(node), VisitChangeFloat32ToFloat64(node);
case IrOpcode::kChangeInt32ToFloat64: case IrOpcode::kChangeInt32ToFloat64:
...@@ -695,6 +697,12 @@ void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) { ...@@ -695,6 +697,12 @@ void InstructionSelector::VisitInt64LessThanOrEqual(Node* node) {
} }
void InstructionSelector::VisitUint64LessThan(Node* node) {
FlagsContinuation cont(kUnsignedLessThan, node);
VisitWord64Compare(node, &cont);
}
void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
OperandGenerator g(this); OperandGenerator g(this);
Emit(kArchTruncateDoubleToI, g.DefineAsRegister(node), Emit(kArchTruncateDoubleToI, g.DefineAsRegister(node),
...@@ -929,6 +937,9 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, ...@@ -929,6 +937,9 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
case IrOpcode::kInt64LessThanOrEqual: case IrOpcode::kInt64LessThanOrEqual:
cont.OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); cont.OverwriteAndNegateIfEqual(kSignedLessThanOrEqual);
return VisitWord64Compare(value, &cont); return VisitWord64Compare(value, &cont);
case IrOpcode::kUint64LessThan:
cont.OverwriteAndNegateIfEqual(kUnsignedLessThan);
return VisitWord64Compare(value, &cont);
case IrOpcode::kFloat64Equal: case IrOpcode::kFloat64Equal:
cont.OverwriteAndNegateIfEqual(kUnorderedEqual); cont.OverwriteAndNegateIfEqual(kUnorderedEqual);
return VisitFloat64Compare(value, &cont); return VisitFloat64Compare(value, &cont);
......
...@@ -173,34 +173,35 @@ const PureOperator kPureOperators[] = { ...@@ -173,34 +173,35 @@ const PureOperator kPureOperators[] = {
&MachineOperatorBuilder::Name, IrOpcode::k##Name, input_count, \ &MachineOperatorBuilder::Name, IrOpcode::k##Name, input_count, \
output_count \ output_count \
} }
PURE(Word32And, 2, 1), PURE(Word32Or, 2, 1), PURE(Word32And, 2, 1), PURE(Word32Or, 2, 1),
PURE(Word32Xor, 2, 1), PURE(Word32Shl, 2, 1), PURE(Word32Xor, 2, 1), PURE(Word32Shl, 2, 1),
PURE(Word32Shr, 2, 1), PURE(Word32Sar, 2, 1), PURE(Word32Shr, 2, 1), PURE(Word32Sar, 2, 1),
PURE(Word32Ror, 2, 1), PURE(Word32Equal, 2, 1), PURE(Word32Ror, 2, 1), PURE(Word32Equal, 2, 1),
PURE(Word64And, 2, 1), PURE(Word64Or, 2, 1), PURE(Word64And, 2, 1), PURE(Word64Or, 2, 1),
PURE(Word64Xor, 2, 1), PURE(Word64Shl, 2, 1), PURE(Word64Xor, 2, 1), PURE(Word64Shl, 2, 1),
PURE(Word64Shr, 2, 1), PURE(Word64Sar, 2, 1), PURE(Word64Shr, 2, 1), PURE(Word64Sar, 2, 1),
PURE(Word64Ror, 2, 1), PURE(Word64Equal, 2, 1), PURE(Word64Ror, 2, 1), PURE(Word64Equal, 2, 1),
PURE(Int32Add, 2, 1), PURE(Int32AddWithOverflow, 2, 2), PURE(Int32Add, 2, 1), PURE(Int32AddWithOverflow, 2, 2),
PURE(Int32Sub, 2, 1), PURE(Int32SubWithOverflow, 2, 2), PURE(Int32Sub, 2, 1), PURE(Int32SubWithOverflow, 2, 2),
PURE(Int32Mul, 2, 1), PURE(Int32Div, 2, 1), PURE(Int32Mul, 2, 1), PURE(Int32Div, 2, 1),
PURE(Int32UDiv, 2, 1), PURE(Int32Mod, 2, 1), PURE(Int32UDiv, 2, 1), PURE(Int32Mod, 2, 1),
PURE(Int32UMod, 2, 1), PURE(Int32LessThan, 2, 1), PURE(Int32UMod, 2, 1), PURE(Int32LessThan, 2, 1),
PURE(Int32LessThanOrEqual, 2, 1), PURE(Uint32LessThan, 2, 1), PURE(Int32LessThanOrEqual, 2, 1), PURE(Uint32LessThan, 2, 1),
PURE(Uint32LessThanOrEqual, 2, 1), PURE(Int64Add, 2, 1), PURE(Uint32LessThanOrEqual, 2, 1), PURE(Int64Add, 2, 1),
PURE(Int64Sub, 2, 1), PURE(Int64Mul, 2, 1), PURE(Int64Sub, 2, 1), PURE(Int64Mul, 2, 1),
PURE(Int64Div, 2, 1), PURE(Int64UDiv, 2, 1), PURE(Int64Div, 2, 1), PURE(Int64UDiv, 2, 1),
PURE(Int64Mod, 2, 1), PURE(Int64UMod, 2, 1), PURE(Int64Mod, 2, 1), PURE(Int64UMod, 2, 1),
PURE(Int64LessThan, 2, 1), PURE(Int64LessThanOrEqual, 2, 1), PURE(Int64LessThan, 2, 1), PURE(Int64LessThanOrEqual, 2, 1),
PURE(ChangeFloat32ToFloat64, 1, 1), PURE(ChangeFloat64ToInt32, 1, 1), PURE(Uint64LessThan, 2, 1), PURE(ChangeFloat32ToFloat64, 1, 1),
PURE(ChangeFloat64ToUint32, 1, 1), PURE(ChangeInt32ToInt64, 1, 1), PURE(ChangeFloat64ToInt32, 1, 1), PURE(ChangeFloat64ToUint32, 1, 1),
PURE(ChangeUint32ToFloat64, 1, 1), PURE(ChangeUint32ToUint64, 1, 1), PURE(ChangeInt32ToInt64, 1, 1), PURE(ChangeUint32ToFloat64, 1, 1),
PURE(TruncateFloat64ToFloat32, 1, 1), PURE(TruncateFloat64ToInt32, 1, 1), PURE(ChangeUint32ToUint64, 1, 1), PURE(TruncateFloat64ToFloat32, 1, 1),
PURE(TruncateInt64ToInt32, 1, 1), PURE(Float64Add, 2, 1), PURE(TruncateFloat64ToInt32, 1, 1), PURE(TruncateInt64ToInt32, 1, 1),
PURE(Float64Sub, 2, 1), PURE(Float64Mul, 2, 1), PURE(Float64Add, 2, 1), PURE(Float64Sub, 2, 1),
PURE(Float64Div, 2, 1), PURE(Float64Mod, 2, 1), PURE(Float64Mul, 2, 1), PURE(Float64Div, 2, 1),
PURE(Float64Sqrt, 1, 1), PURE(Float64Equal, 2, 1), PURE(Float64Mod, 2, 1), PURE(Float64Sqrt, 1, 1),
PURE(Float64LessThan, 2, 1), PURE(Float64LessThanOrEqual, 2, 1) PURE(Float64Equal, 2, 1), PURE(Float64LessThan, 2, 1),
PURE(Float64LessThanOrEqual, 2, 1)
#undef PURE #undef PURE
}; };
......
...@@ -100,6 +100,7 @@ struct StaticParameterTraits<LoadRepresentation> { ...@@ -100,6 +100,7 @@ struct StaticParameterTraits<LoadRepresentation> {
V(Int64UMod, Operator::kNoProperties, 2, 1) \ V(Int64UMod, Operator::kNoProperties, 2, 1) \
V(Int64LessThan, Operator::kNoProperties, 2, 1) \ V(Int64LessThan, Operator::kNoProperties, 2, 1) \
V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 1) \ V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 1) \
V(Uint64LessThan, Operator::kNoProperties, 2, 1) \
V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 1) \ V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 1) \
V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 1) \ V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 1) \
V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 1) \ V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 1) \
......
...@@ -104,6 +104,7 @@ class MachineOperatorBuilder FINAL { ...@@ -104,6 +104,7 @@ class MachineOperatorBuilder FINAL {
const Operator* Int64UMod(); const Operator* Int64UMod();
const Operator* Int64LessThan(); const Operator* Int64LessThan();
const Operator* Int64LessThanOrEqual(); const Operator* Int64LessThanOrEqual();
const Operator* Uint64LessThan();
// These operators change the representation of numbers while preserving the // These operators change the representation of numbers while preserving the
// value of the number. Narrowing operators assume the input is representable // value of the number. Narrowing operators assume the input is representable
...@@ -167,7 +168,8 @@ class MachineOperatorBuilder FINAL { ...@@ -167,7 +168,8 @@ class MachineOperatorBuilder FINAL {
V(Int, Mod) \ V(Int, Mod) \
V(Int, UMod) \ V(Int, UMod) \
V(Int, LessThan) \ V(Int, LessThan) \
V(Int, LessThanOrEqual) V(Int, LessThanOrEqual) \
V(Uint, LessThan)
#define PSEUDO_OP(Prefix, Suffix) \ #define PSEUDO_OP(Prefix, Suffix) \
const Operator* Prefix##Suffix() { \ const Operator* Prefix##Suffix() { \
return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \ return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \
......
...@@ -203,6 +203,7 @@ ...@@ -203,6 +203,7 @@
V(Int64UMod) \ V(Int64UMod) \
V(Int64LessThan) \ V(Int64LessThan) \
V(Int64LessThanOrEqual) \ V(Int64LessThanOrEqual) \
V(Uint64LessThan) \
V(ChangeFloat32ToFloat64) \ V(ChangeFloat32ToFloat64) \
V(ChangeFloat64ToInt32) \ V(ChangeFloat64ToInt32) \
V(ChangeFloat64ToUint32) \ V(ChangeFloat64ToUint32) \
......
...@@ -673,6 +673,9 @@ class RepresentationSelector { ...@@ -673,6 +673,9 @@ class RepresentationSelector {
case IrOpcode::kInt64LessThanOrEqual: case IrOpcode::kInt64LessThanOrEqual:
return VisitInt64Cmp(node); return VisitInt64Cmp(node);
case IrOpcode::kUint64LessThan:
return VisitUint64Cmp(node);
case IrOpcode::kInt64UDiv: case IrOpcode::kInt64UDiv:
case IrOpcode::kInt64UMod: case IrOpcode::kInt64UMod:
return VisitUint64Binop(node); return VisitUint64Binop(node);
......
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