public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Marking variable as addressable from within SSA pass
@ 2004-03-19 17:02 Bonzini
  2004-03-19 21:57 ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Bonzini @ 2004-03-19 17:02 UTC (permalink / raw)
  To: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 1347 bytes --]

Hi,

I am trying to implement vector operation lowering as an SSA pass.  The 
pass is similar to tree-complex; I work on tree-ssa, slightly modified to
use bsi's also at -O0 similar to what is done in the tree-profiling branch,
but this is ok (it bootstraps).

So far I made it work as a non-SSA pass which I run just before
expanding, but I would like to run it as well just after loop
optimization, so that dom can clean up the code it generates.

The pass takes, for example,

  V4QI T_1;
  V4QI T_2;
  V4QI T_3;
  T_3 = T_1 & T_2;

and converts it into

  V4QI T_1;
  V4QI T_2;
  V4QI T_3;
  unsigned int *T_4;
  unsigned int *T_5;
  unsigned int *T_6;
  unsigned int T_7;
  unsigned int T_8;
  T_4 = (unsigned int *) &T_1;  
  T_5 = (unsigned int *) &T_2;  
  T_6 = (unsigned int *) &T_3;  
  T_7 = *T_4;
  T_8 = *T_5;
  T_9 = T_4 & T_5;
  *T_6 = T_9;

I do tweak the alias sets of the unsigned int *Ã that I generate.  All
this mess should hopefully be cleaned up by dom -- indeed even CSE and
ADDRESSOF manage to clean most of it.

I am setting the TREE_ADDRESSABLE bit of T_1, T_2 and T_3 but it is not
enough.  During variable renaming, stmt_ann returns an error_mark and
then everything goes haywire until I get an ICE near note_addressable.
Is there anything more I should do to mark these variables as
addressable?

Thank you,

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-19 17:02 Marking variable as addressable from within SSA pass Bonzini
@ 2004-03-19 21:57 ` Richard Henderson
  2004-03-20 18:09   ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2004-03-19 21:57 UTC (permalink / raw)
  To: Bonzini; +Cc: gcc

On Fri, Mar 19, 2004 at 11:06:36AM -0500, Bonzini wrote:
> The pass takes, for example,
> 
>   V4QI T_1;
>   V4QI T_2;
>   V4QI T_3;
>   T_3 = T_1 & T_2;
> 
> and converts it into
> 
>   V4QI T_1;
>   V4QI T_2;
>   V4QI T_3;
>   unsigned int *T_4;
>   unsigned int *T_5;
>   unsigned int *T_6;
>   unsigned int T_7;
>   unsigned int T_8;
>   T_4 = (unsigned int *) &T_1;  
>   T_5 = (unsigned int *) &T_2;  
>   T_6 = (unsigned int *) &T_3;  
>   T_7 = *T_4;
>   T_8 = *T_5;
>   T_9 = T_4 & T_5;
>   *T_6 = T_9;

You do not want to do this.  Addressing variables SEVERELY pessimizes
the code.  Use a VIEW_CONVERT_EXPR to change the type instead.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-19 21:57 ` Richard Henderson
@ 2004-03-20 18:09   ` Paolo Bonzini
  2004-03-20 22:08     ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2004-03-20 18:09 UTC (permalink / raw)
  To: Richard Henderson, GCC Development

> You do not want to do this.  Addressing variables SEVERELY pessimizes
> the code.  Use a VIEW_CONVERT_EXPR to change the type instead.

I was hoping that DOM could clean up the code, and in this particular case
where I have a logical operation and it's as big as a machine register, yes, I
could do without addressing.

But if the operation is on a wide vector like a V2DI, or if I have something
different from a logical operation, I need to do something like an RTL SUBREG.
Currently I am doing like this:

    V4QI T_1, T_2, T_3;
    char *T_4, *T_5, *T_6, *T_7, *T_8, *T_9;
    char T_10, T_11, T_12;
    T_4 = (char *) &T_1;
    T_5 = (char *) &T_2;
    T_6 = (char *) &T_3;
    ...
    T_7 = T_4 + 3;
    T_8 = T_5 + 3;
    T_9 = T_6 + 3;
    T_10 = *T_7;
    T_11 = *T_8;
    T_12 = T_10 * T_11;
    *T_9 = T_12;

Paolo





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-20 18:09   ` Paolo Bonzini
@ 2004-03-20 22:08     ` Richard Henderson
  2004-03-21 18:17       ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2004-03-20 22:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: GCC Development

On Sat, Mar 20, 2004 at 09:00:40AM +0100, Paolo Bonzini wrote:
> But if the operation is on a wide vector like a V2DI, or if I have something
> different from a logical operation, I need to do something like an RTL SUBREG.

We need to invent something for this.  Do not use ADDR_EXPR.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-20 22:08     ` Richard Henderson
@ 2004-03-21 18:17       ` Paolo Bonzini
  2004-03-21 23:07         ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2004-03-21 18:17 UTC (permalink / raw)
  To: Richard Henderson; +Cc: GCC Development

> We need to invent something for this.  Do not use ADDR_EXPR.

Okay to use VIEW_CONVERT_EXPR to a struct containing an array (see
finish_vector in tree.c), and hope for SRA to do something?

Paolo



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-21 18:17       ` Paolo Bonzini
@ 2004-03-21 23:07         ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2004-03-21 23:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: GCC Development

On Sun, Mar 21, 2004 at 05:54:43PM +0100, Paolo Bonzini wrote:
> Okay to use VIEW_CONVERT_EXPR to a struct containing an array (see
> finish_vector in tree.c), and hope for SRA to do something?

No, we'll want to either use BIT_FIELD_REF or invent something
specific for vectors.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
  2004-03-19 22:06 Richard Kenner
@ 2004-03-19 22:09 ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2004-03-19 22:09 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

On Fri, Mar 19, 2004 at 03:11:28PM -0500, Richard Kenner wrote:
> Amusing that this tree code, originally viewed as Ada-specific, will
> find another use!

When we talked about it once upon a time, at that meeting at HP,
I envisioned using it generically for optimizing certain cases
of unions.  Havn't gotten around to implementing that for SRA,
but it's still on the to-do list.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Marking variable as addressable from within SSA pass
@ 2004-03-19 22:06 Richard Kenner
  2004-03-19 22:09 ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Kenner @ 2004-03-19 22:06 UTC (permalink / raw)
  To: rth; +Cc: gcc

    You do not want to do this.  Addressing variables SEVERELY pessimizes
    the code.  Use a VIEW_CONVERT_EXPR to change the type instead.

Amusing that this tree code, originally viewed as Ada-specific, will
find another use!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-03-21 19:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-19 17:02 Marking variable as addressable from within SSA pass Bonzini
2004-03-19 21:57 ` Richard Henderson
2004-03-20 18:09   ` Paolo Bonzini
2004-03-20 22:08     ` Richard Henderson
2004-03-21 18:17       ` Paolo Bonzini
2004-03-21 23:07         ` Richard Henderson
2004-03-19 22:06 Richard Kenner
2004-03-19 22:09 ` Richard Henderson

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).