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); |
} |
} |
} |