| OLD | NEW |
| 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 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 5468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5479 &output, kMachInt64, | 5479 &output, kMachInt64, |
| 5480 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); | 5480 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); |
| 5481 m.Return(m.Int32Constant(11)); | 5481 m.Return(m.Int32Constant(11)); |
| 5482 FOR_FLOAT64_INPUTS(i) { | 5482 FOR_FLOAT64_INPUTS(i) { |
| 5483 input = *i; | 5483 input = *i; |
| 5484 CHECK_EQ(11, m.Call()); | 5484 CHECK_EQ(11, m.Call()); |
| 5485 double expected = bit_cast<int64_t>(input); | 5485 double expected = bit_cast<int64_t>(input); |
| 5486 CHECK_EQ(expected, output); | 5486 CHECK_EQ(expected, output); |
| 5487 } | 5487 } |
| 5488 } | 5488 } |
| 5489 |
| 5490 |
| 5491 TEST(RunChangeInt64ToFloat64) { |
| 5492 BufferedRawMachineAssemblerTester<double> m(kMachInt64); |
| 5493 m.Return(m.ChangeInt64ToFloat64(m.Parameter(0))); |
| 5494 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); } |
| 5495 } |
| 5496 |
| 5497 |
| 5489 #endif | 5498 #endif |
| 5490 | 5499 |
| 5491 | 5500 |
| 5492 TEST(RunBitcastFloat32ToInt32) { | 5501 TEST(RunBitcastFloat32ToInt32) { |
| 5493 float input = 32.25; | 5502 float input = 32.25; |
| 5494 RawMachineAssemblerTester<int32_t> m; | 5503 RawMachineAssemblerTester<int32_t> m; |
| 5495 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); | 5504 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); |
| 5496 FOR_FLOAT32_INPUTS(i) { | 5505 FOR_FLOAT32_INPUTS(i) { |
| 5497 input = *i; | 5506 input = *i; |
| 5498 int32_t expected = bit_cast<int32_t>(input); | 5507 int32_t expected = bit_cast<int32_t>(input); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 c->CalleeSavedRegisters(), // callee saved | 5569 c->CalleeSavedRegisters(), // callee saved |
| 5561 c->CalleeSavedFPRegisters(), // callee saved FP | 5570 c->CalleeSavedFPRegisters(), // callee saved FP |
| 5562 CallDescriptor::kNoFlags, // flags | 5571 CallDescriptor::kNoFlags, // flags |
| 5563 "c-call-as-code"); | 5572 "c-call-as-code"); |
| 5564 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5573 Node* call = r.AddNode(r.common()->Call(desc), phi); |
| 5565 r.Return(call); | 5574 r.Return(call); |
| 5566 | 5575 |
| 5567 CHECK_EQ(33, r.Call(1)); | 5576 CHECK_EQ(33, r.Call(1)); |
| 5568 CHECK_EQ(44, r.Call(0)); | 5577 CHECK_EQ(44, r.Call(0)); |
| 5569 } | 5578 } |
| OLD | NEW |