31 #if V8_TARGET_ARCH_MIPS64 33 #include "src/base/platform/platform.h" 34 #include "src/disasm.h" 35 #include "src/macro-assembler.h" 36 #include "src/mips64/constants-mips64.h" 50 : converter_(converter),
51 out_buffer_(out_buffer),
53 out_buffer_[out_buffer_pos_] =
'\0';
60 int InstructionDecode(byte* instruction);
64 void PrintChar(
const char ch);
65 void Print(
const char* str);
68 void PrintRegister(
int reg);
69 void PrintFPURegister(
int freg);
70 void PrintMSARegister(
int wreg);
71 void PrintFPUStatusRegister(
int freg);
72 void PrintMSAControlRegister(
int creg);
73 void PrintRs(Instruction* instr);
74 void PrintRt(Instruction* instr);
75 void PrintRd(Instruction* instr);
76 void PrintFs(Instruction* instr);
77 void PrintFt(Instruction* instr);
78 void PrintFd(Instruction* instr);
79 void PrintSa(Instruction* instr);
80 void PrintLsaSa(Instruction* instr);
81 void PrintSd(Instruction* instr);
82 void PrintSs1(Instruction* instr);
83 void PrintSs2(Instruction* instr);
84 void PrintSs3(Instruction* instr);
85 void PrintSs4(Instruction* instr);
86 void PrintSs5(Instruction* instr);
87 void PrintBc(Instruction* instr);
88 void PrintCc(Instruction* instr);
89 void PrintFunction(Instruction* instr);
90 void PrintSecondaryField(Instruction* instr);
91 void PrintUImm9(Instruction* instr);
92 void PrintSImm9(Instruction* instr);
93 void PrintUImm16(Instruction* instr);
94 void PrintSImm16(Instruction* instr);
95 void PrintXImm16(Instruction* instr);
96 void PrintPCImm16(Instruction* instr,
int delta_pc,
int n_bits);
97 void PrintXImm18(Instruction* instr);
98 void PrintSImm18(Instruction* instr);
99 void PrintXImm19(Instruction* instr);
100 void PrintSImm19(Instruction* instr);
101 void PrintXImm21(Instruction* instr);
102 void PrintSImm21(Instruction* instr);
103 void PrintPCImm21(Instruction* instr,
int delta_pc,
int n_bits);
104 void PrintXImm26(Instruction* instr);
105 void PrintSImm26(Instruction* instr);
106 void PrintPCImm26(Instruction* instr,
int delta_pc,
int n_bits);
107 void PrintPCImm26(Instruction* instr);
108 void PrintCode(Instruction* instr);
109 void PrintFormat(Instruction* instr);
110 void PrintBp2(Instruction* instr);
111 void PrintBp3(Instruction* instr);
112 void PrintMsaDataFormat(Instruction* instr);
113 void PrintMsaXImm8(Instruction* instr);
114 void PrintMsaImm8(Instruction* instr);
115 void PrintMsaImm5(Instruction* instr);
116 void PrintMsaSImm5(Instruction* instr);
117 void PrintMsaSImm10(Instruction* instr,
bool is_mi10 =
false);
118 void PrintMsaImmBit(Instruction* instr);
119 void PrintMsaImmElm(Instruction* instr);
120 void PrintMsaCopy(Instruction* instr);
122 void PrintInstructionName(Instruction* instr);
125 int FormatRegister(Instruction* instr,
const char* option);
126 int FormatFPURegister(Instruction* instr,
const char* option);
127 int FormatMSARegister(Instruction* instr,
const char* option);
128 int FormatOption(Instruction* instr,
const char* option);
129 void Format(Instruction* instr,
const char* format);
130 void Unknown(Instruction* instr);
131 int DecodeBreakInstr(Instruction* instr);
134 bool DecodeTypeRegisterRsType(Instruction* instr);
135 void DecodeTypeRegisterSRsType(Instruction* instr);
136 void DecodeTypeRegisterDRsType(Instruction* instr);
137 void DecodeTypeRegisterLRsType(Instruction* instr);
138 void DecodeTypeRegisterWRsType(Instruction* instr);
139 void DecodeTypeRegisterSPECIAL(Instruction* instr);
140 void DecodeTypeRegisterSPECIAL2(Instruction* instr);
141 void DecodeTypeRegisterSPECIAL3(Instruction* instr);
142 void DecodeTypeRegisterCOP1(Instruction* instr);
143 void DecodeTypeRegisterCOP1X(Instruction* instr);
144 int DecodeTypeRegister(Instruction* instr);
146 void DecodeTypeImmediateCOP1(Instruction* instr);
147 void DecodeTypeImmediateREGIMM(Instruction* instr);
148 void DecodeTypeImmediateSPECIAL3(Instruction* instr);
149 void DecodeTypeImmediate(Instruction* instr);
151 void DecodeTypeJump(Instruction* instr);
153 void DecodeTypeMsaI8(Instruction* instr);
154 void DecodeTypeMsaI5(Instruction* instr);
155 void DecodeTypeMsaI10(Instruction* instr);
156 void DecodeTypeMsaELM(Instruction* instr);
157 void DecodeTypeMsaBIT(Instruction* instr);
158 void DecodeTypeMsaMI10(Instruction* instr);
159 void DecodeTypeMsa3R(Instruction* instr);
160 void DecodeTypeMsa3RF(Instruction* instr);
161 void DecodeTypeMsaVec(Instruction* instr);
162 void DecodeTypeMsa2R(Instruction* instr);
163 void DecodeTypeMsa2RF(Instruction* instr);
169 DISALLOW_COPY_AND_ASSIGN(Decoder);
174 #define STRING_STARTS_WITH(string, compare_string) \ 175 (strncmp(string, compare_string, strlen(compare_string)) == 0) 179 void Decoder::PrintChar(
const char ch) {
180 out_buffer_[out_buffer_pos_++] = ch;
185 void Decoder::Print(
const char* str) {
187 while (cur !=
'\0' && (out_buffer_pos_ < (out_buffer_.length() - 1))) {
191 out_buffer_[out_buffer_pos_] = 0;
196 void Decoder::PrintRegister(
int reg) {
197 Print(converter_.NameOfCPURegister(reg));
201 void Decoder::PrintRs(Instruction* instr) {
202 int reg = instr->RsValue();
207 void Decoder::PrintRt(Instruction* instr) {
208 int reg = instr->RtValue();
213 void Decoder::PrintRd(Instruction* instr) {
214 int reg = instr->RdValue();
220 void Decoder::PrintFPURegister(
int freg) {
221 Print(converter_.NameOfXMMRegister(freg));
224 void Decoder::PrintMSARegister(
int wreg) { Print(MSARegisters::Name(wreg)); }
226 void Decoder::PrintFPUStatusRegister(
int freg) {
232 Print(converter_.NameOfXMMRegister(freg));
236 void Decoder::PrintMSAControlRegister(
int creg) {
241 case kMSACSRRegister:
249 void Decoder::PrintFs(Instruction* instr) {
250 int freg = instr->RsValue();
251 PrintFPURegister(freg);
255 void Decoder::PrintFt(Instruction* instr) {
256 int freg = instr->RtValue();
257 PrintFPURegister(freg);
261 void Decoder::PrintFd(Instruction* instr) {
262 int freg = instr->RdValue();
263 PrintFPURegister(freg);
268 void Decoder::PrintSa(Instruction* instr) {
269 int sa = instr->SaValue();
270 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", sa);
275 void Decoder::PrintLsaSa(Instruction* instr) {
276 int sa = instr->LsaSaValue() + 1;
277 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", sa);
282 void Decoder::PrintSd(Instruction* instr) {
283 int sd = instr->RdValue();
284 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", sd);
288 void Decoder::PrintSs1(Instruction* instr) {
289 int msbd = instr->RdValue();
290 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", msbd + 1);
295 void Decoder::PrintSs2(Instruction* instr) {
296 int msb = instr->RdValue();
297 int lsb = instr->SaValue();
299 SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", msb - lsb + 1);
303 void Decoder::PrintSs3(Instruction* instr) {
304 int msbdminus32 = instr->RdValue();
306 SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", msbdminus32 + 32 + 1);
310 void Decoder::PrintSs4(Instruction* instr) {
311 int msbminus32 = instr->RdValue();
312 int lsb = instr->SaValue();
314 SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", msbminus32 + 32 - lsb + 1);
318 void Decoder::PrintSs5(Instruction* instr) {
319 int lsbminus32 = instr->SaValue();
321 SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", lsbminus32 + 32);
326 void Decoder::PrintBc(Instruction* instr) {
327 int cc = instr->FBccValue();
328 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", cc);
333 void Decoder::PrintCc(Instruction* instr) {
334 int cc = instr->FCccValue();
335 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"cc(%d)", cc);
339 void Decoder::PrintUImm9(Instruction* instr) {
340 int32_t imm = instr->Imm9Value();
341 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", imm);
345 void Decoder::PrintSImm9(Instruction* instr) {
346 int32_t imm = ((instr->Imm9Value()) << 23) >> 23;
347 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm);
351 void Decoder::PrintUImm16(Instruction* instr) {
352 int32_t imm = instr->Imm16Value();
353 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", imm);
358 void Decoder::PrintSImm16(Instruction* instr) {
360 ((instr->Imm16Value()) << (32 - kImm16Bits)) >> (32 - kImm16Bits);
361 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm);
366 void Decoder::PrintXImm16(Instruction* instr) {
367 int32_t imm = instr->Imm16Value();
368 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%x", imm);
375 void Decoder::PrintPCImm16(Instruction* instr,
int delta_pc,
int n_bits) {
376 int16_t offset = instr->Imm16Value();
378 SNPrintF(out_buffer_ + out_buffer_pos_,
"%s",
379 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
380 delta_pc + (offset << n_bits)));
385 void Decoder::PrintSImm18(Instruction* instr) {
387 ((instr->Imm18Value()) << (32 - kImm18Bits)) >> (32 - kImm18Bits);
388 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm);
393 void Decoder::PrintXImm18(Instruction* instr) {
394 int32_t imm = instr->Imm18Value();
395 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%x", imm);
400 void Decoder::PrintXImm19(Instruction* instr) {
401 int32_t imm = instr->Imm19Value();
402 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%x", imm);
407 void Decoder::PrintSImm19(Instruction* instr) {
408 int32_t imm19 = instr->Imm19Value();
410 imm19 <<= (32 - kImm19Bits);
411 imm19 >>= (32 - kImm19Bits);
412 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm19);
417 void Decoder::PrintXImm21(Instruction* instr) {
419 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%x", imm);
424 void Decoder::PrintSImm21(Instruction* instr) {
425 int32_t imm21 = instr->Imm21Value();
427 imm21 <<= (32 - kImm21Bits);
428 imm21 >>= (32 - kImm21Bits);
429 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm21);
436 void Decoder::PrintPCImm21(Instruction* instr,
int delta_pc,
int n_bits) {
437 int32_t imm21 = instr->Imm21Value();
439 imm21 <<= (32 - kImm21Bits);
440 imm21 >>= (32 - kImm21Bits);
442 SNPrintF(out_buffer_ + out_buffer_pos_,
"%s",
443 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
444 delta_pc + (imm21 << n_bits)));
449 void Decoder::PrintXImm26(Instruction* instr) {
450 uint64_t target =
static_cast<uint64_t
>(instr->Imm26Value())
452 target = (
reinterpret_cast<uint64_t
>(instr) & ~0xFFFFFFF) | target;
454 SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%" PRIx64, target);
459 void Decoder::PrintSImm26(Instruction* instr) {
460 int32_t imm26 = instr->Imm26Value();
462 imm26 <<= (32 - kImm26Bits);
463 imm26 >>= (32 - kImm26Bits);
464 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm26);
471 void Decoder::PrintPCImm26(Instruction* instr,
int delta_pc,
int n_bits) {
472 int32_t imm26 = instr->Imm26Value();
474 imm26 <<= (32 - kImm26Bits);
475 imm26 >>= (32 - kImm26Bits);
477 SNPrintF(out_buffer_ + out_buffer_pos_,
"%s",
478 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) +
479 delta_pc + (imm26 << n_bits)));
486 void Decoder::PrintPCImm26(Instruction* instr) {
487 int32_t imm26 = instr->Imm26Value();
488 uint64_t pc_mask = ~0xFFFFFFF;
489 uint64_t pc = ((uint64_t)(instr + 1) & pc_mask) | (imm26 << 2);
491 SNPrintF(out_buffer_ + out_buffer_pos_,
"%s",
492 converter_.NameOfAddress((reinterpret_cast<byte*>(pc))));
496 void Decoder::PrintBp2(Instruction* instr) {
497 int bp2 = instr->Bp2Value();
498 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", bp2);
502 void Decoder::PrintBp3(Instruction* instr) {
503 int bp3 = instr->Bp3Value();
504 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", bp3);
509 void Decoder::PrintCode(Instruction* instr) {
510 if (instr->OpcodeFieldRaw() != SPECIAL)
512 switch (instr->FunctionFieldRaw()) {
514 int32_t code = instr->Bits(25, 6);
515 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
516 "0x%05x (%d)", code, code);
525 int32_t code = instr->Bits(15, 6);
527 SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%03x", code);
535 void Decoder::PrintMsaXImm8(Instruction* instr) {
536 int32_t imm = instr->MsaImm8Value();
537 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"0x%x", imm);
540 void Decoder::PrintMsaImm8(Instruction* instr) {
541 int32_t imm = instr->MsaImm8Value();
542 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", imm);
545 void Decoder::PrintMsaImm5(Instruction* instr) {
546 int32_t imm = instr->MsaImm5Value();
547 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", imm);
550 void Decoder::PrintMsaSImm5(Instruction* instr) {
551 int32_t imm = instr->MsaImm5Value();
552 imm <<= (32 - kMsaImm5Bits);
553 imm >>= (32 - kMsaImm5Bits);
554 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm);
557 void Decoder::PrintMsaSImm10(Instruction* instr,
bool is_mi10) {
558 int32_t imm = is_mi10 ? instr->MsaImmMI10Value() : instr->MsaImm10Value();
559 imm <<= (32 - kMsaImm10Bits);
560 imm >>= (32 - kMsaImm10Bits);
561 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%d", imm);
564 void Decoder::PrintMsaImmBit(Instruction* instr) {
565 int32_t m = instr->MsaBitMValue();
566 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", m);
569 void Decoder::PrintMsaImmElm(Instruction* instr) {
570 int32_t n = instr->MsaElmNValue();
571 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"%u", n);
574 void Decoder::PrintMsaCopy(Instruction* instr) {
575 int32_t rd = instr->WdValue();
576 int32_t ws = instr->WsValue();
577 int32_t n = instr->MsaElmNValue();
579 SNPrintF(out_buffer_ + out_buffer_pos_,
"%s, %s[%u]",
580 converter_.NameOfCPURegister(rd), MSARegisters::Name(ws), n);
583 void Decoder::PrintFormat(Instruction* instr) {
584 char formatLetter =
' ';
585 switch (instr->RsFieldRaw()) {
602 PrintChar(formatLetter);
605 void Decoder::PrintMsaDataFormat(Instruction* instr) {
606 DCHECK(instr->IsMSAInstr());
608 if (instr->IsMSABranchInstr()) {
609 switch (instr->RsFieldRaw()) {
635 char DF[] = {
'b',
'h',
'w',
'd'};
636 switch (instr->MSAMinorOpcodeField()) {
640 df = DF[instr->Bits(22, 21)];
643 df = DF[instr->Bits(1, 0)];
646 df = DF[instr->MsaBitDf()];
649 df = DF[instr->MsaElmDf()];
652 uint32_t opcode = instr->InstructionBits() & kMsa3RFMask;
662 df = DF[1 + instr->Bit(21)];
665 df = DF[2 + instr->Bit(21)];
670 df = DF[instr->Bits(17, 16)];
673 df = DF[2 + instr->Bit(16)];
685 void Decoder::PrintInstructionName(Instruction* instr) {
691 int Decoder::FormatRegister(Instruction* instr,
const char* format) {
692 DCHECK_EQ(format[0],
'r');
693 if (format[1] ==
's') {
694 int reg = instr->RsValue();
697 }
else if (format[1] ==
't') {
698 int reg = instr->RtValue();
701 }
else if (format[1] ==
'd') {
702 int reg = instr->RdValue();
712 int Decoder::FormatFPURegister(Instruction* instr,
const char* format) {
713 DCHECK_EQ(format[0],
'f');
714 if ((CTC1 == instr->RsFieldRaw()) || (CFC1 == instr->RsFieldRaw())) {
715 if (format[1] ==
's') {
716 int reg = instr->FsValue();
717 PrintFPUStatusRegister(reg);
719 }
else if (format[1] ==
't') {
720 int reg = instr->FtValue();
721 PrintFPUStatusRegister(reg);
723 }
else if (format[1] ==
'd') {
724 int reg = instr->FdValue();
725 PrintFPUStatusRegister(reg);
727 }
else if (format[1] ==
'r') {
728 int reg = instr->FrValue();
729 PrintFPUStatusRegister(reg);
733 if (format[1] ==
's') {
734 int reg = instr->FsValue();
735 PrintFPURegister(reg);
737 }
else if (format[1] ==
't') {
738 int reg = instr->FtValue();
739 PrintFPURegister(reg);
741 }
else if (format[1] ==
'd') {
742 int reg = instr->FdValue();
743 PrintFPURegister(reg);
745 }
else if (format[1] ==
'r') {
746 int reg = instr->FrValue();
747 PrintFPURegister(reg);
756 int Decoder::FormatMSARegister(Instruction* instr,
const char* format) {
757 DCHECK_EQ(format[0],
'w');
758 if (format[1] ==
's') {
759 int reg = instr->WsValue();
760 PrintMSARegister(reg);
762 }
else if (format[1] ==
't') {
763 int reg = instr->WtValue();
764 PrintMSARegister(reg);
766 }
else if (format[1] ==
'd') {
767 int reg = instr->WdValue();
768 PrintMSARegister(reg);
780 int Decoder::FormatOption(Instruction* instr,
const char* format) {
783 DCHECK(STRING_STARTS_WITH(format,
"code"));
788 if (format[3] ==
'1') {
789 if (format[4] ==
'6') {
790 DCHECK(STRING_STARTS_WITH(format,
"imm16"));
793 DCHECK(STRING_STARTS_WITH(format,
"imm16s"));
797 DCHECK(STRING_STARTS_WITH(format,
"imm16u"));
801 DCHECK(STRING_STARTS_WITH(format,
"imm16x"));
805 DCHECK(STRING_STARTS_WITH(format,
"imm16p"));
810 DCHECK(STRING_STARTS_WITH(format,
"imm16p4"));
814 DCHECK(STRING_STARTS_WITH(format,
"imm16p4s2"));
816 PrintPCImm16(instr, delta_pc, n_bits);
824 }
else if (format[4] ==
'8') {
825 DCHECK(STRING_STARTS_WITH(format,
"imm18"));
828 DCHECK(STRING_STARTS_WITH(format,
"imm18s"));
832 DCHECK(STRING_STARTS_WITH(format,
"imm18x"));
837 }
else if (format[4] ==
'9') {
838 DCHECK(STRING_STARTS_WITH(format,
"imm19"));
841 DCHECK(STRING_STARTS_WITH(format,
"imm19s"));
845 DCHECK(STRING_STARTS_WITH(format,
"imm19x"));
850 }
else if (format[4] ==
'0' && format[5] ==
's') {
851 DCHECK(STRING_STARTS_WITH(format,
"imm10s"));
852 if (format[6] ==
'1') {
853 DCHECK(STRING_STARTS_WITH(format,
"imm10s1"));
854 PrintMsaSImm10(instr,
false);
855 }
else if (format[6] ==
'2') {
856 DCHECK(STRING_STARTS_WITH(format,
"imm10s2"));
857 PrintMsaSImm10(instr,
true);
861 }
else if (format[3] ==
'2' && format[4] ==
'1') {
862 DCHECK(STRING_STARTS_WITH(format,
"imm21"));
865 DCHECK(STRING_STARTS_WITH(format,
"imm21s"));
869 DCHECK(STRING_STARTS_WITH(format,
"imm21x"));
873 DCHECK(STRING_STARTS_WITH(format,
"imm21p"));
878 DCHECK(STRING_STARTS_WITH(format,
"imm21p4"));
882 DCHECK(STRING_STARTS_WITH(format,
"imm21p4s2"));
884 PrintPCImm21(instr, delta_pc, n_bits);
892 }
else if (format[3] ==
'2' && format[4] ==
'6') {
893 DCHECK(STRING_STARTS_WITH(format,
"imm26"));
896 DCHECK(STRING_STARTS_WITH(format,
"imm26s"));
900 DCHECK(STRING_STARTS_WITH(format,
"imm26x"));
904 DCHECK(STRING_STARTS_WITH(format,
"imm26p"));
909 DCHECK(STRING_STARTS_WITH(format,
"imm26p4"));
913 DCHECK(STRING_STARTS_WITH(format,
"imm26p4s2"));
915 PrintPCImm26(instr, delta_pc, n_bits);
922 DCHECK(STRING_STARTS_WITH(format,
"imm26j"));
928 }
else if (format[3] ==
'5') {
929 DCHECK(STRING_STARTS_WITH(format,
"imm5"));
930 if (format[4] ==
'u') {
931 DCHECK(STRING_STARTS_WITH(format,
"imm5u"));
933 }
else if (format[4] ==
's') {
934 DCHECK(STRING_STARTS_WITH(format,
"imm5s"));
935 PrintMsaSImm5(instr);
938 }
else if (format[3] ==
'8') {
939 DCHECK(STRING_STARTS_WITH(format,
"imm8"));
942 }
else if (format[3] ==
'9') {
943 DCHECK(STRING_STARTS_WITH(format,
"imm9"));
944 if (format[4] ==
'u') {
945 DCHECK(STRING_STARTS_WITH(format,
"imm9u"));
947 }
else if (format[4] ==
's') {
948 DCHECK(STRING_STARTS_WITH(format,
"imm9s"));
952 }
else if (format[3] ==
'b') {
953 DCHECK(STRING_STARTS_WITH(format,
"immb"));
954 PrintMsaImmBit(instr);
956 }
else if (format[3] ==
'e') {
957 DCHECK(STRING_STARTS_WITH(format,
"imme"));
958 PrintMsaImmElm(instr);
964 return FormatRegister(instr, format);
967 return FormatFPURegister(instr, format);
970 return FormatMSARegister(instr, format);
975 if (format[2] ==
'2') {
976 DCHECK(STRING_STARTS_WITH(format,
"sa2"));
980 DCHECK(STRING_STARTS_WITH(format,
"sa"));
986 DCHECK(STRING_STARTS_WITH(format,
"sd"));
991 if (format[2] ==
'1') {
992 DCHECK(STRING_STARTS_WITH(format,
"ss1"));
994 }
else if (format[2] ==
'2') {
995 DCHECK(STRING_STARTS_WITH(format,
"ss2"));
997 }
else if (format[2] ==
'3') {
998 DCHECK(STRING_STARTS_WITH(format,
"ss3"));
1000 }
else if (format[2] ==
'4') {
1001 DCHECK(STRING_STARTS_WITH(format,
"ss4"));
1004 DCHECK(STRING_STARTS_WITH(format,
"ss5"));
1012 switch (format[1]) {
1014 DCHECK(STRING_STARTS_WITH(format,
"bc"));
1019 switch (format[2]) {
1021 DCHECK(STRING_STARTS_WITH(format,
"bp2"));
1026 DCHECK(STRING_STARTS_WITH(format,
"bp3"));
1035 DCHECK(STRING_STARTS_WITH(format,
"Cc"));
1040 if (instr->IsMSAInstr()) {
1041 PrintMsaDataFormat(instr);
1054 void Decoder::Format(Instruction* instr,
const char* format) {
1055 char cur = *format++;
1056 while ((cur != 0) && (out_buffer_pos_ < (out_buffer_.length() - 1))) {
1058 format += FormatOption(instr, format);
1060 out_buffer_[out_buffer_pos_++] = cur;
1064 out_buffer_[out_buffer_pos_] =
'\0';
1070 void Decoder::Unknown(Instruction* instr) {
1071 Format(instr,
"unknown");
1075 int Decoder::DecodeBreakInstr(Instruction* instr) {
1077 if (instr->Bits(25, 6) ==
static_cast<int>(kMaxStopCode)) {
1079 Format(instr,
"break, code: 'code");
1080 out_buffer_pos_ += SNPrintF(
1081 out_buffer_ + out_buffer_pos_,
"\n%p %08" PRIx64,
1082 static_cast<void*>(reinterpret_cast<int32_t*>(instr + kInstrSize)),
1083 reinterpret_cast<uint64_t>(
1084 *reinterpret_cast<char**>(instr + kInstrSize)));
1086 return 3 * kInstrSize;
1088 Format(instr,
"break, code: 'code");
1094 bool Decoder::DecodeTypeRegisterRsType(Instruction* instr) {
1095 switch (instr->FunctionFieldRaw()) {
1097 Format(instr,
"rint.'t 'fd, 'fs");
1100 Format(instr,
"sel.'t 'fd, 'fs, 'ft");
1103 Format(instr,
"seleqz.'t 'fd, 'fs, 'ft");
1106 Format(instr,
"selnez.'t 'fd, 'fs, 'ft");
1109 Format(instr,
"movz.'t 'fd, 'fs, 'rt");
1112 Format(instr,
"movn.'t 'fd, 'fs, 'rt");
1115 if (instr->Bit(16)) {
1116 Format(instr,
"movt.'t 'fd, 'fs, 'Cc");
1118 Format(instr,
"movf.'t 'fd, 'fs, 'Cc");
1122 Format(instr,
"min.'t 'fd, 'fs, 'ft");
1125 Format(instr,
"max.'t 'fd, 'fs, 'ft");
1128 Format(instr,
"mina.'t 'fd, 'fs, 'ft");
1131 Format(instr,
"maxa.'t 'fd, 'fs, 'ft");
1134 Format(instr,
"add.'t 'fd, 'fs, 'ft");
1137 Format(instr,
"sub.'t 'fd, 'fs, 'ft");
1140 Format(instr,
"mul.'t 'fd, 'fs, 'ft");
1143 Format(instr,
"div.'t 'fd, 'fs, 'ft");
1146 Format(instr,
"abs.'t 'fd, 'fs");
1149 Format(instr,
"mov.'t 'fd, 'fs");
1152 Format(instr,
"neg.'t 'fd, 'fs");
1155 Format(instr,
"sqrt.'t 'fd, 'fs");
1158 Format(instr,
"recip.'t 'fd, 'fs");
1161 Format(instr,
"rsqrt.'t 'fd, 'fs");
1164 Format(instr,
"cvt.w.'t 'fd, 'fs");
1167 Format(instr,
"cvt.l.'t 'fd, 'fs");
1170 Format(instr,
"trunc.w.'t 'fd, 'fs");
1173 Format(instr,
"trunc.l.'t 'fd, 'fs");
1176 Format(instr,
"round.w.'t 'fd, 'fs");
1179 Format(instr,
"round.l.'t 'fd, 'fs");
1182 Format(instr,
"floor.w.'t 'fd, 'fs");
1185 Format(instr,
"floor.l.'t 'fd, 'fs");
1188 Format(instr,
"ceil.w.'t 'fd, 'fs");
1191 Format(instr,
"ceil.l.'t 'fd, 'fs");
1194 Format(instr,
"class.'t 'fd, 'fs");
1197 Format(instr,
"cvt.s.'t 'fd, 'fs");
1200 Format(instr,
"c.f.'t 'fs, 'ft, 'Cc");
1203 Format(instr,
"c.un.'t 'fs, 'ft, 'Cc");
1206 Format(instr,
"c.eq.'t 'fs, 'ft, 'Cc");
1209 Format(instr,
"c.ueq.'t 'fs, 'ft, 'Cc");
1212 Format(instr,
"c.olt.'t 'fs, 'ft, 'Cc");
1215 Format(instr,
"c.ult.'t 'fs, 'ft, 'Cc");
1218 Format(instr,
"c.ole.'t 'fs, 'ft, 'Cc");
1221 Format(instr,
"c.ule.'t 'fs, 'ft, 'Cc");
1230 void Decoder::DecodeTypeRegisterSRsType(Instruction* instr) {
1231 if (!DecodeTypeRegisterRsType(instr)) {
1232 switch (instr->FunctionFieldRaw()) {
1234 Format(instr,
"cvt.d.'t 'fd, 'fs");
1237 Format(instr,
"maddf.s 'fd, 'fs, 'ft");
1240 Format(instr,
"msubf.s 'fd, 'fs, 'ft");
1243 Format(instr,
"unknown.cop1.'t");
1250 void Decoder::DecodeTypeRegisterDRsType(Instruction* instr) {
1251 if (!DecodeTypeRegisterRsType(instr)) {
1252 switch (instr->FunctionFieldRaw()) {
1254 Format(instr,
"maddf.d 'fd, 'fs, 'ft");
1257 Format(instr,
"msubf.d 'fd, 'fs, 'ft");
1260 Format(instr,
"unknown.cop1.'t");
1267 void Decoder::DecodeTypeRegisterLRsType(Instruction* instr) {
1268 switch (instr->FunctionFieldRaw()) {
1270 Format(instr,
"cvt.d.l 'fd, 'fs");
1273 Format(instr,
"cvt.s.l 'fd, 'fs");
1276 Format(instr,
"cmp.af.d 'fd, 'fs, 'ft");
1279 Format(instr,
"cmp.un.d 'fd, 'fs, 'ft");
1282 Format(instr,
"cmp.eq.d 'fd, 'fs, 'ft");
1285 Format(instr,
"cmp.ueq.d 'fd, 'fs, 'ft");
1288 Format(instr,
"cmp.lt.d 'fd, 'fs, 'ft");
1291 Format(instr,
"cmp.ult.d 'fd, 'fs, 'ft");
1294 Format(instr,
"cmp.le.d 'fd, 'fs, 'ft");
1297 Format(instr,
"cmp.ule.d 'fd, 'fs, 'ft");
1300 Format(instr,
"cmp.or.d 'fd, 'fs, 'ft");
1303 Format(instr,
"cmp.une.d 'fd, 'fs, 'ft");
1306 Format(instr,
"cmp.ne.d 'fd, 'fs, 'ft");
1314 void Decoder::DecodeTypeRegisterWRsType(Instruction* instr) {
1315 switch (instr->FunctionValue()) {
1317 Format(instr,
"cvt.s.w 'fd, 'fs");
1320 Format(instr,
"cvt.d.w 'fd, 'fs");
1323 Format(instr,
"cmp.af.s 'fd, 'fs, 'ft");
1326 Format(instr,
"cmp.un.s 'fd, 'fs, 'ft");
1329 Format(instr,
"cmp.eq.s 'fd, 'fs, 'ft");
1332 Format(instr,
"cmp.ueq.s 'fd, 'fs, 'ft");
1335 Format(instr,
"cmp.lt.s 'fd, 'fs, 'ft");
1338 Format(instr,
"cmp.ult.s 'fd, 'fs, 'ft");
1341 Format(instr,
"cmp.le.s 'fd, 'fs, 'ft");
1344 Format(instr,
"cmp.ule.s 'fd, 'fs, 'ft");
1347 Format(instr,
"cmp.or.s 'fd, 'fs, 'ft");
1350 Format(instr,
"cmp.une.s 'fd, 'fs, 'ft");
1353 Format(instr,
"cmp.ne.s 'fd, 'fs, 'ft");
1361 void Decoder::DecodeTypeRegisterCOP1(Instruction* instr) {
1362 switch (instr->RsFieldRaw()) {
1364 Format(instr,
"mfc1 'rt, 'fs");
1367 Format(instr,
"dmfc1 'rt, 'fs");
1370 Format(instr,
"mfhc1 'rt, 'fs");
1373 Format(instr,
"mtc1 'rt, 'fs");
1376 Format(instr,
"dmtc1 'rt, 'fs");
1380 Format(instr,
"ctc1 'rt, 'fs");
1383 Format(instr,
"cfc1 'rt, 'fs");
1386 Format(instr,
"mthc1 'rt, 'fs");
1389 DecodeTypeRegisterSRsType(instr);
1392 DecodeTypeRegisterDRsType(instr);
1395 DecodeTypeRegisterWRsType(instr);
1398 DecodeTypeRegisterLRsType(instr);
1406 void Decoder::DecodeTypeRegisterCOP1X(Instruction* instr) {
1407 switch (instr->FunctionFieldRaw()) {
1409 Format(instr,
"madd.s 'fd, 'fr, 'fs, 'ft");
1412 Format(instr,
"madd.d 'fd, 'fr, 'fs, 'ft");
1415 Format(instr,
"msub.s 'fd, 'fr, 'fs, 'ft");
1418 Format(instr,
"msub.d 'fd, 'fr, 'fs, 'ft");
1426 void Decoder::DecodeTypeRegisterSPECIAL(Instruction* instr) {
1427 switch (instr->FunctionFieldRaw()) {
1429 Format(instr,
"jr 'rs");
1432 Format(instr,
"jalr 'rs, 'rd");
1435 if (0x0 == static_cast<int>(instr->InstructionBits()))
1436 Format(instr,
"nop");
1438 Format(instr,
"sll 'rd, 'rt, 'sa");
1441 Format(instr,
"dsll 'rd, 'rt, 'sa");
1444 if (kArchVariant != kMips64r6) {
1445 Format(instr,
"dmult 'rs, 'rt");
1447 if (instr->SaValue() == MUL_OP) {
1448 Format(instr,
"dmul 'rd, 'rs, 'rt");
1450 Format(instr,
"dmuh 'rd, 'rs, 'rt");
1455 Format(instr,
"dsll32 'rd, 'rt, 'sa");
1458 if (instr->RsValue() == 0) {
1459 Format(instr,
"srl 'rd, 'rt, 'sa");
1461 Format(instr,
"rotr 'rd, 'rt, 'sa");
1465 if (instr->RsValue() == 0) {
1466 Format(instr,
"dsrl 'rd, 'rt, 'sa");
1468 Format(instr,
"drotr 'rd, 'rt, 'sa");
1472 if (instr->RsValue() == 0) {
1473 Format(instr,
"dsrl32 'rd, 'rt, 'sa");
1475 Format(instr,
"drotr32 'rd, 'rt, 'sa");
1479 Format(instr,
"sra 'rd, 'rt, 'sa");
1482 Format(instr,
"dsra 'rd, 'rt, 'sa");
1485 Format(instr,
"dsra32 'rd, 'rt, 'sa");
1488 Format(instr,
"sllv 'rd, 'rt, 'rs");
1491 Format(instr,
"dsllv 'rd, 'rt, 'rs");
1494 if (instr->SaValue() == 0) {
1495 Format(instr,
"srlv 'rd, 'rt, 'rs");
1497 Format(instr,
"rotrv 'rd, 'rt, 'rs");
1501 if (instr->SaValue() == 0) {
1502 Format(instr,
"dsrlv 'rd, 'rt, 'rs");
1504 Format(instr,
"drotrv 'rd, 'rt, 'rs");
1508 Format(instr,
"srav 'rd, 'rt, 'rs");
1511 Format(instr,
"dsrav 'rd, 'rt, 'rs");
1514 Format(instr,
"lsa 'rd, 'rt, 'rs, 'sa2");
1517 Format(instr,
"dlsa 'rd, 'rt, 'rs, 'sa2");
1520 if (instr->Bits(25, 16) == 0) {
1521 Format(instr,
"mfhi 'rd");
1523 if ((instr->FunctionFieldRaw() == CLZ_R6) && (instr->FdValue() == 1)) {
1524 Format(instr,
"clz 'rd, 'rs");
1525 }
else if ((instr->FunctionFieldRaw() == CLO_R6) &&
1526 (instr->FdValue() == 1)) {
1527 Format(instr,
"clo 'rd, 'rs");
1532 if (instr->Bits(25, 16) == 0) {
1533 Format(instr,
"mflo 'rd");
1535 if ((instr->FunctionFieldRaw() == DCLZ_R6) && (instr->FdValue() == 1)) {
1536 Format(instr,
"dclz 'rd, 'rs");
1537 }
else if ((instr->FunctionFieldRaw() == DCLO_R6) &&
1538 (instr->FdValue() == 1)) {
1539 Format(instr,
"dclo 'rd, 'rs");
1544 if (kArchVariant != kMips64r6) {
1545 Format(instr,
"dmultu 'rs, 'rt");
1547 if (instr->SaValue() == MUL_OP) {
1548 Format(instr,
"dmulu 'rd, 'rs, 'rt");
1550 Format(instr,
"dmuhu 'rd, 'rs, 'rt");
1555 if (kArchVariant != kMips64r6) {
1556 Format(instr,
"mult 'rs, 'rt");
1558 if (instr->SaValue() == MUL_OP) {
1559 Format(instr,
"mul 'rd, 'rs, 'rt");
1561 Format(instr,
"muh 'rd, 'rs, 'rt");
1566 if (kArchVariant != kMips64r6) {
1567 Format(instr,
"multu 'rs, 'rt");
1569 if (instr->SaValue() == MUL_OP) {
1570 Format(instr,
"mulu 'rd, 'rs, 'rt");
1572 Format(instr,
"muhu 'rd, 'rs, 'rt");
1578 if (kArchVariant != kMips64r6) {
1579 Format(instr,
"div 'rs, 'rt");
1581 if (instr->SaValue() == DIV_OP) {
1582 Format(instr,
"div 'rd, 'rs, 'rt");
1584 Format(instr,
"mod 'rd, 'rs, 'rt");
1589 if (kArchVariant != kMips64r6) {
1590 Format(instr,
"ddiv 'rs, 'rt");
1592 if (instr->SaValue() == DIV_OP) {
1593 Format(instr,
"ddiv 'rd, 'rs, 'rt");
1595 Format(instr,
"dmod 'rd, 'rs, 'rt");
1600 if (kArchVariant != kMips64r6) {
1601 Format(instr,
"divu 'rs, 'rt");
1603 if (instr->SaValue() == DIV_OP) {
1604 Format(instr,
"divu 'rd, 'rs, 'rt");
1606 Format(instr,
"modu 'rd, 'rs, 'rt");
1611 if (kArchVariant != kMips64r6) {
1612 Format(instr,
"ddivu 'rs, 'rt");
1614 if (instr->SaValue() == DIV_OP) {
1615 Format(instr,
"ddivu 'rd, 'rs, 'rt");
1617 Format(instr,
"dmodu 'rd, 'rs, 'rt");
1622 Format(instr,
"add 'rd, 'rs, 'rt");
1625 Format(instr,
"dadd 'rd, 'rs, 'rt");
1628 Format(instr,
"addu 'rd, 'rs, 'rt");
1631 Format(instr,
"daddu 'rd, 'rs, 'rt");
1634 Format(instr,
"sub 'rd, 'rs, 'rt");
1637 Format(instr,
"dsub 'rd, 'rs, 'rt");
1640 Format(instr,
"subu 'rd, 'rs, 'rt");
1643 Format(instr,
"dsubu 'rd, 'rs, 'rt");
1646 Format(instr,
"and 'rd, 'rs, 'rt");
1649 if (0 == instr->RsValue()) {
1650 Format(instr,
"mov 'rd, 'rt");
1651 }
else if (0 == instr->RtValue()) {
1652 Format(instr,
"mov 'rd, 'rs");
1654 Format(instr,
"or 'rd, 'rs, 'rt");
1658 Format(instr,
"xor 'rd, 'rs, 'rt");
1661 Format(instr,
"nor 'rd, 'rs, 'rt");
1664 Format(instr,
"slt 'rd, 'rs, 'rt");
1667 Format(instr,
"sltu 'rd, 'rs, 'rt");
1670 Format(instr,
"tge 'rs, 'rt, code: 'code");
1673 Format(instr,
"tgeu 'rs, 'rt, code: 'code");
1676 Format(instr,
"tlt 'rs, 'rt, code: 'code");
1679 Format(instr,
"tltu 'rs, 'rt, code: 'code");
1682 Format(instr,
"teq 'rs, 'rt, code: 'code");
1685 Format(instr,
"tne 'rs, 'rt, code: 'code");
1688 Format(instr,
"sync");
1691 Format(instr,
"movz 'rd, 'rs, 'rt");
1694 Format(instr,
"movn 'rd, 'rs, 'rt");
1697 if (instr->Bit(16)) {
1698 Format(instr,
"movt 'rd, 'rs, 'bc");
1700 Format(instr,
"movf 'rd, 'rs, 'bc");
1704 Format(instr,
"seleqz 'rd, 'rs, 'rt");
1707 Format(instr,
"selnez 'rd, 'rs, 'rt");
1715 void Decoder::DecodeTypeRegisterSPECIAL2(Instruction* instr) {
1716 switch (instr->FunctionFieldRaw()) {
1718 Format(instr,
"mul 'rd, 'rs, 'rt");
1721 if (kArchVariant != kMips64r6) {
1722 Format(instr,
"clz 'rd, 'rs");
1726 if (kArchVariant != kMips64r6) {
1727 Format(instr,
"dclz 'rd, 'rs");
1736 void Decoder::DecodeTypeRegisterSPECIAL3(Instruction* instr) {
1737 switch (instr->FunctionFieldRaw()) {
1739 Format(instr,
"ext 'rt, 'rs, 'sa, 'ss1");
1743 Format(instr,
"dext 'rt, 'rs, 'sa, 'ss1");
1747 Format(instr,
"dextm 'rt, 'rs, 'sa, 'ss3");
1751 Format(instr,
"dextu 'rt, 'rs, 'ss5, 'ss1");
1755 Format(instr,
"ins 'rt, 'rs, 'sa, 'ss2");
1759 Format(instr,
"dins 'rt, 'rs, 'sa, 'ss2");
1763 Format(instr,
"dinsm 'rt, 'rs, 'sa, 'ss4");
1767 Format(instr,
"dinsu 'rt, 'rs, 'ss5, 'ss2");
1771 int sa = instr->SaFieldRaw() >> kSaShift;
1774 Format(instr,
"bitswap 'rd, 'rt");
1778 Format(instr,
"seb 'rd, 'rt");
1782 Format(instr,
"seh 'rd, 'rt");
1786 Format(instr,
"wsbh 'rd, 'rt");
1793 Format(instr,
"align 'rd, 'rs, 'rt, 'bp2");
1806 int sa = instr->SaFieldRaw() >> kSaShift;
1809 switch (instr->SaFieldRaw() >> kSaShift) {
1811 Format(instr,
"dbitswap 'rd, 'rt");
1820 Format(instr,
"dsbh 'rd, 'rt");
1824 Format(instr,
"dshd 'rd, 'rt");
1831 Format(instr,
"dalign 'rd, 'rs, 'rt, 'bp3");
1849 int Decoder::DecodeTypeRegister(Instruction* instr) {
1850 switch (instr->OpcodeFieldRaw()) {
1852 DecodeTypeRegisterCOP1(instr);
1855 DecodeTypeRegisterCOP1X(instr);
1858 switch (instr->FunctionFieldRaw()) {
1860 return DecodeBreakInstr(instr);
1862 DecodeTypeRegisterSPECIAL(instr);
1867 DecodeTypeRegisterSPECIAL2(instr);
1870 DecodeTypeRegisterSPECIAL3(instr);
1873 switch (instr->MSAMinorOpcodeField()) {
1875 DecodeTypeMsa3R(instr);
1878 DecodeTypeMsa3RF(instr);
1881 DecodeTypeMsaVec(instr);
1884 DecodeTypeMsa2R(instr);
1887 DecodeTypeMsa2RF(instr);
1890 DecodeTypeMsaELM(instr);
1902 void Decoder::DecodeTypeImmediateCOP1(Instruction* instr) {
1903 switch (instr->RsFieldRaw()) {
1905 if (instr->FBtrueValue()) {
1906 Format(instr,
"bc1t 'bc, 'imm16u -> 'imm16p4s2");
1908 Format(instr,
"bc1f 'bc, 'imm16u -> 'imm16p4s2");
1912 Format(instr,
"bc1eqz 'ft, 'imm16u -> 'imm16p4s2");
1915 Format(instr,
"bc1nez 'ft, 'imm16u -> 'imm16p4s2");
1922 Format(instr,
"bz.'t 'wt, 'imm16s -> 'imm16p4s2");
1929 Format(instr,
"bnz.'t 'wt, 'imm16s -> 'imm16p4s2");
1937 void Decoder::DecodeTypeImmediateREGIMM(Instruction* instr) {
1938 switch (instr->RtFieldRaw()) {
1940 Format(instr,
"bltz 'rs, 'imm16u -> 'imm16p4s2");
1943 Format(instr,
"bltzal 'rs, 'imm16u -> 'imm16p4s2");
1946 Format(instr,
"bgez 'rs, 'imm16u -> 'imm16p4s2");
1949 if (instr->RsValue() == 0)
1950 Format(instr,
"bal 'imm16s -> 'imm16p4s2");
1952 Format(instr,
"bgezal 'rs, 'imm16u -> 'imm16p4s2");
1956 Format(instr,
"bgezall 'rs, 'imm16u -> 'imm16p4s2");
1959 Format(instr,
"dahi 'rs, 'imm16x");
1962 Format(instr,
"dati 'rs, 'imm16x");
1969 void Decoder::DecodeTypeImmediateSPECIAL3(Instruction* instr) {
1970 switch (instr->FunctionFieldRaw()) {
1972 if (kArchVariant == kMips64r6) {
1973 Format(instr,
"ll 'rt, 'imm9s('rs)");
1980 if (kArchVariant == kMips64r6) {
1981 Format(instr,
"lld 'rt, 'imm9s('rs)");
1988 if (kArchVariant == kMips64r6) {
1989 Format(instr,
"sc 'rt, 'imm9s('rs)");
1996 if (kArchVariant == kMips64r6) {
1997 Format(instr,
"scd 'rt, 'imm9s('rs)");
2008 void Decoder::DecodeTypeImmediate(Instruction* instr) {
2009 switch (instr->OpcodeFieldRaw()) {
2011 DecodeTypeImmediateCOP1(instr);
2015 DecodeTypeImmediateREGIMM(instr);
2019 Format(instr,
"beq 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2022 Format(instr,
"bc 'imm26s -> 'imm26p4s2");
2025 Format(instr,
"balc 'imm26s -> 'imm26p4s2");
2028 Format(instr,
"bne 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2031 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) {
2032 Format(instr,
"blez 'rs, 'imm16u -> 'imm16p4s2");
2033 }
else if ((instr->RtValue() != instr->RsValue()) &&
2034 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
2035 Format(instr,
"bgeuc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2036 }
else if ((instr->RtValue() == instr->RsValue()) &&
2037 (instr->RtValue() != 0)) {
2038 Format(instr,
"bgezalc 'rs, 'imm16u -> 'imm16p4s2");
2039 }
else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
2040 Format(instr,
"blezalc 'rt, 'imm16u -> 'imm16p4s2");
2046 if ((instr->RtValue() == 0) && (instr->RsValue() != 0)) {
2047 Format(instr,
"bgtz 'rs, 'imm16u -> 'imm16p4s2");
2048 }
else if ((instr->RtValue() != instr->RsValue()) &&
2049 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
2050 Format(instr,
"bltuc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2051 }
else if ((instr->RtValue() == instr->RsValue()) &&
2052 (instr->RtValue() != 0)) {
2053 Format(instr,
"bltzalc 'rt, 'imm16u -> 'imm16p4s2");
2054 }
else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
2055 Format(instr,
"bgtzalc 'rt, 'imm16u -> 'imm16p4s2");
2061 if ((instr->RtValue() == instr->RsValue()) && (instr->RtValue() != 0)) {
2062 Format(instr,
"bgezc 'rt, 'imm16u -> 'imm16p4s2");
2063 }
else if ((instr->RtValue() != instr->RsValue()) &&
2064 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
2065 Format(instr,
"bgec 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2066 }
else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
2067 Format(instr,
"blezc 'rt, 'imm16u -> 'imm16p4s2");
2073 if ((instr->RtValue() == instr->RsValue()) && (instr->RtValue() != 0)) {
2074 Format(instr,
"bltzc 'rt, 'imm16u -> 'imm16p4s2");
2075 }
else if ((instr->RtValue() != instr->RsValue()) &&
2076 (instr->RsValue() != 0) && (instr->RtValue() != 0)) {
2077 Format(instr,
"bltc 'rs, 'rt, 'imm16u -> 'imm16p4s2");
2078 }
else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) {
2079 Format(instr,
"bgtzc 'rt, 'imm16u -> 'imm16p4s2");
2085 if (instr->RsValue() == JIC) {
2086 Format(instr,
"jic 'rt, 'imm16s");
2088 Format(instr,
"beqzc 'rs, 'imm21s -> 'imm21p4s2");
2092 if (instr->RsValue() == JIALC) {
2093 Format(instr,
"jialc 'rt, 'imm16s");
2095 Format(instr,
"bnezc 'rs, 'imm21s -> 'imm21p4s2");
2100 if (kArchVariant != kMips64r6) {
2101 Format(instr,
"addi 'rt, 'rs, 'imm16s");
2103 int rs_reg = instr->RsValue();
2104 int rt_reg = instr->RtValue();
2106 if (rs_reg >= rt_reg) {
2107 Format(instr,
"bovc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
2109 DCHECK_GT(rt_reg, 0);
2111 Format(instr,
"beqzalc 'rt, 'imm16s -> 'imm16p4s2");
2113 Format(instr,
"beqc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
2119 if (kArchVariant != kMips64r6) {
2120 Format(instr,
"daddi 'rt, 'rs, 'imm16s");
2122 int rs_reg = instr->RsValue();
2123 int rt_reg = instr->RtValue();
2125 if (rs_reg >= rt_reg) {
2126 Format(instr,
"bnvc 'rs, 'rt, 'imm16s -> 'imm16p4s2");
2128 DCHECK_GT(rt_reg, 0);
2130 Format(instr,
"bnezalc 'rt, 'imm16s -> 'imm16p4s2");
2132 Format(instr,
"bnec 'rs, 'rt, 'imm16s -> 'imm16p4s2");
2138 Format(instr,
"addiu 'rt, 'rs, 'imm16s");
2141 Format(instr,
"daddiu 'rt, 'rs, 'imm16s");
2144 Format(instr,
"slti 'rt, 'rs, 'imm16s");
2147 Format(instr,
"sltiu 'rt, 'rs, 'imm16u");
2150 Format(instr,
"andi 'rt, 'rs, 'imm16x");
2153 Format(instr,
"ori 'rt, 'rs, 'imm16x");
2156 Format(instr,
"xori 'rt, 'rs, 'imm16x");
2159 if (kArchVariant != kMips64r6) {
2160 Format(instr,
"lui 'rt, 'imm16x");
2162 if (instr->RsValue() != 0) {
2163 Format(instr,
"aui 'rt, 'rs, 'imm16x");
2165 Format(instr,
"lui 'rt, 'imm16x");
2170 Format(instr,
"daui 'rt, 'rs, 'imm16x");
2174 Format(instr,
"lb 'rt, 'imm16s('rs)");
2177 Format(instr,
"lh 'rt, 'imm16s('rs)");
2180 Format(instr,
"lwl 'rt, 'imm16s('rs)");
2183 Format(instr,
"ldl 'rt, 'imm16s('rs)");
2186 Format(instr,
"lw 'rt, 'imm16s('rs)");
2189 Format(instr,
"lwu 'rt, 'imm16s('rs)");
2192 Format(instr,
"ld 'rt, 'imm16s('rs)");
2195 Format(instr,
"lbu 'rt, 'imm16s('rs)");
2198 Format(instr,
"lhu 'rt, 'imm16s('rs)");
2201 Format(instr,
"lwr 'rt, 'imm16s('rs)");
2204 Format(instr,
"ldr 'rt, 'imm16s('rs)");
2207 Format(instr,
"pref 'rt, 'imm16s('rs)");
2210 Format(instr,
"sb 'rt, 'imm16s('rs)");
2213 Format(instr,
"sh 'rt, 'imm16s('rs)");
2216 Format(instr,
"swl 'rt, 'imm16s('rs)");
2219 Format(instr,
"sw 'rt, 'imm16s('rs)");
2222 Format(instr,
"sd 'rt, 'imm16s('rs)");
2225 Format(instr,
"swr 'rt, 'imm16s('rs)");
2228 Format(instr,
"sdr 'rt, 'imm16s('rs)");
2231 Format(instr,
"sdl 'rt, 'imm16s('rs)");
2234 if (kArchVariant == kMips64r6) {
2237 Format(instr,
"ll 'rt, 'imm16s('rs)");
2241 if (kArchVariant == kMips64r6) {
2244 Format(instr,
"lld 'rt, 'imm16s('rs)");
2248 if (kArchVariant == kMips64r6) {
2251 Format(instr,
"sc 'rt, 'imm16s('rs)");
2255 if (kArchVariant == kMips64r6) {
2258 Format(instr,
"scd 'rt, 'imm16s('rs)");
2262 Format(instr,
"lwc1 'ft, 'imm16s('rs)");
2265 Format(instr,
"ldc1 'ft, 'imm16s('rs)");
2268 Format(instr,
"swc1 'ft, 'imm16s('rs)");
2271 Format(instr,
"sdc1 'ft, 'imm16s('rs)");
2274 int32_t imm21 = instr->Imm21Value();
2276 uint8_t rt = (imm21 >> kImm16Bits);
2279 Format(instr,
"aluipc 'rs, 'imm16s");
2282 Format(instr,
"auipc 'rs, 'imm16s");
2286 rt = (imm21 >> kImm18Bits);
2289 Format(instr,
"ldpc 'rs, 'imm18s");
2293 rt = (imm21 >> kImm19Bits);
2296 Format(instr,
"lwupc 'rs, 'imm19s");
2299 Format(instr,
"lwpc 'rs, 'imm19s");
2302 Format(instr,
"addiupc 'rs, 'imm19s");
2317 DecodeTypeImmediateSPECIAL3(instr);
2320 switch (instr->MSAMinorOpcodeField()) {
2322 DecodeTypeMsaI8(instr);
2325 DecodeTypeMsaI5(instr);
2328 DecodeTypeMsaI10(instr);
2331 DecodeTypeMsaELM(instr);
2334 DecodeTypeMsaBIT(instr);
2337 DecodeTypeMsaMI10(instr);
2345 printf(
"a 0x%x \n", instr->OpcodeFieldRaw());
2352 void Decoder::DecodeTypeJump(Instruction* instr) {
2353 switch (instr->OpcodeFieldRaw()) {
2355 Format(instr,
"j 'imm26x -> 'imm26j");
2358 Format(instr,
"jal 'imm26x -> 'imm26j");
2365 void Decoder::DecodeTypeMsaI8(Instruction* instr) {
2366 uint32_t opcode = instr->InstructionBits() & kMsaI8Mask;
2370 Format(instr,
"andi.b 'wd, 'ws, 'imm8");
2373 Format(instr,
"ori.b 'wd, 'ws, 'imm8");
2376 Format(instr,
"nori.b 'wd, 'ws, 'imm8");
2379 Format(instr,
"xori.b 'wd, 'ws, 'imm8");
2382 Format(instr,
"bmnzi.b 'wd, 'ws, 'imm8");
2385 Format(instr,
"bmzi.b 'wd, 'ws, 'imm8");
2388 Format(instr,
"bseli.b 'wd, 'ws, 'imm8");
2391 Format(instr,
"shf.b 'wd, 'ws, 'imm8");
2394 Format(instr,
"shf.h 'wd, 'ws, 'imm8");
2397 Format(instr,
"shf.w 'wd, 'ws, 'imm8");
2404 void Decoder::DecodeTypeMsaI5(Instruction* instr) {
2405 uint32_t opcode = instr->InstructionBits() & kMsaI5Mask;
2409 Format(instr,
"addvi.'t 'wd, 'ws, 'imm5u");
2412 Format(instr,
"subvi.'t 'wd, 'ws, 'imm5u");
2415 Format(instr,
"maxi_s.'t 'wd, 'ws, 'imm5s");
2418 Format(instr,
"maxi_u.'t 'wd, 'ws, 'imm5u");
2421 Format(instr,
"mini_s.'t 'wd, 'ws, 'imm5s");
2424 Format(instr,
"mini_u.'t 'wd, 'ws, 'imm5u");
2427 Format(instr,
"ceqi.'t 'wd, 'ws, 'imm5s");
2430 Format(instr,
"clti_s.'t 'wd, 'ws, 'imm5s");
2433 Format(instr,
"clti_u.'t 'wd, 'ws, 'imm5u");
2436 Format(instr,
"clei_s.'t 'wd, 'ws, 'imm5s");
2439 Format(instr,
"clei_u.'t 'wd, 'ws, 'imm5u");
2446 void Decoder::DecodeTypeMsaI10(Instruction* instr) {
2447 uint32_t opcode = instr->InstructionBits() & kMsaI5Mask;
2448 if (opcode == LDI) {
2449 Format(instr,
"ldi.'t 'wd, 'imm10s1");
2455 void Decoder::DecodeTypeMsaELM(Instruction* instr) {
2456 uint32_t opcode = instr->InstructionBits() & kMsaELMMask;
2459 if (instr->Bits(21, 16) == 0x3E) {
2460 Format(instr,
"ctcmsa ");
2461 PrintMSAControlRegister(instr->WdValue());
2463 PrintRegister(instr->WsValue());
2465 Format(instr,
"sldi.'t 'wd, 'ws['imme]");
2469 if (instr->Bits(21, 16) == 0x3E) {
2470 Format(instr,
"cfcmsa ");
2471 PrintRegister(instr->WdValue());
2473 PrintMSAControlRegister(instr->WsValue());
2475 Format(instr,
"splati.'t 'wd, 'ws['imme]");
2479 if (instr->Bits(21, 16) == 0x3E) {
2480 Format(instr,
"move.v 'wd, 'ws");
2482 Format(instr,
"copy_s.'t ");
2483 PrintMsaCopy(instr);
2487 Format(instr,
"copy_u.'t ");
2488 PrintMsaCopy(instr);
2491 Format(instr,
"insert.'t 'wd['imme], ");
2492 PrintRegister(instr->WsValue());
2495 Format(instr,
"insve.'t 'wd['imme], 'ws[0]");
2502 void Decoder::DecodeTypeMsaBIT(Instruction* instr) {
2503 uint32_t opcode = instr->InstructionBits() & kMsaBITMask;
2507 Format(instr,
"slli.'t 'wd, 'ws, 'immb");
2510 Format(instr,
"srai.'t 'wd, 'ws, 'immb");
2513 Format(instr,
"srli.'t 'wd, 'ws, 'immb");
2516 Format(instr,
"bclri.'t 'wd, 'ws, 'immb");
2519 Format(instr,
"bseti.'t 'wd, 'ws, 'immb");
2522 Format(instr,
"bnegi.'t 'wd, 'ws, 'immb");
2525 Format(instr,
"binsli.'t 'wd, 'ws, 'immb");
2528 Format(instr,
"binsri.'t 'wd, 'ws, 'immb");
2531 Format(instr,
"sat_s.'t 'wd, 'ws, 'immb");
2534 Format(instr,
"sat_u.'t 'wd, 'ws, 'immb");
2537 Format(instr,
"srari.'t 'wd, 'ws, 'immb");
2540 Format(instr,
"srlri.'t 'wd, 'ws, 'immb");
2547 void Decoder::DecodeTypeMsaMI10(Instruction* instr) {
2548 uint32_t opcode = instr->InstructionBits() & kMsaMI10Mask;
2549 if (opcode == MSA_LD) {
2550 Format(instr,
"ld.'t 'wd, 'imm10s2(");
2551 PrintRegister(instr->WsValue());
2553 }
else if (opcode == MSA_ST) {
2554 Format(instr,
"st.'t 'wd, 'imm10s2(");
2555 PrintRegister(instr->WsValue());
2562 void Decoder::DecodeTypeMsa3R(Instruction* instr) {
2563 uint32_t opcode = instr->InstructionBits() & kMsa3RMask;
2566 Format(instr,
"sll.'t 'wd, 'ws, 'wt");
2569 Format(instr,
"sra.'t 'wd, 'ws, 'wt");
2572 Format(instr,
"srl.'t 'wd, 'ws, 'wt");
2575 Format(instr,
"bclr.'t 'wd, 'ws, 'wt");
2578 Format(instr,
"bset.'t 'wd, 'ws, 'wt");
2581 Format(instr,
"bneg.'t 'wd, 'ws, 'wt");
2584 Format(instr,
"binsl.'t 'wd, 'ws, 'wt");
2587 Format(instr,
"binsr.'t 'wd, 'ws, 'wt");
2590 Format(instr,
"addv.'t 'wd, 'ws, 'wt");
2593 Format(instr,
"subv.'t 'wd, 'ws, 'wt");
2596 Format(instr,
"max_s.'t 'wd, 'ws, 'wt");
2599 Format(instr,
"max_u.'t 'wd, 'ws, 'wt");
2602 Format(instr,
"min_s.'t 'wd, 'ws, 'wt");
2605 Format(instr,
"min_u.'t 'wd, 'ws, 'wt");
2608 Format(instr,
"max_a.'t 'wd, 'ws, 'wt");
2611 Format(instr,
"min_a.'t 'wd, 'ws, 'wt");
2614 Format(instr,
"ceq.'t 'wd, 'ws, 'wt");
2617 Format(instr,
"clt_s.'t 'wd, 'ws, 'wt");
2620 Format(instr,
"clt_u.'t 'wd, 'ws, 'wt");
2623 Format(instr,
"cle_s.'t 'wd, 'ws, 'wt");
2626 Format(instr,
"cle_u.'t 'wd, 'ws, 'wt");
2629 Format(instr,
"add_a.'t 'wd, 'ws, 'wt");
2632 Format(instr,
"adds_a.'t 'wd, 'ws, 'wt");
2635 Format(instr,
"adds_s.'t 'wd, 'ws, 'wt");
2638 Format(instr,
"adds_u.'t 'wd, 'ws, 'wt");
2641 Format(instr,
"ave_s.'t 'wd, 'ws, 'wt");
2644 Format(instr,
"ave_u.'t 'wd, 'ws, 'wt");
2647 Format(instr,
"aver_s.'t 'wd, 'ws, 'wt");
2650 Format(instr,
"aver_u.'t 'wd, 'ws, 'wt");
2653 Format(instr,
"subs_s.'t 'wd, 'ws, 'wt");
2656 Format(instr,
"subs_u.'t 'wd, 'ws, 'wt");
2659 Format(instr,
"subsus_u.'t 'wd, 'ws, 'wt");
2662 Format(instr,
"subsuu_s.'t 'wd, 'ws, 'wt");
2665 Format(instr,
"asub_s.'t 'wd, 'ws, 'wt");
2668 Format(instr,
"asub_u.'t 'wd, 'ws, 'wt");
2671 Format(instr,
"mulv.'t 'wd, 'ws, 'wt");
2674 Format(instr,
"maddv.'t 'wd, 'ws, 'wt");
2677 Format(instr,
"msubv.'t 'wd, 'ws, 'wt");
2680 Format(instr,
"div_s.'t 'wd, 'ws, 'wt");
2683 Format(instr,
"div_u.'t 'wd, 'ws, 'wt");
2686 Format(instr,
"mod_s.'t 'wd, 'ws, 'wt");
2689 Format(instr,
"mod_u.'t 'wd, 'ws, 'wt");
2692 Format(instr,
"dotp_s.'t 'wd, 'ws, 'wt");
2695 Format(instr,
"dotp_u.'t 'wd, 'ws, 'wt");
2698 Format(instr,
"dpadd_s.'t 'wd, 'ws, 'wt");
2701 Format(instr,
"dpadd_u.'t 'wd, 'ws, 'wt");
2704 Format(instr,
"dpsub_s.'t 'wd, 'ws, 'wt");
2707 Format(instr,
"dpsub_u.'t 'wd, 'ws, 'wt");
2710 Format(instr,
"sld.'t 'wd, 'ws['rt]");
2713 Format(instr,
"splat.'t 'wd, 'ws['rt]");
2716 Format(instr,
"pckev.'t 'wd, 'ws, 'wt");
2719 Format(instr,
"pckod.'t 'wd, 'ws, 'wt");
2722 Format(instr,
"ilvl.'t 'wd, 'ws, 'wt");
2725 Format(instr,
"ilvr.'t 'wd, 'ws, 'wt");
2728 Format(instr,
"ilvev.'t 'wd, 'ws, 'wt");
2731 Format(instr,
"ilvod.'t 'wd, 'ws, 'wt");
2734 Format(instr,
"vshf.'t 'wd, 'ws, 'wt");
2737 Format(instr,
"srar.'t 'wd, 'ws, 'wt");
2740 Format(instr,
"srlr.'t 'wd, 'ws, 'wt");
2743 Format(instr,
"hadd_s.'t 'wd, 'ws, 'wt");
2746 Format(instr,
"hadd_u.'t 'wd, 'ws, 'wt");
2749 Format(instr,
"hsub_s.'t 'wd, 'ws, 'wt");
2752 Format(instr,
"hsub_u.'t 'wd, 'ws, 'wt");
2759 void Decoder::DecodeTypeMsa3RF(Instruction* instr) {
2760 uint32_t opcode = instr->InstructionBits() & kMsa3RFMask;
2763 Format(instr,
"fcaf.'t 'wd, 'ws, 'wt");
2766 Format(instr,
"fcun.'t 'wd, 'ws, 'wt");
2769 Format(instr,
"fceq.'t 'wd, 'ws, 'wt");
2772 Format(instr,
"fcueq.'t 'wd, 'ws, 'wt");
2775 Format(instr,
"fclt.'t 'wd, 'ws, 'wt");
2778 Format(instr,
"fcult.'t 'wd, 'ws, 'wt");
2781 Format(instr,
"fcle.'t 'wd, 'ws, 'wt");
2784 Format(instr,
"fcule.'t 'wd, 'ws, 'wt");
2787 Format(instr,
"fsaf.'t 'wd, 'ws, 'wt");
2790 Format(instr,
"fsun.'t 'wd, 'ws, 'wt");
2793 Format(instr,
"fseq.'t 'wd, 'ws, 'wt");
2796 Format(instr,
"fsueq.'t 'wd, 'ws, 'wt");
2799 Format(instr,
"fslt.'t 'wd, 'ws, 'wt");
2802 Format(instr,
"fsult.'t 'wd, 'ws, 'wt");
2805 Format(instr,
"fsle.'t 'wd, 'ws, 'wt");
2808 Format(instr,
"fsule.'t 'wd, 'ws, 'wt");
2811 Format(instr,
"fadd.'t 'wd, 'ws, 'wt");
2814 Format(instr,
"fsub.'t 'wd, 'ws, 'wt");
2817 Format(instr,
"fmul.'t 'wd, 'ws, 'wt");
2820 Format(instr,
"fdiv.'t 'wd, 'ws, 'wt");
2823 Format(instr,
"fmadd.'t 'wd, 'ws, 'wt");
2826 Format(instr,
"fmsub.'t 'wd, 'ws, 'wt");
2829 Format(instr,
"fexp2.'t 'wd, 'ws, 'wt");
2832 Format(instr,
"fexdo.'t 'wd, 'ws, 'wt");
2835 Format(instr,
"ftq.'t 'wd, 'ws, 'wt");
2838 Format(instr,
"fmin.'t 'wd, 'ws, 'wt");
2841 Format(instr,
"fmin_a.'t 'wd, 'ws, 'wt");
2844 Format(instr,
"fmax.'t 'wd, 'ws, 'wt");
2847 Format(instr,
"fmax_a.'t 'wd, 'ws, 'wt");
2850 Format(instr,
"fcor.'t 'wd, 'ws, 'wt");
2853 Format(instr,
"fcune.'t 'wd, 'ws, 'wt");
2856 Format(instr,
"fcne.'t 'wd, 'ws, 'wt");
2859 Format(instr,
"mul_q.'t 'wd, 'ws, 'wt");
2862 Format(instr,
"madd_q.'t 'wd, 'ws, 'wt");
2865 Format(instr,
"msub_q.'t 'wd, 'ws, 'wt");
2868 Format(instr,
"fsor.'t 'wd, 'ws, 'wt");
2871 Format(instr,
"fsune.'t 'wd, 'ws, 'wt");
2874 Format(instr,
"fsne.'t 'wd, 'ws, 'wt");
2877 Format(instr,
"mulr_q.'t 'wd, 'ws, 'wt");
2880 Format(instr,
"maddr_q.'t 'wd, 'ws, 'wt");
2883 Format(instr,
"msubr_q.'t 'wd, 'ws, 'wt");
2890 void Decoder::DecodeTypeMsaVec(Instruction* instr) {
2891 uint32_t opcode = instr->InstructionBits() & kMsaVECMask;
2894 Format(instr,
"and.v 'wd, 'ws, 'wt");
2897 Format(instr,
"or.v 'wd, 'ws, 'wt");
2900 Format(instr,
"nor.v 'wd, 'ws, 'wt");
2903 Format(instr,
"xor.v 'wd, 'ws, 'wt");
2906 Format(instr,
"bmnz.v 'wd, 'ws, 'wt");
2909 Format(instr,
"bmz.v 'wd, 'ws, 'wt");
2912 Format(instr,
"bsel.v 'wd, 'ws, 'wt");
2919 void Decoder::DecodeTypeMsa2R(Instruction* instr) {
2920 uint32_t opcode = instr->InstructionBits() & kMsa2RMask;
2923 Format(instr,
"fill.'t 'wd, ");
2924 PrintRegister(instr->WsValue());
2927 Format(instr,
"pcnt.'t 'wd, 'ws");
2930 Format(instr,
"nloc.'t 'wd, 'ws");
2933 Format(instr,
"nlzc.'t 'wd, 'ws");
2940 void Decoder::DecodeTypeMsa2RF(Instruction* instr) {
2941 uint32_t opcode = instr->InstructionBits() & kMsa2RFMask;
2944 Format(instr,
"fclass.'t 'wd, 'ws");
2947 Format(instr,
"ftrunc_s.'t 'wd, 'ws");
2950 Format(instr,
"ftrunc_u.'t 'wd, 'ws");
2953 Format(instr,
"fsqrt.'t 'wd, 'ws");
2956 Format(instr,
"frsqrt.'t 'wd, 'ws");
2959 Format(instr,
"frcp.'t 'wd, 'ws");
2962 Format(instr,
"frint.'t 'wd, 'ws");
2965 Format(instr,
"flog2.'t 'wd, 'ws");
2968 Format(instr,
"fexupl.'t 'wd, 'ws");
2971 Format(instr,
"fexupr.'t 'wd, 'ws");
2974 Format(instr,
"ffql.'t 'wd, 'ws");
2977 Format(instr,
"ffqr.'t 'wd, 'ws");
2980 Format(instr,
"ftint_s.'t 'wd, 'ws");
2983 Format(instr,
"ftint_u.'t 'wd, 'ws");
2986 Format(instr,
"ffint_s.'t 'wd, 'ws");
2989 Format(instr,
"ffint_u.'t 'wd, 'ws");
3001 int Decoder::InstructionDecode(byte* instr_ptr) {
3002 Instruction* instr = Instruction::At(instr_ptr);
3004 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
3006 instr->InstructionBits());
3007 switch (instr->InstructionType()) {
3008 case Instruction::kRegisterType: {
3009 return DecodeTypeRegister(instr);
3011 case Instruction::kImmediateType: {
3012 DecodeTypeImmediate(instr);
3015 case Instruction::kJumpType: {
3016 DecodeTypeJump(instr);
3020 Format(instr,
"UNSUPPORTED");
3035 const char* NameConverter::NameOfAddress(byte* addr)
const {
3036 v8::internal::SNPrintF(tmp_buffer_,
"%p", static_cast<void*>(addr));
3037 return tmp_buffer_.start();
3041 const char* NameConverter::NameOfConstant(byte* addr)
const {
3042 return NameOfAddress(addr);
3046 const char* NameConverter::NameOfCPURegister(
int reg)
const {
3047 return v8::internal::Registers::Name(reg);
3051 const char* NameConverter::NameOfXMMRegister(
int reg)
const {
3052 return v8::internal::FPURegisters::Name(reg);
3056 const char* NameConverter::NameOfByteCPURegister(
int reg)
const {
3062 const char* NameConverter::NameInCode(byte* addr)
const {
3072 byte* instruction) {
3074 return d.InstructionDecode(instruction);
3079 int Disassembler::ConstantPoolSizeAt(byte* instruction) {
3083 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end,
3084 UnimplementedOpcodeAction unimplemented_action) {
3085 NameConverter converter;
3086 Disassembler d(converter, unimplemented_action);
3087 for (byte* pc = begin; pc < end;) {
3091 pc += d.InstructionDecode(buffer, pc);
3092 v8::internal::PrintF(f,
"%p %08x %s\n", static_cast<void*>(prev_pc),
3093 *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
3102 #endif // V8_TARGET_ARCH_MIPS64