Reviewers: titzer,

Description:
Add support for uint64 compares to TurboFan.

R=tit...@chromium.org
TEST=compiler-unittests/MachineOperatorTest

Please review this at https://codereview.chromium.org/615083002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+48, -29 lines):
  M src/compiler/instruction-selector.cc
  M src/compiler/machine-operator.h
  M src/compiler/machine-operator.cc
  M src/compiler/machine-operator-unittest.cc
  M src/compiler/opcodes.h
  M src/compiler/simplified-lowering.cc


Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index e3e883dc4b28f2cbeabe953c7d12d6dc19ff2108..d3934b349e528b3edce2fa84ee184446922348c1 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -572,6 +572,8 @@ void InstructionSelector::VisitNode(Node* node) {
       return VisitInt64LessThan(node);
     case IrOpcode::kInt64LessThanOrEqual:
       return VisitInt64LessThanOrEqual(node);
+    case IrOpcode::kUint64LessThan:
+      return VisitUint64LessThan(node);
     case IrOpcode::kChangeFloat32ToFloat64:
       return MarkAsDouble(node), VisitChangeFloat32ToFloat64(node);
     case IrOpcode::kChangeInt32ToFloat64:
@@ -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) {
   OperandGenerator g(this);
   Emit(kArchTruncateDoubleToI, g.DefineAsRegister(node),
@@ -929,6 +937,9 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
       case IrOpcode::kInt64LessThanOrEqual:
         cont.OverwriteAndNegateIfEqual(kSignedLessThanOrEqual);
         return VisitWord64Compare(value, &cont);
+      case IrOpcode::kUint64LessThan:
+        cont.OverwriteAndNegateIfEqual(kUnsignedLessThan);
+        return VisitWord64Compare(value, &cont);
       case IrOpcode::kFloat64Equal:
         cont.OverwriteAndNegateIfEqual(kUnorderedEqual);
         return VisitFloat64Compare(value, &cont);
Index: src/compiler/machine-operator-unittest.cc
diff --git a/src/compiler/machine-operator-unittest.cc b/src/compiler/machine-operator-unittest.cc index b42214c14705f85c636d435f71f131af4940678a..176b78ab626bd68e30bda3bd45b5640c1b378312 100644
--- a/src/compiler/machine-operator-unittest.cc
+++ b/src/compiler/machine-operator-unittest.cc
@@ -173,34 +173,35 @@ const PureOperator kPureOperators[] = {
     &MachineOperatorBuilder::Name, IrOpcode::k##Name, input_count, \
         output_count                                               \
   }
-    PURE(Word32And, 2, 1),                PURE(Word32Or, 2, 1),
-    PURE(Word32Xor, 2, 1),                PURE(Word32Shl, 2, 1),
-    PURE(Word32Shr, 2, 1),                PURE(Word32Sar, 2, 1),
-    PURE(Word32Ror, 2, 1),                PURE(Word32Equal, 2, 1),
-    PURE(Word64And, 2, 1),                PURE(Word64Or, 2, 1),
-    PURE(Word64Xor, 2, 1),                PURE(Word64Shl, 2, 1),
-    PURE(Word64Shr, 2, 1),                PURE(Word64Sar, 2, 1),
-    PURE(Word64Ror, 2, 1),                PURE(Word64Equal, 2, 1),
-    PURE(Int32Add, 2, 1),                 PURE(Int32AddWithOverflow, 2, 2),
-    PURE(Int32Sub, 2, 1),                 PURE(Int32SubWithOverflow, 2, 2),
-    PURE(Int32Mul, 2, 1),                 PURE(Int32Div, 2, 1),
-    PURE(Int32UDiv, 2, 1),                PURE(Int32Mod, 2, 1),
-    PURE(Int32UMod, 2, 1),                PURE(Int32LessThan, 2, 1),
-    PURE(Int32LessThanOrEqual, 2, 1),     PURE(Uint32LessThan, 2, 1),
-    PURE(Uint32LessThanOrEqual, 2, 1),    PURE(Int64Add, 2, 1),
-    PURE(Int64Sub, 2, 1),                 PURE(Int64Mul, 2, 1),
-    PURE(Int64Div, 2, 1),                 PURE(Int64UDiv, 2, 1),
-    PURE(Int64Mod, 2, 1),                 PURE(Int64UMod, 2, 1),
-    PURE(Int64LessThan, 2, 1),            PURE(Int64LessThanOrEqual, 2, 1),
-    PURE(ChangeFloat32ToFloat64, 1, 1),   PURE(ChangeFloat64ToInt32, 1, 1),
-    PURE(ChangeFloat64ToUint32, 1, 1),    PURE(ChangeInt32ToInt64, 1, 1),
-    PURE(ChangeUint32ToFloat64, 1, 1),    PURE(ChangeUint32ToUint64, 1, 1),
- PURE(TruncateFloat64ToFloat32, 1, 1), PURE(TruncateFloat64ToInt32, 1, 1),
-    PURE(TruncateInt64ToInt32, 1, 1),     PURE(Float64Add, 2, 1),
-    PURE(Float64Sub, 2, 1),               PURE(Float64Mul, 2, 1),
-    PURE(Float64Div, 2, 1),               PURE(Float64Mod, 2, 1),
-    PURE(Float64Sqrt, 1, 1),              PURE(Float64Equal, 2, 1),
- PURE(Float64LessThan, 2, 1), PURE(Float64LessThanOrEqual, 2, 1)
+    PURE(Word32And, 2, 1),              PURE(Word32Or, 2, 1),
+    PURE(Word32Xor, 2, 1),              PURE(Word32Shl, 2, 1),
+    PURE(Word32Shr, 2, 1),              PURE(Word32Sar, 2, 1),
+    PURE(Word32Ror, 2, 1),              PURE(Word32Equal, 2, 1),
+    PURE(Word64And, 2, 1),              PURE(Word64Or, 2, 1),
+    PURE(Word64Xor, 2, 1),              PURE(Word64Shl, 2, 1),
+    PURE(Word64Shr, 2, 1),              PURE(Word64Sar, 2, 1),
+    PURE(Word64Ror, 2, 1),              PURE(Word64Equal, 2, 1),
+    PURE(Int32Add, 2, 1),               PURE(Int32AddWithOverflow, 2, 2),
+    PURE(Int32Sub, 2, 1),               PURE(Int32SubWithOverflow, 2, 2),
+    PURE(Int32Mul, 2, 1),               PURE(Int32Div, 2, 1),
+    PURE(Int32UDiv, 2, 1),              PURE(Int32Mod, 2, 1),
+    PURE(Int32UMod, 2, 1),              PURE(Int32LessThan, 2, 1),
+    PURE(Int32LessThanOrEqual, 2, 1),   PURE(Uint32LessThan, 2, 1),
+    PURE(Uint32LessThanOrEqual, 2, 1),  PURE(Int64Add, 2, 1),
+    PURE(Int64Sub, 2, 1),               PURE(Int64Mul, 2, 1),
+    PURE(Int64Div, 2, 1),               PURE(Int64UDiv, 2, 1),
+    PURE(Int64Mod, 2, 1),               PURE(Int64UMod, 2, 1),
+    PURE(Int64LessThan, 2, 1),          PURE(Int64LessThanOrEqual, 2, 1),
+    PURE(Uint64LessThan, 2, 1),         PURE(ChangeFloat32ToFloat64, 1, 1),
+    PURE(ChangeFloat64ToInt32, 1, 1),   PURE(ChangeFloat64ToUint32, 1, 1),
+    PURE(ChangeInt32ToInt64, 1, 1),     PURE(ChangeUint32ToFloat64, 1, 1),
+ PURE(ChangeUint32ToUint64, 1, 1), PURE(TruncateFloat64ToFloat32, 1, 1),
+    PURE(TruncateFloat64ToInt32, 1, 1), PURE(TruncateInt64ToInt32, 1, 1),
+    PURE(Float64Add, 2, 1),             PURE(Float64Sub, 2, 1),
+    PURE(Float64Mul, 2, 1),             PURE(Float64Div, 2, 1),
+    PURE(Float64Mod, 2, 1),             PURE(Float64Sqrt, 1, 1),
+    PURE(Float64Equal, 2, 1),           PURE(Float64LessThan, 2, 1),
+    PURE(Float64LessThanOrEqual, 2, 1)
 #undef PURE
 };

Index: src/compiler/machine-operator.cc
diff --git a/src/compiler/machine-operator.cc b/src/compiler/machine-operator.cc index e00ab428de32f78e8d25a3d78db7854bda9679c5..01e525c043d62ccee605122bc069a3f60f8f8e35 100644
--- a/src/compiler/machine-operator.cc
+++ b/src/compiler/machine-operator.cc
@@ -100,6 +100,7 @@ struct StaticParameterTraits<LoadRepresentation> {
V(Int64UMod, Operator::kNoProperties, 2, 1) \ V(Int64LessThan, Operator::kNoProperties, 2, 1) \ V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 1) \ + V(Uint64LessThan, Operator::kNoProperties, 2, 1) \ V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 1) \ V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 1) \ V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 1) \
Index: src/compiler/machine-operator.h
diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h index 37faa8d206a7dfd031fb4a1c63938d81dec159fe..c6d090f91533326466e6cabf3c2251acb767e2ae 100644
--- a/src/compiler/machine-operator.h
+++ b/src/compiler/machine-operator.h
@@ -104,6 +104,7 @@ class MachineOperatorBuilder FINAL {
   const Operator* Int64UMod();
   const Operator* Int64LessThan();
   const Operator* Int64LessThanOrEqual();
+  const Operator* Uint64LessThan();

// These operators change the representation of numbers while preserving the // value of the number. Narrowing operators assume the input is representable
@@ -167,7 +168,8 @@ class MachineOperatorBuilder FINAL {
   V(Int, Mod)             \
   V(Int, UMod)            \
   V(Int, LessThan)        \
-  V(Int, LessThanOrEqual)
+  V(Int, LessThanOrEqual) \
+  V(Uint, LessThan)
 #define PSEUDO_OP(Prefix, Suffix)                                \
   const Operator* Prefix##Suffix() {                             \
     return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \
Index: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
index 80d772d0a5e8ccc595e1b4192fce194d91d516ff..443ebaec81ee86475392e4ef99ecfee3d6ba8d17 100644
--- a/src/compiler/opcodes.h
+++ b/src/compiler/opcodes.h
@@ -203,6 +203,7 @@
   V(Int64UMod)                \
   V(Int64LessThan)            \
   V(Int64LessThanOrEqual)     \
+  V(Uint64LessThan)           \
   V(ChangeFloat32ToFloat64)   \
   V(ChangeFloat64ToInt32)     \
   V(ChangeFloat64ToUint32)    \
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 7ab20f5d24e346f7026205fa6288b8ddaf942545..b0a168bb0bf55a4defc44728c1630b5c40847676 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -673,6 +673,9 @@ class RepresentationSelector {
       case IrOpcode::kInt64LessThanOrEqual:
         return VisitInt64Cmp(node);

+      case IrOpcode::kUint64LessThan:
+        return VisitUint64Cmp(node);
+
       case IrOpcode::kInt64UDiv:
       case IrOpcode::kInt64UMod:
         return VisitUint64Binop(node);


--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to