Hans-Peter Nilsson schrieb:
Oleg Endo wrote:
Georg-Johann Lay wrote:
The change is definitely in the right direction, but I wonder
how it helps to fix code bloats of 300%-400% as in PR52543?
I'm not familiar with the AVR parts.
BTW, There was a small change in lower-subreg which required some
adaptations in targets:
http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00425.html

See also gcc/config/sh/sh.c (sh_rtx_costs): case SET: ...
Not sure whether it helps in your case.

Those kinds of changes are not required anymore (for most
targets), the fallback rtx_cost was amended to more sanely take
the mode-size into account, and to handle SET.  Whether that is
related to PR52543, I don't know.

Hi,

I found an older compiler version (4.7.1 prerelease) without the
"expand MEM as UNSPEC" hack, and compiled one test case from
PR52543:

long read1 (const __flash1 long *p)
{
    return *p;
}

with the following options

$ avr-gcc -mmcu=atmega128 -c foo.c -fdump-rtl-subreg1-details -fdump-rtl-jump-details -mlog=rtx_costs,address_cost -Os -std=gnu99 -dp -save-temps

The -mlog= option logs all results from the mentioned target hooks.

What I see is this:

- targetm.address_cost isn't even called once

- In .157r.jump the insn is fine, it reads SI from AS2:

(insn 6 3 7 2 (set (reg:SI 46)
(mem:SI (reg/v/f:HI 44 [ p ]) [2 *p_1(D)+0 S4 A8 AS2])) foo.c:10 26 {*movsi}
     (nil))

- In pass .158r.subreg1 this insn is split into 4 movqi.
  This costs 16 instructions instead of 6 without a split.
  Besides that the register pressure goes up.

- Costs for mem:QI/AS2 are called *after* subreg1 split the insn
  forst time from cse1.

- There is not a single call that tries to get the costs for
  mem:SI/AS2 moves

- The only calls that get costs for SI moves look like

avr_rtx_costs[:pass=?]=true (size) total=16, outer=set:
(mem:SI (reg:HI 38 virtual-stack-dynamic) [0 S4 A8])

This cost is for generic address space, not for AS2.
Besides that it calls the hook with the wrong optimization
(speed instead of size as requested by -Os)

Johann


Reply via email to