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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 2060743002: [builtins] Introduce proper Float64Log1p operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@Math_Log
Patch Set: REBASE Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/ieee754.h" 10 #include "src/base/ieee754.h"
(...skipping 5493 matching lines...) Expand 10 before | Expand all | Expand 10 after
5504 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity()))); 5504 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity())));
5505 CHECK(std::isnan(m.Call(-1.0))); 5505 CHECK(std::isnan(m.Call(-1.0)));
5506 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0)); 5506 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-0.0));
5507 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0)); 5507 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0));
5508 CHECK_DOUBLE_EQ(0.0, m.Call(1.0)); 5508 CHECK_DOUBLE_EQ(0.0, m.Call(1.0));
5509 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), 5509 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
5510 m.Call(std::numeric_limits<double>::infinity())); 5510 m.Call(std::numeric_limits<double>::infinity()));
5511 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log(*i), m.Call(*i)); } 5511 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log(*i), m.Call(*i)); }
5512 } 5512 }
5513 5513
5514 TEST(RunFloat64Log1p) {
5515 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5516 m.Return(m.Float64Log1p(m.Parameter(0)));
5517 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5518 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5519 CHECK(std::isnan(m.Call(-std::numeric_limits<double>::infinity())));
5520 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0));
5521 CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
5522 CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
5523 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
5524 m.Call(std::numeric_limits<double>::infinity()));
5525 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log1p(*i), m.Call(*i)); }
5526 }
5527
5514 static double two_30 = 1 << 30; // 2^30 is a smi boundary. 5528 static double two_30 = 1 << 30; // 2^30 is a smi boundary.
5515 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. 5529 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
5516 static double kValues[] = {0.1, 5530 static double kValues[] = {0.1,
5517 0.2, 5531 0.2,
5518 0.49999999999999994, 5532 0.49999999999999994,
5519 0.5, 5533 0.5,
5520 0.7, 5534 0.7,
5521 1.0 - std::numeric_limits<double>::epsilon(), 5535 1.0 - std::numeric_limits<double>::epsilon(),
5522 -0.1, 5536 -0.1,
5523 -0.49999999999999994, 5537 -0.49999999999999994,
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
6273 r.Goto(&merge); 6287 r.Goto(&merge);
6274 r.Bind(&merge); 6288 r.Bind(&merge);
6275 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6289 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6276 r.Return(phi); 6290 r.Return(phi);
6277 CHECK_EQ(1, r.Call(1)); 6291 CHECK_EQ(1, r.Call(1));
6278 } 6292 }
6279 6293
6280 } // namespace compiler 6294 } // namespace compiler
6281 } // namespace internal 6295 } // namespace internal
6282 } // namespace v8 6296 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698