public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: richard.guenther@gmail.com (Richard Guenther)
Cc: ira.rosen@linaro.org (Ira Rosen),
	gcc-patches@gcc.gnu.org,
	       patches@linaro.org (Patch Tracking)
Subject: Re: [patch] Fix PR tree-optimization/49771
Date: Mon, 25 Jul 2011 14:54:00 -0000	[thread overview]
Message-ID: <201107251423.p6PENG4Y023392@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <CAFiYyc0uvTMR4i=sUQE6Mz+JgpCdJc4uhsriWN8T-yOfJMJ0jA@mail.gmail.com> from "Richard Guenther" at Jul 25, 2011 04:07:40 PM

Richard Guenther wrote:

> > Btw, as pseudos do not have a single def site how can the above
> > ever be correct in the face of coalescing?

I had always understood this to reflect the simple fact that a
pointer to some type must never hold a value that is not properly
aligned for that type.  (Maybe this is only true on STRICT_ALIGNMENT
targets?)   This has always been an important property to generate
good code on SPU ...

> > For example on trees we can have
> >
> >  p_1 = &a; // align 256
> >  p_2 = p_1 + 4; // align 32
> >
> > but we'll coalesce the thing and thus would have to use the weaker
> > alignment of both SSA names.  expand_one_register_var expands
> > the decl, not the SSA name, so using get_pointer_alignment on
> > the decl would probably be fine, though also pointless as it always
> > will return 8.
> >
> > At least I don't see any code that would prevent a temporary variable
> > of type int * of being coalesced with a temporary variable of type vector
> > int *.

I don't really understand the coalesce code, but in the above sample,
the two variables must have the same type, otherwise there'd have to
be a cast somewhere.  Does coalesce eliminate casts?

> > Why should REGNO_POINTER_ALIGN be interesting to anyone?
> > Proper alignment information is (should be) attached to every
> > MEM already.
> 
> nonzero_bits1 seems to be the only consumer of REGNO_POINTER_ALIGN
> apart from maybe alpha.c and spu.c.
> 
> We should simply kill REGNO_POINTER_ALIGN IMHO.

On the SPU at least, REGNO_POINTER_ALIGN carries additional information
over just the MEM alignment.  Say, I'm getting a MEM the form
(mem (plus (reg X) (reg Y))), and the MEM is aligned to 32 bits.

This means I need to generate a rotate to fix up the value that was
loaded by the (forced aligned) load instruction.  However, the form
of this rotate can be simpler if I know that e.g. reg X is always
guaranteed to be 128-bits aligned and only reg Y introduces the
potential misalignment.  If on the other hand neither of the base
registers is guaranteed to be 128-bit aligned, I need to generate
more complex rotate code ...

I understand this may also be important on other platforms, e.g.
to choose which register to use as base and which as index in a
memory operation ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2011-07-25 14:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19  8:24 Ira Rosen
2011-07-19  9:49 ` Richard Guenther
2011-07-19 14:01   ` Ira Rosen
2011-07-19 14:03     ` Richard Guenther
2011-07-20 19:47 ` Ulrich Weigand
2011-07-21 12:54   ` Ira Rosen
2011-07-24 14:32     ` Ira Rosen
2011-07-24 18:46       ` Richard Guenther
2011-07-25  9:44         ` Ulrich Weigand
2011-07-25 10:08           ` Richard Guenther
2011-07-25 11:26             ` Ira Rosen
2011-07-25 11:41               ` Richard Guenther
2011-07-25 12:33                 ` Ira Rosen
2011-07-25 13:01                   ` Richard Guenther
2011-07-25 13:07                     ` Richard Guenther
2011-07-25 13:47                       ` Ulrich Weigand
2011-07-25 14:01                         ` Richard Guenther
2011-07-25 14:10                           ` Richard Guenther
2011-07-25 14:14                             ` Richard Guenther
2011-07-25 14:54                               ` Ulrich Weigand [this message]
2011-07-25 14:59                                 ` Richard Guenther
2011-07-25 16:12                                   ` Ulrich Weigand
2011-07-26  8:25                                     ` Richard Guenther
2011-07-26  8:59                                       ` Andrew Pinski
2011-07-26 14:23                                       ` Ulrich Weigand
2011-07-26 14:25                                         ` Michael Matz
2011-07-26 16:18                                           ` Merge alignments from coalesced SSA pointers Michael Matz
2011-07-26 17:23                                             ` Michael Matz
2011-08-08 16:34                                               ` Ulrich Weigand
2011-08-09 12:01                                                 ` Michael Matz
2011-08-12 16:41                                                   ` [rfa] Set alignment of pseudos via get_pointer_alignment Michael Matz
2011-08-12 22:53                                                     ` Richard Guenther
2011-08-23 15:04                                                       ` Michael Matz
2011-07-26 17:28                                             ` Merge alignments from coalesced SSA pointers Ulrich Weigand
2011-07-27  9:13                                               ` Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107251423.p6PENG4Y023392@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ira.rosen@linaro.org \
    --cc=patches@linaro.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).