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-4_x.c] - Blame information for rev 149

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, Sc)
134
#endif
135
T(1, Sc)
136
T(2, Sc)
137
T(3, Sc)
138
T(4, Sc)
139
T(5, Sc)
140
T(6, Sc)
141
T(7, Sc)
142
T(8, Sc)
143
T(9, Sc)
144
T(10, Sc)
145
T(11, Sc)
146
T(12, Sc)
147
T(13, Sc)
148
T(14, Sc)
149
T(15, Sc)
150
#ifndef SKIP_ZERO_ARRAY
151
T(0, Ss)
152
#endif
153
T(1, Ss)
154
T(2, Ss)
155
T(3, Ss)
156
T(4, Ss)
157
T(5, Ss)
158
T(6, Ss)
159
T(7, Ss)
160
T(8, Ss)
161
T(9, Ss)
162
T(10, Ss)
163
T(11, Ss)
164
T(12, Ss)
165
T(13, Ss)
166
T(14, Ss)
167
T(15, Ss)
168
#ifndef SKIP_ZERO_ARRAY
169
T(0, Si)
170
#endif
171
T(1, Si)
172
T(2, Si)
173
T(3, Si)
174
T(4, Si)
175
T(5, Si)
176
T(6, Si)
177
T(7, Si)
178
T(8, Si)
179
T(9, Si)
180
T(10, Si)
181
T(11, Si)
182
T(12, Si)
183
T(13, Si)
184
T(14, Si)
185
T(15, Si)
186
 
187
#undef T
188
 
189
void
190
struct_by_value_4_x ()
191
{
192
DEBUG_INIT
193
 
194
#define T(N, TYPE) testit##TYPE##N ();
195
 
196
#ifndef SKIP_ZERO_ARRAY
197
T(0, Sc)
198
#endif
199
T(1, Sc)
200
T(2, Sc)
201
T(3, Sc)
202
T(4, Sc)
203
T(5, Sc)
204
T(6, Sc)
205
T(7, Sc)
206
T(8, Sc)
207
T(9, Sc)
208
T(10, Sc)
209
T(11, Sc)
210
T(12, Sc)
211
T(13, Sc)
212
T(14, Sc)
213
T(15, Sc)
214
#ifndef SKIP_ZERO_ARRAY
215
T(0, Ss)
216
#endif
217
T(1, Ss)
218
T(2, Ss)
219
T(3, Ss)
220
T(4, Ss)
221
T(5, Ss)
222
T(6, Ss)
223
T(7, Ss)
224
T(8, Ss)
225
T(9, Ss)
226
T(10, Ss)
227
T(11, Ss)
228
T(12, Ss)
229
T(13, Ss)
230
T(14, Ss)
231
T(15, Ss)
232
#ifndef SKIP_ZERO_ARRAY
233
T(0, Si)
234
#endif
235
T(1, Si)
236
T(2, Si)
237
T(3, Si)
238
T(4, Si)
239
T(5, Si)
240
T(6, Si)
241
T(7, Si)
242
T(8, Si)
243
T(9, Si)
244
T(10, Si)
245
T(11, Si)
246
T(12, Si)
247
T(13, Si)
248
T(14, Si)
249
T(15, Si)
250
 
251
DEBUG_FINI
252
 
253
if (fails != 0)
254
  abort ();
255
 
256
#undef T
257
}

powered by: WebSVN 2.1.0

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