public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dorit Nuzman <DORIT@il.ibm.com>
To: gcc-patches@gcc.gnu.org
Subject: [autovect] [patch] outer-loop vectorization bug fix
Date: Sun, 12 Aug 2007 14:18:00 -0000	[thread overview]
Message-ID: <OFD681CF48.0936AF3F-ONC2257335.0043F194-C2257335.004ED000@il.ibm.com> (raw)

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


This patch brings the following over to autovect branch:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00568.html

Bootstrapped with vectorization enabled on i386-linux. tested on the
vectorizer testcases.
Committed to autovect branch.

dorit

(See attached file: autovectfix.txt)

[-- Attachment #2: autovectfix.txt --]
[-- Type: text/plain, Size: 2694 bytes --]

Index: testsuite/ChangeLog.autovect
===================================================================
*** testsuite/ChangeLog.autovect	(revision 127372)
--- testsuite/ChangeLog.autovect	(working copy)
***************
*** 1,3 ****
--- 1,7 ----
+ 2007-08-12  Dorit Nuzman  <dorit@il.ibm.com>
+ 
+ 	* gcc.dg/vect/vect-outer-2d.c: New test.
+ 
  2007-08-12  Ira Rosen  <irar@il.ibm.com>
  
  	* gcc.dg/vect/slp-37.c: New. 
Index: testsuite/gcc.dg/vect/vect-outer-2d.c
===================================================================
*** testsuite/gcc.dg/vect/vect-outer-2d.c	(revision 0)
--- testsuite/gcc.dg/vect/vect-outer-2d.c	(revision 0)
***************
*** 0 ****
--- 1,41 ----
+ /* { dg-require-effective-target vect_float } */
+ #include <stdarg.h>
+ #include "tree-vect.h"
+ 
+ #define N 40
+ float image[N][N][N+1] __attribute__ ((__aligned__(16)));
+ 
+ void
+ foo (){
+   int i,j,k;
+ 
+  for (k=0; k<N; k++) {
+   for (i = 0; i < N; i++) {
+     for (j = 0; j < i+1; j++) {
+       image[k][j][i] = j+i+k;
+     }
+   }
+  }
+ }
+ 
+ int main (void)
+ {
+   check_vect ();
+   int i, j, k;
+ 
+   foo ();
+ 
+  for (k=0; k<N; k++) {
+   for (i = 0; i < N; i++) {
+     for (j = 0; j < i+1; j++) {
+       if (image[k][j][i] != j+i+k)
+ 	abort ();
+     }
+   }
+  }
+ 
+   return 0;
+ }
+ 
+ /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 0 "vect" } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */
Index: ChangeLog.autovect
===================================================================
*** ChangeLog.autovect	(revision 127372)
--- ChangeLog.autovect	(working copy)
***************
*** 1,3 ****
--- 1,9 ----
+ 2007-08-12  Dorit Nuzman  <dorit@il.ibm.com>
+ 
+ 	* tree-vect-analyze.c (vect_analyze_loop_form): Check that the 
+ 	inner-loop bound is invariant in the outer-loop (for outer-loop
+ 	vectorization).
+ 
  2007-08-12  Ira Rosen  <irar@il.ibm.com>
  
  	* tree-vect-analyze.c (vect_get_and_check_slp_defs): Add new argument. 
Index: tree-vect-analyze.c
===================================================================
*** tree-vect-analyze.c	(revision 127372)
--- tree-vect-analyze.c	(working copy)
*************** vect_analyze_loop_form (struct loop *loo
*** 3785,3790 ****
--- 3785,3800 ----
  	  return NULL;
  	}
  
+       if (!expr_invariant_in_loop_p (loop, 
+ 					LOOP_VINFO_NITERS (inner_loop_vinfo)))
+ 	{
+ 	  if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS))
+ 	    fprintf (vect_dump, 
+ 		     "not vectorized: inner-loop count not invariant.");
+ 	  destroy_loop_vec_info (inner_loop_vinfo, true);
+ 	  return NULL;
+ 	}
+ 
        if (loop->num_nodes != 5) 
          {
  	  if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS))

                 reply	other threads:[~2007-08-12 14:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=OFD681CF48.0936AF3F-ONC2257335.0043F194-C2257335.004ED000@il.ibm.com \
    --to=dorit@il.ibm.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).