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/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3883 } | 3883 } |
3884 | 3884 |
3885 | 3885 |
3886 TEST(RunFloat64UnorderedCompare) { | 3886 TEST(RunFloat64UnorderedCompare) { |
3887 RawMachineAssemblerTester<int32_t> m; | 3887 RawMachineAssemblerTester<int32_t> m; |
3888 | 3888 |
3889 const Operator* operators[] = {m.machine()->Float64Equal(), | 3889 const Operator* operators[] = {m.machine()->Float64Equal(), |
3890 m.machine()->Float64LessThan(), | 3890 m.machine()->Float64LessThan(), |
3891 m.machine()->Float64LessThanOrEqual()}; | 3891 m.machine()->Float64LessThanOrEqual()}; |
3892 | 3892 |
3893 double nan = v8::base::OS::nan_value(); | 3893 double nan = std::numeric_limits<double>::quiet_NaN(); |
3894 | 3894 |
3895 FOR_FLOAT64_INPUTS(i) { | 3895 FOR_FLOAT64_INPUTS(i) { |
3896 for (size_t o = 0; o < arraysize(operators); ++o) { | 3896 for (size_t o = 0; o < arraysize(operators); ++o) { |
3897 for (int j = 0; j < 2; j++) { | 3897 for (int j = 0; j < 2; j++) { |
3898 RawMachineAssemblerTester<int32_t> m; | 3898 RawMachineAssemblerTester<int32_t> m; |
3899 Node* a = m.Float64Constant(*i); | 3899 Node* a = m.Float64Constant(*i); |
3900 Node* b = m.Float64Constant(nan); | 3900 Node* b = m.Float64Constant(nan); |
3901 if (j == 1) std::swap(a, b); | 3901 if (j == 1) std::swap(a, b); |
3902 m.Return(m.NewNode(operators[o], a, b)); | 3902 m.Return(m.NewNode(operators[o], a, b)); |
3903 CHECK_EQ(0, m.Call()); | 3903 CHECK_EQ(0, m.Call()); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4378 struct { | 4378 struct { |
4379 double from; | 4379 double from; |
4380 double raw; | 4380 double raw; |
4381 } kValues[] = {{0, 0}, | 4381 } kValues[] = {{0, 0}, |
4382 {0.5, 0}, | 4382 {0.5, 0}, |
4383 {-0.5, 0}, | 4383 {-0.5, 0}, |
4384 {1.5, 1}, | 4384 {1.5, 1}, |
4385 {-1.5, -1}, | 4385 {-1.5, -1}, |
4386 {5.5, 5}, | 4386 {5.5, 5}, |
4387 {-5.0, -5}, | 4387 {-5.0, -5}, |
4388 {v8::base::OS::nan_value(), 0}, | 4388 {std::numeric_limits<double>::quiet_NaN(), 0}, |
4389 {std::numeric_limits<double>::infinity(), 0}, | 4389 {std::numeric_limits<double>::infinity(), 0}, |
4390 {-v8::base::OS::nan_value(), 0}, | 4390 {-std::numeric_limits<double>::quiet_NaN(), 0}, |
4391 {-std::numeric_limits<double>::infinity(), 0}, | 4391 {-std::numeric_limits<double>::infinity(), 0}, |
4392 {4.94065645841e-324, 0}, | 4392 {4.94065645841e-324, 0}, |
4393 {-4.94065645841e-324, 0}, | 4393 {-4.94065645841e-324, 0}, |
4394 {0.9999999999999999, 0}, | 4394 {0.9999999999999999, 0}, |
4395 {-0.9999999999999999, 0}, | 4395 {-0.9999999999999999, 0}, |
4396 {4294967296.0, 0}, | 4396 {4294967296.0, 0}, |
4397 {-4294967296.0, 0}, | 4397 {-4294967296.0, 0}, |
4398 {9223372036854775000.0, 4294966272.0}, | 4398 {9223372036854775000.0, 4294966272.0}, |
4399 {-9223372036854775000.0, -4294966272.0}, | 4399 {-9223372036854775000.0, -4294966272.0}, |
4400 {4.5036e+15, 372629504}, | 4400 {4.5036e+15, 372629504}, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 m.Float64RoundTiesAway(m.LoadFromPointer(&input, kMachFloat64))); | 4682 m.Float64RoundTiesAway(m.LoadFromPointer(&input, kMachFloat64))); |
4683 m.Return(m.Int32Constant(0)); | 4683 m.Return(m.Int32Constant(0)); |
4684 for (size_t i = 0; i < arraysize(kValues); ++i) { | 4684 for (size_t i = 0; i < arraysize(kValues); ++i) { |
4685 input = kValues[i]; | 4685 input = kValues[i]; |
4686 CHECK_EQ(0, m.Call()); | 4686 CHECK_EQ(0, m.Call()); |
4687 double expected = round(kValues[i]); | 4687 double expected = round(kValues[i]); |
4688 CHECK_EQ(expected, result); | 4688 CHECK_EQ(expected, result); |
4689 } | 4689 } |
4690 } | 4690 } |
4691 #endif // V8_TURBOFAN_TARGET | 4691 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |