OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // A Disassembler object is used to disassemble a block of code instruction by | 5 // A Disassembler object is used to disassemble a block of code instruction by |
6 // instruction. The default implementation of the NameConverter object can be | 6 // instruction. The default implementation of the NameConverter object can be |
7 // overriden to modify register names or to do symbol lookup on addresses. | 7 // overriden to modify register names or to do symbol lookup on addresses. |
8 // | 8 // |
9 // The example below will disassemble a block of code and print it to stdout. | 9 // The example below will disassemble a block of code and print it to stdout. |
10 // | 10 // |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 } else if ((instr->VLValue() == 0x1) && (instr->VCValue() == 0x1)) { | 1569 } else if ((instr->VLValue() == 0x1) && (instr->VCValue() == 0x1)) { |
1570 int opc1_opc2 = (instr->Bits(22, 21) << 2) | instr->Bits(6, 5); | 1570 int opc1_opc2 = (instr->Bits(22, 21) << 2) | instr->Bits(6, 5); |
1571 if ((opc1_opc2 & 0xb) == 0) { | 1571 if ((opc1_opc2 & 0xb) == 0) { |
1572 // NeonS32 / NeonU32 | 1572 // NeonS32 / NeonU32 |
1573 if (instr->Bit(21) == 0x0) { | 1573 if (instr->Bit(21) == 0x0) { |
1574 Format(instr, "vmov'cond.32 'rt, 'Dd[0]"); | 1574 Format(instr, "vmov'cond.32 'rt, 'Dd[0]"); |
1575 } else { | 1575 } else { |
1576 Format(instr, "vmov'cond.32 'rt, 'Dd[1]"); | 1576 Format(instr, "vmov'cond.32 'rt, 'Dd[1]"); |
1577 } | 1577 } |
1578 } else { | 1578 } else { |
1579 const char* sign = instr->Bit(23) != 0 ? "u" : "s"; | 1579 char sign = instr->Bit(23) != 0 ? 'u' : 's'; |
1580 int rt = instr->RtValue(); | 1580 int rt = instr->RtValue(); |
1581 int vn = instr->VFPNRegValue(kDoublePrecision); | 1581 int vn = instr->VFPNRegValue(kDoublePrecision); |
1582 if ((opc1_opc2 & 0x8) != 0) { | 1582 if ((opc1_opc2 & 0x8) != 0) { |
1583 // NeonS8 / NeonU8 | 1583 // NeonS8 / NeonU8 |
1584 int i = opc1_opc2 & 0x7; | 1584 int i = opc1_opc2 & 0x7; |
1585 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1585 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1586 "vmov.%s8 r%d, d%d[%d]", sign, rt, vn, i); | 1586 "vmov.%c8 r%d, d%d[%d]", sign, rt, vn, i); |
1587 } else if ((opc1_opc2 & 0x1) != 0) { | 1587 } else if ((opc1_opc2 & 0x1) != 0) { |
1588 // NeonS16 / NeonU16 | 1588 // NeonS16 / NeonU16 |
1589 int i = (opc1_opc2 >> 1) & 0x3; | 1589 int i = (opc1_opc2 >> 1) & 0x3; |
1590 out_buffer_pos_ += | 1590 out_buffer_pos_ += |
1591 SNPrintF(out_buffer_ + out_buffer_pos_, "vmov.%s16 r%d, d%d[%d]", | 1591 SNPrintF(out_buffer_ + out_buffer_pos_, "vmov.%c16 r%d, d%d[%d]", |
1592 sign, rt, vn, i); | 1592 sign, rt, vn, i); |
1593 } else { | 1593 } else { |
1594 Unknown(instr); | 1594 Unknown(instr); |
1595 } | 1595 } |
1596 } | 1596 } |
1597 } else if ((instr->VCValue() == 0x0) && | 1597 } else if ((instr->VCValue() == 0x0) && |
1598 (instr->VAValue() == 0x7) && | 1598 (instr->VAValue() == 0x7) && |
1599 (instr->Bits(19, 16) == 0x1)) { | 1599 (instr->Bits(19, 16) == 0x1)) { |
1600 if (instr->VLValue() == 0) { | 1600 if (instr->VLValue() == 0) { |
1601 if (instr->Bits(15, 12) == 0xF) { | 1601 if (instr->Bits(15, 12) == 0xF) { |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 case 7: | 2159 case 7: |
2160 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 2160 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
2161 (instr->Bit(4) == 1)) { | 2161 (instr->Bit(4) == 1)) { |
2162 // vmovl unsigned | 2162 // vmovl unsigned |
2163 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 2163 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
2164 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 2164 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
2165 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 2165 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
2166 int imm3 = instr->Bits(21, 19); | 2166 int imm3 = instr->Bits(21, 19); |
2167 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2167 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
2168 "vmovl.u%d q%d, d%d", imm3 * 8, Vd, Vm); | 2168 "vmovl.u%d q%d, d%d", imm3 * 8, Vd, Vm); |
2169 } else if (instr->Opc1Value() == 7 && instr->Bits(21, 20) == 0x3 && | 2169 } else if (instr->Opc1Value() == 7 && instr->Bit(4) == 0) { |
2170 instr->Bit(4) == 0) { | |
2171 if (instr->Bits(17, 16) == 0x2 && instr->Bits(11, 7) == 0) { | 2170 if (instr->Bits(17, 16) == 0x2 && instr->Bits(11, 7) == 0) { |
2172 if (instr->Bit(6) == 0) { | 2171 if (instr->Bit(6) == 0) { |
2173 int Vd = instr->VFPDRegValue(kDoublePrecision); | 2172 int Vd = instr->VFPDRegValue(kDoublePrecision); |
2174 int Vm = instr->VFPMRegValue(kDoublePrecision); | 2173 int Vm = instr->VFPMRegValue(kDoublePrecision); |
2175 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2174 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
2176 "vswp d%d, d%d", Vd, Vm); | 2175 "vswp d%d, d%d", Vd, Vm); |
2177 } else { | 2176 } else { |
2178 int Vd = instr->VFPDRegValue(kSimd128Precision); | 2177 int Vd = instr->VFPDRegValue(kSimd128Precision); |
2179 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2178 int Vm = instr->VFPMRegValue(kSimd128Precision); |
2180 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2179 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2248 int Vm = instr->VFPMRegValue(kSimd128Precision); |
2250 int size = kBitsPerByte * (1 << instr->Bits(19, 18)); | 2249 int size = kBitsPerByte * (1 << instr->Bits(19, 18)); |
2251 // vtrn.<size> Qd, Qm. | 2250 // vtrn.<size> Qd, Qm. |
2252 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2251 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
2253 "vtrn.%d q%d, q%d", size, Vd, Vm); | 2252 "vtrn.%d q%d, q%d", size, Vd, Vm); |
2254 } else if (instr->Bits(17, 16) == 0x1 && instr->Bit(11) == 0 && | 2253 } else if (instr->Bits(17, 16) == 0x1 && instr->Bit(11) == 0 && |
2255 instr->Bit(6) == 1) { | 2254 instr->Bit(6) == 1) { |
2256 int Vd = instr->VFPDRegValue(kSimd128Precision); | 2255 int Vd = instr->VFPDRegValue(kSimd128Precision); |
2257 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2256 int Vm = instr->VFPMRegValue(kSimd128Precision); |
2258 int size = kBitsPerByte * (1 << instr->Bits(19, 18)); | 2257 int size = kBitsPerByte * (1 << instr->Bits(19, 18)); |
2259 const char* type = instr->Bit(10) != 0 ? "f" : "s"; | 2258 char type = instr->Bit(10) != 0 ? 'f' : 's'; |
2260 if (instr->Bits(9, 6) == 0xd) { | 2259 if (instr->Bits(9, 6) == 0xd) { |
2261 // vabs<type>.<size> Qd, Qm. | 2260 // vabs<type>.<size> Qd, Qm. |
2262 out_buffer_pos_ += | 2261 out_buffer_pos_ += |
2263 SNPrintF(out_buffer_ + out_buffer_pos_, "vabs.%s%d q%d, q%d", | 2262 SNPrintF(out_buffer_ + out_buffer_pos_, "vabs.%c%d q%d, q%d", |
2264 type, size, Vd, Vm); | 2263 type, size, Vd, Vm); |
2265 } else if (instr->Bits(9, 6) == 0xf) { | 2264 } else if (instr->Bits(9, 6) == 0xf) { |
2266 // vneg<type>.<size> Qd, Qm. | 2265 // vneg<type>.<size> Qd, Qm. |
2267 out_buffer_pos_ += | 2266 out_buffer_pos_ += |
2268 SNPrintF(out_buffer_ + out_buffer_pos_, "vneg.%s%d q%d, q%d", | 2267 SNPrintF(out_buffer_ + out_buffer_pos_, "vneg.%c%d q%d, q%d", |
2269 type, size, Vd, Vm); | 2268 type, size, Vd, Vm); |
2270 } else { | 2269 } else { |
2271 Unknown(instr); | 2270 Unknown(instr); |
2272 } | 2271 } |
2273 } else if (instr->Bits(19, 18) == 0x2 && instr->Bits(11, 8) == 0x5 && | 2272 } else if (instr->Bits(19, 18) == 0x2 && instr->Bits(11, 8) == 0x5 && |
2274 instr->Bit(6) == 1) { | 2273 instr->Bit(6) == 1) { |
2275 // vrecpe/vrsqrte.f32 Qd, Qm. | 2274 // vrecpe/vrsqrte.f32 Qd, Qm. |
2276 int Vd = instr->VFPDRegValue(kSimd128Precision); | 2275 int Vd = instr->VFPDRegValue(kSimd128Precision); |
2277 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2276 int Vm = instr->VFPMRegValue(kSimd128Precision); |
2278 const char* op = instr->Bit(7) == 0 ? "vrecpe" : "vrsqrte"; | 2277 const char* op = instr->Bit(7) == 0 ? "vrecpe" : "vrsqrte"; |
2279 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 2278 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
2280 "%s.f32 q%d, q%d", op, Vd, Vm); | 2279 "%s.f32 q%d, q%d", op, Vd, Vm); |
| 2280 } else if (instr->Bits(17, 16) == 0x2 && instr->Bits(11, 8) == 0x2 && |
| 2281 instr->Bits(7, 6) != 0) { |
| 2282 // vqmovn.<type><size> Dd, Qm. |
| 2283 int Vd = instr->VFPDRegValue(kDoublePrecision); |
| 2284 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 2285 char type = instr->Bit(6) != 0 ? 'u' : 's'; |
| 2286 int size = 2 * kBitsPerByte * (1 << instr->Bits(19, 18)); |
| 2287 out_buffer_pos_ += |
| 2288 SNPrintF(out_buffer_ + out_buffer_pos_, "vqmovn.%c%i d%d, q%d", |
| 2289 type, size, Vd, Vm); |
2281 } else { | 2290 } else { |
2282 Unknown(instr); | 2291 Unknown(instr); |
2283 } | 2292 } |
2284 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1 && | 2293 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1 && |
2285 instr->Bit(6) == 1) { | 2294 instr->Bit(6) == 1) { |
2286 // vshr.u<size> Qd, Qm, shift | 2295 // vshr.u<size> Qd, Qm, shift |
2287 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); | 2296 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); |
2288 int shift = 2 * size - instr->Bits(21, 16); | 2297 int shift = 2 * size - instr->Bits(21, 16); |
2289 int Vd = instr->VFPDRegValue(kSimd128Precision); | 2298 int Vd = instr->VFPDRegValue(kSimd128Precision); |
2290 int Vm = instr->VFPMRegValue(kSimd128Precision); | 2299 int Vm = instr->VFPMRegValue(kSimd128Precision); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 pc += d.InstructionDecode(buffer, pc); | 2638 pc += d.InstructionDecode(buffer, pc); |
2630 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), | 2639 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
2631 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2640 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
2632 } | 2641 } |
2633 } | 2642 } |
2634 | 2643 |
2635 | 2644 |
2636 } // namespace disasm | 2645 } // namespace disasm |
2637 | 2646 |
2638 #endif // V8_TARGET_ARCH_ARM | 2647 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |