This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch pending review


Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:

> Hi,
> 
> this patch
> 
> <http://gcc.gnu.org/ml/gcc-patches/2000-11/msg00202.html>
> 
> hasn't been reviewed yet. It works fine and enables successful RTL checking
> bootstraps on powerpc-linux-gnu.

Thank you!

I was trying to work out why my patch, which changed it to:

;; Length (in bytes).
(define_attr "length" ""
  (if_then_else (eq_attr "type" "branch")
              (if_then_else (and (ge (minus (pc) (match_dup 0))
                                      (const_int -32768))
                                 (lt (minus (pc) (match_dup 0))
                                      (const_int 32764)))
                             (const_int 4)
                             (const_int 8))

wasn't working.

I believe the correct change is to make it

;; Length (in bytes).
; According to insn_current_reference_address, '(pc)' in the following means:
;   for a forward branch, the reference address is the end address of
;   the branch as known from the previous branch shortening pass,
;   minus a value to account for possible size increase due to
;   alignment.  For a backward branch, it is the start address of the
;   branch as known from the current pass, plus a value to account for
;   possible size increase due to alignment.
; so for forward branches, we need to subtract the size of the branch
; (which will be 4 if the branch is being shortened) from (pc), to get
; the start of the branch from which the branch offset will be
; relative.  This is accomplished by using 32764 rather than 32768 below.
(define_attr "length" ""
  (if_then_else (eq_attr "type" "branch")
              (if_then_else (and (ge (minus (match_dup 0) (pc))
                                      (const_int -32768))
                                 (lt (minus (match_dup 0) (pc))
                                      (const_int 32764)))
                             (const_int 4)
                             (const_int 8))

and drop the generic change.  (The generic change would break many
other ports.)  I'll test this and see how it goes.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]