[mips][mips64r6] Add b[on]vc
authorDaniel Sanders <daniel.sanders@imgtec.com>
Thu, 22 May 2014 11:23:21 +0000 (11:23 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Thu, 22 May 2014 11:23:21 +0000 (11:23 +0000)
commitc96096cc0f080016ebf5308fe408ca4de8c3c19d
treebbb5ef974dd8afdbd4199a2c3b27653ad688ad16
parent2447dcc2e850a90ef65d5ca5b6c6a298a4ed3b7e
[mips][mips64r6] Add b[on]vc

Summary:
This required me to implement the disassembler for MIPS64r6 since the encodings
are ambiguous with other instructions. This in turn revealed a few
assembly/disassembly bugs which I have fixed.

* da[ht]i only take two operands according to the spec, not three.
* DecodeBranchTarget2[16] correctly handles wider immediates than simm16
  * Also made non-functional change to DecodeBranchTarget and
    DecodeBranchTargetMM to keep implementation style consistent between
    them.
* Difficult encodings are handled by a custom decode method on the most
  general encoding in the group. This method will convert the MCInst to a
  different opcode if necessary.

DecodeBranchTarget is not currently the inverse of getBranchTargetOpValue
so disassembling some branch instructions emit incorrect output. This seems
to affect branches with delay slots on all MIPS ISA's. I've left this bug
for now and temporarily removed the check for the immediate on
bc[12]eqz/bc[12]nez in the MIPS32r6/MIPS64r6 tests.

jialc and jic crash the disassembler for some reason. I've left these
instructions commented out for the moment.

Depends on D3760

Reviewers: jkolek, zoran.jovanovic, vmedic

Reviewed By: vmedic

Differential Revision: http://reviews.llvm.org/D3761

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209415 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Mips/Disassembler/MipsDisassembler.cpp
lib/Target/Mips/Mips32r6InstrFormats.td
lib/Target/Mips/Mips32r6InstrInfo.td
lib/Target/Mips/Mips64r6InstrInfo.td
test/MC/Disassembler/Mips/mips32r6.txt [new file with mode: 0644]
test/MC/Disassembler/Mips/mips64r6.txt [new file with mode: 0644]
test/MC/Mips/mips32r6/valid-xfail.s [new file with mode: 0644]
test/MC/Mips/mips32r6/valid.s
test/MC/Mips/mips64r6/valid-xfail.s [new file with mode: 0644]
test/MC/Mips/mips64r6/valid.s