chromium/v8/test/cctest/compiler/test-run-machops.cc

// Copyright 2014 the V8 project authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.

#include <cmath>
#include <functional>
#include <limits>

#include "src/base/bits.h"
#include "src/base/ieee754.h"
#include "src/base/overflowing-math.h"
#include "src/base/safe_conversions.h"
#include "src/base/utils/random-number-generator.h"
#include "src/builtins/builtins.h"
#include "src/common/ptr-compr-inl.h"
#include "src/objects/objects-inl.h"
#include "src/utils/boxed-float.h"
#include "src/utils/utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
#include "test/common/flag-utils.h"
#include "test/common/value-helper.h"

namespace v8 {
namespace internal {
namespace compiler {


TEST(RunInt32Add) {}

static int RunInt32AddShift(bool is_left, int32_t add_left, int32_t add_right,
                            int32_t shift_left, int32_t shift_right) {}

TEST(RunInt32AddShift) {}

TEST(RunWord32ReverseBits) {}

TEST(RunWord32ReverseBytes) {}

TEST(RunWord32Ctz) {}

TEST(RunWord32Clz) {}


TEST(RunWord32Popcnt) {}


#if V8_TARGET_ARCH_64_BIT
TEST(RunWord64ReverseBits) {}

TEST(RunWord64ReverseBytes) {}

TEST(RunWord64Clz) {}


TEST(RunWord64Ctz) {}


TEST(RunWord64Popcnt) {}

#endif  // V8_TARGET_ARCH_64_BIT

TEST(RunWord32Select) {}

TEST(RunWord64Select) {}

TEST(RunSelectUnorderedEqual) {}

TEST(RunSelectUnorderedNotEqual) {}

namespace {
template <typename T>
ExternalReference ExternalRefFromFunc(RawMachineAssemblerTester<T>* m,
                                      Address func_address) {}
}  // namespace

namespace {
void FooForSelect() {}
}  // namespace

TEST(RunWord32SelectWithMemoryInput) {}

TEST(RunWord64SelectWithMemoryInput) {}

TEST(RunFloat32SelectRegFloatCompare) {}

TEST(RunFloat64SelectRegFloatCompare) {}

TEST(RunFloat32SelectImmediateOnLeftFloatCompare) {}

TEST(RunFloat64SelectImmediateOnRightFloatCompare) {}

TEST(RunFloat32SelectImmediateIntCompare) {}

TEST(RunFloat64SelectImmediateIntCompare) {}

static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) {}


TEST(CodeGenInt32Binop) {}


TEST(CodeGenNop) {}


#if V8_TARGET_ARCH_64_BIT
static Node* Int64Input(RawMachineAssemblerTester<int64_t>* m, int index) {}


TEST(CodeGenInt64Binop) {}


TEST(RunInt64AddWithOverflowP) {}


TEST(RunInt64AddWithOverflowImm) {}


TEST(RunInt64AddWithOverflowInBranchP) {}


TEST(RunInt64SubWithOverflowP) {}


TEST(RunInt64SubWithOverflowImm) {}


TEST(RunInt64SubWithOverflowInBranchP) {}

TEST(RunInt64MulWithOverflowImm) {}

TEST(RunInt64MulWithOverflowInBranchP) {}

static int64_t RunInt64AddShift(bool is_left, int64_t add_left,
                                int64_t add_right, int64_t shift_left,
                                int64_t shift_right) {}

TEST(RunInt64AddShift) {}

// TODO(titzer): add tests that run 64-bit integer operations.
#endif  // V8_TARGET_ARCH_64_BIT


TEST(RunGoto) {}


TEST(RunGotoMultiple) {}


TEST(RunBranch) {}


TEST(RunDiamond2) {}


TEST(RunLoop) {}


template <typename R>
static void BuildDiamondPhi(RawMachineAssemblerTester<R>* m, Node* cond_node,
                            MachineRepresentation rep, Node* true_node,
                            Node* false_node) {}


TEST(RunDiamondPhiConst) {}


TEST(RunDiamondPhiNumber) {}


TEST(RunDiamondPhiString) {}


TEST(RunDiamondPhiParam) {}


TEST(RunLoopPhiConst) {}


TEST(RunLoopPhiParam) {}


TEST(RunLoopPhiInduction) {}


TEST(RunLoopIncrement) {}


TEST(RunLoopIncrement2) {}


TEST(RunLoopIncrement3) {}


TEST(RunLoopDecrement) {}


TEST(RunLoopIncrementFloat32) {}


TEST(RunLoopIncrementFloat64) {}


TEST(RunSwitch1) {}


TEST(RunSwitch2) {}


TEST(RunSwitch3) {}


TEST(RunSwitch4) {}


TEST(RunInt32AddP) {}


TEST(RunInt32AddAndWord32EqualP) {}


TEST(RunInt32AddAndWord32EqualImm) {}


TEST(RunInt32AddAndWord32NotEqualP) {}


TEST(RunInt32AddAndWord32NotEqualImm) {}


TEST(RunInt32AddAndWord32SarP) {}


TEST(RunInt32AddAndWord32ShlP) {}


TEST(RunInt32AddAndWord32ShrP) {}


TEST(RunInt32AddInBranch) {}


TEST(RunInt32AddInComparison) {}


TEST(RunInt32SubP) {}

TEST(RunInt32SubImm) {}

TEST(RunInt32SubImm2) {}

TEST(RunInt32SubAndWord32SarP) {}


TEST(RunInt32SubAndWord32ShlP) {}


TEST(RunInt32SubAndWord32ShrP) {}


TEST(RunInt32SubInBranch) {}


TEST(RunInt32SubInComparison) {}


TEST(RunInt32MulP) {}


TEST(RunInt32MulHighP) {}


TEST(RunInt32MulImm) {}

TEST(RunInt32MulAndInt32AddP) {}


TEST(RunInt32MulAndInt32SubP) {}


TEST(RunUint32MulHighP) {}


TEST(RunInt32DivP) {}


TEST(RunUint32DivP) {}


TEST(RunInt32ModP) {}


TEST(RunUint32ModP) {}


TEST(RunWord32AndP) {}


TEST(RunWord32AndAndWord32ShlP) {}


TEST(RunWord32AndAndWord32ShrP) {}


TEST(RunWord32AndAndWord32SarP) {}


TEST(RunWord32AndImm) {}


TEST(RunWord32AndInBranch) {}


TEST(RunWord32AndInComparison) {}


TEST(RunWord32OrP) {}


TEST(RunWord32OrImm) {}


TEST(RunWord32OrInBranch) {}


TEST(RunWord32OrInComparison) {}


TEST(RunWord32XorP) {}


TEST(RunWord32XorInBranch) {}


TEST(RunWord32ShlP) {}


TEST(RunWord32ShlInComparison) {}


TEST(RunWord32ShrP) {}

TEST(RunWordShiftInBranch) {}

TEST(RunWord32ShrInComparison) {}


TEST(RunWord32SarP) {}


TEST(RunWord32SarInComparison) {}


TEST(RunWord32RorP) {}


TEST(RunWord32RorInComparison) {}

TEST(RunWord32BitwiseNotP) {}


TEST(RunInt32NegP) {}


TEST(RunWord32EqualAndWord32SarP) {}


TEST(RunWord32EqualAndWord32ShlP) {}


TEST(RunWord32EqualAndWord32ShrP) {}


TEST(RunDeadNodes) {}


TEST(RunDeadInt32Binops) {}


TEST(RunFloat32Add) {}


TEST(RunFloat32Sub) {}

TEST(RunFloat32Neg) {}

TEST(RunFloat32Mul) {}


TEST(RunFloat32Div) {}


TEST(RunFloat64Add) {}


TEST(RunFloat64Sub) {}

TEST(RunFloat64Neg) {}

TEST(RunFloat64Mul) {}


TEST(RunFloat64Div) {}


TEST(RunFloat64Mod) {}


TEST(RunDeadFloat32Binops) {}


TEST(RunDeadFloat64Binops) {}


TEST(RunFloat32AddP) {}


TEST(RunFloat64AddP) {}

TEST(RunFloat64MaxP) {}


TEST(RunFloat64MinP) {}

TEST(RunFloat32Max) {}

TEST(RunFloat32Min) {}

TEST(RunFloat64Max) {}

TEST(RunFloat64Min) {}

TEST(RunFloat32SubP) {}


TEST(RunFloat32SubImm1) {}


TEST(RunFloat32SubImm2) {}


TEST(RunFloat64SubImm1) {}


TEST(RunFloat64SubImm2) {}


TEST(RunFloat64SubP) {}


TEST(RunFloat32MulP) {}


TEST(RunFloat64MulP) {}

TEST(RunFloat32MulAndFloat32Neg) {}

TEST(RunFloat64MulAndFloat64Neg) {}

TEST(RunFloat32NegAndFloat32Mul1) {}

TEST(RunFloat64NegAndFloat64Mul1) {}

TEST(RunFloat32NegAndFloat32Mul2) {}

TEST(RunFloat64NegAndFloat64Mul2) {}

TEST(RunFloat32NegAndFloat32Mul3) {}

TEST(RunFloat64NegAndFloat64Mul3) {}

TEST(RunFloat64MulAndFloat64Add1) {}


TEST(RunFloat64MulAndFloat64Add2) {}


TEST(RunFloat64MulAndFloat64Sub1) {}


TEST(RunFloat64MulAndFloat64Sub2) {}


TEST(RunFloat64MulImm1) {}


TEST(RunFloat64MulImm2) {}


TEST(RunFloat32DivP) {}


TEST(RunFloat64DivP) {}


TEST(RunFloat64ModP) {}


TEST(RunChangeInt32ToFloat64_A) {}


TEST(RunChangeInt32ToFloat64_B) {}


TEST(RunChangeUint32ToFloat64) {}


TEST(RunTruncateFloat32ToInt32) {}

TEST(RunTruncateFloat32ToUint32) {}


TEST(RunChangeFloat64ToInt32_A) {}


TEST(RunChangeFloat64ToInt32_B) {}

TEST(RunChangeFloat64ToUint32) {}


TEST(RunTruncateFloat64ToFloat32) {}

uint64_t ToInt64(uint32_t low, uint32_t high) {}

#if V8_TARGET_ARCH_32_BIT
TEST(RunInt32PairAdd) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairAdd = m.Int32PairAdd(m.Parameter(0), m.Parameter(1), m.Parameter(2),
                                 m.Parameter(3));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairAdd));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairAdd));
  m.Return(m.Int32Constant(74));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32),
             static_cast<uint32_t>(j & 0xFFFFFFFF),
             static_cast<uint32_t>(j >> 32));
      CHECK_EQ(i + j, ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairAddUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  m.Return(m.Projection(1, m.Int32PairAdd(m.Parameter(0), m.Parameter(1),
                                          m.Parameter(2), m.Parameter(3))));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      CHECK_EQ(
          static_cast<uint32_t>((i + j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32),
                                       static_cast<uint32_t>(j & 0xFFFFFFFF),
                                       static_cast<uint32_t>(j >> 32))));
    }
  }
}

void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) {
  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
                                               MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairAdd = m.Int32PairAdd(m.Parameter(a), m.Parameter(b), m.Parameter(c),
                                 m.Parameter(d));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairAdd));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairAdd));
  m.Return(m.Int32Constant(74));

  FOR_UINT32_INPUTS(i) {
    FOR_UINT32_INPUTS(j) {
      m.Call(i, j);
      uint32_t inputs[] = {i, j};
      CHECK_EQ(ToInt64(inputs[a], inputs[b]) + ToInt64(inputs[c], inputs[d]),
               ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairAddWithSharedInput) {
  TestInt32PairAddWithSharedInput(0, 0, 0, 0);
  TestInt32PairAddWithSharedInput(1, 0, 0, 0);
  TestInt32PairAddWithSharedInput(0, 1, 0, 0);
  TestInt32PairAddWithSharedInput(0, 0, 1, 0);
  TestInt32PairAddWithSharedInput(0, 0, 0, 1);
  TestInt32PairAddWithSharedInput(1, 1, 0, 0);
}

TEST(RunInt32PairSub) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairSub = m.Int32PairSub(m.Parameter(0), m.Parameter(1), m.Parameter(2),
                                 m.Parameter(3));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairSub));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairSub));
  m.Return(m.Int32Constant(74));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32),
             static_cast<uint32_t>(j & 0xFFFFFFFF),
             static_cast<uint32_t>(j >> 32));
      CHECK_EQ(i - j, ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairSubUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  m.Return(m.Projection(1, m.Int32PairSub(m.Parameter(0), m.Parameter(1),
                                          m.Parameter(2), m.Parameter(3))));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      CHECK_EQ(
          static_cast<uint32_t>((i - j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32),
                                       static_cast<uint32_t>(j & 0xFFFFFFFF),
                                       static_cast<uint32_t>(j >> 32))));
    }
  }
}

void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) {
  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
                                               MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairSub = m.Int32PairSub(m.Parameter(a), m.Parameter(b), m.Parameter(c),
                                 m.Parameter(d));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairSub));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairSub));
  m.Return(m.Int32Constant(74));

  FOR_UINT32_INPUTS(i) {
    FOR_UINT32_INPUTS(j) {
      m.Call(i, j);
      uint32_t inputs[] = {i, j};
      CHECK_EQ(ToInt64(inputs[a], inputs[b]) - ToInt64(inputs[c], inputs[d]),
               ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairSubWithSharedInput) {
  TestInt32PairSubWithSharedInput(0, 0, 0, 0);
  TestInt32PairSubWithSharedInput(1, 0, 0, 0);
  TestInt32PairSubWithSharedInput(0, 1, 0, 0);
  TestInt32PairSubWithSharedInput(0, 0, 1, 0);
  TestInt32PairSubWithSharedInput(0, 0, 0, 1);
  TestInt32PairSubWithSharedInput(1, 1, 0, 0);
}

TEST(RunInt32PairMul) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairMul = m.Int32PairMul(m.Parameter(0), m.Parameter(1), m.Parameter(2),
                                 m.Parameter(3));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairMul));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairMul));
  m.Return(m.Int32Constant(74));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32),
             static_cast<uint32_t>(j & 0xFFFFFFFF),
             static_cast<uint32_t>(j >> 32));
      CHECK_EQ(i * j, ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairMulUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
      MachineType::Uint32());

  m.Return(m.Projection(1, m.Int32PairMul(m.Parameter(0), m.Parameter(1),
                                          m.Parameter(2), m.Parameter(3))));

  FOR_UINT64_INPUTS(i) {
    FOR_UINT64_INPUTS(j) {
      CHECK_EQ(
          static_cast<uint32_t>((i * j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32),
                                       static_cast<uint32_t>(j & 0xFFFFFFFF),
                                       static_cast<uint32_t>(j >> 32))));
    }
  }
}

void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) {
  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
                                               MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairMul = m.Int32PairMul(m.Parameter(a), m.Parameter(b), m.Parameter(c),
                                 m.Parameter(d));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairMul));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairMul));
  m.Return(m.Int32Constant(74));

  FOR_UINT32_INPUTS(i) {
    FOR_UINT32_INPUTS(j) {
      m.Call(i, j);
      uint32_t inputs[] = {i, j};
      CHECK_EQ(ToInt64(inputs[a], inputs[b]) * ToInt64(inputs[c], inputs[d]),
               ToInt64(low, high));
    }
  }
}

TEST(RunInt32PairMulWithSharedInput) {
  TestInt32PairMulWithSharedInput(0, 0, 0, 0);
  TestInt32PairMulWithSharedInput(1, 0, 0, 0);
  TestInt32PairMulWithSharedInput(0, 1, 0, 0);
  TestInt32PairMulWithSharedInput(0, 0, 1, 0);
  TestInt32PairMulWithSharedInput(0, 0, 0, 1);
  TestInt32PairMulWithSharedInput(1, 1, 0, 0);
  TestInt32PairMulWithSharedInput(0, 1, 1, 0);
}

TEST(RunWord32PairShl) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairShl =
      m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairShl));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairShl));
  m.Return(m.Int32Constant(74));

  FOR_UINT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32), j);
      CHECK_EQ(i << j, ToInt64(low, high));
    }
  }
}

TEST(RunWord32PairShlUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  m.Return(m.Projection(
      1, m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2))));

  FOR_UINT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      CHECK_EQ(
          static_cast<uint32_t>((i << j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32), j)));
    }
  }
}

void TestWord32PairShlWithSharedInput(int a, int b) {
  BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
                                               MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairAdd =
      m.Word32PairShl(m.Parameter(a), m.Parameter(b), m.Parameter(1));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairAdd));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairAdd));
  m.Return(m.Int32Constant(74));

  FOR_UINT32_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      m.Call(i, j);
      uint32_t inputs[] = {i, j};
      CHECK_EQ(ToInt64(inputs[a], inputs[b]) << j, ToInt64(low, high));
    }
  }
}

TEST(RunWord32PairShlWithSharedInput) {
  TestWord32PairShlWithSharedInput(0, 0);
  TestWord32PairShlWithSharedInput(0, 1);
  TestWord32PairShlWithSharedInput(1, 0);
  TestWord32PairShlWithSharedInput(1, 1);
}

TEST(RunWord32PairShr) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairAdd =
      m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairAdd));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairAdd));
  m.Return(m.Int32Constant(74));

  FOR_UINT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32), j);
      CHECK_EQ(i >> j, ToInt64(low, high));
    }
  }
}

TEST(RunWord32PairShrUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  m.Return(m.Projection(
      1, m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2))));

  FOR_UINT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      CHECK_EQ(
          static_cast<uint32_t>((i >> j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32), j)));
    }
  }
}

TEST(RunWord32PairSar) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  uint32_t high;
  uint32_t low;

  Node* PairAdd =
      m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2));

  m.StoreToPointer(&low, MachineRepresentation::kWord32,
                   m.Projection(0, PairAdd));
  m.StoreToPointer(&high, MachineRepresentation::kWord32,
                   m.Projection(1, PairAdd));
  m.Return(m.Int32Constant(74));

  FOR_INT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
             static_cast<uint32_t>(i >> 32), j);
      CHECK_EQ(i >> j, static_cast<int64_t>(ToInt64(low, high)));
    }
  }
}

TEST(RunWord32PairSarUseOnlyHighWord) {
  BufferedRawMachineAssemblerTester<int32_t> m(
      MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());

  m.Return(m.Projection(
      1, m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2))));

  FOR_INT64_INPUTS(i) {
    for (uint32_t j = 0; j < 64; j++) {
      CHECK_EQ(
          static_cast<uint32_t>((i >> j) >> 32),
          static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
                                       static_cast<uint32_t>(i >> 32), j)));
    }
  }
}
#endif

TEST(RunDeadChangeFloat64ToInt32) {}


TEST(RunDeadChangeInt32ToFloat64) {}


TEST(RunLoopPhiInduction2) {}


TEST(RunFloatDiamond) {}


TEST(RunDoubleDiamond) {}


TEST(RunRefDiamond) {}


TEST(RunDoubleRefDiamond) {}


TEST(RunDoubleRefDoubleDiamond) {}


TEST(RunDoubleLoopPhi) {}


TEST(RunCountToTenAccRaw) {}


TEST(RunCountToTenAccRaw2) {}


TEST(RunAddTree) {}


static const int kFloat64CompareHelperTestCases =;
static const int kFloat64CompareHelperNodeType =;

static int Float64CompareHelper(RawMachineAssemblerTester<int32_t>* m,
                                int test_case, int node_type, double x,
                                double y) {}


TEST(RunFloat64Compare) {}


TEST(RunFloat64UnorderedCompare) {}


TEST(RunFloat64Equal) {}


TEST(RunFloat64LessThan) {}


static void IntPtrCompare(intptr_t left, intptr_t right) {}


TEST(RunIntPtrCompare) {}


TEST(RunTestIntPtrArithmetic) {}


TEST(RunSpillLotsOfThings) {}


TEST(RunSpillConstantsAndParameters) {}


TEST(RunNewSpaceConstantsInPhi) {}


TEST(RunInt32AddWithOverflowP) {}


TEST(RunInt32AddWithOverflowImm) {}


TEST(RunInt32AddWithOverflowInBranchP) {}


TEST(RunInt32SubWithOverflowP) {}


TEST(RunInt32SubWithOverflowImm) {}


TEST(RunInt32SubWithOverflowInBranchP) {}

TEST(RunInt32MulWithOverflowP) {}

TEST(RunInt32MulWithOverflowImm) {}

TEST(RunInt32MulWithOverflowInBranchP) {}

TEST(RunWord64EqualInBranchP) {}


TEST(RunChangeInt32ToInt64P) {}


TEST(RunChangeUint32ToUint64P) {}


TEST(RunTruncateInt64ToInt32P) {}

TEST(RunTruncateFloat64ToWord32P) {}

TEST(RunTruncateFloat64ToWord32SignExtension) {}

TEST(RunChangeFloat32ToFloat64) {}


TEST(RunFloat32Constant) {}


TEST(RunFloat64ExtractLowWord32) {}


TEST(RunFloat64ExtractHighWord32) {}


TEST(RunFloat64InsertLowWord32) {}


TEST(RunFloat64InsertHighWord32) {}


TEST(RunFloat32Abs) {}


TEST(RunFloat64Abs) {}

TEST(RunFloat64Acos) {}

TEST(RunFloat64Acosh) {}

TEST(RunFloat64Asin) {}

TEST(RunFloat64Asinh) {}

TEST(RunFloat64Atan) {}

TEST(RunFloat64Atanh) {}

TEST(RunFloat64Atan2) {}

TEST(RunFloat64Cos) {}

TEST(RunFloat64Cosh) {}

TEST(RunFloat64Exp) {}

TEST(RunFloat64Expm1) {}

TEST(RunFloat64Log) {}

TEST(RunFloat64Log1p) {}

TEST(RunFloat64Log2) {}

TEST(RunFloat64Log10) {}

TEST(RunFloat64Cbrt) {}

TEST(RunFloat64Sin) {}

TEST(RunFloat64Sinh) {}

TEST(RunFloat64Tan) {}

TEST(RunFloat64Tanh) {}

static double two_30 =;             // 2^30 is a smi boundary.
static double two_52 =;  // 2^52 is a precision boundary.
static double kValues[] =;


TEST(RunFloat32RoundDown) {}


TEST(RunFloat64RoundDown1) {}


TEST(RunFloat64RoundDown2) {}


TEST(RunFloat32RoundUp) {}


TEST(RunFloat64RoundUp) {}


TEST(RunFloat32RoundTiesEven) {}


TEST(RunFloat64RoundTiesEven) {}


TEST(RunFloat32RoundTruncate) {}


TEST(RunFloat64RoundTruncate) {}


TEST(RunFloat64RoundTiesAway) {}


#if !USE_SIMULATOR

namespace {

int32_t const kMagicFoo0 =;

int32_t foo0() {}


int32_t foo1(int32_t x) {}

int32_t foo2(int32_t x, int32_t y) {}

uint32_t foo8(uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e,
              uint32_t f, uint32_t g, uint32_t h) {}

uint32_t foo9(uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e,
              uint32_t f, uint32_t g, uint32_t h, uint32_t i) {}

}  // namespace


TEST(RunCallCFunction0) {}


TEST(RunCallCFunction1) {}


TEST(RunCallCFunction2) {}


TEST(RunCallCFunction8) {}

TEST(RunCallCFunction9) {}

#endif  // !USE_SIMULATOR

#ifdef V8_ENABLE_FP_PARAMS_IN_C_LINKAGE

namespace {

void CheckEqual(double expected, double actual) {}

void CheckLessOrEqual(double actual, double expected) {}

const double foo_result =;

#ifdef V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
union Int64OrDoubleUnion {
  int64_t int64_value;
  double double_value;
};

Int64OrDoubleUnion double_foo0() {
  Int64OrDoubleUnion ret;
  ret.double_value = foo_result;
  return ret;
}

Int64OrDoubleUnion double_foo1(Int64OrDoubleUnion x) {
  Int64OrDoubleUnion ret;
  ret.double_value = x.double_value;
  return ret;
}

Int64OrDoubleUnion double_foo2(Int64OrDoubleUnion x, Int64OrDoubleUnion y) {
  Int64OrDoubleUnion ret;
  ret.double_value = x.double_value * 10 + y.double_value;
  return ret;
}

Int64OrDoubleUnion double_foo8(Int64OrDoubleUnion a, Int64OrDoubleUnion b,
                               Int64OrDoubleUnion c, Int64OrDoubleUnion d,
                               Int64OrDoubleUnion e, Int64OrDoubleUnion f,
                               Int64OrDoubleUnion g, Int64OrDoubleUnion h) {
  Int64OrDoubleUnion ret;
  ret.double_value = a.double_value + b.double_value + c.double_value +
                     d.double_value + e.double_value + f.double_value +
                     g.double_value + h.double_value;
  return ret;
}

Int64OrDoubleUnion double_foo9(Int64OrDoubleUnion a, Int64OrDoubleUnion b,
                               Int64OrDoubleUnion c, Int64OrDoubleUnion d,
                               Int64OrDoubleUnion e, Int64OrDoubleUnion f,
                               Int64OrDoubleUnion g, Int64OrDoubleUnion h,
                               Int64OrDoubleUnion i) {
  Int64OrDoubleUnion ret;
  ret.double_value = a.double_value + b.double_value + c.double_value +
                     d.double_value + e.double_value + f.double_value +
                     g.double_value + h.double_value + i.double_value;
  return ret;
}

Int64OrDoubleUnion double_foo10(Int64OrDoubleUnion a, Int64OrDoubleUnion b,
                                Int64OrDoubleUnion c, Int64OrDoubleUnion d,
                                Int64OrDoubleUnion e, Int64OrDoubleUnion f,
                                Int64OrDoubleUnion g, Int64OrDoubleUnion h,
                                Int64OrDoubleUnion i, Int64OrDoubleUnion j) {
  Int64OrDoubleUnion ret;
  ret.double_value = a.double_value + b.double_value + c.double_value +
                     d.double_value + e.double_value + f.double_value +
                     g.double_value + h.double_value + i.double_value +
                     j.int64_value;
  return ret;
}

Int64OrDoubleUnion int_foo10(Int64OrDoubleUnion a, Int64OrDoubleUnion b,
                             Int64OrDoubleUnion c, Int64OrDoubleUnion d,
                             Int64OrDoubleUnion e, Int64OrDoubleUnion f,
                             Int64OrDoubleUnion g, Int64OrDoubleUnion h,
                             Int64OrDoubleUnion i, Int64OrDoubleUnion j) {
  Int64OrDoubleUnion ret;
  ret.double_value = a.int64_value + b.int64_value + c.int64_value +
                     d.int64_value + e.int64_value + f.int64_value +
                     g.int64_value + h.int64_value + i.int64_value +
                     j.double_value;
  return ret;
}
#else   // def V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS
double double_foo0() {}

double double_foo1(double x) {}

double double_foo2(double x, double y) {}

double double_foo8(double a, double b, double c, double d, double e, double f,
                   double g, double h) {}

double double_foo9(double a, double b, double c, double d, double e, double f,
                   double g, double h, double i) {}

double double_foo10(double a, double b, double c, double d, double e, double f,
                    double g, double h, double i, int64_t j) {}

double int_foo10(int64_t a, int64_t b, int64_t c, int64_t d, int64_t e,
                 int64_t f, int64_t g, int64_t h, int64_t i, double j) {}
#endif  // V8_USE_SIMULATOR_WITH_GENERIC_C_CALLS

}  // namespace

TEST(RunCallDoubleCFunction0) {}

TEST(RunCallDoubleCFunction1) {}

TEST(RunCallDoubleCFunction2) {}

TEST(RunCallDoubleCFunction8) {}

TEST(RunCallDoubleCFunction9) {}

TEST(RunCallDoubleCFunction10) {}

TEST(RunCallIntCFunction10) {}
#endif  // V8_ENABLE_FP_PARAMS_IN_C_LINKAGE

#if V8_TARGET_ARCH_64_BIT
// TODO(titzer): run int64 tests on all platforms when supported.

TEST(RunChangeFloat64ToInt64) {}

TEST(RunChangeInt64ToFloat64) {}

TEST(RunBitcastInt64ToFloat64) {}


TEST(RunBitcastFloat64ToInt64) {}


TEST(RunTryTruncateFloat32ToInt64WithoutCheck) {}


TEST(RunTryTruncateFloat32ToInt64WithCheck) {}


TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {}


TEST(RunTryTruncateFloat64ToInt64WithCheck) {}


TEST(RunTryTruncateFloat32ToUint64WithoutCheck) {}


TEST(RunTryTruncateFloat32ToUint64WithCheck) {}


TEST(RunTryTruncateFloat64ToUint64WithoutCheck) {}


TEST(RunTryTruncateFloat64ToUint64WithCheck) {}


TEST(RunRoundInt64ToFloat32) {}


TEST(RunRoundInt64ToFloat64) {}


TEST(RunRoundUint64ToFloat64) {}


TEST(RunRoundUint64ToFloat32) {}


#endif


TEST(RunBitcastFloat32ToInt32) {}


TEST(RunRoundInt32ToFloat32) {}


TEST(RunRoundUint32ToFloat32) {}


TEST(RunBitcastInt32ToFloat32) {}


TEST(RunComputedCodeObject) {}

TEST(ParentFramePointer) {}

#if V8_TARGET_ARCH_64_BIT

TEST(Regression5923) {}

TEST(Regression5951) {}

TEST(Regression6046a) {}

TEST(Regression6122) {}

#endif  // V8_TARGET_ARCH_64_BIT

TEST(Regression6046b) {}

TEST(Regression6122b) {}

TEST(Regression6028) {}

TEST(Regression5951_32bit) {}

TEST(Regression738952) {}

#if V8_TARGET_ARCH_64_BIT
TEST(Regression12373) {}
#endif  // V8_TARGET_ARCH_64_BIT

}  // namespace compiler
}  // namespace internal
}  // namespace v8