OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 AppendToBuffer("%s", f0mnem); | 1035 AppendToBuffer("%s", f0mnem); |
1036 data += 2; | 1036 data += 2; |
1037 } else if (f0byte == 0x28) { | 1037 } else if (f0byte == 0x28) { |
1038 data += 2; | 1038 data += 2; |
1039 int mod, regop, rm; | 1039 int mod, regop, rm; |
1040 get_modrm(*data, &mod, ®op, &rm); | 1040 get_modrm(*data, &mod, ®op, &rm); |
1041 AppendToBuffer("movaps %s,%s", | 1041 AppendToBuffer("movaps %s,%s", |
1042 NameOfXMMRegister(regop), | 1042 NameOfXMMRegister(regop), |
1043 NameOfXMMRegister(rm)); | 1043 NameOfXMMRegister(rm)); |
1044 data++; | 1044 data++; |
1045 } else if (f0byte >= 0x53 && f0byte <= 0x5F) { | 1045 } else if (f0byte == 0x10) { |
| 1046 data += 2; |
| 1047 int mod, regop, rm; |
| 1048 get_modrm(*data, &mod, ®op, &rm); |
| 1049 AppendToBuffer("movups %s,", NameOfXMMRegister(regop)); |
| 1050 data += PrintRightXMMOperand(data); |
| 1051 } else if (f0byte == 0x11) { |
| 1052 AppendToBuffer("movups "); |
| 1053 data += 2; |
| 1054 int mod, regop, rm; |
| 1055 get_modrm(*data, &mod, ®op, &rm); |
| 1056 data += PrintRightXMMOperand(data); |
| 1057 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
| 1058 } else if (f0byte >= 0x51 && f0byte <= 0x5F) { |
1046 const char* const pseudo_op[] = { | 1059 const char* const pseudo_op[] = { |
| 1060 "sqrtps", |
| 1061 "rsqrtps", |
1047 "rcpps", | 1062 "rcpps", |
1048 "andps", | 1063 "andps", |
1049 "andnps", | 1064 "andnps", |
1050 "orps", | 1065 "orps", |
1051 "xorps", | 1066 "xorps", |
1052 "addps", | 1067 "addps", |
1053 "mulps", | 1068 "mulps", |
1054 "cvtps2pd", | 1069 "cvtps2pd", |
1055 "cvtdq2ps", | 1070 "cvtdq2ps", |
1056 "subps", | 1071 "subps", |
1057 "minps", | 1072 "minps", |
1058 "divps", | 1073 "divps", |
1059 "maxps", | 1074 "maxps" |
1060 }; | 1075 }; |
1061 | 1076 |
1062 data += 2; | 1077 data += 2; |
1063 int mod, regop, rm; | 1078 int mod, regop, rm; |
1064 get_modrm(*data, &mod, ®op, &rm); | 1079 get_modrm(*data, &mod, ®op, &rm); |
1065 AppendToBuffer("%s %s,", | 1080 AppendToBuffer("%s %s,", |
1066 pseudo_op[f0byte - 0x53], | 1081 pseudo_op[f0byte - 0x51], |
1067 NameOfXMMRegister(regop)); | 1082 NameOfXMMRegister(regop)); |
1068 data += PrintRightXMMOperand(data); | 1083 data += PrintRightXMMOperand(data); |
1069 } else if (f0byte == 0x50) { | 1084 } else if (f0byte == 0x50) { |
1070 data += 2; | 1085 data += 2; |
1071 int mod, regop, rm; | 1086 int mod, regop, rm; |
1072 get_modrm(*data, &mod, ®op, &rm); | 1087 get_modrm(*data, &mod, ®op, &rm); |
1073 AppendToBuffer("movmskps %s,%s", | 1088 AppendToBuffer("movmskps %s,%s", |
1074 NameOfCPURegister(regop), | 1089 NameOfCPURegister(regop), |
1075 NameOfXMMRegister(rm)); | 1090 NameOfXMMRegister(rm)); |
1076 data++; | 1091 data++; |
| 1092 } else if (f0byte == 0xC2) { |
| 1093 // Intel manual 2A, Table 3-11. |
| 1094 data += 2; |
| 1095 int mod, regop, rm; |
| 1096 get_modrm(*data, &mod, ®op, &rm); |
| 1097 const char* const pseudo_op[] = { |
| 1098 "cmpeqps", |
| 1099 "cmpltps", |
| 1100 "cmpleps", |
| 1101 "cmpunordps", |
| 1102 "cmpneqps", |
| 1103 "cmpnltps", |
| 1104 "cmpnleps", |
| 1105 "cmpordps" |
| 1106 }; |
| 1107 AppendToBuffer("%s %s,%s", |
| 1108 pseudo_op[data[1]], |
| 1109 NameOfXMMRegister(regop), |
| 1110 NameOfXMMRegister(rm)); |
| 1111 data += 2; |
1077 } else if (f0byte== 0xC6) { | 1112 } else if (f0byte== 0xC6) { |
1078 // shufps xmm, xmm/m128, imm8 | 1113 // shufps xmm, xmm/m128, imm8 |
1079 data += 2; | 1114 data += 2; |
1080 int mod, regop, rm; | 1115 int mod, regop, rm; |
1081 get_modrm(*data, &mod, ®op, &rm); | 1116 get_modrm(*data, &mod, ®op, &rm); |
1082 int8_t imm8 = static_cast<int8_t>(data[1]); | 1117 int8_t imm8 = static_cast<int8_t>(data[1]); |
1083 AppendToBuffer("shufps %s,%s,%d", | 1118 AppendToBuffer("shufps %s,%s,%d", |
1084 NameOfXMMRegister(rm), | 1119 NameOfXMMRegister(rm), |
1085 NameOfXMMRegister(regop), | 1120 NameOfXMMRegister(regop), |
1086 static_cast<int>(imm8)); | 1121 static_cast<int>(imm8)); |
1087 data += 2; | 1122 data += 2; |
| 1123 } else if (f0byte== 0x5B) { |
| 1124 data += 2; |
| 1125 int mod, regop, rm; |
| 1126 get_modrm(*data, &mod, ®op, &rm); |
| 1127 AppendToBuffer("cvtdq2ps %s,", |
| 1128 NameOfXMMRegister(rm)); |
| 1129 data += PrintRightXMMOperand(data); |
1088 } else if ((f0byte & 0xF0) == 0x80) { | 1130 } else if ((f0byte & 0xF0) == 0x80) { |
1089 data += JumpConditional(data, branch_hint); | 1131 data += JumpConditional(data, branch_hint); |
1090 } else if (f0byte == 0xBE || f0byte == 0xBF || f0byte == 0xB6 || | 1132 } else if (f0byte == 0xBE || f0byte == 0xBF || f0byte == 0xB6 || |
1091 f0byte == 0xB7 || f0byte == 0xAF) { | 1133 f0byte == 0xB7 || f0byte == 0xAF) { |
1092 data += 2; | 1134 data += 2; |
1093 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); | 1135 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); |
1094 } else if ((f0byte & 0xF0) == 0x90) { | 1136 } else if ((f0byte & 0xF0) == 0x90) { |
1095 data += SetCC(data); | 1137 data += SetCC(data); |
1096 } else if ((f0byte & 0xF0) == 0x40) { | 1138 } else if ((f0byte & 0xF0) == 0x40) { |
1097 data += CMov(data); | 1139 data += CMov(data); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 if (*data == 0x38) { | 1270 if (*data == 0x38) { |
1229 data++; | 1271 data++; |
1230 if (*data == 0x17) { | 1272 if (*data == 0x17) { |
1231 data++; | 1273 data++; |
1232 int mod, regop, rm; | 1274 int mod, regop, rm; |
1233 get_modrm(*data, &mod, ®op, &rm); | 1275 get_modrm(*data, &mod, ®op, &rm); |
1234 AppendToBuffer("ptest %s,%s", | 1276 AppendToBuffer("ptest %s,%s", |
1235 NameOfXMMRegister(regop), | 1277 NameOfXMMRegister(regop), |
1236 NameOfXMMRegister(rm)); | 1278 NameOfXMMRegister(rm)); |
1237 data++; | 1279 data++; |
| 1280 } else if (*data == 0x40) { |
| 1281 data++; |
| 1282 int mod, regop, rm; |
| 1283 get_modrm(*data, &mod, ®op, &rm); |
| 1284 AppendToBuffer("pmulld %s,%s", |
| 1285 NameOfXMMRegister(regop)); |
| 1286 data += PrintRightXMMOperand(data); |
1238 } else if (*data == 0x2A) { | 1287 } else if (*data == 0x2A) { |
1239 // movntdqa | 1288 // movntdqa |
1240 data++; | 1289 data++; |
1241 int mod, regop, rm; | 1290 int mod, regop, rm; |
1242 get_modrm(*data, &mod, ®op, &rm); | 1291 get_modrm(*data, &mod, ®op, &rm); |
1243 AppendToBuffer("movntdqa %s,", NameOfXMMRegister(regop)); | 1292 AppendToBuffer("movntdqa %s,", NameOfXMMRegister(regop)); |
1244 data += PrintRightOperand(data); | 1293 data += PrintRightOperand(data); |
1245 } else { | 1294 } else { |
1246 UnimplementedInstruction(); | 1295 UnimplementedInstruction(); |
1247 } | 1296 } |
(...skipping 12 matching lines...) Expand all Loading... |
1260 } else if (*data == 0x16) { | 1309 } else if (*data == 0x16) { |
1261 data++; | 1310 data++; |
1262 int mod, regop, rm; | 1311 int mod, regop, rm; |
1263 get_modrm(*data, &mod, ®op, &rm); | 1312 get_modrm(*data, &mod, ®op, &rm); |
1264 int8_t imm8 = static_cast<int8_t>(data[1]); | 1313 int8_t imm8 = static_cast<int8_t>(data[1]); |
1265 AppendToBuffer("pextrd %s,%s,%d", | 1314 AppendToBuffer("pextrd %s,%s,%d", |
1266 NameOfCPURegister(regop), | 1315 NameOfCPURegister(regop), |
1267 NameOfXMMRegister(rm), | 1316 NameOfXMMRegister(rm), |
1268 static_cast<int>(imm8)); | 1317 static_cast<int>(imm8)); |
1269 data += 2; | 1318 data += 2; |
| 1319 } else if (*data == 0x21) { |
| 1320 data++; |
| 1321 int mod, regop, rm; |
| 1322 get_modrm(*data, &mod, ®op, &rm); |
| 1323 int8_t imm8 = static_cast<int8_t>(data[1]); |
| 1324 AppendToBuffer("insertps %s,%s,%d", |
| 1325 NameOfXMMRegister(regop), |
| 1326 NameOfXMMRegister(rm), |
| 1327 static_cast<int>(imm8)); |
| 1328 data += 2; |
1270 } else if (*data == 0x17) { | 1329 } else if (*data == 0x17) { |
1271 data++; | 1330 data++; |
1272 int mod, regop, rm; | 1331 int mod, regop, rm; |
1273 get_modrm(*data, &mod, ®op, &rm); | 1332 get_modrm(*data, &mod, ®op, &rm); |
1274 int8_t imm8 = static_cast<int8_t>(data[1]); | 1333 int8_t imm8 = static_cast<int8_t>(data[1]); |
1275 AppendToBuffer("extractps %s,%s,%d", | 1334 AppendToBuffer("extractps %s,%s,%d", |
1276 NameOfCPURegister(rm), | 1335 NameOfCPURegister(rm), |
1277 NameOfXMMRegister(regop), | 1336 NameOfXMMRegister(regop), |
1278 static_cast<int>(imm8)); | 1337 static_cast<int>(imm8)); |
1279 data += 2; | 1338 data += 2; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 NameOfXMMRegister(rm)); | 1388 NameOfXMMRegister(rm)); |
1330 data++; | 1389 data++; |
1331 } else if (*data == 0x57) { | 1390 } else if (*data == 0x57) { |
1332 data++; | 1391 data++; |
1333 int mod, regop, rm; | 1392 int mod, regop, rm; |
1334 get_modrm(*data, &mod, ®op, &rm); | 1393 get_modrm(*data, &mod, ®op, &rm); |
1335 AppendToBuffer("xorpd %s,%s", | 1394 AppendToBuffer("xorpd %s,%s", |
1336 NameOfXMMRegister(regop), | 1395 NameOfXMMRegister(regop), |
1337 NameOfXMMRegister(rm)); | 1396 NameOfXMMRegister(rm)); |
1338 data++; | 1397 data++; |
| 1398 } else if (*data == 0x5B) { |
| 1399 data++; |
| 1400 int mod, regop, rm; |
| 1401 get_modrm(*data, &mod, ®op, &rm); |
| 1402 AppendToBuffer("cvtps2dq %s,%s", |
| 1403 NameOfXMMRegister(regop)); |
| 1404 data += PrintRightXMMOperand(data); |
| 1405 } else if (*data == 0x62) { |
| 1406 data++; |
| 1407 int mod, regop, rm; |
| 1408 get_modrm(*data, &mod, ®op, &rm); |
| 1409 AppendToBuffer("punpackldq %s,", |
| 1410 NameOfXMMRegister(regop)); |
| 1411 data += PrintRightXMMOperand(data); |
| 1412 } else if (*data == 0xF4) { |
| 1413 data++; |
| 1414 int mod, regop, rm; |
| 1415 get_modrm(*data, &mod, ®op, &rm); |
| 1416 AppendToBuffer("pmuludq %s,", |
| 1417 NameOfXMMRegister(regop)); |
| 1418 data += PrintRightXMMOperand(data); |
| 1419 } else if (*data == 0xFA) { |
| 1420 data++; |
| 1421 int mod, regop, rm; |
| 1422 get_modrm(*data, &mod, ®op, &rm); |
| 1423 AppendToBuffer("psubd %s,", |
| 1424 NameOfXMMRegister(regop)); |
| 1425 data += PrintRightXMMOperand(data); |
| 1426 } else if (*data == 0xFE) { |
| 1427 data++; |
| 1428 int mod, regop, rm; |
| 1429 get_modrm(*data, &mod, ®op, &rm); |
| 1430 AppendToBuffer("paddd %s,", |
| 1431 NameOfXMMRegister(regop)); |
| 1432 data += PrintRightXMMOperand(data); |
1339 } else if (*data == 0x6E) { | 1433 } else if (*data == 0x6E) { |
1340 data++; | 1434 data++; |
1341 int mod, regop, rm; | 1435 int mod, regop, rm; |
1342 get_modrm(*data, &mod, ®op, &rm); | 1436 get_modrm(*data, &mod, ®op, &rm); |
1343 AppendToBuffer("movd %s,", NameOfXMMRegister(regop)); | 1437 AppendToBuffer("movd %s,", NameOfXMMRegister(regop)); |
1344 data += PrintRightOperand(data); | 1438 data += PrintRightOperand(data); |
1345 } else if (*data == 0x6F) { | 1439 } else if (*data == 0x6F) { |
1346 data++; | 1440 data++; |
1347 int mod, regop, rm; | 1441 int mod, regop, rm; |
1348 get_modrm(*data, &mod, ®op, &rm); | 1442 get_modrm(*data, &mod, ®op, &rm); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 fprintf(f, " "); | 1856 fprintf(f, " "); |
1763 } | 1857 } |
1764 fprintf(f, " %s\n", buffer.start()); | 1858 fprintf(f, " %s\n", buffer.start()); |
1765 } | 1859 } |
1766 } | 1860 } |
1767 | 1861 |
1768 | 1862 |
1769 } // namespace disasm | 1863 } // namespace disasm |
1770 | 1864 |
1771 #endif // V8_TARGET_ARCH_IA32 | 1865 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |