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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [compat/] [struct-by-value-8_x.c] - Blame information for rev 823

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

Line No. Rev Author Line
1 149 jeremybenn
#include "compat-common.h"
2
 
3
#define T(N, TYPE)                                              \
4
struct S##TYPE##N { TYPE i[N]; };                               \
5
                                                                \
6
struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N;                   \
7
struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N;                   \
8
struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N;                   \
9
struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N;                   \
10
struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N;                  \
11
struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N;                 \
12
struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N;                 \
13
struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N;                 \
14
                                                                \
15
extern void init##TYPE (TYPE *p, int i);                        \
16
extern void checkg##TYPE##N (void);                             \
17
extern void                                                     \
18
test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2,      \
19
               struct S##TYPE##N s3, struct S##TYPE##N s4,      \
20
               struct S##TYPE##N s5, struct S##TYPE##N s6,      \
21
               struct S##TYPE##N s7, struct S##TYPE##N s8,      \
22
               struct S##TYPE##N s9, struct S##TYPE##N s10,     \
23
               struct S##TYPE##N s11, struct S##TYPE##N s12,    \
24
               struct S##TYPE##N s13, struct S##TYPE##N s14,    \
25
               struct S##TYPE##N s15, struct S##TYPE##N s16);   \
26
extern void testva##TYPE##N (int n, ...);                       \
27
                                                                \
28
                                                                \
29
void                                                            \
30
init##TYPE##N (struct S##TYPE##N *p, int i)                     \
31
{                                                               \
32
  int j;                                                        \
33
  for (j = 0; j < N; j++)                                        \
34
    init##TYPE(&p->i[j], i+j);                                  \
35
}                                                               \
36
                                                                \
37
void                                                            \
38
check##TYPE##N (struct S##TYPE##N *p, int i)                    \
39
{                                                               \
40
  int j;                                                        \
41
  for (j = 0; j < N; j++)                                        \
42
    check##TYPE(p->i[j], i+j);                                  \
43
}                                                               \
44
                                                                \
45
void                                                            \
46
test2_##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2,    \
47
                 struct S##TYPE##N s3, struct S##TYPE##N s4,    \
48
                 struct S##TYPE##N s5, struct S##TYPE##N s6,    \
49
                 struct S##TYPE##N s7, struct S##TYPE##N s8)    \
50
{                                                               \
51
  test##TYPE##N (s1, g2s##TYPE##N, s2, g4s##TYPE##N,            \
52
                 s3, g6s##TYPE##N, s4, g8s##TYPE##N,            \
53
                 s5, g10s##TYPE##N, s6, g12s##TYPE##N,          \
54
                 s7, g14s##TYPE##N, s8, g16s##TYPE##N);         \
55
}                                                               \
56
                                                                \
57
void                                                            \
58
testit##TYPE##N (void)                                          \
59
{                                                               \
60
  DEBUG_FPUTS (#TYPE "[" #N "]");                               \
61
  DEBUG_FPUTS (" init: ");                                      \
62
  init##TYPE##N  ( &g1s##TYPE##N,  1*16);                       \
63
  init##TYPE##N  ( &g2s##TYPE##N,  2*16);                       \
64
  init##TYPE##N  ( &g3s##TYPE##N,  3*16);                       \
65
  init##TYPE##N  ( &g4s##TYPE##N,  4*16);                       \
66
  init##TYPE##N  ( &g5s##TYPE##N,  5*16);                       \
67
  init##TYPE##N  ( &g6s##TYPE##N,  6*16);                       \
68
  init##TYPE##N  ( &g7s##TYPE##N,  7*16);                       \
69
  init##TYPE##N  ( &g8s##TYPE##N,  8*16);                       \
70
  init##TYPE##N  ( &g9s##TYPE##N,  9*16);                       \
71
  init##TYPE##N  (&g10s##TYPE##N, 10*16);                       \
72
  init##TYPE##N  (&g11s##TYPE##N, 11*16);                       \
73
  init##TYPE##N  (&g12s##TYPE##N, 12*16);                       \
74
  init##TYPE##N  (&g13s##TYPE##N, 13*16);                       \
75
  init##TYPE##N  (&g14s##TYPE##N, 14*16);                       \
76
  init##TYPE##N  (&g15s##TYPE##N, 15*16);                       \
77
  init##TYPE##N  (&g16s##TYPE##N, 16*16);                       \
78
  checkg##TYPE##N ();                                           \
79
  DEBUG_NL;                                                     \
80
  DEBUG_FPUTS (#TYPE "[" #N "]");                               \
81
  DEBUG_FPUTS (" test: ");                                      \
82
  test##TYPE##N (g1s##TYPE##N, g2s##TYPE##N,                    \
83
                 g3s##TYPE##N, g4s##TYPE##N,                    \
84
                 g5s##TYPE##N, g6s##TYPE##N,                    \
85
                 g7s##TYPE##N, g8s##TYPE##N,                    \
86
                 g9s##TYPE##N, g10s##TYPE##N,                   \
87
                 g11s##TYPE##N, g12s##TYPE##N,                  \
88
                 g13s##TYPE##N, g14s##TYPE##N,                  \
89
                 g15s##TYPE##N, g16s##TYPE##N);                 \
90
  DEBUG_NL;                                                     \
91
  DEBUG_FPUTS (#TYPE "[" #N "]");                               \
92
  DEBUG_FPUTS (" testva:");                                     \
93
  testva##TYPE##N (16,                                          \
94
                   g1s##TYPE##N, g2s##TYPE##N,                  \
95
                   g3s##TYPE##N, g4s##TYPE##N,                  \
96
                   g5s##TYPE##N, g6s##TYPE##N,                  \
97
                   g7s##TYPE##N, g8s##TYPE##N,                  \
98
                   g9s##TYPE##N, g10s##TYPE##N,                 \
99
                   g11s##TYPE##N, g12s##TYPE##N,                \
100
                   g13s##TYPE##N, g14s##TYPE##N,                \
101
                   g15s##TYPE##N, g16s##TYPE##N);               \
102
  DEBUG_NL;                                                     \
103
  DEBUG_FPUTS (#TYPE "[" #N "]");                               \
104
  DEBUG_FPUTS (" test2: ");                                     \
105
  test2_##TYPE##N (g1s##TYPE##N, g3s##TYPE##N,                  \
106
                   g5s##TYPE##N, g7s##TYPE##N,                  \
107
                   g9s##TYPE##N, g11s##TYPE##N,                 \
108
                   g13s##TYPE##N, g15s##TYPE##N);               \
109
  DEBUG_NL;                                                     \
110
}
111
 
112
typedef struct { char c; } Sc;
113
typedef struct { short s; } Ss;
114
typedef struct { int i; } Si;
115
typedef struct { short s; char c; } Ssc;
116
typedef struct { int i; short s; } Sis;
117
typedef struct { char c; short s; int i; } Scsi;
118
typedef struct { char c; int i; short s; } Scis;
119
 
120
void checkSc (Sc x, int i) { if (x.c != i/16) DEBUG_CHECK }
121
void checkSs (Ss x, int i) { if (x.s != i) DEBUG_CHECK }
122
void checkSi (Si x, int i) { if (x.i != i) DEBUG_CHECK }
123
void checkSsc (Ssc x, int i)
124
{ if (x.s != i || x.c != (i/16)+1) DEBUG_CHECK }
125
void checkSis (Sis x, int i)
126
{ if (x.i != i || x.s != i+1) DEBUG_CHECK }
127
void checkScsi (Scsi x, int i)
128
{ if (x.c != i/16 || x.s != i+1 || x.i != i+2) DEBUG_CHECK }
129
void checkScis (Scis x, int i)
130
{ if (x.c != i/16 || x.i != i+1 || x.s != i+2) DEBUG_CHECK }
131
 
132
#ifndef SKIP_ZERO_ARRAY
133
T(0, Ssc)
134
#endif
135
T(1, Ssc)
136
T(2, Ssc)
137
T(3, Ssc)
138
T(4, Ssc)
139
T(5, Ssc)
140
T(6, Ssc)
141
T(7, Ssc)
142
T(8, Ssc)
143
T(9, Ssc)
144
T(10, Ssc)
145
T(11, Ssc)
146
T(12, Ssc)
147
T(13, Ssc)
148
T(14, Ssc)
149
T(15, Ssc)
150
#ifndef SKIP_ZERO_ARRAY
151
T(0, Sis)
152
#endif
153
T(1, Sis)
154
T(2, Sis)
155
T(3, Sis)
156
T(4, Sis)
157
T(5, Sis)
158
T(6, Sis)
159
T(7, Sis)
160
T(8, Sis)
161
T(9, Sis)
162
T(10, Sis)
163
T(11, Sis)
164
T(12, Sis)
165
T(13, Sis)
166
T(14, Sis)
167
T(15, Sis)
168
 
169
#undef T
170
 
171
void
172
struct_by_value_8_x ()
173
{
174
DEBUG_INIT
175
 
176
#define T(N, TYPE) testit##TYPE##N ();
177
 
178
#ifndef SKIP_ZERO_ARRAY
179
T(0, Ssc)
180
#endif
181
T(1, Ssc)
182
T(2, Ssc)
183
T(3, Ssc)
184
T(4, Ssc)
185
T(5, Ssc)
186
T(6, Ssc)
187
T(7, Ssc)
188
T(8, Ssc)
189
T(9, Ssc)
190
T(10, Ssc)
191
T(11, Ssc)
192
T(12, Ssc)
193
T(13, Ssc)
194
T(14, Ssc)
195
T(15, Ssc)
196
#ifndef SKIP_ZERO_ARRAY
197
T(0, Sis)
198
#endif
199
T(1, Sis)
200
T(2, Sis)
201
T(3, Sis)
202
T(4, Sis)
203
T(5, Sis)
204
T(6, Sis)
205
T(7, Sis)
206
T(8, Sis)
207
T(9, Sis)
208
T(10, Sis)
209
T(11, Sis)
210
T(12, Sis)
211
T(13, Sis)
212
T(14, Sis)
213
T(15, Sis)
214
 
215
DEBUG_FINI
216
 
217
if (fails != 0)
218
  abort ();
219
 
220
#undef T
221
}

powered by: WebSVN 2.1.0

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