Mips's MicroMips ??

Hi,

We have this line in micromips-16-bit-instructions.s

CHECK-EB: addu16 $6, $17, $4 # encoding: [0x07,0x42]

However, when I check this with llvm-mc, like below, I dont get back the assembly.
This is against the latest LLVM code. What is wrong here?

Thanks,
Jun

$ echo “0x07,0x42”|./Release+Asserts/bin/llvm-mc -disassemble -triple=mips -show-encoding -mattr=micromips
.text
:1:1: warning: invalid instruction encoding
0x07,0x42
^
:1:6: warning: invalid instruction encoding
0x07,0x42

Hi,

I’ve had a quick look through MipsDisassembler.cpp and it seems that the disassembler doesn’t know anything about 16-bit instructions at the moment. The two main problems are that DecoderTableMicroMips16 (which contains ADDU16_MM) is never used, and the disassembler always reads the opcode as a 4-byte value.

Vladimir/Sasa/Jozef/Zoran: I don’t know much about the microMIPS encodings at the moment. Do you have the details on distinguishing 16-bit from 32-bit instructions?

Hello Daniel,
At the moment we are preparing the patch for disassembling microMIPS 16 bit instructions and it will be on Phabricator tomorrow or on Wednesday.
Functionality is implemented in MipsDisassembler::getInstruction where first two bytes are read and decodeInstruction is called with DecoderTableMicroMips16 and only if it fails we read 4 bytes and call decodeInstruction with DecoderTableMicroMips32.

Regards,
Zoran

awesome! looking forward to it.

thanks,
Jun

Hi all,
the patch is on Phabricator (http://reviews.llvm.org/D6149). With the help of new method readInstruction16() two bytes are read and decodeInstruction() is called with DecoderTableMicroMips16, if this fails another two bytes are read and decodeInstruction() is called with DecoderTableMicroMips32.

Regards,
Jozef

Hi all,
the patch is on Phabricator (http://reviews.llvm.org/D6149). With the
help of new method readInstruction16() two bytes are read and
decodeInstruction() is called with DecoderTableMicroMips16, if this fails
another two bytes are read and decodeInstruction() is called with
DecoderTableMicroMips32.

thanks for the heads up. will this be merged soon?

Jun