Fix off by one negative offsets for conditional branches.
authorNick Clifton <nickc@redhat.com>
Fri, 12 Nov 2004 12:27:05 +0000 (12:27 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 12 Nov 2004 12:27:05 +0000 (12:27 +0000)
Add a test of this fix.

gas/ChangeLog
gas/config/tc-mn10300.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mn10300/relax.d [new file with mode: 0644]
gas/testsuite/gas/mn10300/relax.s [new file with mode: 0644]

index c2ade55e28749fa856a2c3f8610e3f073ff67486..bda1a36c2302a0f7d429abafeb5309044c0aefce 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-12  Nick Clifton  <nickc@redhat.com>
+
+       * config/tc-mn10300.c (md_relax_table): Fix off by one negative
+       offsets for conditional branches.
+
 2004-11-11  Bob Wilson  <bob.wilson@acm.org>
 
        * config/tc-xtensa.c (MAX_IMMED6): Change value to 65.
index ea5b533dec10d0271fcee9b33a58cd2daf492718..e2fcf75aa31241023ae86e03fa772915a802d9dd 100644 (file)
@@ -57,12 +57,12 @@ const char FLT_CHARS[] = "dD";
 const relax_typeS md_relax_table[] = {
   /* bCC relaxing  */
   {0x7f, -0x80, 2, 1},
-  {0x7fff, -0x8000, 5, 2},
+  {0x7fff, -0x8000 + 1, 5, 2},
   {0x7fffffff, -0x80000000, 7, 0},
 
   /* bCC relaxing (uncommon cases)  */
   {0x7f, -0x80, 3, 4},
-  {0x7fff, -0x8000, 6, 5},
+  {0x7fff, -0x8000 + 1, 6, 5},
   {0x7fffffff, -0x80000000, 8, 0},
 
   /* call relaxing  */
@@ -80,7 +80,7 @@ const relax_typeS md_relax_table[] = {
 
   /* fbCC relaxing  */
   {0x7f, -0x80, 3, 14},
-  {0x7fff, -0x8000, 6, 15},
+  {0x7fff, -0x8000 + 1, 6, 15},
   {0x7fffffff, -0x80000000, 8, 0},
 
 };
index b5c94fc4b3ca3889583681caeb559b84a146d662..9de9798c603c5991e44e84ce94208956eff9db2e 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-12  Nick Clifton  <nickc@redhat.com>
+
+       * gas/mn10300/basic.exp: Add relax test.
+       * gas/mn10300/relax.s: New test.
+       * gas/mn10300/relax.d: Expected results.  Make sure that the
+       correct size of instruction has been selected.
+
 2004-11-11  Bob Wilson  <bob.wilson@acm.org>
 
        * gas/xtensa/short_branch_offset.s: New.
diff --git a/gas/testsuite/gas/mn10300/relax.d b/gas/testsuite/gas/mn10300/relax.d
new file mode 100644 (file)
index 0000000..069e8b6
--- /dev/null
@@ -0,0 +1,17 @@
+#objdump: -r 
+#name: Relaxation of conditional branches
+
+.*: +file format.*elf32-[am33lin|mn10300].*
+
+RELOCATION RECORDS FOR \[.rlcb\]:
+OFFSET   TYPE              VALUE 
+0+8003 R_MN10300_PCREL8  .L0._0\+0x00000001
+0+8005 R_MN10300_PCREL32  .L2\+0x00000001
+
+
+RELOCATION RECORDS FOR \[.rsflb\]:
+OFFSET   TYPE              VALUE 
+0+8004 R_MN10300_PCREL8  .L0._1\+0x00000002
+0+8006 R_MN10300_PCREL32  .L4\+0x00000001
+
+
diff --git a/gas/testsuite/gas/mn10300/relax.s b/gas/testsuite/gas/mn10300/relax.s
new file mode 100644 (file)
index 0000000..2ef3f60
--- /dev/null
@@ -0,0 +1,32 @@
+       .am33_2
+       
+       .section .rlcb, "ax"
+       .global relax_long_cond_branch
+relax_long_cond_branch:
+       clr d0
+       clr d1
+.L2:
+       add d1,d0
+       inc d1
+
+       .fill 32764, 1, 0xcb
+
+       cmp 9,d1
+       ble .L2
+       rets
+       
+
+       .section .rsflb, "ax"
+       .global relax_long_float_cond_branch
+relax_long_float_cond_branch:
+       clr d0
+       clr d1
+.L4:
+       add d1,d0
+       inc d1
+
+       .fill 32764, 1, 0xcb
+
+       cmp 9,d1
+       fble .L4
+       rets
This page took 0.036486 seconds and 4 git commands to generate.