public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc4.0 autovect-branch
@ 2004-12-17 16:48 Villemin Ryusuke
  2004-12-17 17:04 ` Daniel Berlin
  2004-12-17 18:17 ` Devang Patel
  0 siblings, 2 replies; 6+ messages in thread
From: Villemin Ryusuke @ 2004-12-17 16:48 UTC (permalink / raw)
  To: gcc-help

Hi,

I might be missing something simple and obvious, but I can't find out what :
I picked up gcc4.0 in the autovect-branch, compiled it successfully but can t make it vectorize anything.

int a[256], b[256], c[256];

foo () {
  int i;
  for (i=0; i<256; i++){
    a[i] = b[i] + c[i];
  }
}

compiled with :
"gcc -O2 -msse2 -ftree-vectorize -fdump-tree-vect-stats vecto.c".

I expect to see a "LOOP VECTORIZED." (or at least "not vectorized:"), but I have nothing...

Any ideas ?

Thank you,

-- 
Ryusuke "Pazoo" VILLEMIN                      mailto:ryu@buf.com
Buf Compagnie                                 http://www.buf.com

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

* Re: gcc4.0 autovect-branch
  2004-12-17 16:48 gcc4.0 autovect-branch Villemin Ryusuke
@ 2004-12-17 17:04 ` Daniel Berlin
  2004-12-17 18:17 ` Devang Patel
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Berlin @ 2004-12-17 17:04 UTC (permalink / raw)
  To: Villemin Ryusuke; +Cc: gcc-help

On Fri, 2004-12-17 at 17:47 +0100, Villemin Ryusuke wrote:
> Hi,
> 
> I might be missing something simple and obvious, but I can't find out what :
> I picked up gcc4.0 in the autovect-branch, compiled it successfully but can t make it vectorize anything.
> 
> int a[256], b[256], c[256];
> 
> foo () {
>   int i;
>   for (i=0; i<256; i++){
>     a[i] = b[i] + c[i];
>   }
> }
> 
> compiled with :
> "gcc -O2 -msse2 -ftree-vectorize -fdump-tree-vect-stats vecto.c".
> 
> I expect to see a "LOOP VECTORIZED." (or at least "not vectorized:"), but I have nothing...
> 
> Any ideas ?
> 
I get

;; Function foo (foo)


loop at /home/dberlin/vect.c:7: if (ivtmp.23_38 < 64) goto <L5>; else
goto <L2>;
loop at /home/dberlin/vect.c:7: LOOP VECTORIZED.



in the dump file for the vectorizer.

What do you see?


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

* Re: gcc4.0 autovect-branch
  2004-12-17 16:48 gcc4.0 autovect-branch Villemin Ryusuke
  2004-12-17 17:04 ` Daniel Berlin
@ 2004-12-17 18:17 ` Devang Patel
  2004-12-17 18:56   ` Daniel Berlin
  1 sibling, 1 reply; 6+ messages in thread
From: Devang Patel @ 2004-12-17 18:17 UTC (permalink / raw)
  To: Villemin Ryusuke; +Cc: gcc-help


On Dec 17, 2004, at 8:47 AM, Villemin Ryusuke wrote:

> Hi,
>
> I might be missing something simple and obvious, but I can't find out 
> what :
> I picked up gcc4.0 in the autovect-branch, compiled it successfully 
> but can t make it vectorize anything.
>
> int a[256], b[256], c[256];
>
> foo () {
>   int i;
>   for (i=0; i<256; i++){
>     a[i] = b[i] + c[i];
>   }
> }
>
> compiled with :
> "gcc -O2 -msse2 -ftree-vectorize -fdump-tree-vect-stats vecto.c".

Compiler is able to vectorize this loop on powerpc-darwin.

> I expect to see a "LOOP VECTORIZED." (or at least "not vectorized:"), 
> but I have nothing...

Do you see vecto.c.t53.vect ? What does it say?
If you do not see vecto.c.t53.vect then somehow vectorizer is not 
triggered.

-
Devang

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

* Re: gcc4.0 autovect-branch
  2004-12-17 18:17 ` Devang Patel
@ 2004-12-17 18:56   ` Daniel Berlin
  2004-12-20 14:07     ` Villemin Ryusuke
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Berlin @ 2004-12-17 18:56 UTC (permalink / raw)
  To: Devang Patel; +Cc: Villemin Ryusuke, gcc-help

On Fri, 2004-12-17 at 10:16 -0800, Devang Patel wrote:
> On Dec 17, 2004, at 8:47 AM, Villemin Ryusuke wrote:
> 
> > Hi,
> >
> > I might be missing something simple and obvious, but I can't find out 
> > what :
> > I picked up gcc4.0 in the autovect-branch, compiled it successfully 
> > but can t make it vectorize anything.
> >
> > int a[256], b[256], c[256];
> >
> > foo () {
> >   int i;
> >   for (i=0; i<256; i++){
> >     a[i] = b[i] + c[i];
> >   }
> > }
> >
> > compiled with :
> > "gcc -O2 -msse2 -ftree-vectorize -fdump-tree-vect-stats vecto.c".
> 
> Compiler is able to vectorize this loop on powerpc-darwin.
> 
> > I expect to see a "LOOP VECTORIZED." (or at least "not vectorized:"), 
> > but I have nothing...
> 
> Do you see vecto.c.t53.vect ? What does it say?
> If you do not see vecto.c.t53.vect then somehow vectorizer is not 
> triggered.
> 
> -
> Devang

I get the feeling he expected it to print something to stderr/stdout,
like intel's compiler does if you tell it to vectorize, and that this is
what he thought the dump option did.

Villemin, this is not the case.
-fdump-tree-<passname> will produce a <sourcename>.t<pass
number>.<passname>  dumpfile that contains dumps from that pass.

*That* is where the LOOP VECTORIZED text will be printed.
--Dan

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

* Re: gcc4.0 autovect-branch
  2004-12-17 18:56   ` Daniel Berlin
@ 2004-12-20 14:07     ` Villemin Ryusuke
  2004-12-20 15:50       ` Daniel Berlin
  0 siblings, 1 reply; 6+ messages in thread
From: Villemin Ryusuke @ 2004-12-20 14:07 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Devang Patel, gcc-help

Thank you for your reply!
I was expecting an output like icc, so I checked the assembler code file ("-S") but didn t see any vector instruction...

It was because I declared my arrays local to the foo function:

foo () {
 float a[256], b[256], c[256];
 int i;
 for (i=0; i<256; i++){
  a[i] = b[i] + c[i];
 }
}

the vect output is :
loop at vecto.c:9: not vectorized: unsupported data-type

vectorized 0 loops in function.
...



On Fri, 17 Dec 2004 13:55:49 -0500
Daniel Berlin <dberlin@dberlin.org> wrote:

> On Fri, 2004-12-17 at 10:16 -0800, Devang Patel wrote:
> > On Dec 17, 2004, at 8:47 AM, Villemin Ryusuke wrote:
> > 
> > > Hi,
> > >
> > > I might be missing something simple and obvious, but I can't find out 
> > > what :
> > > I picked up gcc4.0 in the autovect-branch, compiled it successfully 
> > > but can t make it vectorize anything.
> > >
> > > int a[256], b[256], c[256];
> > >
> > > foo () {
> > >   int i;
> > >   for (i=0; i<256; i++){
> > >     a[i] = b[i] + c[i];
> > >   }
> > > }
> > >
> > > compiled with :
> > > "gcc -O2 -msse2 -ftree-vectorize -fdump-tree-vect-stats vecto.c".
> > 
> > Compiler is able to vectorize this loop on powerpc-darwin.
> > 
> > > I expect to see a "LOOP VECTORIZED." (or at least "not vectorized:"), 
> > > but I have nothing...
> > 
> > Do you see vecto.c.t53.vect ? What does it say?
> > If you do not see vecto.c.t53.vect then somehow vectorizer is not 
> > triggered.
> > 
> > -
> > Devang
> 
> I get the feeling he expected it to print something to stderr/stdout,
> like intel's compiler does if you tell it to vectorize, and that this is
> what he thought the dump option did.
> 
> Villemin, this is not the case.
> -fdump-tree-<passname> will produce a <sourcename>.t<pass
> number>.<passname>  dumpfile that contains dumps from that pass.
> 
> *That* is where the LOOP VECTORIZED text will be printed.
> --Dan


-- 
Ryusuke "Pazoo" VILLEMIN                      mailto:ryu@buf.com
Buf Compagnie                                 http://www.buf.com

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

* Re: gcc4.0 autovect-branch
  2004-12-20 14:07     ` Villemin Ryusuke
@ 2004-12-20 15:50       ` Daniel Berlin
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Berlin @ 2004-12-20 15:50 UTC (permalink / raw)
  To: Villemin Ryusuke; +Cc: Devang Patel, gcc-help



On Mon, 20 Dec 2004, Villemin Ryusuke wrote:

> Thank you for your reply!
> I was expecting an output like icc, so I checked the assembler code file 
> ("-S") but didn t see any vector instruction...

we've meant to add a flag to output info like icc does when compiling, and 
we have the info to do so, it's just nobody actually went and did it :)

>
> It was because I declared my arrays local to the foo function:
>
> foo () {
> float a[256], b[256], c[256];
> int i;
> for (i=0; i<256; i++){
>  a[i] = b[i] + c[i];
> }
> }
>
> the vect output is :
> loop at vecto.c:9: not vectorized: unsupported data-type
>
You never use the results, so we delete the computations when they are 
local.

Thus, the reason it's not vectorizing is because there is nothing left to 
vectorize.
Your loop looks like this by that point:

foo () {
int i;
for (i = 0; i < 256; i++) {
}
}

If you add another loop or something that uses the value of a[i], so that 
it's actually needed, you'll see we vectorize the loop.

for example, add

   for (i=0; i<256; i++)
         printf ("%f\n", a[i]);

and we'll vectorize your loop.

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

end of thread, other threads:[~2004-12-20 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 16:48 gcc4.0 autovect-branch Villemin Ryusuke
2004-12-17 17:04 ` Daniel Berlin
2004-12-17 18:17 ` Devang Patel
2004-12-17 18:56   ` Daniel Berlin
2004-12-20 14:07     ` Villemin Ryusuke
2004-12-20 15:50       ` Daniel Berlin

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