summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-22 13:10:49 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-22 13:10:49 +0000
commitd8454216c1986f0126a807b6e06539a0e8f21447 (patch)
tree11bbc10f68c15a604e8b77a8dac5135a2a899cb5 /gcc/testsuite/gcc.dg
parent3326680b408b3414e67501b400120decdc4ab893 (diff)
downloadgcc-d8454216c1986f0126a807b6e06539a0e8f21447.tar.gz
* tree-data-ref.c (ptr_ptr_may_alias_p): Take alias sets into account.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122226 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rwxr-xr-xgcc/testsuite/gcc.dg/vect/vect-106.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-106.c b/gcc/testsuite/gcc.dg/vect/vect-106.c
new file mode 100755
index 00000000000..04a9f6c1c68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-106.c
@@ -0,0 +1,73 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 9
+
+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;
+ int *p, *q, *p1, *q1;
+ p = (unsigned int *) malloc (sizeof (unsigned int) * N);
+ q = (unsigned int *) malloc (sizeof (unsigned int) * N);
+
+ p1 = p; q1 = q;
+
+ /* Not vectorizable: because of the redundant cast (caused by ponter
+ arithmetics), alias analysis fails to distinguish between
+ the pointers. */
+ for (i = 0; i < N; i++)
+ {
+ *(q + i) = a[i];
+ *(p + i) = b[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (*q != a[i] || *p != b[i])
+ abort();
+ q++;
+ p++;
+ }
+
+ q = q1;
+ p = p1;
+ /* Vectorizable. */
+ for (i = 0; i < N; i++)
+ {
+ *q = b[i];
+ *p = a[i];
+ q++;
+ p++;
+ }
+
+ q = q1;
+ p = p1;
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (*q != b[i] || *p != a[i])
+ abort();
+ q++;
+ p++;
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+