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

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

Issue 1512023002: [turbofan] Change TruncateFloat32ToUint64 to TryTruncateFloat32ToUint64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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)));

Powered by Google App Engine
This is Rietveld 408576698