OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [section-anchors-vect-69.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target section_anchors } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 32
7
 
8
struct s{
9
  int m;
10
  int n[N][N][N];
11
};
12
 
13
struct s2{
14
  int m;
15
  int n[N-1][N-1][N-1];
16
};
17
 
18
struct test1{
19
  struct s a; /* array a.n is unaligned */
20
  int b;
21
  int c;
22
  struct s e; /* array e.n is aligned */
23
};
24
 
25
struct test2{
26
  struct s2 a; /* array a.n is unaligned */
27
  int b;
28
  int c;
29
  struct s2 e; /* array e.n is aligned */
30
};
31
 
32
 
33
struct test1 tmp1[4];
34
struct test2 tmp2[4];
35
 
36
int main1 ()
37
{
38
  int i,j;
39
 
40
  /* 1. unaligned */
41
  for (i = 0; i < N; i++)
42
    {
43
      tmp1[2].a.n[1][2][i] = 5;
44
    }
45
 
46
  /* check results:  */
47
  for (i = 0; i <N; i++)
48
    {
49
      if (tmp1[2].a.n[1][2][i] != 5)
50
        abort ();
51
    }
52
 
53
  /* 2. aligned */
54
  for (i = 3; i < N-1; i++)
55
    {
56
      tmp1[2].a.n[1][2][i] = 6;
57
    }
58
 
59
  /* check results:  */
60
  for (i = 3; i < N-1; i++)
61
    {
62
      if (tmp1[2].a.n[1][2][i] != 6)
63
        abort ();
64
    }
65
 
66
  /* 3. aligned */
67
  for (i = 0; i < N; i++)
68
    {
69
      for (j = 0; j < N; j++)
70
        {
71
          tmp1[2].e.n[1][i][j] = 8;
72
        }
73
    }
74
 
75
  /* check results:  */
76
  for (i = 0; i < N; i++)
77
    {
78
      for (j = 0; j < N; j++)
79
        {
80
          if (tmp1[2].e.n[1][i][j] != 8)
81
            abort ();
82
        }
83
    }
84
 
85
  /* 4. unaligned */
86
  for (i = 0; i < N-4; i++)
87
    {
88
      for (j = 0; j < N-4; j++)
89
        {
90
          tmp2[2].e.n[1][i][j] = 8;
91
        }
92
    }
93
 
94
  /* check results:  */
95
  for (i = 0; i < N-4; i++)
96
    {
97
      for (j = 0; j < N-4; j++)
98
        {
99
          if (tmp2[2].e.n[1][i][j] != 8)
100
            abort ();
101
        }
102
    }
103
 
104
  return 0;
105
}
106
 
107
int main (void)
108
{
109
  check_vect ();
110
 
111
  return main1 ();
112
}
113
 
114
/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_int } } } */
115
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
116
/* Alignment forced using versioning until the pass that increases alignment
117
  is extended to handle structs.  */
118
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target {vect_int && vector_alignment_reachable } } } } */
119
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */
120
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

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