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

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: Added better mips64 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 | « test/cctest/compiler/test-representation-change.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | 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 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)));
« no previous file with comments | « test/cctest/compiler/test-representation-change.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698