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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [spu/] [abi.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
/* Test that arguments are passed in the correct location according to the ABI.  */
4
 
5
#include <stdlib.h>
6
 
7
/* Hack to allow calling func_asm which takes 84 arguments that are scalars.
8
   The function func_call takes 84 union quadword arguments, so we can check to
9
   see if each scalar is passed in the correct location.  This asm glues the
10
   two functions together, so that the compiler is not aware of the
11
   aliasing.  */
12
__asm__ ("func_asm = func_call");
13
 
14
typedef unsigned int uqword __attribute__((mode(TI)));
15
typedef int qword __attribute__((mode(TI)));
16
 
17
union u
18
{
19
  uqword                uq;
20
  qword                 sq;
21
  double                d[2];
22
  float                 f[4];
23
  unsigned long long    ull[2];
24
  long long             sll[2];
25
  unsigned long         ul[4];
26
  long                  sl[4];
27
  unsigned int          ui[4];
28
  int                   si[4];
29
  unsigned short        us[8];
30
  short                 ss[8];
31
  unsigned char         uc[16];
32
  signed char           sc[16];
33
};
34
 
35
 
36
extern void func_asm(signed char a1,
37
                     unsigned char a2,
38
                     short a3,
39
                     unsigned short a4,
40
                     int a5,
41
                     unsigned int a6,
42
                     long a7,
43
                     unsigned long a8,
44
                     long long a9,
45
                     unsigned long long a10,
46
                     float a11,
47
                     double a12,
48
                     int a13,
49
                     int a14,
50
                     int a15,
51
                     int a16,
52
                     int a17,
53
                     int a18,
54
                     int a19,
55
                     int a20,
56
                     int a21,
57
                     int a22,
58
                     int a23,
59
                     int a24,
60
                     int a25,
61
                     int a26,
62
                     int a27,
63
                     int a28,
64
                     int a29,
65
                     int a30,
66
                     int a31,
67
                     int a32,
68
                     int a33,
69
                     int a34,
70
                     int a35,
71
                     int a36,
72
                     int a37,
73
                     int a38,
74
                     int a39,
75
                     int a40,
76
                     int a41,
77
                     int a42,
78
                     int a43,
79
                     int a44,
80
                     int a45,
81
                     int a46,
82
                     int a47,
83
                     int a48,
84
                     int a49,
85
                     int a50,
86
                     int a51,
87
                     int a52,
88
                     int a53,
89
                     int a54,
90
                     int a55,
91
                     int a56,
92
                     int a57,
93
                     int a58,
94
                     int a59,
95
                     int a60,
96
                     int a61,
97
                     int a62,
98
                     int a63,
99
                     int a64,
100
                     int a65,
101
                     int a66,
102
                     int a67,
103
                     int a68,
104
                     int a69,
105
                     int a70,
106
                     int a71,
107
                     int a72,
108
                     signed char a73,
109
                     unsigned char a74,
110
                     short a75,
111
                     unsigned short a76,
112
                     int a77,
113
                     unsigned int a78,
114
                     long a79,
115
                     unsigned long a80,
116
                     long long a81,
117
                     unsigned long long a82,
118
                     float a83,
119
                     double a84);
120
 
121
void func_call(union u a1,
122
               union u a2,
123
               union u a3,
124
               union u a4,
125
               union u a5,
126
               union u a6,
127
               union u a7,
128
               union u a8,
129
               union u a9,
130
               union u a10,
131
               union u a11,
132
               union u a12,
133
               union u a13,
134
               union u a14,
135
               union u a15,
136
               union u a16,
137
               union u a17,
138
               union u a18,
139
               union u a19,
140
               union u a20,
141
               union u a21,
142
               union u a22,
143
               union u a23,
144
               union u a24,
145
               union u a25,
146
               union u a26,
147
               union u a27,
148
               union u a28,
149
               union u a29,
150
               union u a30,
151
               union u a31,
152
               union u a32,
153
               union u a33,
154
               union u a34,
155
               union u a35,
156
               union u a36,
157
               union u a37,
158
               union u a38,
159
               union u a39,
160
               union u a40,
161
               union u a41,
162
               union u a42,
163
               union u a43,
164
               union u a44,
165
               union u a45,
166
               union u a46,
167
               union u a47,
168
               union u a48,
169
               union u a49,
170
               union u a50,
171
               union u a51,
172
               union u a52,
173
               union u a53,
174
               union u a54,
175
               union u a55,
176
               union u a56,
177
               union u a57,
178
               union u a58,
179
               union u a59,
180
               union u a60,
181
               union u a61,
182
               union u a62,
183
               union u a63,
184
               union u a64,
185
               union u a65,
186
               union u a66,
187
               union u a67,
188
               union u a68,
189
               union u a69,
190
               union u a70,
191
               union u a71,
192
               union u a72,
193
               union u a73,
194
               union u a74,
195
               union u a75,
196
               union u a76,
197
               union u a77,
198
               union u a78,
199
               union u a79,
200
               union u a80,
201
               union u a81,
202
               union u a82,
203
               union u a83,
204
               union u a84)
205
{
206
  /* arguments passed in registers */
207
  if (a1.sc[3] != -1)                   /* signed char */
208
    abort ();
209
 
210
  if (a2.uc[3] != +2)                   /* unsigned char */
211
    abort ();
212
 
213
  if (a3.ss[1] != -3)                   /* short */
214
    abort ();
215
 
216
  if (a4.us[1] != +4)                   /* unsigned short */
217
    abort ();
218
 
219
  if (a5.si[0] != -5)                    /* int */
220
    abort ();
221
 
222
  if (a6.ui[0] != +6)                    /* unsigned int */
223
    abort ();
224
 
225
  if (a7.sl[0] != -7)                    /* long */
226
    abort ();
227
 
228
  if (a8.ul[0] != +8)                    /* unsigned long */
229
    abort ();
230
 
231
  if (a9.sll[0] != -9)                   /* long long */
232
    abort ();
233
 
234
  if (a10.ull[0] != +10)         /* unsigned long long */
235
    abort ();
236
 
237
  if (a11.f[0] != -11.0f)                /* float */
238
    abort ();
239
 
240
  if (a12.d[0] != +12.0)         /* double */
241
    abort ();
242
 
243
  if (a13.si[0] != -13)                  /* int */
244
    abort ();
245
 
246
  if (a14.si[0] != +14)                  /* int */
247
    abort ();
248
 
249
  if (a15.si[0] != -15)                  /* int */
250
    abort ();
251
 
252
  if (a16.si[0] != +16)                  /* int */
253
    abort ();
254
 
255
  if (a17.si[0] != -17)                  /* int */
256
    abort ();
257
 
258
  if (a18.si[0] != +18)                  /* int */
259
    abort ();
260
 
261
  if (a19.si[0] != -19)                  /* int */
262
    abort ();
263
 
264
  if (a20.si[0] != +20)                  /* int */
265
    abort ();
266
 
267
  if (a21.si[0] != -21)                  /* int */
268
    abort ();
269
 
270
  if (a22.si[0] != +22)                  /* int */
271
    abort ();
272
 
273
  if (a23.si[0] != -23)                  /* int */
274
    abort ();
275
 
276
  if (a24.si[0] != +24)                  /* int */
277
    abort ();
278
 
279
  if (a25.si[0] != -25)                  /* int */
280
    abort ();
281
 
282
  if (a26.si[0] != +26)                  /* int */
283
    abort ();
284
 
285
  if (a27.si[0] != -27)                  /* int */
286
    abort ();
287
 
288
  if (a28.si[0] != +28)                  /* int */
289
    abort ();
290
 
291
  if (a29.si[0] != -29)                  /* int */
292
    abort ();
293
 
294
  if (a30.si[0] != +30)                  /* int */
295
    abort ();
296
 
297
  if (a31.si[0] != -31)                  /* int */
298
    abort ();
299
 
300
  if (a32.si[0] != +32)                  /* int */
301
    abort ();
302
 
303
  if (a33.si[0] != -33)                  /* int */
304
    abort ();
305
 
306
  if (a34.si[0] != +34)                  /* int */
307
    abort ();
308
 
309
  if (a35.si[0] != -35)                  /* int */
310
    abort ();
311
 
312
  if (a36.si[0] != +36)                  /* int */
313
    abort ();
314
 
315
  if (a37.si[0] != -37)                  /* int */
316
    abort ();
317
 
318
  if (a38.si[0] != +38)                  /* int */
319
    abort ();
320
 
321
  if (a39.si[0] != -39)                  /* int */
322
    abort ();
323
 
324
  if (a40.si[0] != +40)                  /* int */
325
    abort ();
326
 
327
  if (a41.si[0] != -41)                  /* int */
328
    abort ();
329
 
330
  if (a42.si[0] != +42)                  /* int */
331
    abort ();
332
 
333
  if (a43.si[0] != -43)                  /* int */
334
    abort ();
335
 
336
  if (a44.si[0] != +44)                  /* int */
337
    abort ();
338
 
339
  if (a45.si[0] != -45)                  /* int */
340
    abort ();
341
 
342
  if (a46.si[0] != +46)                  /* int */
343
    abort ();
344
 
345
  if (a47.si[0] != -47)                  /* int */
346
    abort ();
347
 
348
  if (a48.si[0] != +48)                  /* int */
349
    abort ();
350
 
351
  if (a49.si[0] != -49)                  /* int */
352
    abort ();
353
 
354
  if (a50.si[0] != +50)                  /* int */
355
    abort ();
356
 
357
  if (a51.si[0] != -51)                  /* int */
358
    abort ();
359
 
360
  if (a52.si[0] != +52)                  /* int */
361
    abort ();
362
 
363
  if (a53.si[0] != -53)                  /* int */
364
    abort ();
365
 
366
  if (a54.si[0] != +54)                  /* int */
367
    abort ();
368
 
369
  if (a55.si[0] != -55)                  /* int */
370
    abort ();
371
 
372
  if (a56.si[0] != +56)                  /* int */
373
    abort ();
374
 
375
  if (a57.si[0] != -57)                  /* int */
376
    abort ();
377
 
378
  if (a58.si[0] != +58)                  /* int */
379
    abort ();
380
 
381
  if (a59.si[0] != -59)                  /* int */
382
    abort ();
383
 
384
  if (a60.si[0] != +60)                  /* int */
385
    abort ();
386
 
387
  if (a61.si[0] != -61)                  /* int */
388
    abort ();
389
 
390
  if (a62.si[0] != +62)                  /* int */
391
    abort ();
392
 
393
  if (a63.si[0] != -63)                  /* int */
394
    abort ();
395
 
396
  if (a64.si[0] != +64)                  /* int */
397
    abort ();
398
 
399
  if (a65.si[0] != -65)                  /* int */
400
    abort ();
401
 
402
  if (a66.si[0] != +66)                  /* int */
403
    abort ();
404
 
405
  if (a67.si[0] != -67)                  /* int */
406
    abort ();
407
 
408
  if (a68.si[0] != +68)                  /* int */
409
    abort ();
410
 
411
  if (a69.si[0] != -69)                  /* int */
412
    abort ();
413
 
414
  if (a70.si[0] != +70)                  /* int */
415
    abort ();
416
 
417
  if (a71.si[0] != -71)                  /* int */
418
    abort ();
419
 
420
  if (a72.si[0] != +72)                  /* int */
421
    abort ();
422
 
423
  /* arguments passed on the stack */
424
  if (a73.sc[3] != -73)                 /* signed char */
425
    abort ();
426
 
427
  if (a74.uc[3] != 74)                  /* unsigned char */
428
    abort ();
429
 
430
  if (a75.ss[1] != -75)                 /* short */
431
    abort ();
432
 
433
  if (a76.us[1] != +76)                 /* unsigned short */
434
    abort ();
435
 
436
  if (a77.si[0] != -77)                  /* int */
437
    abort ();
438
 
439
  if (a78.ui[0] != +78)                  /* unsigned int */
440
    abort ();
441
 
442
  if (a79.sl[0] != -79)                  /* long */
443
    abort ();
444
 
445
  if (a80.ul[0] != +80)                  /* unsigned long */
446
    abort ();
447
 
448
  if (a81.sll[0] != -81)         /* long long */
449
    abort ();
450
 
451
  if (a82.ull[0] != +82)         /* unsigned long long */
452
    abort ();
453
 
454
  if (a83.f[0] != -83.0f)                /* float */
455
    abort ();
456
 
457
  if (a84.d[0] != +84.0)         /* double */
458
    abort ();
459
}
460
 
461
int main(void)
462
{
463
  func_asm(-1,   +2,  -3,  +4,  -5,  +6,  -7,  +8,  -9, +10,
464
           -11, +12, -13, +14, -15, +16, -17, +18, -19, +20,
465
           -21, +22, -23, +24, -25, +26, -27, +28, -29, +30,
466
           -31, +32, -33, +34, -35, +36, -37, +38, -39, +40,
467
           -41, +42, -43, +44, -45, +46, -47, +48, -49, +50,
468
           -51, +52, -53, +54, -55, +56, -57, +58, -59, +60,
469
           -61, +62, -63, +64, -65, +66, -67, +68, -69, +70,
470
           -71, +72, -73, +74, -75, +76, -77, +78, -79, +80,
471
           -81, +82, -83, +84);
472
 
473
  return 0;
474
}

powered by: WebSVN 2.1.0

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