[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-12-05 Thread danglin at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #19 from John David Anglin  2012-12-06 
02:19:57 UTC ---

Author: danglin

Date: Thu Dec  6 02:19:48 2012

New Revision: 194238



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194238

Log:

Backport for mainline:

2011-11-30  John David Anglin  



PR middle-end/50283

* config/pa/pa.md (in_branch_delay): Disallow frame related insns.

(in_nullified_branch_delay): Likewise.

(in_call_delay): Likewise.



2012-11-12  John David Anglin  



PR target/55195

* config/pa/pa.md (type): Add sibcall and sh_func_adrs insn types.

(in_branch_delay): Don't allow sibcall or sh_func_adrs insns.

(in_nullified_branch_delay): Likewise.

(in_call_delay): Likewise.

Define delay for sibcall insns.  Adjust Z3 and Z4 insn reservations for

new types.  Add opaque cond to mark all calls, sibcalls, dyncalls and

the $$sh_func_adrs call as variable.  Update type of sibcalls and

$$sh_func_adrs call.

* config/pa/pa.c (pa_adjust_insn_length): Revise to return updated

length instead of adjustment.  Handle negative and undefined call

adjustments for insn_default_length.  Remove adjustment for millicode

insn with unfilled delay slot.

(pa_output_millicode_call): Update for revised millicode length.

* config/pa/pa.h (ADJUST_INSN_LENGTH): Revise to set LENGTH.



2012-12-05  John David Anglin  



* config/pa/pa.md: Use "const_int 0" instead of match_test to simplify

opaque cond in all call insns.





Modified:

branches/gcc-4_6-branch/gcc/ChangeLog

branches/gcc-4_6-branch/gcc/config/pa/pa.c

branches/gcc-4_6-branch/gcc/config/pa/pa.h

branches/gcc-4_6-branch/gcc/config/pa/pa.md


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-12-01 Thread danglin at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #18 from John David Anglin  2012-12-01 
20:36:08 UTC ---

Author: danglin

Date: Sat Dec  1 20:36:04 2012

New Revision: 194027



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194027

Log:

Backport from mainline:

2012-11-12  John David Anglin  



PR target/55195

* config/pa/pa.md (type): Add sibcall and sh_func_adrs insn types.

(in_branch_delay): Don't allow sibcall or sh_func_adrs insns.

(in_nullified_branch_delay): Likewise.

(in_call_delay): Likewise.

Define delay for sibcall insns.  Adjust Z3 and Z4 insn reservations for

new types.  Add opaque cond to mark all calls, sibcalls, dyncalls and

the $$sh_func_adrs call as variable.  Update type of sibcalls and

$$sh_func_adrs call.

* config/pa/pa.c (pa_adjust_insn_length): Revise to return updated

length instead of adjustment.  Handle negative and undefined call

adjustments for insn_default_length.  Remove adjustment for millicode

insn with unfilled delay slot.

(pa_output_millicode_call): Update for revised millicode length.

* config/pa/pa.h (ADJUST_INSN_LENGTH): Revise to set LENGTH.





Modified:

branches/gcc-4_7-branch/gcc/ChangeLog

branches/gcc-4_7-branch/gcc/config/pa/pa.c

branches/gcc-4_7-branch/gcc/config/pa/pa.h

branches/gcc-4_7-branch/gcc/config/pa/pa.md


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-12 Thread danglin at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



John David Anglin  changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 Resolution||FIXED



--- Comment #17 from John David Anglin  2012-11-13 
01:11:01 UTC ---

Fixed on trunk


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-12 Thread danglin at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #16 from John David Anglin  2012-11-13 
00:37:01 UTC ---

Author: danglin

Date: Tue Nov 13 00:36:54 2012

New Revision: 193464



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193464

Log:

PR target/55195

* config/pa/pa.md (type): Add sibcall and sh_func_adrs insn types.

(in_branch_delay): Don't allow sibcall or sh_func_adrs insns.

(in_nullified_branch_delay): Likewise.

(in_call_delay): Likewise.

Define delay for sibcall insns.  Adjust Z3 and Z4 insn reservations for

new types.  Add opaque cond to mark all calls, sibcalls, dyncalls and

the $$sh_func_adrs call as variable.  Update type of sibcalls and

$$sh_func_adrs call.

* config/pa/pa.c (pa_adjust_insn_length): Revise to return updated

length instead of adjustment.  Handle negative and undefined call

adjustments for insn_default_length.  Remove adjustment for millicode

insn with unfilled delay slot.

(pa_output_millicode_call): Update for revised millicode length.

* config/pa/pa.h (ADJUST_INSN_LENGTH): Revise to set LENGTH.





Modified:

trunk/gcc/ChangeLog

trunk/gcc/config/pa/pa.c

trunk/gcc/config/pa/pa.h

trunk/gcc/config/pa/pa.md


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-04 Thread amylaar at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #8 from Jorn Wolfgang Rennecke  
2012-11-05 02:32:35 UTC ---

(In reply to comment #7)



> In some sense, this seems like a hack which might be optimized by an

> attribute processor.  What about a way to mark length attributes as  

> variable?



That would be nice, and pretty straightforward to code, but we seem short of

generator program patches reviewers now.



Note, I don't think there is any valid reason for the attribute processor

to look inside a match_test; if it was something that the generators were

supposed to understand, we should have rtl syntax for it.


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-04 Thread dave.anglin at bell dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #7 from dave.anglin at bell dot net 2012-11-04 23:50:44 UTC ---

On 4-Nov-12, at 12:31 PM, amylaar at gcc dot gnu.org wrote:



> Such a length attribute is not considered variable by  

> shorten_branches.

>

> You need to include a clause that is directly in the attribute, e.g.

> (and (match_test "0") (eq (match_dup 0) (pc)))





In some sense, this seems like a hack which might be optimized by an

attribute processor.  What about a way to mark length attributes as  

variable?



Dave

--

John David Anglindave.ang...@bell.net


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-04 Thread dave.anglin at bell dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #6 from dave.anglin at bell dot net 2012-11-04 22:23:04 UTC ---

On 4-Nov-12, at 12:31 PM, amylaar at gcc dot gnu.org wrote:



> The instruction call_symref_pic_post_reload has the following length

> attribute setting:

>

> (set (attr "length") (symbol_ref "pa_attr_length_call (insn, 0)"))

>

> Such a length attribute is not considered variable by  

> shorten_branches.

>

> You need to include a clause that is directly in the attribute, e.g.

> (and (match_test "0") (eq (match_dup 0) (pc)))





Thanks Jorn for debugging this.



Dave

--

John David Anglindave.ang...@bell.net


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-04 Thread amylaar at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



--- Comment #5 from Jorn Wolfgang Rennecke  
2012-11-04 17:34:47 UTC ---

Created attachment 28613

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28613

here is a proof-of-concept patch that allows the offending file to assemble

successfully.


[Bug target/55195] [4.8 Regression] shorten_branches generates incorrect forward branch distances

2012-11-04 Thread amylaar at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55195



Jorn Wolfgang Rennecke  changed:



   What|Removed |Added



 CC||law at redhat dot com

  Component|middle-end  |target



--- Comment #4 from Jorn Wolfgang Rennecke  
2012-11-04 17:31:52 UTC ---

(In reply to comment #3)

In the ccA1Vjgkjx.234r.shorten dump file,

between L19464 and L19463, there is but one call instruction, a basic block

start, a barrier, and some 600 NOTE_INSN_VAR_LOCATION:



(code_label 4141 28778 2472 19464 "" [1 uses])

(note 2472 4141 3318 [bb 311] NOTE_INSN_BASIC_BLOCK)

(call_insn:TI 3318 2472 3319 (parallel [

(call (mem:SI (symbol_ref/v:SI ("@_Jv_ThrowBadArrayIndex") [flags

0x241]  ) [0 S4 A32])

(const_int 16 [0x10]))

(clobber (reg:SI 1 %r1))

(clobber (reg:SI 2 %r2))

(use (reg:SI 19 %r19))

(use (const_int 0 [0]))

])

/ssd/synopsys/arc_gnu_4.8-r192641/gcc-4.8/libjava/classpath/gnu/java/nio/charset/MacSymbol.java:73

198 {*call_symref_pic_post_reload}

 (expr_list:REG_DEAD (reg:SI 26 %r26)

(expr_list:REG_DEAD (reg:SI 19 %r19)

(expr_list:REG_NORETURN (const_int 0 [0])

(nil

(expr_list:REG_CC_SETTER (use (reg:SI 26 %r26))

(nil)))

(barrier 3319 3318 28981)

(note 28981 3319 28980 (nil) NOTE_INSN_CALL_ARG_LOCATION)

...



(note 29183 29182 4140 (var_location D.16611 (nil)) NOTE_INSN_VAR_LOCATION)

(code_label 4140 29183 2459 19463 "" [1 uses])



The instruction call_symref_pic_post_reload has the following length

attribute setting:



(set (attr "length") (symbol_ref "pa_attr_length_call (insn, 0)"))



Such a length attribute is not considered variable by shorten_branches.



You need to include a clause that is directly in the attribute, e.g.

(and (match_test "0") (eq (match_dup 0) (pc)))