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 #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 3550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3561 TEST(RunFloat32Sub) { | 3561 TEST(RunFloat32Sub) { |
3562 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), | 3562 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), |
3563 MachineType::Float32()); | 3563 MachineType::Float32()); |
3564 m.Return(m.Float32Sub(m.Parameter(0), m.Parameter(1))); | 3564 m.Return(m.Float32Sub(m.Parameter(0), m.Parameter(1))); |
3565 | 3565 |
3566 FOR_FLOAT32_INPUTS(i) { | 3566 FOR_FLOAT32_INPUTS(i) { |
3567 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*i, *j)); } | 3567 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*i, *j)); } |
3568 } | 3568 } |
3569 } | 3569 } |
3570 | 3570 |
| 3571 TEST(RunFloat32Neg) { |
| 3572 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32()); |
| 3573 if (!m.machine()->Float32Neg().IsSupported()) return; |
| 3574 m.Return(m.AddNode(m.machine()->Float32Neg().op(), m.Parameter(0))); |
| 3575 FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - *i, m.Call(*i)); } |
| 3576 } |
3571 | 3577 |
3572 TEST(RunFloat32Mul) { | 3578 TEST(RunFloat32Mul) { |
3573 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), | 3579 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32(), |
3574 MachineType::Float32()); | 3580 MachineType::Float32()); |
3575 m.Return(m.Float32Mul(m.Parameter(0), m.Parameter(1))); | 3581 m.Return(m.Float32Mul(m.Parameter(0), m.Parameter(1))); |
3576 | 3582 |
3577 FOR_FLOAT32_INPUTS(i) { | 3583 FOR_FLOAT32_INPUTS(i) { |
3578 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*i, *j)); } | 3584 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*i, *j)); } |
3579 } | 3585 } |
3580 } | 3586 } |
(...skipping 24 matching lines...) Expand all Loading... |
3605 TEST(RunFloat64Sub) { | 3611 TEST(RunFloat64Sub) { |
3606 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), | 3612 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), |
3607 MachineType::Float64()); | 3613 MachineType::Float64()); |
3608 m.Return(m.Float64Sub(m.Parameter(0), m.Parameter(1))); | 3614 m.Return(m.Float64Sub(m.Parameter(0), m.Parameter(1))); |
3609 | 3615 |
3610 FOR_FLOAT64_INPUTS(i) { | 3616 FOR_FLOAT64_INPUTS(i) { |
3611 FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i - *j, m.Call(*i, *j)); } | 3617 FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i - *j, m.Call(*i, *j)); } |
3612 } | 3618 } |
3613 } | 3619 } |
3614 | 3620 |
| 3621 TEST(RunFloat64Neg) { |
| 3622 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); |
| 3623 if (!m.machine()->Float64Neg().IsSupported()) return; |
| 3624 m.Return(m.AddNode(m.machine()->Float64Neg().op(), m.Parameter(0))); |
| 3625 FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(-0.0 - *i, m.Call(*i)); } |
| 3626 } |
3615 | 3627 |
3616 TEST(RunFloat64Mul) { | 3628 TEST(RunFloat64Mul) { |
3617 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), | 3629 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64(), |
3618 MachineType::Float64()); | 3630 MachineType::Float64()); |
3619 m.Return(m.Float64Mul(m.Parameter(0), m.Parameter(1))); | 3631 m.Return(m.Float64Mul(m.Parameter(0), m.Parameter(1))); |
3620 | 3632 |
3621 FOR_FLOAT64_INPUTS(i) { | 3633 FOR_FLOAT64_INPUTS(i) { |
3622 FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i * *j, m.Call(*i, *j)); } | 3634 FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i * *j, m.Call(*i, *j)); } |
3623 } | 3635 } |
3624 } | 3636 } |
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6246 r.Goto(&merge); | 6258 r.Goto(&merge); |
6247 r.Bind(&merge); | 6259 r.Bind(&merge); |
6248 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6260 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6249 r.Return(phi); | 6261 r.Return(phi); |
6250 CHECK_EQ(1, r.Call(1)); | 6262 CHECK_EQ(1, r.Call(1)); |
6251 } | 6263 } |
6252 | 6264 |
6253 } // namespace compiler | 6265 } // namespace compiler |
6254 } // namespace internal | 6266 } // namespace internal |
6255 } // namespace v8 | 6267 } // namespace v8 |
OLD | NEW |