2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-88.c
blob3dc5588e92dd5facbba29e08467acf3d4e2d06b8
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
8 __attribute__ ((noinline))
9 int main1 (int n, int *a)
11 int i, j, k;
12 int b[N];
14 for (i = 0; i < n; i++)
16 for (j = 0; j < n; j++)
18 k = i + n;
19 a[j] = k;
21 b[i] = k;
25 for (j = 0; j < n; j++)
26 if (a[j] != i + n - 1)
27 abort();
29 for (j = 0; j < n; j++)
30 if (b[j] != j + n)
31 abort();
33 return 0;
36 int main (void)
38 int a[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
40 check_vect ();
42 main1 (N, a+1);
43 main1 (0, a+1);
44 main1 (1, a+1);
45 main1 (2, a+1);
46 main1 (N-1, a+1);
48 return 0;
51 /* Fails for targets that don't vectorize PLUS (e.g alpha). */
52 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
53 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_hw_misalign } } } */
54 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail vect_hw_misalign } } } */
55 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" {target { vector_alignment_reachable && {! vect_hw_misalign} } } } } */
56 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
57 /* { dg-final { cleanup-tree-dump "vect" } } */