OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
8 #if defined(TARGET_ARCH_ARM64) | 8 #if defined(TARGET_ARCH_ARM64) |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 | 10 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 534 } |
535 return 5; | 535 return 5; |
536 } | 536 } |
537 case 'r': { | 537 case 'r': { |
538 return FormatRegister(instr, format); | 538 return FormatRegister(instr, format); |
539 } | 539 } |
540 case 'v': { | 540 case 'v': { |
541 if (format[1] == 's') { | 541 if (format[1] == 's') { |
542 ASSERT(STRING_STARTS_WITH(format, "vsz")); | 542 ASSERT(STRING_STARTS_WITH(format, "vsz")); |
543 char const* sz_str; | 543 char const* sz_str; |
544 if (instr->Bit(22) == 0) { | 544 if (instr->Bits(14, 2) == 3) { |
545 sz_str = "f32"; | 545 switch (instr->Bit(22)) { |
| 546 case 0: sz_str = "s"; break; |
| 547 case 1: sz_str = "d"; break; |
| 548 default: UNREACHABLE(); break; |
| 549 } |
546 } else { | 550 } else { |
547 sz_str = "f64"; | 551 switch (instr->Bit(22)) { |
| 552 case 0: sz_str = "w"; break; |
| 553 case 1: sz_str = "x"; break; |
| 554 default: UNREACHABLE(); break; |
| 555 } |
548 } | 556 } |
549 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 557 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
550 remaining_size_in_buffer(), | 558 remaining_size_in_buffer(), |
551 "%s", | 559 "%s", |
552 sz_str); | 560 sz_str); |
553 return 3; | 561 return 3; |
554 } else { | 562 } else { |
555 return FormatVRegister(instr, format); | 563 return FormatVRegister(instr, format); |
556 } | 564 } |
557 } | 565 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 Unknown(instr); | 1029 Unknown(instr); |
1022 } | 1030 } |
1023 } | 1031 } |
1024 | 1032 |
1025 | 1033 |
1026 void ARM64Decoder::DecodeSIMDCopy(Instr* instr) { | 1034 void ARM64Decoder::DecodeSIMDCopy(Instr* instr) { |
1027 const int32_t Q = instr->Bit(30); | 1035 const int32_t Q = instr->Bit(30); |
1028 const int32_t op = instr->Bit(29); | 1036 const int32_t op = instr->Bit(29); |
1029 const int32_t imm4 = instr->Bits(11, 4); | 1037 const int32_t imm4 = instr->Bits(11, 4); |
1030 | 1038 |
1031 if ((Q == 1) && (op == 0) && (imm4 == 0)) { | 1039 if ((op == 0) && (imm4 == 7)) { |
| 1040 if (Q == 0) { |
| 1041 Format(instr, "vmovrs 'rd, 'vn'idx5"); |
| 1042 } else { |
| 1043 Format(instr, "vmovrd 'rd, 'vn'idx5"); |
| 1044 } |
| 1045 } else if ((Q == 1) && (op == 0) && (imm4 == 0)) { |
1032 Format(instr, "vdup'csz 'vd, 'vn'idx5"); | 1046 Format(instr, "vdup'csz 'vd, 'vn'idx5"); |
| 1047 } else if ((Q == 1) && (op == 0) && (imm4 == 3)) { |
| 1048 Format(instr, "vins'csz 'vd'idx5, 'rn"); |
| 1049 } else if ((Q == 1) && (op == 0) && (imm4 == 1)) { |
| 1050 Format(instr, "vdup'csz 'vd, 'rn"); |
1033 } else if ((Q == 1) && (op == 1)) { | 1051 } else if ((Q == 1) && (op == 1)) { |
1034 Format(instr, "vins'csz 'vd'idx5, 'vn'idx4"); | 1052 Format(instr, "vins'csz 'vd'idx5, 'vn'idx4"); |
1035 } else { | 1053 } else { |
1036 Unknown(instr); | 1054 Unknown(instr); |
1037 } | 1055 } |
1038 } | 1056 } |
1039 | 1057 |
1040 | 1058 |
1041 void ARM64Decoder::DecodeSIMDThreeSame(Instr* instr) { | 1059 void ARM64Decoder::DecodeSIMDThreeSame(Instr* instr) { |
1042 const int32_t Q = instr->Bit(30); | 1060 const int32_t Q = instr->Bit(30); |
1043 const int32_t U = instr->Bit(29); | 1061 const int32_t U = instr->Bit(29); |
1044 const int32_t opcode = instr->Bits(11, 5); | 1062 const int32_t opcode = instr->Bits(11, 5); |
1045 | 1063 |
1046 if (Q == 0) { | 1064 if (Q == 0) { |
1047 Unknown(instr); | 1065 Unknown(instr); |
1048 return; | 1066 return; |
1049 } | 1067 } |
1050 | 1068 |
1051 if ((U == 0) && (opcode == 0x1a)) { | 1069 if ((U == 0) && (opcode == 0x3)) { |
| 1070 if (instr->Bit(23) == 0) { |
| 1071 Format(instr, "vand 'vd, 'vn, 'vm"); |
| 1072 } else { |
| 1073 Format(instr, "vorr 'vd, 'vn, 'vm"); |
| 1074 } |
| 1075 } else if ((U == 1) && (opcode == 0x3)) { |
| 1076 Format(instr, "veor 'vd, 'vn, 'vm"); |
| 1077 } else if ((U == 0) && (opcode == 0x10)) { |
| 1078 Format(instr, "vadd'vsz 'vd, 'vn, 'vm"); |
| 1079 } else if ((U == 1) && (opcode == 0x10)) { |
| 1080 Format(instr, "vsub'vsz 'vd, 'vn, 'vm"); |
| 1081 } else if ((U == 0) && (opcode == 0x1a)) { |
1052 if (instr->Bit(23) == 0) { | 1082 if (instr->Bit(23) == 0) { |
1053 Format(instr, "vadd'vsz 'vd, 'vn, 'vm"); | 1083 Format(instr, "vadd'vsz 'vd, 'vn, 'vm"); |
1054 } else { | 1084 } else { |
1055 Format(instr, "vsub'vsz 'vd, 'vn, 'vm"); | 1085 Format(instr, "vsub'vsz 'vd, 'vn, 'vm"); |
1056 } | 1086 } |
1057 } else if ((U == 1) && (opcode == 0x1b)) { | 1087 } else if ((U == 1) && (opcode == 0x1b)) { |
1058 Format(instr, "vmul'vsz 'vd, 'vn, 'vm"); | 1088 Format(instr, "vmul'vsz 'vd, 'vn, 'vm"); |
1059 } else if ((U == 1) && (opcode == 0x1f)) { | 1089 } else if ((U == 1) && (opcode == 0x1f)) { |
1060 Format(instr, "vdiv'vsz 'vd, 'vn, 'vm"); | 1090 Format(instr, "vdiv'vsz 'vd, 'vn, 'vm"); |
1061 } else { | 1091 } else { |
1062 Unknown(instr); | 1092 Unknown(instr); |
1063 } | 1093 } |
1064 } | 1094 } |
1065 | 1095 |
1066 | 1096 |
| 1097 void ARM64Decoder::DecodeSIMDTwoReg(Instr* instr) { |
| 1098 const int32_t Q = instr->Bit(30); |
| 1099 const int32_t U = instr->Bit(29); |
| 1100 const int32_t op = instr->Bits(12, 5); |
| 1101 const int32_t sz = instr->Bits(22, 2); |
| 1102 |
| 1103 if (Q == 0) { |
| 1104 Unknown(instr); |
| 1105 return; |
| 1106 } |
| 1107 |
| 1108 if ((U == 1) && (op == 0x5)) { |
| 1109 Format(instr, "vnot 'vd, 'vn"); |
| 1110 } else if ((U == 0) && (op == 0xf)) { |
| 1111 if (sz == 2) { |
| 1112 Format(instr, "vabss 'vd, 'vn"); |
| 1113 } else if (sz == 3) { |
| 1114 Format(instr, "vabsd 'vd, 'vn"); |
| 1115 } else { |
| 1116 Unknown(instr); |
| 1117 } |
| 1118 } else if ((U == 1) && (op == 0xf)) { |
| 1119 if (sz == 2) { |
| 1120 Format(instr, "vnegs 'vd, 'vn"); |
| 1121 } else if (sz == 3) { |
| 1122 Format(instr, "vnegd 'vd, 'vn"); |
| 1123 } else { |
| 1124 Unknown(instr); |
| 1125 } |
| 1126 } else { |
| 1127 Unknown(instr); |
| 1128 } |
| 1129 } |
| 1130 |
| 1131 |
1067 void ARM64Decoder::DecodeDPSimd1(Instr* instr) { | 1132 void ARM64Decoder::DecodeDPSimd1(Instr* instr) { |
1068 if (instr->IsSIMDCopyOp()) { | 1133 if (instr->IsSIMDCopyOp()) { |
1069 DecodeSIMDCopy(instr); | 1134 DecodeSIMDCopy(instr); |
1070 } else if (instr->IsSIMDThreeSameOp()) { | 1135 } else if (instr->IsSIMDThreeSameOp()) { |
1071 DecodeSIMDThreeSame(instr); | 1136 DecodeSIMDThreeSame(instr); |
| 1137 } else if (instr->IsSIMDTwoRegOp()) { |
| 1138 DecodeSIMDTwoReg(instr); |
1072 } else { | 1139 } else { |
1073 Unknown(instr); | 1140 Unknown(instr); |
1074 } | 1141 } |
1075 } | 1142 } |
1076 | 1143 |
1077 | 1144 |
1078 void ARM64Decoder::DecodeFPImm(Instr* instr) { | 1145 void ARM64Decoder::DecodeFPImm(Instr* instr) { |
1079 if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bit(23) != 0) || | 1146 if ((instr->Bit(31) != 0) || (instr->Bit(29) != 0) || (instr->Bit(23) != 0) || |
1080 (instr->Bits(5, 5) != 0)) { | 1147 (instr->Bits(5, 5) != 0)) { |
1081 Unknown(instr); | 1148 Unknown(instr); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 human_buffer, | 1344 human_buffer, |
1278 sizeof(human_buffer), | 1345 sizeof(human_buffer), |
1279 pc); | 1346 pc); |
1280 pc += instruction_length; | 1347 pc += instruction_length; |
1281 } | 1348 } |
1282 } | 1349 } |
1283 | 1350 |
1284 } // namespace dart | 1351 } // namespace dart |
1285 | 1352 |
1286 #endif // defined TARGET_ARCH_ARM | 1353 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |