public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
To: Devang Patel <dpatel@apple.com>
Cc: "gcc@gcc.gnu.org list" <gcc@gcc.gnu.org>,
	Jason Merrill <jason@redhat.com>,
	Dorit Naishlos <DORIT@il.ibm.com>,
	Richard Henderson <rth@redhat.com>,
	Diego Novillo <dnovillo@redhat.com>
Subject: Re: [lno] [RFC] if-conversion and auto vectorizer
Date: Sat, 13 Mar 2004 09:24:00 -0000	[thread overview]
Message-ID: <20040313092438.GA6767@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <415253BF-7455-11D8-A347-000393A91CAA@apple.com>

Hello,

> OK. So far I have coded transformation to transform
> 
> bar ()
> {
>   int A[N+1], B[N+1], C[N+1], D[N+1];
>   int i;
> 
>   for (i = 1; i<N; i++)
>     {
>       if (A[i] > 0)
>         {
>           A[i] = A[i] + C[i];
>           B[i] = A[i] + 1;
>         }
>       else
>         {
>           A[i] = D[i];
>           B[i] = D[i] + 1;
>         }
>     }
>   ibar(A);
>   ibar(B);
> }
> 
> into :
> 
> bar ()
> {
>   int i;
>   int D[17];
>   int C[17];
>   int B[17];
>   int A[17];
>   int T.5;
>   int T.4;
>   int T.3;
>   int T.2;
>   int T.1;
>   int T.0;
> 
>   # BLOCK 0
>   # PRED: ENTRY [100.0%]  (fallthru,exec)
>   # SUCC: 1 [100.0%]  (fallthru,exec)
> 
>   # BLOCK 1
>   # PRED: 6 [100.0%]  (fallthru) 0 [100.0%]  (fallthru,exec)
>   # i_1 = PHI <1(0), i_15(6)>;
> <L0>:;
>   T.0_3 = if (1)
>     {
>       A[i_1];
>     };
>   if (T.0_3 > 0) goto <L1>; else goto <L2>;
>   # SUCC: 3 [21.0%]  (false,exec) 2 [79.0%]  (true,exec)
> 
>   # BLOCK 2
>   # PRED: 1 [79.0%]  (true,exec)
> <L1>:;
>   T.1_9 = if (1 && T.0_3 > 0)

why this "1 &&" part?

>     {
>       C[i_1];
>     };
>   T.2_10 = if (1 && T.0_3 > 0)
>     {
>       T.0_3 + T.1_9;
>     };
>   A[i_1] = if (1 && T.0_3 > 0)
>     {
>       T.2_10
>     };
>   T.3_12 = if (1 && T.0_3 > 0)
>     {
>       T.2_10 + 1;
>     };
>   B[i_1] = if (1 && T.0_3 > 0)
>     {
>       T.3_12
>     };
>   goto <bb 4> (<L3>);
>   # SUCC: 4 [100.0%]  (fallthru,exec)
> 
>   # BLOCK 3
>   # PRED: 1 [21.0%]  (false,exec)
> <L2>:;
>   T.4_5 = if (1 && !(T.0_3 > 0))
>     {
>       D[i_1];
>     };
>   A[i_1] = if (1 && !(T.0_3 > 0))
>     {
>       T.4_5
>     };
>   T.5_7 = if (1 && !(T.0_3 > 0))
>     {
>       T.4_5 + 1;
>     };
>   B[i_1] = if (1 && !(T.0_3 > 0))
>     {
>       T.5_7
>     };
>   # SUCC: 4 [100.0%]  (fallthru,exec)
> 
>   # BLOCK 4
>   # PRED: 3 [100.0%]  (fallthru,exec) 2 [100.0%]  (fallthru,exec)
> <L3>:;
>   i_15 = i_1 + 1;
>   if (i_15 <= 15) goto <L8>; else goto <L5>;
>   # SUCC: 5 [11.0%]  (false,exec) 6 [89.0%]  (true,exec)
> 
>   # BLOCK 6
>   # PRED: 4 [89.0%]  (true,exec)
> <L8>:;
>   goto <bb 1> (<L0>);
>   # SUCC: 1 [100.0%]  (fallthru)
> 
>   # BLOCK 5
>   # PRED: 4 [11.0%]  (false,exec)
> <L5>:;
>   ibar (&A);
>   ibar (&B);
>   return;
>   # SUCC: EXIT [100.0%]
> 
> }
> 
> I spent lot of time unnecessary to create super block inside loop by
> merging block 2 and 3 into block 1.
> 
> If vectorizer can not vectorize this loop then it will be reverted to
> original form using loop versioning. Am I on the right track ?

I am not at all sure what you want to achieve with this transformation;
it seems to me that you haven't done anything that could possibly make
vectorizer's work easier.

Zdenek

  reply	other threads:[~2004-03-13  9:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-04 19:59 Devang Patel
2004-03-04 20:12 ` Andrew Pinski
2004-03-04 20:39   ` Devang Patel
2004-03-04 21:03 ` Richard Henderson
2004-03-05 19:06   ` Devang Patel
2004-03-05 19:17     ` Diego Novillo
2004-03-05 19:22       ` Diego Novillo
2004-03-05 19:28       ` Devang Patel
2004-03-05 19:41         ` Diego Novillo
2004-03-05 19:44           ` Diego Novillo
2004-03-12 18:45             ` Devang Patel
2004-03-13  9:24               ` Zdenek Dvorak [this message]
2004-03-13 22:41                 ` Devang Patel
2004-03-14 10:59                 ` Dorit Naishlos
2004-03-14 10:57 Fw: " Dorit Naishlos
2004-03-14 19:22 ` Andrew Pinski
2004-03-14 22:31   ` Daniel Berlin
2004-03-15  2:29   ` Alex Rosenberg
2004-03-15 22:38     ` Richard Henderson
2004-03-15 23:08       ` Devang Patel
2004-03-15 23:20         ` Richard Henderson
2004-03-16  0:02           ` Devang Patel
2004-03-16  0:07             ` Diego Novillo
2004-03-16  0:45               ` Richard Henderson
2004-03-16  3:02                 ` Diego Novillo
2004-03-16  3:33                   ` Richard Henderson
2004-03-16  6:33                     ` Devang Patel
2004-03-15 22:42 Robert Dewar
2004-03-15 23:08 ` Richard Henderson
2004-03-16  3:46 Chris Lattner
2004-03-16  5:33 Robert Dewar
2004-03-16  6:54 ` Richard Henderson
2004-03-16 12:27 Robert Dewar
2004-03-16 18:32 ` Richard Henderson
2004-03-16 22:51   ` Toon Moene
2004-03-16 23:10     ` Joseph S. Myers
2004-03-16 23:28       ` Toon Moene
2004-03-16 23:37     ` Richard Henderson
2004-03-16 23:42       ` Toon Moene

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=20040313092438.GA6767@atrey.karlin.mff.cuni.cz \
    --to=rakdver@atrey.karlin.mff.cuni.cz \
    --cc=DORIT@il.ibm.com \
    --cc=dnovillo@redhat.com \
    --cc=dpatel@apple.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=rth@redhat.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).