Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 2490973002: [turbofan] Fix -Wsign-compare warnings. (Closed)
Patch Set: fix dcheck Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-run-load-store.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ieee754.h" 10 #include "src/base/ieee754.h"
(...skipping 4153 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 TEST(RunInt32PairAddUseOnlyHighWord) { 4164 TEST(RunInt32PairAddUseOnlyHighWord) {
4165 BufferedRawMachineAssemblerTester<int32_t> m( 4165 BufferedRawMachineAssemblerTester<int32_t> m(
4166 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), 4166 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
4167 MachineType::Uint32()); 4167 MachineType::Uint32());
4168 4168
4169 m.Return(m.Projection(1, m.Int32PairAdd(m.Parameter(0), m.Parameter(1), 4169 m.Return(m.Projection(1, m.Int32PairAdd(m.Parameter(0), m.Parameter(1),
4170 m.Parameter(2), m.Parameter(3)))); 4170 m.Parameter(2), m.Parameter(3))));
4171 4171
4172 FOR_UINT64_INPUTS(i) { 4172 FOR_UINT64_INPUTS(i) {
4173 FOR_UINT64_INPUTS(j) { 4173 FOR_UINT64_INPUTS(j) {
4174 CHECK_EQ(static_cast<uint32_t>((*i + *j) >> 32), 4174 CHECK_EQ(
4175 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4175 static_cast<uint32_t>((*i + *j) >> 32),
4176 static_cast<uint32_t>(*i >> 32), 4176 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4177 static_cast<uint32_t>(*j & 0xffffffff), 4177 static_cast<uint32_t>(*i >> 32),
4178 static_cast<uint32_t>(*j >> 32))); 4178 static_cast<uint32_t>(*j & 0xffffffff),
4179 static_cast<uint32_t>(*j >> 32))));
4179 } 4180 }
4180 } 4181 }
4181 } 4182 }
4182 4183
4183 void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) { 4184 void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) {
4184 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), 4185 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
4185 MachineType::Uint32()); 4186 MachineType::Uint32());
4186 4187
4187 uint32_t high; 4188 uint32_t high;
4188 uint32_t low; 4189 uint32_t low;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4246 TEST(RunInt32PairSubUseOnlyHighWord) { 4247 TEST(RunInt32PairSubUseOnlyHighWord) {
4247 BufferedRawMachineAssemblerTester<int32_t> m( 4248 BufferedRawMachineAssemblerTester<int32_t> m(
4248 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), 4249 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
4249 MachineType::Uint32()); 4250 MachineType::Uint32());
4250 4251
4251 m.Return(m.Projection(1, m.Int32PairSub(m.Parameter(0), m.Parameter(1), 4252 m.Return(m.Projection(1, m.Int32PairSub(m.Parameter(0), m.Parameter(1),
4252 m.Parameter(2), m.Parameter(3)))); 4253 m.Parameter(2), m.Parameter(3))));
4253 4254
4254 FOR_UINT64_INPUTS(i) { 4255 FOR_UINT64_INPUTS(i) {
4255 FOR_UINT64_INPUTS(j) { 4256 FOR_UINT64_INPUTS(j) {
4256 CHECK_EQ(static_cast<uint32_t>((*i - *j) >> 32), 4257 CHECK_EQ(
4257 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4258 static_cast<uint32_t>((*i - *j) >> 32),
4258 static_cast<uint32_t>(*i >> 32), 4259 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4259 static_cast<uint32_t>(*j & 0xffffffff), 4260 static_cast<uint32_t>(*i >> 32),
4260 static_cast<uint32_t>(*j >> 32))); 4261 static_cast<uint32_t>(*j & 0xffffffff),
4262 static_cast<uint32_t>(*j >> 32))));
4261 } 4263 }
4262 } 4264 }
4263 } 4265 }
4264 4266
4265 void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) { 4267 void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) {
4266 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), 4268 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
4267 MachineType::Uint32()); 4269 MachineType::Uint32());
4268 4270
4269 uint32_t high; 4271 uint32_t high;
4270 uint32_t low; 4272 uint32_t low;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 TEST(RunInt32PairMulUseOnlyHighWord) { 4330 TEST(RunInt32PairMulUseOnlyHighWord) {
4329 BufferedRawMachineAssemblerTester<int32_t> m( 4331 BufferedRawMachineAssemblerTester<int32_t> m(
4330 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), 4332 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(),
4331 MachineType::Uint32()); 4333 MachineType::Uint32());
4332 4334
4333 m.Return(m.Projection(1, m.Int32PairMul(m.Parameter(0), m.Parameter(1), 4335 m.Return(m.Projection(1, m.Int32PairMul(m.Parameter(0), m.Parameter(1),
4334 m.Parameter(2), m.Parameter(3)))); 4336 m.Parameter(2), m.Parameter(3))));
4335 4337
4336 FOR_UINT64_INPUTS(i) { 4338 FOR_UINT64_INPUTS(i) {
4337 FOR_UINT64_INPUTS(j) { 4339 FOR_UINT64_INPUTS(j) {
4338 CHECK_EQ(static_cast<uint32_t>((*i * *j) >> 32), 4340 CHECK_EQ(
4339 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4341 static_cast<uint32_t>((*i * *j) >> 32),
4340 static_cast<uint32_t>(*i >> 32), 4342 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4341 static_cast<uint32_t>(*j & 0xffffffff), 4343 static_cast<uint32_t>(*i >> 32),
4342 static_cast<uint32_t>(*j >> 32))); 4344 static_cast<uint32_t>(*j & 0xffffffff),
4345 static_cast<uint32_t>(*j >> 32))));
4343 } 4346 }
4344 } 4347 }
4345 } 4348 }
4346 4349
4347 void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) { 4350 void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) {
4348 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), 4351 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
4349 MachineType::Uint32()); 4352 MachineType::Uint32());
4350 4353
4351 uint32_t high; 4354 uint32_t high;
4352 uint32_t low; 4355 uint32_t low;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 4410
4408 TEST(RunWord32PairShlUseOnlyHighWord) { 4411 TEST(RunWord32PairShlUseOnlyHighWord) {
4409 BufferedRawMachineAssemblerTester<int32_t> m( 4412 BufferedRawMachineAssemblerTester<int32_t> m(
4410 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); 4413 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
4411 4414
4412 m.Return(m.Projection( 4415 m.Return(m.Projection(
4413 1, m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); 4416 1, m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2))));
4414 4417
4415 FOR_UINT64_INPUTS(i) { 4418 FOR_UINT64_INPUTS(i) {
4416 for (uint32_t j = 0; j < 64; j++) { 4419 for (uint32_t j = 0; j < 64; j++) {
4417 CHECK_EQ(static_cast<uint32_t>((*i << j) >> 32), 4420 CHECK_EQ(
4418 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4421 static_cast<uint32_t>((*i << j) >> 32),
4419 static_cast<uint32_t>(*i >> 32), j)); 4422 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4423 static_cast<uint32_t>(*i >> 32), j)));
4420 } 4424 }
4421 } 4425 }
4422 } 4426 }
4423 4427
4424 void TestWord32PairShlWithSharedInput(int a, int b) { 4428 void TestWord32PairShlWithSharedInput(int a, int b) {
4425 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), 4429 BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(),
4426 MachineType::Uint32()); 4430 MachineType::Uint32());
4427 4431
4428 uint32_t high; 4432 uint32_t high;
4429 uint32_t low; 4433 uint32_t low;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4480 4484
4481 TEST(RunWord32PairShrUseOnlyHighWord) { 4485 TEST(RunWord32PairShrUseOnlyHighWord) {
4482 BufferedRawMachineAssemblerTester<int32_t> m( 4486 BufferedRawMachineAssemblerTester<int32_t> m(
4483 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); 4487 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
4484 4488
4485 m.Return(m.Projection( 4489 m.Return(m.Projection(
4486 1, m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); 4490 1, m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2))));
4487 4491
4488 FOR_UINT64_INPUTS(i) { 4492 FOR_UINT64_INPUTS(i) {
4489 for (uint32_t j = 0; j < 64; j++) { 4493 for (uint32_t j = 0; j < 64; j++) {
4490 CHECK_EQ(static_cast<uint32_t>((*i >> j) >> 32), 4494 CHECK_EQ(
4491 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4495 static_cast<uint32_t>((*i >> j) >> 32),
4492 static_cast<uint32_t>(*i >> 32), j)); 4496 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4497 static_cast<uint32_t>(*i >> 32), j)));
4493 } 4498 }
4494 } 4499 }
4495 } 4500 }
4496 4501
4497 TEST(RunWord32PairSar) { 4502 TEST(RunWord32PairSar) {
4498 BufferedRawMachineAssemblerTester<int32_t> m( 4503 BufferedRawMachineAssemblerTester<int32_t> m(
4499 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); 4504 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
4500 4505
4501 uint32_t high; 4506 uint32_t high;
4502 uint32_t low; 4507 uint32_t low;
4503 4508
4504 Node* PairAdd = 4509 Node* PairAdd =
4505 m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2)); 4510 m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2));
4506 4511
4507 m.StoreToPointer(&low, MachineRepresentation::kWord32, 4512 m.StoreToPointer(&low, MachineRepresentation::kWord32,
4508 m.Projection(0, PairAdd)); 4513 m.Projection(0, PairAdd));
4509 m.StoreToPointer(&high, MachineRepresentation::kWord32, 4514 m.StoreToPointer(&high, MachineRepresentation::kWord32,
4510 m.Projection(1, PairAdd)); 4515 m.Projection(1, PairAdd));
4511 m.Return(m.Int32Constant(74)); 4516 m.Return(m.Int32Constant(74));
4512 4517
4513 FOR_INT64_INPUTS(i) { 4518 FOR_INT64_INPUTS(i) {
4514 for (uint32_t j = 0; j < 64; j++) { 4519 for (uint32_t j = 0; j < 64; j++) {
4515 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4520 m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4516 static_cast<uint32_t>(*i >> 32), j); 4521 static_cast<uint32_t>(*i >> 32), j);
4517 CHECK_EQ(*i >> j, ToInt64(low, high)); 4522 CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high)));
4518 } 4523 }
4519 } 4524 }
4520 } 4525 }
4521 4526
4522 TEST(RunWord32PairSarUseOnlyHighWord) { 4527 TEST(RunWord32PairSarUseOnlyHighWord) {
4523 BufferedRawMachineAssemblerTester<int32_t> m( 4528 BufferedRawMachineAssemblerTester<int32_t> m(
4524 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); 4529 MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
4525 4530
4526 m.Return(m.Projection( 4531 m.Return(m.Projection(
4527 1, m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); 4532 1, m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2))));
4528 4533
4529 FOR_INT64_INPUTS(i) { 4534 FOR_INT64_INPUTS(i) {
4530 for (uint32_t j = 0; j < 64; j++) { 4535 for (uint32_t j = 0; j < 64; j++) {
4531 CHECK_EQ(static_cast<uint32_t>((*i >> j) >> 32), 4536 CHECK_EQ(
4532 m.Call(static_cast<uint32_t>(*i & 0xffffffff), 4537 static_cast<uint32_t>((*i >> j) >> 32),
4533 static_cast<uint32_t>(*i >> 32), j)); 4538 static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff),
4539 static_cast<uint32_t>(*i >> 32), j)));
4534 } 4540 }
4535 } 4541 }
4536 } 4542 }
4537 #endif 4543 #endif
4538 4544
4539 TEST(RunDeadChangeFloat64ToInt32) { 4545 TEST(RunDeadChangeFloat64ToInt32) {
4540 RawMachineAssemblerTester<int32_t> m; 4546 RawMachineAssemblerTester<int32_t> m;
4541 const int magic = 0x88abcda4; 4547 const int magic = 0x88abcda4;
4542 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); 4548 m.ChangeFloat64ToInt32(m.Float64Constant(999.78));
4543 m.Return(m.Int32Constant(magic)); 4549 m.Return(m.Int32Constant(magic));
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
6675 r.Goto(&merge); 6681 r.Goto(&merge);
6676 r.Bind(&merge); 6682 r.Bind(&merge);
6677 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6683 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6678 r.Return(phi); 6684 r.Return(phi);
6679 CHECK_EQ(1, r.Call(1)); 6685 CHECK_EQ(1, r.Call(1));
6680 } 6686 }
6681 6687
6682 } // namespace compiler 6688 } // namespace compiler
6683 } // namespace internal 6689 } // namespace internal
6684 } // namespace v8 6690 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-load-store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698