public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: binutils@sourceware.org
Cc: Richard Sandiford <rdsandiford@googlemail.com>
Subject: [PATCH] MIPS/GAS: Disable branch relaxation for BPOSGE32/64
Date: Fri, 25 Feb 2011 00:57:00 -0000	[thread overview]
Message-ID: <alpine.DEB.1.10.1102212039440.20460@tp.orcam.me.uk> (raw)

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:

             reply	other threads:[~2011-02-25  0:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25  0:57 Maciej W. Rozycki [this message]
2011-02-26  9:38 ` Richard Sandiford
2011-02-28 16:30   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.10.1102212039440.20460@tp.orcam.me.uk \
    --to=macro@codesourcery.com \
    --cc=binutils@sourceware.org \
    --cc=rdsandiford@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).