| 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..a55e1a9f4e2790632613329d1d60fb2c4aaf0a04 100644
|
| --- a/test/cctest/compiler/test-run-machops.cc
|
| +++ b/test/cctest/compiler/test-run-machops.cc
|
| @@ -5438,9 +5438,9 @@ TEST(RunTryTruncateFloat64ToInt64WithCheck) {
|
| }
|
|
|
|
|
| -TEST(RunTruncateFloat32ToUint64) {
|
| +TEST(RunTryTruncateFloat32ToUint64WithoutCheck) {
|
| BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat32);
|
| - m.Return(m.TruncateFloat32ToUint64(m.Parameter(0)));
|
| + m.Return(m.TryTruncateFloat32ToUint64(m.Parameter(0)));
|
|
|
| FOR_UINT64_INPUTS(i) {
|
| float input = static_cast<float>(*i);
|
| @@ -5456,6 +5456,28 @@ TEST(RunTruncateFloat32ToUint64) {
|
| }
|
|
|
|
|
| +TEST(RunTryTruncateFloat32ToUint64WithCheck) {
|
| + int64_t success = 0;
|
| + BufferedRawMachineAssemblerTester<uint64_t> m(kMachFloat32);
|
| + Node* trunc = m.TryTruncateFloat32ToUint64(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 < 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(kMachFloat64);
|
| m.Return(m.TruncateFloat64ToUint64(m.Parameter(0)));
|
|
|