summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-25 12:05:07 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-25 12:05:07 +0000
commit516849c7cdbe9be15bb886db53588d1cc868e795 (patch)
tree2c7091212ab12d18c54b6a9e333f0b9450742dab /gcc/testsuite/gcc.dg
parente8089f751c03c2f2d0709b475a22b42e0cc402a2 (diff)
downloadgcc-516849c7cdbe9be15bb886db53588d1cc868e795.tar.gz
* expr.c (highest_pow2_factor): Make extern.
* tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102356 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr20122.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-100.c80
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-101.c49
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-102.c55
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-103.c57
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-104.c66
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-105.c66
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-115.c75
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-116.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-43.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-91.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp2
13 files changed, 523 insertions, 28 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c
new file mode 100644
index 00000000000..80c9c0180d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ltrans-8.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-linear -fdump-tree-ltrans-all" } */
+double foo(double *a)
+{
+ int i,j;
+ double r = 0.0;
+ for (i=0; i<8; ++i)
+ for (j=0; j<8; ++j)
+ r += a[j*8+i];
+ return r;
+}
+
+/* { dg-final { scan-tree-dump-times "transformed loop" 1 "ltrans"} } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr20122.c b/gcc/testsuite/gcc.dg/vect/pr20122.c
index 7fef9887fb2..a713e5e1fa8 100644
--- a/gcc/testsuite/gcc.dg/vect/pr20122.c
+++ b/gcc/testsuite/gcc.dg/vect/pr20122.c
@@ -7,8 +7,10 @@ typedef short ashort __attribute__ ((__aligned__(16)));
ashort Kernshort[24];
static void VecBug(ashort Kernel[8][24]) __attribute__((noinline));
static void VecBug(ashort Kernel[8][24]);
+static void VecBug2(ashort Kernel[8][24]) __attribute__((noinline));
+static void VecBug2(ashort Kernel[8][24]);
-/* Doesn't occur of only inner-loop. */
+/* Not vectorizable: Kernel may alias Kernshort - a global array. */
static void VecBug(ashort Kernel[8][24])
{
int k,i;
@@ -17,6 +19,21 @@ static void VecBug(ashort Kernel[8][24])
Kernshort[i] = Kernel[k][i];
}
+/* Vectorizable: Kernshort2 is local. */
+static void VecBug2(ashort Kernel[8][24])
+{
+ int k,i;
+ ashort Kernshort2[24];
+ for (k = 0; k<8; k++)
+ for (i = 0; i<24; i++)
+ Kernshort2[i] = Kernel[k][i];
+
+ for (k = 0; k<8; k++)
+ for (i = 0; i<24; i++)
+ if (Kernshort2[i] != Kernel[k][i])
+ abort ();
+}
+
int main (int argc, char **argv)
{
check_vect ();
@@ -29,6 +46,7 @@ int main (int argc, char **argv)
Kernel[k][i] = 0;
VecBug(Kernel);
+ VecBug2(Kernel);
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-100.c b/gcc/testsuite/gcc.dg/vect/vect-100.c
index 3b803fc71b6..c1b9e401897 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-100.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-100.c
@@ -1,28 +1,78 @@
-/* Assuming we can vectorize char multiplication, here's an execute test. */
+/* { dg-require-effective-target vect_int } */
+#include <stdlib.h>
#include <stdarg.h>
#include "tree-vect.h"
-extern void abort (void);
-void foo()
+#define N 9
+
+struct extraction
{
- static unsigned char A[256], B[256], C[256];
+ int a[N];
+ int b[N];
+};
+
+static int a[N] = {1,2,3,4,5,6,7,8,9};
+static int b[N] = {2,3,4,5,6,7,8,9,0};
+
+int main1 () {
int i;
+ struct extraction *p;
+
+ p = (struct extraction *) malloc (sizeof (struct extraction));
- for (i = 0; i < 256; ++i)
- A[i] = B[i] = i;
+ /* Not vectorizable: p may alias a and/or b, since they are globals. */
+ for (i = 0; i < N; i++)
+ {
+ p->a[i] = a[i];
+ p->b[i] = b[i];
+ }
- for (i = 0; i < 256; ++i)
- C[i] = A[i] * B[i];
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->a[i] != a[i] || p->b[i] != b[i])
+ abort();
+ }
- for (i = 0; i < 256; ++i)
- if (C[i] != (unsigned char)(i * i))
- abort ();
+ return 0;
}
-int main()
-{
- check_vect ();
- foo();
+int main2 () {
+ int i;
+ int c[N] = {1,2,3,4,5,6,7,8,9};
+ int d[N] = {2,3,4,5,6,7,8,9,0};
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ /* Vectorizable: c and d are local arrays. */
+ for (i = 0; i < N; i++)
+ {
+ p->a[i] = c[i];
+ p->b[i] = d[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->a[i] != c[i] || p->b[i] != d[i])
+ abort();
+ }
+
return 0;
}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+ main2 ();
+
+ return 0;
+}
+
+/* Requires versioning. */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-101.c b/gcc/testsuite/gcc.dg/vect/vect-101.c
new file mode 100644
index 00000000000..e195a58af5f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-101.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 9
+
+struct extraction
+{
+ int a[N];
+ int b[N];
+};
+
+static int a[N] = {1,2,3,4,5,6,7,8,9};
+static int b[N] = {2,3,4,5,6,7,8,9,0};
+
+int main1 (int x, int y) {
+ int i;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ /* Not vectorizable: different unknown offset. */
+ for (i = 0; i < N; i++)
+ {
+ *((int *)p + x + i) = a[i];
+ *((int *)p + y + i) = b[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->a[i] != a[i] || p->b[i] != b[i])
+ abort();
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (0, N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-102.c b/gcc/testsuite/gcc.dg/vect/vect-102.c
new file mode 100644
index 00000000000..af3261d01f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-102.c
@@ -0,0 +1,55 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 9
+
+struct extraction
+{
+ int a[N];
+ int b[N];
+};
+
+static int a[N] = {1,2,3,4,5,6,7,8,9};
+static int b[N] = {2,3,4,5,6,7,8,9,9};
+
+int main1 (int x, int y) {
+ int i;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ for (i = 0; i < N; i++)
+ {
+ p->a[i] = a[i];
+ if (x == 135)
+ abort (); /* to avoid vectorization */
+ }
+
+ /* Not vectorizable: distance 1. */
+ for (i = 0; i < N - 1; i++)
+ {
+ *((int *)p + x + i) = *((int *)p + x + i + 1);
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->a[i] != b[i])
+ abort();
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (0, N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-103.c b/gcc/testsuite/gcc.dg/vect/vect-103.c
new file mode 100644
index 00000000000..effa97e15ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-103.c
@@ -0,0 +1,57 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 9
+
+struct extraction
+{
+ int a[N];
+ int b[N];
+};
+
+static int a[N] = {1,2,3,4,5,6,7,8,9};
+static int b[N] = {17,24,7,0,2,3,4,31,82};
+static int c[N] = {9,17,24,7,0,2,3,4,31};
+
+int main1 (int x, int y) {
+ int i;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ for (i = 0; i < N; i++)
+ {
+ p->a[i] = a[i];
+ p->b[i] = b[i];
+ if (x == 135)
+ abort (); /* to avoid vectorization */
+ }
+
+ /* Vectorizable: distance > VF. */
+ for (i = 0; i < N; i++)
+ {
+ *((int *)p + x + i) = *((int *)p + x + i + 8);
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->a[i] != c[i])
+ abort();
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (0, N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "dependence distance modulo vf == 0" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-104.c b/gcc/testsuite/gcc.dg/vect/vect-104.c
new file mode 100644
index 00000000000..6d16da6b32e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-104.c
@@ -0,0 +1,66 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 3
+
+struct extraction
+{
+ int a[N][N];
+ int b[N][N];
+};
+
+static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
+static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
+static int c[N][N] = {{1,2,3},{4,6,8},{8,9,9}};
+
+int main1 (int x) {
+ int i,j;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ p->a[i][j] = a[i][j];
+ p->b[i][j] = b[i][j];
+ if (x == 135)
+ abort (); /* to avoid vectorization */
+ }
+ }
+
+ /* Not vectorizable: distance = 1. */
+ for (i = 1; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ *((int *)p + x + i + j) = *((int *)p + x + i + j + 1);
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (p->a[i][j] != c[i][j])
+ abort();
+ }
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-105.c b/gcc/testsuite/gcc.dg/vect/vect-105.c
new file mode 100644
index 00000000000..c8f8e5b6813
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-105.c
@@ -0,0 +1,66 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 4
+
+struct extraction
+{
+ int a[N][N];
+ int b[N][N];
+};
+
+static int a[N][N] = {{1,2,3,11},{4,5,6,12},{7,8,9,13},{34,45,67,83}};
+static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
+static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
+
+int main1 (int x) {
+ int i,j;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ p->a[i][j] = a[i][j];
+ p->b[i][j] = b[i][j];
+ if (x == 135)
+ abort (); /* to avoid vectorization */
+ }
+ }
+
+ /* Vectorizable: distance > number of iterations. */
+ for (i = 1; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ *((int *)p + x + i + j) = *((int *)p + x + i + j + 5);
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (p->a[i][j] != c[i][j])
+ abort();
+ }
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-115.c b/gcc/testsuite/gcc.dg/vect/vect-115.c
new file mode 100644
index 00000000000..fe055fb0def
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-115.c
@@ -0,0 +1,75 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct s{
+ int b[N];
+ int c[N];
+ int m;
+};
+
+struct t{
+ struct s strc_s;
+ int m;
+};
+
+struct test1{
+ struct t strc_t;
+ struct t *ptr_t;
+ int k;
+ int l;
+};
+
+int main1 ()
+{
+ int i;
+ struct test1 tmp1;
+ int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+ struct t tmp2;
+
+ tmp1.ptr_t = &tmp2;
+
+ /* DR bases comparison: record and array. */
+ for (i = 0; i < N; i++)
+ {
+ tmp1.strc_t.strc_s.b[i] = a[i];
+ }
+
+ /* Check results. */
+ for (i = 0; i < N; i++)
+ {
+ if (tmp1.strc_t.strc_s.b[i] != a[i])
+ abort();
+ }
+
+ /* DR bases comparison: record containing ptr and array. */
+ for (i = 0; i < N; i++)
+ {
+ tmp1.ptr_t->strc_s.c[i] = a[i];
+ }
+
+ /* Check results. */
+ for (i = 0; i < N; i++)
+ {
+ if (tmp1.ptr_t->strc_s.c[i] != a[i])
+ abort();
+ }
+
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-116.c b/gcc/testsuite/gcc.dg/vect/vect-116.c
new file mode 100644
index 00000000000..3b803fc71b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-116.c
@@ -0,0 +1,28 @@
+/* Assuming we can vectorize char multiplication, here's an execute test. */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+extern void abort (void);
+void foo()
+{
+ static unsigned char A[256], B[256], C[256];
+ int i;
+
+ for (i = 0; i < 256; ++i)
+ A[i] = B[i] = i;
+
+ for (i = 0; i < 256; ++i)
+ C[i] = A[i] * B[i];
+
+ for (i = 0; i < 256; ++i)
+ if (C[i] != (unsigned char)(i * i))
+ abort ();
+}
+
+int main()
+{
+ check_vect ();
+ foo();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-43.c b/gcc/testsuite/gcc.dg/vect/vect-43.c
index 6cea83206f9..12db333b39b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-43.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-43.c
@@ -29,7 +29,7 @@ main1 (afloat * pa)
afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
-
+ /* Not vectorizable: pa may alias pb and/or pc, since their addresses escape. */
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
@@ -40,6 +40,29 @@ main1 (afloat * pa)
return 0;
}
+int
+main2 (afloat * pa)
+{
+ int i;
+ afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+
+ /* Vectorizable: pb and pc addresses do not escape. */
+ for (i = 0; i < N; i++)
+ {
+ pa[i] = pb[i] * pc[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (pa[i] != (pb[i] * pc[i]))
+ abort ();
+ }
+
+ return 0;
+}
+
int main (void)
{
int i;
@@ -50,6 +73,7 @@ int main (void)
check_vect ();
main1 (a);
+ main2 (a);
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-91.c b/gcc/testsuite/gcc.dg/vect/vect-91.c
index 96099f4fe0b..d72bd4c8cf0 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-91.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-91.c
@@ -11,10 +11,7 @@ extern int a[N];
/* The alignment of 'pa' is unknown.
Yet we do know that both the read access and write access have
the same alignment. Peeling to align one of the accesses will
- align the other.
-
- Not vectorized yet due to problems in dataref analysis that
- are fixed in autovect-branch but not yet in mainline. */
+ align the other. */
int
main1 (int * pa)
@@ -60,11 +57,8 @@ main3 ()
return 0;
}
-/* Currently only the loops in main2 and main3 get vectorized. After the merge
- of the datarefs-analysis cleanups from autovect-branch to mainline, the loop
- in main1 will also be vectorized. */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail vect_no_int_add } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index 8c53541003d..07b7e946f80 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -24,7 +24,7 @@ set DEFAULT_VECTCFLAGS ""
# These flags are used for all targets.
lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" \
- "-ftree-vectorizer-verbose=3" "-fdump-tree-vect-stats"
+ "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
# If the target system supports vector instructions, the default action
# for a test is 'run', otherwise it's 'compile'. Save current default.