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 41603dfbbfb98a4532bfb72514b9828bae025df8..09fec3fbaec13675053bedd6a9228f57b3692ef0 100644 |
--- a/test/cctest/compiler/test-run-machops.cc |
+++ b/test/cctest/compiler/test-run-machops.cc |
@@ -5527,7 +5527,7 @@ TEST(RunTryTruncateFloat64ToInt64WithCheck) { |
TEST(RunTruncateFloat32ToUint64) { |
BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float32()); |
- m.Return(m.TruncateFloat32ToUint64(m.Parameter(0))); |
+ m.Return(m.TryTruncateFloat32ToUint64(m.Parameter(0))); |
FOR_UINT64_INPUTS(i) { |
float input = static_cast<float>(*i); |
@@ -5543,6 +5543,28 @@ TEST(RunTruncateFloat32ToUint64) { |
} |
+TEST(RunTryTruncateFloat32ToUint64WithCheck) { |
+ int64_t success = 0; |
+ BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float32()); |
+ Node* trunc = m.TryTruncateFloat32ToUint64(m.Parameter(0)); |
+ Node* val = m.Projection(0, trunc); |
+ Node* check = m.Projection(1, trunc); |
+ m.StoreToPointer(&success, MachineType::Int64(), check); |
+ m.Return(val); |
+ |
+ FOR_FLOAT32_INPUTS(i) { |
+ if (*i < 18446744073709551616.0 && *i >= 0.0) { |
+ // Conversions within this range should succeed. |
+ CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i)); |
+ CHECK_NE(0, success); |
+ } else { |
+ m.Call(*i); |
+ CHECK_EQ(0, success); |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunTryTruncateFloat64ToUint64WithoutCheck) { |
BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Float64()); |
m.Return(m.TruncateFloat64ToUint64(m.Parameter(0))); |