This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch 0/5] nios2 address mode improvements
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 20 Oct 2017 10:56:56 +0200
- Subject: Re: [patch 0/5] nios2 address mode improvements
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 133C73E2D3
- References: <59E95981.4040306@codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Oct 19, 2017 at 08:03:45PM -0600, Sandra Loosemore wrote:
> A harder problem is that doing the high/lo_sum splitting in expand
> inhibits subsequent optimizations. One such problem arises when you
> have accesses to multiple fields in a static structure object. Expand
> sees this as many (symbol + offset) expressions involving the same
> symbol with different constant offsets. What we should be doing in
> that case is CSE'ing the symbol address computation rather than
> splitting every such expression individually.
Do you have the needed relocations for that though?
If not, then you need to do:
tmp = high (symbol);
tmp |= lo_sum (symbol); // or +
a = [tmp + 0];
b = [tmp + 4];
c = [tmp + 8];
if you do (like e.g. sparc64 has the %olo relocation), then you can do
tmp = high (symbol);
a = [tmp + lo_sum (symbol) + 0];
b = [tmp + lo_sum (symbol) + 4];
c = [tmp + lo_sum (symbol) + 8];
If you tried to do:
tmp = high (symbol);
a = [tmp + lo_sum (symbol)];
b = [tmp + lo_sum (symbol + 4)];
c = [tmp + lo_sum (symbol + 8)];
then this would break if lo_sum (symbol + 4) or lo_sum (symbol + 8)
is < 4.
Jakub