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 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4378 } | 4378 } |
4379 } | 4379 } |
4380 | 4380 |
4381 TEST(RunWord32PairShlWithSharedInput) { | 4381 TEST(RunWord32PairShlWithSharedInput) { |
4382 TestWord32PairShlWithSharedInput(0, 0); | 4382 TestWord32PairShlWithSharedInput(0, 0); |
4383 TestWord32PairShlWithSharedInput(0, 1); | 4383 TestWord32PairShlWithSharedInput(0, 1); |
4384 TestWord32PairShlWithSharedInput(1, 0); | 4384 TestWord32PairShlWithSharedInput(1, 0); |
4385 TestWord32PairShlWithSharedInput(1, 1); | 4385 TestWord32PairShlWithSharedInput(1, 1); |
4386 } | 4386 } |
4387 | 4387 |
| 4388 TEST(RunWord32PairShr) { |
| 4389 BufferedRawMachineAssemblerTester<int32_t> m( |
| 4390 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); |
| 4391 |
| 4392 uint32_t high; |
| 4393 uint32_t low; |
| 4394 |
| 4395 Node* PairAdd = |
| 4396 m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2)); |
| 4397 |
| 4398 m.StoreToPointer(&low, MachineRepresentation::kWord32, |
| 4399 m.Projection(0, PairAdd)); |
| 4400 m.StoreToPointer(&high, MachineRepresentation::kWord32, |
| 4401 m.Projection(1, PairAdd)); |
| 4402 m.Return(m.Int32Constant(74)); |
| 4403 |
| 4404 FOR_UINT64_INPUTS(i) { |
| 4405 for (uint32_t j = 0; j < 64; j++) { |
| 4406 m.Call(static_cast<uint32_t>(*i & 0xffffffff), |
| 4407 static_cast<uint32_t>(*i >> 32), j); |
| 4408 CHECK_EQ(*i >> j, ToInt64(low, high)); |
| 4409 } |
| 4410 } |
| 4411 } |
| 4412 |
| 4413 TEST(RunWord32PairSar) { |
| 4414 BufferedRawMachineAssemblerTester<int32_t> m( |
| 4415 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); |
| 4416 |
| 4417 uint32_t high; |
| 4418 uint32_t low; |
| 4419 |
| 4420 Node* PairAdd = |
| 4421 m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2)); |
| 4422 |
| 4423 m.StoreToPointer(&low, MachineRepresentation::kWord32, |
| 4424 m.Projection(0, PairAdd)); |
| 4425 m.StoreToPointer(&high, MachineRepresentation::kWord32, |
| 4426 m.Projection(1, PairAdd)); |
| 4427 m.Return(m.Int32Constant(74)); |
| 4428 |
| 4429 FOR_INT64_INPUTS(i) { |
| 4430 for (uint32_t j = 0; j < 64; j++) { |
| 4431 m.Call(static_cast<uint32_t>(*i & 0xffffffff), |
| 4432 static_cast<uint32_t>(*i >> 32), j); |
| 4433 CHECK_EQ(*i >> j, ToInt64(low, high)); |
| 4434 } |
| 4435 } |
| 4436 } |
| 4437 |
4388 #endif | 4438 #endif |
4389 | 4439 |
4390 TEST(RunDeadChangeFloat64ToInt32) { | 4440 TEST(RunDeadChangeFloat64ToInt32) { |
4391 RawMachineAssemblerTester<int32_t> m; | 4441 RawMachineAssemblerTester<int32_t> m; |
4392 const int magic = 0x88abcda4; | 4442 const int magic = 0x88abcda4; |
4393 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); | 4443 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); |
4394 m.Return(m.Int32Constant(magic)); | 4444 m.Return(m.Int32Constant(magic)); |
4395 CHECK_EQ(magic, m.Call()); | 4445 CHECK_EQ(magic, m.Call()); |
4396 } | 4446 } |
4397 | 4447 |
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6316 r.Goto(&merge); | 6366 r.Goto(&merge); |
6317 r.Bind(&merge); | 6367 r.Bind(&merge); |
6318 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); | 6368 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); |
6319 r.Return(phi); | 6369 r.Return(phi); |
6320 CHECK_EQ(1, r.Call(1)); | 6370 CHECK_EQ(1, r.Call(1)); |
6321 } | 6371 } |
6322 | 6372 |
6323 } // namespace compiler | 6373 } // namespace compiler |
6324 } // namespace internal | 6374 } // namespace internal |
6325 } // namespace v8 | 6375 } // namespace v8 |
OLD | NEW |