| Index: test/cctest/compiler/test-run-calls-to-external-references.cc
|
| diff --git a/test/cctest/compiler/test-run-calls-to-external-references.cc b/test/cctest/compiler/test-run-calls-to-external-references.cc
|
| index e701e62c195d1ec30da8eeefbea93fce179d1fbc..2444045e9a49aa8c67f58ecee91e1a47aa9c9a92 100644
|
| --- a/test/cctest/compiler/test-run-calls-to-external-references.cc
|
| +++ b/test/cctest/compiler/test-run-calls-to-external-references.cc
|
| @@ -331,6 +331,99 @@ TEST(RunCallUint64ToFloat64) {
|
| }
|
| }
|
|
|
| +TEST(RunCallFloat32ToInt64) {
|
| + BufferedRawMachineAssemblerTester<int32_t> m;
|
| + ExternalReference ref = ExternalReference::wasm_float32_to_int64(m.isolate());
|
| +
|
| + float input;
|
| + int64_t output;
|
| +
|
| + Node* function = m.ExternalConstant(ref);
|
| + m.Return(m.CallCFunction2(
|
| + MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
|
| + function, m.PointerConstant(&input), m.PointerConstant(&output)));
|
| + FOR_FLOAT32_INPUTS(i) {
|
| + input = *i;
|
| + if (*i >= static_cast<float>(std::numeric_limits<int64_t>::min()) &&
|
| + *i < static_cast<float>(std::numeric_limits<int64_t>::max())) {
|
| + CHECK_EQ(1, m.Call());
|
| + CHECK_EQ(static_cast<int64_t>(*i), output);
|
| + } else {
|
| + CHECK_EQ(0, m.Call());
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(RunCallFloat32ToUint64) {
|
| + BufferedRawMachineAssemblerTester<int32_t> m;
|
| + ExternalReference ref =
|
| + ExternalReference::wasm_float32_to_uint64(m.isolate());
|
| +
|
| + float input;
|
| + uint64_t output;
|
| +
|
| + Node* function = m.ExternalConstant(ref);
|
| + m.Return(m.CallCFunction2(
|
| + MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
|
| + function, m.PointerConstant(&input), m.PointerConstant(&output)));
|
| + FOR_FLOAT32_INPUTS(i) {
|
| + input = *i;
|
| + if (*i > -1.0 &&
|
| + *i < static_cast<float>(std::numeric_limits<uint64_t>::max())) {
|
| + CHECK_EQ(1, m.Call());
|
| + CHECK_EQ(static_cast<uint64_t>(*i), output);
|
| + } else {
|
| + CHECK_EQ(0, m.Call());
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(RunCallFloat64ToInt64) {
|
| + BufferedRawMachineAssemblerTester<int32_t> m;
|
| + ExternalReference ref = ExternalReference::wasm_float64_to_int64(m.isolate());
|
| +
|
| + double input;
|
| + int64_t output;
|
| +
|
| + Node* function = m.ExternalConstant(ref);
|
| + m.Return(m.CallCFunction2(
|
| + MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
|
| + function, m.PointerConstant(&input), m.PointerConstant(&output)));
|
| + FOR_FLOAT64_INPUTS(i) {
|
| + input = *i;
|
| + if (*i >= static_cast<double>(std::numeric_limits<int64_t>::min()) &&
|
| + *i < static_cast<double>(std::numeric_limits<int64_t>::max())) {
|
| + CHECK_EQ(1, m.Call());
|
| + CHECK_EQ(static_cast<int64_t>(*i), output);
|
| + } else {
|
| + CHECK_EQ(0, m.Call());
|
| + }
|
| + }
|
| +}
|
| +
|
| +TEST(RunCallFloat64ToUint64) {
|
| + BufferedRawMachineAssemblerTester<int32_t> m;
|
| + ExternalReference ref =
|
| + ExternalReference::wasm_float64_to_uint64(m.isolate());
|
| +
|
| + double input;
|
| + uint64_t output;
|
| +
|
| + Node* function = m.ExternalConstant(ref);
|
| + m.Return(m.CallCFunction2(
|
| + MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
|
| + function, m.PointerConstant(&input), m.PointerConstant(&output)));
|
| + FOR_FLOAT64_INPUTS(i) {
|
| + input = *i;
|
| + if (*i > -1.0 &&
|
| + *i < static_cast<double>(std::numeric_limits<uint64_t>::max())) {
|
| + CHECK_EQ(1, m.Call());
|
| + CHECK_EQ(static_cast<uint64_t>(*i), output);
|
| + } else {
|
| + CHECK_EQ(0, m.Call());
|
| + }
|
| + }
|
| +}
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|