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

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

Issue 1455983002: [turbofan] Implemented the ChangeFloat64ToInt64 TurboFan operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/x64/instruction-selector-x64.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 5328 matching lines...) Expand 10 before | Expand all | Expand 10 after
5339 FOR_INT64_INPUTS(i) { 5339 FOR_INT64_INPUTS(i) {
5340 input = *i; 5340 input = *i;
5341 CHECK_EQ(11, m.Call()); 5341 CHECK_EQ(11, m.Call());
5342 double expected = bit_cast<double>(input); 5342 double expected = bit_cast<double>(input);
5343 CHECK_EQ(bit_cast<int64_t>(expected), bit_cast<int64_t>(output)); 5343 CHECK_EQ(bit_cast<int64_t>(expected), bit_cast<int64_t>(output));
5344 } 5344 }
5345 } 5345 }
5346 5346
5347 5347
5348 TEST(RunBitcastFloat64ToInt64) { 5348 TEST(RunBitcastFloat64ToInt64) {
5349 double input = 0; 5349 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
5350 int64_t output = 0; 5350
5351 RawMachineAssemblerTester<int32_t> m; 5351 m.Return(m.BitcastFloat64ToInt64(m.Parameter(0)));
5352 m.StoreToPointer( 5352 FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); }
5353 &output, kMachInt64, 5353 }
5354 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); 5354
5355 m.Return(m.Int32Constant(11)); 5355
5356 FOR_FLOAT64_INPUTS(i) { 5356 TEST(RunChangeFloat64ToInt64) {
5357 input = *i; 5357 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
5358 CHECK_EQ(11, m.Call()); 5358 m.Return(m.ChangeFloat64ToInt64(m.Parameter(0)));
5359 double expected = bit_cast<int64_t>(input); 5359
5360 CHECK_EQ(expected, output); 5360 FOR_INT64_INPUTS(i) {
5361 double input = static_cast<double>(*i);
5362 CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
5361 } 5363 }
5362 } 5364 }
5363 5365
5364 5366
5365 TEST(RunRoundInt64ToFloat32) { 5367 TEST(RunRoundInt64ToFloat32) {
5366 BufferedRawMachineAssemblerTester<float> m(kMachInt64); 5368 BufferedRawMachineAssemblerTester<float> m(kMachInt64);
5367 m.Return(m.RoundInt64ToFloat32(m.Parameter(0))); 5369 m.Return(m.RoundInt64ToFloat32(m.Parameter(0)));
5368 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); } 5370 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); }
5369 } 5371 }
5370 5372
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
5633 Node* call = r.AddNode(r.common()->Call(desc), phi); 5635 Node* call = r.AddNode(r.common()->Call(desc), phi);
5634 r.Return(call); 5636 r.Return(call);
5635 5637
5636 CHECK_EQ(33, r.Call(1)); 5638 CHECK_EQ(33, r.Call(1));
5637 CHECK_EQ(44, r.Call(0)); 5639 CHECK_EQ(44, r.Call(0));
5638 } 5640 }
5639 5641
5640 } // namespace compiler 5642 } // namespace compiler
5641 } // namespace internal 5643 } // namespace internal
5642 } // namespace v8 5644 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698