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

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

Issue 1504363002: [turbofan] Change TruncateFloat32ToInt64 to TryTruncateFloat32ToInt64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed bad code in the mips 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 3c5d57cb31fef1839fdafb5f35d1bae20fc60f6c..7b251b52f52f4fd274dc462037fbf91087b0829e 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -5387,9 +5387,9 @@ TEST(RunBitcastFloat64ToInt64) {
}
-TEST(RunTruncateFloat32ToInt64) {
+TEST(RunTryTruncateFloat32ToInt64WithoutCheck) {
BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat32);
- m.Return(m.TruncateFloat32ToInt64(m.Parameter(0)));
+ m.Return(m.TryTruncateFloat32ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
float input = static_cast<float>(*i);
@@ -5397,9 +5397,25 @@ TEST(RunTruncateFloat32ToInt64) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
- FOR_FLOAT32_INPUTS(j) {
- if (*j < 9223372036854775808.0 && *j > -9223372036854775809.0) {
- CHECK_EQ(static_cast<int64_t>(*j), m.Call(*j));
+}
+
+
+TEST(RunTryTruncateFloat32ToInt64WithCheck) {
+ int64_t success = 0;
+ BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat32);
+ Node* trunc = m.TryTruncateFloat32ToInt64(m.Parameter(0));
+ Node* val = m.Projection(0, trunc);
+ Node* check = m.Projection(1, trunc);
+ m.StoreToPointer(&success, kMachInt64, check);
+ m.Return(val);
+
+ FOR_FLOAT32_INPUTS(i) {
+ if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) {
+ CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ CHECK_NE(0, success);
+ } else {
+ m.Call(*i);
+ CHECK_EQ(0, success);
}
}
}
« 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