This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Implement BLTZC, BLEZC, BGEZC and BGTZC instructions, fix disassembly and add operand checking to existing B<cond>C implementations
ClosedPublic

Authored by mamidzic on Jul 22 2016, 2:14 AM.

Details

Summary

The patch implements BLTZC, BLEZC, BGEZC and BGTZC instructions, fixes disassembly of all existing MicroMips B<cond>C implementations and adds offset checking to MipsR6 and MMR6 B<cond>C instructions.

Diff Detail

Repository
rL LLVM

Event Timeline

mamidzic updated this revision to Diff 65035.Jul 22 2016, 2:14 AM
mamidzic retitled this revision from to [mips][microMIPS] Implement BLTZC, BLEZC, BGEZC and BGTZC instructions.
mamidzic updated this object.
sdardis requested changes to this revision.Jul 22 2016, 7:17 AM
sdardis edited edge metadata.
sdardis added inline comments.
lib/Target/Mips/Disassembler/MipsDisassembler.cpp
651–663 ↗(On Diff #65035)

The current '* 2"s should be changed to '* 2 + 4'.

724–736 ↗(On Diff #65035)

Here too.

755 ↗(On Diff #65035)

Style point, you can put this line after the 'int64_t Imm..' line like the next function for consistency.

2392–2403 ↗(On Diff #65035)

Here again '* 2' -> '* 2 + 4'.

2437–2448 ↗(On Diff #65035)

Here again.

test/MC/Mips/micromips32r6/invalid.s
301 ↗(On Diff #65035)

Add out of range tests as well, and unencodable offsets and to the other invalid test.

This revision now requires changes to proceed.Jul 22 2016, 7:17 AM

And update the title/body to reflect that you've fixed the disassembly of all micromips b<cond>c instructions.

mamidzic updated this revision to Diff 68505.Aug 18 2016, 3:33 AM
mamidzic retitled this revision from [mips][microMIPS] Implement BLTZC, BLEZC, BGEZC and BGTZC instructions to [mips][microMIPS] Implement BLTZC, BLEZC, BGEZC and BGTZC instructions, fix disassembly and add operand checking to existing B<cond>C implementations.
mamidzic updated this object.
mamidzic edited edge metadata.

Added + 4 (where missing) to offsets when decoding B<cond>C instructions. Changed tests accordingly.
Added checking of offset range and alignment to B<cond>C instructions for MipsR6 and MMR6.
Added more invalid tests for B<cond>C instructions in MMR6 and MipsR6.

sdardis accepted this revision.Aug 18 2016, 8:08 AM
sdardis edited edge metadata.

LGTM with the highlighted comment changed.

lib/Target/Mips/Disassembler/MipsDisassembler.cpp
2424 ↗(On Diff #68505)

if rs == 0 -> if rt == 0

This revision is now accepted and ready to land.Aug 18 2016, 8:08 AM
This revision was automatically updated to reflect the committed changes.