aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2004-11-11 19:05:43 +0000
committerBob Wilson <bob.wilson@acm.org>2004-11-11 19:05:43 +0000
commita67517f48ea8dba9381df004e6aebf9b1d0d39c2 (patch)
treed5a8200b538fa5fcba4f12549733a6e6c14cb8d3
parentd6f7abdf98f98f21d0c3724f6897ebecf55ec9aa (diff)
downloadgdb-a67517f48ea8dba9381df004e6aebf9b1d0d39c2.zip
gdb-a67517f48ea8dba9381df004e6aebf9b1d0d39c2.tar.gz
gdb-a67517f48ea8dba9381df004e6aebf9b1d0d39c2.tar.bz2
gas/
* config/tc-xtensa.c (MAX_IMMED6): Change value to 65. gas/testsuite/ * gas/xtensa/short_branch_offset.s: New. * gas/xtensa/short_branch_offset.d: New. * gas/xtensa/all.exp: Run new test.
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-xtensa.c7
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/xtensa/all.exp4
-rw-r--r--gas/testsuite/gas/xtensa/short_branch_offset.d34
-rw-r--r--gas/testsuite/gas/xtensa/short_branch_offset.s24
6 files changed, 75 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1c74fa6..c2ade55 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2004-11-11 Bob Wilson <bob.wilson@acm.org>
+
+ * config/tc-xtensa.c (MAX_IMMED6): Change value to 65.
+
2004-11-10 Bob Wilson <bob.wilson@acm.org>
* config/tc-xtensa.c (update_next_frag_state): Always add a NOP if
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 11bd872..8f36230 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -7242,8 +7242,11 @@ xtensa_mark_narrow_branches (void)
use for alignment narrow branches that definitely will not expand to a
jump and a branch. These functions find and mark these cases. */
-/* the range in bytes of a bnez.n and beqz.n */
-#define MAX_IMMED6 68
+/* The range in bytes of BNEZ.N and BEQZ.N. The target operand is encoded
+ as PC + 4 + imm6, where imm6 is a 6-bit immediate ranging from 0 to 63.
+ We start counting beginning with the frag after the 2-byte branch, so the
+ maximum offset is (4 - 2) + 63 = 65. */
+#define MAX_IMMED6 65
static size_t unrelaxed_frag_max_size (fragS *);
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index fe960ea..b5c94fc 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2004-11-11 Bob Wilson <bob.wilson@acm.org>
+
+ * gas/xtensa/short_branch_offset.s: New.
+ * gas/xtensa/short_branch_offset.d: New.
+ * gas/xtensa/all.exp: Run new test.
+
2004-11-10 Alan Modra <amodra@bigpond.net.au>
* gas/i386/opcode.s: Pad section.
diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp
index 2077301..89b3cdf 100644
--- a/gas/testsuite/gas/xtensa/all.exp
+++ b/gas/testsuite/gas/xtensa/all.exp
@@ -78,9 +78,9 @@ if [istarget xtensa*-*-*] then {
objdump_finish
if [all_ones $x1] then { pass $testname } else { fail $testname }
-
+ run_dump_test "short_branch_offset"
}
if [info exists errorInfo] then {
unset errorInfo
- }
+}
diff --git a/gas/testsuite/gas/xtensa/short_branch_offset.d b/gas/testsuite/gas/xtensa/short_branch_offset.d
new file mode 100644
index 0000000..0d95a7c
--- /dev/null
+++ b/gas/testsuite/gas/xtensa/short_branch_offset.d
@@ -0,0 +1,34 @@
+# as: --no-target-align
+# objdump: -d
+
+# Test that a short branch with a target just barely out of range does
+# not crash the assembler.
+
+.*: +file format elf32-xtensa-.*
+
+Disassembly of section .text:
+
+00000000 <.text>:
+ 0: .* bnez a2, 0x45
+ 3: .* nop
+ 6: .* nop
+ 9: .* nop
+ c: .* nop
+ f: .* nop
+ 12: .* nop
+ 15: .* nop
+ 18: .* nop
+ 1b: .* nop
+ 1e: .* nop
+ 21: .* nop
+ 24: .* nop
+ 27: .* nop
+ 2a: .* nop
+ 2d: .* nop
+ 30: .* nop
+ 33: .* nop
+ 36: .* nop
+ 39: .* nop
+ 3c: .* nop
+ 3f: .* nop
+ 42: .* nop
diff --git a/gas/testsuite/gas/xtensa/short_branch_offset.s b/gas/testsuite/gas/xtensa/short_branch_offset.s
new file mode 100644
index 0000000..df2489f
--- /dev/null
+++ b/gas/testsuite/gas/xtensa/short_branch_offset.s
@@ -0,0 +1,24 @@
+ bnez.n a2, .Lplus68
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+ _nop
+.Lplus68: