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

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

Issue 648663002: [turbofan] Optimize Uint32LessThan with Word32Sar. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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 | « test/unittests/compiler/graph-unittest.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/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/machine-operator-reducer.h" 7 #include "src/compiler/machine-operator-reducer.h"
8 #include "src/compiler/typer.h" 8 #include "src/compiler/typer.h"
9 #include "test/unittests/compiler/graph-unittest.h" 9 #include "test/unittests/compiler/graph-unittest.h"
10 10
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 649
650 r = Reduce(graph()->NewNode(common()->Projection(0), add)); 650 r = Reduce(graph()->NewNode(common()->Projection(0), add));
651 ASSERT_TRUE(r.Changed()); 651 ASSERT_TRUE(r.Changed());
652 EXPECT_THAT(r.replacement(), IsInt32Constant(z)); 652 EXPECT_THAT(r.replacement(), IsInt32Constant(z));
653 } 653 }
654 } 654 }
655 } 655 }
656 656
657 657
658 // ----------------------------------------------------------------------------- 658 // -----------------------------------------------------------------------------
659 // Uint32LessThan
660
661
662 TEST_F(MachineOperatorReducerTest, Uint32LessThanWithWord32Sar) {
663 Node* const p0 = Parameter(0);
664 TRACED_FORRANGE(uint32_t, shift, 1, 3) {
665 const uint32_t limit = (kMaxInt >> shift) - 1;
666 Node* const node = graph()->NewNode(
667 machine()->Uint32LessThan(),
668 graph()->NewNode(machine()->Word32Sar(), p0, Uint32Constant(shift)),
669 Uint32Constant(limit));
670
671 Reduction r = Reduce(node);
672 ASSERT_TRUE(r.Changed());
673 EXPECT_THAT(
674 r.replacement(),
675 IsUint32LessThan(p0, IsInt32Constant(bit_cast<int32_t>(
676 (limit << shift) | ((1u << shift) - 1)))));
677 }
678 }
679
680
681 // -----------------------------------------------------------------------------
659 // Store 682 // Store
660 683
661 684
662 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 685 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
663 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); 686 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier);
664 Node* const base = Parameter(0); 687 Node* const base = Parameter(0);
665 Node* const index = Parameter(1); 688 Node* const index = Parameter(1);
666 Node* const value = Parameter(2); 689 Node* const value = Parameter(2);
667 Node* const effect = graph()->start(); 690 Node* const effect = graph()->start();
668 Node* const control = graph()->start(); 691 Node* const control = graph()->start();
(...skipping 29 matching lines...) Expand all
698 Reduction r = Reduce(node); 721 Reduction r = Reduce(node);
699 ASSERT_TRUE(r.Changed()); 722 ASSERT_TRUE(r.Changed());
700 EXPECT_THAT(r.replacement(), 723 EXPECT_THAT(r.replacement(),
701 IsStore(rep, base, index, value, effect, control)); 724 IsStore(rep, base, index, value, effect, control));
702 } 725 }
703 } 726 }
704 727
705 } // namespace compiler 728 } // namespace compiler
706 } // namespace internal 729 } // namespace internal
707 } // namespace v8 730 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/graph-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698