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]
Other format: [Raw text]

Re: [patch 0/5] nios2 address mode improvements


On 10/20/2017 02:56 AM, Jakub Jelinek wrote:
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.

No, nothing that sophisticated -- I'm aiming to produce the first of your three choices. I just want to avoid producing 3 different high/lo_sum pairs here, which is what the unpatched nios2 backend does. :-(

-Sandra


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