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

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

Issue 2083573002: [builtins] Unify Cosh, Sinh and Tanh as exports from flibm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE and windows fix. Created 4 years, 5 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
« no previous file with comments | « src/v8.gyp ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5519 matching lines...) Expand 10 before | Expand all | Expand 10 after
5530 } 5530 }
5531 5531
5532 TEST(RunFloat64Cos) { 5532 TEST(RunFloat64Cos) {
5533 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5533 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5534 m.Return(m.Float64Cos(m.Parameter(0))); 5534 m.Return(m.Float64Cos(m.Parameter(0)));
5535 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5535 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5536 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5536 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5537 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cos(*i), m.Call(*i)); } 5537 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cos(*i), m.Call(*i)); }
5538 } 5538 }
5539 5539
5540 TEST(RunFloat64Cosh) {
5541 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5542 m.Return(m.Float64Cosh(m.Parameter(0)));
5543 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5544 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5545 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cosh(*i), m.Call(*i)); }
5546 }
5547
5540 TEST(RunFloat64Exp) { 5548 TEST(RunFloat64Exp) {
5541 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5549 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5542 m.Return(m.Float64Exp(m.Parameter(0))); 5550 m.Return(m.Float64Exp(m.Parameter(0)));
5543 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5551 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5544 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5552 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5545 CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity())); 5553 CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity()));
5546 CHECK_DOUBLE_EQ(1.0, m.Call(-0.0)); 5554 CHECK_DOUBLE_EQ(1.0, m.Call(-0.0));
5547 CHECK_DOUBLE_EQ(1.0, m.Call(0.0)); 5555 CHECK_DOUBLE_EQ(1.0, m.Call(0.0));
5548 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), 5556 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
5549 m.Call(std::numeric_limits<double>::infinity())); 5557 m.Call(std::numeric_limits<double>::infinity()));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5632 } 5640 }
5633 5641
5634 TEST(RunFloat64Sin) { 5642 TEST(RunFloat64Sin) {
5635 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5643 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5636 m.Return(m.Float64Sin(m.Parameter(0))); 5644 m.Return(m.Float64Sin(m.Parameter(0)));
5637 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5645 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5638 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5646 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5639 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::sin(*i), m.Call(*i)); } 5647 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::sin(*i), m.Call(*i)); }
5640 } 5648 }
5641 5649
5650 TEST(RunFloat64Sinh) {
5651 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5652 m.Return(m.Float64Sinh(m.Parameter(0)));
5653 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5654 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5655 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::sinh(*i), m.Call(*i)); }
5656 }
5657
5642 TEST(RunFloat64Tan) { 5658 TEST(RunFloat64Tan) {
5643 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5659 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5644 m.Return(m.Float64Tan(m.Parameter(0))); 5660 m.Return(m.Float64Tan(m.Parameter(0)));
5645 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5661 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5646 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5662 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5647 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::tan(*i), m.Call(*i)); } 5663 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::tan(*i), m.Call(*i)); }
5648 } 5664 }
5649 5665
5666 TEST(RunFloat64Tanh) {
5667 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5668 m.Return(m.Float64Tanh(m.Parameter(0)));
5669 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5670 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5671 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::tanh(*i), m.Call(*i)); }
5672 }
5673
5650 static double two_30 = 1 << 30; // 2^30 is a smi boundary. 5674 static double two_30 = 1 << 30; // 2^30 is a smi boundary.
5651 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. 5675 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
5652 static double kValues[] = {0.1, 5676 static double kValues[] = {0.1,
5653 0.2, 5677 0.2,
5654 0.49999999999999994, 5678 0.49999999999999994,
5655 0.5, 5679 0.5,
5656 0.7, 5680 0.7,
5657 1.0 - std::numeric_limits<double>::epsilon(), 5681 1.0 - std::numeric_limits<double>::epsilon(),
5658 -0.1, 5682 -0.1,
5659 -0.49999999999999994, 5683 -0.49999999999999994,
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
6409 r.Goto(&merge); 6433 r.Goto(&merge);
6410 r.Bind(&merge); 6434 r.Bind(&merge);
6411 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6435 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6412 r.Return(phi); 6436 r.Return(phi);
6413 CHECK_EQ(1, r.Call(1)); 6437 CHECK_EQ(1, r.Call(1));
6414 } 6438 }
6415 6439
6416 } // namespace compiler 6440 } // namespace compiler
6417 } // namespace internal 6441 } // namespace internal
6418 } // namespace v8 6442 } // namespace v8
OLDNEW
« no previous file with comments | « src/v8.gyp ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698