This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] New early loop unrolling pass


This is the final version with all vectorizer tests fixed.  See
http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01702.html for details.
Loop closed SSA form is needed because tree_duplicate_loop_to_header_edge
verifies it, so I left that code in place.

Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for mainline?

Thanks,
Richard.

2008-04-23  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/18754
	PR tree-optimization/34223
	* tree-pass.h (pass_complete_unrolli): Declare.
	* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Print
	loop size before and after unconditionally of UL_NO_GROWTH in effect.
	Rewrite loop into loop closed SSA form if it is not already.
	(tree_unroll_loops_completely): Re-structure to iterate over
	innermost loops with intermediate CFG cleanups.
	Unroll outermost loops only if requested or the code does not grow
	doing so.
	* tree-ssa-loop.c (gate_tree_vectorize): Don't shortcut if no
	loops are available.
	(tree_vectorize): Instead do so here.
	(tree_complete_unroll): Also unroll outermost loops.
	(tree_complete_unroll_inner): New function.
	(gate_tree_complete_unroll_inner): Likewise.
	(pass_complete_unrolli): New pass.
	* tree-flow.h (tree_unroll_loops_completely): Add extra parameter.
	* passes.c (init_optimization_passes): Schedule complete inner
	loop unrolling pass before the first CCP pass after final inlining.

	* gcc.dg/tree-ssa/loop-36.c: New testcase.
	* gcc.dg/tree-ssa/loop-37.c: Likewise.
	* gcc.dg/vect/vect-118.c: Likewise.
	* gcc.dg/Wunreachable-8.c: XFAIL bogus warning.
	* gcc.dg/vect/vect-66.c: Increase loop trip count.
	* gcc.dg/vect/no-section-anchors-vect-66.c: Likewise.
	* gcc.dg/vect/no-section-anchors-vect-69.c: Likewise.
	* gcc.dg/vect/vect-76.c: Likewise.
	* gcc.dg/vect/vect-outer-6.c: Likewise.
	* gcc.dg/vect/vect-outer-1.c: Likewise.
	* gcc.dg/vect/vect-outer-1a.c: Likewise.
	* gcc.dg/vect/vect-11a.c: Likewise.
	* gcc.dg/vect/vect-shift-1.c: Likewise.
	* gcc.target/i386/vectorize1.c: Likewise.

Index: gcc/tree-ssa-loop-manip.c
===================================================================
*** gcc/tree-ssa-loop-manip.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/tree-ssa-loop-manip.c	2008-04-24 10:51:01.000000000 +0200
*************** find_uses_to_rename_use (basic_block bb,
*** 248,257 ****
      return;
    def_loop = def_bb->loop_father;
  
!   /* If the definition is not inside loop, it is not interesting.  */
    if (!loop_outer (def_loop))
      return;
  
    if (!use_blocks[ver])
      use_blocks[ver] = BITMAP_ALLOC (NULL);
    bitmap_set_bit (use_blocks[ver], bb->index);
--- 248,262 ----
      return;
    def_loop = def_bb->loop_father;
  
!   /* If the definition is not inside a loop, it is not interesting.  */
    if (!loop_outer (def_loop))
      return;
  
+   /* If the use is not outside of the loop it is defined in, it is not
+      interesting.  */
+   if (flow_bb_inside_loop_p (def_loop, bb))
+     return;
+ 
    if (!use_blocks[ver])
      use_blocks[ver] = BITMAP_ALLOC (NULL);
    bitmap_set_bit (use_blocks[ver], bb->index);
Index: gcc/tree-pass.h
===================================================================
*** gcc/tree-pass.h.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/tree-pass.h	2008-04-24 10:51:01.000000000 +0200
*************** extern struct gimple_opt_pass pass_if_co
*** 290,295 ****
--- 290,296 ----
  extern struct gimple_opt_pass pass_loop_distribution;
  extern struct gimple_opt_pass pass_vectorize;
  extern struct gimple_opt_pass pass_complete_unroll;
+ extern struct gimple_opt_pass pass_complete_unrolli;
  extern struct gimple_opt_pass pass_parallelize_loops;
  extern struct gimple_opt_pass pass_loop_prefetch;
  extern struct gimple_opt_pass pass_iv_optimize;
Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
*** gcc/tree-ssa-loop-ivcanon.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/tree-ssa-loop-ivcanon.c	2008-04-24 10:51:01.000000000 +0200
*************** try_unroll_loop_completely (struct loop 
*** 187,209 ****
  	  > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS))
  	return false;
  
!       if (ul == UL_NO_GROWTH)
  	{
- 	  unr_insns = estimated_unrolled_size (ninsns, n_unroll);
- 	  
  	  if (dump_file && (dump_flags & TDF_DETAILS))
! 	    {
! 	      fprintf (dump_file, "  Loop size: %d\n", (int) ninsns);
! 	      fprintf (dump_file, "  Estimated size after unrolling: %d\n",
! 		       (int) unr_insns);
! 	    }
! 	  
! 	  if (unr_insns > ninsns)
! 	    {
! 	      if (dump_file && (dump_flags & TDF_DETAILS))
! 		fprintf (dump_file, "Not unrolling loop %d:\n", loop->num);
! 	      return false;
! 	    }
  	}
      }
  
--- 187,206 ----
  	  > (unsigned) PARAM_VALUE (PARAM_MAX_COMPLETELY_PEELED_INSNS))
  	return false;
  
!       unr_insns = estimated_unrolled_size (ninsns, n_unroll);
!       if (dump_file && (dump_flags & TDF_DETAILS))
! 	{
! 	  fprintf (dump_file, "  Loop size: %d\n", (int) ninsns);
! 	  fprintf (dump_file, "  Estimated size after unrolling: %d\n",
! 		   (int) unr_insns);
! 	}
! 
!       if (ul == UL_NO_GROWTH
! 	  && unr_insns > ninsns)
  	{
  	  if (dump_file && (dump_flags & TDF_DETAILS))
! 	    fprintf (dump_file, "Not unrolling loop %d.\n", loop->num);
! 	  return false;
  	}
      }
  
*************** try_unroll_loop_completely (struct loop 
*** 214,219 ****
--- 211,220 ----
        unsigned i;
        VEC (edge, heap) *to_remove = NULL;
  
+       /* Re-write this loop into loop closed SSA form if necessary.  */
+       if (!loops_state_satisfies_p (LOOP_CLOSED_SSA))
+ 	rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+ 
        initialize_original_copy_tables ();
        wont_exit = sbitmap_alloc (n_unroll + 1);
        sbitmap_ones (wont_exit);
*************** canonicalize_induction_variables (void)
*** 339,368 ****
     size of the code does not increase.  */
  
  unsigned int
! tree_unroll_loops_completely (bool may_increase_size)
  {
    loop_iterator li;
    struct loop *loop;
!   bool changed = false;
    enum unroll_level ul;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
!       if (may_increase_size && maybe_hot_bb_p (loop->header))
! 	ul = UL_ALL;
!       else
! 	ul = UL_NO_GROWTH;
!       changed |= canonicalize_loop_induction_variables (loop,
! 							false, ul,
! 							!flag_tree_loop_ivcanon);
!     }
  
!   /* Clean up the information about numbers of iterations, since complete
!      unrolling might have invalidated it.  */
!   scev_reset ();
  
-   if (changed)
-     return TODO_cleanup_cfg;
    return 0;
  }
  
--- 340,384 ----
     size of the code does not increase.  */
  
  unsigned int
! tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer)
  {
    loop_iterator li;
    struct loop *loop;
!   bool changed;
    enum unroll_level ul;
  
!   do
      {
!       changed = false;
  
!       FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
! 	{
! 	  if (may_increase_size && maybe_hot_bb_p (loop->header)
! 	      /* Unroll outermost loops only if asked to do so or they do
! 		 not cause code growth.  */
! 	      && (unroll_outer
! 		  || (loop_outer (loop) && loop_outer (loop_outer (loop)))))
! 	    ul = UL_ALL;
! 	  else
! 	    ul = UL_NO_GROWTH;
! 	  changed |= canonicalize_loop_induction_variables
! 		       (loop, false, ul, !flag_tree_loop_ivcanon);
! 	}
! 
!       if (changed)
! 	{
! 	  /* This will take care of removing completely unrolled loops
! 	     from the loop structures so we can continue unrolling now
! 	     innermost loops.  */
! 	  cleanup_tree_cfg ();
! 
! 	  /* Clean up the information about numbers of iterations, since
! 	     complete unrolling might have invalidated it.  */
! 	  scev_reset ();
! 	}
!     }
!   while (changed);
  
    return 0;
  }
  
Index: gcc/tree-ssa-loop.c
===================================================================
*** gcc/tree-ssa-loop.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/tree-ssa-loop.c	2008-04-24 10:51:01.000000000 +0200
*************** struct gimple_opt_pass pass_predcom = 
*** 223,235 ****
  static unsigned int
  tree_vectorize (void)
  {
    return vectorize_loops ();
  }
  
  static bool
  gate_tree_vectorize (void)
  {
!   return flag_tree_vectorize && number_of_loops () > 1;
  }
  
  struct gimple_opt_pass pass_vectorize =
--- 223,238 ----
  static unsigned int
  tree_vectorize (void)
  {
+   if (number_of_loops () <= 1)
+     return 0;
+ 
    return vectorize_loops ();
  }
  
  static bool
  gate_tree_vectorize (void)
  {
!   return flag_tree_vectorize;
  }
  
  struct gimple_opt_pass pass_vectorize =
*************** tree_complete_unroll (void)
*** 466,472 ****
  
    return tree_unroll_loops_completely (flag_unroll_loops
  				       || flag_peel_loops
! 				       || optimize >= 3);
  }
  
  static bool
--- 469,475 ----
  
    return tree_unroll_loops_completely (flag_unroll_loops
  				       || flag_peel_loops
! 				       || optimize >= 3, true);
  }
  
  static bool
*************** struct gimple_opt_pass pass_complete_unr
*** 495,500 ****
--- 498,550 ----
   }
  };
  
+ /* Complete unrolling of inner loops.  */
+ 
+ static unsigned int
+ tree_complete_unroll_inner (void)
+ {
+   unsigned ret = 0;
+ 
+   loop_optimizer_init (LOOPS_NORMAL
+ 		       | LOOPS_HAVE_RECORDED_EXITS);
+   if (number_of_loops () > 1)
+     {
+       scev_initialize ();
+       ret = tree_unroll_loops_completely (optimize >= 3, false);
+       free_numbers_of_iterations_estimates ();
+       scev_finalize ();
+     }
+   loop_optimizer_finalize ();
+ 
+   return ret;
+ }
+ 
+ static bool
+ gate_tree_complete_unroll_inner (void)
+ {
+   return optimize >= 2;
+ }
+ 
+ struct gimple_opt_pass pass_complete_unrolli =
+ {
+  {
+   GIMPLE_PASS,
+   "cunrolli",				/* name */
+   gate_tree_complete_unroll_inner,	/* gate */
+   tree_complete_unroll_inner,	       	/* execute */
+   NULL,					/* sub */
+   NULL,					/* next */
+   0,					/* static_pass_number */
+   TV_COMPLETE_UNROLL,	  		/* tv_id */
+   PROP_cfg | PROP_ssa,			/* properties_required */
+   0,					/* properties_provided */
+   0,					/* properties_destroyed */
+   0,					/* todo_flags_start */
+   TODO_dump_func | TODO_verify_loops
+     | TODO_ggc_collect 			/* todo_flags_finish */
+  }
+ };
+ 
  /* Parallelization.  */
  
  static bool
Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/tree-flow.h	2008-04-24 10:51:01.000000000 +0200
*************** basic_block *blocks_in_phiopt_order (voi
*** 1016,1022 ****
  void tree_ssa_lim (void);
  unsigned int tree_ssa_unswitch_loops (void);
  unsigned int canonicalize_induction_variables (void);
! unsigned int tree_unroll_loops_completely (bool);
  unsigned int tree_ssa_prefetch_arrays (void);
  unsigned int remove_empty_loops (void);
  void tree_ssa_iv_optimize (void);
--- 1016,1022 ----
  void tree_ssa_lim (void);
  unsigned int tree_ssa_unswitch_loops (void);
  unsigned int canonicalize_induction_variables (void);
! unsigned int tree_unroll_loops_completely (bool, bool);
  unsigned int tree_ssa_prefetch_arrays (void);
  unsigned int remove_empty_loops (void);
  void tree_ssa_iv_optimize (void);
Index: gcc/passes.c
===================================================================
*** gcc/passes.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/passes.c	2008-04-24 10:51:01.000000000 +0200
*************** init_optimization_passes (void)
*** 567,572 ****
--- 567,573 ----
        NEXT_PASS (pass_rename_ssa_copies);
  
        /* Initial scalar cleanups.  */
+       NEXT_PASS (pass_complete_unrolli);
        NEXT_PASS (pass_ccp);
        NEXT_PASS (pass_phiprop);
        NEXT_PASS (pass_fre);
Index: gcc/testsuite/gcc.dg/Wunreachable-8.c
===================================================================
*** gcc/testsuite/gcc.dg/Wunreachable-8.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/Wunreachable-8.c	2008-04-24 10:51:01.000000000 +0200
*************** float Factorial(float X)
*** 6,12 ****
    int k,j;
    for (k=1; k < 5; k++)
      {
!       val += 1.0;
      }
    return (val); /* { dg-bogus "will never be executed" } */
  }
--- 6,12 ----
    int k,j;
    for (k=1; k < 5; k++)
      {
!       val += 1.0; /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */
      }
    return (val); /* { dg-bogus "will never be executed" } */
  }
Index: gcc/testsuite/gcc.dg/tree-ssa/loop-36.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/tree-ssa/loop-36.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 0 ****
--- 1,21 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -fdump-tree-dce2" } */
+ 
+ struct X { float array[4]; };
+ 
+ struct X a,b;
+ 
+ float foobar () {
+   float s = 0;
+   unsigned int d;
+   struct X c;
+   for (d=0; d<4; ++d)
+     c.array[d] = a.array[d] * b.array[d];
+   for (d=0; d<4; ++d)
+     s+=c.array[d];
+   return s;
+ }
+ 
+ /* The temporary structure should have been promoted to registers
+    by FRE after the loops have been unrolled by the early unrolling pass.  */
+ /* { dg-final { scan-tree-dump-not "c\.array" "dce2" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/loop-37.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/tree-ssa/loop-37.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 0 ****
--- 1,27 ----
+ /* { dg-do link } */
+ /* { dg-options "-O2 -fdump-tree-optimized" } */
+ 
+ extern void link_error (void);
+ static const int my_array [3] = { 4, 5, 6 };
+ 
+ void f0 (void)
+ {
+   int j, sum = 0;
+   for (j = 0; j < 3; j ++)
+     sum += my_array [j];
+   if (15 != sum)
+     link_error ();
+ }
+ 
+ int f1 (int a [])
+ {
+   int j, sum = 0;
+   for (j = 0; j < 3; j ++)
+     sum += a [j] + my_array [j];
+   return sum;
+ }
+ 
+ int main() { }
+ 
+ /* { dg-final { scan-tree-dump-not "my_array" "optimized" } } */
+ /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-118.c
===================================================================
*** /dev/null	1970-01-01 00:00:00.000000000 +0000
--- gcc/testsuite/gcc.dg/vect/vect-118.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 0 ****
--- 1,34 ----
+ /* { dg-require-effective-target vect_int } */
+ /* { dg-options "-O3 -fdump-tree-vect-details" } */
+ 
+ #include "tree-vect.h"
+ 
+ #define M 10
+ #define N 3
+ 
+ void __attribute__((noinline))
+ foo (int n, int *ub, int *uc)
+ {
+   int i, j, tmp1;
+ 
+   for (i = 0; i < n; i++)
+     {
+       tmp1 = 0;
+       for (j = 0; j < M; j++)
+         {
+           tmp1 += uc[i] * ((int)(j << N) / M);
+         }
+       ub[i] = tmp1;
+     }
+ }
+ 
+ int main()
+ {
+   int uc[16], ub[16];
+   check_vect ();
+   foo (16, uc, ub);
+   return 0;
+ }
+ 
+ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-66.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-66.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-66.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 3,22 ****
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 16
  
  __attribute__ ((noinline))
! int main1 ()
  {
    int i, j;
!   int ib[6] = {0,3,6,9,12,15};
!   int ia[8][5][6];
!   int ic[16][16][5][6];
  
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             ia[2][6][j] = 5;
          }
--- 3,20 ----
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 8
  
  __attribute__ ((noinline))
! void main1 ()
  {
    int i, j;
!   int ia[8][5][N+2];
  
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             ia[2][6][j] = 5;
          }
*************** int main1 ()
*** 25,57 ****
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             if (ia[2][6][j] != 5)
                  abort();
          }
      }
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
             ia[3][6][j+2] = 5;
      }
  
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 2; j < 6; j++)
          {
             if (ia[3][6][j] != 5)
                  abort();
          }
      }
  
    /* Multidimensional array. Not aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             ic[2][1][6][j+1] = 5;
          }
--- 23,70 ----
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             if (ia[2][6][j] != 5)
                  abort();
          }
      }
+ }
+ 
+ __attribute__ ((noinline))
+ void main2 ()
+ {
+   int i, j;
+   int ia[8][5][N+2];
+ 
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
             ia[3][6][j+2] = 5;
      }
  
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 2; j < N+2; j++)
          {
             if (ia[3][6][j] != 5)
                  abort();
          }
      }
+ }
+ 
+ __attribute__ ((noinline))
+ void main3 ()
+ {
+   int i, j;
+   int ic[16][16][5][N+2];
  
    /* Multidimensional array. Not aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             ic[2][1][6][j+1] = 5;
          }
*************** int main1 ()
*** 60,81 ****
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             if (ic[2][1][6][j+1] != 5)
                  abort();
          }
      }
- 
-   return 0;
  }
  
  int main (void)
  { 
    check_vect ();
  
!   return main1 ();
  }
  
! /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
  /* { dg-final { cleanup-tree-dump "vect" } } */
--- 73,96 ----
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             if (ic[2][1][6][j+1] != 5)
                  abort();
          }
      }
  }
  
  int main (void)
  { 
    check_vect ();
  
!   main1 ();
!   main2 ();
!   main3 ();
! 
!   return 0;
  }
  
! /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */
  /* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 3,13 ****
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 16
  
! int ib[6] = {0,3,6,9,12,15};
! int ia[8][5][6];
! int ic[16][16][5][6];
  
  __attribute__ ((noinline))
  int main1 ()
--- 3,12 ----
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 8
  
! int ia[8][5][N+2];
! int ic[16][16][5][N+2];
  
  __attribute__ ((noinline))
  int main1 ()
*************** int main1 ()
*** 17,23 ****
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             ia[2][6][j] = 5;
          }
--- 16,22 ----
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             ia[2][6][j] = 5;
          }
*************** int main1 ()
*** 26,32 ****
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             if (ia[2][6][j] != 5)
                  abort();
--- 25,31 ----
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             if (ia[2][6][j] != 5)
                  abort();
*************** int main1 ()
*** 35,48 ****
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
             ia[3][6][j+2] = 5;
      }
  
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 2; j < 6; j++)
          {
             if (ia[3][6][j] != 5)
                  abort();
--- 34,47 ----
    /* Multidimensional array. Aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
             ia[3][6][j+2] = 5;
      }
  
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 2; j < N+2; j++)
          {
             if (ia[3][6][j] != 5)
                  abort();
*************** int main1 ()
*** 52,58 ****
    /* Multidimensional array. Not aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             ic[2][1][6][j+1] = 5;
          }
--- 51,57 ----
    /* Multidimensional array. Not aligned. */
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             ic[2][1][6][j+1] = 5;
          }
*************** int main1 ()
*** 61,67 ****
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < 4; j++)
          {
             if (ic[2][1][6][j+1] != 5)
                  abort();
--- 60,66 ----
    /* check results: */  
    for (i = 0; i < 16; i++)
      {
!       for (j = 0; j < N; j++)
          {
             if (ic[2][1][6][j+1] != 5)
                  abort();
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 3,9 ****
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 8
  
  struct s{
    int m;
--- 3,9 ----
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 12
  
  struct s{
    int m;
Index: gcc/testsuite/gcc.dg/vect/vect-76.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-76.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-76.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 3,9 ****
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 8
  #define OFF 4
  
  /* Check handling of accesses for which the "initial condition" -
--- 3,9 ----
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 12
  #define OFF 4
  
  /* Check handling of accesses for which the "initial condition" -
Index: gcc/testsuite/gcc.dg/vect/vect-outer-6.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-outer-6.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-outer-6.c	2008-04-24 10:51:01.000000000 +0200
*************** int main1 ()
*** 20,29 ****
  
    int i, j;
  
!   for (i = 0; i < 8; i++)
      {
        s = 0;
!       for (j=0; j<8; j+=4)
  	s += C[j];
        A[i] = s;
      }
--- 20,29 ----
  
    int i, j;
  
!   for (i = 0; i < N; i++)
      {
        s = 0;
!       for (j = 0; j < N; j += 4)
  	s += C[j];
        A[i] = s;
      }
*************** int main ()
*** 49,58 ****
    main1();
  
    /* check results:  */
!   for (i = 0; i < 8; i++)
      {
        s = 0;
!       for (j=0; j<8; j+=4)
          s += C[j];
        if (A[i] != s)
          abort ();
--- 49,58 ----
    main1();
  
    /* check results:  */
!   for (i = 0; i < N; i++)
      {
        s = 0;
!       for (j = 0; j < N; j += 4)
          s += C[j];
        if (A[i] != s)
          abort ();
Index: gcc/testsuite/gcc.dg/vect/vect-outer-1.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-outer-1.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-outer-1.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 1,6 ****
  /* { dg-do compile } */
  
! #define N 40
  signed short image[N][N] __attribute__ ((__aligned__(16)));
  signed short block[N][N] __attribute__ ((__aligned__(16)));
  signed short out[N] __attribute__ ((__aligned__(16)));
--- 1,6 ----
  /* { dg-do compile } */
  
! #define N 64
  signed short image[N][N] __attribute__ ((__aligned__(16)));
  signed short block[N][N] __attribute__ ((__aligned__(16)));
  signed short out[N] __attribute__ ((__aligned__(16)));
Index: gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-outer-1a.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-outer-1a.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 1,6 ****
  /* { dg-do compile } */
  
! #define N 40
  signed short image[N][N] __attribute__ ((__aligned__(16)));
  signed short block[N][N] __attribute__ ((__aligned__(16)));
  
--- 1,6 ----
  /* { dg-do compile } */
  
! #define N 64
  signed short image[N][N] __attribute__ ((__aligned__(16)));
  signed short block[N][N] __attribute__ ((__aligned__(16)));
  
Index: gcc/testsuite/gcc.dg/vect/vect-11a.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-11a.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-11a.c	2008-04-24 10:51:01.000000000 +0200
*************** extern void abort (void);
*** 9,23 ****
  __attribute__ ((noinline))
  void u ()
  {  
!   unsigned int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001};
!   unsigned int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001};
!   unsigned int Answer[4] = {0,0xf7ffffff,0x0200fe01,0xe0000001};
!   unsigned int C[4];
    int i, j;
    
!   for (i=0; i<4; i++)
      C[i] = A[i] * B[i];
!   for (i=0; i<4; i++)
      if (C[i] != Answer[i])
        abort ();
  }
--- 9,26 ----
  __attribute__ ((noinline))
  void u ()
  {  
!   unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
! 		       0x08000000,0xffffffff,0xff0000ff,0xf0000001};
!   unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
! 		       0x08000000,0x08000001,0xff0000ff,0xf0000001};
!   unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001,
! 			    0,0xf7ffffff,0x0200fe01,0xe0000001};
!   unsigned int C[8];
    int i, j;
    
!   for (i=0; i<8; i++)
      C[i] = A[i] * B[i];
!   for (i=0; i<8; i++)
      if (C[i] != Answer[i])
        abort ();
  }
*************** void u ()
*** 25,39 ****
  __attribute__ ((noinline))
  void s()
  {
!   signed int A[4] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001};
!   signed int B[4] = {0x08000000,0x08000001,0xff0000ff,0xf0000001};
!   signed int Answer[4] = {0,0xf7ffffff,0x0200fe01, 0xe0000001};
!   signed int C[4];
    int i, j;
    
!   for (i=0; i<4; i++)
      C[i] = A[i] * B[i];
!   for (i=0; i<4; i++)
      if (C[i] != Answer[i])
        abort ();
  }
--- 28,45 ----
  __attribute__ ((noinline))
  void s()
  {
!   signed int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001,
! 		     0x08000000,0xffffffff,0xff0000ff,0xf0000001};
!   signed int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001,
! 		     0x08000000,0x08000001,0xff0000ff,0xf0000001};
!   signed int Answer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001,
! 			  0,0xf7ffffff,0x0200fe01, 0xe0000001};
!   signed int C[8];
    int i, j;
    
!   for (i=0; i<8; i++)
      C[i] = A[i] * B[i];
!   for (i=0; i<8; i++)
      if (C[i] != Answer[i])
        abort ();
  }
Index: gcc/testsuite/gcc.dg/vect/vect-shift-1.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-shift-1.c.orig	2008-04-23 17:53:13.000000000 +0200
--- gcc/testsuite/gcc.dg/vect/vect-shift-1.c	2008-04-24 10:51:01.000000000 +0200
***************
*** 4,15 ****
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 4
  
  int main ()
  {
!   unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 };
!   unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 };
    int i;
  
    check_vect ();
--- 4,17 ----
  #include <stdarg.h>
  #include "tree-vect.h"
  
! #define N 8
  
  int main ()
  {
!   unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001,
! 			0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 };
!   unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000,
! 			0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 };
    int i;
  
    check_vect ();
Index: gcc/testsuite/gcc.target/i386/vectorize1.c
===================================================================
*** gcc/testsuite/gcc.target/i386/vectorize1.c.orig	2007-01-18 14:24:50.000000000 +0100
--- gcc/testsuite/gcc.target/i386/vectorize1.c	2008-04-24 10:55:50.000000000 +0200
***************
*** 4,17 ****
  extern char lanip[3][40];
  typedef struct
  {
!   char *t[4];
  }tx_typ;
  
  int set_names (void)
  {
    static tx_typ tt1;
    int ln;
!   for (ln = 0; ln < 4; ln++)
        tt1.t[ln] = lanip[1];
  }
  
--- 4,17 ----
  extern char lanip[3][40];
  typedef struct
  {
!   char *t[8];
  }tx_typ;
  
  int set_names (void)
  {
    static tx_typ tt1;
    int ln;
!   for (ln = 0; ln < 8; ln++)
        tt1.t[ln] = lanip[1];
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]