binutils-gdb/binutils/testsuite/binutils-all/mips
Maciej W. Rozycki 9785fc2a4d MIPS: Fix XPA base and Virtualization ASE instruction handling
Correct a commit 7d64c587c1 ("Add support for the MIPS eXtended
Physical Address (XPA) ASE.") bug, causing XPA base and Virtualization
ASE instructions to be wrongly always enabled with the selection of the
MIPS32r2 or higher ISA.

For example this source assembles successfully as shown below:

$ cat xpa.s
	mfhc0	$2, $1
$ as -32 -mips32 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32 (mips32) `mfhc0 $2,$1'
$ as -32 -mips32r2 -o xpa.o xpa.s
$ objdump -d xpa.o

xpa.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0:	40420800 	mfhc0	v0,c0_random
	...
$

To address this issue remove the I33 (INSN_ISA32R2) marking from all XPA
instructions in the opcode table.  Additionally, for XPA Virtualization
ASE instructions implement an XPAVZ (ASE_XPA_VIRT) combination ASE flag
and use it in place of IVIRT|XPA (ASE_VIRT|ASE_XPA).

Now the same source is correctly rejected unless the `-mxpa' option is
also used:

$ as -32 -mips32r2 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mfhc0 $2,$1'
$ as -32 -mips32r2 -mxpa -o xpa.o xpa.s
$

Add test cases for XPA base and XPA Virtualization ASE instructions.

Parts of this change by Andrew Bennett.

	include/
	* opcode/mips.h (ASE_XPA_VIRT): New macro.

	opcodes/
	* mips-dis.c (mips_calculate_combination_ases): Handle the
	ASE_XPA_VIRT flag.
	(parse_mips_ase_option): New function.
	(parse_mips_dis_option): Factor out ASE option handling to the
	new function.  Call `mips_calculate_combination_ases'.
	* mips-opc.c (XPAVZ): New macro.
	(mips_builtin_opcodes): Correct ISA and ASE flags for "mfhc0",
	"mfhgc0", "mthc0" and "mthgc0".

	gas/
	* config/tc-mips.c (mips_set_ase): Handle the ASE_XPA_VIRT flag.
	* testsuite/gas/mips/xpa.d: Remove `xpa' from `-M' in `objdump'
	flags.  Add `-mvirt' to `as' flags.
	* testsuite/gas/mips/xpa-err.d: New test.
	* testsuite/gas/mips/xpa-virt-err.d: New test.
	* testsuite/gas/mips/xpa-err.l: New stderr output.
	* testsuite/gas/mips/xpa-virt-err.l: New stderr output.
	* testsuite/gas/mips/xpa-err.s: New test source.
	* testsuite/gas/mips/xpa-virt-err.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	binutils/
	* testsuite/binutils-all/mips/mips-xpa-virt-1.d: New test.
	* testsuite/binutils-all/mips/mips-xpa-virt-2.d: New test.
	* testsuite/binutils-all/mips/mips-xpa-virt-3.d: New test.
	* testsuite/binutils-all/mips/mips-xpa-virt-4.d: New test.
	* testsuite/binutils-all/mips/mips-xpa-virt.s: New test source.
	* testsuite/binutils-all/mips/mips.exp: Run the new tests.
2017-06-30 07:21:55 +01:00
..
mips-ase-1.d MIPS/opcodes: Also set disassembler's ASE flags from ELF structures 2016-12-14 22:12:21 +00:00
mips-ase-1.s MIPS/opcodes: Also set disassembler's ASE flags from ELF structures 2016-12-14 22:12:21 +00:00
mips-ase-2.d MIPS/opcodes: Also set disassembler's ASE flags from ELF structures 2016-12-14 22:12:21 +00:00
mips-ase-2.s MIPS/opcodes: Also set disassembler's ASE flags from ELF structures 2016-12-14 22:12:21 +00:00
mips-ase-3.d MIPS/opcodes: Also set disassembler's ASE flags from ELF structures 2016-12-14 22:12:21 +00:00
mips-note-2-n32.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-note-2-n64.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-note-2.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-note-2r-n32.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-note-2r-n64.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-note-2r.d MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count' 2017-05-20 00:31:39 +01:00
mips-xpa-virt-1.d MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips-xpa-virt-2.d MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips-xpa-virt-3.d MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips-xpa-virt-4.d MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips-xpa-virt.s MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips.exp MIPS: Fix XPA base and Virtualization ASE instruction handling 2017-06-30 07:21:55 +01:00
mips16-alias.d MIPS16/opcodes: Annotate instruction aliases 2017-04-25 11:55:34 +01:00
mips16-alias.s MIPS16/opcodes: Annotate instruction aliases 2017-04-25 11:55:34 +01:00
mips16-extend-insn.d MIPS16/opcodes: Make the handling of BREAK and SDBBP consistent 2017-05-12 01:12:10 +01:00
mips16-extend-insn.s MIPS16: Handle non-extensible instructions correctly 2016-12-23 19:33:45 +00:00
mips16-extend-noinsn.d MIPS16: Switch to 32-bit opcode table interpretation 2016-12-20 11:56:32 +00:00
mips16-extend-noinsn.s MIPS16/opcodes: Reformat raw EXTEND and undecoded output 2016-12-09 23:18:06 +00:00
mips16-noalias.d MIPS16/opcodes: Annotate instruction aliases 2017-04-25 11:55:34 +01:00
mips16-pcrel.d MIPS16/opcodes: Fix PC-relative operation delay-slot adjustment 2016-12-08 23:30:57 +00:00
mips16-pcrel.s MIPS16/opcodes: Fix PC-relative operation delay-slot adjustment 2016-12-08 23:30:57 +00:00
mips16-undecoded.d MIPS16e2: Add new MIPS16e2 ASE binutils and GAS tests 2017-05-15 13:57:11 +01:00
mips16-undecoded.s MIPS16e2: Add new MIPS16e2 ASE binutils and GAS tests 2017-05-15 13:57:11 +01:00
mips16e2-extend-insn.d MIPS16e2: Add new MIPS16e2 ASE binutils and GAS tests 2017-05-15 13:57:11 +01:00
mips16e2-undecoded.d MIPS16e2: Add new MIPS16e2 ASE binutils and GAS tests 2017-05-15 13:57:11 +01:00
mixed-micromips.d
mixed-micromips.s
mixed-mips16-micromips.d MIPS/opcodes: Correct mixed MIPS16 and microMIPS disassembly 2016-05-18 13:07:24 +01:00
mixed-mips16-micromips.s MIPS/opcodes: Correct mixed MIPS16 and microMIPS disassembly 2016-05-18 13:07:24 +01:00
mixed-mips16.d
mixed-mips16.s