Add support for uint64 compares to TurboFan.
authormstarzinger@chromium.org <mstarzinger@chromium.org>
Wed, 1 Oct 2014 08:11:56 +0000 (08:11 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org>
Wed, 1 Oct 2014 08:11:56 +0000 (08:11 +0000)
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

src/compiler/instruction-selector.cc
src/compiler/machine-operator-unittest.cc
src/compiler/machine-operator.cc
src/compiler/machine-operator.h
src/compiler/opcodes.h
src/compiler/simplified-lowering.cc

index e3e883d..d3934b3 100644 (file)
@@ -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 b42214c..176b78a 100644 (file)
@@ -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 e00ab42..01e525c 100644 (file)
@@ -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 37faa8d..c6d090f 100644 (file)
@@ -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 80d772d..443ebae 100644 (file)
   V(Int64UMod)                \
   V(Int64LessThan)            \
   V(Int64LessThanOrEqual)     \
+  V(Uint64LessThan)           \
   V(ChangeFloat32ToFloat64)   \
   V(ChangeFloat64ToInt32)     \
   V(ChangeFloat64ToUint32)    \
index 8a34562..f388fb3 100644 (file)
@@ -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);