2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-104.c
bloba77c98735ebad6876c97ee22467f5287b4575a01
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "--param max-completely-peel-times=1" } */
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 3
10 struct extraction
12 int a[N][N];
13 int b[N][N];
16 static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
17 static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
18 static int c[N][N] = {{1,2,3},{4,5,5},{5,5,5}};
20 __attribute__ ((noinline))
21 int main1 (int x) {
22 int i,j;
23 struct extraction *p;
24 p = (struct extraction *) malloc (sizeof (struct extraction));
26 for (i = 0; i < N; i++)
28 for (j = 0; j < N; j++)
30 p->a[i][j] = a[i][j];
31 p->b[i][j] = b[i][j];
32 asm volatile ("" ::: "memory");
36 /* Not vectorizable: distance = 1. */
37 for (i = 1; i < N; i++)
39 for (j = 0; j < N; j++)
41 *((int *)p + x + i + j + 1) = *((int *)p + x + i + j);
45 /* check results: */
46 for (i = 0; i < N; i++)
48 for (j = 0; j < N; j++)
50 if (p->a[i][j] != c[i][j])
51 abort();
54 return 0;
57 int main (void)
59 check_vect ();
61 return main1 (N);
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
65 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" { target { ! vect_multiple_sizes } } } } */
66 /* { dg-final { scan-tree-dump "possible dependence between data-refs" "vect" { target vect_multiple_sizes } } } */