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

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

Issue 20467004: Inline two argument shuffle operations on IA32 and X64. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | runtime/vm/disassembler_x64.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 (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_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 221
222 static InstructionTable instruction_table; 222 static InstructionTable instruction_table;
223 223
224 224
225 // Mnemonics for instructions 0xF0 byte. 225 // Mnemonics for instructions 0xF0 byte.
226 // Returns NULL if the instruction is not handled here. 226 // Returns NULL if the instruction is not handled here.
227 static const char* F0Mnem(uint8_t f0byte) { 227 static const char* F0Mnem(uint8_t f0byte) {
228 switch (f0byte) { 228 switch (f0byte) {
229 case 0x12: return "movhlps";
230 case 0x14: return "unpcklps";
231 case 0x15: return "unpckhps";
232 case 0x16: return "movlhps";
229 case 0xA2: return "cpuid"; 233 case 0xA2: return "cpuid";
230 case 0x31: return "rdtsc"; 234 case 0x31: return "rdtsc";
231 case 0xBE: return "movsx_b"; 235 case 0xBE: return "movsx_b";
232 case 0xBF: return "movsx_w"; 236 case 0xBF: return "movsx_w";
233 case 0xB6: return "movzx_b"; 237 case 0xB6: return "movzx_b";
234 case 0xB7: return "movzx_w"; 238 case 0xB7: return "movzx_w";
235 case 0xAF: return "imul"; 239 case 0xAF: return "imul";
236 case 0xA5: return "shld"; 240 case 0xA5: return "shld";
237 case 0xAD: return "shrd"; 241 case 0xAD: return "shrd";
238 case 0xAB: return "bts"; 242 case 0xAB: return "bts";
(...skipping 12 matching lines...) Expand all
251 case 0x5E: return "divps"; 255 case 0x5E: return "divps";
252 case 0x5F: return "maxps"; 256 case 0x5F: return "maxps";
253 case 0x28: return "movaps"; 257 case 0x28: return "movaps";
254 case 0x10: return "movups"; 258 case 0x10: return "movups";
255 case 0x11: return "movups"; 259 case 0x11: return "movups";
256 default: return NULL; 260 default: return NULL;
257 } 261 }
258 } 262 }
259 263
260 264
265 static bool IsTwoXmmRegInstruction(uint8_t f0byte) {
266 return f0byte == 0x28 || f0byte == 0x11 || f0byte == 0x12 ||
267 f0byte == 0x14 || f0byte == 0x15 || f0byte == 0x16 ||
268 f0byte == 0x51 || f0byte == 0x52 || f0byte == 0x53 ||
269 f0byte == 0x54 || f0byte == 0x56 || f0byte == 0x58 ||
270 f0byte == 0x59 || f0byte == 0x5C || f0byte == 0x5D ||
271 f0byte == 0x5E || f0byte == 0x5F;
272 }
273
274
261 // The implementation of x86 decoding based on the above tables. 275 // The implementation of x86 decoding based on the above tables.
262 class X86Decoder : public ValueObject { 276 class X86Decoder : public ValueObject {
263 public: 277 public:
264 X86Decoder(char* buffer, intptr_t buffer_size) 278 X86Decoder(char* buffer, intptr_t buffer_size)
265 : buffer_(buffer), 279 : buffer_(buffer),
266 buffer_size_(buffer_size), 280 buffer_size_(buffer_size),
267 buffer_pos_(0) { 281 buffer_pos_(0) {
268 buffer_[buffer_pos_] = '\0'; 282 buffer_[buffer_pos_] = '\0';
269 } 283 }
270 284
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 Print(" "); 1369 Print(" ");
1356 data += PrintRightOperand(data); 1370 data += PrintRightOperand(data);
1357 if (f0byte == 0xAB) { 1371 if (f0byte == 0xAB) {
1358 Print(","); 1372 Print(",");
1359 PrintCPURegister(regop); 1373 PrintCPURegister(regop);
1360 } else { 1374 } else {
1361 Print(","); 1375 Print(",");
1362 PrintCPURegister(regop); 1376 PrintCPURegister(regop);
1363 Print(",cl"); 1377 Print(",cl");
1364 } 1378 }
1365 } else if (f0byte == 0x28) {
1366 // movaps
1367 Print(f0mnem);
1368 int mod, regop, rm;
1369 GetModRm(*data, &mod, &regop, &rm);
1370 Print(" ");
1371 PrintXmmRegister(regop);
1372 Print(",");
1373 data += PrintRightXmmOperand(data);
1374 } else if (f0byte == 0x11) {
1375 Print("movups ");
1376 int mod, regop, rm;
1377 GetModRm(*data, &mod, &regop, &rm);
1378 data += PrintRightXmmOperand(data);
1379 Print(",");
1380 PrintXmmRegister(regop);
1381 } else if (f0byte == 0x10) { 1379 } else if (f0byte == 0x10) {
1382 int mod, regop, rm; 1380 int mod, regop, rm;
1383 GetModRm(*data, &mod, &regop, &rm); 1381 GetModRm(*data, &mod, &regop, &rm);
1384 Print("movups "); 1382 Print("movups ");
1385 PrintXmmRegister(regop); 1383 PrintXmmRegister(regop);
1386 Print(","); 1384 Print(",");
1387 data += PrintRightOperand(data); 1385 data += PrintRightOperand(data);
1388 } else if (f0byte == 0x51 || f0byte == 0x52 || f0byte == 0x53 || 1386 } else if (IsTwoXmmRegInstruction(f0byte)) {
1389 f0byte == 0x54 || f0byte == 0x56 || f0byte == 0x58 ||
1390 f0byte == 0x59 || f0byte == 0x5C || f0byte == 0x5D ||
1391 f0byte == 0x5E || f0byte == 0x5F) {
1392 int mod, regop, rm; 1387 int mod, regop, rm;
1393 GetModRm(*data, &mod, &regop, &rm); 1388 GetModRm(*data, &mod, &regop, &rm);
1394 Print(f0mnem); 1389 Print(f0mnem);
1395 Print(" "); 1390 Print(" ");
1396 PrintXmmRegister(regop); 1391 PrintXmmRegister(regop);
1397 Print(","); 1392 Print(",");
1398 data += PrintRightXmmOperand(data); 1393 data += PrintRightXmmOperand(data);
1399 } else if (f0byte == 0x50) { 1394 } else if (f0byte == 0x50) {
1400 Print("movmskpd "); 1395 Print("movmskpd ");
1401 int mod, regop, rm; 1396 int mod, regop, rm;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 Print("roundsd "); 1586 Print("roundsd ");
1592 PrintXmmRegister(regop); 1587 PrintXmmRegister(regop);
1593 Print(", "); 1588 Print(", ");
1594 PrintXmmRegister(rm); 1589 PrintXmmRegister(rm);
1595 Print(", "); 1590 Print(", ");
1596 PrintInt(data[1] & 3); 1591 PrintInt(data[1] & 3);
1597 data += 2; 1592 data += 2;
1598 } else { 1593 } else {
1599 UNIMPLEMENTED(); 1594 UNIMPLEMENTED();
1600 } 1595 }
1596 } else if (*data == 0x14) {
1597 int mod, regop, rm;
1598 GetModRm(*(data+1), &mod, &regop, &rm);
1599 Print("unpcklpd ");
1600 PrintXmmRegister(regop);
1601 Print(",");
1602 PrintXmmRegister(rm);
1603 data += 2;
1604 } else if (*data == 0x15) {
1605 int mod, regop, rm;
1606 GetModRm(*(data+1), &mod, &regop, &rm);
1607 Print("unpckhpd ");
1608 PrintXmmRegister(regop);
1609 Print(",");
1610 PrintXmmRegister(rm);
1611 data += 2;
1601 } else { 1612 } else {
1602 UNIMPLEMENTED(); 1613 UNIMPLEMENTED();
1603 } 1614 }
1604 } else if (*data == 0x90) { 1615 } else if (*data == 0x90) {
1605 data++; 1616 data++;
1606 Print("nop"); 1617 Print("nop");
1607 } else { 1618 } else {
1608 UNIMPLEMENTED(); 1619 UNIMPLEMENTED();
1609 } 1620 }
1610 break; 1621 break;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 pc); 1818 pc);
1808 pc += instruction_length; 1819 pc += instruction_length;
1809 } 1820 }
1810 1821
1811 return; 1822 return;
1812 } 1823 }
1813 1824
1814 } // namespace dart 1825 } // namespace dart
1815 1826
1816 #endif // defined TARGET_ARCH_IA32 1827 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698