This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] MIPS/GAS: Simplify non-MIPS16 branch swapping sequence

Simplify non-MIPS16 branch swapping by copying the MIPS16 variant, which 
sets the new position for the current instruction first and reduces the 
calculation of the new position of the previous instruction.  Also refer 
to previous instruction's frag and position via `delay' for consistency.

Reintroduce an explanatory comment, updated, previously removed with:

commit 1e91584932efd70020c8c98037d0cb93a0552a20
Author: Richard Sandiford <>
Date:   Wed Mar 9 09:17:02 2005 +0000

<>, ("Rework 
MIPS nop-insertion code, add -mfix-vr4130 [5/11]").

	* config/tc-mips.c (append_insn): Simplify non-MIPS16 branch 
	swapping sequence.
 No changes in regression testing, committed.


Index: binutils/gas/config/tc-mips.c
--- binutils.orig/gas/config/tc-mips.c	2016-06-29 21:50:31.740894896 +0100
+++ binutils/gas/config/tc-mips.c	2016-06-30 11:12:19.276873304 +0100
@@ -7537,9 +7537,10 @@ append_insn (struct mips_cl_insn *ip, ex
-	    move_insn (&delay, ip->frag,
-		       ip->where - branch_disp + insn_length (ip));
-	    move_insn (ip, history[0].frag, history[0].where);
+	    /* If this is not a relaxed branch and we are in the
+	       same frag, then just swap the instructions.  */
+	    move_insn (ip, delay.frag, delay.where);
+	    move_insn (&delay, ip->frag, ip->where + insn_length (ip));
 	history[0] = *ip;
 	delay.fixed_p = 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]