aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-08-06 20:33:00 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-08-06 20:33:00 +0000
commit464ab0e55ade01d2bb0b4fa45c429af7a2f85a26 (patch)
treeefdfb6373618ee76ba6266857db483ede5cb3666
parent7bb15c6f21865baeedeb6e3765af8643c082cf47 (diff)
downloadgdb-464ab0e55ade01d2bb0b4fa45c429af7a2f85a26.zip
gdb-464ab0e55ade01d2bb0b4fa45c429af7a2f85a26.tar.gz
gdb-464ab0e55ade01d2bb0b4fa45c429af7a2f85a26.tar.bz2
gas/
* config/tc-mips.c (append_insn): Also handle moving delay-slot instruction across frags for fixed branches. gas/testsuite/ * gas/mips/branch-swap-2.l: New list test. * gas/mips/branch-swap-2.s: New test source. * gas/mips/mips.exp: Run the new test.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-mips.c2
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/mips/branch-swap-2.l1
-rw-r--r--gas/testsuite/gas/mips/branch-swap-2.s8
-rw-r--r--gas/testsuite/gas/mips/mips.exp14
6 files changed, 35 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0ed4312..9597f5e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2012-08-06 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * config/tc-mips.c (append_insn): Also handle moving delay-slot
+ instruction across frags for fixed branches.
+
2012-08-03 Maciej W. Rozycki <macro@codesourcery.com>
* frags.c (frag_grow): Never shrink the obstack size requested
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index a9bd0d8..fa78840 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -4488,7 +4488,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
move_insn (ip, delay.frag, delay.where);
move_insn (&delay, ip->frag, ip->where + insn_length (ip));
}
- else if (relaxed_branch)
+ else if (relaxed_branch || delay.frag != ip->frag)
{
/* Add the delay slot instruction to the end of the
current frag and shrink the fixed part of the
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index fd73cce..33ddd17 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-06 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * gas/mips/branch-swap-2.l: New list test.
+ * gas/mips/branch-swap-2.s: New test source.
+ * gas/mips/mips.exp: Run the new test.
+
2012-08-06 Roland McGrath <mcgrathr@google.com>
* gas/i386/x86-64-stack.s: Add cases for push immediate.
diff --git a/gas/testsuite/gas/mips/branch-swap-2.l b/gas/testsuite/gas/mips/branch-swap-2.l
new file mode 100644
index 0000000..36a0971
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-swap-2.l
@@ -0,0 +1 @@
+# No warnings or errors expected!
diff --git a/gas/testsuite/gas/mips/branch-swap-2.s b/gas/testsuite/gas/mips/branch-swap-2.s
new file mode 100644
index 0000000..9fe21d1
--- /dev/null
+++ b/gas/testsuite/gas/mips/branch-swap-2.s
@@ -0,0 +1,8 @@
+ .set micromips
+ .text
+foo:
+ .rept count
+ ori $2, $3, (. - foo) >> 2
+ .endr
+ addu $2, $3, $4
+ j ext
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index b88782f..cc44e62 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -505,6 +505,20 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test_arches "branch-misc-2pic-64" [mips_arch_list_matching mips3]
run_dump_test "branch-misc-3"
run_dump_test "branch-swap"
+
+ if $elf {
+ # Sweep a range of branch offsets so that it hits a position where
+ # it is at the beginning of a frag and then swapped with a 16-bit
+ # instruction from the preceding frag. The offset will be somewhere
+ # close below 4096 as this is the default obstack size limit that
+ # we use and some space will have been already consumed. The exact
+ # amount depends on the host's programming model.
+ for { set count 960 } { $count <= 1024 } { incr count } {
+ run_list_test "branch-swap-2" "--defsym count=$count" \
+ "MIPS branch swapping ($count)"
+ }
+ }
+
run_dump_test "div"
if { !$addr32 } {