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

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

Issue 1738623003: [wasm] Int64Lowering of FXXXConvertI64 instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase. Created 4 years, 9 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
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 5635 matching lines...) Expand 10 before | Expand all | Expand 10 after
5646 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), 5646 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
5647 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(), 5647 MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
5648 function, param, param, param, param, param, param, param, param)); 5648 function, param, param, param, param, param, param, param, param));
5649 FOR_INT32_INPUTS(i) { 5649 FOR_INT32_INPUTS(i) {
5650 int32_t const x = *i; 5650 int32_t const x = *i;
5651 CHECK_EQ(x * 8, m.Call(x)); 5651 CHECK_EQ(x * 8, m.Call(x));
5652 } 5652 }
5653 } 5653 }
5654 #endif // USE_SIMULATOR 5654 #endif // USE_SIMULATOR
5655 5655
5656 template <typename T>
5657 void TestExternalReferenceFunction(
5658 BufferedRawMachineAssemblerTester<int32_t>* m, ExternalReference ref,
5659 T (*comparison)(T)) {
5660 T parameter;
5661
5662 Node* function = m->ExternalConstant(ref);
5663 m->CallCFunction1(MachineType::Pointer(), MachineType::Pointer(), function,
5664 m->PointerConstant(&parameter));
5665 m->Return(m->Int32Constant(4356));
5666 FOR_FLOAT64_INPUTS(i) {
5667 parameter = *i;
5668 m->Call();
5669 CheckDoubleEq(comparison(*i), parameter);
5670 }
5671 }
5672
5673 TEST(RunCallExternalReferenceF32Trunc) {
5674 BufferedRawMachineAssemblerTester<int32_t> m;
5675 ExternalReference ref =
5676 ExternalReference::f32_trunc_wrapper_function(m.isolate());
5677 TestExternalReferenceFunction<float>(&m, ref, truncf);
5678 }
5679
5680 TEST(RunCallExternalReferenceF32Floor) {
5681 BufferedRawMachineAssemblerTester<int32_t> m;
5682 ExternalReference ref =
5683 ExternalReference::f32_floor_wrapper_function(m.isolate());
5684 TestExternalReferenceFunction<float>(&m, ref, floorf);
5685 }
5686
5687 TEST(RunCallExternalReferenceF32Ceil) {
5688 BufferedRawMachineAssemblerTester<int32_t> m;
5689 ExternalReference ref =
5690 ExternalReference::f32_ceil_wrapper_function(m.isolate());
5691 TestExternalReferenceFunction<float>(&m, ref, ceilf);
5692 }
5693
5694 TEST(RunCallExternalReferenceF32RoundTiesEven) {
5695 BufferedRawMachineAssemblerTester<int32_t> m;
5696 ExternalReference ref =
5697 ExternalReference::f32_nearest_int_wrapper_function(m.isolate());
5698 TestExternalReferenceFunction<float>(&m, ref, nearbyintf);
5699 }
5700
5701 TEST(RunCallExternalReferenceF64Trunc) {
5702 BufferedRawMachineAssemblerTester<int32_t> m;
5703 ExternalReference ref =
5704 ExternalReference::f64_trunc_wrapper_function(m.isolate());
5705 TestExternalReferenceFunction<double>(&m, ref, trunc);
5706 }
5707
5708 TEST(RunCallExternalReferenceF64Floor) {
5709 BufferedRawMachineAssemblerTester<int32_t> m;
5710 ExternalReference ref =
5711 ExternalReference::f64_floor_wrapper_function(m.isolate());
5712 TestExternalReferenceFunction<double>(&m, ref, floor);
5713 }
5714
5715 TEST(RunCallExternalReferenceF64Ceil) {
5716 BufferedRawMachineAssemblerTester<int32_t> m;
5717 ExternalReference ref =
5718 ExternalReference::f64_ceil_wrapper_function(m.isolate());
5719 TestExternalReferenceFunction<double>(&m, ref, ceil);
5720 }
5721
5722 TEST(RunCallExternalReferenceF64RoundTiesEven) {
5723 BufferedRawMachineAssemblerTester<int32_t> m;
5724 ExternalReference ref =
5725 ExternalReference::f64_nearest_int_wrapper_function(m.isolate());
5726 TestExternalReferenceFunction<double>(&m, ref, nearbyint);
5727 }
5728
5729 #if V8_TARGET_ARCH_64_BIT 5656 #if V8_TARGET_ARCH_64_BIT
5730 // TODO(titzer): run int64 tests on all platforms when supported. 5657 // TODO(titzer): run int64 tests on all platforms when supported.
5731 TEST(RunCheckedLoadInt64) { 5658 TEST(RunCheckedLoadInt64) {
5732 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; 5659 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL};
5733 RawMachineAssemblerTester<int64_t> m(MachineType::Int32()); 5660 RawMachineAssemblerTester<int64_t> m(MachineType::Int32());
5734 Node* base = m.PointerConstant(buffer); 5661 Node* base = m.PointerConstant(buffer);
5735 Node* index = m.Parameter(0); 5662 Node* index = m.Parameter(0);
5736 Node* length = m.Int32Constant(16); 5663 Node* length = m.Int32Constant(16);
5737 Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base, 5664 Node* load = m.AddNode(m.machine()->CheckedLoad(MachineType::Int64()), base,
5738 index, length); 5665 index, length);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
6254 r.Goto(&merge); 6181 r.Goto(&merge);
6255 r.Bind(&merge); 6182 r.Bind(&merge);
6256 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6183 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6257 r.Return(phi); 6184 r.Return(phi);
6258 CHECK_EQ(1, r.Call(1)); 6185 CHECK_EQ(1, r.Call(1));
6259 } 6186 }
6260 6187
6261 } // namespace compiler 6188 } // namespace compiler
6262 } // namespace internal 6189 } // namespace internal
6263 } // namespace v8 6190 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-calls-to-external-references.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698