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

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

Issue 1444583002: [turbofan] Added the optional Float64RoundUp operator to turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed the implementation of VisitFloat32RoundUp on mips32 Created 5 years, 1 month 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/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | 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 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 5137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5148 BufferedRawMachineAssemblerTester<double> m(kMachFloat64); 5148 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
5149 if (!m.machine()->Float64RoundDown().IsSupported()) return; 5149 if (!m.machine()->Float64RoundDown().IsSupported()) return;
5150 5150
5151 m.Return(m.Float64RoundDown(m.Parameter(0))); 5151 m.Return(m.Float64RoundDown(m.Parameter(0)));
5152 5152
5153 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::floor(*i), m.Call(*i)); } 5153 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::floor(*i), m.Call(*i)); }
5154 } 5154 }
5155 5155
5156 5156
5157 TEST(RunFloat64RoundDown2) { 5157 TEST(RunFloat64RoundDown2) {
5158 double input = -1.0; 5158 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
5159 double result = 0.0;
5160 RawMachineAssemblerTester<int32_t> m;
5161 if (!m.machine()->Float64RoundDown().IsSupported()) return; 5159 if (!m.machine()->Float64RoundDown().IsSupported()) return;
5162 m.StoreToPointer(&result, kMachFloat64, 5160 m.Return(m.Float64Sub(m.Float64Constant(-0.0),
5163 m.Float64Sub(m.Float64Constant(-0.0), 5161 m.Float64RoundDown(m.Float64Sub(m.Float64Constant(-0.0),
5164 m.Float64RoundDown(m.Float64Sub( 5162 m.Parameter(0)))));
5165 m.Float64Constant(-0.0), 5163
5166 m.LoadFromPointer(&input, kMachFloat64)))));
5167 m.Return(m.Int32Constant(0));
5168 for (size_t i = 0; i < arraysize(kValues); ++i) { 5164 for (size_t i = 0; i < arraysize(kValues); ++i) {
5169 input = kValues[i]; 5165 CHECK_EQ(std::ceil(kValues[i]), m.Call(kValues[i]));
5170 CHECK_EQ(0, m.Call());
5171 double expected = std::ceil(kValues[i]);
5172 CHECK_EQ(expected, result);
5173 } 5166 }
5174 } 5167 }
5175 5168
5176 5169
5170 TEST(RunFloat64RoundUp) {
5171 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
5172 if (!m.machine()->Float64RoundUp().IsSupported()) return;
5173 m.Return(m.Float64RoundUp(m.Parameter(0)));
5174
5175 FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(std::ceil(*i), m.Call(*i)); }
5176 }
5177
5178
5177 TEST(RunFloat64RoundTruncate) { 5179 TEST(RunFloat64RoundTruncate) {
5178 double input = -1.0; 5180 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
5179 double result = 0.0;
5180 RawMachineAssemblerTester<int32_t> m;
5181 if (!m.machine()->Float64RoundTruncate().IsSupported()) return; 5181 if (!m.machine()->Float64RoundTruncate().IsSupported()) return;
5182 m.StoreToPointer( 5182 m.Return(m.Float64RoundTruncate(m.Parameter(0)));
5183 &result, kMachFloat64,
5184 m.Float64RoundTruncate(m.LoadFromPointer(&input, kMachFloat64)));
5185 m.Return(m.Int32Constant(0));
5186 for (size_t i = 0; i < arraysize(kValues); ++i) { 5183 for (size_t i = 0; i < arraysize(kValues); ++i) {
5187 input = kValues[i]; 5184 CHECK_EQ(trunc(kValues[i]), m.Call(kValues[i]));
5188 CHECK_EQ(0, m.Call());
5189 double expected = trunc(kValues[i]);
5190 CHECK_EQ(expected, result);
5191 } 5185 }
5192 } 5186 }
5193 5187
5194 5188
5195 TEST(RunFloat64RoundTiesAway) { 5189 TEST(RunFloat64RoundTiesAway) {
5196 double input = -1.0; 5190 BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
5197 double result = 0.0;
5198 RawMachineAssemblerTester<int32_t> m;
5199 if (!m.machine()->Float64RoundTiesAway().IsSupported()) return; 5191 if (!m.machine()->Float64RoundTiesAway().IsSupported()) return;
5200 m.StoreToPointer( 5192 m.Return(m.Float64RoundTiesAway(m.Parameter(0)));
5201 &result, kMachFloat64,
5202 m.Float64RoundTiesAway(m.LoadFromPointer(&input, kMachFloat64)));
5203 m.Return(m.Int32Constant(0));
5204 for (size_t i = 0; i < arraysize(kValues); ++i) { 5193 for (size_t i = 0; i < arraysize(kValues); ++i) {
5205 input = kValues[i]; 5194 CHECK_EQ(round(kValues[i]), m.Call(kValues[i]));
5206 CHECK_EQ(0, m.Call());
5207 double expected = round(kValues[i]);
5208 CHECK_EQ(expected, result);
5209 } 5195 }
5210 } 5196 }
5211 5197
5212 5198
5213 #if !USE_SIMULATOR 5199 #if !USE_SIMULATOR
5214 5200
5215 namespace { 5201 namespace {
5216 5202
5217 int32_t const kMagicFoo0 = 0xdeadbeef; 5203 int32_t const kMagicFoo0 = 0xdeadbeef;
5218 5204
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 Node* call = r.AddNode(r.common()->Call(desc), phi); 5604 Node* call = r.AddNode(r.common()->Call(desc), phi);
5619 r.Return(call); 5605 r.Return(call);
5620 5606
5621 CHECK_EQ(33, r.Call(1)); 5607 CHECK_EQ(33, r.Call(1));
5622 CHECK_EQ(44, r.Call(0)); 5608 CHECK_EQ(44, r.Call(0));
5623 } 5609 }
5624 5610
5625 } // namespace compiler 5611 } // namespace compiler
5626 } // namespace internal 5612 } // namespace internal
5627 } // namespace v8 5613 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698