blob: 5d594f1f4263f94b3f1d048f794092ce62c03352 [file] [log] [blame]
Akira Hatanaka71928e62012-04-17 18:03:21 +00001//===- MipsDisassembler.cpp - Disassembler for Mips -------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is part of the Mips Disassembler.
11//
12//===----------------------------------------------------------------------===//
13
14#include "Mips.h"
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000015#include "MipsRegisterInfo.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000016#include "MipsSubtarget.h"
Lang Hamesa1bc0f52014-04-15 04:40:56 +000017#include "llvm/MC/MCContext.h"
Akira Hatanaka71928e62012-04-17 18:03:21 +000018#include "llvm/MC/MCDisassembler.h"
Jim Grosbachecaef492012-08-14 19:06:05 +000019#include "llvm/MC/MCFixedLenDisassembler.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000020#include "llvm/MC/MCInst.h"
21#include "llvm/MC/MCSubtargetInfo.h"
22#include "llvm/Support/MathExtras.h"
Akira Hatanaka71928e62012-04-17 18:03:21 +000023#include "llvm/Support/TargetRegistry.h"
Akira Hatanaka71928e62012-04-17 18:03:21 +000024
Akira Hatanaka71928e62012-04-17 18:03:21 +000025using namespace llvm;
26
Chandler Carruthe96dd892014-04-21 22:55:11 +000027#define DEBUG_TYPE "mips-disassembler"
28
Akira Hatanaka71928e62012-04-17 18:03:21 +000029typedef MCDisassembler::DecodeStatus DecodeStatus;
30
Benjamin Kramercb3e98c2012-05-01 14:34:24 +000031namespace {
32
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000033/// A disasembler class for Mips.
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000034class MipsDisassemblerBase : public MCDisassembler {
Akira Hatanaka71928e62012-04-17 18:03:21 +000035public:
Lang Hamesa1bc0f52014-04-15 04:40:56 +000036 MipsDisassemblerBase(const MCSubtargetInfo &STI, MCContext &Ctx,
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000037 bool IsBigEndian)
38 : MCDisassembler(STI, Ctx),
39 IsN64(STI.getFeatureBits() & Mips::FeatureN64),
40 IsBigEndian(IsBigEndian) {}
Akira Hatanaka71928e62012-04-17 18:03:21 +000041
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000042 virtual ~MipsDisassemblerBase() {}
Akira Hatanaka71928e62012-04-17 18:03:21 +000043
Akira Hatanaka9bfa2e22013-08-28 00:55:15 +000044 bool isN64() const { return IsN64; }
45
Akira Hatanaka71928e62012-04-17 18:03:21 +000046private:
Akira Hatanaka9bfa2e22013-08-28 00:55:15 +000047 bool IsN64;
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000048protected:
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000049 bool IsBigEndian;
Akira Hatanaka71928e62012-04-17 18:03:21 +000050};
51
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000052/// A disasembler class for Mips32.
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000053class MipsDisassembler : public MipsDisassemblerBase {
Vladimir Medicdde3d582013-09-06 12:30:36 +000054 bool IsMicroMips;
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000055public:
Daniel Sandersc171f652014-06-13 13:15:59 +000056 MipsDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, bool bigEndian)
57 : MipsDisassemblerBase(STI, Ctx, bigEndian) {
58 IsMicroMips = STI.getFeatureBits() & Mips::FeatureMicroMips;
59 }
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000060
Daniel Sandersc171f652014-06-13 13:15:59 +000061 bool hasMips3() const { return STI.getFeatureBits() & Mips::FeatureMips3; }
62 bool hasMips32() const { return STI.getFeatureBits() & Mips::FeatureMips32; }
63 bool hasMips32r6() const {
Daniel Sanders5c582b22014-05-22 11:23:21 +000064 return STI.getFeatureBits() & Mips::FeatureMips32r6;
65 }
66
Daniel Sanders0fa60412014-06-12 13:39:06 +000067 bool isGP64() const { return STI.getFeatureBits() & Mips::FeatureGP64Bit; }
68
Daniel Sandersc171f652014-06-13 13:15:59 +000069 bool hasCOP3() const {
70 // Only present in MIPS-I and MIPS-II
71 return !hasMips32() && !hasMips3();
72 }
73
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000074 DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
Rafael Espindola7fc5b872014-11-12 02:04:27 +000075 ArrayRef<uint8_t> Bytes, uint64_t Address,
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000076 raw_ostream &VStream,
77 raw_ostream &CStream) const override;
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000078};
79
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000080/// A disasembler class for Mips64.
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000081class Mips64Disassembler : public MipsDisassemblerBase {
Akira Hatanaka71928e62012-04-17 18:03:21 +000082public:
Lang Hamesa1bc0f52014-04-15 04:40:56 +000083 Mips64Disassembler(const MCSubtargetInfo &STI, MCContext &Ctx,
Akira Hatanaka9bf2b562012-07-09 18:46:47 +000084 bool bigEndian) :
Lang Hamesa1bc0f52014-04-15 04:40:56 +000085 MipsDisassemblerBase(STI, Ctx, bigEndian) {}
Akira Hatanaka71928e62012-04-17 18:03:21 +000086
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000087 DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
Rafael Espindola7fc5b872014-11-12 02:04:27 +000088 ArrayRef<uint8_t> Bytes, uint64_t Address,
Rafael Espindola4aa6bea2014-11-10 18:11:10 +000089 raw_ostream &VStream,
90 raw_ostream &CStream) const override;
Akira Hatanaka71928e62012-04-17 18:03:21 +000091};
92
Benjamin Kramercb3e98c2012-05-01 14:34:24 +000093} // end anonymous namespace
94
Akira Hatanaka71928e62012-04-17 18:03:21 +000095// Forward declare these because the autogenerated code will reference them.
96// Definitions are further down.
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +000097static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst,
98 unsigned RegNo,
99 uint64_t Address,
100 const void *Decoder);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000101
Reed Kotlerec8a5492013-02-14 03:05:25 +0000102static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst,
103 unsigned RegNo,
104 uint64_t Address,
105 const void *Decoder);
106
Zoran Jovanovicb0852e52014-10-21 08:23:11 +0000107static DecodeStatus DecodeGPRMM16RegisterClass(MCInst &Inst,
108 unsigned RegNo,
109 uint64_t Address,
110 const void *Decoder);
111
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000112static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst,
113 unsigned RegNo,
114 uint64_t Address,
115 const void *Decoder);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000116
Akira Hatanaka9bfa2e22013-08-28 00:55:15 +0000117static DecodeStatus DecodePtrRegisterClass(MCInst &Inst,
118 unsigned Insn,
119 uint64_t Address,
120 const void *Decoder);
121
Akira Hatanaka654655f2013-08-14 00:53:38 +0000122static DecodeStatus DecodeDSPRRegisterClass(MCInst &Inst,
123 unsigned RegNo,
124 uint64_t Address,
125 const void *Decoder);
Akira Hatanakaecabd1a2012-09-27 02:01:10 +0000126
Akira Hatanaka71928e62012-04-17 18:03:21 +0000127static DecodeStatus DecodeFGR64RegisterClass(MCInst &Inst,
128 unsigned RegNo,
129 uint64_t Address,
130 const void *Decoder);
131
132static DecodeStatus DecodeFGR32RegisterClass(MCInst &Inst,
133 unsigned RegNo,
134 uint64_t Address,
135 const void *Decoder);
136
137static DecodeStatus DecodeCCRRegisterClass(MCInst &Inst,
138 unsigned RegNo,
139 uint64_t Address,
140 const void *Decoder);
141
Akira Hatanaka1fb1b8b2013-07-26 20:13:47 +0000142static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst,
143 unsigned RegNo,
144 uint64_t Address,
145 const void *Decoder);
146
Daniel Sanders0fa60412014-06-12 13:39:06 +0000147static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo,
148 uint64_t Address,
149 const void *Decoder);
150
Akira Hatanaka71928e62012-04-17 18:03:21 +0000151static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst,
152 unsigned Insn,
153 uint64_t Address,
154 const void *Decoder);
155
156static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst,
157 unsigned RegNo,
158 uint64_t Address,
159 const void *Decoder);
160
Akira Hatanaka00fcf2e2013-08-08 21:54:26 +0000161static DecodeStatus DecodeACC64DSPRegisterClass(MCInst &Inst,
162 unsigned RegNo,
163 uint64_t Address,
164 const void *Decoder);
Akira Hatanakaecabd1a2012-09-27 02:01:10 +0000165
Akira Hatanaka8002a3f2013-08-14 00:47:08 +0000166static DecodeStatus DecodeHI32DSPRegisterClass(MCInst &Inst,
167 unsigned RegNo,
168 uint64_t Address,
169 const void *Decoder);
Akira Hatanaka59bfaf72013-04-18 00:52:44 +0000170
Akira Hatanaka8002a3f2013-08-14 00:47:08 +0000171static DecodeStatus DecodeLO32DSPRegisterClass(MCInst &Inst,
172 unsigned RegNo,
173 uint64_t Address,
174 const void *Decoder);
Akira Hatanaka59bfaf72013-04-18 00:52:44 +0000175
Jack Carter3eb663b2013-09-26 00:09:46 +0000176static DecodeStatus DecodeMSA128BRegisterClass(MCInst &Inst,
177 unsigned RegNo,
178 uint64_t Address,
179 const void *Decoder);
180
Jack Carter5dc8ac92013-09-25 23:50:44 +0000181static DecodeStatus DecodeMSA128HRegisterClass(MCInst &Inst,
182 unsigned RegNo,
183 uint64_t Address,
184 const void *Decoder);
185
186static DecodeStatus DecodeMSA128WRegisterClass(MCInst &Inst,
187 unsigned RegNo,
188 uint64_t Address,
189 const void *Decoder);
190
191static DecodeStatus DecodeMSA128DRegisterClass(MCInst &Inst,
192 unsigned RegNo,
193 uint64_t Address,
194 const void *Decoder);
195
Matheus Almeidaa591fdc2013-10-21 12:26:50 +0000196static DecodeStatus DecodeMSACtrlRegisterClass(MCInst &Inst,
197 unsigned RegNo,
198 uint64_t Address,
199 const void *Decoder);
200
Daniel Sanders2a83d682014-05-21 12:56:39 +0000201static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst,
202 unsigned RegNo,
203 uint64_t Address,
204 const void *Decoder);
205
Akira Hatanaka71928e62012-04-17 18:03:21 +0000206static DecodeStatus DecodeBranchTarget(MCInst &Inst,
207 unsigned Offset,
208 uint64_t Address,
209 const void *Decoder);
210
Akira Hatanaka71928e62012-04-17 18:03:21 +0000211static DecodeStatus DecodeJumpTarget(MCInst &Inst,
212 unsigned Insn,
213 uint64_t Address,
214 const void *Decoder);
215
Zoran Jovanovic3c8869d2014-05-16 11:03:45 +0000216static DecodeStatus DecodeBranchTarget21(MCInst &Inst,
217 unsigned Offset,
218 uint64_t Address,
219 const void *Decoder);
220
221static DecodeStatus DecodeBranchTarget26(MCInst &Inst,
222 unsigned Offset,
223 uint64_t Address,
224 const void *Decoder);
225
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000226// DecodeBranchTargetMM - Decode microMIPS branch offset, which is
227// shifted left by 1 bit.
228static DecodeStatus DecodeBranchTargetMM(MCInst &Inst,
229 unsigned Offset,
230 uint64_t Address,
231 const void *Decoder);
232
Zoran Jovanovic507e0842013-10-29 16:38:59 +0000233// DecodeJumpTargetMM - Decode microMIPS jump target, which is
234// shifted left by 1 bit.
235static DecodeStatus DecodeJumpTargetMM(MCInst &Inst,
236 unsigned Insn,
237 uint64_t Address,
238 const void *Decoder);
239
Akira Hatanaka71928e62012-04-17 18:03:21 +0000240static DecodeStatus DecodeMem(MCInst &Inst,
241 unsigned Insn,
242 uint64_t Address,
243 const void *Decoder);
244
Daniel Sanders92db6b72014-10-01 08:26:55 +0000245static DecodeStatus DecodeCacheOp(MCInst &Inst,
246 unsigned Insn,
247 uint64_t Address,
248 const void *Decoder);
249
Matheus Almeidafe0bf9f2013-10-21 13:07:13 +0000250static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn,
251 uint64_t Address, const void *Decoder);
252
Vladimir Medicdde3d582013-09-06 12:30:36 +0000253static DecodeStatus DecodeMemMMImm12(MCInst &Inst,
254 unsigned Insn,
255 uint64_t Address,
256 const void *Decoder);
257
258static DecodeStatus DecodeMemMMImm16(MCInst &Inst,
259 unsigned Insn,
260 uint64_t Address,
261 const void *Decoder);
262
Akira Hatanaka71928e62012-04-17 18:03:21 +0000263static DecodeStatus DecodeFMem(MCInst &Inst, unsigned Insn,
264 uint64_t Address,
265 const void *Decoder);
266
Daniel Sanders92db6b72014-10-01 08:26:55 +0000267static DecodeStatus DecodeFMem2(MCInst &Inst, unsigned Insn,
268 uint64_t Address,
269 const void *Decoder);
270
271static DecodeStatus DecodeFMem3(MCInst &Inst, unsigned Insn,
272 uint64_t Address,
273 const void *Decoder);
274
Daniel Sanders6a803f62014-06-16 13:13:03 +0000275static DecodeStatus DecodeSpecial3LlSc(MCInst &Inst,
276 unsigned Insn,
277 uint64_t Address,
278 const void *Decoder);
279
Akira Hatanaka71928e62012-04-17 18:03:21 +0000280static DecodeStatus DecodeSimm16(MCInst &Inst,
281 unsigned Insn,
282 uint64_t Address,
283 const void *Decoder);
284
Matheus Almeida779c5932013-11-18 12:32:49 +0000285// Decode the immediate field of an LSA instruction which
286// is off by one.
287static DecodeStatus DecodeLSAImm(MCInst &Inst,
288 unsigned Insn,
289 uint64_t Address,
290 const void *Decoder);
291
Akira Hatanaka71928e62012-04-17 18:03:21 +0000292static DecodeStatus DecodeInsSize(MCInst &Inst,
293 unsigned Insn,
294 uint64_t Address,
295 const void *Decoder);
296
297static DecodeStatus DecodeExtSize(MCInst &Inst,
298 unsigned Insn,
299 uint64_t Address,
300 const void *Decoder);
301
Daniel Sandersb59e1a42014-05-15 10:45:58 +0000302static DecodeStatus DecodeSimm19Lsl2(MCInst &Inst, unsigned Insn,
303 uint64_t Address, const void *Decoder);
304
Zoran Jovanovic28551422014-06-09 09:49:51 +0000305static DecodeStatus DecodeSimm18Lsl3(MCInst &Inst, unsigned Insn,
306 uint64_t Address, const void *Decoder);
307
Daniel Sandersb50ccf82014-04-01 10:35:28 +0000308/// INSVE_[BHWD] have an implicit operand that the generated decoder doesn't
309/// handle.
310template <typename InsnType>
311static DecodeStatus DecodeINSVE_DF(MCInst &MI, InsnType insn, uint64_t Address,
312 const void *Decoder);
Daniel Sanders5c582b22014-05-22 11:23:21 +0000313
314template <typename InsnType>
315static DecodeStatus
316DecodeAddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
317 const void *Decoder);
318
319template <typename InsnType>
320static DecodeStatus
321DecodeDaddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
322 const void *Decoder);
323
324template <typename InsnType>
325static DecodeStatus
326DecodeBlezlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
327 const void *Decoder);
328
329template <typename InsnType>
330static DecodeStatus
331DecodeBgtzlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
332 const void *Decoder);
333
334template <typename InsnType>
335static DecodeStatus
336DecodeBgtzGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
337 const void *Decoder);
338
Zoran Jovanovic28a0ca02014-06-12 11:47:44 +0000339template <typename InsnType>
340static DecodeStatus
341DecodeBlezGroupBranch(MCInst &MI, InsnType insn, uint64_t Address,
342 const void *Decoder);
343
Akira Hatanaka71928e62012-04-17 18:03:21 +0000344namespace llvm {
345extern Target TheMipselTarget, TheMipsTarget, TheMips64Target,
346 TheMips64elTarget;
347}
348
349static MCDisassembler *createMipsDisassembler(
350 const Target &T,
Lang Hamesa1bc0f52014-04-15 04:40:56 +0000351 const MCSubtargetInfo &STI,
352 MCContext &Ctx) {
353 return new MipsDisassembler(STI, Ctx, true);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000354}
355
356static MCDisassembler *createMipselDisassembler(
357 const Target &T,
Lang Hamesa1bc0f52014-04-15 04:40:56 +0000358 const MCSubtargetInfo &STI,
359 MCContext &Ctx) {
360 return new MipsDisassembler(STI, Ctx, false);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000361}
362
363static MCDisassembler *createMips64Disassembler(
364 const Target &T,
Lang Hamesa1bc0f52014-04-15 04:40:56 +0000365 const MCSubtargetInfo &STI,
366 MCContext &Ctx) {
367 return new Mips64Disassembler(STI, Ctx, true);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000368}
369
370static MCDisassembler *createMips64elDisassembler(
371 const Target &T,
Lang Hamesa1bc0f52014-04-15 04:40:56 +0000372 const MCSubtargetInfo &STI,
373 MCContext &Ctx) {
374 return new Mips64Disassembler(STI, Ctx, false);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000375}
376
377extern "C" void LLVMInitializeMipsDisassembler() {
378 // Register the disassembler.
379 TargetRegistry::RegisterMCDisassembler(TheMipsTarget,
380 createMipsDisassembler);
381 TargetRegistry::RegisterMCDisassembler(TheMipselTarget,
382 createMipselDisassembler);
383 TargetRegistry::RegisterMCDisassembler(TheMips64Target,
384 createMips64Disassembler);
385 TargetRegistry::RegisterMCDisassembler(TheMips64elTarget,
386 createMips64elDisassembler);
387}
388
Akira Hatanaka71928e62012-04-17 18:03:21 +0000389#include "MipsGenDisassemblerTables.inc"
390
Daniel Sanders5c582b22014-05-22 11:23:21 +0000391static unsigned getReg(const void *D, unsigned RC, unsigned RegNo) {
392 const MipsDisassemblerBase *Dis = static_cast<const MipsDisassemblerBase*>(D);
393 const MCRegisterInfo *RegInfo = Dis->getContext().getRegisterInfo();
394 return *(RegInfo->getRegClass(RC).begin() + RegNo);
395}
396
Daniel Sandersb50ccf82014-04-01 10:35:28 +0000397template <typename InsnType>
398static DecodeStatus DecodeINSVE_DF(MCInst &MI, InsnType insn, uint64_t Address,
399 const void *Decoder) {
400 typedef DecodeStatus (*DecodeFN)(MCInst &, unsigned, uint64_t, const void *);
401 // The size of the n field depends on the element size
402 // The register class also depends on this.
403 InsnType tmp = fieldFromInstruction(insn, 17, 5);
404 unsigned NSize = 0;
405 DecodeFN RegDecoder = nullptr;
406 if ((tmp & 0x18) == 0x00) { // INSVE_B
407 NSize = 4;
408 RegDecoder = DecodeMSA128BRegisterClass;
409 } else if ((tmp & 0x1c) == 0x10) { // INSVE_H
410 NSize = 3;
411 RegDecoder = DecodeMSA128HRegisterClass;
412 } else if ((tmp & 0x1e) == 0x18) { // INSVE_W
413 NSize = 2;
414 RegDecoder = DecodeMSA128WRegisterClass;
415 } else if ((tmp & 0x1f) == 0x1c) { // INSVE_D
416 NSize = 1;
417 RegDecoder = DecodeMSA128DRegisterClass;
418 } else
419 llvm_unreachable("Invalid encoding");
420
421 assert(NSize != 0 && RegDecoder != nullptr);
422
423 // $wd
424 tmp = fieldFromInstruction(insn, 6, 5);
425 if (RegDecoder(MI, tmp, Address, Decoder) == MCDisassembler::Fail)
426 return MCDisassembler::Fail;
427 // $wd_in
428 if (RegDecoder(MI, tmp, Address, Decoder) == MCDisassembler::Fail)
429 return MCDisassembler::Fail;
430 // $n
431 tmp = fieldFromInstruction(insn, 16, NSize);
432 MI.addOperand(MCOperand::CreateImm(tmp));
433 // $ws
434 tmp = fieldFromInstruction(insn, 11, 5);
435 if (RegDecoder(MI, tmp, Address, Decoder) == MCDisassembler::Fail)
436 return MCDisassembler::Fail;
437 // $n2
438 MI.addOperand(MCOperand::CreateImm(0));
439
440 return MCDisassembler::Success;
441}
442
Daniel Sanders5c582b22014-05-22 11:23:21 +0000443template <typename InsnType>
444static DecodeStatus DecodeAddiGroupBranch(MCInst &MI, InsnType insn,
445 uint64_t Address,
446 const void *Decoder) {
447 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
448 // (otherwise we would have matched the ADDI instruction from the earlier
449 // ISA's instead).
450 //
451 // We have:
452 // 0b001000 sssss ttttt iiiiiiiiiiiiiiii
453 // BOVC if rs >= rt
454 // BEQZALC if rs == 0 && rt != 0
455 // BEQC if rs < rt && rs != 0
456
457 InsnType Rs = fieldFromInstruction(insn, 21, 5);
458 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000459 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Daniel Sanders5c582b22014-05-22 11:23:21 +0000460 bool HasRs = false;
461
462 if (Rs >= Rt) {
463 MI.setOpcode(Mips::BOVC);
464 HasRs = true;
465 } else if (Rs != 0 && Rs < Rt) {
466 MI.setOpcode(Mips::BEQC);
467 HasRs = true;
468 } else
469 MI.setOpcode(Mips::BEQZALC);
470
471 if (HasRs)
472 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
473 Rs)));
474
475 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
476 Rt)));
477 MI.addOperand(MCOperand::CreateImm(Imm));
478
479 return MCDisassembler::Success;
480}
481
482template <typename InsnType>
483static DecodeStatus DecodeDaddiGroupBranch(MCInst &MI, InsnType insn,
484 uint64_t Address,
485 const void *Decoder) {
486 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
487 // (otherwise we would have matched the ADDI instruction from the earlier
488 // ISA's instead).
489 //
490 // We have:
491 // 0b011000 sssss ttttt iiiiiiiiiiiiiiii
492 // BNVC if rs >= rt
493 // BNEZALC if rs == 0 && rt != 0
494 // BNEC if rs < rt && rs != 0
495
496 InsnType Rs = fieldFromInstruction(insn, 21, 5);
497 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000498 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Daniel Sanders5c582b22014-05-22 11:23:21 +0000499 bool HasRs = false;
500
501 if (Rs >= Rt) {
502 MI.setOpcode(Mips::BNVC);
503 HasRs = true;
504 } else if (Rs != 0 && Rs < Rt) {
505 MI.setOpcode(Mips::BNEC);
506 HasRs = true;
507 } else
508 MI.setOpcode(Mips::BNEZALC);
509
510 if (HasRs)
511 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
512 Rs)));
513
514 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
515 Rt)));
516 MI.addOperand(MCOperand::CreateImm(Imm));
517
518 return MCDisassembler::Success;
519}
520
521template <typename InsnType>
522static DecodeStatus DecodeBlezlGroupBranch(MCInst &MI, InsnType insn,
523 uint64_t Address,
524 const void *Decoder) {
525 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
526 // (otherwise we would have matched the BLEZL instruction from the earlier
527 // ISA's instead).
528 //
529 // We have:
530 // 0b010110 sssss ttttt iiiiiiiiiiiiiiii
531 // Invalid if rs == 0
532 // BLEZC if rs == 0 && rt != 0
533 // BGEZC if rs == rt && rt != 0
534 // BGEC if rs != rt && rs != 0 && rt != 0
535
536 InsnType Rs = fieldFromInstruction(insn, 21, 5);
537 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000538 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Zoran Jovanovic28a0ca02014-06-12 11:47:44 +0000539 bool HasRs = false;
Daniel Sanders5c582b22014-05-22 11:23:21 +0000540
541 if (Rt == 0)
542 return MCDisassembler::Fail;
543 else if (Rs == 0)
544 MI.setOpcode(Mips::BLEZC);
545 else if (Rs == Rt)
546 MI.setOpcode(Mips::BGEZC);
Zoran Jovanovic28a0ca02014-06-12 11:47:44 +0000547 else {
548 HasRs = true;
549 MI.setOpcode(Mips::BGEC);
550 }
551
552 if (HasRs)
553 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
554 Rs)));
Daniel Sanders5c582b22014-05-22 11:23:21 +0000555
556 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
557 Rt)));
558
559 MI.addOperand(MCOperand::CreateImm(Imm));
560
561 return MCDisassembler::Success;
562}
563
564template <typename InsnType>
565static DecodeStatus DecodeBgtzlGroupBranch(MCInst &MI, InsnType insn,
566 uint64_t Address,
567 const void *Decoder) {
568 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
569 // (otherwise we would have matched the BGTZL instruction from the earlier
570 // ISA's instead).
571 //
572 // We have:
573 // 0b010111 sssss ttttt iiiiiiiiiiiiiiii
574 // Invalid if rs == 0
575 // BGTZC if rs == 0 && rt != 0
576 // BLTZC if rs == rt && rt != 0
577 // BLTC if rs != rt && rs != 0 && rt != 0
578
Zoran Jovanovic5c14b062014-06-18 14:36:00 +0000579 bool HasRs = false;
580
Daniel Sanders5c582b22014-05-22 11:23:21 +0000581 InsnType Rs = fieldFromInstruction(insn, 21, 5);
582 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000583 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Daniel Sanders5c582b22014-05-22 11:23:21 +0000584
585 if (Rt == 0)
586 return MCDisassembler::Fail;
587 else if (Rs == 0)
588 MI.setOpcode(Mips::BGTZC);
589 else if (Rs == Rt)
590 MI.setOpcode(Mips::BLTZC);
Zoran Jovanovic5c14b062014-06-18 14:36:00 +0000591 else {
592 MI.setOpcode(Mips::BLTC);
593 HasRs = true;
594 }
595
596 if (HasRs)
597 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
598 Rs)));
Daniel Sanders5c582b22014-05-22 11:23:21 +0000599
600 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
601 Rt)));
602
603 MI.addOperand(MCOperand::CreateImm(Imm));
604
605 return MCDisassembler::Success;
606}
607
608template <typename InsnType>
609static DecodeStatus DecodeBgtzGroupBranch(MCInst &MI, InsnType insn,
610 uint64_t Address,
611 const void *Decoder) {
612 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
613 // (otherwise we would have matched the BGTZ instruction from the earlier
614 // ISA's instead).
615 //
616 // We have:
617 // 0b000111 sssss ttttt iiiiiiiiiiiiiiii
618 // BGTZ if rt == 0
619 // BGTZALC if rs == 0 && rt != 0
620 // BLTZALC if rs != 0 && rs == rt
621 // BLTUC if rs != 0 && rs != rt
622
623 InsnType Rs = fieldFromInstruction(insn, 21, 5);
624 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000625 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Daniel Sanders5c582b22014-05-22 11:23:21 +0000626 bool HasRs = false;
627 bool HasRt = false;
628
629 if (Rt == 0) {
630 MI.setOpcode(Mips::BGTZ);
631 HasRs = true;
632 } else if (Rs == 0) {
633 MI.setOpcode(Mips::BGTZALC);
634 HasRt = true;
635 } else if (Rs == Rt) {
636 MI.setOpcode(Mips::BLTZALC);
637 HasRs = true;
Zoran Jovanovic5c14b062014-06-18 14:36:00 +0000638 } else {
639 MI.setOpcode(Mips::BLTUC);
640 HasRs = true;
641 HasRt = true;
642 }
Daniel Sanders5c582b22014-05-22 11:23:21 +0000643
644 if (HasRs)
645 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
646 Rs)));
647
648 if (HasRt)
649 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
650 Rt)));
651
652 MI.addOperand(MCOperand::CreateImm(Imm));
653
654 return MCDisassembler::Success;
655}
656
Zoran Jovanovic28a0ca02014-06-12 11:47:44 +0000657template <typename InsnType>
658static DecodeStatus DecodeBlezGroupBranch(MCInst &MI, InsnType insn,
659 uint64_t Address,
660 const void *Decoder) {
661 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
662 // (otherwise we would have matched the BLEZL instruction from the earlier
663 // ISA's instead).
664 //
665 // We have:
666 // 0b000110 sssss ttttt iiiiiiiiiiiiiiii
667 // Invalid if rs == 0
668 // BLEZALC if rs == 0 && rt != 0
669 // BGEZALC if rs == rt && rt != 0
670 // BGEUC if rs != rt && rs != 0 && rt != 0
671
672 InsnType Rs = fieldFromInstruction(insn, 21, 5);
673 InsnType Rt = fieldFromInstruction(insn, 16, 5);
Alexey Samsonovd37bab62014-09-02 17:49:16 +0000674 InsnType Imm = SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4;
Zoran Jovanovic28a0ca02014-06-12 11:47:44 +0000675 bool HasRs = false;
676
677 if (Rt == 0)
678 return MCDisassembler::Fail;
679 else if (Rs == 0)
680 MI.setOpcode(Mips::BLEZALC);
681 else if (Rs == Rt)
682 MI.setOpcode(Mips::BGEZALC);
683 else {
684 HasRs = true;
685 MI.setOpcode(Mips::BGEUC);
686 }
687
688 if (HasRs)
689 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
690 Rs)));
691 MI.addOperand(MCOperand::CreateReg(getReg(Decoder, Mips::GPR32RegClassID,
692 Rt)));
693
694 MI.addOperand(MCOperand::CreateImm(Imm));
695
696 return MCDisassembler::Success;
697}
698
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000699/// Read four bytes from the ArrayRef and return 32 bit word sorted
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000700/// according to the given endianess
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000701static DecodeStatus readInstruction32(ArrayRef<uint8_t> Bytes, uint64_t Address,
702 uint64_t &Size, uint32_t &Insn,
703 bool IsBigEndian, bool IsMicroMips) {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000704 // We want to read exactly 4 Bytes of data.
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000705 if (Bytes.size() < 4) {
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000706 Size = 0;
Akira Hatanaka71928e62012-04-17 18:03:21 +0000707 return MCDisassembler::Fail;
708 }
709
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000710 if (IsBigEndian) {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000711 // Encoded as a big-endian 32-bit word in the stream.
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000712 Insn =
713 (Bytes[3] << 0) | (Bytes[2] << 8) | (Bytes[1] << 16) | (Bytes[0] << 24);
714 } else {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000715 // Encoded as a small-endian 32-bit word in the stream.
Vladimir Medicdde3d582013-09-06 12:30:36 +0000716 // Little-endian byte ordering:
717 // mips32r2: 4 | 3 | 2 | 1
718 // microMIPS: 2 | 1 | 4 | 3
719 if (IsMicroMips) {
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000720 Insn = (Bytes[2] << 0) | (Bytes[3] << 8) | (Bytes[0] << 16) |
Vladimir Medicdde3d582013-09-06 12:30:36 +0000721 (Bytes[1] << 24);
722 } else {
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000723 Insn = (Bytes[0] << 0) | (Bytes[1] << 8) | (Bytes[2] << 16) |
Vladimir Medicdde3d582013-09-06 12:30:36 +0000724 (Bytes[3] << 24);
725 }
Akira Hatanaka71928e62012-04-17 18:03:21 +0000726 }
727
728 return MCDisassembler::Success;
729}
730
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000731DecodeStatus MipsDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000732 ArrayRef<uint8_t> Bytes,
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000733 uint64_t Address,
734 raw_ostream &VStream,
735 raw_ostream &CStream) const {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000736 uint32_t Insn;
737
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000738 DecodeStatus Result =
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000739 readInstruction32(Bytes, Address, Size, Insn, IsBigEndian, IsMicroMips);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000740 if (Result == MCDisassembler::Fail)
741 return MCDisassembler::Fail;
742
Vladimir Medicdde3d582013-09-06 12:30:36 +0000743 if (IsMicroMips) {
Daniel Sanders0fa60412014-06-12 13:39:06 +0000744 DEBUG(dbgs() << "Trying MicroMips32 table (32-bit opcodes):\n");
Vladimir Medicdde3d582013-09-06 12:30:36 +0000745 // Calling the auto-generated decoder function.
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000746 Result = decodeInstruction(DecoderTableMicroMips32, Instr, Insn, Address,
Vladimir Medicdde3d582013-09-06 12:30:36 +0000747 this, STI);
748 if (Result != MCDisassembler::Fail) {
749 Size = 4;
750 return Result;
751 }
752 return MCDisassembler::Fail;
753 }
754
Daniel Sandersc171f652014-06-13 13:15:59 +0000755 if (hasCOP3()) {
756 DEBUG(dbgs() << "Trying COP3_ table (32-bit opcodes):\n");
757 Result =
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000758 decodeInstruction(DecoderTableCOP3_32, Instr, Insn, Address, this, STI);
Daniel Sandersc171f652014-06-13 13:15:59 +0000759 if (Result != MCDisassembler::Fail) {
760 Size = 4;
761 return Result;
762 }
763 }
764
765 if (hasMips32r6() && isGP64()) {
Daniel Sanders0fa60412014-06-12 13:39:06 +0000766 DEBUG(dbgs() << "Trying Mips32r6_64r6 (GPR64) table (32-bit opcodes):\n");
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000767 Result = decodeInstruction(DecoderTableMips32r6_64r6_GP6432, Instr, Insn,
Daniel Sanders0fa60412014-06-12 13:39:06 +0000768 Address, this, STI);
769 if (Result != MCDisassembler::Fail) {
770 Size = 4;
771 return Result;
772 }
773 }
774
Daniel Sandersc171f652014-06-13 13:15:59 +0000775 if (hasMips32r6()) {
Daniel Sanders0fa60412014-06-12 13:39:06 +0000776 DEBUG(dbgs() << "Trying Mips32r6_64r6 table (32-bit opcodes):\n");
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000777 Result = decodeInstruction(DecoderTableMips32r6_64r632, Instr, Insn,
Daniel Sanders5c582b22014-05-22 11:23:21 +0000778 Address, this, STI);
779 if (Result != MCDisassembler::Fail) {
780 Size = 4;
781 return Result;
782 }
783 }
784
Daniel Sanders0fa60412014-06-12 13:39:06 +0000785 DEBUG(dbgs() << "Trying Mips table (32-bit opcodes):\n");
Akira Hatanaka71928e62012-04-17 18:03:21 +0000786 // Calling the auto-generated decoder function.
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000787 Result =
788 decodeInstruction(DecoderTableMips32, Instr, Insn, Address, this, STI);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000789 if (Result != MCDisassembler::Fail) {
790 Size = 4;
791 return Result;
792 }
793
794 return MCDisassembler::Fail;
795}
796
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000797DecodeStatus Mips64Disassembler::getInstruction(MCInst &Instr, uint64_t &Size,
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000798 ArrayRef<uint8_t> Bytes,
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000799 uint64_t Address,
800 raw_ostream &VStream,
801 raw_ostream &CStream) const {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000802 uint32_t Insn;
803
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000804 DecodeStatus Result =
Rafael Espindola7fc5b872014-11-12 02:04:27 +0000805 readInstruction32(Bytes, Address, Size, Insn, IsBigEndian, false);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000806 if (Result == MCDisassembler::Fail)
807 return MCDisassembler::Fail;
808
809 // Calling the auto-generated decoder function.
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000810 Result =
811 decodeInstruction(DecoderTableMips6432, Instr, Insn, Address, this, STI);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000812 if (Result != MCDisassembler::Fail) {
813 Size = 4;
814 return Result;
815 }
816 // If we fail to decode in Mips64 decoder space we can try in Mips32
Rafael Espindola4aa6bea2014-11-10 18:11:10 +0000817 Result =
818 decodeInstruction(DecoderTableMips32, Instr, Insn, Address, this, STI);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000819 if (Result != MCDisassembler::Fail) {
820 Size = 4;
821 return Result;
822 }
823
824 return MCDisassembler::Fail;
825}
826
Reed Kotlerec8a5492013-02-14 03:05:25 +0000827static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst,
828 unsigned RegNo,
829 uint64_t Address,
830 const void *Decoder) {
831
832 return MCDisassembler::Fail;
833
834}
835
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000836static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst,
837 unsigned RegNo,
838 uint64_t Address,
839 const void *Decoder) {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000840
841 if (RegNo > 31)
842 return MCDisassembler::Fail;
843
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000844 unsigned Reg = getReg(Decoder, Mips::GPR64RegClassID, RegNo);
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000845 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000846 return MCDisassembler::Success;
847}
848
Zoran Jovanovicb0852e52014-10-21 08:23:11 +0000849static DecodeStatus DecodeGPRMM16RegisterClass(MCInst &Inst,
850 unsigned RegNo,
851 uint64_t Address,
852 const void *Decoder) {
853 return MCDisassembler::Fail;
854}
855
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000856static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst,
857 unsigned RegNo,
858 uint64_t Address,
859 const void *Decoder) {
Akira Hatanaka71928e62012-04-17 18:03:21 +0000860 if (RegNo > 31)
861 return MCDisassembler::Fail;
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000862 unsigned Reg = getReg(Decoder, Mips::GPR32RegClassID, RegNo);
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000863 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000864 return MCDisassembler::Success;
865}
866
Akira Hatanaka9bfa2e22013-08-28 00:55:15 +0000867static DecodeStatus DecodePtrRegisterClass(MCInst &Inst,
868 unsigned RegNo,
869 uint64_t Address,
870 const void *Decoder) {
871 if (static_cast<const MipsDisassembler *>(Decoder)->isN64())
872 return DecodeGPR64RegisterClass(Inst, RegNo, Address, Decoder);
873
874 return DecodeGPR32RegisterClass(Inst, RegNo, Address, Decoder);
875}
876
Akira Hatanaka654655f2013-08-14 00:53:38 +0000877static DecodeStatus DecodeDSPRRegisterClass(MCInst &Inst,
878 unsigned RegNo,
879 uint64_t Address,
880 const void *Decoder) {
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000881 return DecodeGPR32RegisterClass(Inst, RegNo, Address, Decoder);
Akira Hatanakaecabd1a2012-09-27 02:01:10 +0000882}
883
Akira Hatanaka71928e62012-04-17 18:03:21 +0000884static DecodeStatus DecodeFGR64RegisterClass(MCInst &Inst,
885 unsigned RegNo,
886 uint64_t Address,
887 const void *Decoder) {
888 if (RegNo > 31)
889 return MCDisassembler::Fail;
890
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000891 unsigned Reg = getReg(Decoder, Mips::FGR64RegClassID, RegNo);
892 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000893 return MCDisassembler::Success;
894}
895
896static DecodeStatus DecodeFGR32RegisterClass(MCInst &Inst,
897 unsigned RegNo,
898 uint64_t Address,
899 const void *Decoder) {
900 if (RegNo > 31)
901 return MCDisassembler::Fail;
902
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000903 unsigned Reg = getReg(Decoder, Mips::FGR32RegClassID, RegNo);
904 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000905 return MCDisassembler::Success;
906}
907
908static DecodeStatus DecodeCCRRegisterClass(MCInst &Inst,
909 unsigned RegNo,
910 uint64_t Address,
911 const void *Decoder) {
Chad Rosier253777f2013-06-26 22:23:32 +0000912 if (RegNo > 31)
913 return MCDisassembler::Fail;
914 unsigned Reg = getReg(Decoder, Mips::CCRRegClassID, RegNo);
915 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000916 return MCDisassembler::Success;
917}
918
Akira Hatanaka1fb1b8b2013-07-26 20:13:47 +0000919static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst,
920 unsigned RegNo,
921 uint64_t Address,
922 const void *Decoder) {
923 if (RegNo > 7)
924 return MCDisassembler::Fail;
925 unsigned Reg = getReg(Decoder, Mips::FCCRegClassID, RegNo);
926 Inst.addOperand(MCOperand::CreateReg(Reg));
927 return MCDisassembler::Success;
928}
929
Daniel Sanders0fa60412014-06-12 13:39:06 +0000930static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo,
931 uint64_t Address,
932 const void *Decoder) {
933 if (RegNo > 31)
934 return MCDisassembler::Fail;
935
936 unsigned Reg = getReg(Decoder, Mips::FGRCCRegClassID, RegNo);
937 Inst.addOperand(MCOperand::CreateReg(Reg));
938 return MCDisassembler::Success;
939}
940
Akira Hatanaka71928e62012-04-17 18:03:21 +0000941static DecodeStatus DecodeMem(MCInst &Inst,
942 unsigned Insn,
943 uint64_t Address,
944 const void *Decoder) {
945 int Offset = SignExtend32<16>(Insn & 0xffff);
Jim Grosbachecaef492012-08-14 19:06:05 +0000946 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
947 unsigned Base = fieldFromInstruction(Insn, 21, 5);
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000948
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +0000949 Reg = getReg(Decoder, Mips::GPR32RegClassID, Reg);
950 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
Akira Hatanaka71928e62012-04-17 18:03:21 +0000951
952 if(Inst.getOpcode() == Mips::SC){
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000953 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000954 }
955
Akira Hatanaka9bf2b562012-07-09 18:46:47 +0000956 Inst.addOperand(MCOperand::CreateReg(Reg));
957 Inst.addOperand(MCOperand::CreateReg(Base));
Akira Hatanaka71928e62012-04-17 18:03:21 +0000958 Inst.addOperand(MCOperand::CreateImm(Offset));
959
960 return MCDisassembler::Success;
961}
962
Daniel Sanders92db6b72014-10-01 08:26:55 +0000963static DecodeStatus DecodeCacheOp(MCInst &Inst,
964 unsigned Insn,
965 uint64_t Address,
966 const void *Decoder) {
967 int Offset = SignExtend32<16>(Insn & 0xffff);
968 unsigned Hint = fieldFromInstruction(Insn, 16, 5);
969 unsigned Base = fieldFromInstruction(Insn, 21, 5);
970
971 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
972
973 Inst.addOperand(MCOperand::CreateReg(Base));
974 Inst.addOperand(MCOperand::CreateImm(Offset));
975 Inst.addOperand(MCOperand::CreateImm(Hint));
976
977 return MCDisassembler::Success;
978}
979
Matheus Almeidafe0bf9f2013-10-21 13:07:13 +0000980static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn,
981 uint64_t Address, const void *Decoder) {
982 int Offset = SignExtend32<10>(fieldFromInstruction(Insn, 16, 10));
983 unsigned Reg = fieldFromInstruction(Insn, 6, 5);
984 unsigned Base = fieldFromInstruction(Insn, 11, 5);
985
986 Reg = getReg(Decoder, Mips::MSA128BRegClassID, Reg);
987 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
988
989 Inst.addOperand(MCOperand::CreateReg(Reg));
990 Inst.addOperand(MCOperand::CreateReg(Base));
Matheus Almeida6b59c442013-12-05 11:06:22 +0000991
992 // The immediate field of an LD/ST instruction is scaled which means it must
993 // be multiplied (when decoding) by the size (in bytes) of the instructions'
994 // data format.
995 // .b - 1 byte
996 // .h - 2 bytes
997 // .w - 4 bytes
998 // .d - 8 bytes
999 switch(Inst.getOpcode())
1000 {
1001 default:
1002 assert (0 && "Unexpected instruction");
1003 return MCDisassembler::Fail;
1004 break;
1005 case Mips::LD_B:
1006 case Mips::ST_B:
1007 Inst.addOperand(MCOperand::CreateImm(Offset));
1008 break;
1009 case Mips::LD_H:
1010 case Mips::ST_H:
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001011 Inst.addOperand(MCOperand::CreateImm(Offset * 2));
Matheus Almeida6b59c442013-12-05 11:06:22 +00001012 break;
1013 case Mips::LD_W:
1014 case Mips::ST_W:
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001015 Inst.addOperand(MCOperand::CreateImm(Offset * 4));
Matheus Almeida6b59c442013-12-05 11:06:22 +00001016 break;
1017 case Mips::LD_D:
1018 case Mips::ST_D:
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001019 Inst.addOperand(MCOperand::CreateImm(Offset * 8));
Matheus Almeida6b59c442013-12-05 11:06:22 +00001020 break;
1021 }
Matheus Almeidafe0bf9f2013-10-21 13:07:13 +00001022
1023 return MCDisassembler::Success;
1024}
1025
Vladimir Medicdde3d582013-09-06 12:30:36 +00001026static DecodeStatus DecodeMemMMImm12(MCInst &Inst,
1027 unsigned Insn,
1028 uint64_t Address,
1029 const void *Decoder) {
1030 int Offset = SignExtend32<12>(Insn & 0x0fff);
1031 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1032 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1033
1034 Reg = getReg(Decoder, Mips::GPR32RegClassID, Reg);
1035 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
1036
Zoran Jovanovic285cc282014-02-28 18:22:56 +00001037 if (Inst.getOpcode() == Mips::SC_MM)
1038 Inst.addOperand(MCOperand::CreateReg(Reg));
1039
Vladimir Medicdde3d582013-09-06 12:30:36 +00001040 Inst.addOperand(MCOperand::CreateReg(Reg));
1041 Inst.addOperand(MCOperand::CreateReg(Base));
1042 Inst.addOperand(MCOperand::CreateImm(Offset));
1043
1044 return MCDisassembler::Success;
1045}
1046
1047static DecodeStatus DecodeMemMMImm16(MCInst &Inst,
1048 unsigned Insn,
1049 uint64_t Address,
1050 const void *Decoder) {
1051 int Offset = SignExtend32<16>(Insn & 0xffff);
1052 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1053 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1054
1055 Reg = getReg(Decoder, Mips::GPR32RegClassID, Reg);
1056 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
1057
1058 Inst.addOperand(MCOperand::CreateReg(Reg));
1059 Inst.addOperand(MCOperand::CreateReg(Base));
1060 Inst.addOperand(MCOperand::CreateImm(Offset));
1061
1062 return MCDisassembler::Success;
1063}
1064
Akira Hatanaka71928e62012-04-17 18:03:21 +00001065static DecodeStatus DecodeFMem(MCInst &Inst,
1066 unsigned Insn,
1067 uint64_t Address,
1068 const void *Decoder) {
1069 int Offset = SignExtend32<16>(Insn & 0xffff);
Jim Grosbachecaef492012-08-14 19:06:05 +00001070 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1071 unsigned Base = fieldFromInstruction(Insn, 21, 5);
Akira Hatanaka71928e62012-04-17 18:03:21 +00001072
Akira Hatanaka9bf2b562012-07-09 18:46:47 +00001073 Reg = getReg(Decoder, Mips::FGR64RegClassID, Reg);
Akira Hatanaka13e6ccf2013-08-06 23:08:38 +00001074 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
Akira Hatanaka9bf2b562012-07-09 18:46:47 +00001075
1076 Inst.addOperand(MCOperand::CreateReg(Reg));
1077 Inst.addOperand(MCOperand::CreateReg(Base));
Akira Hatanaka71928e62012-04-17 18:03:21 +00001078 Inst.addOperand(MCOperand::CreateImm(Offset));
1079
1080 return MCDisassembler::Success;
1081}
1082
Daniel Sanders92db6b72014-10-01 08:26:55 +00001083static DecodeStatus DecodeFMem2(MCInst &Inst,
1084 unsigned Insn,
1085 uint64_t Address,
1086 const void *Decoder) {
1087 int Offset = SignExtend32<16>(Insn & 0xffff);
1088 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1089 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1090
1091 Reg = getReg(Decoder, Mips::COP2RegClassID, Reg);
1092 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
1093
1094 Inst.addOperand(MCOperand::CreateReg(Reg));
1095 Inst.addOperand(MCOperand::CreateReg(Base));
1096 Inst.addOperand(MCOperand::CreateImm(Offset));
1097
1098 return MCDisassembler::Success;
1099}
1100
1101static DecodeStatus DecodeFMem3(MCInst &Inst,
1102 unsigned Insn,
1103 uint64_t Address,
1104 const void *Decoder) {
1105 int Offset = SignExtend32<16>(Insn & 0xffff);
1106 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1107 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1108
1109 Reg = getReg(Decoder, Mips::COP3RegClassID, Reg);
1110 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
1111
1112 Inst.addOperand(MCOperand::CreateReg(Reg));
1113 Inst.addOperand(MCOperand::CreateReg(Base));
1114 Inst.addOperand(MCOperand::CreateImm(Offset));
1115
1116 return MCDisassembler::Success;
1117}
1118
Daniel Sanders6a803f62014-06-16 13:13:03 +00001119static DecodeStatus DecodeSpecial3LlSc(MCInst &Inst,
1120 unsigned Insn,
1121 uint64_t Address,
1122 const void *Decoder) {
1123 int64_t Offset = SignExtend64<9>((Insn >> 7) & 0x1ff);
1124 unsigned Rt = fieldFromInstruction(Insn, 16, 5);
1125 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1126
1127 Rt = getReg(Decoder, Mips::GPR32RegClassID, Rt);
1128 Base = getReg(Decoder, Mips::GPR32RegClassID, Base);
1129
1130 if(Inst.getOpcode() == Mips::SC_R6 || Inst.getOpcode() == Mips::SCD_R6){
1131 Inst.addOperand(MCOperand::CreateReg(Rt));
1132 }
1133
1134 Inst.addOperand(MCOperand::CreateReg(Rt));
1135 Inst.addOperand(MCOperand::CreateReg(Base));
1136 Inst.addOperand(MCOperand::CreateImm(Offset));
1137
1138 return MCDisassembler::Success;
1139}
Akira Hatanaka71928e62012-04-17 18:03:21 +00001140
1141static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst,
1142 unsigned RegNo,
1143 uint64_t Address,
1144 const void *Decoder) {
1145 // Currently only hardware register 29 is supported.
1146 if (RegNo != 29)
1147 return MCDisassembler::Fail;
1148 Inst.addOperand(MCOperand::CreateReg(Mips::HWR29));
1149 return MCDisassembler::Success;
1150}
1151
Akira Hatanaka71928e62012-04-17 18:03:21 +00001152static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst,
1153 unsigned RegNo,
1154 uint64_t Address,
1155 const void *Decoder) {
Akira Hatanaka9bf2b562012-07-09 18:46:47 +00001156 if (RegNo > 30 || RegNo %2)
Akira Hatanaka71928e62012-04-17 18:03:21 +00001157 return MCDisassembler::Fail;
1158
Akira Hatanaka9bf2b562012-07-09 18:46:47 +00001159 ;
1160 unsigned Reg = getReg(Decoder, Mips::AFGR64RegClassID, RegNo /2);
1161 Inst.addOperand(MCOperand::CreateReg(Reg));
Akira Hatanaka71928e62012-04-17 18:03:21 +00001162 return MCDisassembler::Success;
1163}
1164
Akira Hatanaka00fcf2e2013-08-08 21:54:26 +00001165static DecodeStatus DecodeACC64DSPRegisterClass(MCInst &Inst,
1166 unsigned RegNo,
1167 uint64_t Address,
1168 const void *Decoder) {
Akira Hatanakaecabd1a2012-09-27 02:01:10 +00001169 if (RegNo >= 4)
1170 return MCDisassembler::Fail;
1171
Akira Hatanaka00fcf2e2013-08-08 21:54:26 +00001172 unsigned Reg = getReg(Decoder, Mips::ACC64DSPRegClassID, RegNo);
Akira Hatanakaecabd1a2012-09-27 02:01:10 +00001173 Inst.addOperand(MCOperand::CreateReg(Reg));
1174 return MCDisassembler::Success;
1175}
1176
Akira Hatanaka8002a3f2013-08-14 00:47:08 +00001177static DecodeStatus DecodeHI32DSPRegisterClass(MCInst &Inst,
1178 unsigned RegNo,
1179 uint64_t Address,
1180 const void *Decoder) {
Akira Hatanaka59bfaf72013-04-18 00:52:44 +00001181 if (RegNo >= 4)
1182 return MCDisassembler::Fail;
1183
Akira Hatanaka8002a3f2013-08-14 00:47:08 +00001184 unsigned Reg = getReg(Decoder, Mips::HI32DSPRegClassID, RegNo);
Akira Hatanaka59bfaf72013-04-18 00:52:44 +00001185 Inst.addOperand(MCOperand::CreateReg(Reg));
1186 return MCDisassembler::Success;
1187}
1188
Akira Hatanaka8002a3f2013-08-14 00:47:08 +00001189static DecodeStatus DecodeLO32DSPRegisterClass(MCInst &Inst,
1190 unsigned RegNo,
1191 uint64_t Address,
1192 const void *Decoder) {
Akira Hatanaka59bfaf72013-04-18 00:52:44 +00001193 if (RegNo >= 4)
1194 return MCDisassembler::Fail;
1195
Akira Hatanaka8002a3f2013-08-14 00:47:08 +00001196 unsigned Reg = getReg(Decoder, Mips::LO32DSPRegClassID, RegNo);
Akira Hatanaka59bfaf72013-04-18 00:52:44 +00001197 Inst.addOperand(MCOperand::CreateReg(Reg));
1198 return MCDisassembler::Success;
1199}
1200
Jack Carter3eb663b2013-09-26 00:09:46 +00001201static DecodeStatus DecodeMSA128BRegisterClass(MCInst &Inst,
1202 unsigned RegNo,
1203 uint64_t Address,
1204 const void *Decoder) {
1205 if (RegNo > 31)
1206 return MCDisassembler::Fail;
1207
1208 unsigned Reg = getReg(Decoder, Mips::MSA128BRegClassID, RegNo);
1209 Inst.addOperand(MCOperand::CreateReg(Reg));
1210 return MCDisassembler::Success;
1211}
1212
Jack Carter5dc8ac92013-09-25 23:50:44 +00001213static DecodeStatus DecodeMSA128HRegisterClass(MCInst &Inst,
1214 unsigned RegNo,
1215 uint64_t Address,
1216 const void *Decoder) {
1217 if (RegNo > 31)
1218 return MCDisassembler::Fail;
1219
1220 unsigned Reg = getReg(Decoder, Mips::MSA128HRegClassID, RegNo);
1221 Inst.addOperand(MCOperand::CreateReg(Reg));
1222 return MCDisassembler::Success;
1223}
1224
1225static DecodeStatus DecodeMSA128WRegisterClass(MCInst &Inst,
1226 unsigned RegNo,
1227 uint64_t Address,
1228 const void *Decoder) {
1229 if (RegNo > 31)
1230 return MCDisassembler::Fail;
1231
1232 unsigned Reg = getReg(Decoder, Mips::MSA128WRegClassID, RegNo);
1233 Inst.addOperand(MCOperand::CreateReg(Reg));
1234 return MCDisassembler::Success;
1235}
1236
1237static DecodeStatus DecodeMSA128DRegisterClass(MCInst &Inst,
1238 unsigned RegNo,
1239 uint64_t Address,
1240 const void *Decoder) {
1241 if (RegNo > 31)
1242 return MCDisassembler::Fail;
1243
1244 unsigned Reg = getReg(Decoder, Mips::MSA128DRegClassID, RegNo);
1245 Inst.addOperand(MCOperand::CreateReg(Reg));
1246 return MCDisassembler::Success;
1247}
1248
Matheus Almeidaa591fdc2013-10-21 12:26:50 +00001249static DecodeStatus DecodeMSACtrlRegisterClass(MCInst &Inst,
1250 unsigned RegNo,
1251 uint64_t Address,
1252 const void *Decoder) {
1253 if (RegNo > 7)
1254 return MCDisassembler::Fail;
1255
1256 unsigned Reg = getReg(Decoder, Mips::MSACtrlRegClassID, RegNo);
1257 Inst.addOperand(MCOperand::CreateReg(Reg));
1258 return MCDisassembler::Success;
1259}
1260
Daniel Sanders2a83d682014-05-21 12:56:39 +00001261static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst,
1262 unsigned RegNo,
1263 uint64_t Address,
1264 const void *Decoder) {
1265 if (RegNo > 31)
1266 return MCDisassembler::Fail;
1267
1268 unsigned Reg = getReg(Decoder, Mips::COP2RegClassID, RegNo);
1269 Inst.addOperand(MCOperand::CreateReg(Reg));
1270 return MCDisassembler::Success;
1271}
1272
Akira Hatanaka71928e62012-04-17 18:03:21 +00001273static DecodeStatus DecodeBranchTarget(MCInst &Inst,
1274 unsigned Offset,
1275 uint64_t Address,
1276 const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001277 int32_t BranchOffset = (SignExtend32<16>(Offset) * 4) + 4;
Akira Hatanaka71928e62012-04-17 18:03:21 +00001278 Inst.addOperand(MCOperand::CreateImm(BranchOffset));
1279 return MCDisassembler::Success;
1280}
1281
Akira Hatanaka71928e62012-04-17 18:03:21 +00001282static DecodeStatus DecodeJumpTarget(MCInst &Inst,
1283 unsigned Insn,
1284 uint64_t Address,
1285 const void *Decoder) {
1286
Jim Grosbachecaef492012-08-14 19:06:05 +00001287 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 2;
Akira Hatanaka71928e62012-04-17 18:03:21 +00001288 Inst.addOperand(MCOperand::CreateImm(JumpOffset));
1289 return MCDisassembler::Success;
1290}
1291
Zoran Jovanovic3c8869d2014-05-16 11:03:45 +00001292static DecodeStatus DecodeBranchTarget21(MCInst &Inst,
1293 unsigned Offset,
1294 uint64_t Address,
1295 const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001296 int32_t BranchOffset = SignExtend32<21>(Offset) * 4;
Zoran Jovanovic3c8869d2014-05-16 11:03:45 +00001297
1298 Inst.addOperand(MCOperand::CreateImm(BranchOffset));
1299 return MCDisassembler::Success;
1300}
1301
1302static DecodeStatus DecodeBranchTarget26(MCInst &Inst,
1303 unsigned Offset,
1304 uint64_t Address,
1305 const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001306 int32_t BranchOffset = SignExtend32<26>(Offset) * 4;
Zoran Jovanovic3c8869d2014-05-16 11:03:45 +00001307
1308 Inst.addOperand(MCOperand::CreateImm(BranchOffset));
1309 return MCDisassembler::Success;
1310}
1311
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +00001312static DecodeStatus DecodeBranchTargetMM(MCInst &Inst,
1313 unsigned Offset,
1314 uint64_t Address,
1315 const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001316 int32_t BranchOffset = SignExtend32<16>(Offset) * 2;
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +00001317 Inst.addOperand(MCOperand::CreateImm(BranchOffset));
1318 return MCDisassembler::Success;
1319}
1320
Zoran Jovanovic507e0842013-10-29 16:38:59 +00001321static DecodeStatus DecodeJumpTargetMM(MCInst &Inst,
1322 unsigned Insn,
1323 uint64_t Address,
1324 const void *Decoder) {
1325 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 1;
1326 Inst.addOperand(MCOperand::CreateImm(JumpOffset));
1327 return MCDisassembler::Success;
1328}
Akira Hatanaka71928e62012-04-17 18:03:21 +00001329
1330static DecodeStatus DecodeSimm16(MCInst &Inst,
1331 unsigned Insn,
1332 uint64_t Address,
1333 const void *Decoder) {
1334 Inst.addOperand(MCOperand::CreateImm(SignExtend32<16>(Insn)));
1335 return MCDisassembler::Success;
1336}
1337
Matheus Almeida779c5932013-11-18 12:32:49 +00001338static DecodeStatus DecodeLSAImm(MCInst &Inst,
1339 unsigned Insn,
1340 uint64_t Address,
1341 const void *Decoder) {
1342 // We add one to the immediate field as it was encoded as 'imm - 1'.
1343 Inst.addOperand(MCOperand::CreateImm(Insn + 1));
1344 return MCDisassembler::Success;
1345}
1346
Akira Hatanaka71928e62012-04-17 18:03:21 +00001347static DecodeStatus DecodeInsSize(MCInst &Inst,
1348 unsigned Insn,
1349 uint64_t Address,
1350 const void *Decoder) {
1351 // First we need to grab the pos(lsb) from MCInst.
1352 int Pos = Inst.getOperand(2).getImm();
1353 int Size = (int) Insn - Pos + 1;
1354 Inst.addOperand(MCOperand::CreateImm(SignExtend32<16>(Size)));
1355 return MCDisassembler::Success;
1356}
1357
1358static DecodeStatus DecodeExtSize(MCInst &Inst,
1359 unsigned Insn,
1360 uint64_t Address,
1361 const void *Decoder) {
1362 int Size = (int) Insn + 1;
1363 Inst.addOperand(MCOperand::CreateImm(SignExtend32<16>(Size)));
1364 return MCDisassembler::Success;
1365}
Daniel Sandersb59e1a42014-05-15 10:45:58 +00001366
1367static DecodeStatus DecodeSimm19Lsl2(MCInst &Inst, unsigned Insn,
1368 uint64_t Address, const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001369 Inst.addOperand(MCOperand::CreateImm(SignExtend32<19>(Insn) * 4));
Daniel Sandersb59e1a42014-05-15 10:45:58 +00001370 return MCDisassembler::Success;
1371}
Zoran Jovanovic28551422014-06-09 09:49:51 +00001372
1373static DecodeStatus DecodeSimm18Lsl3(MCInst &Inst, unsigned Insn,
1374 uint64_t Address, const void *Decoder) {
Alexey Samsonovd37bab62014-09-02 17:49:16 +00001375 Inst.addOperand(MCOperand::CreateImm(SignExtend32<18>(Insn) * 8));
Zoran Jovanovic28551422014-06-09 09:49:51 +00001376 return MCDisassembler::Success;
1377}