diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc index 22c85d5ec3..078b8c25cd 100644 --- a/test/cctest/compiler/test-run-machops.cc +++ b/test/cctest/compiler/test-run-machops.cc @@ -5280,6 +5280,7 @@ TEST(RunCallCFunction8) { #endif // USE_SIMULATOR #if V8_TARGET_ARCH_64_BIT +// TODO(titzer): run int64 tests on all platforms when supported. TEST(RunCheckedLoadInt64) { int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; RawMachineAssemblerTester m(kMachInt32); @@ -5325,7 +5326,6 @@ TEST(RunCheckedStoreInt64) { TEST(RunBitcastInt64ToFloat64) { - // TODO(titzer): run int64 tests on all platforms when supported. int64_t input = 1; double output = 0.0; RawMachineAssemblerTester m; @@ -5333,8 +5333,8 @@ TEST(RunBitcastInt64ToFloat64) { &output, kMachFloat64, m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, kMachInt64))); m.Return(m.Int32Constant(11)); - FOR_INT32_INPUTS(i) { - input = static_cast(*i) * 14444; + FOR_INT64_INPUTS(i) { + input = *i; CHECK_EQ(11, m.Call()); double expected = bit_cast(input); CHECK_EQ(bit_cast(expected), bit_cast(output)); @@ -5343,7 +5343,6 @@ TEST(RunBitcastInt64ToFloat64) { TEST(RunBitcastFloat64ToInt64) { - // TODO(titzer): run int64 tests on all platforms when supported. double input = 0; int64_t output = 0; RawMachineAssemblerTester m; diff --git a/test/cctest/compiler/value-helper.h b/test/cctest/compiler/value-helper.h index 67aefac218..5c0481fe18 100644 --- a/test/cctest/compiler/value-helper.h +++ b/test/cctest/compiler/value-helper.h @@ -131,6 +131,40 @@ class ValueHelper { return std::vector(&kValues[0], &kValues[arraysize(kValues)]); } + static const std::vector int64_vector() { + std::vector values = uint64_vector(); + return std::vector(values.begin(), values.end()); + } + + static const std::vector uint64_vector() { + static const uint64_t kValues[] = { + 0x00000000, 0x00000001, 0xffffffff, + 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, + 0x00000002, 0x00000003, 0x00000004, + 0x00000005, 0x00000008, 0x00000009, + 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffffffffd, + 0x0000000000000000, 0x0000000100000000, 0xffffffff00000000, + 0x1b09788b00000000, 0x04c5fce800000000, 0xcc0de5bf00000000, + 0x0000000200000000, 0x0000000300000000, 0x0000000400000000, + 0x0000000500000000, 0x0000000800000000, 0x0000000900000000, + 0x273a798e187937a3, 0xece3af835495a16b, 0x0b668ecc11223344, + 0x0000009e, 0x00000043, 0x0000af73, + 0x0000116b, 0x00658ecc, 0x002b3b4c, + 0x88776655, 0x70000000, 0x07200000, + 0x7fffffff, 0x56123761, 0x7fffff00, + 0x761c4761eeeeeeee, 0x80000000eeeeeeee, 0x88888888dddddddd, + 0xa0000000dddddddd, 0xddddddddaaaaaaaa, 0xe0000000aaaaaaaa, + 0xeeeeeeeeeeeeeeee, 0xfffffffdeeeeeeee, 0xf0000000dddddddd, + 0x007fffffdddddddd, 0x003fffffaaaaaaaa, 0x001fffffaaaaaaaa, + 0x000fffff, 0x0007ffff, 0x0003ffff, + 0x0001ffff, 0x0000ffff, 0x00007fff, + 0x00003fff, 0x00001fff, 0x00000fff, + 0x000007ff, 0x000003ff, 0x000001ff, + 0x00003fffffffffff, 0x00001fffffffffff, 0x00000fffffffffff, + 0x000007ffffffffff, 0x000003ffffffffff, 0x000001ffffffffff}; + return std::vector(&kValues[0], &kValues[arraysize(kValues)]); + } + static const std::vector nan_vector(size_t limit = 0) { static const double nan = std::numeric_limits::quiet_NaN(); static const double values[] = {-nan, -V8_INFINITY * -0.0, @@ -156,6 +190,8 @@ class ValueHelper { #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) +#define FOR_INT64_INPUTS(var) FOR_INPUTS(int64_t, int64, var) +#define FOR_UINT64_INPUTS(var) FOR_INPUTS(uint64_t, uint64, var) #define FOR_FLOAT32_INPUTS(var) FOR_INPUTS(float, float32, var) #define FOR_FLOAT64_INPUTS(var) FOR_INPUTS(double, float64, var)