This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] MIPS16: Handle non-extensible instructions correctly

Identify non-extensible instructions in the MIPS16 opcode table and 
disallow their use with the `.e' instruction size suffix in assembly and 
do not interpret any EXTEND prefix present as a part of the instruction 
in disassembly.

According to all versions of the MIPS16 ASE specifications the following 
instructions encodings are not extensible [1][2][3][4][5][6]: I8/MOV32R, 
I8/MOVR32, all RRR minor opcodes, all RR minor opcodes except from DSRA 
and DSRL, and EXTEND itself, and as from revision 2.50 of the MIPS16e 
ASE specifications it has been further clarified what was previously 
implied, that non-extesiable instructions when preceded with an EXTEND 
prefix must cause a Reserved Instruction exception [3][5].

Therefore in the presence of an EXTEND prefix none of these instructions 
are supposed to be handled as extended instructions and supporting these 
forms in disassembly causes confusion, and in the case of the RRR major 
opcode it also clashes with the ASMACRO encoding.


[1] "Product Description, MIPS16 Application-Specific Extension", 
    Version 1.3, MIPS Technologies, Inc., 970130, Table 3. "MIPS16 
    Instruction Set Summary", p. 5

[2] same, Table 5 "RR Minor Opcodes (RR-type instructions)", p.10

[3] "MIPS32 Architecture for Programmers, Volume IV-a: The MIPS16e
    Application-Specific Extension to the MIPS32 Architecture", MIPS 
    Technologies, Inc., Document Number: MD00076, Revision 2.63, July 
    16, 2013, Section 3.9 "MIPS16e Instruction Summaries", pp. 37-39

[4] same, Section 3.15 "Instruction Bit Encoding", pp. 46-49

[5] "MIPS64 Architecture for Programmers, Volume IV-a: The MIPS16e 
    Application-Specific Extension to the MIPS64 Architecture", MIPS 
    Technologies, Inc., Document Number: MD00077, Revision 2.60, June 
    25, 2008, Section 1.9 "MIPS16e Instruction Summaries", pp. 38-41

[6] same, Section 1.15 "Instruction Bit Encoding", pp. 48-51

	* opcode/mips.h (INSN2_SHORT_ONLY): New macro.

	* config/tc-mips.c (is_size_valid_16): Disallow a `.e' suffix
	instruction size override for INSN2_SHORT_ONLY opcode table
	* testsuite/gas/mips/mips16-extend-swap.d: Adjust output.
	* testsuite/gas/mips/mips16-macro-e.l: Adjust error messages.
	* testsuite/gas/mips/mips16-32@mips16-macro-e.l: Adjust error
	* testsuite/gas/mips/mips16e-32@mips16-macro-e.l: Adjust error
	* testsuite/gas/mips/mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-insn-e.d: New test.
	* testsuite/gas/mips/mips16-32@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-64@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16e-32@mips16-insn-t.d: New test.
	* testsuite/gas/mips/mips16-insn-e.l: New stderr output.
	* testsuite/gas/mips/mips16-insn-t.l: New stderr output.
	* testsuite/gas/mips/mips16-32@mips16-insn-e.l: New stderr 
	* testsuite/gas/mips/mips16-64@mips16-insn-e.l: New stderr 
	* testsuite/gas/mips/mips16e-32@mips16-insn-e.l: New stderr 
	* testsuite/gas/mips/mips16-32@mips16-insn-t.l: New stderr 
	* testsuite/gas/mips/mips16-64@mips16-insn-t.l: New stderr 
	* testsuite/gas/mips/mips16e-32@mips16-insn-t.l: New stderr 
	* testsuite/gas/mips/mips16-insn-e.s: New test source.
	* testsuite/gas/mips/mips16-insn-t.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	* mips-dis.c (print_insn_mips16): Disallow EXTEND prefix 
	matching for INSN2_SHORT_ONLY opcode table entries.
	* mips16-opc.c (SH): New macro.
	(mips16_opcodes): Set SH in `pinfo2' for non-extensible 
	instruction entries: "nop", "addu", "and", "break", "cmp", 
	"daddu", "ddiv", "ddivu", "div", "divu", "dmult", "dmultu",
	"drem", "dremu", "dsllv", "dsll", "dsrav", "dsra", "dsrlv",
	"dsrl", "dsubu", "exit", "entry", "jalr", "jal", "jr", "j", 
	"jalrc", "jrc", "mfhi", "mflo", "move", "mult", "multu", "neg", 
	"not", "or", "rem", "remu", "sllv", "sll", "slt", "sltu", 
	"srav", "sra", "srlv", "srl", "subu", "xor", "sdbbp", "seb", 
	"seh", "sew", "zeb", "zeh", "zew" and "extend".

	* testsuite/binutils-all/mips/mips16-extend-insn.d: New test.
	* testsuite/binutils-all/mips/mips16-extend-insn.s: New test 
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.
[Patch attached compressed due to its size.]

Attachment: binutils-mips16-short-only.diff.bz2
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]