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

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

Issue 1526293002: [turbofan] Fixed a bug in TryTruncateFloatXXToInt64 with INT64_MIN. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 5464 matching lines...) Expand 10 before | Expand all | Expand 10 after
5475 TEST(RunTryTruncateFloat32ToInt64WithCheck) { 5475 TEST(RunTryTruncateFloat32ToInt64WithCheck) {
5476 int64_t success = 0; 5476 int64_t success = 0;
5477 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float32()); 5477 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float32());
5478 Node* trunc = m.TryTruncateFloat32ToInt64(m.Parameter(0)); 5478 Node* trunc = m.TryTruncateFloat32ToInt64(m.Parameter(0));
5479 Node* val = m.Projection(0, trunc); 5479 Node* val = m.Projection(0, trunc);
5480 Node* check = m.Projection(1, trunc); 5480 Node* check = m.Projection(1, trunc);
5481 m.StoreToPointer(&success, MachineRepresentation::kWord64, check); 5481 m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
5482 m.Return(val); 5482 m.Return(val);
5483 5483
5484 FOR_FLOAT32_INPUTS(i) { 5484 FOR_FLOAT32_INPUTS(i) {
5485 if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) { 5485 if (*i < 9223372036854775808.0 && *i >= -9223372036854775808.0) {
5486 CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i)); 5486 CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
5487 CHECK_NE(0, success); 5487 CHECK_NE(0, success);
5488 } else { 5488 } else {
5489 m.Call(*i); 5489 m.Call(*i);
5490 CHECK_EQ(0, success); 5490 CHECK_EQ(0, success);
5491 } 5491 }
5492 } 5492 }
5493 } 5493 }
5494 5494
5495 5495
(...skipping 11 matching lines...) Expand all
5507 TEST(RunTryTruncateFloat64ToInt64WithCheck) { 5507 TEST(RunTryTruncateFloat64ToInt64WithCheck) {
5508 int64_t success = 0; 5508 int64_t success = 0;
5509 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64()); 5509 BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
5510 Node* trunc = m.TryTruncateFloat64ToInt64(m.Parameter(0)); 5510 Node* trunc = m.TryTruncateFloat64ToInt64(m.Parameter(0));
5511 Node* val = m.Projection(0, trunc); 5511 Node* val = m.Projection(0, trunc);
5512 Node* check = m.Projection(1, trunc); 5512 Node* check = m.Projection(1, trunc);
5513 m.StoreToPointer(&success, MachineRepresentation::kWord64, check); 5513 m.StoreToPointer(&success, MachineRepresentation::kWord64, check);
5514 m.Return(val); 5514 m.Return(val);
5515 5515
5516 FOR_FLOAT64_INPUTS(i) { 5516 FOR_FLOAT64_INPUTS(i) {
5517 if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) { 5517 if (*i < 9223372036854775808.0 && *i >= -9223372036854775808.0) {
5518 // Conversions within this range should succeed. 5518 // Conversions within this range should succeed.
5519 CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i)); 5519 CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
5520 CHECK_NE(0, success); 5520 CHECK_NE(0, success);
5521 } else { 5521 } else {
5522 m.Call(*i); 5522 m.Call(*i);
5523 CHECK_EQ(0, success); 5523 CHECK_EQ(0, success);
5524 } 5524 }
5525 } 5525 }
5526 } 5526 }
5527 5527
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
5874 Node* call = r.AddNode(r.common()->Call(desc), phi); 5874 Node* call = r.AddNode(r.common()->Call(desc), phi);
5875 r.Return(call); 5875 r.Return(call);
5876 5876
5877 CHECK_EQ(33, r.Call(1)); 5877 CHECK_EQ(33, r.Call(1));
5878 CHECK_EQ(44, r.Call(0)); 5878 CHECK_EQ(44, r.Call(0));
5879 } 5879 }
5880 5880
5881 } // namespace compiler 5881 } // namespace compiler
5882 } // namespace internal 5882 } // namespace internal
5883 } // namespace v8 5883 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698