OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the 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 4848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4859 double actual = 0.0f; | 4859 double actual = 0.0f; |
4860 float expected = 0.0; | 4860 float expected = 0.0; |
4861 RawMachineAssemblerTester<int32_t> m; | 4861 RawMachineAssemblerTester<int32_t> m; |
4862 m.StoreToPointer( | 4862 m.StoreToPointer( |
4863 &actual, kMachFloat64, | 4863 &actual, kMachFloat64, |
4864 m.ChangeFloat32ToFloat64(m.LoadFromPointer(&expected, kMachFloat32))); | 4864 m.ChangeFloat32ToFloat64(m.LoadFromPointer(&expected, kMachFloat32))); |
4865 m.Return(m.Int32Constant(0)); | 4865 m.Return(m.Int32Constant(0)); |
4866 FOR_FLOAT32_INPUTS(i) { | 4866 FOR_FLOAT32_INPUTS(i) { |
4867 expected = *i; | 4867 expected = *i; |
4868 CHECK_EQ(0, m.Call()); | 4868 CHECK_EQ(0, m.Call()); |
4869 CHECK_EQ(expected, actual); | 4869 CHECK_EQ(static_cast<double>(expected), actual); |
4870 } | 4870 } |
4871 } | 4871 } |
4872 | 4872 |
4873 | 4873 |
4874 TEST(RunChangeFloat32ToFloat64_spilled) { | 4874 TEST(RunChangeFloat32ToFloat64_spilled) { |
4875 RawMachineAssemblerTester<int32_t> m; | 4875 RawMachineAssemblerTester<int32_t> m; |
4876 const int kNumInputs = 32; | 4876 const int kNumInputs = 32; |
4877 int32_t magic = 0x786234; | 4877 int32_t magic = 0x786234; |
4878 float input[kNumInputs]; | 4878 float input[kNumInputs]; |
4879 double result[kNumInputs]; | 4879 double result[kNumInputs]; |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 c->CalleeSavedRegisters(), // callee saved | 5429 c->CalleeSavedRegisters(), // callee saved |
5430 c->CalleeSavedFPRegisters(), // callee saved FP | 5430 c->CalleeSavedFPRegisters(), // callee saved FP |
5431 CallDescriptor::kNoFlags, // flags | 5431 CallDescriptor::kNoFlags, // flags |
5432 "c-call-as-code"); | 5432 "c-call-as-code"); |
5433 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5433 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5434 r.Return(call); | 5434 r.Return(call); |
5435 | 5435 |
5436 CHECK_EQ(33, r.Call(1)); | 5436 CHECK_EQ(33, r.Call(1)); |
5437 CHECK_EQ(44, r.Call(0)); | 5437 CHECK_EQ(44, r.Call(0)); |
5438 } | 5438 } |
OLD | NEW |