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

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

Issue 1066393002: [turbofan] Add new Float32Abs and Float64Abs operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 5 years, 8 months 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/math.js ('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 1686d377883e9c68898e301461b46d36a384384a..9c143caa7df556633763680e0d28a8b24202a1b2 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -4945,6 +4945,40 @@ TEST(RunFloat64InsertHighWord32) {
}
+TEST(RunFloat32Abs) {
+ float input = -1.0;
+ float result = 0.0;
+ RawMachineAssemblerTester<int32_t> m;
+ if (!m.machine()->HasFloat32Abs()) return;
+ m.StoreToPointer(&result, kMachFloat32,
+ m.Float32Abs(m.LoadFromPointer(&input, kMachFloat32)));
+ m.Return(m.Int32Constant(0));
+ FOR_FLOAT32_INPUTS(i) {
+ input = *i;
+ float expected = std::abs(input);
+ CHECK_EQ(0, m.Call());
+ CheckFloatEq(expected, result);
+ }
+}
+
+
+TEST(RunFloat64Abs) {
+ double input = -1.0;
+ double result = 0.0;
+ RawMachineAssemblerTester<int32_t> m;
+ if (!m.machine()->HasFloat64Abs()) return;
+ m.StoreToPointer(&result, kMachFloat64,
+ m.Float64Abs(m.LoadFromPointer(&input, kMachFloat64)));
+ m.Return(m.Int32Constant(0));
+ FOR_FLOAT64_INPUTS(i) {
+ input = *i;
+ double expected = std::abs(input);
+ CHECK_EQ(0, m.Call());
+ CheckDoubleEq(expected, result);
+ }
+}
+
+
static double two_30 = 1 << 30; // 2^30 is a smi boundary.
static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
static double kValues[] = {0.1,
« no previous file with comments | « src/math.js ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698