Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-106.c
blob2687919989998b7d34572482f8593d4bd6d53e3a
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 9
10 static int a[N] = {1,2,3,4,5,6,7,8,9};
11 static int b[N] = {2,3,4,5,6,7,8,9,0};
13 __attribute__ ((noinline))
14 int main1 () {
15 int i;
16 int *p, *q, *p1, *q1;
17 p = (unsigned int *) malloc (sizeof (unsigned int) * N);
18 q = (unsigned int *) malloc (sizeof (unsigned int) * N);
20 p1 = p; q1 = q;
22 /* Vectorizable, before pointer plus we would get a redundant cast
23 (caused by pointer arithmetics), alias analysis fails to distinguish
24 between the pointers. */
25 for (i = 0; i < N; i++)
27 *(q + i) = a[i];
28 *(p + i) = b[i];
31 /* check results: */
32 #pragma GCC novector
33 for (i = 0; i < N; i++)
35 if (*q != a[i] || *p != b[i])
36 abort();
37 q++;
38 p++;
41 q = q1;
42 p = p1;
43 /* Vectorizable. */
44 for (i = 0; i < N; i++)
46 *q = b[i];
47 *p = a[i];
48 q++;
49 p++;
52 q = q1;
53 p = p1;
54 /* check results: */
55 #pragma GCC novector
56 for (i = 0; i < N; i++)
58 if (*q != b[i] || *p != a[i])
59 abort();
60 q++;
61 p++;
64 return 0;
67 int main (void)
69 check_vect ();
71 return main1 ();
74 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
76 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */