This is the mail archive of the gcc-cvs@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]

r242289 - /branches/ARM/sve-branch/gcc/tree-ssa...


Author: rsandifo
Date: Fri Nov 11 17:34:30 2016
New Revision: 242289

URL: https://gcc.gnu.org/viewcvs?rev=242289&root=gcc&view=rev
Log:
Improve canonicalisation of TARGET_MEM_REFs

A general TARGET_MEM_REF is:

    BASE + SYMBOL + OFFSET + INDEX * STEP

which is supposed to be general enough for targets with complex
addresses like x86_64.  After classifying the address in this way,
the code that builds TARGET_MEM_REFs tries to simplify the address
until it is valid for the current target and for the mode of memory
being addressed.  It does this in a fixed order:

1. add INDEX * STEP to BASE, if STEP != 1
2. add SYMBOL to BASE
3. add INDEX to BASE
4. add OFFSET to BASE

This meant that if we had an invalid address:

  BASE + OFFSET + INDEX * 8

and BASE + OFFSET is also invalid, we'd create:

  tmp1 = INDEX * 8
  tmp2 = tmp1 + BASE
  tmp3 = tmp2 + OFFSET
  MEM[base:tmp3, offset:0]

without considering whether:

  tmp = BASE + OFFSET
  MEM[base:tmp + INDEX * 8, offset:0]

might be valid.

This meant that if ivopts tried to create an iv with base &a+8
or &a+32 and a multiplier of 8 on the step (to take advantage
of the INDEX * 8 mode that ivopts knows the target has),
we'd always treat the multiplication as a separate operation,
in a way that could never be folded into the address.

The patch avoids this by skipping (1) if BASE + INDEX * STEP
is a legitimate address.

Modified:
    branches/ARM/sve-branch/gcc/tree-ssa-address.c


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