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

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 1495213003: [turbofan] Changed TruncateFloat64ToInt64 to TryTruncateFloat64ToInt64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed unused code. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index b128b81a2075266266505351cec90d2b7322bc13..24007a83f6cbc4652f367315815354b054864b26 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -5408,9 +5408,9 @@ TEST(RunTruncateFloat32ToInt64) {
}
-TEST(RunTruncateFloat64ToInt64) {
+TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {
BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
- m.Return(m.TruncateFloat64ToInt64(m.Parameter(0)));
+ m.Return(m.TryTruncateFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
double input = static_cast<double>(*i);
@@ -5419,6 +5419,28 @@ TEST(RunTruncateFloat64ToInt64) {
}
+TEST(RunTryTruncateFloat64ToInt64WithCheck) {
+ int64_t success = 0;
+ BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
+ Node* trunc = m.TryTruncateFloat64ToInt64(m.Parameter(0));
+ Node* val = m.Projection(0, trunc);
+ Node* check = m.Projection(1, trunc);
+ m.StoreToPointer(&success, kMachInt64, check);
+ m.Return(val);
+
+ FOR_FLOAT64_INPUTS(i) {
+ if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) {
+ // Conversions within this range
+ CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ CHECK_NE(0, success);
+ } else {
+ m.Call(*i);
+ CHECK_EQ(0, success);
+ }
+ }
+}
+
+
TEST(RunTruncateFloat32ToUint64) {
BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat32);
m.Return(m.TruncateFloat32ToUint64(m.Parameter(0)));
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698