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

Side by Side Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 707683003: [turbofan] Push TruncateFloat64ToInt32 into phis. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/machine-operator-reducer.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. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/division-by-constant.h" 6 #include "src/base/division-by-constant.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator-reducer.h" 8 #include "src/compiler/machine-operator-reducer.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "test/unittests/compiler/graph-unittest.h" 10 #include "test/unittests/compiler/graph-unittest.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 TEST_F(MachineOperatorReducerTest, TruncateFloat64ToInt32WithConstant) { 448 TEST_F(MachineOperatorReducerTest, TruncateFloat64ToInt32WithConstant) {
449 TRACED_FOREACH(double, x, kFloat64Values) { 449 TRACED_FOREACH(double, x, kFloat64Values) {
450 Reduction reduction = Reduce(graph()->NewNode( 450 Reduction reduction = Reduce(graph()->NewNode(
451 machine()->TruncateFloat64ToInt32(), Float64Constant(x))); 451 machine()->TruncateFloat64ToInt32(), Float64Constant(x)));
452 ASSERT_TRUE(reduction.Changed()); 452 ASSERT_TRUE(reduction.Changed());
453 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(x))); 453 EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(x)));
454 } 454 }
455 } 455 }
456 456
457 457
458 TEST_F(MachineOperatorReducerTest, TruncateFloat64ToInt32WithPhi) {
459 Node* const p0 = Parameter(0);
460 Node* const p1 = Parameter(1);
461 Node* const merge = graph()->start();
462 Reduction reduction = Reduce(graph()->NewNode(
463 machine()->TruncateFloat64ToInt32(),
464 graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p1, merge)));
465 ASSERT_TRUE(reduction.Changed());
466 EXPECT_THAT(reduction.replacement(),
467 IsPhi(kMachInt32, IsTruncateFloat64ToInt32(p0),
468 IsTruncateFloat64ToInt32(p1), merge));
469 }
470
471
458 // ----------------------------------------------------------------------------- 472 // -----------------------------------------------------------------------------
459 // TruncateInt64ToInt32 473 // TruncateInt64ToInt32
460 474
461 475
462 TEST_F(MachineOperatorReducerTest, TruncateInt64ToInt32WithChangeInt32ToInt64) { 476 TEST_F(MachineOperatorReducerTest, TruncateInt64ToInt32WithChangeInt32ToInt64) {
463 Node* value = Parameter(0); 477 Node* value = Parameter(0);
464 Reduction reduction = Reduce(graph()->NewNode( 478 Reduction reduction = Reduce(graph()->NewNode(
465 machine()->TruncateInt64ToInt32(), 479 machine()->TruncateInt64ToInt32(),
466 graph()->NewNode(machine()->ChangeInt32ToInt64(), value))); 480 graph()->NewNode(machine()->ChangeInt32ToInt64(), value)));
467 ASSERT_TRUE(reduction.Changed()); 481 ASSERT_TRUE(reduction.Changed());
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 Reduction r = Reduce(node); 1218 Reduction r = Reduce(node);
1205 ASSERT_TRUE(r.Changed()); 1219 ASSERT_TRUE(r.Changed());
1206 EXPECT_THAT(r.replacement(), 1220 EXPECT_THAT(r.replacement(),
1207 IsStore(rep, base, index, value, effect, control)); 1221 IsStore(rep, base, index, value, effect, control));
1208 } 1222 }
1209 } 1223 }
1210 1224
1211 } // namespace compiler 1225 } // namespace compiler
1212 } // namespace internal 1226 } // namespace internal
1213 } // namespace v8 1227 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698