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

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

Issue 2073123002: [builtins] Introduce proper Float64Cos and Float64Sin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix missing breaks 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
« no previous file with comments | « src/third_party/fdlibm/fdlibm.js ('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 5511 matching lines...) Expand 10 before | Expand all | Expand 10 after
5522 m.Return(m.Float64Atanh(m.Parameter(0))); 5522 m.Return(m.Float64Atanh(m.Parameter(0)));
5523 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5523 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5524 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5524 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5525 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), m.Call(1.0)); 5525 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), m.Call(1.0));
5526 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0)); 5526 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0));
5527 CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0)); 5527 CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
5528 CHECK_DOUBLE_EQ(0.0, m.Call(0.0)); 5528 CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
5529 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atanh(*i), m.Call(*i)); } 5529 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atanh(*i), m.Call(*i)); }
5530 } 5530 }
5531 5531
5532 TEST(RunFloat64Cos) {
5533 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5534 m.Return(m.Float64Cos(m.Parameter(0)));
5535 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_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)); }
5538 }
5539
5532 TEST(RunFloat64Exp) { 5540 TEST(RunFloat64Exp) {
5533 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5541 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5534 m.Return(m.Float64Exp(m.Parameter(0))); 5542 m.Return(m.Float64Exp(m.Parameter(0)));
5535 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5543 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5536 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5544 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5537 CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity())); 5545 CHECK_EQ(0.0, m.Call(-std::numeric_limits<double>::infinity()));
5538 CHECK_DOUBLE_EQ(1.0, m.Call(-0.0)); 5546 CHECK_DOUBLE_EQ(1.0, m.Call(-0.0));
5539 CHECK_DOUBLE_EQ(1.0, m.Call(0.0)); 5547 CHECK_DOUBLE_EQ(1.0, m.Call(0.0));
5540 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), 5548 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
5541 m.Call(std::numeric_limits<double>::infinity())); 5549 m.Call(std::numeric_limits<double>::infinity()));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 m.Return(m.Float64Cbrt(m.Parameter(0))); 5624 m.Return(m.Float64Cbrt(m.Parameter(0)));
5617 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN()))); 5625 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5618 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN()))); 5626 CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
5619 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), 5627 CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
5620 m.Call(std::numeric_limits<double>::infinity())); 5628 m.Call(std::numeric_limits<double>::infinity()));
5621 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), 5629 CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(),
5622 m.Call(-std::numeric_limits<double>::infinity())); 5630 m.Call(-std::numeric_limits<double>::infinity()));
5623 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cbrt(*i), m.Call(*i)); } 5631 FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cbrt(*i), m.Call(*i)); }
5624 } 5632 }
5625 5633
5634 TEST(RunFloat64Sin) {
5635 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5636 m.Return(m.Float64Sin(m.Parameter(0)));
5637 CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
5638 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)); }
5640 }
5641
5626 static double two_30 = 1 << 30; // 2^30 is a smi boundary. 5642 static double two_30 = 1 << 30; // 2^30 is a smi boundary.
5627 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary. 5643 static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
5628 static double kValues[] = {0.1, 5644 static double kValues[] = {0.1,
5629 0.2, 5645 0.2,
5630 0.49999999999999994, 5646 0.49999999999999994,
5631 0.5, 5647 0.5,
5632 0.7, 5648 0.7,
5633 1.0 - std::numeric_limits<double>::epsilon(), 5649 1.0 - std::numeric_limits<double>::epsilon(),
5634 -0.1, 5650 -0.1,
5635 -0.49999999999999994, 5651 -0.49999999999999994,
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
6385 r.Goto(&merge); 6401 r.Goto(&merge);
6386 r.Bind(&merge); 6402 r.Bind(&merge);
6387 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6403 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6388 r.Return(phi); 6404 r.Return(phi);
6389 CHECK_EQ(1, r.Call(1)); 6405 CHECK_EQ(1, r.Call(1));
6390 } 6406 }
6391 6407
6392 } // namespace compiler 6408 } // namespace compiler
6393 } // namespace internal 6409 } // namespace internal
6394 } // namespace v8 6410 } // namespace v8
OLDNEW
« no previous file with comments | « src/third_party/fdlibm/fdlibm.js ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698