public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64
@ 2011-02-25  0:57 Maciej W. Rozycki
  2011-02-26  9:38 ` Richard Sandiford
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2011-02-25  0:57 UTC (permalink / raw)
  To: binutils; +Cc: Richard Sandiford

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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-28 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25  0:57 [PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64 Maciej W. Rozycki
2011-02-26  9:38 ` Richard Sandiford
2011-02-28 16:30   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).