Add an assembly snippet for `mips_option_tests' to verify that the target board can indeed run microMIPS code, support for which is optional in the MIPS architecture.
Unlike with the `-mips16' option test for the MIPS16 ASE do not rely on a function attribute to switch to the regular MIPS mode first in the wrapper arranged by `mips_first_unsupported_option' -- like with the `nomips16' attribute used there -- because support for regular MIPS code is optional for microMIPS processors. Consequently microMIPS execution may be all that the target board supports and therefore whatever the instruction encoding for the target board -- between the regular MIPS and the microMIPS sets -- has been selected as the default in board options, it has to be respected. Instead of a function attribute use `.set push' and `.set pop' pseudo-ops around `.set micromips' then, ensuring the test code is assembled using the microMIPS instruction encoding, regardless of what encoding is used for the surrounding code, and making sure said surrounding code is consistently assembled. Use the JRADDIUSP instruction for the actual check as an additional safety measure, as this hardware instruction is only present in the microMIPS encoding. The option test otherwise corresponds to the `-mips16' one, as the ISA bit has to be similarly set and restored. gcc/testsuite/ * gcc.target/mips/mips.exp (mips_option_tests): Add `-mmicromips' array element. --- NB it looks to me like some of the other tests ought to be using `.set push' and `.set pop' too, as it's generally unsafe to leave ISA/ASE setting overrides behind at the conclusion of an inline asm for the assembler to continue using with all the compiler-generated code which follows. OK to apply? Maciej gcc-mips-test-option-tests-mmicromips.diff Index: gcc/gcc/testsuite/gcc.target/mips/mips.exp =================================================================== --- gcc.orig/gcc/testsuite/gcc.target/mips/mips.exp 2016-10-25 05:37:13.000000000 +0100 +++ gcc/gcc/testsuite/gcc.target/mips/mips.exp 2016-11-09 17:23:15.985788415 +0000 @@ -360,6 +360,19 @@ set mips_option_tests(-mips16) { jalr $3 move $31,$2 } +set mips_option_tests(-mmicromips) { + move $2,$31 + bal 1f + .set push + .set micromips + jraddiusp 0 + .set pop + .align 2 +1: + ori $3,$31,1 + jalr $3 + move $31,$2 +} set mips_option_tests(-mpaired-single) { .set mips64 lui $2,0x3f80