This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: binutils at sourceware dot org
- Cc: Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Fri, 25 Feb 2011 00:57:38 +0000 (GMT)
- Subject: [PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64
Hi,
Here's a change to disable branch relaxation for the BPOSGE32 and
BPOSGE64 MIPS DSP instructions. They have no complementing branches and
therefore cannot be relaxed using our current infrastructure -- an extra
unconditional branch over the long jump would have to be produced and I
think there's little demand for such a feature, hence my simple change.
Currently trying to assemble an out-of-range branch of this kind yields
an error like this:
relax-bposge.s:12: Internal error!
Assertion failure in md_convert_frag at [...]/gas/config/tc-mips.c line 17346.
Please report this bug.
Regression-tested with the mips-sde-elf and mips-gnu-linux targets. OK
to apply?
2011-02-21 Maciej W. Rozycki <macro@codesourcery.com>
gas/
* config/tc-mips.c (append_insn): Disable branch relaxation for
DSP instructions.
gas/testsuite/
* gas/mips/relax-bposge.l: New test for DSP branch relaxation.
* gas/mips/relax-bposge.s: Source for the new test.
* gas/mips/mips.exp: Run the new test.
Maciej
binutils-gas-mips-relax-dsp.diff
Index: binutils-fsf-trunk-quilt/gas/config/tc-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/config/tc-mips.c 2011-02-24 23:46:08.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/config/tc-mips.c 2011-02-24 23:46:09.000000000 +0000
@@ -3132,6 +3132,8 @@ append_insn (struct mips_cl_insn *ip, ex
out that the branch was out-of-range, we'll get an error. */
&& !mips_opts.warn_about_macros
&& (mips_opts.at || mips_pic == NO_PIC)
+ /* Don't relax BPOSGE32/64 as they have no complementing branches. */
+ && !(ip->insn_mo->membership & (INSN_DSP64 | INSN_DSP))
&& !mips_opts.mips16)
{
relaxed_branch = TRUE;
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/testsuite/gas/mips/mips.exp 2011-02-24 23:46:08.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp 2011-02-24 23:46:09.000000000 +0000
@@ -708,6 +708,8 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "relax-swap1-mips1"
run_dump_test "relax-swap1-mips2"
run_dump_test "relax-swap2"
+ run_list_test_arches "relax-bposge" "-mdsp -relax-branch" \
+ [mips_arch_list_matching mips64r2]
run_list_test "illegal" "-32"
run_list_test "baddata1" "-32"
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.l
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.l 2011-02-24 23:46:09.000000000 +0000
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:6: Warning: Relaxed out-of-range branch into a jump
+.*:9: Warning: Relaxed out-of-range branch into a jump
+.*:7: Error: Branch out of range
+.*:8: Error: Branch out of range
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/relax-bposge.s 2011-02-24 23:46:09.000000000 +0000
@@ -0,0 +1,12 @@
+# Source file to test branch relaxation with the BPOSGE32 and BPOSGE64
+# instructions.
+
+ .text
+foo:
+ b bar
+ bposge32 bar
+ bposge64 bar
+ bal bar
+
+ .space 0x20000
+bar: