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 6002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6013 } | 6013 } |
6014 | 6014 |
6015 | 6015 |
6016 TEST(RunRoundInt32ToFloat32) { | 6016 TEST(RunRoundInt32ToFloat32) { |
6017 BufferedRawMachineAssemblerTester<float> m(MachineType::Int32()); | 6017 BufferedRawMachineAssemblerTester<float> m(MachineType::Int32()); |
6018 m.Return(m.RoundInt32ToFloat32(m.Parameter(0))); | 6018 m.Return(m.RoundInt32ToFloat32(m.Parameter(0))); |
6019 FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } | 6019 FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } |
6020 } | 6020 } |
6021 | 6021 |
6022 | 6022 |
| 6023 TEST(RunRoundUint32ToFloat32) { |
| 6024 BufferedRawMachineAssemblerTester<float> m(MachineType::Uint32()); |
| 6025 m.Return(m.RoundUint32ToFloat32(m.Parameter(0))); |
| 6026 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } |
| 6027 } |
| 6028 |
| 6029 |
6023 TEST(RunBitcastInt32ToFloat32) { | 6030 TEST(RunBitcastInt32ToFloat32) { |
6024 int32_t input = 1; | 6031 int32_t input = 1; |
6025 float output = 0.0; | 6032 float output = 0.0; |
6026 RawMachineAssemblerTester<int32_t> m; | 6033 RawMachineAssemblerTester<int32_t> m; |
6027 m.StoreToPointer( | 6034 m.StoreToPointer( |
6028 &output, MachineRepresentation::kFloat32, | 6035 &output, MachineRepresentation::kFloat32, |
6029 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32()))); | 6036 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32()))); |
6030 m.Return(m.Int32Constant(11)); | 6037 m.Return(m.Int32Constant(11)); |
6031 FOR_INT32_INPUTS(i) { | 6038 FOR_INT32_INPUTS(i) { |
6032 input = *i; | 6039 input = *i; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6083 Node* call = r.AddNode(r.common()->Call(desc), phi); | 6090 Node* call = r.AddNode(r.common()->Call(desc), phi); |
6084 r.Return(call); | 6091 r.Return(call); |
6085 | 6092 |
6086 CHECK_EQ(33, r.Call(1)); | 6093 CHECK_EQ(33, r.Call(1)); |
6087 CHECK_EQ(44, r.Call(0)); | 6094 CHECK_EQ(44, r.Call(0)); |
6088 } | 6095 } |
6089 | 6096 |
6090 } // namespace compiler | 6097 } // namespace compiler |
6091 } // namespace internal | 6098 } // namespace internal |
6092 } // namespace v8 | 6099 } // namespace v8 |
OLD | NEW |