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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [mips/] [inter/] [mips16_stubs_1_x.c] - Blame information for rev 321

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 321 jeremybenn
#include <stdlib.h>
2
 
3
/* All the function pointers are declared and initialized in
4
   mips16-stubs-2.c.  */
5
 
6
extern double the_result;
7
 
8
extern void v0 (void);
9
extern void v1 (float);
10
extern void v5 (float, float);
11
extern void v9 (float, double);
12
extern void v2 (double);
13
extern void v6 (double, float);
14
extern void v10 (double, double);
15
 
16
extern float f0 (void);
17
extern float f1 (float);
18
extern float f5 (float, float);
19
extern float f9 (float, double);
20
extern float f2 (double);
21
extern float f6 (double, float);
22
extern float f10 (double, double);
23
 
24
extern double d0 (void);
25
extern double d1 (float);
26
extern double d5 (float, float);
27
extern double d9 (float, double);
28
extern double d2 (double);
29
extern double d6 (double, float);
30
extern double d10 (double, double);
31
 
32
extern _Complex float cf0 (void);
33
extern _Complex float cf1 (float);
34
extern _Complex float cf5 (float, float);
35
extern _Complex float cf9 (float, double);
36
extern _Complex float cf2 (double);
37
extern _Complex float cf6 (double, float);
38
extern _Complex float cf10 (double, double);
39
 
40
extern _Complex double cd0 (void);
41
extern _Complex double cd1 (float);
42
extern _Complex double cd5 (float, float);
43
extern _Complex double cd9 (float, double);
44
extern _Complex double cd2 (double);
45
extern _Complex double cd6 (double, float);
46
extern _Complex double cd10 (double, double);
47
 
48
extern void (*pv0) (void);
49
extern void (*pv1) (float);
50
extern void (*pv5) (float, float);
51
extern void (*pv9) (float, double);
52
extern void (*pv2) (double);
53
extern void (*pv6) (double, float);
54
extern void (*pv10) (double, double);
55
 
56
extern float (*pf0) (void);
57
extern float (*pf1) (float);
58
extern float (*pf5) (float, float);
59
extern float (*pf9) (float, double);
60
extern float (*pf2) (double);
61
extern float (*pf6) (double, float);
62
extern float (*pf10) (double, double);
63
 
64
extern double (*pd0) (void);
65
extern double (*pd1) (float);
66
extern double (*pd5) (float, float);
67
extern double (*pd9) (float, double);
68
extern double (*pd2) (double);
69
extern double (*pd6) (double, float);
70
extern double (*pd10) (double, double);
71
 
72
extern _Complex float (*pcf0) (void);
73
extern _Complex float (*pcf1) (float);
74
extern _Complex float (*pcf5) (float, float);
75
extern _Complex float (*pcf9) (float, double);
76
extern _Complex float (*pcf2) (double);
77
extern _Complex float (*pcf6) (double, float);
78
extern _Complex float (*pcf10) (double, double);
79
 
80
extern _Complex double (*pcd0) (void);
81
extern _Complex double (*pcd1) (float);
82
extern _Complex double (*pcd5) (float, float);
83
extern _Complex double (*pcd9) (float, double);
84
extern _Complex double (*pcd2) (double);
85
extern _Complex double (*pcd6) (double, float);
86
extern _Complex double (*pcd10) (double, double);
87
 
88
/* Macros for results checking.  */
89
#define CHECK_RESULT(x, y) if ((x) != (y)) abort ()
90
#define CHECK_VOID_RESULT(x, y)  CHECK_RESULT (((x), the_result), y)
91
 
92
/* Call functions through pointers and and check against expected results.  */
93
void
94
test (void)
95
{
96
 
97
  CHECK_VOID_RESULT (v0 (), 1.0);
98
  CHECK_VOID_RESULT (v1 (1.0), 2.0);
99
  CHECK_VOID_RESULT (v5 (5.0, 6.0), 12.0);
100
  CHECK_VOID_RESULT (v9 (9.0, 10.0), 20.0);
101
  CHECK_VOID_RESULT (v2 (2.0), 3.0);
102
  CHECK_VOID_RESULT (v6 (6.0, 7.0), 14.0);
103
  CHECK_VOID_RESULT (v10 (10.0, 11.0), 22.0);
104
 
105
  CHECK_RESULT (f0 (), 1.0);
106
  CHECK_RESULT (f1 (1.0), 2.0);
107
  CHECK_RESULT (f5 (5.0, 6.0), 12.0);
108
  CHECK_RESULT (f9 (9.0, 10.0), 20.0);
109
  CHECK_RESULT (f2 (2.0), 3.0);
110
  CHECK_RESULT (f6 (6.0, 7.0), 14.0);
111
  CHECK_RESULT (f10 (10.0, 11.0), 22.0);
112
 
113
  CHECK_RESULT (d0 (), 1.0);
114
  CHECK_RESULT (d1 (1.0), 2.0);
115
  CHECK_RESULT (d5 (5.0, 6.0), 12.0);
116
  CHECK_RESULT (d9 (9.0, 10.0), 20.0);
117
  CHECK_RESULT (d2 (2.0), 3.0);
118
  CHECK_RESULT (d6 (6.0, 7.0), 14.0);
119
  CHECK_RESULT (d10 (10.0, 11.0), 22.0);
120
 
121
  CHECK_RESULT (cf0 (), 1.0 + 0.0i);
122
  CHECK_RESULT (cf1 (1.0), 2.0 + 1.0i);
123
  CHECK_RESULT (cf5 (5.0, 6.0), 12.0 + 5.0i);
124
  CHECK_RESULT (cf9 (9.0, 10.0), 20.0 + 9.0i);
125
  CHECK_RESULT (cf2 (2.0), 3.0 + 2.0i);
126
  CHECK_RESULT (cf6 (6.0, 7.0), 14.0 + 6.0i);
127
  CHECK_RESULT (cf10 (10.0, 11.0), 22.0 + 10.0i);
128
 
129
  CHECK_RESULT (cd0 (), 1.0 + 0.0i);
130
  CHECK_RESULT (cd1 (1.0), 2.0 + 1.0i);
131
  CHECK_RESULT (cd5 (5.0, 6.0), 12.0 + 5.0i);
132
  CHECK_RESULT (cd9 (9.0, 10.0), 20.0 + 9.0i);
133
  CHECK_RESULT (cd2 (2.0), 3.0 + 2.0i);
134
  CHECK_RESULT (cd6 (6.0, 7.0), 14.0 + 6.0i);
135
  CHECK_RESULT (cd10 (10.0, 11.0), 22.0 + 10.0i);
136
 
137
  CHECK_VOID_RESULT ((*pv0) (), 1.0);
138
  CHECK_VOID_RESULT ((*pv1) (1.0), 2.0);
139
  CHECK_VOID_RESULT ((*pv5) (5.0, 6.0), 12.0);
140
  CHECK_VOID_RESULT ((*pv9) (9.0, 10.0), 20.0);
141
  CHECK_VOID_RESULT ((*pv2) (2.0), 3.0);
142
  CHECK_VOID_RESULT ((*pv6) (6.0, 7.0), 14.0);
143
  CHECK_VOID_RESULT ((*pv10) (10.0, 11.0), 22.0);
144
 
145
  CHECK_RESULT ((*pf0) (), 1.0);
146
  CHECK_RESULT ((*pf1) (1.0), 2.0);
147
  CHECK_RESULT ((*pf5) (5.0, 6.0), 12.0);
148
  CHECK_RESULT ((*pf9) (9.0, 10.0), 20.0);
149
  CHECK_RESULT ((*pf2) (2.0), 3.0);
150
  CHECK_RESULT ((*pf6) (6.0, 7.0), 14.0);
151
  CHECK_RESULT ((*pf10) (10.0, 11.0), 22.0);
152
 
153
  CHECK_RESULT ((*pd0) (), 1.0);
154
  CHECK_RESULT ((*pd1) (1.0), 2.0);
155
  CHECK_RESULT ((*pd5) (5.0, 6.0), 12.0);
156
  CHECK_RESULT ((*pd9) (9.0, 10.0), 20.0);
157
  CHECK_RESULT ((*pd2) (2.0), 3.0);
158
  CHECK_RESULT ((*pd6) (6.0, 7.0), 14.0);
159
  CHECK_RESULT ((*pd10) (10.0, 11.0), 22.0);
160
 
161
  CHECK_RESULT ((*pcf0) (), 1.0 + 0.0i);
162
  CHECK_RESULT ((*pcf1) (1.0), 2.0 + 1.0i);
163
  CHECK_RESULT ((*pcf5) (5.0, 6.0), 12.0 + 5.0i);
164
  CHECK_RESULT ((*pcf9) (9.0, 10.0), 20.0 + 9.0i);
165
  CHECK_RESULT ((*pcf2) (2.0), 3.0 + 2.0i);
166
  CHECK_RESULT ((*pcf6) (6.0, 7.0), 14.0 + 6.0i);
167
  CHECK_RESULT ((*pcf10) (10.0, 11.0), 22.0 + 10.0i);
168
 
169
  CHECK_RESULT ((*pcd0) (), 1.0 + 0.0i);
170
  CHECK_RESULT ((*pcd1) (1.0), 2.0 + 1.0i);
171
  CHECK_RESULT ((*pcd5) (5.0, 6.0), 12.0 + 5.0i);
172
  CHECK_RESULT ((*pcd9) (9.0, 10.0), 20.0 + 9.0i);
173
  CHECK_RESULT ((*pcd2) (2.0), 3.0 + 2.0i);
174
  CHECK_RESULT ((*pcd6) (6.0, 7.0), 14.0 + 6.0i);
175
  CHECK_RESULT ((*pcd10) (10.0, 11.0), 22.0 + 10.0i);
176
}

powered by: WebSVN 2.1.0

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