[Mips] Disassemble the R5900 lq/sq, MMI and pipeline-1 instructions #19
Loading…
Reference in a new issue
No description provided.
Delete branch "r5900-disasm-mmi"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The R5900-only instructions were defined for the assembler but sat in a decoder namespace (
VU0) thatMipsDisassembler::getInstructionnever queried, so llvm-objdump andllvm-mc --disassembleshowed them as<unknown>or invalid. This moves them to theR5900table, which is only tried when ther5900feature is set.lq,sq,lqc2,sqc2p*instructions andqfsrvmult1,multu1,madd1,maddu1(2- and 3-operand),div1,divu1,mfhi1,mflo1,mthi1,mtlo1mult/multu/madd/maddu,mfsa,mtsa,mtsab,mtsah,bc0f/bc0t/bc0fl/bc0tl, the 14 debug COP0 moves (mfbpc...mtdvbm)Decoding details:
mult/multuwith rd = 0DecodeR5900MulRdfails, so the main table's 2-operandmult $rs, $rtis useddiv1/divu1isAsmParserOnly; decodes asdiv1 $zero, $rs, $rt, the spelling GNU objdump uses and GNU as acceptslqc2/sqc2DecodeVU0Memdecodes rt as a VF register ($vf9, not$9)All changes are gated on the R5900: the
R5900decoder table is only reached whenFeatureR5900is set, and every moved def keeps itsIsR5900Pred/HasVU0predicate.Tests:
llvm/test/MC/Disassembler/Mips/r5900-ee.txt: 143 encodings. 140 are every newly decodable def, assembled withmips64r5900el-ps2-elf-as -march=r5900; GNU objdump prints the same instruction and operands for each.r5900-ee-invalid.txt: the same encodings do not decode with-mcpu=mips3.MC/MipsandMC/Disassembler/Mips: 557 passed, 53 expected failures (already there), 0 failures.Bench ELF (
scratch/bv/lto194-base-O2/.../ee-bench.unstripped.elf): the 99<unknown>instruction words (lq, sq, MMI, 3-operand mult) now disassemble. The 264<unknown>lines left are all0x04170001, lld's MIPS trap fill between functions (trapInstrin lld/ELF/Arch/Mips.cpp, the R6sigrie). GNU objdump prints these as.word 0x4170001, so they stay undecoded. llvm-objdump on this ELF needs ps2/llvm#17 to get past the EF_MIPS_ARCH abort; I checked the result with #17 applied.🤖 Generated with Claude Code