Page MenuHomePhabricator

[mips][microMIPS] Implement disassembler support for 16-bit instructions LBU16, LHU16, LW16, SB16, SH16 and SW16
ClosedPublic

Authored by jkolek on Nov 25 2014, 5:52 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

jkolek updated this revision to Diff 16614.Nov 25 2014, 5:52 AM
jkolek retitled this revision from to [mips][microMIPS] Implement disassembler support for 16-bit instructions LBU16, LHU16, LW16, SB16, SH16 and SW16.
jkolek updated this object.
jkolek edited the test plan for this revision. (Show Details)
jkolek added reviewers: dsanders, sstankovic, vmedic.
jkolek added subscribers: zoran.jovanovic, Unknown Object (MLST).
sstankovic added inline comments.Nov 26 2014, 8:27 AM
lib/Target/Mips/Disassembler/MipsDisassembler.cpp
1127 ↗(On Diff #16614)

lbu16 is wrongly disassembled when encoded immediate is 0xf. The decoded immediate should be -1 in that case. For the following instruction

lbu16 $3, -1($16)

if it is assembled with llvm-mc (or gcc) and then disassembled with llvm-objdump, the result is

lbu16 $3, 15($16)

Please include this instruction in both assemble and disassemble tests.

1134 ↗(On Diff #16614)

It's not clear whether you need SignExtend here. Instruction reference document says that offset is sign-extended. But gcc treats the offset as zero-extended, and will only assemble lw16 if offset is [0, 4, ..., 60].

jkolek updated this revision to Diff 16655.Nov 26 2014, 9:05 AM

Corrected LBU16 offset, if offset its encoding is 0xF then disassembled value will be -1.
LW16 is corrected according to GCC.

jkolek updated this revision to Diff 16656.Nov 26 2014, 9:42 AM
sstankovic accepted this revision.Nov 26 2014, 9:56 AM
sstankovic edited edge metadata.
This revision is now accepted and ready to land.Nov 26 2014, 9:56 AM
jkolek closed this revision.Nov 26 2014, 10:57 AM
jkolek updated this revision to Diff 16658.

Closed by commit rL222847 (authored by @jkolek).