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

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

Issue 1584663007: [turbofan] Implement rounding of floats on x64 and ia32 without sse4.1. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: reduced generated code. Created 4 years, 11 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/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('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/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 5401 matching lines...) Expand 10 before | Expand all | Expand 10 after
5412 TEST(RunFloat32RoundDown) { 5412 TEST(RunFloat32RoundDown) {
5413 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32()); 5413 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
5414 if (!m.machine()->Float32RoundDown().IsSupported()) return; 5414 if (!m.machine()->Float32RoundDown().IsSupported()) return;
5415 5415
5416 m.Return(m.Float32RoundDown(m.Parameter(0))); 5416 m.Return(m.Float32RoundDown(m.Parameter(0)));
5417 5417
5418 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floorf(*i), m.Call(*i)); } 5418 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floorf(*i), m.Call(*i)); }
5419 } 5419 }
5420 5420
5421 5421
5422 TEST(RunFloat32RoundDownMinusZero) {
5423 BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
5424 if (!m.machine()->Float32RoundDown().IsSupported()) return;
5425
5426 m.Return(m.Float32RoundDown(m.Parameter(0)));
5427 int32_t expected = bit_cast<int32_t>(-0.0f);
5428 int32_t result = bit_cast<int32_t>(m.Call(-0.0f));
5429 CHECK_EQ(expected, result);
5430 }
5431
5432
5433 TEST(RunFloat64RoundDownMinusZero) {
5434 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5435 if (!m.machine()->Float64RoundDown().IsSupported()) return;
5436
5437 m.Return(m.Float64RoundDown(m.Parameter(0)));
5438 int64_t expected = bit_cast<int64_t>(-0.0);
5439 int64_t result = bit_cast<int64_t>(m.Call(-0.0));
5440 CHECK_EQ(expected, result);
5441 }
5442
5443
5422 TEST(RunFloat64RoundDown1) { 5444 TEST(RunFloat64RoundDown1) {
5423 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64()); 5445 BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
5424 if (!m.machine()->Float64RoundDown().IsSupported()) return; 5446 if (!m.machine()->Float64RoundDown().IsSupported()) return;
5425 5447
5426 m.Return(m.Float64RoundDown(m.Parameter(0))); 5448 m.Return(m.Float64RoundDown(m.Parameter(0)));
5427 5449
5428 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(floor(*i), m.Call(*i)); } 5450 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(floor(*i), m.Call(*i)); }
5429 } 5451 }
5430 5452
5431 5453
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
6083 Node* call = r.AddNode(r.common()->Call(desc), phi); 6105 Node* call = r.AddNode(r.common()->Call(desc), phi);
6084 r.Return(call); 6106 r.Return(call);
6085 6107
6086 CHECK_EQ(33, r.Call(1)); 6108 CHECK_EQ(33, r.Call(1));
6087 CHECK_EQ(44, r.Call(0)); 6109 CHECK_EQ(44, r.Call(0));
6088 } 6110 }
6089 6111
6090 } // namespace compiler 6112 } // namespace compiler
6091 } // namespace internal 6113 } // namespace internal
6092 } // namespace v8 6114 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698