GAS/MIPS: Add `-mfix-r5900' option for the R5900 short loop erratum
authorFredrik Noring <noring@nocrew.org>
Fri, 30 Nov 2018 18:32:36 +0000 (18:32 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Fri, 30 Nov 2018 18:32:36 +0000 (18:32 +0000)
commit27c634e0ed18f769fb92d03fb75ea491fb6656ec
treedb6c1e97130b20724ac361837f886500ba15f8e0
parent92528b6772a19dd671b52d954c14886b11fc0a8d
GAS/MIPS: Add `-mfix-r5900' option for the R5900 short loop erratum

`-march=r5900' already enables the R5900 short loop workaround.
However, the R5900 ISA and most other MIPS ISAs are mutually
exclusive since R5900-specific instructions are generated as well.

The `-mfix-r5900' option can be used in combination with e.g.
`-mips2' or `-mips3' to generate generic MIPS binaries that also
work with the R5900 target.

This change has been tested with `make RUNTESTFLAGS=mips.exp
check-gas' for the targets `mipsr5900el-unknown-linux-gnu',
`mipsr5900el-elf' and `mips3-unknown-linux-gnu'.

gas/
* config/tc-mips.c (mips_fix_r5900, mips_fix_r5900_explicit):
New variables.
(options): Add OPTION_FIX_R5900 and OPTION_NO_FIX_R5900
enumeration constants.
(md_longopts): Add "mfix-r5900" and "mno-fix-r5900" options.
(can_swap_branch_p, md_parse_option, mips_after_parse_args):
Handle the new options.
(md_show_usage): Document the `-mfix-r5900' option.
* doc/as.texi: Likewise.
* doc/c-mips.texi: Likewise.
* testsuite/gas/mips/mips.exp: Run R5900 dump tests.
* testsuite/gas/mips/r5900-fix.d: Test `-mfix-r5900' option.
* testsuite/gas/mips/r5900-fix.s: Likewise.
* testsuite/gas/mips/r5900-no-fix.d: Test `-mno-fix-r5900'.
* testsuite/gas/mips/r5900-no-fix.s: Likewise.
gas/ChangeLog
gas/config/tc-mips.c
gas/doc/as.texi
gas/doc/c-mips.texi
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/r5900-fix.d [new file with mode: 0644]
gas/testsuite/gas/mips/r5900-fix.s [new file with mode: 0644]
gas/testsuite/gas/mips/r5900-no-fix.d [new file with mode: 0644]
gas/testsuite/gas/mips/r5900-no-fix.s [new file with mode: 0644]