aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2001-01-15 16:17:08 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2001-01-15 16:17:08 +0000
commit6c98269caade6f1688dce794bffaf3f5bcfb7463 (patch)
tree079a5b2826eac27935426b6909a01d0d7505244b /gcc
parentb3c5b2be07540878bc999983433ae8b81aad8561 (diff)
downloadgcc-6c98269caade6f1688dce794bffaf3f5bcfb7463.zip
gcc-6c98269caade6f1688dce794bffaf3f5bcfb7463.tar.gz
gcc-6c98269caade6f1688dce794bffaf3f5bcfb7463.tar.bz2
arm.md (cbranchsi4): Correct calculation of branch ranges.
* arm.md (cbranchsi4): Correct calculation of branch ranges. (negated_cbranchsi4): Likewise. From-SVN: r39039
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/arm/arm.md25
2 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1fb8a66..c70dc0a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2001-01-15 Richard Earnshaw <rearnsha@arm.com>
+ * arm.md (cbranchsi4): Correct calculation of branch ranges.
+ (negated_cbranchsi4): Likewise.
+
+2001-01-15 Richard Earnshaw <rearnsha@arm.com>
+
* config/arm/semi.h (SUBTARGET_EXTRA_SPECS): Define.
(SUBTARGET_EXTRA_ASM_SPEC): Define to empty string.
(ASM_SPEC): Call subtarget_extra_asm_spec. Don't
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index f7d4e6d..103d5ad 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -5520,7 +5520,22 @@
-;; Comapre & branch insns
+;; Compare & branch insns
+;; The range calcualations are based as follows:
+;; For forward branches, the address calculation returns the address of
+;; the next instruction. This is 2 beyond the branch instruction.
+;; For backward branches, the address calculation returns the address of
+;; the first instruction in this pattern (cmp). This is 2 before the branch
+;; instruction for the shortest sequence, and 4 before the branch instruction
+;; if we have to jump around an unconditional branch.
+;; To the basic branch range the PC offset must be added (this is +4).
+;; So for forward branches we have
+;; (pos_range - pos_base_offs + pc_offs) = (pos_range - 2 + 4).
+;; And for backward branches we have
+;; (neg_range - neg_base_offs + pc_offs) = (neg_range - (-2 or -4) + 4).
+;;
+;; For a 'b' pos_range = 2046, neg_range = -2048 giving (-2040->2048).
+;; For a 'b<cond>' pos_range = 254, neg_range = -256 giving (-250 ->256).
(define_insn "cbranchsi4"
[(set (pc)
@@ -5552,7 +5567,7 @@
(const_int 4)
(if_then_else
(and (ge (minus (match_dup 3) (pc)) (const_int -2040))
- (le (minus (match_dup 3) (pc)) (const_int 2054)))
+ (le (minus (match_dup 3) (pc)) (const_int 2048)))
(const_int 6)
(const_int 8))))]
)
@@ -5583,11 +5598,11 @@
(set (attr "length")
(if_then_else
(and (ge (minus (match_dup 3) (pc)) (const_int -250))
- (le (minus (match_dup 3) (pc)) (const_int 254)))
+ (le (minus (match_dup 3) (pc)) (const_int 256)))
(const_int 4)
(if_then_else
- (and (ge (minus (match_dup 3) (pc)) (const_int -2044))
- (le (minus (match_dup 3) (pc)) (const_int 2044)))
+ (and (ge (minus (match_dup 3) (pc)) (const_int -2040))
+ (le (minus (match_dup 3) (pc)) (const_int 2048)))
(const_int 6)
(const_int 8))))]
)