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

Side by Side Diff: src/mips/disasm-mips.cc

Issue 1396133002: MIPS: r6 compact branch optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/mips/constants-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // A Disassembler object is used to disassemble a block of code instruction by 5 // A Disassembler object is used to disassemble a block of code instruction by
6 // instruction. The default implementation of the NameConverter object can be 6 // instruction. The default implementation of the NameConverter object can be
7 // overriden to modify register names or to do symbol lookup on addresses. 7 // overriden to modify register names or to do symbol lookup on addresses.
8 // 8 //
9 // The example below will disassemble a block of code and print it to stdout. 9 // The example below will disassemble a block of code and print it to stdout.
10 // 10 //
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 Format(instr, "balc 'imm26s -> 'imm26p4s2"); 1370 Format(instr, "balc 'imm26s -> 'imm26p4s2");
1371 break; 1371 break;
1372 case BNE: 1372 case BNE:
1373 Format(instr, "bne 'rs, 'rt, 'imm16u -> 'imm16p4s2"); 1373 Format(instr, "bne 'rs, 'rt, 'imm16u -> 'imm16p4s2");
1374 break; 1374 break;
1375 case BLEZ: 1375 case BLEZ:
1376 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) { 1376 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) {
1377 Format(instr, "blez 'rs, 'imm16u -> 'imm16p4s2"); 1377 Format(instr, "blez 'rs, 'imm16u -> 'imm16p4s2");
1378 } else if ((instr->RtValue() != instr->RsValue()) && 1378 } else if ((instr->RtValue() != instr->RsValue()) &&
1379 (instr->RsValue() != 0) && (instr->RtValue() != 0)) { 1379 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
1380 Format(instr, "bgeuc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); 1380 Format(instr, "bgeuc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
1381 } else if ((instr->RtValue() == instr->RsValue()) && 1381 } else if ((instr->RtValue() == instr->RsValue()) &&
1382 (instr->RtValue() != 0)) { 1382 (instr->RtValue() != 0)) {
1383 Format(instr, "bgezalc 'rs, 'imm16u -> 'imm16p4s2"); 1383 Format(instr, "bgezalc 'rs, 'imm16u -> 'imm16p4s2");
1384 } else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) { 1384 } else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
1385 Format(instr, "blezalc 'rt, 'imm16u -> 'imm16p4s2"); 1385 Format(instr, "blezalc 'rt, 'imm16u -> 'imm16p4s2");
1386 } else { 1386 } else {
1387 UNREACHABLE(); 1387 UNREACHABLE();
1388 } 1388 }
1389 break; 1389 break;
1390 case BGTZ: 1390 case BGTZ:
1391 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) { 1391 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) {
1392 Format(instr, "bgtz 'rs, 'imm16u -> 'imm16p4s2"); 1392 Format(instr, "bgtz 'rs, 'imm16u -> 'imm16p4s2");
1393 } else if ((instr->RtValue() != instr->RsValue()) && 1393 } else if ((instr->RtValue() != instr->RsValue()) &&
1394 (instr->RsValue() != 0) && (instr->RtValue() != 0)) { 1394 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
1395 Format(instr, "bltuc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); 1395 Format(instr, "bltuc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
(...skipping 16 matching lines...) Expand all
1412 Format(instr, "blezc 'rt, 'imm16u -> 'imm16p4s2"); 1412 Format(instr, "blezc 'rt, 'imm16u -> 'imm16p4s2");
1413 } else { 1413 } else {
1414 UNREACHABLE(); 1414 UNREACHABLE();
1415 } 1415 }
1416 break; 1416 break;
1417 case BGTZL: 1417 case BGTZL:
1418 if ((instr->RtValue() == instr->RsValue()) && (instr->RtValue() != 0)) { 1418 if ((instr->RtValue() == instr->RsValue()) && (instr->RtValue() != 0)) {
1419 Format(instr, "bltzc 'rt, 'imm16u -> 'imm16p4s2"); 1419 Format(instr, "bltzc 'rt, 'imm16u -> 'imm16p4s2");
1420 } else if ((instr->RtValue() != instr->RsValue()) && 1420 } else if ((instr->RtValue() != instr->RsValue()) &&
1421 (instr->RsValue() != 0) && (instr->RtValue() != 0)) { 1421 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
1422 Format(instr, "bltc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); 1422 Format(instr, "bltc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
1423 } else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) { 1423 } else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
1424 Format(instr, "bgtzc 'rt, 'imm16u -> 'imm16p4s2"); 1424 Format(instr, "bgtzc 'rt, 'imm16u -> 'imm16p4s2");
1425 } else { 1425 } else {
1426 UNREACHABLE(); 1426 UNREACHABLE();
1427 } 1427 }
1428 break; 1428 break;
1429 case POP66: 1429 case POP66:
1430 if (instr->RsValue() == JIC) { 1430 if (instr->RsValue() == JIC) {
1431 Format(instr, "jic 'rt, 'imm16s"); 1431 Format(instr, "jic 'rt, 'imm16s");
1432 } else { 1432 } else {
1433 Format(instr, "beqzc 'rs, 'imm21s -> 'imm21p4s2"); 1433 Format(instr, "beqzc 'rs, 'imm21s -> 'imm21p4s2");
1434 } 1434 }
1435 break; 1435 break;
1436 case POP76: 1436 case POP76:
1437 if (instr->RsValue() == JIALC) { 1437 if (instr->RsValue() == JIALC) {
1438 Format(instr, "jialc 'rt, 'imm16x"); 1438 Format(instr, "jialc 'rt, 'imm16x");
1439 } else { 1439 } else {
1440 Format(instr, "bnezc 'rs, 'imm21x -> 'imm21p4s2"); 1440 Format(instr, "bnezc 'rs, 'imm21x -> 'imm21p4s2");
1441 } 1441 }
1442 break; 1442 break;
1443 // ------------- Arithmetic instructions. 1443 // ------------- Arithmetic instructions.
1444 case ADDI: 1444 case ADDI:
1445 if (!IsMipsArchVariant(kMips32r6)) { 1445 if (!IsMipsArchVariant(kMips32r6)) {
1446 Format(instr, "addi 'rt, 'rs, 'imm16s"); 1446 Format(instr, "addi 'rt, 'rs, 'imm16s");
1447 } else { 1447 } else {
1448 // Check if BOVC or BEQC instruction. 1448 int rs_reg = instr->RsValue();
1449 if (instr->RsValue() >= instr->RtValue()) { 1449 int rt_reg = instr->RtValue();
1450 // Check if BOVC, BEQZALC or BEQC instruction.
1451 if (rs_reg >= rt_reg) {
1450 Format(instr, "bovc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); 1452 Format(instr, "bovc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1451 } else if (instr->RsValue() < instr->RtValue()) {
1452 Format(instr, "beqc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1453 } else { 1453 } else {
1454 UNREACHABLE(); 1454 if (rs_reg == 0) {
1455 Format(instr, "beqzalc 'rt, 'imm16s -> 'imm16p4s2");
1456 } else {
1457 Format(instr, "beqc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1458 }
1455 } 1459 }
1456 } 1460 }
1457 break; 1461 break;
1458 case DADDI: 1462 case DADDI:
1459 if (IsMipsArchVariant(kMips32r6)) { 1463 if (IsMipsArchVariant(kMips32r6)) {
1460 // Check if BNVC or BNEC instruction. 1464 int rs_reg = instr->RsValue();
1461 if (instr->RsValue() >= instr->RtValue()) { 1465 int rt_reg = instr->RtValue();
1466 // Check if BNVC, BNEZALC or BNEC instruction.
1467 if (rs_reg >= rt_reg) {
1462 Format(instr, "bnvc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); 1468 Format(instr, "bnvc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1463 } else if (instr->RsValue() < instr->RtValue()) {
1464 Format(instr, "bnec 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1465 } else { 1469 } else {
1466 UNREACHABLE(); 1470 if (rs_reg == 0) {
1471 Format(instr, "bnezalc 'rt, 'imm16s -> 'imm16p4s2");
1472 } else {
1473 Format(instr, "bnec 'rs, 'rt, 'imm16s -> 'imm16p4s2");
1474 }
1467 } 1475 }
1468 } 1476 }
1469 break; 1477 break;
1470 case ADDIU: 1478 case ADDIU:
1471 Format(instr, "addiu 'rt, 'rs, 'imm16s"); 1479 Format(instr, "addiu 'rt, 'rs, 'imm16s");
1472 break; 1480 break;
1473 case SLTI: 1481 case SLTI:
1474 Format(instr, "slti 'rt, 'rs, 'imm16s"); 1482 Format(instr, "slti 'rt, 'rs, 'imm16s");
1475 break; 1483 break;
1476 case SLTIU: 1484 case SLTIU:
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 1712 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
1705 } 1713 }
1706 } 1714 }
1707 1715
1708 1716
1709 #undef UNSUPPORTED 1717 #undef UNSUPPORTED
1710 1718
1711 } // namespace disasm 1719 } // namespace disasm
1712 1720
1713 #endif // V8_TARGET_ARCH_MIPS 1721 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/constants-mips.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698