Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 1661463002: [wasm] Provide backoff implementations for the Fxx rounding instructions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@trunc64-external-reference
Patch Set: rebase. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/test-api-fast-accessor-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 5570 matching lines...) Expand 10 before | Expand all | Expand 10 after
5581 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), 5581 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
5582 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), 5582 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
5583 function, param, param, param, param, param, param, param, param)); 5583 function, param, param, param, param, param, param, param, param));
5584 FOR_INT32_INPUTS(i) { 5584 FOR_INT32_INPUTS(i) {
5585 int32_t const x = *i; 5585 int32_t const x = *i;
5586 CHECK_EQ(x * 8, m.Call(x)); 5586 CHECK_EQ(x * 8, m.Call(x));
5587 } 5587 }
5588 } 5588 }
5589 #endif // USE_SIMULATOR 5589 #endif // USE_SIMULATOR
5590 5590
5591 template <typename T>
5592 void TestExternalReferenceFunction(
5593 BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref,
5594 T (*comparison)(T)) {
5595 T parameter;
5596
5597 Node* function = m->ExternalConstant(ref);
5598 m->CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), function,
5599 m->PointerConstant(&parameter));
5600 m->Return(m->Int32Constant(4356));
5601 FOR_FLOAT64_INPUTS(i) {
5602 parameter = *i;
5603 m->Call();
5604 CheckDoubleEq(comparison(*i), parameter);
5605 }
5606 }
5607
5608 TEST(RunCallExternalReferenceF32Trunc) {
5609 BufferedRawMachineAssemblerTester<int32_t> m;
5610 ExternalReference ref =
5611 ExternalReference::f32_trunc_wrapper_function(m.isolate());
5612 TestExternalReferenceFunction<float>(&m, ref, truncf);
5613 }
5614
5615 TEST(RunCallExternalReferenceF32Floor) {
5616 BufferedRawMachineAssemblerTester<int32_t> m;
5617 ExternalReference ref =
5618 ExternalReference::f32_floor_wrapper_function(m.isolate());
5619 TestExternalReferenceFunction<float>(&m, ref, floorf);
5620 }
5621
5622 TEST(RunCallExternalReferenceF32Ceil) {
5623 BufferedRawMachineAssemblerTester<int32_t> m;
5624 ExternalReference ref =
5625 ExternalReference::f32_ceil_wrapper_function(m.isolate());
5626 TestExternalReferenceFunction<float>(&m, ref, ceilf);
5627 }
5628
5629 TEST(RunCallExternalReferenceF32RoundTiesEven) {
5630 BufferedRawMachineAssemblerTester<int32_t> m;
5631 ExternalReference ref =
5632 ExternalReference::f32_nearest_int_wrapper_function(m.isolate());
5633 TestExternalReferenceFunction<float>(&m, ref, nearbyintf);
5634 }
5635
5591 TEST(RunCallExternalReferenceF64Trunc) { 5636 TEST(RunCallExternalReferenceF64Trunc) {
5592 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5637 BufferedRawMachineAssemblerTester<int32_t> m;
5593 Node* stack_slot = m.StackSlot(MachineRepresentation::kFloat64); 5638 ExternalReference ref =
5594 m.Store(MachineRepresentation::kFloat64, stack_slot, m.Parameter(0), 5639 ExternalReference::f64_trunc_wrapper_function(m.isolate());
5595 WriteBarrierKind::kNoWriteBarrier); 5640 TestExternalReferenceFunction<double>(&m, ref, trunc);
5596 Node* function = m.ExternalConstant( 5641 }
5597 ExternalReference::trunc64_wrapper_function(m.isolate())); 5642
5598 m.CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), function, 5643 TEST(RunCallExternalReferenceF64Floor) {
5599 stack_slot); 5644 BufferedRawMachineAssemblerTester<int32_t> m;
5600 m.Return(m.Load(MachineType::Float64(), stack_slot)); 5645 ExternalReference ref =
5601 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(trunc(*i), m.Call(*i)); } 5646 ExternalReference::f64_floor_wrapper_function(m.isolate());
5647 TestExternalReferenceFunction<double>(&m, ref, floor);
5648 }
5649
5650 TEST(RunCallExternalReferenceF64Ceil) {
5651 BufferedRawMachineAssemblerTester<int32_t> m;
5652 ExternalReference ref =
5653 ExternalReference::f64_ceil_wrapper_function(m.isolate());
5654 TestExternalReferenceFunction<double>(&m, ref, ceil);
5655 }
5656
5657 TEST(RunCallExternalReferenceF64RoundTiesEven) {
5658 BufferedRawMachineAssemblerTester<int32_t> m;
5659 ExternalReference ref =
5660 ExternalReference::f64_nearest_int_wrapper_function(m.isolate());
5661 TestExternalReferenceFunction<double>(&m, ref, nearbyint);
5602 } 5662 }
5603 5663
5604 #if V8_TARGET_ARCH_64_BIT 5664 #if V8_TARGET_ARCH_64_BIT
5605 // TODO(titzer): run int64 tests on all platforms when supported. 5665 // TODO(titzer): run int64 tests on all platforms when supported.
5606 TEST(RunCheckedLoadInt64) { 5666 TEST(RunCheckedLoadInt64) {
5607 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; 5667 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL};
5608 RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); 5668 RawMachineAssemblerTester<int64_t> m(MachineType::Int32());
5609 Node* base = m.PointerConstant(buffer); 5669 Node* base = m.PointerConstant(buffer);
5610 Node* index = m.Parameter(0); 5670 Node* index = m.Parameter(0);
5611 Node* length = m.Int32Constant(16); 5671 Node* length = m.Int32Constant(16);
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 Node* call = r.AddNode(r.common()->Call(desc), phi); 6158 Node* call = r.AddNode(r.common()->Call(desc), phi);
6099 r.Return(call); 6159 r.Return(call);
6100 6160
6101 CHECK_EQ(33, r.Call(1)); 6161 CHECK_EQ(33, r.Call(1));
6102 CHECK_EQ(44, r.Call(0)); 6162 CHECK_EQ(44, r.Call(0));
6103 } 6163 }
6104 6164
6105 } // namespace compiler 6165 } // namespace compiler
6106 } // namespace internal 6166 } // namespace internal
6107 } // namespace v8 6167 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/test-api-fast-accessor-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698