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

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

Issue 1435203003: [x64] Fixed a rounding error on x64 for the Uint64ToF64 conversion. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed the test to make it platform independent. Created 5 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 | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | 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 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after
5377 TEST(RunRoundInt64ToFloat64) { 5377 TEST(RunRoundInt64ToFloat64) {
5378 BufferedRawMachineAssemblerTester<double> m(kMachInt64); 5378 BufferedRawMachineAssemblerTester<double> m(kMachInt64);
5379 m.Return(m.RoundInt64ToFloat64(m.Parameter(0))); 5379 m.Return(m.RoundInt64ToFloat64(m.Parameter(0)));
5380 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); } 5380 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); }
5381 } 5381 }
5382 5382
5383 5383
5384 TEST(RunRoundUint64ToFloat64) { 5384 TEST(RunRoundUint64ToFloat64) {
5385 BufferedRawMachineAssemblerTester<double> m(kMachUint64); 5385 BufferedRawMachineAssemblerTester<double> m(kMachUint64);
5386 m.Return(m.RoundUint64ToFloat64(m.Parameter(0))); 5386 m.Return(m.RoundUint64ToFloat64(m.Parameter(0)));
5387 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); } 5387
5388 CHECK_EQ(bit_cast<double>(uint64_t(0x0000000000000000)),
5389 m.Call(uint64_t(0x0000000000000000)));
5390 CHECK_EQ(bit_cast<double>(uint64_t(0x3ff0000000000000)),
5391 m.Call(uint64_t(0x0000000000000001)));
5392 CHECK_EQ(bit_cast<double>(uint64_t(0x41efffffffe00000)),
5393 m.Call(uint64_t(0x00000000ffffffff)));
5394 CHECK_EQ(bit_cast<double>(uint64_t(0x41bb09788b000000)),
5395 m.Call(uint64_t(0x000000001b09788b)));
5396 CHECK_EQ(bit_cast<double>(uint64_t(0x419317f3a0000000)),
5397 m.Call(uint64_t(0x0000000004c5fce8)));
5398 CHECK_EQ(bit_cast<double>(uint64_t(0x41e981bcb7e00000)),
5399 m.Call(uint64_t(0x00000000cc0de5bf)));
5400 CHECK_EQ(bit_cast<double>(uint64_t(0x4000000000000000)),
5401 m.Call(uint64_t(0x0000000000000002)));
5402 CHECK_EQ(bit_cast<double>(uint64_t(0x4008000000000000)),
5403 m.Call(uint64_t(0x0000000000000003)));
5404 CHECK_EQ(bit_cast<double>(uint64_t(0x4010000000000000)),
5405 m.Call(uint64_t(0x0000000000000004)));
5406 CHECK_EQ(bit_cast<double>(uint64_t(0x4014000000000000)),
5407 m.Call(uint64_t(0x0000000000000005)));
5408 CHECK_EQ(bit_cast<double>(uint64_t(0x4020000000000000)),
5409 m.Call(uint64_t(0x0000000000000008)));
5410 CHECK_EQ(bit_cast<double>(uint64_t(0x4022000000000000)),
5411 m.Call(uint64_t(0x0000000000000009)));
5412 CHECK_EQ(bit_cast<double>(uint64_t(0x43f0000000000000)),
5413 m.Call(uint64_t(0xffffffffffffffff)));
5414 CHECK_EQ(bit_cast<double>(uint64_t(0x43f0000000000000)),
5415 m.Call(uint64_t(0xfffffffffffffffe)));
5416 CHECK_EQ(bit_cast<double>(uint64_t(0x43f0000000000000)),
5417 m.Call(uint64_t(0xfffffffffffffffd)));
5418 CHECK_EQ(bit_cast<double>(uint64_t(0x0000000000000000)),
5419 m.Call(uint64_t(0x0000000000000000)));
5420 CHECK_EQ(bit_cast<double>(uint64_t(0x41f0000000000000)),
5421 m.Call(uint64_t(0x0000000100000000)));
5422 CHECK_EQ(bit_cast<double>(uint64_t(0x43efffffffe00000)),
5423 m.Call(uint64_t(0xffffffff00000000)));
5424 CHECK_EQ(bit_cast<double>(uint64_t(0x43bb09788b000000)),
5425 m.Call(uint64_t(0x1b09788b00000000)));
5426 CHECK_EQ(bit_cast<double>(uint64_t(0x439317f3a0000000)),
5427 m.Call(uint64_t(0x04c5fce800000000)));
5428 CHECK_EQ(bit_cast<double>(uint64_t(0x43e981bcb7e00000)),
5429 m.Call(uint64_t(0xcc0de5bf00000000)));
5430 CHECK_EQ(bit_cast<double>(uint64_t(0x4200000000000000)),
5431 m.Call(uint64_t(0x0000000200000000)));
5432 CHECK_EQ(bit_cast<double>(uint64_t(0x4208000000000000)),
5433 m.Call(uint64_t(0x0000000300000000)));
5434 CHECK_EQ(bit_cast<double>(uint64_t(0x4210000000000000)),
5435 m.Call(uint64_t(0x0000000400000000)));
5436 CHECK_EQ(bit_cast<double>(uint64_t(0x4214000000000000)),
5437 m.Call(uint64_t(0x0000000500000000)));
5438 CHECK_EQ(bit_cast<double>(uint64_t(0x4220000000000000)),
5439 m.Call(uint64_t(0x0000000800000000)));
5440 CHECK_EQ(bit_cast<double>(uint64_t(0x4222000000000000)),
5441 m.Call(uint64_t(0x0000000900000000)));
5442 CHECK_EQ(bit_cast<double>(uint64_t(0x43c39d3cc70c3c9c)),
5443 m.Call(uint64_t(0x273a798e187937a3)));
5444 CHECK_EQ(bit_cast<double>(uint64_t(0x43ed9c75f06a92b4)),
5445 m.Call(uint64_t(0xece3af835495a16b)));
5446 CHECK_EQ(bit_cast<double>(uint64_t(0x43a6cd1d98224467)),
5447 m.Call(uint64_t(0x0b668ecc11223344)));
5448 CHECK_EQ(bit_cast<double>(uint64_t(0x4063c00000000000)),
5449 m.Call(uint64_t(0x000000000000009e)));
5450 CHECK_EQ(bit_cast<double>(uint64_t(0x4050c00000000000)),
5451 m.Call(uint64_t(0x0000000000000043)));
5452 CHECK_EQ(bit_cast<double>(uint64_t(0x40e5ee6000000000)),
5453 m.Call(uint64_t(0x000000000000af73)));
5454 CHECK_EQ(bit_cast<double>(uint64_t(0x40b16b0000000000)),
5455 m.Call(uint64_t(0x000000000000116b)));
5456 CHECK_EQ(bit_cast<double>(uint64_t(0x415963b300000000)),
5457 m.Call(uint64_t(0x0000000000658ecc)));
5458 CHECK_EQ(bit_cast<double>(uint64_t(0x41459da600000000)),
5459 m.Call(uint64_t(0x00000000002b3b4c)));
5460 CHECK_EQ(bit_cast<double>(uint64_t(0x41e10eeccaa00000)),
5461 m.Call(uint64_t(0x0000000088776655)));
5462 CHECK_EQ(bit_cast<double>(uint64_t(0x41dc000000000000)),
5463 m.Call(uint64_t(0x0000000070000000)));
5464 CHECK_EQ(bit_cast<double>(uint64_t(0x419c800000000000)),
5465 m.Call(uint64_t(0x0000000007200000)));
5466 CHECK_EQ(bit_cast<double>(uint64_t(0x41dfffffffc00000)),
5467 m.Call(uint64_t(0x000000007fffffff)));
5468 CHECK_EQ(bit_cast<double>(uint64_t(0x41d5848dd8400000)),
5469 m.Call(uint64_t(0x0000000056123761)));
5470 CHECK_EQ(bit_cast<double>(uint64_t(0x41dfffffc0000000)),
5471 m.Call(uint64_t(0x000000007fffff00)));
5472 CHECK_EQ(bit_cast<double>(uint64_t(0x43dd8711d87bbbbc)),
5473 m.Call(uint64_t(0x761c4761eeeeeeee)));
5474 CHECK_EQ(bit_cast<double>(uint64_t(0x43e00000001dddde)),
5475 m.Call(uint64_t(0x80000000eeeeeeee)));
5476 CHECK_EQ(bit_cast<double>(uint64_t(0x43e11111111bbbbc)),
5477 m.Call(uint64_t(0x88888888dddddddd)));
5478 CHECK_EQ(bit_cast<double>(uint64_t(0x43e40000001bbbbc)),
5479 m.Call(uint64_t(0xa0000000dddddddd)));
5480 CHECK_EQ(bit_cast<double>(uint64_t(0x43ebbbbbbbb55555)),
5481 m.Call(uint64_t(0xddddddddaaaaaaaa)));
5482 CHECK_EQ(bit_cast<double>(uint64_t(0x43ec000000155555)),
5483 m.Call(uint64_t(0xe0000000aaaaaaaa)));
5484 CHECK_EQ(bit_cast<double>(uint64_t(0x43edddddddddddde)),
5485 m.Call(uint64_t(0xeeeeeeeeeeeeeeee)));
5486 CHECK_EQ(bit_cast<double>(uint64_t(0x43efffffffbdddde)),
5487 m.Call(uint64_t(0xfffffffdeeeeeeee)));
5488 CHECK_EQ(bit_cast<double>(uint64_t(0x43ee0000001bbbbc)),
5489 m.Call(uint64_t(0xf0000000dddddddd)));
5490 CHECK_EQ(bit_cast<double>(uint64_t(0x435ffffff7777777)),
5491 m.Call(uint64_t(0x007fffffdddddddd)));
5492 CHECK_EQ(bit_cast<double>(uint64_t(0x434fffffd5555555)),
5493 m.Call(uint64_t(0x003fffffaaaaaaaa)));
5494 CHECK_EQ(bit_cast<double>(uint64_t(0x433fffffaaaaaaaa)),
5495 m.Call(uint64_t(0x001fffffaaaaaaaa)));
5496 CHECK_EQ(bit_cast<double>(uint64_t(0x412ffffe00000000)),
5497 m.Call(uint64_t(0x00000000000fffff)));
5498 CHECK_EQ(bit_cast<double>(uint64_t(0x411ffffc00000000)),
5499 m.Call(uint64_t(0x000000000007ffff)));
5500 CHECK_EQ(bit_cast<double>(uint64_t(0x410ffff800000000)),
5501 m.Call(uint64_t(0x000000000003ffff)));
5502 CHECK_EQ(bit_cast<double>(uint64_t(0x40fffff000000000)),
5503 m.Call(uint64_t(0x000000000001ffff)));
5504 CHECK_EQ(bit_cast<double>(uint64_t(0x40efffe000000000)),
5505 m.Call(uint64_t(0x000000000000ffff)));
5506 CHECK_EQ(bit_cast<double>(uint64_t(0x40dfffc000000000)),
5507 m.Call(uint64_t(0x0000000000007fff)));
5508 CHECK_EQ(bit_cast<double>(uint64_t(0x40cfff8000000000)),
5509 m.Call(uint64_t(0x0000000000003fff)));
5510 CHECK_EQ(bit_cast<double>(uint64_t(0x40bfff0000000000)),
5511 m.Call(uint64_t(0x0000000000001fff)));
5512 CHECK_EQ(bit_cast<double>(uint64_t(0x40affe0000000000)),
5513 m.Call(uint64_t(0x0000000000000fff)));
5514 CHECK_EQ(bit_cast<double>(uint64_t(0x409ffc0000000000)),
5515 m.Call(uint64_t(0x00000000000007ff)));
5516 CHECK_EQ(bit_cast<double>(uint64_t(0x408ff80000000000)),
5517 m.Call(uint64_t(0x00000000000003ff)));
5518 CHECK_EQ(bit_cast<double>(uint64_t(0x407ff00000000000)),
5519 m.Call(uint64_t(0x00000000000001ff)));
5520 CHECK_EQ(bit_cast<double>(uint64_t(0x42cfffffffffff80)),
5521 m.Call(uint64_t(0x00003fffffffffff)));
5522 CHECK_EQ(bit_cast<double>(uint64_t(0x42bfffffffffff00)),
5523 m.Call(uint64_t(0x00001fffffffffff)));
5524 CHECK_EQ(bit_cast<double>(uint64_t(0x42affffffffffe00)),
5525 m.Call(uint64_t(0x00000fffffffffff)));
5526 CHECK_EQ(bit_cast<double>(uint64_t(0x429ffffffffffc00)),
5527 m.Call(uint64_t(0x000007ffffffffff)));
5528 CHECK_EQ(bit_cast<double>(uint64_t(0x428ffffffffff800)),
5529 m.Call(uint64_t(0x000003ffffffffff)));
5530 CHECK_EQ(bit_cast<double>(uint64_t(0x427ffffffffff000)),
5531 m.Call(uint64_t(0x000001ffffffffff)));
5532 CHECK_EQ(bit_cast<double>(uint64_t(0x43e0000010000000)),
5533 m.Call(uint64_t(0x8000008000000000)));
5534 CHECK_EQ(bit_cast<double>(uint64_t(0x43e0000010000000)),
5535 m.Call(uint64_t(0x8000008000000001)));
5536 CHECK_EQ(bit_cast<double>(uint64_t(0x43e0000000000000)),
5537 m.Call(uint64_t(0x8000000000000400)));
5538 CHECK_EQ(bit_cast<double>(uint64_t(0x43e0000000000001)),
5539 m.Call(uint64_t(0x8000000000000401)));
5388 } 5540 }
5389 5541
5390 5542
5391 #endif 5543 #endif
5392 5544
5393 5545
5394 TEST(RunBitcastFloat32ToInt32) { 5546 TEST(RunBitcastFloat32ToInt32) {
5395 float input = 32.25; 5547 float input = 32.25;
5396 RawMachineAssemblerTester<int32_t> m; 5548 RawMachineAssemblerTester<int32_t> m;
5397 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32))); 5549 m.Return(m.BitcastFloat32ToInt32(m.LoadFromPointer(&input, kMachFloat32)));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5466 Node* call = r.AddNode(r.common()->Call(desc), phi); 5618 Node* call = r.AddNode(r.common()->Call(desc), phi);
5467 r.Return(call); 5619 r.Return(call);
5468 5620
5469 CHECK_EQ(33, r.Call(1)); 5621 CHECK_EQ(33, r.Call(1));
5470 CHECK_EQ(44, r.Call(0)); 5622 CHECK_EQ(44, r.Call(0));
5471 } 5623 }
5472 5624
5473 } // namespace compiler 5625 } // namespace compiler
5474 } // namespace internal 5626 } // namespace internal
5475 } // namespace v8 5627 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698