public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed] Tweak tracking of MIPS branch history
@ 2011-06-29 20:45 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2011-06-29 20:45 UTC (permalink / raw)
  To: binutils

We currently clear the history after an unconditional branch in
a ".set reorder" section.  We should really do the same for
unconditional branches in a ".set noreorder" section, so that
hazards between earlier instructions don't come into play once
the ".set noreorder" block is over.

Tested on:

    mips64-elf mips64el-unknown-kfreebsd-gnu mips64-linux-gnu
    mips64octeon-linux-gnu mips64-unknown-kfreebsd-gnu
    mipsel-unknown-kfreebsd-gnu mipsisa32el-linux-gnu
    mipsisa64-elf mips-linux-gnu mips-sgi-irix6.5
    mips-unknown-kfreebsd-gnu mips-wrs-vxworks

and applied.

Richard


gas/
	* config/tc-mips.c (append_insn): Always clear the history after an
	unconditional branch.

Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c	2011-06-29 19:56:09.000000000 +0100
+++ gas/config/tc-mips.c	2011-06-29 19:56:59.000000000 +0100
@@ -3609,13 +3609,6 @@ append_insn (struct mips_cl_insn *ip, ex
 	      delay.fixed_p = 1;
 	      insert_into_history (0, 1, &delay);
 	    }
-
-	  /* If that was an unconditional branch, forget the previous
-	     insn information.  */
-	  if (pinfo & INSN_UNCOND_BRANCH_DELAY)
-	    {
-	      mips_no_prev_insn ();
-	    }
 	}
       else if (pinfo & INSN_COND_BRANCH_LIKELY)
 	{
@@ -3632,6 +3625,12 @@ append_insn (struct mips_cl_insn *ip, ex
   else
     insert_into_history (0, 1, ip);
 
+  /* If we have just completed an unconditional branch, clear the history.  */
+  if ((history[1].insn_mo->pinfo & INSN_UNCOND_BRANCH_DELAY)
+      || (mips_opts.mips16
+	  && (history[0].insn_mo->pinfo & MIPS16_INSN_UNCOND_BRANCH)))
+    mips_no_prev_insn ();
+
   /* We just output an insn, so the next one doesn't have a label.  */
   mips_clear_insn_labels ();
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-29 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 20:45 [committed] Tweak tracking of MIPS branch history Richard Sandiford

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).