OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-105-big-array.c] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdlib.h>
4
#include <stdarg.h>
5
#include "tree-vect.h"
6
 
7
#define N 16
8
 
9
struct extraction
10
{
11
  int a[N][N];
12
  int b[N][N];
13
};
14
 
15
static int a[N][N];
16
static int b[N][N];
17
static int c[N][N];
18
 
19
volatile int y;
20
 
21
__attribute__ ((noinline))
22
int main1 (int x) {
23
  int i,j, off;
24
  struct extraction *p;
25
  p = (struct extraction *) malloc (sizeof (struct extraction));
26
  for (i = 0; i < N; i++)
27
   {
28
    for (j = 0; j < N; j++)
29
     {
30
       a[i][j] = (i*7 + j*17)%53;
31
       b[i][j] = (i*11+ j*13)%41;
32
       if (y)
33
         abort (); /* to avoid vectorization.  */
34
     }
35
   }
36
  for (i = 0; i < N; i++)
37
   {
38
    for (j = 0; j < N; j++)
39
     {
40
       c[i][j] = a[i][j];
41
       if (y)
42
         abort (); /* to avoid vectorization.  */
43
     }
44
   }
45
  for (i = 1; i < N; i++)
46
  {
47
    for (j = 0; j < N; j++)
48
    {
49
      off = x + i + j + N+1;
50
      if (x + i + j > N*N-1)
51
        break;
52
      if (off > N*N-1)
53
        *(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
54
      else
55
        *(&c[0][0]+x+i+j) = *(&a[0][0] + off);
56
       if (y)
57
         abort (); /* to avoid vectorization.  */
58
    }
59
  }
60
 
61
  for (i = 0; i < N; i++)
62
   {
63
    for (j = 0; j < N; j++)
64
     {
65
       p->a[i][j] = a[i][j];
66
       p->b[i][j] = b[i][j];
67
       /* Because Y is volatile, the compiler cannot move this check out
68
          of the loop.  */
69
       if (y)
70
         abort (); /* to avoid vectorization.  */
71
     }
72
   }
73
 
74
  /* Vectorizable: distance > number of iterations.  */
75
  for (i = 1; i < N; i++)
76
  {
77
    for (j = 0; j < N; j++)
78
    {
79
       *((int *)p + x + i + j) = *((int *)p + x + i + j + N+1);
80
    }
81
  }
82
 
83
  /* check results: */
84
  for (i = 0; i < N; i++)
85
   {
86
    for (j = 0; j < N; j++)
87
     {
88
       if (p->a[i][j] != c[i][j])
89
         abort ();
90
     }
91
  }
92
  return 0;
93
}
94
 
95
int main (void)
96
{
97
  check_vect ();
98
 
99
  return main1 (N);
100
}
101
 
102
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
103
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
104
/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
105
/* { dg-final { cleanup-tree-dump "vect" } } */
106
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.