public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dorit Naishlos <DORIT@il.ibm.com>
To: Olga Golovanevsky <OLGA@il.ibm.com>
Cc: Devang Patel <dpatel@apple._com>, gcc-patches@gcc.gnu.org
Subject: Re: [lno] [patch] "while" with unknown loop bound
Date: Wed, 09 Jun 2004 15:59:00 -0000	[thread overview]
Message-ID: <OF23FB40B2.3F011075-ONC2256EAE.004E1E71-C2256EAE.004E7139@il.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2096 bytes --]


committed, along with the test-case below.

dorit

(See attached file: tree-ssa-vect-30.c)



                                                                                                                                     
                      Olga Golovanevsky                                                                                              
                                               To:       Dorit Naishlos/Haifa/IBM@IBMIL                                              
                      06/06/2004 15:35         cc:       Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>, Sebastian Pop             
                                                <sebastian.pop@cri.ensmp.fr>, Devang Patel <dpatel@apple. com>,                      
                                                gcc-patches@gcc.gnu.org                                                              
                                               From:     Olga Golovanevsky/Haifa/IBM@IBMIL                                           
                                               Subject:  [lno] [patch] "while" with unknown loop bound                               
                                                                                                                                     



This patch allows vectorizing of "while" loop with unknown loop bound.
Thus, for example, the following loop will vectorize now:

  while (n--) {
    a[i] = b[i];
    i++;
  }

The patch also contains correction in cfg construction for
loop duplication in function tree_duplicate_loop_to_exit_cfg.

Bootstrapped on powerpc-apple-darwin7.0.0.

ChangeLog:

             * tree-vctorizer.c
             (vect_update_initial_conditions_of_duplicated_loop):
             Handle general form of "init" and "step" of access function.
             * tree-ssa-loop-manip.c (tree_duplicate_loop_to_exit_cfg):
             The exit from loop is taken from bb previous to latch instead
             of latch itself.



#### diffJ6_2.txt has been removed from this note on June 09, 2004 by Dorit
Naishlos

[-- Attachment #2: tree-ssa-vect-30.c --]
[-- Type: application/octet-stream, Size: 1295 bytes --]

/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do compile { target i?86-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */

#include <stdarg.h>
#include <signal.h>

#define N 16

float b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
float a[N];
float c[N];

int main1 (int n)
{
  int i=0;

  /* Vectorized: unknown loop bound.  */
  while (n--) {
    a[i] = b[i];
    i++;
  }

  /* check results:  */
  for (i = 0; i < n; i++)
    {
      if (a[i] != b[i])
        abort ();
    }

  return 0;
}

int main2 (unsigned int n)
{
  int i=0;

  /* Vectorized: unknown loop bound.  */
  while (n--) {
    c[i] = b[i];
    i++;
  }

  /* check results:  */
  for (i = 0; i < n; i++)
    {
      if (c[i] != b[i])
        abort ();
    }

  return 0;
}

void
sig_ill_handler (int sig)
{   
    exit(0);
}

int main (void)
{ 
  /* Exit on systems without altivec.  */
  signal (SIGILL, sig_ill_handler);
  /* Altivec instruction, 'vor %v0,%v0,%v0'.  */
  asm volatile (".long 0x10000484");
  signal (SIGILL, SIG_DFL);
  
  return main1 (N);
  return main2 (N);
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */

             reply	other threads:[~2004-06-09 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09 15:59 Dorit Naishlos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-06-06 13:57 Olga Golovanevsky

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=OF23FB40B2.3F011075-ONC2256EAE.004E1E71-C2256EAE.004E7139@il.ibm.com \
    --to=dorit@il.ibm.com \
    --cc=OLGA@il.ibm.com \
    --cc=dpatel@apple._com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).