public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>,
	 Catherine Moore <clm@codesourcery.com>,
	 Eric Christopher	<echristo@gmail.com>,
	 Matthew Fortune <matthew.fortune@imgtec.com>
Subject: Re: [PATCH] MIPS/GCC: Unconditional jump generation bug fix
Date: Fri, 05 Dec 2014 10:48:00 -0000	[thread overview]
Message-ID: <87388ucqy6.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1411160038070.2881@tp.orcam.me.uk> (Maciej	W. Rozycki's message of "Mon, 17 Nov 2014 16:06:47 +0000")

"Maciej W. Rozycki" <macro@codesourcery.com> writes:
> 2014-11-17  Maciej W. Rozycki  <macro@codesourcery.com>
>
> 	gcc/
> 	* gcc/config/mips/mips.md (*jump_absolute): Use a branch when in
> 	range, a jump otherwise.
>
>   Maciej
>
> gcc-mips-jump-branch.diff
> Index: gcc-fsf-trunk-quilt/gcc/config/mips/mips.md
> ===================================================================
> --- gcc-fsf-trunk-quilt.orig/gcc/config/mips/mips.md	2014-11-16 19:54:17.000000000 +0000
> +++ gcc-fsf-trunk-quilt/gcc/config/mips/mips.md	2014-11-17 04:44:32.847732003 +0000
> @@ -5957,14 +5957,12 @@
>  	(label_ref (match_operand 0)))]
>    "!TARGET_MIPS16 && TARGET_ABSOLUTE_JUMPS"
>  {
> -  /* Use a branch for microMIPS.  The assembler will choose
> -     a 16-bit branch, a 32-bit branch, or a 32-bit jump.  */
> -  if (TARGET_MICROMIPS && !TARGET_ABICALLS_PIC2)
> +  if (get_attr_length (insn) <= 8)
>      return "%*b\t%l0%/";
>    else
>      return MIPS_ABSOLUTE_JUMP ("%*j\t%l0%/");
>  }
> -  [(set_attr "type" "jump")])
> +  [(set_attr "type" "branch")])

You didn't mention it explicitly, but this will have the effect of
overestimating the length of the insn by 8 bytes in cases where the
jump is used.  That might be an acceptable trade-off (even for
non-microMIPS code) but it's probably worth mentioning in a comment.

Thanks,
Richard

  parent reply	other threads:[~2014-12-05 10:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-17 16:38 Maciej W. Rozycki
2014-11-17 16:56 ` Matthew Fortune
2014-11-18 16:56   ` Maciej W. Rozycki
2014-11-18 17:28     ` Matthew Fortune
2014-11-18 17:29       ` Moore, Catherine
2014-11-18 19:33         ` Matthew Fortune
2014-11-19 13:35           ` Maciej W. Rozycki
2014-12-05 10:48 ` Richard Sandiford [this message]
2014-12-05 11:06   ` Matthew Fortune
2014-12-05 11:25     ` Richard Sandiford

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=87388ucqy6.fsf@e105548-lin.cambridge.arm.com \
    --to=richard.sandiford@arm.com \
    --cc=clm@codesourcery.com \
    --cc=echristo@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=macro@codesourcery.com \
    --cc=matthew.fortune@imgtec.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).