468
468
if (index == 4 && (base & 7) == 4 && scale == 0 /*times_1*/) {
469
469
// index == rsp means no index. Only use sib byte with no index for
470
470
// rsp and r12 base.
471
AppendToBuffer("[%s]", (this->*register_name)(base));
471
AppendToBuffer("[%s]", NameOfCPURegister(base));
473
473
} else if (base == 5) {
474
474
// base == rbp means no base register (when mod == 0).
475
475
int32_t disp = *reinterpret_cast<int32_t*>(modrmp + 2);
476
476
AppendToBuffer("[%s*%d+0x%x]",
477
(this->*register_name)(index),
477
NameOfCPURegister(index),
478
478
1 << scale, disp);
480
480
} else if (index != 4 && base != 5) {
481
481
// [base+index*scale]
482
482
AppendToBuffer("[%s+%s*%d]",
483
(this->*register_name)(base),
484
(this->*register_name)(index),
483
NameOfCPURegister(base),
484
NameOfCPURegister(index),
503
503
: *reinterpret_cast<char*>(modrmp + 2);
504
504
if (index == 4 && (base & 7) == 4 && scale == 0 /*times_1*/) {
506
AppendToBuffer("[%s-0x%x]", (this->*register_name)(base), -disp);
506
AppendToBuffer("[%s-0x%x]", NameOfCPURegister(base), -disp);
508
AppendToBuffer("[%s+0x%x]", (this->*register_name)(base), disp);
508
AppendToBuffer("[%s+0x%x]", NameOfCPURegister(base), disp);
512
512
AppendToBuffer("[%s+%s*%d-0x%x]",
513
(this->*register_name)(base),
514
(this->*register_name)(index),
513
NameOfCPURegister(base),
514
NameOfCPURegister(index),
518
518
AppendToBuffer("[%s+%s*%d+0x%x]",
519
(this->*register_name)(base),
520
(this->*register_name)(index),
519
NameOfCPURegister(base),
520
NameOfCPURegister(index),
528
528
int disp = (mod == 2) ? *reinterpret_cast<int32_t*>(modrmp + 1)
529
529
: *reinterpret_cast<char*>(modrmp + 1);
531
AppendToBuffer("[%s-0x%x]", (this->*register_name)(rm), -disp);
531
AppendToBuffer("[%s-0x%x]", NameOfCPURegister(rm), -disp);
533
AppendToBuffer("[%s+0x%x]", (this->*register_name)(rm), disp);
533
AppendToBuffer("[%s+0x%x]", NameOfCPURegister(rm), disp);
535
535
return (mod == 2) ? 5 : 2;
1019
1019
NameOfXMMRegister(regop));
1020
1020
current += PrintRightOperand(current);
1021
1021
} else if (opcode == 0x7E) {
1022
AppendToBuffer("mov%c %s,",
1023
rex_w() ? 'q' : 'd',
1024
NameOfCPURegister(regop));
1025
current += PrintRightXMMOperand(current);
1022
AppendToBuffer("mov%c ",
1023
rex_w() ? 'q' : 'd');
1024
current += PrintRightOperand(current);
1025
AppendToBuffer(", %s", NameOfXMMRegister(regop));
1027
1027
const char* mnemonic = "?";
1028
1028
if (opcode == 0x57) {
1029
1029
mnemonic = "xorpd";
1030
1030
} else if (opcode == 0x2E) {
1031
mnemonic = "ucomisd";
1032
} else if (opcode == 0x2F) {
1031
1033
mnemonic = "comisd";
1032
} else if (opcode == 0x2F) {
1033
mnemonic = "ucomisd";
1035
1035
UnimplementedInstruction();
1057
1057
// CVTSI2SD: integer to XMM double conversion.
1058
1058
int mod, regop, rm;
1059
1059
get_modrm(*current, &mod, ®op, &rm);
1060
AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop));
1060
AppendToBuffer("%sd %s,", mnemonic, NameOfXMMRegister(regop));
1061
1061
current += PrintRightOperand(current);
1062
1062
} else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) {
1063
1063
// XMM arithmetic. Mnemonic was retrieved at the start of this function.
1071
1071
} else if (group_1_prefix_ == 0xF3) {
1072
1072
// Instructions with prefix 0xF3.
1073
if (opcode == 0x2C) {
1073
if (opcode == 0x11 || opcode == 0x10) {
1074
// MOVSS: Move scalar double-precision fp to/from/between XMM registers.
1075
AppendToBuffer("movss ");
1077
get_modrm(*current, &mod, ®op, &rm);
1078
if (opcode == 0x11) {
1079
current += PrintRightOperand(current);
1080
AppendToBuffer(",%s", NameOfXMMRegister(regop));
1082
AppendToBuffer("%s,", NameOfXMMRegister(regop));
1083
current += PrintRightOperand(current);
1085
} else if (opcode == 0x2A) {
1086
// CVTSI2SS: integer to XMM single conversion.
1088
get_modrm(*current, &mod, ®op, &rm);
1089
AppendToBuffer("%ss %s,", mnemonic, NameOfXMMRegister(regop));
1090
current += PrintRightOperand(current);
1091
} else if (opcode == 0x2C) {
1074
1092
// CVTTSS2SI: Convert scalar single-precision FP to dword integer.
1075
1093
// Assert that mod is not 3, so source is memory, not an XMM register.
1076
1094
ASSERT_NE(0xC0, *current & 0xC0);