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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2427483002: [turbofan][X64] Movzxbl/Movsxbl/Movzxwl/Movsxwl also zero extend to 64bit. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | test/unittests/compiler/x64/instruction-selector-x64-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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 Node* const value = node->InputAt(0); 1243 Node* const value = node->InputAt(0);
1244 switch (value->opcode()) { 1244 switch (value->opcode()) {
1245 case IrOpcode::kInt32AddWithOverflow: 1245 case IrOpcode::kInt32AddWithOverflow:
1246 case IrOpcode::kInt32SubWithOverflow: 1246 case IrOpcode::kInt32SubWithOverflow:
1247 case IrOpcode::kInt32MulWithOverflow: 1247 case IrOpcode::kInt32MulWithOverflow:
1248 return true; 1248 return true;
1249 default: 1249 default:
1250 return false; 1250 return false;
1251 } 1251 }
1252 } 1252 }
1253 case IrOpcode::kLoad: {
1254 // The movzxbl/movsxbl/movzxwl/movsxwl operations implicitly zero-extend
1255 // to 64-bit on x64,
1256 // so the zero-extension is a no-op.
1257 LoadRepresentation load_rep = LoadRepresentationOf(node->op());
1258 ArchOpcode opcode = GetLoadOpcode(load_rep);
Benedikt Meurer 2016/10/17 08:20:42 How about pattern matching the representation inst
1259 switch (opcode) {
1260 case kX64Movzxbl:
1261 case kX64Movsxbl:
1262 case kX64Movzxwl:
1263 case kX64Movsxwl:
1264 return true;
1265 default:
1266 return false;
1267 }
1268 }
1253 default: 1269 default:
1254 return false; 1270 return false;
1255 } 1271 }
1256 } 1272 }
1257 1273
1258 } // namespace 1274 } // namespace
1259 1275
1260 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { 1276 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
1261 X64OperandGenerator g(this); 1277 X64OperandGenerator g(this);
1262 Node* value = node->InputAt(0); 1278 Node* value = node->InputAt(0);
1263 if (ZeroExtendsWord32ToWord64(value)) { 1279 if (ZeroExtendsWord32ToWord64(value)) {
1264 // These 32-bit operations implicitly zero-extend to 64-bit on x64, so the 1280 // These 32-bit operations implicitly zero-extend to 64-bit on x64, so the
1265 // zero-extension is a no-op. 1281 // zero-extension is a no-op.
1266 return EmitIdentity(node); 1282 return EmitIdentity(node);
1267 } 1283 }
1284
titzer 2016/10/17 08:13:35 Spurious whitespace change.
1268 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); 1285 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value));
1269 } 1286 }
1270 1287
1271 1288
1272 namespace { 1289 namespace {
1273 1290
1274 void VisitRO(InstructionSelector* selector, Node* node, 1291 void VisitRO(InstructionSelector* selector, Node* node,
1275 InstructionCode opcode) { 1292 InstructionCode opcode) {
1276 X64OperandGenerator g(selector); 1293 X64OperandGenerator g(selector);
1277 selector->Emit(opcode, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 1294 selector->Emit(opcode, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 // static 2350 // static
2334 MachineOperatorBuilder::AlignmentRequirements 2351 MachineOperatorBuilder::AlignmentRequirements
2335 InstructionSelector::AlignmentRequirements() { 2352 InstructionSelector::AlignmentRequirements() {
2336 return MachineOperatorBuilder::AlignmentRequirements:: 2353 return MachineOperatorBuilder::AlignmentRequirements::
2337 FullUnalignedAccessSupport(); 2354 FullUnalignedAccessSupport();
2338 } 2355 }
2339 2356
2340 } // namespace compiler 2357 } // namespace compiler
2341 } // namespace internal 2358 } // namespace internal
2342 } // namespace v8 2359 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/x64/instruction-selector-x64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698