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

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

Issue 1819383002: MIPS: [wasm] Lowering of Int64Shl, Int64Shr, Int64Sar, Int64Add and Int64Sub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Enable all lowering tests Created 4 years, 8 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
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/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 } 389 }
390 VisitRRO(this, kMipsShr, node); 390 VisitRRO(this, kMipsShr, node);
391 } 391 }
392 392
393 393
394 void InstructionSelector::VisitWord32Sar(Node* node) { 394 void InstructionSelector::VisitWord32Sar(Node* node) {
395 VisitRRO(this, kMipsSar, node); 395 VisitRRO(this, kMipsSar, node);
396 } 396 }
397 397
398 void InstructionSelector::VisitInt32PairAdd(Node* node) { UNIMPLEMENTED(); } 398 void InstructionSelector::VisitInt32PairAdd(Node* node) {
399 MipsOperandGenerator g(this);
399 400
400 void InstructionSelector::VisitInt32PairSub(Node* node) { UNIMPLEMENTED(); } 401 // We use UseUniqueRegister here to avoid register sharing with the output
402 // register.
403 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
404 g.UseUniqueRegister(node->InputAt(1)),
405 g.UseUniqueRegister(node->InputAt(2)),
406 g.UseUniqueRegister(node->InputAt(3))};
407 InstructionOperand outputs[] = {
408 g.DefineAsRegister(node),
409 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
410 Emit(kMipsAddPair, 2, outputs, 4, inputs);
411 }
412
413 void InstructionSelector::VisitInt32PairSub(Node* node) {
414 MipsOperandGenerator g(this);
415
416 // We use UseUniqueRegister here to avoid register sharing with the output
417 // register.
418 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
419 g.UseUniqueRegister(node->InputAt(1)),
420 g.UseUniqueRegister(node->InputAt(2)),
421 g.UseUniqueRegister(node->InputAt(3))};
422 InstructionOperand outputs[] = {
423 g.DefineAsRegister(node),
424 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
425 Emit(kMipsSubPair, 2, outputs, 4, inputs);
426 }
balazs.kilvady 2016/04/05 11:13:16 I like the VisitWord32PairShift() refactoring belo
Marija Antic 2016/04/05 12:28:34 Done.
401 427
402 void InstructionSelector::VisitInt32PairMul(Node* node) { UNIMPLEMENTED(); } 428 void InstructionSelector::VisitInt32PairMul(Node* node) { UNIMPLEMENTED(); }
403 429
404 void InstructionSelector::VisitWord32PairShl(Node* node) { UNIMPLEMENTED(); } 430 // Shared routine for multiple shift operations.
431 static void VisitWord32PairShift(InstructionSelector* selector,
432 InstructionCode opcode, Node* node) {
433 MipsOperandGenerator g(selector);
434 Int32Matcher m(node->InputAt(2));
435 InstructionOperand shift_operand;
436 if (m.HasValue()) {
437 shift_operand = g.UseImmediate(m.node());
438 } else {
439 shift_operand = g.UseUniqueRegister(m.node());
440 }
405 441
406 void InstructionSelector::VisitWord32PairShr(Node* node) { UNIMPLEMENTED(); } 442 // We use UseUniqueRegister here to avoid register sharing with the output
443 // register.
444 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
445 g.UseUniqueRegister(node->InputAt(1)),
446 shift_operand};
407 447
408 void InstructionSelector::VisitWord32PairSar(Node* node) { UNIMPLEMENTED(); } 448 InstructionOperand outputs[] = {
449 g.DefineAsRegister(node),
450 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
451
452 selector->Emit(opcode, 2, outputs, 3, inputs);
453 }
454
455 void InstructionSelector::VisitWord32PairShl(Node* node) {
456 VisitWord32PairShift(this, kMipsShlPair, node);
457 }
458
459 void InstructionSelector::VisitWord32PairShr(Node* node) {
460 VisitWord32PairShift(this, kMipsShrPair, node);
461 }
462
463 void InstructionSelector::VisitWord32PairSar(Node* node) {
464 VisitWord32PairShift(this, kMipsSarPair, node);
465 }
409 466
410 void InstructionSelector::VisitWord32Ror(Node* node) { 467 void InstructionSelector::VisitWord32Ror(Node* node) {
411 VisitRRO(this, kMipsRor, node); 468 VisitRRO(this, kMipsRor, node);
412 } 469 }
413 470
414 471
415 void InstructionSelector::VisitWord32Clz(Node* node) { 472 void InstructionSelector::VisitWord32Clz(Node* node) {
416 VisitRR(this, kMipsClz, node); 473 VisitRR(this, kMipsClz, node);
417 } 474 }
418 475
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 : g.UseRegister(length) 1036 : g.UseRegister(length)
980 : g.UseRegister(length); 1037 : g.UseRegister(length);
981 1038
982 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(), 1039 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
983 offset_operand, length_operand, g.UseRegister(value), 1040 offset_operand, length_operand, g.UseRegister(value),
984 g.UseRegister(buffer)); 1041 g.UseRegister(buffer));
985 } 1042 }
986 1043
987 1044
988 namespace { 1045 namespace {
989
990 // Shared routine for multiple compare operations. 1046 // Shared routine for multiple compare operations.
991 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1047 static void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
992 InstructionOperand left, InstructionOperand right, 1048 InstructionOperand left, InstructionOperand right,
993 FlagsContinuation* cont) { 1049 FlagsContinuation* cont) {
994 MipsOperandGenerator g(selector); 1050 MipsOperandGenerator g(selector);
995 opcode = cont->Encode(opcode); 1051 opcode = cont->Encode(opcode);
996 if (cont->IsBranch()) { 1052 if (cont->IsBranch()) {
997 selector->Emit(opcode, g.NoOutput(), left, right, 1053 selector->Emit(opcode, g.NoOutput(), left, right,
998 g.Label(cont->true_block()), g.Label(cont->false_block())); 1054 g.Label(cont->true_block()), g.Label(cont->false_block()));
999 } else if (cont->IsDeoptimize()) { 1055 } else if (cont->IsDeoptimize()) {
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 MachineOperatorBuilder::kFloat32Max | 1454 MachineOperatorBuilder::kFloat32Max |
1399 MachineOperatorBuilder::kFloat32RoundDown | 1455 MachineOperatorBuilder::kFloat32RoundDown |
1400 MachineOperatorBuilder::kFloat32RoundUp | 1456 MachineOperatorBuilder::kFloat32RoundUp |
1401 MachineOperatorBuilder::kFloat32RoundTruncate | 1457 MachineOperatorBuilder::kFloat32RoundTruncate |
1402 MachineOperatorBuilder::kFloat32RoundTiesEven; 1458 MachineOperatorBuilder::kFloat32RoundTiesEven;
1403 } 1459 }
1404 1460
1405 } // namespace compiler 1461 } // namespace compiler
1406 } // namespace internal 1462 } // namespace internal
1407 } // namespace v8 1463 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698