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 6145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6156 FOR_INT32_INPUTS(i) { | 6156 FOR_INT32_INPUTS(i) { |
6157 volatile float expected = static_cast<float>(*i); | 6157 volatile float expected = static_cast<float>(*i); |
6158 CHECK_EQ(expected, m.Call(*i)); | 6158 CHECK_EQ(expected, m.Call(*i)); |
6159 } | 6159 } |
6160 } | 6160 } |
6161 | 6161 |
6162 | 6162 |
6163 TEST(RunRoundUint32ToFloat32) { | 6163 TEST(RunRoundUint32ToFloat32) { |
6164 BufferedRawMachineAssemblerTester<float> m(MachineType::Uint32()); | 6164 BufferedRawMachineAssemblerTester<float> m(MachineType::Uint32()); |
6165 m.Return(m.RoundUint32ToFloat32(m.Parameter(0))); | 6165 m.Return(m.RoundUint32ToFloat32(m.Parameter(0))); |
6166 FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } | 6166 FOR_UINT32_INPUTS(i) { |
| 6167 volatile float expected = static_cast<float>(*i); |
| 6168 CHECK_EQ(expected, m.Call(*i)); |
| 6169 } |
6167 } | 6170 } |
6168 | 6171 |
6169 | 6172 |
6170 TEST(RunBitcastInt32ToFloat32) { | 6173 TEST(RunBitcastInt32ToFloat32) { |
6171 int32_t input = 1; | 6174 int32_t input = 1; |
6172 float output = 0.0; | 6175 float output = 0.0; |
6173 RawMachineAssemblerTester<int32_t> m; | 6176 RawMachineAssemblerTester<int32_t> m; |
6174 m.StoreToPointer( | 6177 m.StoreToPointer( |
6175 &output, MachineRepresentation::kFloat32, | 6178 &output, MachineRepresentation::kFloat32, |
6176 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32()))); | 6179 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32()))); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6251 r.Goto(&merge); | 6254 r.Goto(&merge); |
6252 r.Bind(&merge); | 6255 r.Bind(&merge); |
6253 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6256 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6254 r.Return(phi); | 6257 r.Return(phi); |
6255 CHECK_EQ(1, r.Call(1)); | 6258 CHECK_EQ(1, r.Call(1)); |
6256 } | 6259 } |
6257 | 6260 |
6258 } // namespace compiler | 6261 } // namespace compiler |
6259 } // namespace internal | 6262 } // namespace internal |
6260 } // namespace v8 | 6263 } // namespace v8 |
OLD | NEW |