| 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 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5377 &output, kMachInt64, | 5377 &output, kMachInt64, |
| 5378 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); | 5378 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); |
| 5379 m.Return(m.Int32Constant(11)); | 5379 m.Return(m.Int32Constant(11)); |
| 5380 FOR_FLOAT64_INPUTS(i) { | 5380 FOR_FLOAT64_INPUTS(i) { |
| 5381 input = *i; | 5381 input = *i; |
| 5382 CHECK_EQ(11, m.Call()); | 5382 CHECK_EQ(11, m.Call()); |
| 5383 double expected = bit_cast<int64_t>(input); | 5383 double expected = bit_cast<int64_t>(input); |
| 5384 CHECK_EQ(expected, output); | 5384 CHECK_EQ(expected, output); |
| 5385 } | 5385 } |
| 5386 } | 5386 } |
| 5387 |
| 5388 |
| 5389 TEST(RunRoundInt64ToFloat64) { |
| 5390 BufferedRawMachineAssemblerTester<double> m(kMachInt64); |
| 5391 m.Return(m.RoundInt64ToFloat64(m.Parameter(0))); |
| 5392 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); } |
| 5393 } |
| 5394 |
| 5395 |
| 5387 #endif | 5396 #endif |
| 5388 | 5397 |
| 5389 | 5398 |
| 5390 TEST(RunBitcastFloat32ToInt32) { | 5399 TEST(RunBitcastFloat32ToInt32) { |
| 5391 float input = 32.25; | 5400 float input = 32.25; |
| 5392 RawMachineAssemblerTester<int32_t> m; | 5401 RawMachineAssemblerTester<int32_t> m; |
| 5393 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); | 5402 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); |
| 5394 FOR_FLOAT32_INPUTS(i) { | 5403 FOR_FLOAT32_INPUTS(i) { |
| 5395 input = *i; | 5404 input = *i; |
| 5396 int32_t expected = bit_cast<int32_t>(input); | 5405 int32_t expected = bit_cast<int32_t>(input); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5462 Node* call = r.AddNode(r.common()->Call(desc), phi); | 5471 Node* call = r.AddNode(r.common()->Call(desc), phi); |
| 5463 r.Return(call); | 5472 r.Return(call); |
| 5464 | 5473 |
| 5465 CHECK_EQ(33, r.Call(1)); | 5474 CHECK_EQ(33, r.Call(1)); |
| 5466 CHECK_EQ(44, r.Call(0)); | 5475 CHECK_EQ(44, r.Call(0)); |
| 5467 } | 5476 } |
| 5468 | 5477 |
| 5469 } // namespace compiler | 5478 } // namespace compiler |
| 5470 } // namespace internal | 5479 } // namespace internal |
| 5471 } // namespace v8 | 5480 } // namespace v8 |
| OLD | NEW |