Chromium Code Reviews| Index: test/cctest/compiler/test-run-machops.cc |
| diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc |
| index fba9e0e1a505e8ca89dd2866a51f50bb1af9c7fa..2cb72f11163e66ae63203c4afb689d5e5cd65349 100644 |
| --- a/test/cctest/compiler/test-run-machops.cc |
| +++ b/test/cctest/compiler/test-run-machops.cc |
| @@ -5654,7 +5654,7 @@ TEST(RunCallCFunction8) { |
| #endif // USE_SIMULATOR |
| template <typename T> |
| -void TestExternalReferenceFunction( |
| +void TestExternalReferenceRoundingFunction( |
|
titzer
2016/02/25 17:04:33
Can we split all these external references tests i
ahaas
2016/02/25 18:29:18
Done.
|
| BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref, |
| T (*comparison)(T)) { |
| T parameter; |
| @@ -5672,58 +5672,128 @@ void TestExternalReferenceFunction( |
| TEST(RunCallExternalReferenceF32Trunc) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f32_trunc_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<float>(&m, ref, truncf); |
| + ExternalReference ref = ExternalReference::wasm_f32_trunc(m.isolate()); |
| + TestExternalReferenceRoundingFunction<float>(&m, ref, truncf); |
| } |
| TEST(RunCallExternalReferenceF32Floor) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f32_floor_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<float>(&m, ref, floorf); |
| + ExternalReference ref = ExternalReference::wasm_f32_floor(m.isolate()); |
| + TestExternalReferenceRoundingFunction<float>(&m, ref, floorf); |
| } |
| TEST(RunCallExternalReferenceF32Ceil) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f32_ceil_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<float>(&m, ref, ceilf); |
| + ExternalReference ref = ExternalReference::wasm_f32_ceil(m.isolate()); |
| + TestExternalReferenceRoundingFunction<float>(&m, ref, ceilf); |
| } |
| TEST(RunCallExternalReferenceF32RoundTiesEven) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f32_nearest_int_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<float>(&m, ref, nearbyintf); |
| + ExternalReference ref = ExternalReference::wasm_f32_nearest_int(m.isolate()); |
| + TestExternalReferenceRoundingFunction<float>(&m, ref, nearbyintf); |
| } |
| TEST(RunCallExternalReferenceF64Trunc) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f64_trunc_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<double>(&m, ref, trunc); |
| + ExternalReference ref = ExternalReference::wasm_f64_trunc(m.isolate()); |
| + TestExternalReferenceRoundingFunction<double>(&m, ref, trunc); |
| } |
| TEST(RunCallExternalReferenceF64Floor) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f64_floor_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<double>(&m, ref, floor); |
| + ExternalReference ref = ExternalReference::wasm_f64_floor(m.isolate()); |
| + TestExternalReferenceRoundingFunction<double>(&m, ref, floor); |
| } |
| TEST(RunCallExternalReferenceF64Ceil) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| - ExternalReference ref = |
| - ExternalReference::f64_ceil_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<double>(&m, ref, ceil); |
| + ExternalReference ref = ExternalReference::wasm_f64_ceil(m.isolate()); |
| + TestExternalReferenceRoundingFunction<double>(&m, ref, ceil); |
| } |
| TEST(RunCallExternalReferenceF64RoundTiesEven) { |
| BufferedRawMachineAssemblerTester<int32_t> m; |
| + ExternalReference ref = ExternalReference::wasm_f64_nearest_int(m.isolate()); |
| + TestExternalReferenceRoundingFunction<double>(&m, ref, nearbyint); |
| +} |
| + |
| +TEST(RunCallExternalReferenceConvertInt64ToFloat32) { |
| + BufferedRawMachineAssemblerTester<int32_t> m; |
| + ExternalReference ref = ExternalReference::wasm_int64_to_float32(m.isolate()); |
| + |
| + int64_t input; |
| + float output; |
| + |
| + Node* function = m.ExternalConstant(ref); |
| + m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), |
| + MachineType::Pointer(), function, m.PointerConstant(&input), |
| + m.PointerConstant(&output)); |
| + m.Return(m.Int32Constant(4356)); |
| + FOR_INT64_INPUTS(i) { |
| + input = *i; |
| + m.Call(); |
| + CheckFloatEq(static_cast<float>(*i), output); |
| + } |
| +} |
| + |
| +TEST(RunCallExternalReferenceConvertUint64ToFloat32) { |
| + BufferedRawMachineAssemblerTester<int32_t> m; |
| + ExternalReference ref = |
| + ExternalReference::wasm_uint64_to_float32(m.isolate()); |
| + |
| + uint64_t input; |
| + float output; |
| + |
| + Node* function = m.ExternalConstant(ref); |
| + m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), |
| + MachineType::Pointer(), function, m.PointerConstant(&input), |
| + m.PointerConstant(&output)); |
| + m.Return(m.Int32Constant(4356)); |
| + FOR_UINT64_INPUTS(i) { |
| + input = *i; |
| + m.Call(); |
| + CheckFloatEq(static_cast<float>(*i), output); |
| + } |
| +} |
| + |
| +TEST(RunCallExternalReferenceConvertInt64ToFloat64) { |
| + BufferedRawMachineAssemblerTester<int32_t> m; |
| + ExternalReference ref = ExternalReference::wasm_int64_to_float64(m.isolate()); |
| + |
| + int64_t input; |
| + double output; |
| + |
| + Node* function = m.ExternalConstant(ref); |
| + m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), |
| + MachineType::Pointer(), function, m.PointerConstant(&input), |
| + m.PointerConstant(&output)); |
| + m.Return(m.Int32Constant(4356)); |
| + FOR_INT64_INPUTS(i) { |
| + input = *i; |
| + m.Call(); |
| + CheckDoubleEq(static_cast<double>(*i), output); |
| + } |
| +} |
| + |
| +TEST(RunCallExternalReferenceConvertUint64ToFloat64) { |
| + BufferedRawMachineAssemblerTester<int32_t> m; |
| ExternalReference ref = |
| - ExternalReference::f64_nearest_int_wrapper_function(m.isolate()); |
| - TestExternalReferenceFunction<double>(&m, ref, nearbyint); |
| + ExternalReference::wasm_uint64_to_float64(m.isolate()); |
| + |
| + uint64_t input; |
| + double output; |
| + |
| + Node* function = m.ExternalConstant(ref); |
| + m.CallCFunction2(MachineType::Pointer(), MachineType::Pointer(), |
| + MachineType::Pointer(), function, m.PointerConstant(&input), |
| + m.PointerConstant(&output)); |
| + m.Return(m.Int32Constant(4356)); |
| + FOR_UINT64_INPUTS(i) { |
| + input = *i; |
| + m.Call(); |
| + CheckDoubleEq(static_cast<double>(*i), output); |
| + } |
| } |
| #if V8_TARGET_ARCH_64_BIT |