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

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

Issue 1444583002: [turbofan] Added the optional Float64RoundUp operator to turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed the implementation of VisitFloat32RoundUp on mips32 Created 5 years, 1 month 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 | « src/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | 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 e8f0c6b47a55af3b3ff7de8226207f57f30ff031..a5052f33f0c9b3bf48a8f4ed48dfe254ff5c0d74 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -5155,57 +5155,43 @@ TEST(RunFloat64RoundDown1) {
TEST(RunFloat64RoundDown2) {
- double input = -1.0;
- double result = 0.0;
- RawMachineAssemblerTester<int32_t> m;
+ BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
if (!m.machine()->Float64RoundDown().IsSupported()) return;
- m.StoreToPointer(&result, kMachFloat64,
- m.Float64Sub(m.Float64Constant(-0.0),
- m.Float64RoundDown(m.Float64Sub(
- m.Float64Constant(-0.0),
- m.LoadFromPointer(&input, kMachFloat64)))));
- m.Return(m.Int32Constant(0));
+ m.Return(m.Float64Sub(m.Float64Constant(-0.0),
+ m.Float64RoundDown(m.Float64Sub(m.Float64Constant(-0.0),
+ m.Parameter(0)))));
+
for (size_t i = 0; i < arraysize(kValues); ++i) {
- input = kValues[i];
- CHECK_EQ(0, m.Call());
- double expected = std::ceil(kValues[i]);
- CHECK_EQ(expected, result);
+ CHECK_EQ(std::ceil(kValues[i]), m.Call(kValues[i]));
}
}
+TEST(RunFloat64RoundUp) {
+ BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
+ if (!m.machine()->Float64RoundUp().IsSupported()) return;
+ m.Return(m.Float64RoundUp(m.Parameter(0)));
+
+ FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::ceil(*i), m.Call(*i)); }
+}
+
+
TEST(RunFloat64RoundTruncate) {
- double input = -1.0;
- double result = 0.0;
- RawMachineAssemblerTester<int32_t> m;
+ BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
if (!m.machine()->Float64RoundTruncate().IsSupported()) return;
- m.StoreToPointer(
- &result, kMachFloat64,
- m.Float64RoundTruncate(m.LoadFromPointer(&input, kMachFloat64)));
- m.Return(m.Int32Constant(0));
+ m.Return(m.Float64RoundTruncate(m.Parameter(0)));
for (size_t i = 0; i < arraysize(kValues); ++i) {
- input = kValues[i];
- CHECK_EQ(0, m.Call());
- double expected = trunc(kValues[i]);
- CHECK_EQ(expected, result);
+ CHECK_EQ(trunc(kValues[i]), m.Call(kValues[i]));
}
}
TEST(RunFloat64RoundTiesAway) {
- double input = -1.0;
- double result = 0.0;
- RawMachineAssemblerTester<int32_t> m;
+ BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
if (!m.machine()->Float64RoundTiesAway().IsSupported()) return;
- m.StoreToPointer(
- &result, kMachFloat64,
- m.Float64RoundTiesAway(m.LoadFromPointer(&input, kMachFloat64)));
- m.Return(m.Int32Constant(0));
+ m.Return(m.Float64RoundTiesAway(m.Parameter(0)));
for (size_t i = 0; i < arraysize(kValues); ++i) {
- input = kValues[i];
- CHECK_EQ(0, m.Call());
- double expected = round(kValues[i]);
- CHECK_EQ(expected, result);
+ CHECK_EQ(round(kValues[i]), m.Call(kValues[i]));
}
}
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698