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 5470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5481 &output, kMachInt64, | 5481 &output, kMachInt64, |
5482 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); | 5482 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); |
5483 m.Return(m.Int32Constant(11)); | 5483 m.Return(m.Int32Constant(11)); |
5484 FOR_FLOAT64_INPUTS(i) { | 5484 FOR_FLOAT64_INPUTS(i) { |
5485 input = *i; | 5485 input = *i; |
5486 CHECK_EQ(11, m.Call()); | 5486 CHECK_EQ(11, m.Call()); |
5487 double expected = bit_cast<int64_t>(input); | 5487 double expected = bit_cast<int64_t>(input); |
5488 CHECK_EQ(expected, output); | 5488 CHECK_EQ(expected, output); |
5489 } | 5489 } |
5490 } | 5490 } |
| 5491 |
| 5492 |
| 5493 TEST(RunRoundInt64ToFloat64) { |
| 5494 BufferedRawMachineAssemblerTester<double> m(kMachInt64); |
| 5495 m.Return(m.RoundInt64ToFloat64(m.Parameter(0))); |
| 5496 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); } |
| 5497 } |
| 5498 |
| 5499 |
5491 #endif | 5500 #endif |
5492 | 5501 |
5493 | 5502 |
5494 TEST(RunBitcastFloat32ToInt32) { | 5503 TEST(RunBitcastFloat32ToInt32) { |
5495 float input = 32.25; | 5504 float input = 32.25; |
5496 RawMachineAssemblerTester<int32_t> m; | 5505 RawMachineAssemblerTester<int32_t> m; |
5497 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); | 5506 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); |
5498 FOR_FLOAT32_INPUTS(i) { | 5507 FOR_FLOAT32_INPUTS(i) { |
5499 input = *i; | 5508 input = *i; |
5500 int32_t expected = bit_cast<int32_t>(input); | 5509 int32_t expected = bit_cast<int32_t>(input); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5566 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5575 Node* call = r.AddNode(r.common()->Call(desc), phi); |
5567 r.Return(call); | 5576 r.Return(call); |
5568 | 5577 |
5569 CHECK_EQ(33, r.Call(1)); | 5578 CHECK_EQ(33, r.Call(1)); |
5570 CHECK_EQ(44, r.Call(0)); | 5579 CHECK_EQ(44, r.Call(0)); |
5571 } | 5580 } |
5572 | 5581 |
5573 } // namespace compiler | 5582 } // namespace compiler |
5574 } // namespace internal | 5583 } // namespace internal |
5575 } // namespace v8 | 5584 } // namespace v8 |
OLD | NEW |