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

Side by Side Diff: src/compiler/machine-operator-reducer.cc

Issue 735623002: [turbofan] Avoid useless sign extension after sign extended load. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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
« no previous file with comments | « no previous file | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | 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/compiler/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler/diamond.h" 10 #include "src/compiler/diamond.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return ReplaceInt32(m.left().Value() >> m.right().Value()); 243 return ReplaceInt32(m.left().Value() >> m.right().Value());
244 } 244 }
245 break; 245 break;
246 } 246 }
247 case IrOpcode::kWord32Sar: { 247 case IrOpcode::kWord32Sar: {
248 Int32BinopMatcher m(node); 248 Int32BinopMatcher m(node);
249 if (m.right().Is(0)) return Replace(m.left().node()); // x >> 0 => x 249 if (m.right().Is(0)) return Replace(m.left().node()); // x >> 0 => x
250 if (m.IsFoldable()) { // K >> K => K 250 if (m.IsFoldable()) { // K >> K => K
251 return ReplaceInt32(m.left().Value() >> m.right().Value()); 251 return ReplaceInt32(m.left().Value() >> m.right().Value());
252 } 252 }
253 if (m.left().IsWord32Shl()) {
254 Int32BinopMatcher mleft(m.left().node());
255 if (mleft.left().IsLoad()) {
256 LoadRepresentation const rep =
257 OpParameter<LoadRepresentation>(mleft.left().node());
258 if (m.right().Is(24) && mleft.right().Is(24) && rep == kMachInt8) {
259 // Load[kMachInt8] << 24 >> 24 => Load[kMachInt8]
260 return Replace(mleft.left().node());
261 }
262 if (m.right().Is(16) && mleft.right().Is(16) && rep == kMachInt16) {
263 // Load[kMachInt16] << 16 >> 16 => Load[kMachInt8]
264 return Replace(mleft.left().node());
265 }
266 }
267 }
253 break; 268 break;
254 } 269 }
255 case IrOpcode::kWord32Ror: { 270 case IrOpcode::kWord32Ror: {
256 Int32BinopMatcher m(node); 271 Int32BinopMatcher m(node);
257 if (m.right().Is(0)) return Replace(m.left().node()); // x ror 0 => x 272 if (m.right().Is(0)) return Replace(m.left().node()); // x ror 0 => x
258 if (m.IsFoldable()) { // K ror K => K 273 if (m.IsFoldable()) { // K ror K => K
259 return ReplaceInt32( 274 return ReplaceInt32(
260 base::bits::RotateRight32(m.left().Value(), m.right().Value())); 275 base::bits::RotateRight32(m.left().Value(), m.right().Value()));
261 } 276 }
262 break; 277 break;
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 813 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
799 return jsgraph()->machine(); 814 return jsgraph()->machine();
800 } 815 }
801 816
802 817
803 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 818 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
804 819
805 } // namespace compiler 820 } // namespace compiler
806 } // namespace internal 821 } // namespace internal
807 } // namespace v8 822 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698