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

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

Issue 1476063002: [turbofan] Implemented the TruncateFloat32ToInt64 TurboFan operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Increased the type of opcodes from uint8_t to uint16_t. Created 5 years 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') | 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 5373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5384 5384
5385 5385
5386 TEST(RunBitcastFloat64ToInt64) { 5386 TEST(RunBitcastFloat64ToInt64) {
5387 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); 5387 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
5388 5388
5389 m.Return(m.BitcastFloat64ToInt64(m.Parameter(0))); 5389 m.Return(m.BitcastFloat64ToInt64(m.Parameter(0)));
5390 FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); } 5390 FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); }
5391 } 5391 }
5392 5392
5393 5393
5394 TEST(RunTruncateFloat32ToInt64) {
5395 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat32);
5396 m.Return(m.TruncateFloat32ToInt64(m.Parameter(0)));
5397
5398 FOR_INT64_INPUTS(i) {
5399 float input = static_cast<float>(*i);
5400 if (input < 9223372036854775808.0 && input > -9223372036854775809.0) {
5401 CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
5402 }
5403 }
5404 FOR_FLOAT32_INPUTS(j) {
5405 if (*j < 9223372036854775808.0 && *j > -9223372036854775809.0) {
5406 CHECK_EQ(static_cast<int64_t>(*j), m.Call(*j));
5407 }
5408 }
5409 }
5410
5411
5394 TEST(RunTruncateFloat64ToInt64) { 5412 TEST(RunTruncateFloat64ToInt64) {
5395 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64); 5413 BufferedRawMachineAssemblerTester<int64_t> m(kMachFloat64);
5396 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0))); 5414 m.Return(m.TruncateFloat64ToInt64(m.Parameter(0)));
5397 5415
5398 FOR_INT64_INPUTS(i) { 5416 FOR_INT64_INPUTS(i) {
5399 double input = static_cast<double>(*i); 5417 double input = static_cast<double>(*i);
5400 CHECK_EQ(static_cast<int64_t>(input), m.Call(input)); 5418 CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
5401 } 5419 }
5402 } 5420 }
5403 5421
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5693 Node* call = r.AddNode(r.common()->Call(desc), phi); 5711 Node* call = r.AddNode(r.common()->Call(desc), phi);
5694 r.Return(call); 5712 r.Return(call);
5695 5713
5696 CHECK_EQ(33, r.Call(1)); 5714 CHECK_EQ(33, r.Call(1));
5697 CHECK_EQ(44, r.Call(0)); 5715 CHECK_EQ(44, r.Call(0));
5698 } 5716 }
5699 5717
5700 } // namespace compiler 5718 } // namespace compiler
5701 } // namespace internal 5719 } // namespace internal
5702 } // namespace v8 5720 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698