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

Side by Side Diff: runtime/vm/disassembler_x64.cc

Issue 12207117: SSE Assembler and Disassembler support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests Created 7 years, 10 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
« runtime/platform/globals.h ('K') | « runtime/vm/disassembler_ia32.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_X64) 8 #if defined(TARGET_ARCH_X64)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 current += 4; 1387 current += 4;
1388 } // else no immediate displacement. 1388 } // else no immediate displacement.
1389 AppendToBuffer("nop"); 1389 AppendToBuffer("nop");
1390 1390
1391 } else if (opcode == 0x28) { 1391 } else if (opcode == 0x28) {
1392 // movaps xmm, xmm/m128 1392 // movaps xmm, xmm/m128
1393 int mod, regop, rm; 1393 int mod, regop, rm;
1394 get_modrm(*current, &mod, &regop, &rm); 1394 get_modrm(*current, &mod, &regop, &rm);
1395 AppendToBuffer("movaps %s, ", NameOfXMMRegister(regop)); 1395 AppendToBuffer("movaps %s, ", NameOfXMMRegister(regop));
1396 current += PrintRightXMMOperand(current); 1396 current += PrintRightXMMOperand(current);
1397
1398 } else if (opcode == 0x29) { 1397 } else if (opcode == 0x29) {
1399 // movaps xmm/m128, xmm 1398 // movaps xmm/m128, xmm
1400 int mod, regop, rm; 1399 int mod, regop, rm;
1401 get_modrm(*current, &mod, &regop, &rm); 1400 get_modrm(*current, &mod, &regop, &rm);
1402 AppendToBuffer("movaps "); 1401 AppendToBuffer("movaps ");
1403 current += PrintRightXMMOperand(current); 1402 current += PrintRightXMMOperand(current);
1404 AppendToBuffer(", %s", NameOfXMMRegister(regop)); 1403 AppendToBuffer(", %s", NameOfXMMRegister(regop));
1405 1404 } else if (opcode == 0x11) {
1405 // movups xmm/m128, xmm
1406 int mod, regop, rm;
1407 get_modrm(*current, &mod, &regop, &rm);
1408 AppendToBuffer("movups ");
1409 current += PrintRightXMMOperand(current);
1410 AppendToBuffer(", %s", NameOfXMMRegister(regop));
1411 } else if (opcode == 0x10) {
1412 // movups xmm, xmm/m128
1413 int mod, regop, rm;
1414 get_modrm(*current, &mod, &regop, &rm);
1415 AppendToBuffer("movups %s, ", NameOfXMMRegister(regop));
1416 current += PrintRightXMMOperand(current);
1406 } else if (opcode == 0xA2 || opcode == 0x31) { 1417 } else if (opcode == 0xA2 || opcode == 0x31) {
1407 // RDTSC or CPUID 1418 // RDTSC or CPUID
1408 AppendToBuffer("%s", mnemonic); 1419 AppendToBuffer("%s", mnemonic);
1409 1420
1410 } else if ((opcode & 0xF0) == 0x40) { 1421 } else if ((opcode & 0xF0) == 0x40) {
1411 // CMOVcc: conditional move. 1422 // CMOVcc: conditional move.
1412 int condition = opcode & 0x0F; 1423 int condition = opcode & 0x0F;
1413 const InstructionDesc& idesc = cmov_instructions[condition]; 1424 const InstructionDesc& idesc = cmov_instructions[condition];
1414 byte_size_operand_ = idesc.byte_size_operation; 1425 byte_size_operand_ = idesc.byte_size_operation;
1415 current += PrintOperands(idesc.mnem, idesc.op_order_, current); 1426 current += PrintOperands(idesc.mnem, idesc.op_order_, current);
1416 1427
1417 } else if (opcode == 0x57) { 1428 } else if (opcode == 0x51 || opcode == 0x52 || opcode == 0x53 ||
1418 // xorps xmm, xmm/m128 1429 opcode == 0x54 || opcode == 0x56 || opcode == 0x57 ||
1430 opcode == 0x58 || opcode == 0x59 || opcode == 0x5C ||
1431 opcode == 0x5D || opcode == 0x5E || opcode == 0x5F) {
1432 const char* mnemonic = NULL;
1433 switch (opcode) {
1434 case 0x51:
1435 mnemonic = "sqrtps";
1436 break;
srdjan 2013/02/12 19:06:35 Strange 'break' indent. Instead of switch, why no
Cutch 2013/02/12 22:34:27 Cleaned up.
1437 case 0x52:
1438 mnemonic = "rsqrtps";
1439 break;
1440 case 0x53:
1441 mnemonic = "rcpps";
1442 break;
1443 case 0x54:
1444 mnemonic = "andps";
1445 break;
1446 case 0x56:
1447 mnemonic = "orps";
1448 break;
1449 case 0x57:
1450 mnemonic = "xorps";
1451 break;
1452 case 0x58:
1453 mnemonic = "addps";
1454 break;
1455 case 0x59:
1456 mnemonic = "mulps";
1457 break;
1458 case 0x5C:
1459 mnemonic = "subps";
1460 break;
1461 case 0x5D:
1462 mnemonic = "minps";
1463 break;
1464 case 0x5E:
1465 mnemonic = "divps";
1466 break;
1467 case 0x5F:
1468 mnemonic = "maxps";
1469 break;
1470 default:
1471 UNREACHABLE();
1472 break;
1473 }
1419 int mod, regop, rm; 1474 int mod, regop, rm;
1420 get_modrm(*current, &mod, &regop, &rm); 1475 get_modrm(*current, &mod, &regop, &rm);
1421 AppendToBuffer("xorps %s, ", NameOfXMMRegister(regop)); 1476 AppendToBuffer("%s %s, ", mnemonic, NameOfXMMRegister(regop));
1422 current += PrintRightXMMOperand(current); 1477 current += PrintRightXMMOperand(current);
1423 1478 } else if (opcode == 0xC2 || opcode == 0xC6) {
1479 int mod, regop, rm;
1480 get_modrm(*current, &mod, &regop, &rm);
1481 if (opcode == 0xC2) {
1482 AppendToBuffer("cmpps %s, ", NameOfXMMRegister(regop));
1483 } else {
1484 ASSERT(opcode == 0xC6);
1485 AppendToBuffer("shufps %s, ", NameOfXMMRegister(regop));
1486 }
1487 current += PrintRightXMMOperand(current);
1488 AppendToBuffer(" [%x]", *current);
1489 current++;
1424 } else if ((opcode & 0xF0) == 0x80) { 1490 } else if ((opcode & 0xF0) == 0x80) {
1425 // Jcc: Conditional jump (branch). 1491 // Jcc: Conditional jump (branch).
1426 current = data + JumpConditional(data); 1492 current = data + JumpConditional(data);
1427 1493
1428 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || 1494 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 ||
1429 opcode == 0xB7 || opcode == 0xAF) { 1495 opcode == 0xB7 || opcode == 0xAF) {
1430 // Size-extending moves, IMUL. 1496 // Size-extending moves, IMUL.
1431 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); 1497 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current);
1432 1498
1433 } else if ((opcode & 0xF0) == 0x90) { 1499 } else if ((opcode & 0xF0) == 0x90) {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 human_buffer, 1939 human_buffer,
1874 sizeof(human_buffer), 1940 sizeof(human_buffer),
1875 pc); 1941 pc);
1876 pc += instruction_length; 1942 pc += instruction_length;
1877 } 1943 }
1878 } 1944 }
1879 1945
1880 } // namespace dart 1946 } // namespace dart
1881 1947
1882 #endif // defined TARGET_ARCH_X64 1948 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/platform/globals.h ('K') | « runtime/vm/disassembler_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698