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

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

Issue 794473003: Revert of [turbofan] Correctify TruncateFloat64ToInt32 reduction in MachineOperatorReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 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/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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 Reduction reduction = Reduce(graph()->NewNode( 462 Reduction reduction = Reduce(graph()->NewNode(
463 machine()->TruncateFloat64ToInt32(), 463 machine()->TruncateFloat64ToInt32(),
464 graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p1, merge))); 464 graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p1, merge)));
465 ASSERT_TRUE(reduction.Changed()); 465 ASSERT_TRUE(reduction.Changed());
466 EXPECT_THAT(reduction.replacement(), 466 EXPECT_THAT(reduction.replacement(),
467 IsPhi(kMachInt32, IsTruncateFloat64ToInt32(p0), 467 IsPhi(kMachInt32, IsTruncateFloat64ToInt32(p0),
468 IsTruncateFloat64ToInt32(p1), merge)); 468 IsTruncateFloat64ToInt32(p1), merge));
469 } 469 }
470 470
471 471
472 TEST_F(MachineOperatorReducerTest,
473 TruncateFloat64ToInt32WithPhiAndChangeInt32ToFloat64) {
474 Node* const p0 = Parameter(0);
475 Node* const merge = graph()->start();
476 Node* const truncate = graph()->NewNode(
477 machine()->TruncateFloat64ToInt32(),
478 graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p0, merge));
479 truncate->InputAt(0)->ReplaceInput(
480 1, graph()->NewNode(machine()->ChangeInt32ToFloat64(), truncate));
481 Reduction reduction = Reduce(truncate);
482 ASSERT_TRUE(reduction.Changed());
483 Capture<Node*> phi;
484 EXPECT_THAT(
485 reduction.replacement(),
486 AllOf(CaptureEq(&phi), IsPhi(kMachInt32, IsTruncateFloat64ToInt32(p0),
487 CaptureEq(&phi), merge)));
488 }
489
490
491 // ----------------------------------------------------------------------------- 472 // -----------------------------------------------------------------------------
492 // TruncateInt64ToInt32 473 // TruncateInt64ToInt32
493 474
494 475
495 TEST_F(MachineOperatorReducerTest, TruncateInt64ToInt32WithChangeInt32ToInt64) { 476 TEST_F(MachineOperatorReducerTest, TruncateInt64ToInt32WithChangeInt32ToInt64) {
496 Node* value = Parameter(0); 477 Node* value = Parameter(0);
497 Reduction reduction = Reduce(graph()->NewNode( 478 Reduction reduction = Reduce(graph()->NewNode(
498 machine()->TruncateInt64ToInt32(), 479 machine()->TruncateInt64ToInt32(),
499 graph()->NewNode(machine()->ChangeInt32ToInt64(), value))); 480 graph()->NewNode(machine()->ChangeInt32ToInt64(), value)));
500 ASSERT_TRUE(reduction.Changed()); 481 ASSERT_TRUE(reduction.Changed());
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 Reduction r = Reduce(node); 1331 Reduction r = Reduce(node);
1351 ASSERT_TRUE(r.Changed()); 1332 ASSERT_TRUE(r.Changed());
1352 EXPECT_THAT(r.replacement(), 1333 EXPECT_THAT(r.replacement(),
1353 IsStore(rep, base, index, value, effect, control)); 1334 IsStore(rep, base, index, value, effect, control));
1354 } 1335 }
1355 } 1336 }
1356 1337
1357 } // namespace compiler 1338 } // namespace compiler
1358 } // namespace internal 1339 } // namespace internal
1359 } // namespace v8 1340 } // 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