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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [store.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Check that GDB can correctly update a value, living in a register,
2
   in the target.  This pretty much relies on the compiler taking heed
3
   of requests for values to be stored in registers.  */
4
 
5
/* NOTE: carlton/2002-12-05: These functions were all static, but for
6
   whatever reason that caused GCC 3.1 to optimize away some of the
7
   function calls within main even when no optimization flags were
8
   passed.  */
9
 
10
typedef signed char charest;
11
 
12
charest
13
add_charest (register charest u, register charest v)
14
{
15
  return u + v;
16
}
17
 
18
short
19
add_short (register short u, register short v)
20
{
21
  return u + v;
22
}
23
 
24
int
25
add_int (register int u, register int v)
26
{
27
  return u + v;
28
}
29
 
30
long
31
add_long (register long u, register long v)
32
{
33
  return u + v;
34
}
35
 
36
typedef long long longest;
37
 
38
longest
39
add_longest (register longest u, register longest v)
40
{
41
  return u + v;
42
}
43
 
44
float
45
add_float (register float u, register float v)
46
{
47
  return u + v;
48
}
49
 
50
double
51
add_double (register double u, register double v)
52
{
53
  return u + v;
54
}
55
 
56
typedef long double doublest;
57
 
58
doublest
59
add_doublest (register doublest u, register doublest v)
60
{
61
  return u + v;
62
}
63
 
64
/* */
65
 
66
charest
67
wack_charest (register charest u, register charest v)
68
{
69
  register charest l = u, r = v;
70
  l = add_charest (l, r);
71
  return l + r;
72
}
73
 
74
short
75
wack_short (register short u, register short v)
76
{
77
  register short l = u, r = v;
78
  l = add_short (l, r);
79
  return l + r;
80
}
81
 
82
int
83
wack_int (register int u, register int v)
84
{
85
  register int l = u, r = v;
86
  l = add_int (l, r);
87
  return l + r;
88
}
89
 
90
long
91
wack_long (register long u, register long v)
92
{
93
  register long l = u, r = v;
94
  l = add_long (l, r);
95
  return l + r;
96
}
97
 
98
long
99
wack_longest (register longest u, register longest v)
100
{
101
  register longest l = u, r = v;
102
  l = add_longest (l, r);
103
  return l + r;
104
}
105
 
106
float
107
wack_float (register float u, register float v)
108
{
109
  register float l = u, r = v;
110
  l = add_float (l, r);
111
  return l + r;
112
}
113
 
114
double
115
wack_double (register double u, register double v)
116
{
117
  register double l = u, r = v;
118
  l = add_double (l, r);
119
  return l + r;
120
}
121
 
122
doublest
123
wack_doublest (register doublest u, register doublest v)
124
{
125
  register doublest l = u, r = v;
126
  l = add_doublest (l, r);
127
  return l + r;
128
}
129
 
130
/* */
131
 
132
struct s_1 { short s[1]; } z_1, s_1;
133
struct s_2 { short s[2]; } z_2, s_2;
134
struct s_3 { short s[3]; } z_3, s_3;
135
struct s_4 { short s[4]; } z_4, s_4;
136
 
137
struct s_1
138
add_struct_1 (struct s_1 s)
139
{
140
  int i;
141
  for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
142
    {
143
      s.s[i] = s.s[i] + s.s[i];
144
    }
145
  return s;
146
}
147
 
148
struct s_2
149
add_struct_2 (struct s_2 s)
150
{
151
  int i;
152
  for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
153
    {
154
      s.s[i] = s.s[i] + s.s[i];
155
    }
156
  return s;
157
}
158
 
159
struct s_3
160
add_struct_3 (struct s_3 s)
161
{
162
  int i;
163
  for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
164
    {
165
      s.s[i] = s.s[i] + s.s[i];
166
    }
167
  return s;
168
}
169
 
170
struct s_4
171
add_struct_4 (struct s_4 s)
172
{
173
  int i;
174
  for (i = 0; i < sizeof (s) / sizeof (s.s[0]); i++)
175
    {
176
      s.s[i] = s.s[i] + s.s[i];
177
    }
178
  return s;
179
}
180
 
181
struct s_1
182
wack_struct_1 (void)
183
{
184
  int i; register struct s_1 u = z_1;
185
  for (i = 0; i < sizeof (s_1) / sizeof (s_1.s[0]); i++) { s_1.s[i] = i + 1; }
186
  u = add_struct_1 (u);
187
  return u;
188
}
189
 
190
struct s_2
191
wack_struct_2 (void)
192
{
193
  int i; register struct s_2 u = z_2;
194
  for (i = 0; i < sizeof (s_2) / sizeof (s_2.s[0]); i++) { s_2.s[i] = i + 1; }
195
  u = add_struct_2 (u);
196
  return u;
197
}
198
 
199
struct s_3
200
wack_struct_3 (void)
201
{
202
  int i; register struct s_3 u = z_3;
203
  for (i = 0; i < sizeof (s_3) / sizeof (s_3.s[0]); i++) { s_3.s[i] = i + 1; }
204
  u = add_struct_3 (u);
205
  return u;
206
}
207
 
208
struct s_4
209
wack_struct_4 (void)
210
{
211
  int i; register struct s_4 u = z_4;
212
  for (i = 0; i < sizeof (s_4) / sizeof (s_4.s[0]); i++) { s_4.s[i] = i + 1; }
213
  u = add_struct_4 (u);
214
  return u;
215
}
216
 
217
/* */
218
 
219
struct f_1 {unsigned i:1;unsigned j:1;unsigned k:1; } f_1 = {1,1,1}, F_1;
220
struct f_2 {unsigned i:2;unsigned j:2;unsigned k:2; } f_2 = {1,1,1}, F_2;
221
struct f_3 {unsigned i:3;unsigned j:3;unsigned k:3; } f_3 = {1,1,1}, F_3;
222
struct f_4 {unsigned i:4;unsigned j:4;unsigned k:4; } f_4 = {1,1,1}, F_4;
223
 
224
struct f_1
225
wack_field_1 (void)
226
{
227
  register struct f_1 u = f_1;
228
  return u;
229
}
230
 
231
struct f_2
232
wack_field_2 (void)
233
{
234
  register struct f_2 u = f_2;
235
  return u;
236
}
237
 
238
struct f_3
239
wack_field_3 (void)
240
{
241
  register struct f_3 u = f_3;
242
  return u;
243
}
244
 
245
struct f_4
246
wack_field_4 (void)
247
{
248
  register struct f_4 u = f_4;
249
  return u;
250
}
251
 
252
/* */
253
 
254
int
255
main ()
256
{
257
  /* These calls are for current frame test.  */
258
  wack_charest (-1, -2);
259
  wack_short (-1, -2);
260
  wack_int (-1, -2);
261
  wack_long (-1, -2);
262
  wack_longest (-1, -2);
263
  wack_float (-1, -2);
264
  wack_double (-1, -2);
265
  wack_doublest (-1, -2);
266
 
267
  /* These calls are for up frame.  */
268
  wack_charest (-1, -2);
269
  wack_short (-1, -2);
270
  wack_int (-1, -2);
271
  wack_long (-1, -2);
272
  wack_longest (-1, -2);
273
  wack_float (-1, -2);
274
  wack_double (-1, -2);
275
  wack_doublest (-1, -2);
276
 
277
  /* These calls are for current frame test.  */
278
  wack_struct_1 ();
279
  wack_struct_2 ();
280
  wack_struct_3 ();
281
  wack_struct_4 ();
282
 
283
  /* These calls are for up frame.  */
284
  wack_struct_1 ();
285
  wack_struct_2 ();
286
  wack_struct_3 ();
287
  wack_struct_4 ();
288
 
289
  wack_field_1 ();
290
  wack_field_2 ();
291
  wack_field_3 ();
292
  wack_field_4 ();
293
 
294
  return 0;
295
}

powered by: WebSVN 2.1.0

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