aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJie Zhang <jie.zhang@analog.com>2005-05-19 08:42:26 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2005-05-19 08:42:26 +0000
commita2391c6a3515ecf759f126ba37851b02122c8525 (patch)
tree08a2133a6f473c19f7d779c63f7f942c161074cd
parent389c6c8b5b9e67ed40847e3052a12a87b12e9bef (diff)
downloadgcc-a2391c6a3515ecf759f126ba37851b02122c8525.zip
gcc-a2391c6a3515ecf759f126ba37851b02122c8525.tar.gz
gcc-a2391c6a3515ecf759f126ba37851b02122c8525.tar.bz2
bfin.c (branch_dest): Add comment why it's necessary.
* config/bfin/bfin.c (branch_dest): Add comment why it's necessary. * config/bfin/bfin.md (attr "length" default): Change the offset of forward conditional branch of length 4 from 4096 to 4092. Co-Authored-By: Bernd Schmidt <bernd.schmidt@analog.com> From-SVN: r99966
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/bfin/bfin.c5
-rw-r--r--gcc/config/bfin/bfin.md6
3 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4722b92..9511f56 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2005-05-18 Jie Zhang <jie.zhang@analog.com>
+ Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.c (branch_dest): Add comment why it's
+ necessary.
+ * config/bfin/bfin.md (attr "length" default): Change the offset of
+ forward conditional branch of length 4 from 4096 to 4092.
+
2005-05-19 Jan Beulich <jbeulich@novell.com>
* unwind-compat.c: Include tconfig.h and tsystem.h.
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a9b59f2..653c200 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -1751,7 +1751,10 @@ override_options (void)
flag_schedule_insns = 0;
}
-/* Return the destination address of BRANCH. */
+/* Return the destination address of BRANCH.
+ We need to use this instead of get_attr_length, because the
+ cbranch_with_nops pattern conservatively sets its length to 6, and
+ we still prefer to use shorter sequences. */
static int
branch_dest (rtx branch)
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index f0ff33f..986e649e 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -173,7 +173,9 @@
;;; if cc jmp; jump.[sl] offset
;;; offset of jump.[sl] is from the jump instruction but
;;; gcc calculates length from the if cc jmp instruction
-;;; hence our range is (-4094, 4096) instead of (-4096, 4094) for a br
+;;; furthermore gcc takes the end address of the branch instruction
+;;; as (pc) for a forward branch
+;;; hence our range is (-4094, 4092) instead of (-4096, 4094) for a br
;;;
;;; The way the (pc) rtx works in these calculations is somewhat odd;
;;; for backward branches it's the address of the current instruction,
@@ -210,7 +212,7 @@
(ge (minus (match_dup 3) (pc)) (const_int -1024)))
(const_int 2)
(and
- (le (minus (match_dup 3) (pc)) (const_int 4096))
+ (le (minus (match_dup 3) (pc)) (const_int 4092))
(ge (minus (match_dup 3) (pc)) (const_int -4094)))
(const_int 4)]
(const_int 6))