diff options
Diffstat (limited to 'recipes-extended/testfloat/files')
3 files changed, 3138 insertions, 0 deletions
diff --git a/recipes-extended/testfloat/files/SoftFloat-powerpc-1.patch b/recipes-extended/testfloat/files/SoftFloat-powerpc-1.patch new file mode 100644 index 00000000..b6db2de2 --- /dev/null +++ b/recipes-extended/testfloat/files/SoftFloat-powerpc-1.patch | |||
@@ -0,0 +1,1427 @@ | |||
1 | This patch adds PowerPC support in SoftFloat. | ||
2 | |||
3 | Signed-off-by: Ebony Zhu <ebony.zhu@freescale.com> | ||
4 | Signed-off-by: Liu Yu <Yu.Liu@freescale.com> | ||
5 | --- | ||
6 | SoftFloat-2b/processors/powerpc-GCC.h | 87 ++++ | ||
7 | SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | 26 ++ | ||
8 | SoftFloat-2b/softfloat/bits32/powerpc-GCC/milieu.h | 55 +++ | ||
9 | .../bits32/powerpc-GCC/softfloat-specialize | 252 ++++++++++++ | ||
10 | .../softfloat/bits32/powerpc-GCC/softfloat.h | 155 +++++++ | ||
11 | SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | 24 ++ | ||
12 | SoftFloat-2b/softfloat/bits64/powerpc-GCC/milieu.h | 55 +++ | ||
13 | .../bits64/powerpc-GCC/softfloat-specialize | 422 ++++++++++++++++++++ | ||
14 | .../softfloat/bits64/powerpc-GCC/softfloat.h | 269 +++++++++++++ | ||
15 | 9 files changed, 1345 insertions(+), 0 deletions(-) | ||
16 | create mode 100644 SoftFloat-2b/processors/powerpc-GCC.h | ||
17 | create mode 100644 SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
18 | create mode 100644 SoftFloat-2b/softfloat/bits32/powerpc-GCC/milieu.h | ||
19 | create mode 100644 SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat-specialize | ||
20 | create mode 100644 SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat.h | ||
21 | create mode 100644 SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
22 | create mode 100644 SoftFloat-2b/softfloat/bits64/powerpc-GCC/milieu.h | ||
23 | create mode 100644 SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat-specialize | ||
24 | create mode 100644 SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat.h | ||
25 | |||
26 | diff --git a/SoftFloat-2b/processors/powerpc-GCC.h b/SoftFloat-2b/processors/powerpc-GCC.h | ||
27 | new file mode 100644 | ||
28 | index 0000000..002a786 | ||
29 | --- /dev/null | ||
30 | +++ b/SoftFloat-2b/processors/powerpc-GCC.h | ||
31 | @@ -0,0 +1,87 @@ | ||
32 | +/* | ||
33 | + * This file is derived from processors/386-gcc.h, | ||
34 | + * the copyright for that material belongs to the original owners. | ||
35 | + * | ||
36 | + * Additional material and changes where applicable is: | ||
37 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
38 | + * | ||
39 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
40 | + * Yu Liu, <yu.liu@freescale.com> | ||
41 | + * | ||
42 | + * THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
43 | + * been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
44 | + * RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
45 | + * AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
46 | + * COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
47 | + * EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
48 | + * INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
49 | + * OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
50 | + */ | ||
51 | + | ||
52 | +/*---------------------------------------------------------------------------- | ||
53 | +| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. | ||
54 | +*----------------------------------------------------------------------------*/ | ||
55 | +#define BIGENDIAN | ||
56 | + | ||
57 | +/*---------------------------------------------------------------------------- | ||
58 | +| The macro `BITS64' can be defined to indicate that 64-bit integer types are | ||
59 | +| supported by the compiler. | ||
60 | +*----------------------------------------------------------------------------*/ | ||
61 | +#define BITS32 | ||
62 | + | ||
63 | +/*---------------------------------------------------------------------------- | ||
64 | +| Each of the following `typedef's defines the most convenient type that holds | ||
65 | +| integers of at least as many bits as specified. For example, `uint8' should | ||
66 | +| be the most convenient type that can hold unsigned integers of as many as | ||
67 | +| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most | ||
68 | +| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed | ||
69 | +| to the same as `int'. | ||
70 | +*----------------------------------------------------------------------------*/ | ||
71 | +typedef int flag; | ||
72 | +typedef int uint8; | ||
73 | +typedef int int8; | ||
74 | +typedef int uint16; | ||
75 | +typedef int int16; | ||
76 | +typedef unsigned int uint32; | ||
77 | +typedef signed int int32; | ||
78 | +#ifdef BITS64 | ||
79 | +typedef unsigned long long int uint64; | ||
80 | +typedef signed long long int int64; | ||
81 | +#endif | ||
82 | + | ||
83 | +/*---------------------------------------------------------------------------- | ||
84 | +| Each of the following `typedef's defines a type that holds integers | ||
85 | +| of _exactly_ the number of bits specified. For instance, for most | ||
86 | +| implementation of C, `bits16' and `sbits16' should be `typedef'ed to | ||
87 | +| `unsigned short int' and `signed short int' (or `short int'), respectively. | ||
88 | +*----------------------------------------------------------------------------*/ | ||
89 | +typedef unsigned char bits8; | ||
90 | +typedef signed char sbits8; | ||
91 | +typedef unsigned short int bits16; | ||
92 | +typedef signed short int sbits16; | ||
93 | +typedef unsigned int bits32; | ||
94 | +typedef signed int sbits32; | ||
95 | +#ifdef BITS64 | ||
96 | +typedef unsigned long long int bits64; | ||
97 | +typedef signed long long int sbits64; | ||
98 | +#endif | ||
99 | + | ||
100 | +#ifdef BITS64 | ||
101 | +/*---------------------------------------------------------------------------- | ||
102 | +| The `LIT64' macro takes as its argument a textual integer literal and | ||
103 | +| if necessary ``marks'' the literal as having a 64-bit integer type. | ||
104 | +| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be | ||
105 | +| appended with the letters `LL' standing for `long long', which is `gcc's | ||
106 | +| name for the 64-bit integer type. Some compilers may allow `LIT64' to be | ||
107 | +| defined as the identity macro: `#define LIT64( a ) a'. | ||
108 | +*----------------------------------------------------------------------------*/ | ||
109 | +#define LIT64( a ) a##LL | ||
110 | +#endif | ||
111 | + | ||
112 | +/*---------------------------------------------------------------------------- | ||
113 | +| The macro `INLINE' can be used before functions that should be inlined. If | ||
114 | +| a compiler does not support explicit inlining, this macro should be defined | ||
115 | +| to be `static'. | ||
116 | +*----------------------------------------------------------------------------*/ | ||
117 | +#define INLINE extern inline | ||
118 | + | ||
119 | diff --git a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
120 | new file mode 100644 | ||
121 | index 0000000..28f1e33 | ||
122 | --- /dev/null | ||
123 | +++ b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
124 | @@ -0,0 +1,26 @@ | ||
125 | + | ||
126 | +PROCESSOR_H = ../../../processors/powerpc-GCC.h | ||
127 | +SOFTFLOAT_MACROS = ../softfloat-macros | ||
128 | + | ||
129 | +OBJ = .o | ||
130 | +EXE = | ||
131 | +INCLUDES = -I. -I.. | ||
132 | +COMPILE_C = $(COMPILE_PREFIX)gcc -msoft-float -c -o $@ $(INCLUDES) -I- -O2 | ||
133 | +LINK = $(COMPILE_PREFIX)gcc -o $@ | ||
134 | + | ||
135 | +ALL: softfloat$(OBJ) timesoftfloat$(EXE) | ||
136 | + | ||
137 | +milieu.h: $(PROCESSOR_H) | ||
138 | + touch milieu.h | ||
139 | + | ||
140 | +softfloat$(OBJ): milieu.h softfloat.h softfloat-specialize $(SOFTFLOAT_MACROS) ../softfloat.c | ||
141 | + $(COMPILE_C) ../softfloat.c | ||
142 | + | ||
143 | +timesoftfloat$(OBJ): milieu.h softfloat.h ../timesoftfloat.c | ||
144 | + $(COMPILE_C) ../timesoftfloat.c | ||
145 | + | ||
146 | +timesoftfloat$(EXE): softfloat$(OBJ) timesoftfloat$(OBJ) | ||
147 | + $(LINK) softfloat$(OBJ) timesoftfloat$(OBJ) | ||
148 | + | ||
149 | +clean: | ||
150 | + rm -f *.o timesoftfloat$(EXE) | ||
151 | diff --git a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/milieu.h b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/milieu.h | ||
152 | new file mode 100644 | ||
153 | index 0000000..d8b6012 | ||
154 | --- /dev/null | ||
155 | +++ b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/milieu.h | ||
156 | @@ -0,0 +1,55 @@ | ||
157 | +/* | ||
158 | + * This file is derived from softfloat/bits32/386-Win32-GCC/milieu.h, | ||
159 | + * the copyright for that material belongs to the original owners. | ||
160 | + * | ||
161 | + * Additional material and changes where applicable is: | ||
162 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
163 | + * | ||
164 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
165 | + * Yu Liu, <yu.liu@freescale.com> | ||
166 | + */ | ||
167 | + | ||
168 | +/*============================================================================ | ||
169 | + | ||
170 | +This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic | ||
171 | +Package, Release 2b. | ||
172 | + | ||
173 | +Written by John R. Hauser. This work was made possible in part by the | ||
174 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
175 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
176 | +National Science Foundation under grant MIP-9311980. The original version | ||
177 | +of this code was written as part of a project to build a fixed-point vector | ||
178 | +processor in collaboration with the University of California at Berkeley, | ||
179 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
180 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
181 | +arithmetic/SoftFloat.html'. | ||
182 | + | ||
183 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
184 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
185 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
186 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
187 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
188 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
189 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
190 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
191 | + | ||
192 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
193 | +(1) the source code for the derivative work includes prominent notice that | ||
194 | +the work is derivative, and (2) the source code includes prominent notice with | ||
195 | +these four paragraphs for those parts of this code that are retained. | ||
196 | + | ||
197 | +=============================================================================*/ | ||
198 | + | ||
199 | +/*---------------------------------------------------------------------------- | ||
200 | +| Include common integer types and flags. | ||
201 | +*----------------------------------------------------------------------------*/ | ||
202 | +#include "../../../processors/powerpc-GCC.h" | ||
203 | + | ||
204 | +/*---------------------------------------------------------------------------- | ||
205 | +| Symbolic Boolean literals. | ||
206 | +*----------------------------------------------------------------------------*/ | ||
207 | +enum { | ||
208 | + FALSE = 0, | ||
209 | + TRUE = 1 | ||
210 | +}; | ||
211 | + | ||
212 | diff --git a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat-specialize b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat-specialize | ||
213 | new file mode 100644 | ||
214 | index 0000000..fd2caa4 | ||
215 | --- /dev/null | ||
216 | +++ b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat-specialize | ||
217 | @@ -0,0 +1,252 @@ | ||
218 | +/* | ||
219 | + * This file is derived from softfloat/bits32/386-Win32-GCC/softfloat-specialize, | ||
220 | + * the copyright for that material belongs to the original owners. | ||
221 | + * | ||
222 | + * Additional material and changes where applicable is: | ||
223 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
224 | + * | ||
225 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
226 | + * Yu Liu, <yu.liu@freescale.com> | ||
227 | + */ | ||
228 | + | ||
229 | +/*============================================================================ | ||
230 | + | ||
231 | +This C source fragment is part of the SoftFloat IEC/IEEE Floating-point | ||
232 | +Arithmetic Package, Release 2b. | ||
233 | + | ||
234 | +Written by John R. Hauser. This work was made possible in part by the | ||
235 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
236 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
237 | +National Science Foundation under grant MIP-9311980. The original version | ||
238 | +of this code was written as part of a project to build a fixed-point vector | ||
239 | +processor in collaboration with the University of California at Berkeley, | ||
240 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
241 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
242 | +arithmetic/SoftFloat.html'. | ||
243 | + | ||
244 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
245 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
246 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
247 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
248 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
249 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
250 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
251 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
252 | + | ||
253 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
254 | +(1) the source code for the derivative work includes prominent notice that | ||
255 | +the work is derivative, and (2) the source code includes prominent notice with | ||
256 | +these four paragraphs for those parts of this code that are retained. | ||
257 | + | ||
258 | +=============================================================================*/ | ||
259 | + | ||
260 | +/*---------------------------------------------------------------------------- | ||
261 | +| Underflow tininess-detection mode, statically initialized to default value. | ||
262 | +| (The declaration in `softfloat.h' must match the `int8' type here.) | ||
263 | +*----------------------------------------------------------------------------*/ | ||
264 | +int8 float_detect_tininess = float_tininess_after_rounding; | ||
265 | + | ||
266 | +/*---------------------------------------------------------------------------- | ||
267 | +| Raises the exceptions specified by `flags'. Floating-point traps can be | ||
268 | +| defined here if desired. It is currently not possible for such a trap | ||
269 | +| to substitute a result value. If traps are not implemented, this routine | ||
270 | +| should be simply `float_exception_flags |= flags;'. | ||
271 | +*----------------------------------------------------------------------------*/ | ||
272 | + | ||
273 | +void float_raise( int8 flags ) | ||
274 | +{ | ||
275 | + | ||
276 | + float_exception_flags |= flags; | ||
277 | + | ||
278 | +} | ||
279 | + | ||
280 | +/*---------------------------------------------------------------------------- | ||
281 | +| Internal canonical NaN format. | ||
282 | +*----------------------------------------------------------------------------*/ | ||
283 | +typedef struct { | ||
284 | + flag sign; | ||
285 | + bits32 high, low; | ||
286 | +} commonNaNT; | ||
287 | + | ||
288 | +/*---------------------------------------------------------------------------- | ||
289 | +| The pattern for a default generated single-precision NaN. | ||
290 | +*----------------------------------------------------------------------------*/ | ||
291 | +enum { | ||
292 | + float32_default_nan = 0xFFFFFFFF | ||
293 | +}; | ||
294 | + | ||
295 | +/*---------------------------------------------------------------------------- | ||
296 | +| Returns 1 if the single-precision floating-point value `a' is a NaN; | ||
297 | +| otherwise returns 0. | ||
298 | +*----------------------------------------------------------------------------*/ | ||
299 | + | ||
300 | +flag float32_is_nan( float32 a ) | ||
301 | +{ | ||
302 | + | ||
303 | + return ( 0xFF000000 < (bits32) ( a<<1 ) ); | ||
304 | + | ||
305 | +} | ||
306 | + | ||
307 | +/*---------------------------------------------------------------------------- | ||
308 | +| Returns 1 if the single-precision floating-point value `a' is a signaling | ||
309 | +| NaN; otherwise returns 0. | ||
310 | +*----------------------------------------------------------------------------*/ | ||
311 | + | ||
312 | +flag float32_is_signaling_nan( float32 a ) | ||
313 | +{ | ||
314 | + | ||
315 | + return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); | ||
316 | + | ||
317 | +} | ||
318 | + | ||
319 | +/*---------------------------------------------------------------------------- | ||
320 | +| Returns the result of converting the single-precision floating-point NaN | ||
321 | +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | ||
322 | +| exception is raised. | ||
323 | +*----------------------------------------------------------------------------*/ | ||
324 | + | ||
325 | +static commonNaNT float32ToCommonNaN( float32 a ) | ||
326 | +{ | ||
327 | + commonNaNT z; | ||
328 | + | ||
329 | + if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
330 | + z.sign = a>>31; | ||
331 | + z.low = 0; | ||
332 | + z.high = a<<9; | ||
333 | + return z; | ||
334 | + | ||
335 | +} | ||
336 | + | ||
337 | +/*---------------------------------------------------------------------------- | ||
338 | +| Returns the result of converting the canonical NaN `a' to the single- | ||
339 | +| precision floating-point format. | ||
340 | +*----------------------------------------------------------------------------*/ | ||
341 | + | ||
342 | +static float32 commonNaNToFloat32( commonNaNT a ) | ||
343 | +{ | ||
344 | + | ||
345 | + return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>9 ); | ||
346 | + | ||
347 | +} | ||
348 | + | ||
349 | +/*---------------------------------------------------------------------------- | ||
350 | +| Takes two single-precision floating-point values `a' and `b', one of which | ||
351 | +| is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a | ||
352 | +| signaling NaN, the invalid exception is raised. | ||
353 | +*----------------------------------------------------------------------------*/ | ||
354 | + | ||
355 | +static float32 propagateFloat32NaN( float32 a, float32 b ) | ||
356 | +{ | ||
357 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
358 | + | ||
359 | + aIsNaN = float32_is_nan( a ); | ||
360 | + aIsSignalingNaN = float32_is_signaling_nan( a ); | ||
361 | + bIsNaN = float32_is_nan( b ); | ||
362 | + bIsSignalingNaN = float32_is_signaling_nan( b ); | ||
363 | + a |= 0x00400000; | ||
364 | + b |= 0x00400000; | ||
365 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
366 | + if ( aIsNaN ) { | ||
367 | + return ( aIsSignalingNaN & bIsNaN ) ? b : a; | ||
368 | + } | ||
369 | + else { | ||
370 | + return b; | ||
371 | + } | ||
372 | + | ||
373 | +} | ||
374 | + | ||
375 | +/*---------------------------------------------------------------------------- | ||
376 | +| The pattern for a default generated double-precision NaN. The `high' and | ||
377 | +| `low' values hold the most- and least-significant bits, respectively. | ||
378 | +*----------------------------------------------------------------------------*/ | ||
379 | +enum { | ||
380 | + float64_default_nan_high = 0xFFFFFFFF, | ||
381 | + float64_default_nan_low = 0xFFFFFFFF | ||
382 | +}; | ||
383 | + | ||
384 | +/*---------------------------------------------------------------------------- | ||
385 | +| Returns 1 if the double-precision floating-point value `a' is a NaN; | ||
386 | +| otherwise returns 0. | ||
387 | +*----------------------------------------------------------------------------*/ | ||
388 | + | ||
389 | +flag float64_is_nan( float64 a ) | ||
390 | +{ | ||
391 | + | ||
392 | + return | ||
393 | + ( 0xFFE00000 <= (bits32) ( a.high<<1 ) ) | ||
394 | + && ( a.low || ( a.high & 0x000FFFFF ) ); | ||
395 | + | ||
396 | +} | ||
397 | + | ||
398 | +/*---------------------------------------------------------------------------- | ||
399 | +| Returns 1 if the double-precision floating-point value `a' is a signaling | ||
400 | +| NaN; otherwise returns 0. | ||
401 | +*----------------------------------------------------------------------------*/ | ||
402 | + | ||
403 | +flag float64_is_signaling_nan( float64 a ) | ||
404 | +{ | ||
405 | + | ||
406 | + return | ||
407 | + ( ( ( a.high>>19 ) & 0xFFF ) == 0xFFE ) | ||
408 | + && ( a.low || ( a.high & 0x0007FFFF ) ); | ||
409 | + | ||
410 | +} | ||
411 | + | ||
412 | +/*---------------------------------------------------------------------------- | ||
413 | +| Returns the result of converting the double-precision floating-point NaN | ||
414 | +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | ||
415 | +| exception is raised. | ||
416 | +*----------------------------------------------------------------------------*/ | ||
417 | + | ||
418 | +static commonNaNT float64ToCommonNaN( float64 a ) | ||
419 | +{ | ||
420 | + commonNaNT z; | ||
421 | + | ||
422 | + if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
423 | + z.sign = a.high>>31; | ||
424 | + shortShift64Left( a.high, a.low, 12, &z.high, &z.low ); | ||
425 | + return z; | ||
426 | + | ||
427 | +} | ||
428 | + | ||
429 | +/*---------------------------------------------------------------------------- | ||
430 | +| Returns the result of converting the canonical NaN `a' to the double- | ||
431 | +| precision floating-point format. | ||
432 | +*----------------------------------------------------------------------------*/ | ||
433 | + | ||
434 | +static float64 commonNaNToFloat64( commonNaNT a ) | ||
435 | +{ | ||
436 | + float64 z; | ||
437 | + | ||
438 | + shift64Right( a.high, a.low, 12, &z.high, &z.low ); | ||
439 | + z.high |= ( ( (bits32) a.sign )<<31 ) | 0x7FF80000; | ||
440 | + return z; | ||
441 | + | ||
442 | +} | ||
443 | + | ||
444 | +/*---------------------------------------------------------------------------- | ||
445 | +| Takes two double-precision floating-point values `a' and `b', one of which | ||
446 | +| is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a | ||
447 | +| signaling NaN, the invalid exception is raised. | ||
448 | +*----------------------------------------------------------------------------*/ | ||
449 | + | ||
450 | +static float64 propagateFloat64NaN( float64 a, float64 b ) | ||
451 | +{ | ||
452 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
453 | + | ||
454 | + aIsNaN = float64_is_nan( a ); | ||
455 | + aIsSignalingNaN = float64_is_signaling_nan( a ); | ||
456 | + bIsNaN = float64_is_nan( b ); | ||
457 | + bIsSignalingNaN = float64_is_signaling_nan( b ); | ||
458 | + a.high |= 0x00080000; | ||
459 | + b.high |= 0x00080000; | ||
460 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
461 | + if ( aIsNaN ) { | ||
462 | + return ( aIsSignalingNaN & bIsNaN ) ? b : a; | ||
463 | + } | ||
464 | + else { | ||
465 | + return b; | ||
466 | + } | ||
467 | + | ||
468 | +} | ||
469 | + | ||
470 | diff --git a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat.h b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat.h | ||
471 | new file mode 100644 | ||
472 | index 0000000..0015b8e | ||
473 | --- /dev/null | ||
474 | +++ b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/softfloat.h | ||
475 | @@ -0,0 +1,155 @@ | ||
476 | +/* | ||
477 | + * This file is derived from softfloat/bits32/386-Win32-GCC/softfloat.h, | ||
478 | + * the copyright for that material belongs to the original owners. | ||
479 | + * | ||
480 | + * Additional material and changes where applicable is: | ||
481 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
482 | + * | ||
483 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
484 | + * Yu Liu, <yu.liu@freescale.com> | ||
485 | + */ | ||
486 | + | ||
487 | +/*============================================================================ | ||
488 | + | ||
489 | +This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic | ||
490 | +Package, Release 2b. | ||
491 | + | ||
492 | +Written by John R. Hauser. This work was made possible in part by the | ||
493 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
494 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
495 | +National Science Foundation under grant MIP-9311980. The original version | ||
496 | +of this code was written as part of a project to build a fixed-point vector | ||
497 | +processor in collaboration with the University of California at Berkeley, | ||
498 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
499 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
500 | +arithmetic/SoftFloat.html'. | ||
501 | + | ||
502 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
503 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
504 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
505 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
506 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
507 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
508 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
509 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
510 | + | ||
511 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
512 | +(1) the source code for the derivative work includes prominent notice that | ||
513 | +the work is derivative, and (2) the source code includes prominent notice with | ||
514 | +these four paragraphs for those parts of this code that are retained. | ||
515 | + | ||
516 | +=============================================================================*/ | ||
517 | + | ||
518 | +/*---------------------------------------------------------------------------- | ||
519 | +| Software IEC/IEEE floating-point types. | ||
520 | +*----------------------------------------------------------------------------*/ | ||
521 | +typedef bits32 float32; | ||
522 | +typedef struct { | ||
523 | + bits32 high, low; | ||
524 | +} float64; | ||
525 | + | ||
526 | +/*---------------------------------------------------------------------------- | ||
527 | +| Software IEC/IEEE floating-point underflow tininess-detection mode. | ||
528 | +*----------------------------------------------------------------------------*/ | ||
529 | +extern int8 float_detect_tininess; | ||
530 | +enum { | ||
531 | + float_tininess_after_rounding = 0, | ||
532 | + float_tininess_before_rounding = 1 | ||
533 | +}; | ||
534 | + | ||
535 | +/*---------------------------------------------------------------------------- | ||
536 | +| Software IEC/IEEE floating-point rounding mode. | ||
537 | +*----------------------------------------------------------------------------*/ | ||
538 | +extern int8 float_rounding_mode; | ||
539 | +enum { | ||
540 | + float_round_nearest_even = 0, | ||
541 | + float_round_to_zero = 1, | ||
542 | + float_round_up = 2, | ||
543 | + float_round_down = 3 | ||
544 | +}; | ||
545 | + | ||
546 | +/*---------------------------------------------------------------------------- | ||
547 | +| Software IEC/IEEE floating-point exception flags. | ||
548 | +*----------------------------------------------------------------------------*/ | ||
549 | +/* | ||
550 | +extern int8 float_exception_flags; | ||
551 | +enum { | ||
552 | + float_flag_inexact = 1, | ||
553 | + float_flag_underflow = 2, | ||
554 | + float_flag_overflow = 4, | ||
555 | + float_flag_divbyzero = 8, | ||
556 | + float_flag_invalid = 16 | ||
557 | +}; | ||
558 | +*/ | ||
559 | + | ||
560 | +extern int8 float_exception_flags; | ||
561 | +enum { | ||
562 | + float_flag_inexact = 16, | ||
563 | + float_flag_underflow = 2, | ||
564 | + float_flag_overflow = 1, | ||
565 | + float_flag_divbyzero = 4, | ||
566 | + float_flag_invalid = 8 | ||
567 | +}; | ||
568 | + | ||
569 | +/*---------------------------------------------------------------------------- | ||
570 | +| Routine to raise any or all of the software IEC/IEEE floating-point | ||
571 | +| exception flags. | ||
572 | +*----------------------------------------------------------------------------*/ | ||
573 | +void float_raise( int8 ); | ||
574 | + | ||
575 | +/*---------------------------------------------------------------------------- | ||
576 | +| Software IEC/IEEE integer-to-floating-point conversion routines. | ||
577 | +*----------------------------------------------------------------------------*/ | ||
578 | +float32 int32_to_float32( int32 ); | ||
579 | +float64 int32_to_float64( int32 ); | ||
580 | + | ||
581 | +/*---------------------------------------------------------------------------- | ||
582 | +| Software IEC/IEEE single-precision conversion routines. | ||
583 | +*----------------------------------------------------------------------------*/ | ||
584 | +int32 float32_to_int32( float32 ); | ||
585 | +int32 float32_to_int32_round_to_zero( float32 ); | ||
586 | +float64 float32_to_float64( float32 ); | ||
587 | + | ||
588 | +/*---------------------------------------------------------------------------- | ||
589 | +| Software IEC/IEEE single-precision operations. | ||
590 | +*----------------------------------------------------------------------------*/ | ||
591 | +float32 float32_round_to_int( float32 ); | ||
592 | +float32 float32_add( float32, float32 ); | ||
593 | +float32 float32_sub( float32, float32 ); | ||
594 | +float32 float32_mul( float32, float32 ); | ||
595 | +float32 float32_div( float32, float32 ); | ||
596 | +float32 float32_rem( float32, float32 ); | ||
597 | +float32 float32_sqrt( float32 ); | ||
598 | +flag float32_eq( float32, float32 ); | ||
599 | +flag float32_le( float32, float32 ); | ||
600 | +flag float32_lt( float32, float32 ); | ||
601 | +flag float32_eq_signaling( float32, float32 ); | ||
602 | +flag float32_le_quiet( float32, float32 ); | ||
603 | +flag float32_lt_quiet( float32, float32 ); | ||
604 | +flag float32_is_signaling_nan( float32 ); | ||
605 | + | ||
606 | +/*---------------------------------------------------------------------------- | ||
607 | +| Software IEC/IEEE double-precision conversion routines. | ||
608 | +*----------------------------------------------------------------------------*/ | ||
609 | +int32 float64_to_int32( float64 ); | ||
610 | +int32 float64_to_int32_round_to_zero( float64 ); | ||
611 | +float32 float64_to_float32( float64 ); | ||
612 | + | ||
613 | +/*---------------------------------------------------------------------------- | ||
614 | +| Software IEC/IEEE double-precision operations. | ||
615 | +*----------------------------------------------------------------------------*/ | ||
616 | +float64 float64_round_to_int( float64 ); | ||
617 | +float64 float64_add( float64, float64 ); | ||
618 | +float64 float64_sub( float64, float64 ); | ||
619 | +float64 float64_mul( float64, float64 ); | ||
620 | +float64 float64_div( float64, float64 ); | ||
621 | +float64 float64_rem( float64, float64 ); | ||
622 | +float64 float64_sqrt( float64 ); | ||
623 | +flag float64_eq( float64, float64 ); | ||
624 | +flag float64_le( float64, float64 ); | ||
625 | +flag float64_lt( float64, float64 ); | ||
626 | +flag float64_eq_signaling( float64, float64 ); | ||
627 | +flag float64_le_quiet( float64, float64 ); | ||
628 | +flag float64_lt_quiet( float64, float64 ); | ||
629 | +flag float64_is_signaling_nan( float64 ); | ||
630 | + | ||
631 | diff --git a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
632 | new file mode 100644 | ||
633 | index 0000000..a5e2cc7 | ||
634 | --- /dev/null | ||
635 | +++ b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
636 | @@ -0,0 +1,24 @@ | ||
637 | + | ||
638 | +PROCESSOR_H = ../../../processors/powerpc-GCC.h | ||
639 | +SOFTFLOAT_MACROS = ../softfloat-macros | ||
640 | + | ||
641 | +OBJ = .o | ||
642 | +EXE = | ||
643 | +INCLUDES = -I. -I.. | ||
644 | +COMPILE_C = $(COMPILE_PREFIX) -mcpu=8548 -mhard-float -mfloat-gprs=double -o $@ $(INCLUDES) -I- -O2 | ||
645 | +LINK = $(COMPILE_PREFIX) -o $@ | ||
646 | + | ||
647 | +ALL: softfloat$(OBJ) timesoftfloat$(EXE) | ||
648 | + | ||
649 | +milieu.h: $(PROCESSOR_H) | ||
650 | + touch milieu.h | ||
651 | + | ||
652 | +softfloat$(OBJ): milieu.h softfloat.h softfloat-specialize $(SOFTFLOAT_MACROS) ../softfloat.c | ||
653 | + $(COMPILE_C) ../softfloat.c | ||
654 | + | ||
655 | +timesoftfloat$(OBJ): milieu.h softfloat.h ../timesoftfloat.c | ||
656 | + $(COMPILE_C) ../timesoftfloat.c | ||
657 | + | ||
658 | +timesoftfloat$(EXE): softfloat$(OBJ) timesoftfloat$(OBJ) | ||
659 | + $(LINK) softfloat$(OBJ) timesoftfloat$(OBJ) | ||
660 | + | ||
661 | diff --git a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/milieu.h b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/milieu.h | ||
662 | new file mode 100644 | ||
663 | index 0000000..1b66490 | ||
664 | --- /dev/null | ||
665 | +++ b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/milieu.h | ||
666 | @@ -0,0 +1,55 @@ | ||
667 | +/* | ||
668 | + * This file is derived from softfloat/bits64/386-Win32-GCC/milieu.h, | ||
669 | + * the copyright for that material belongs to the original owners. | ||
670 | + * | ||
671 | + * Additional material and changes where applicable is: | ||
672 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
673 | + * | ||
674 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
675 | + * Yu Liu, <yu.liu@freescale.com> | ||
676 | + */ | ||
677 | + | ||
678 | +/*============================================================================ | ||
679 | + | ||
680 | +This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic | ||
681 | +Package, Release 2b. | ||
682 | + | ||
683 | +Written by John R. Hauser. This work was made possible in part by the | ||
684 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
685 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
686 | +National Science Foundation under grant MIP-9311980. The original version | ||
687 | +of this code was written as part of a project to build a fixed-point vector | ||
688 | +processor in collaboration with the University of California at Berkeley, | ||
689 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
690 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
691 | +arithmetic/SoftFloat.html'. | ||
692 | + | ||
693 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
694 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
695 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
696 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
697 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
698 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
699 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
700 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
701 | + | ||
702 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
703 | +(1) the source code for the derivative work includes prominent notice that | ||
704 | +the work is derivative, and (2) the source code includes prominent notice with | ||
705 | +these four paragraphs for those parts of this code that are retained. | ||
706 | + | ||
707 | +=============================================================================*/ | ||
708 | + | ||
709 | +/*---------------------------------------------------------------------------- | ||
710 | +| Include common integer types and flags. | ||
711 | +*----------------------------------------------------------------------------*/ | ||
712 | +#include "../../../processors/SPARC-GCC.h" | ||
713 | + | ||
714 | +/*---------------------------------------------------------------------------- | ||
715 | +| Symbolic Boolean literals. | ||
716 | +*----------------------------------------------------------------------------*/ | ||
717 | +enum { | ||
718 | + FALSE = 0, | ||
719 | + TRUE = 1 | ||
720 | +}; | ||
721 | + | ||
722 | diff --git a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat-specialize b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat-specialize | ||
723 | new file mode 100644 | ||
724 | index 0000000..b1d0bc8 | ||
725 | --- /dev/null | ||
726 | +++ b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat-specialize | ||
727 | @@ -0,0 +1,422 @@ | ||
728 | +/* | ||
729 | + * This file is derived from softfloat/bits64/386-Win32-GCC/softfloat-specialize, | ||
730 | + * the copyright for that material belongs to the original owners. | ||
731 | + * | ||
732 | + * Additional material and changes where applicable is: | ||
733 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
734 | + * | ||
735 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
736 | + * Yu Liu, <yu.liu@freescale.com> | ||
737 | + */ | ||
738 | + | ||
739 | +/*============================================================================ | ||
740 | + | ||
741 | +This C source fragment is part of the SoftFloat IEC/IEEE Floating-point | ||
742 | +Arithmetic Package, Release 2b. | ||
743 | + | ||
744 | +Written by John R. Hauser. This work was made possible in part by the | ||
745 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
746 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
747 | +National Science Foundation under grant MIP-9311980. The original version | ||
748 | +of this code was written as part of a project to build a fixed-point vector | ||
749 | +processor in collaboration with the University of California at Berkeley, | ||
750 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
751 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
752 | +arithmetic/SoftFloat.html'. | ||
753 | + | ||
754 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
755 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
756 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
757 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
758 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
759 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
760 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
761 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
762 | + | ||
763 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
764 | +(1) the source code for the derivative work includes prominent notice that | ||
765 | +the work is derivative, and (2) the source code includes prominent notice with | ||
766 | +these four paragraphs for those parts of this code that are retained. | ||
767 | + | ||
768 | +=============================================================================*/ | ||
769 | + | ||
770 | +/*---------------------------------------------------------------------------- | ||
771 | +| Underflow tininess-detection mode, statically initialized to default value. | ||
772 | +| (The declaration in `softfloat.h' must match the `int8' type here.) | ||
773 | +*----------------------------------------------------------------------------*/ | ||
774 | +int8 float_detect_tininess = float_tininess_before_rounding; | ||
775 | + | ||
776 | +/*---------------------------------------------------------------------------- | ||
777 | +| Raises the exceptions specified by `flags'. Floating-point traps can be | ||
778 | +| defined here if desired. It is currently not possible for such a trap | ||
779 | +| to substitute a result value. If traps are not implemented, this routine | ||
780 | +| should be simply `float_exception_flags |= flags;'. | ||
781 | +*----------------------------------------------------------------------------*/ | ||
782 | + | ||
783 | +void float_raise( int8 flags ) | ||
784 | +{ | ||
785 | + | ||
786 | + float_exception_flags |= flags; | ||
787 | + | ||
788 | +} | ||
789 | + | ||
790 | +/*---------------------------------------------------------------------------- | ||
791 | +| Internal canonical NaN format. | ||
792 | +*----------------------------------------------------------------------------*/ | ||
793 | +typedef struct { | ||
794 | + flag sign; | ||
795 | + bits64 high, low; | ||
796 | +} commonNaNT; | ||
797 | + | ||
798 | +/*---------------------------------------------------------------------------- | ||
799 | +| The pattern for a default generated single-precision NaN. | ||
800 | +*----------------------------------------------------------------------------*/ | ||
801 | +#define float32_default_nan 0x7FFFFFFF | ||
802 | + | ||
803 | +/*---------------------------------------------------------------------------- | ||
804 | +| Returns 1 if the single-precision floating-point value `a' is a NaN; | ||
805 | +| otherwise returns 0. | ||
806 | +*----------------------------------------------------------------------------*/ | ||
807 | + | ||
808 | +flag float32_is_nan( float32 a ) | ||
809 | +{ | ||
810 | + | ||
811 | + return ( 0xFF000000 < (bits32) ( a<<1 ) ); | ||
812 | + | ||
813 | +} | ||
814 | + | ||
815 | +/*---------------------------------------------------------------------------- | ||
816 | +| Returns 1 if the single-precision floating-point value `a' is a signaling | ||
817 | +| NaN; otherwise returns 0. | ||
818 | +*----------------------------------------------------------------------------*/ | ||
819 | + | ||
820 | +flag float32_is_signaling_nan( float32 a ) | ||
821 | +{ | ||
822 | + | ||
823 | + return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); | ||
824 | + | ||
825 | +} | ||
826 | + | ||
827 | +/*---------------------------------------------------------------------------- | ||
828 | +| Returns the result of converting the single-precision floating-point NaN | ||
829 | +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | ||
830 | +| exception is raised. | ||
831 | +*----------------------------------------------------------------------------*/ | ||
832 | + | ||
833 | +static commonNaNT float32ToCommonNaN( float32 a ) | ||
834 | +{ | ||
835 | + commonNaNT z; | ||
836 | + | ||
837 | + if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
838 | + z.sign = a>>31; | ||
839 | + z.low = 0; | ||
840 | + z.high = ( (bits64) a )<<41; | ||
841 | + return z; | ||
842 | + | ||
843 | +} | ||
844 | + | ||
845 | +/*---------------------------------------------------------------------------- | ||
846 | +| Returns the result of converting the canonical NaN `a' to the single- | ||
847 | +| precision floating-point format. | ||
848 | +*----------------------------------------------------------------------------*/ | ||
849 | + | ||
850 | +static float32 commonNaNToFloat32( commonNaNT a ) | ||
851 | +{ | ||
852 | + | ||
853 | + return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 ); | ||
854 | + | ||
855 | +} | ||
856 | + | ||
857 | +/*---------------------------------------------------------------------------- | ||
858 | +| Takes two single-precision floating-point values `a' and `b', one of which | ||
859 | +| is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a | ||
860 | +| signaling NaN, the invalid exception is raised. | ||
861 | +*----------------------------------------------------------------------------*/ | ||
862 | + | ||
863 | +static float32 propagateFloat32NaN( float32 a, float32 b ) | ||
864 | +{ | ||
865 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
866 | + | ||
867 | + aIsNaN = float32_is_nan( a ); | ||
868 | + aIsSignalingNaN = float32_is_signaling_nan( a ); | ||
869 | + bIsNaN = float32_is_nan( b ); | ||
870 | + bIsSignalingNaN = float32_is_signaling_nan( b ); | ||
871 | + a |= 0x00400000; | ||
872 | + b |= 0x00400000; | ||
873 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
874 | + return bIsSignalingNaN ? b : aIsSignalingNaN ? a : bIsNaN ? b : a; | ||
875 | + | ||
876 | +} | ||
877 | + | ||
878 | +/*---------------------------------------------------------------------------- | ||
879 | +| The pattern for a default generated double-precision NaN. | ||
880 | +*----------------------------------------------------------------------------*/ | ||
881 | +#define float64_default_nan LIT64( 0x7FFFFFFFFFFFFFFF ) | ||
882 | + | ||
883 | +/*---------------------------------------------------------------------------- | ||
884 | +| Returns 1 if the double-precision floating-point value `a' is a NaN; | ||
885 | +| otherwise returns 0. | ||
886 | +*----------------------------------------------------------------------------*/ | ||
887 | + | ||
888 | +flag float64_is_nan( float64 a ) | ||
889 | +{ | ||
890 | + | ||
891 | + return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) ); | ||
892 | + | ||
893 | +} | ||
894 | + | ||
895 | +/*---------------------------------------------------------------------------- | ||
896 | +| Returns 1 if the double-precision floating-point value `a' is a signaling | ||
897 | +| NaN; otherwise returns 0. | ||
898 | +*----------------------------------------------------------------------------*/ | ||
899 | + | ||
900 | +flag float64_is_signaling_nan( float64 a ) | ||
901 | +{ | ||
902 | + | ||
903 | + return | ||
904 | + ( ( ( a>>51 ) & 0xFFF ) == 0xFFE ) | ||
905 | + && ( a & LIT64( 0x0007FFFFFFFFFFFF ) ); | ||
906 | + | ||
907 | +} | ||
908 | + | ||
909 | +/*---------------------------------------------------------------------------- | ||
910 | +| Returns the result of converting the double-precision floating-point NaN | ||
911 | +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | ||
912 | +| exception is raised. | ||
913 | +*----------------------------------------------------------------------------*/ | ||
914 | + | ||
915 | +static commonNaNT float64ToCommonNaN( float64 a ) | ||
916 | +{ | ||
917 | + commonNaNT z; | ||
918 | + | ||
919 | + if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
920 | + z.sign = a>>63; | ||
921 | + z.low = 0; | ||
922 | + z.high = a<<12; | ||
923 | + return z; | ||
924 | + | ||
925 | +} | ||
926 | + | ||
927 | +/*---------------------------------------------------------------------------- | ||
928 | +| Returns the result of converting the canonical NaN `a' to the double- | ||
929 | +| precision floating-point format. | ||
930 | +*----------------------------------------------------------------------------*/ | ||
931 | + | ||
932 | +static float64 commonNaNToFloat64( commonNaNT a ) | ||
933 | +{ | ||
934 | + | ||
935 | + return | ||
936 | + ( ( (bits64) a.sign )<<63 ) | ||
937 | + | LIT64( 0x7FF8000000000000 ) | ||
938 | + | ( a.high>>12 ); | ||
939 | + | ||
940 | +} | ||
941 | + | ||
942 | +/*---------------------------------------------------------------------------- | ||
943 | +| Takes two double-precision floating-point values `a' and `b', one of which | ||
944 | +| is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a | ||
945 | +| signaling NaN, the invalid exception is raised. | ||
946 | +*----------------------------------------------------------------------------*/ | ||
947 | + | ||
948 | +static float64 propagateFloat64NaN( float64 a, float64 b ) | ||
949 | +{ | ||
950 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
951 | + | ||
952 | + aIsNaN = float64_is_nan( a ); | ||
953 | + aIsSignalingNaN = float64_is_signaling_nan( a ); | ||
954 | + bIsNaN = float64_is_nan( b ); | ||
955 | + bIsSignalingNaN = float64_is_signaling_nan( b ); | ||
956 | + a |= LIT64( 0x0008000000000000 ); | ||
957 | + b |= LIT64( 0x0008000000000000 ); | ||
958 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
959 | + return bIsSignalingNaN ? b : aIsSignalingNaN ? a : bIsNaN ? b : a; | ||
960 | + | ||
961 | +} | ||
962 | + | ||
963 | +#ifdef FLOATX80 | ||
964 | + | ||
965 | +/*---------------------------------------------------------------------------- | ||
966 | +| The pattern for a default generated extended double-precision NaN. The | ||
967 | +| `high' and `low' values hold the most- and least-significant bits, | ||
968 | +| respectively. | ||
969 | +*----------------------------------------------------------------------------*/ | ||
970 | +#define floatx80_default_nan_high 0x7FFF | ||
971 | +#define floatx80_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) | ||
972 | + | ||
973 | +/*---------------------------------------------------------------------------- | ||
974 | +| Returns 1 if the extended double-precision floating-point value `a' is a | ||
975 | +| NaN; otherwise returns 0. | ||
976 | +*----------------------------------------------------------------------------*/ | ||
977 | + | ||
978 | +flag floatx80_is_nan( floatx80 a ) | ||
979 | +{ | ||
980 | + | ||
981 | + return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 ); | ||
982 | + | ||
983 | +} | ||
984 | + | ||
985 | +/*---------------------------------------------------------------------------- | ||
986 | +| Returns 1 if the extended double-precision floating-point value `a' is a | ||
987 | +| signaling NaN; otherwise returns 0. | ||
988 | +*----------------------------------------------------------------------------*/ | ||
989 | + | ||
990 | +flag floatx80_is_signaling_nan( floatx80 a ) | ||
991 | +{ | ||
992 | + bits64 aLow; | ||
993 | + | ||
994 | + aLow = a.low & ~ LIT64( 0x4000000000000000 ); | ||
995 | + return | ||
996 | + ( ( a.high & 0x7FFF ) == 0x7FFF ) | ||
997 | + && (bits64) ( aLow<<1 ) | ||
998 | + && ( a.low == aLow ); | ||
999 | + | ||
1000 | +} | ||
1001 | + | ||
1002 | +/*---------------------------------------------------------------------------- | ||
1003 | +| Returns the result of converting the extended double-precision floating- | ||
1004 | +| point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the | ||
1005 | +| invalid exception is raised. | ||
1006 | +*----------------------------------------------------------------------------*/ | ||
1007 | + | ||
1008 | +static commonNaNT floatx80ToCommonNaN( floatx80 a ) | ||
1009 | +{ | ||
1010 | + commonNaNT z; | ||
1011 | + | ||
1012 | + if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
1013 | + z.sign = a.high>>15; | ||
1014 | + z.low = 0; | ||
1015 | + z.high = a.low<<1; | ||
1016 | + return z; | ||
1017 | + | ||
1018 | +} | ||
1019 | + | ||
1020 | +/*---------------------------------------------------------------------------- | ||
1021 | +| Returns the result of converting the canonical NaN `a' to the extended | ||
1022 | +| double-precision floating-point format. | ||
1023 | +*----------------------------------------------------------------------------*/ | ||
1024 | + | ||
1025 | +static floatx80 commonNaNToFloatx80( commonNaNT a ) | ||
1026 | +{ | ||
1027 | + floatx80 z; | ||
1028 | + | ||
1029 | + z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 ); | ||
1030 | + z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF; | ||
1031 | + return z; | ||
1032 | + | ||
1033 | +} | ||
1034 | + | ||
1035 | +/*---------------------------------------------------------------------------- | ||
1036 | +| Takes two extended double-precision floating-point values `a' and `b', one | ||
1037 | +| of which is a NaN, and returns the appropriate NaN result. If either `a' or | ||
1038 | +| `b' is a signaling NaN, the invalid exception is raised. | ||
1039 | +*----------------------------------------------------------------------------*/ | ||
1040 | + | ||
1041 | +static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b ) | ||
1042 | +{ | ||
1043 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
1044 | + | ||
1045 | + aIsNaN = floatx80_is_nan( a ); | ||
1046 | + aIsSignalingNaN = floatx80_is_signaling_nan( a ); | ||
1047 | + bIsNaN = floatx80_is_nan( b ); | ||
1048 | + bIsSignalingNaN = floatx80_is_signaling_nan( b ); | ||
1049 | + a.low |= LIT64( 0xC000000000000000 ); | ||
1050 | + b.low |= LIT64( 0xC000000000000000 ); | ||
1051 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
1052 | + return bIsSignalingNaN ? b : aIsSignalingNaN ? a : bIsNaN ? b : a; | ||
1053 | + | ||
1054 | +} | ||
1055 | + | ||
1056 | +#endif | ||
1057 | + | ||
1058 | +#ifdef FLOAT128 | ||
1059 | + | ||
1060 | +/*---------------------------------------------------------------------------- | ||
1061 | +| The pattern for a default generated quadruple-precision NaN. The `high' and | ||
1062 | +| `low' values hold the most- and least-significant bits, respectively. | ||
1063 | +*----------------------------------------------------------------------------*/ | ||
1064 | +#define float128_default_nan_high LIT64( 0x7FFFFFFFFFFFFFFF ) | ||
1065 | +#define float128_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF ) | ||
1066 | + | ||
1067 | +/*---------------------------------------------------------------------------- | ||
1068 | +| Returns 1 if the quadruple-precision floating-point value `a' is a NaN; | ||
1069 | +| otherwise returns 0. | ||
1070 | +*----------------------------------------------------------------------------*/ | ||
1071 | + | ||
1072 | +flag float128_is_nan( float128 a ) | ||
1073 | +{ | ||
1074 | + | ||
1075 | + return | ||
1076 | + ( LIT64( 0xFFFE000000000000 ) <= (bits64) ( a.high<<1 ) ) | ||
1077 | + && ( a.low || ( a.high & LIT64( 0x0000FFFFFFFFFFFF ) ) ); | ||
1078 | + | ||
1079 | +} | ||
1080 | + | ||
1081 | +/*---------------------------------------------------------------------------- | ||
1082 | +| Returns 1 if the quadruple-precision floating-point value `a' is a | ||
1083 | +| signaling NaN; otherwise returns 0. | ||
1084 | +*----------------------------------------------------------------------------*/ | ||
1085 | + | ||
1086 | +flag float128_is_signaling_nan( float128 a ) | ||
1087 | +{ | ||
1088 | + | ||
1089 | + return | ||
1090 | + ( ( ( a.high>>47 ) & 0xFFFF ) == 0xFFFE ) | ||
1091 | + && ( a.low || ( a.high & LIT64( 0x00007FFFFFFFFFFF ) ) ); | ||
1092 | + | ||
1093 | +} | ||
1094 | + | ||
1095 | +/*---------------------------------------------------------------------------- | ||
1096 | +| Returns the result of converting the quadruple-precision floating-point NaN | ||
1097 | +| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid | ||
1098 | +| exception is raised. | ||
1099 | +*----------------------------------------------------------------------------*/ | ||
1100 | + | ||
1101 | +static commonNaNT float128ToCommonNaN( float128 a ) | ||
1102 | +{ | ||
1103 | + commonNaNT z; | ||
1104 | + | ||
1105 | + if ( float128_is_signaling_nan( a ) ) float_raise( float_flag_invalid ); | ||
1106 | + z.sign = a.high>>63; | ||
1107 | + shortShift128Left( a.high, a.low, 16, &z.high, &z.low ); | ||
1108 | + return z; | ||
1109 | + | ||
1110 | +} | ||
1111 | + | ||
1112 | +/*---------------------------------------------------------------------------- | ||
1113 | +| Returns the result of converting the canonical NaN `a' to the quadruple- | ||
1114 | +| precision floating-point format. | ||
1115 | +*----------------------------------------------------------------------------*/ | ||
1116 | + | ||
1117 | +static float128 commonNaNToFloat128( commonNaNT a ) | ||
1118 | +{ | ||
1119 | + float128 z; | ||
1120 | + | ||
1121 | + shift128Right( a.high, a.low, 16, &z.high, &z.low ); | ||
1122 | + z.high |= ( ( (bits64) a.sign )<<63 ) | LIT64( 0x7FFF800000000000 ); | ||
1123 | + return z; | ||
1124 | + | ||
1125 | +} | ||
1126 | + | ||
1127 | +/*---------------------------------------------------------------------------- | ||
1128 | +| Takes two quadruple-precision floating-point values `a' and `b', one of | ||
1129 | +| which is a NaN, and returns the appropriate NaN result. If either `a' or | ||
1130 | +| `b' is a signaling NaN, the invalid exception is raised. | ||
1131 | +*----------------------------------------------------------------------------*/ | ||
1132 | + | ||
1133 | +static float128 propagateFloat128NaN( float128 a, float128 b ) | ||
1134 | +{ | ||
1135 | + flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN; | ||
1136 | + | ||
1137 | + aIsNaN = float128_is_nan( a ); | ||
1138 | + aIsSignalingNaN = float128_is_signaling_nan( a ); | ||
1139 | + bIsNaN = float128_is_nan( b ); | ||
1140 | + bIsSignalingNaN = float128_is_signaling_nan( b ); | ||
1141 | + a.high |= LIT64( 0x0000800000000000 ); | ||
1142 | + b.high |= LIT64( 0x0000800000000000 ); | ||
1143 | + if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid ); | ||
1144 | + return bIsSignalingNaN ? b : aIsSignalingNaN ? a : bIsNaN ? b : a; | ||
1145 | + | ||
1146 | +} | ||
1147 | + | ||
1148 | +#endif | ||
1149 | + | ||
1150 | diff --git a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat.h b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat.h | ||
1151 | new file mode 100644 | ||
1152 | index 0000000..5b7cb1c | ||
1153 | --- /dev/null | ||
1154 | +++ b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/softfloat.h | ||
1155 | @@ -0,0 +1,269 @@ | ||
1156 | +/* | ||
1157 | + * This file is derived from softfloat/bits64/386-Win32-GCC/softfloat.h, | ||
1158 | + * the copyright for that material belongs to the original owners. | ||
1159 | + * | ||
1160 | + * Additional material and changes where applicable is: | ||
1161 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
1162 | + * | ||
1163 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
1164 | + * Yu Liu, <yu.liu@freescale.com> | ||
1165 | + */ | ||
1166 | + | ||
1167 | +/*============================================================================ | ||
1168 | + | ||
1169 | +This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic | ||
1170 | +Package, Release 2b. | ||
1171 | + | ||
1172 | +Written by John R. Hauser. This work was made possible in part by the | ||
1173 | +International Computer Science Institute, located at Suite 600, 1947 Center | ||
1174 | +Street, Berkeley, California 94704. Funding was partially provided by the | ||
1175 | +National Science Foundation under grant MIP-9311980. The original version | ||
1176 | +of this code was written as part of a project to build a fixed-point vector | ||
1177 | +processor in collaboration with the University of California at Berkeley, | ||
1178 | +overseen by Profs. Nelson Morgan and John Wawrzynek. More information | ||
1179 | +is available through the Web page `http://www.cs.berkeley.edu/~jhauser/ | ||
1180 | +arithmetic/SoftFloat.html'. | ||
1181 | + | ||
1182 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
1183 | +been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
1184 | +RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
1185 | +AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
1186 | +COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
1187 | +EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
1188 | +INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
1189 | +OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
1190 | + | ||
1191 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
1192 | +(1) the source code for the derivative work includes prominent notice that | ||
1193 | +the work is derivative, and (2) the source code includes prominent notice with | ||
1194 | +these four paragraphs for those parts of this code that are retained. | ||
1195 | + | ||
1196 | +=============================================================================*/ | ||
1197 | + | ||
1198 | +/*---------------------------------------------------------------------------- | ||
1199 | +| The macro `FLOATX80' must be defined to enable the extended double-precision | ||
1200 | +| floating-point format `floatx80'. If this macro is not defined, the | ||
1201 | +| `floatx80' type will not be defined, and none of the functions that either | ||
1202 | +| input or output the `floatx80' type will be defined. The same applies to | ||
1203 | +| the `FLOAT128' macro and the quadruple-precision format `float128'. | ||
1204 | +*----------------------------------------------------------------------------*/ | ||
1205 | +#define FLOATX80 | ||
1206 | +#define FLOAT128 | ||
1207 | + | ||
1208 | +/*---------------------------------------------------------------------------- | ||
1209 | +| Software IEC/IEEE floating-point types. | ||
1210 | +*----------------------------------------------------------------------------*/ | ||
1211 | +typedef unsigned int float32; | ||
1212 | +typedef unsigned long long float64; | ||
1213 | +#ifdef FLOATX80 | ||
1214 | +typedef struct { | ||
1215 | + unsigned short high; | ||
1216 | + unsigned long long low; | ||
1217 | +} floatx80; | ||
1218 | +#endif | ||
1219 | +#ifdef FLOAT128 | ||
1220 | +typedef struct { | ||
1221 | + unsigned long long high, low; | ||
1222 | +} float128; | ||
1223 | +#endif | ||
1224 | + | ||
1225 | +/*---------------------------------------------------------------------------- | ||
1226 | +| Software IEC/IEEE floating-point underflow tininess-detection mode. | ||
1227 | +*----------------------------------------------------------------------------*/ | ||
1228 | +extern int float_detect_tininess; | ||
1229 | +enum { | ||
1230 | + float_tininess_after_rounding = 0, | ||
1231 | + float_tininess_before_rounding = 1 | ||
1232 | +}; | ||
1233 | + | ||
1234 | +/*---------------------------------------------------------------------------- | ||
1235 | +| Software IEC/IEEE floating-point rounding mode. | ||
1236 | +*----------------------------------------------------------------------------*/ | ||
1237 | +extern int float_rounding_mode; | ||
1238 | +enum { | ||
1239 | + float_round_nearest_even = 0, | ||
1240 | + float_round_to_zero = 1, | ||
1241 | + float_round_up = 2, | ||
1242 | + float_round_down = 3 | ||
1243 | +}; | ||
1244 | + | ||
1245 | +/*---------------------------------------------------------------------------- | ||
1246 | +| Software IEC/IEEE floating-point exception flags. | ||
1247 | +*----------------------------------------------------------------------------*/ | ||
1248 | +extern int float_exception_flags; | ||
1249 | +enum { | ||
1250 | + float_flag_inexact = 1, | ||
1251 | + float_flag_divbyzero = 2, | ||
1252 | + float_flag_underflow = 4, | ||
1253 | + float_flag_overflow = 8, | ||
1254 | + float_flag_invalid = 16 | ||
1255 | +}; | ||
1256 | + | ||
1257 | +/*---------------------------------------------------------------------------- | ||
1258 | +| Routine to raise any or all of the software IEC/IEEE floating-point | ||
1259 | +| exception flags. | ||
1260 | +*----------------------------------------------------------------------------*/ | ||
1261 | +void float_raise( int ); | ||
1262 | + | ||
1263 | +/*---------------------------------------------------------------------------- | ||
1264 | +| Software IEC/IEEE integer-to-floating-point conversion routines. | ||
1265 | +*----------------------------------------------------------------------------*/ | ||
1266 | +float32 int32_to_float32( int ); | ||
1267 | +float64 int32_to_float64( int ); | ||
1268 | +#ifdef FLOATX80 | ||
1269 | +floatx80 int32_to_floatx80( int ); | ||
1270 | +#endif | ||
1271 | +#ifdef FLOAT128 | ||
1272 | +float128 int32_to_float128( int ); | ||
1273 | +#endif | ||
1274 | +float32 int64_to_float32( long long ); | ||
1275 | +float64 int64_to_float64( long long ); | ||
1276 | +#ifdef FLOATX80 | ||
1277 | +floatx80 int64_to_floatx80( long long ); | ||
1278 | +#endif | ||
1279 | +#ifdef FLOAT128 | ||
1280 | +float128 int64_to_float128( long long ); | ||
1281 | +#endif | ||
1282 | + | ||
1283 | +/*---------------------------------------------------------------------------- | ||
1284 | +| Software IEC/IEEE single-precision conversion routines. | ||
1285 | +*----------------------------------------------------------------------------*/ | ||
1286 | +int float32_to_int32( float32 ); | ||
1287 | +int float32_to_int32_round_to_zero( float32 ); | ||
1288 | +long long float32_to_int64( float32 ); | ||
1289 | +long long float32_to_int64_round_to_zero( float32 ); | ||
1290 | +float64 float32_to_float64( float32 ); | ||
1291 | +#ifdef FLOATX80 | ||
1292 | +floatx80 float32_to_floatx80( float32 ); | ||
1293 | +#endif | ||
1294 | +#ifdef FLOAT128 | ||
1295 | +float128 float32_to_float128( float32 ); | ||
1296 | +#endif | ||
1297 | + | ||
1298 | +/*---------------------------------------------------------------------------- | ||
1299 | +| Software IEC/IEEE single-precision operations. | ||
1300 | +*----------------------------------------------------------------------------*/ | ||
1301 | +float32 float32_round_to_int( float32 ); | ||
1302 | +float32 float32_add( float32, float32 ); | ||
1303 | +float32 float32_sub( float32, float32 ); | ||
1304 | +float32 float32_mul( float32, float32 ); | ||
1305 | +float32 float32_div( float32, float32 ); | ||
1306 | +float32 float32_rem( float32, float32 ); | ||
1307 | +float32 float32_sqrt( float32 ); | ||
1308 | +int float32_eq( float32, float32 ); | ||
1309 | +int float32_le( float32, float32 ); | ||
1310 | +int float32_lt( float32, float32 ); | ||
1311 | +int float32_eq_signaling( float32, float32 ); | ||
1312 | +int float32_le_quiet( float32, float32 ); | ||
1313 | +int float32_lt_quiet( float32, float32 ); | ||
1314 | +int float32_is_signaling_nan( float32 ); | ||
1315 | + | ||
1316 | +/*---------------------------------------------------------------------------- | ||
1317 | +| Software IEC/IEEE double-precision conversion routines. | ||
1318 | +*----------------------------------------------------------------------------*/ | ||
1319 | +int float64_to_int32( float64 ); | ||
1320 | +int float64_to_int32_round_to_zero( float64 ); | ||
1321 | +long long float64_to_int64( float64 ); | ||
1322 | +long long float64_to_int64_round_to_zero( float64 ); | ||
1323 | +float32 float64_to_float32( float64 ); | ||
1324 | +#ifdef FLOATX80 | ||
1325 | +floatx80 float64_to_floatx80( float64 ); | ||
1326 | +#endif | ||
1327 | +#ifdef FLOAT128 | ||
1328 | +float128 float64_to_float128( float64 ); | ||
1329 | +#endif | ||
1330 | + | ||
1331 | +/*---------------------------------------------------------------------------- | ||
1332 | +| Software IEC/IEEE double-precision operations. | ||
1333 | +*----------------------------------------------------------------------------*/ | ||
1334 | +float64 float64_round_to_int( float64 ); | ||
1335 | +float64 float64_add( float64, float64 ); | ||
1336 | +float64 float64_sub( float64, float64 ); | ||
1337 | +float64 float64_mul( float64, float64 ); | ||
1338 | +float64 float64_div( float64, float64 ); | ||
1339 | +float64 float64_rem( float64, float64 ); | ||
1340 | +float64 float64_sqrt( float64 ); | ||
1341 | +int float64_eq( float64, float64 ); | ||
1342 | +int float64_le( float64, float64 ); | ||
1343 | +int float64_lt( float64, float64 ); | ||
1344 | +int float64_eq_signaling( float64, float64 ); | ||
1345 | +int float64_le_quiet( float64, float64 ); | ||
1346 | +int float64_lt_quiet( float64, float64 ); | ||
1347 | +int float64_is_signaling_nan( float64 ); | ||
1348 | + | ||
1349 | +#ifdef FLOATX80 | ||
1350 | + | ||
1351 | +/*---------------------------------------------------------------------------- | ||
1352 | +| Software IEC/IEEE extended double-precision conversion routines. | ||
1353 | +*----------------------------------------------------------------------------*/ | ||
1354 | +int floatx80_to_int32( floatx80 ); | ||
1355 | +int floatx80_to_int32_round_to_zero( floatx80 ); | ||
1356 | +long long floatx80_to_int64( floatx80 ); | ||
1357 | +long long floatx80_to_int64_round_to_zero( floatx80 ); | ||
1358 | +float32 floatx80_to_float32( floatx80 ); | ||
1359 | +float64 floatx80_to_float64( floatx80 ); | ||
1360 | +#ifdef FLOAT128 | ||
1361 | +float128 floatx80_to_float128( floatx80 ); | ||
1362 | +#endif | ||
1363 | + | ||
1364 | +/*---------------------------------------------------------------------------- | ||
1365 | +| Software IEC/IEEE extended double-precision rounding precision. Valid | ||
1366 | +| values are 32, 64, and 80. | ||
1367 | +*----------------------------------------------------------------------------*/ | ||
1368 | +extern int floatx80_rounding_precision; | ||
1369 | + | ||
1370 | +/*---------------------------------------------------------------------------- | ||
1371 | +| Software IEC/IEEE extended double-precision operations. | ||
1372 | +*----------------------------------------------------------------------------*/ | ||
1373 | +floatx80 floatx80_round_to_int( floatx80 ); | ||
1374 | +floatx80 floatx80_add( floatx80, floatx80 ); | ||
1375 | +floatx80 floatx80_sub( floatx80, floatx80 ); | ||
1376 | +floatx80 floatx80_mul( floatx80, floatx80 ); | ||
1377 | +floatx80 floatx80_div( floatx80, floatx80 ); | ||
1378 | +floatx80 floatx80_rem( floatx80, floatx80 ); | ||
1379 | +floatx80 floatx80_sqrt( floatx80 ); | ||
1380 | +int floatx80_eq( floatx80, floatx80 ); | ||
1381 | +int floatx80_le( floatx80, floatx80 ); | ||
1382 | +int floatx80_lt( floatx80, floatx80 ); | ||
1383 | +int floatx80_eq_signaling( floatx80, floatx80 ); | ||
1384 | +int floatx80_le_quiet( floatx80, floatx80 ); | ||
1385 | +int floatx80_lt_quiet( floatx80, floatx80 ); | ||
1386 | +int floatx80_is_signaling_nan( floatx80 ); | ||
1387 | + | ||
1388 | +#endif | ||
1389 | + | ||
1390 | +#ifdef FLOAT128 | ||
1391 | + | ||
1392 | +/*---------------------------------------------------------------------------- | ||
1393 | +| Software IEC/IEEE quadruple-precision conversion routines. | ||
1394 | +*----------------------------------------------------------------------------*/ | ||
1395 | +int float128_to_int32( float128 ); | ||
1396 | +int float128_to_int32_round_to_zero( float128 ); | ||
1397 | +long long float128_to_int64( float128 ); | ||
1398 | +long long float128_to_int64_round_to_zero( float128 ); | ||
1399 | +float32 float128_to_float32( float128 ); | ||
1400 | +float64 float128_to_float64( float128 ); | ||
1401 | +#ifdef FLOATX80 | ||
1402 | +floatx80 float128_to_floatx80( float128 ); | ||
1403 | +#endif | ||
1404 | + | ||
1405 | +/*---------------------------------------------------------------------------- | ||
1406 | +| Software IEC/IEEE quadruple-precision operations. | ||
1407 | +*----------------------------------------------------------------------------*/ | ||
1408 | +float128 float128_round_to_int( float128 ); | ||
1409 | +float128 float128_add( float128, float128 ); | ||
1410 | +float128 float128_sub( float128, float128 ); | ||
1411 | +float128 float128_mul( float128, float128 ); | ||
1412 | +float128 float128_div( float128, float128 ); | ||
1413 | +float128 float128_rem( float128, float128 ); | ||
1414 | +float128 float128_sqrt( float128 ); | ||
1415 | +int float128_eq( float128, float128 ); | ||
1416 | +int float128_le( float128, float128 ); | ||
1417 | +int float128_lt( float128, float128 ); | ||
1418 | +int float128_eq_signaling( float128, float128 ); | ||
1419 | +int float128_le_quiet( float128, float128 ); | ||
1420 | +int float128_lt_quiet( float128, float128 ); | ||
1421 | +int float128_is_signaling_nan( float128 ); | ||
1422 | + | ||
1423 | +#endif | ||
1424 | + | ||
1425 | -- | ||
1426 | 1.5.4 | ||
1427 | |||
diff --git a/recipes-extended/testfloat/files/TestFloat-powerpc-E500v2-SPE-1.patch b/recipes-extended/testfloat/files/TestFloat-powerpc-E500v2-SPE-1.patch new file mode 100644 index 00000000..c34421cf --- /dev/null +++ b/recipes-extended/testfloat/files/TestFloat-powerpc-E500v2-SPE-1.patch | |||
@@ -0,0 +1,1644 @@ | |||
1 | This patch adds PowerPC E500v2 SPE support in TestFloat. | ||
2 | And it disables the testing for hardware that can not trigger SPE interrupt. | ||
3 | |||
4 | Signed-off-by: Ebony Zhu <ebony.zhu@freescale.com> | ||
5 | Signed-off-by: Liu Yu <Yu.Liu@freescale.com> | ||
6 | --- | ||
7 | processors/POWERPC-gcc.h | 99 +++++ | ||
8 | testfloat/powerpc-linux-gcc/Makefile | 83 +++++ | ||
9 | testfloat/powerpc-linux-gcc/milieu.h | 71 ++++ | ||
10 | testfloat/powerpc-linux-gcc/systflags.c | 107 ++++++ | ||
11 | testfloat/powerpc-linux-gcc/systfloat.c | 595 +++++++++++++++++++++++++++++++ | ||
12 | testfloat/powerpc-linux-gcc/systmodes.c | 67 ++++ | ||
13 | testfloat/templates/Makefile | 18 +- | ||
14 | testfloat/templates/milieu.h | 2 +- | ||
15 | testfloat/testFunction.h | 2 +- | ||
16 | testfloat/testLoops.c | 216 +++++++++++ | ||
17 | 10 files changed, 1252 insertions(+), 8 deletions(-) | ||
18 | create mode 100644 processors/POWERPC-gcc.h | ||
19 | create mode 100644 testfloat/powerpc-linux-gcc/Makefile | ||
20 | create mode 100644 testfloat/powerpc-linux-gcc/milieu.h | ||
21 | create mode 100644 testfloat/powerpc-linux-gcc/systflags.c | ||
22 | create mode 100644 testfloat/powerpc-linux-gcc/systfloat.c | ||
23 | create mode 100644 testfloat/powerpc-linux-gcc/systmodes.c | ||
24 | |||
25 | diff --git a/processors/POWERPC-gcc.h b/processors/POWERPC-gcc.h | ||
26 | new file mode 100644 | ||
27 | index 0000000..4201faa | ||
28 | --- /dev/null | ||
29 | +++ b/processors/POWERPC-gcc.h | ||
30 | @@ -0,0 +1,99 @@ | ||
31 | +/* | ||
32 | + * This file is derived from processors/i386-GCC.h, | ||
33 | + * the copyright for that material belongs to the original owners. | ||
34 | + * | ||
35 | + * Additional material and changes where applicable is: | ||
36 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
37 | + * | ||
38 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
39 | + * Yu Liu, <yu.liu@freescale.com> | ||
40 | + * | ||
41 | + * THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has | ||
42 | + * been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES | ||
43 | + * RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS | ||
44 | + * AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES, | ||
45 | + * COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE | ||
46 | + * EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE | ||
47 | + * INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR | ||
48 | + * OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE. | ||
49 | + */ | ||
50 | + | ||
51 | +/* | ||
52 | +------------------------------------------------------------------------------- | ||
53 | +One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. | ||
54 | +------------------------------------------------------------------------------- | ||
55 | +*/ | ||
56 | +#define BIGENDIAN | ||
57 | + | ||
58 | +/* | ||
59 | +------------------------------------------------------------------------------- | ||
60 | +The macro `BITS64' can be defined to indicate that 64-bit integer types are | ||
61 | +supported by the compiler. | ||
62 | +------------------------------------------------------------------------------- | ||
63 | +*/ | ||
64 | +#undef BITS64 | ||
65 | + | ||
66 | +/* | ||
67 | +------------------------------------------------------------------------------- | ||
68 | +Each of the following `typedef's defines the most convenient type that holds | ||
69 | +integers of at least as many bits as specified. For example, `uint8' should | ||
70 | +be the most convenient type that can hold unsigned integers of as many as | ||
71 | +8 bits. The `flag' type must be able to hold either a 0 or 1. For most | ||
72 | +implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed | ||
73 | +to the same as `int'. | ||
74 | +------------------------------------------------------------------------------- | ||
75 | +*/ | ||
76 | +typedef int flag; | ||
77 | +typedef int uint8; | ||
78 | +typedef int int8; | ||
79 | +typedef int uint16; | ||
80 | +typedef int int16; | ||
81 | +typedef unsigned int uint32; | ||
82 | +typedef signed int int32; | ||
83 | +#ifdef BITS64 | ||
84 | +typedef unsigned long long int uint64; | ||
85 | +typedef signed long long int int64; | ||
86 | +#endif | ||
87 | + | ||
88 | +/* | ||
89 | +------------------------------------------------------------------------------- | ||
90 | +Each of the following `typedef's defines a type that holds integers | ||
91 | +of _exactly_ the number of bits specified. For instance, for most | ||
92 | +implementation of C, `bits16' and `sbits16' should be `typedef'ed to | ||
93 | +`unsigned short int' and `signed short int' (or `short int'), respectively. | ||
94 | +------------------------------------------------------------------------------- | ||
95 | +*/ | ||
96 | +typedef unsigned char bits8; | ||
97 | +typedef signed char sbits8; | ||
98 | +typedef unsigned short int bits16; | ||
99 | +typedef signed short int sbits16; | ||
100 | +typedef unsigned int bits32; | ||
101 | +typedef signed int sbits32; | ||
102 | +#ifdef BITS64 | ||
103 | +typedef unsigned long long int bits64; | ||
104 | +typedef signed long long int sbits64; | ||
105 | +#endif | ||
106 | + | ||
107 | +#ifdef BITS64 | ||
108 | +/* | ||
109 | +------------------------------------------------------------------------------- | ||
110 | +The `LIT64' macro takes as its argument a textual integer literal and | ||
111 | +if necessary ``marks'' the literal as having a 64-bit integer type. | ||
112 | +For example, the GNU C Compiler (`gcc') requires that 64-bit literals be | ||
113 | +appended with the letters `LL' standing for `long long', which is `gcc's | ||
114 | +name for the 64-bit integer type. Some compilers may allow `LIT64' to be | ||
115 | +defined as the identity macro: `#define LIT64( a ) a'. | ||
116 | +------------------------------------------------------------------------------- | ||
117 | +*/ | ||
118 | +#define LIT64( a ) a##LL | ||
119 | +#endif | ||
120 | + | ||
121 | +/* | ||
122 | +------------------------------------------------------------------------------- | ||
123 | +The macro `INLINE' can be used before functions that should be inlined. If | ||
124 | +a compiler does not support explicit inlining, this macro should be defined | ||
125 | +to be `static'. | ||
126 | +------------------------------------------------------------------------------- | ||
127 | +*/ | ||
128 | +#define INLINE extern inline | ||
129 | + | ||
130 | diff --git a/testfloat/powerpc-linux-gcc/Makefile b/testfloat/powerpc-linux-gcc/Makefile | ||
131 | new file mode 100644 | ||
132 | index 0000000..de50aad | ||
133 | --- /dev/null | ||
134 | +++ b/testfloat/powerpc-linux-gcc/Makefile | ||
135 | @@ -0,0 +1,83 @@ | ||
136 | + | ||
137 | +PROCESSOR_H = ../../processors/POWERPC-gcc.h | ||
138 | +SOFTFLOAT_VERSION = bits32 | ||
139 | +TARGET = powerpc-GCC | ||
140 | +SOFTFLOAT_DIR = ../../SoftFloat-2b/softfloat/$(SOFTFLOAT_VERSION)/$(TARGET) | ||
141 | + | ||
142 | +OBJ = .o | ||
143 | +EXE = | ||
144 | +INCLUDES = -I. -I.. -I$(SOFTFLOAT_DIR) | ||
145 | + | ||
146 | +COMPILE_C = $(COMPILE_PREFIX)gcc -c -o $@ $(INCLUDES) -I- -O $(EXTRA_CFLAGS) | ||
147 | + | ||
148 | +COMPILE_C_HARD = $(COMPILE_PREFIX)gcc -c -te500v2 -o $@ $(INCLUDES) | ||
149 | + | ||
150 | +COMPILE_SLOWFLOAT_C = $(COMPILE_PREFIX)gcc -c -o $@ $(INCLUDES) -I- -O | ||
151 | + | ||
152 | +LINK = $(COMPILE_PREFIX)gcc -lm -o $@ | ||
153 | + | ||
154 | +SOFTFLOAT_H = $(SOFTFLOAT_DIR)/softfloat.h | ||
155 | +SOFTFLOAT_OBJ = $(SOFTFLOAT_DIR)/softfloat$(OBJ) | ||
156 | + | ||
157 | +ALL: testsoftfloat$(EXE) testfloat$(EXE) | ||
158 | + | ||
159 | +systmodes$(OBJ): milieu.h systmodes.c | ||
160 | + $(COMPILE_C) systmodes.c | ||
161 | + | ||
162 | +systflags$(OBJ): milieu.h ../systflags.h systflags.c | ||
163 | + $(COMPILE_C) systflags.c | ||
164 | + | ||
165 | +systfloat$(OBJ): milieu.h $(SOFTFLOAT_H) ../systfloat.h systfloat.c | ||
166 | + $(COMPILE_C_HARD) systfloat.c | ||
167 | + | ||
168 | +#------------------------------------------------------------------------------ | ||
169 | +# Probably O.K. below here. | ||
170 | +#------------------------------------------------------------------------------ | ||
171 | + | ||
172 | +milieu.h: $(PROCESSOR_H) | ||
173 | + touch milieu.h | ||
174 | + | ||
175 | +fail$(OBJ): milieu.h ../fail.h | ||
176 | + $(COMPILE_C) ../fail.c | ||
177 | + | ||
178 | +random$(OBJ): milieu.h ../random.h | ||
179 | + $(COMPILE_C) ../random.c | ||
180 | + | ||
181 | +testCases$(OBJ): milieu.h ../fail.h ../random.h $(SOFTFLOAT_H) ../testCases.h ../testCases.c | ||
182 | + $(COMPILE_C) ../testCases.c | ||
183 | + | ||
184 | +writeHex$(OBJ): milieu.h $(SOFTFLOAT_H) ../writeHex.h ../writeHex.c | ||
185 | + $(COMPILE_C) ../writeHex.c | ||
186 | + | ||
187 | +testLoops$(OBJ): milieu.h $(SOFTFLOAT_H) ../testCases.h ../writeHex.h ../testLoops.h ../testLoops.c | ||
188 | + $(COMPILE_C) ../testLoops.c | ||
189 | + | ||
190 | +slowfloat$(OBJ): milieu.h $(SOFTFLOAT_H) ../slowfloat.h ../slowfloat-32.c ../slowfloat-64.c ../slowfloat.c | ||
191 | + $(COMPILE_SLOWFLOAT_C) ../slowfloat.c | ||
192 | + | ||
193 | +testsoftfloat$(OBJ): milieu.h ../fail.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../slowfloat.h ../testsoftfloat.c | ||
194 | + $(COMPILE_C) ../testsoftfloat.c | ||
195 | + | ||
196 | +testsoftfloat$(EXE): fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) slowfloat$(OBJ) testsoftfloat$(OBJ) systflags$(OBJ) systmodes$(OBJ) | ||
197 | + $(LINK) fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) slowfloat$(OBJ) testsoftfloat$(OBJ) systflags$(OBJ) systmodes$(OBJ) | ||
198 | + | ||
199 | +testFunction$(OBJ): milieu.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../systmodes.h ../systflags.h ../systfloat.h ../testFunction.h ../testFunction.c | ||
200 | + $(COMPILE_C) ../testFunction.c | ||
201 | + | ||
202 | +testfloat$(OBJ): milieu.h ../fail.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../systflags.h ../testFunction.h ../testfloat.c | ||
203 | + $(COMPILE_C) ../testfloat.c | ||
204 | + | ||
205 | +testfloat$(EXE): fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) systmodes$(OBJ) systflags$(OBJ) systfloat$(OBJ) testFunction$(OBJ) testfloat$(OBJ) | ||
206 | + $(LINK) fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) systmodes$(OBJ) systflags$(OBJ) systfloat$(OBJ) testFunction$(OBJ) testfloat$(OBJ) | ||
207 | + | ||
208 | +$(SOFTFLOAT_OBJ): | ||
209 | + make -C $(SOFTFLOAT_DIR) | ||
210 | + | ||
211 | +cp: ALL | ||
212 | + cp testsoftfloat$(EXE) ../../test_softfloat$(EXE) | ||
213 | + cp testfloat$(EXE) ../../test_float$(EXE) | ||
214 | + | ||
215 | +clean: | ||
216 | + make -C $(SOFTFLOAT_DIR) clean | ||
217 | + rm -f *.o testfloat$(EXE) testsoftfloat$(EXE) | ||
218 | + rm -f ../../test_softfloat$(EXE) ../../test_float$(EXE) | ||
219 | diff --git a/testfloat/powerpc-linux-gcc/milieu.h b/testfloat/powerpc-linux-gcc/milieu.h | ||
220 | new file mode 100644 | ||
221 | index 0000000..29d2b18 | ||
222 | --- /dev/null | ||
223 | +++ b/testfloat/powerpc-linux-gcc/milieu.h | ||
224 | @@ -0,0 +1,71 @@ | ||
225 | +/* | ||
226 | + * This file is derived from testfloat/386-Win32-gcc/milieu.h, | ||
227 | + * the copyright for that material belongs to the original owners. | ||
228 | + * | ||
229 | + * Additional material and changes where applicable is: | ||
230 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
231 | + * | ||
232 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
233 | + * Yu Liu, <yu.liu@freescale.com> | ||
234 | + */ | ||
235 | + | ||
236 | +/* | ||
237 | +=============================================================================== | ||
238 | + | ||
239 | +This C header file is part of TestFloat, Release 2a, a package of programs | ||
240 | +for testing the correctness of floating-point arithmetic complying to the | ||
241 | +IEC/IEEE Standard for Floating-Point. | ||
242 | + | ||
243 | +Written by John R. Hauser. More information is available through the Web | ||
244 | +page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'. | ||
245 | + | ||
246 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort | ||
247 | +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT | ||
248 | +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO | ||
249 | +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY | ||
250 | +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. | ||
251 | + | ||
252 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
253 | +(1) they include prominent notice that the work is derivative, and (2) they | ||
254 | +include prominent notice akin to these four paragraphs for those parts of | ||
255 | +this code that are retained. | ||
256 | + | ||
257 | +=============================================================================== | ||
258 | +*/ | ||
259 | + | ||
260 | +/* | ||
261 | +------------------------------------------------------------------------------- | ||
262 | +Include common integer types and flags. | ||
263 | +------------------------------------------------------------------------------- | ||
264 | +*/ | ||
265 | +#include "../../processors/POWERPC-gcc.h" | ||
266 | +/* | ||
267 | +------------------------------------------------------------------------------- | ||
268 | +If the `BITS64' macro is defined by the processor header file but the | ||
269 | +version of SoftFloat being used/tested is the 32-bit one (`bits32'), the | ||
270 | +`BITS64' macro must be undefined here. | ||
271 | +------------------------------------------------------------------------------- | ||
272 | +*/ | ||
273 | + | ||
274 | +#undef BITS64 | ||
275 | +/* | ||
276 | +------------------------------------------------------------------------------- | ||
277 | +The macro `LONG_DOUBLE_IS_FLOATX80' can be defined to indicate that the | ||
278 | +C compiler supports the type `long double' as an extended double-precision | ||
279 | +format. Alternatively, the macro `LONG_DOUBLE_IS_FLOAT128' can be defined | ||
280 | +to indicate that `long double' is a quadruple-precision format. If neither | ||
281 | +of these macros is defined, `long double' will be ignored. | ||
282 | +------------------------------------------------------------------------------- | ||
283 | +#define LONG_DOUBLE_IS_FLOATX80 | ||
284 | +*/ | ||
285 | + | ||
286 | +/* | ||
287 | +------------------------------------------------------------------------------- | ||
288 | +Symbolic Boolean literals. | ||
289 | +------------------------------------------------------------------------------- | ||
290 | +*/ | ||
291 | +enum { | ||
292 | + FALSE = 0, | ||
293 | + TRUE = 1 | ||
294 | +}; | ||
295 | + | ||
296 | diff --git a/testfloat/powerpc-linux-gcc/systflags.c b/testfloat/powerpc-linux-gcc/systflags.c | ||
297 | new file mode 100644 | ||
298 | index 0000000..c382442 | ||
299 | --- /dev/null | ||
300 | +++ b/testfloat/powerpc-linux-gcc/systflags.c | ||
301 | @@ -0,0 +1,107 @@ | ||
302 | +/* | ||
303 | + * This file is derived from testfloat/386-Win32-gcc/systflags.c, | ||
304 | + * the copyright for that material belongs to the original owners. | ||
305 | + * | ||
306 | + * Additional material and changes where applicable is: | ||
307 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
308 | + * | ||
309 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
310 | + * Yu Liu, <yu.liu@freescale.com> | ||
311 | + */ | ||
312 | + | ||
313 | +/* | ||
314 | +=============================================================================== | ||
315 | + | ||
316 | +This C source file is part of TestFloat, Release 2a, a package of programs | ||
317 | +for testing the correctness of floating-point arithmetic complying to the | ||
318 | +IEC/IEEE Standard for Floating-Point. | ||
319 | + | ||
320 | +Written by John R. Hauser. More information is available through the Web | ||
321 | +page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'. | ||
322 | + | ||
323 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort | ||
324 | +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT | ||
325 | +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO | ||
326 | +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY | ||
327 | +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. | ||
328 | + | ||
329 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
330 | +(1) they include prominent notice that the work is derivative, and (2) they | ||
331 | +include prominent notice akin to these four paragraphs for those parts of | ||
332 | +this code that are retained. | ||
333 | + | ||
334 | +=============================================================================== | ||
335 | +*/ | ||
336 | + | ||
337 | +#include "milieu.h" | ||
338 | +#include "systflags.h" | ||
339 | +#include <fenv.h> | ||
340 | +#include <stdio.h> | ||
341 | +#include <math.h> | ||
342 | +#include <bits/nan.h> | ||
343 | +#include <bits/inf.h> | ||
344 | + | ||
345 | +#ifdef __SPE__ | ||
346 | + | ||
347 | +#include <spe.h> | ||
348 | + | ||
349 | + | ||
350 | +#define SPE_FINV_ENABLE (1UL << 5) | ||
351 | +#define SPE_FDBZ_ENABLE (1UL << 4) | ||
352 | +#define SPE_FUNF_ENABLE (1UL << 3) | ||
353 | +#define SPE_FOVF_ENABLE (1UL << 2) | ||
354 | + | ||
355 | +#define SPE_FG (1UL << 13) | ||
356 | +#define SPE_FX (1UL << 12) | ||
357 | +#define SPE_FINV (1UL << 11) | ||
358 | +#define SPE_FDBZ (1UL << 10) | ||
359 | +#define SPE_FUNF (1UL << 9) | ||
360 | +#define SPE_FOVF (1UL << 8) | ||
361 | + | ||
362 | +#define SPE_FG_H (1UL << 29) | ||
363 | +#define SPE_FX_H (1UL << 28) | ||
364 | +#define SPE_FINV_H (1UL << 27) | ||
365 | +#define SPE_FDBZ_H (1UL << 26) | ||
366 | +#define SPE_FUNF_H (1UL << 25) | ||
367 | +#define SPE_FOVF_H (1UL << 24) | ||
368 | + | ||
369 | +static int is_soft_emu = 0; | ||
370 | + | ||
371 | +#endif | ||
372 | +/* | ||
373 | +------------------------------------------------------------------------------- | ||
374 | +Clears the system's IEC/IEEE floating-point exception flags. Returns the | ||
375 | +previous value of the flags. | ||
376 | +------------------------------------------------------------------------------- | ||
377 | +*/ | ||
378 | +extern int rounding; | ||
379 | +unsigned int spefscr = 0; | ||
380 | + | ||
381 | +int8 syst_float_flags_clear( void ) | ||
382 | +{ | ||
383 | +#ifdef TEST_KERNEL_EMU | ||
384 | + if( (spefscr & (SPE_FINV | SPE_FINV_H)) | ||
385 | + || (spefscr & (SPE_FDBZ | SPE_FDBZ_H)) | ||
386 | + || (spefscr & (SPE_FUNF | SPE_FUNF_H)) | ||
387 | + || (spefscr & (SPE_FOVF | SPE_FOVF_H)) | ||
388 | + || (spefscr & (SPE_FX | SPE_FG | SPE_FX_H | SPE_FG_H))){ | ||
389 | + is_soft_emu = 1; | ||
390 | + } else { | ||
391 | + is_soft_emu = 0; | ||
392 | + } | ||
393 | +#endif | ||
394 | + __builtin_spe_mtspefscr(0x3c|(rounding & 0x3)); | ||
395 | + | ||
396 | + return ((spefscr>>17) & 0x1f); | ||
397 | +} | ||
398 | + | ||
399 | +int syst_float_is_soft_emu(void) | ||
400 | +{ | ||
401 | + int ret = 0; | ||
402 | +#ifdef TEST_KERNEL_EMU | ||
403 | + ret = is_soft_emu; | ||
404 | +#endif | ||
405 | + return ret; | ||
406 | +} | ||
407 | + | ||
408 | + | ||
409 | diff --git a/testfloat/powerpc-linux-gcc/systfloat.c b/testfloat/powerpc-linux-gcc/systfloat.c | ||
410 | new file mode 100644 | ||
411 | index 0000000..8d06f9f | ||
412 | --- /dev/null | ||
413 | +++ b/testfloat/powerpc-linux-gcc/systfloat.c | ||
414 | @@ -0,0 +1,595 @@ | ||
415 | +/* | ||
416 | + * This file is derived from testfloat/systfloat.c, | ||
417 | + * the copyright for that material belongs to the original owners. | ||
418 | + * | ||
419 | + * Additional material and changes where applicable is: | ||
420 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
421 | + * | ||
422 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
423 | + * Yu Liu, <yu.liu@freescale.com> | ||
424 | + */ | ||
425 | + | ||
426 | +/* | ||
427 | +=============================================================================== | ||
428 | + | ||
429 | +This C source file is part of TestFloat, Release 2a, a package of programs | ||
430 | +for testing the correctness of floating-point arithmetic complying to the | ||
431 | +IEC/IEEE Standard for Floating-Point. | ||
432 | + | ||
433 | +Written by John R. Hauser. More information is available through the Web | ||
434 | +page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'. | ||
435 | + | ||
436 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort | ||
437 | +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT | ||
438 | +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO | ||
439 | +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY | ||
440 | +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. | ||
441 | + | ||
442 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
443 | +(1) they include prominent notice that the work is derivative, and (2) they | ||
444 | +include prominent notice akin to these four paragraphs for those parts of | ||
445 | +this code that are retained. | ||
446 | + | ||
447 | +=============================================================================== | ||
448 | +*/ | ||
449 | + | ||
450 | +#include <math.h> | ||
451 | +#include "milieu.h" | ||
452 | +#include "softfloat.h" | ||
453 | +#include "systfloat.h" | ||
454 | + | ||
455 | +extern unsigned int spefscr; | ||
456 | + | ||
457 | +float32 syst_int32_to_float32( int32 a ) | ||
458 | +{ | ||
459 | + float32 z; | ||
460 | + | ||
461 | + *( (float *) &z ) = a; | ||
462 | + spefscr = __builtin_spe_mfspefscr(); | ||
463 | + return z; | ||
464 | + | ||
465 | +} | ||
466 | + | ||
467 | +float64 syst_int32_to_float64( int32 a ) | ||
468 | +{ | ||
469 | + float64 z; | ||
470 | + | ||
471 | + *( (double *) &z ) = a; | ||
472 | + spefscr = __builtin_spe_mfspefscr(); | ||
473 | + return z; | ||
474 | + | ||
475 | +} | ||
476 | + | ||
477 | +#if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 ) | ||
478 | + | ||
479 | +floatx80 syst_int32_to_floatx80( int32 a ) | ||
480 | +{ | ||
481 | + floatx80 z; | ||
482 | + | ||
483 | + *( (long double *) &z ) = a; | ||
484 | + return z; | ||
485 | + | ||
486 | +} | ||
487 | + | ||
488 | +#endif | ||
489 | + | ||
490 | +#if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 ) | ||
491 | + | ||
492 | +float128 syst_int32_to_float128( int32 a ) | ||
493 | +{ | ||
494 | + float128 z; | ||
495 | + | ||
496 | + *( (long double *) &z ) = a; | ||
497 | + return z; | ||
498 | + | ||
499 | +} | ||
500 | + | ||
501 | +#endif | ||
502 | + | ||
503 | +#ifdef BITS64 | ||
504 | + | ||
505 | +float32 syst_int64_to_float32( int64 a ) | ||
506 | +{ | ||
507 | + float32 z; | ||
508 | + | ||
509 | + *( (float *) &z ) = a; | ||
510 | + spefscr = __builtin_spe_mfspefscr(); | ||
511 | + return z; | ||
512 | + | ||
513 | +} | ||
514 | + | ||
515 | +float64 syst_int64_to_float64( int64 a ) | ||
516 | +{ | ||
517 | + float64 z; | ||
518 | + | ||
519 | + *( (double *) &z ) = a; | ||
520 | + spefscr = __builtin_spe_mfspefscr(); | ||
521 | + return z; | ||
522 | + | ||
523 | +} | ||
524 | + | ||
525 | +#if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 ) | ||
526 | + | ||
527 | +floatx80 syst_int64_to_floatx80( int64 a ) | ||
528 | +{ | ||
529 | + floatx80 z; | ||
530 | + | ||
531 | + *( (long double *) &z ) = a; | ||
532 | + return z; | ||
533 | + | ||
534 | +} | ||
535 | + | ||
536 | +#endif | ||
537 | + | ||
538 | +#if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 ) | ||
539 | + | ||
540 | +float128 syst_int64_to_float128( int64 a ) | ||
541 | +{ | ||
542 | + float128 z; | ||
543 | + | ||
544 | + *( (long double *) &z ) = a; | ||
545 | + return z; | ||
546 | + | ||
547 | +} | ||
548 | + | ||
549 | +#endif | ||
550 | + | ||
551 | +#endif | ||
552 | + | ||
553 | +int32 syst_float32_to_int32_round_to_zero( float32 a ) | ||
554 | +{ | ||
555 | + int32 z = *( (float *) &a ); | ||
556 | + spefscr = __builtin_spe_mfspefscr(); | ||
557 | + | ||
558 | + return z; | ||
559 | + | ||
560 | +} | ||
561 | + | ||
562 | +#ifdef BITS64 | ||
563 | + | ||
564 | +int64 syst_float32_to_int64_round_to_zero( float32 a ) | ||
565 | +{ | ||
566 | + int64 z = *( (float *) &a ); | ||
567 | + spefscr = __builtin_spe_mfspefscr(); | ||
568 | + return z; | ||
569 | + | ||
570 | +} | ||
571 | + | ||
572 | +#endif | ||
573 | + | ||
574 | +float64 syst_float32_to_float64( float32 a ) | ||
575 | +{ | ||
576 | + float64 z; | ||
577 | + | ||
578 | + *( (double *) &z ) = *( (float *) &a ); | ||
579 | + spefscr = __builtin_spe_mfspefscr(); | ||
580 | + return z; | ||
581 | + | ||
582 | +} | ||
583 | + | ||
584 | +#if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 ) | ||
585 | + | ||
586 | +floatx80 syst_float32_to_floatx80( float32 a ) | ||
587 | +{ | ||
588 | + floatx80 z; | ||
589 | + | ||
590 | + *( (long double *) &z ) = *( (float *) &a ); | ||
591 | + return z; | ||
592 | + | ||
593 | +} | ||
594 | + | ||
595 | +#endif | ||
596 | + | ||
597 | +#if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 ) | ||
598 | + | ||
599 | +float128 syst_float32_to_float128( float32 a ) | ||
600 | +{ | ||
601 | + float128 z; | ||
602 | + | ||
603 | + *( (long double *) &z ) = *( (float *) &a ); | ||
604 | + return z; | ||
605 | + | ||
606 | +} | ||
607 | + | ||
608 | +#endif | ||
609 | + | ||
610 | +float32 syst_float32_add( float32 a, float32 b ) | ||
611 | +{ | ||
612 | + float32 z; | ||
613 | + | ||
614 | + *( (float *) &z ) = *( (float *) &a ) + *( (float *) &b ); | ||
615 | + spefscr = __builtin_spe_mfspefscr(); | ||
616 | + return z; | ||
617 | + | ||
618 | +} | ||
619 | + | ||
620 | +float32 syst_float32_sub( float32 a, float32 b ) | ||
621 | +{ | ||
622 | + float32 z; | ||
623 | + | ||
624 | + *( (float *) &z ) = *( (float *) &a ) - *( (float *) &b ); | ||
625 | + spefscr = __builtin_spe_mfspefscr(); | ||
626 | + return z; | ||
627 | + | ||
628 | +} | ||
629 | + | ||
630 | +float32 syst_float32_mul( float32 a, float32 b ) | ||
631 | +{ | ||
632 | + float32 z; | ||
633 | + | ||
634 | + *( (float *) &z ) = *( (float *) &a ) * *( (float *) &b ); | ||
635 | + spefscr = __builtin_spe_mfspefscr(); | ||
636 | + return z; | ||
637 | + | ||
638 | +} | ||
639 | + | ||
640 | +float32 syst_float32_div( float32 a, float32 b ) | ||
641 | +{ | ||
642 | + float32 z; | ||
643 | + | ||
644 | + *( (float *) &z ) = *( (float *) &a ) / *( (float *) &b ); | ||
645 | + spefscr = __builtin_spe_mfspefscr(); | ||
646 | + return z; | ||
647 | + | ||
648 | +} | ||
649 | + | ||
650 | +flag syst_float32_eq( float32 a, float32 b ) | ||
651 | +{ | ||
652 | + flag f = ( *( (float *) &a ) == *( (float *) &b ) ); | ||
653 | + spefscr = __builtin_spe_mfspefscr(); | ||
654 | + return f; | ||
655 | + | ||
656 | +} | ||
657 | + | ||
658 | +flag syst_float32_le( float32 a, float32 b ) | ||
659 | +{ | ||
660 | + flag f = ( *( (float *) &a ) <= *( (float *) &b ) ); | ||
661 | + spefscr = __builtin_spe_mfspefscr(); | ||
662 | + return f; | ||
663 | + | ||
664 | +} | ||
665 | + | ||
666 | +flag syst_float32_lt( float32 a, float32 b ) | ||
667 | +{ | ||
668 | + flag f = ( *( (float *) &a ) < *( (float *) &b ) ); | ||
669 | + spefscr = __builtin_spe_mfspefscr(); | ||
670 | + return f; | ||
671 | + | ||
672 | +} | ||
673 | + | ||
674 | +int32 syst_float64_to_int32_round_to_zero( float64 a ) | ||
675 | +{ | ||
676 | + int32 z = *( (double *) &a ); | ||
677 | + spefscr = __builtin_spe_mfspefscr(); | ||
678 | + return z; | ||
679 | + | ||
680 | +} | ||
681 | + | ||
682 | +#ifdef BITS64 | ||
683 | + | ||
684 | +int64 syst_float64_to_int64_round_to_zero( float64 a ) | ||
685 | +{ | ||
686 | + int64 z = *( (double *) &a ); | ||
687 | + spefscr = __builtin_spe_mfspefscr(); | ||
688 | + return z; | ||
689 | + | ||
690 | +} | ||
691 | + | ||
692 | +#endif | ||
693 | + | ||
694 | +float32 syst_float64_to_float32( float64 a ) | ||
695 | +{ | ||
696 | + float32 z; | ||
697 | + | ||
698 | + *( (float *) &z ) = *( (double *) &a ); | ||
699 | + spefscr = __builtin_spe_mfspefscr(); | ||
700 | + return z; | ||
701 | + | ||
702 | +} | ||
703 | + | ||
704 | +#if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 ) | ||
705 | + | ||
706 | +floatx80 syst_float64_to_floatx80( float64 a ) | ||
707 | +{ | ||
708 | + floatx80 z; | ||
709 | + | ||
710 | + *( (long double *) &z ) = *( (double *) &a ); | ||
711 | + return z; | ||
712 | + | ||
713 | +} | ||
714 | + | ||
715 | +#endif | ||
716 | + | ||
717 | +#if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 ) | ||
718 | + | ||
719 | +float128 syst_float64_to_float128( float64 a ) | ||
720 | +{ | ||
721 | + float128 z; | ||
722 | + | ||
723 | + *( (long double *) &z ) = *( (double *) &a ); | ||
724 | + return z; | ||
725 | + | ||
726 | +} | ||
727 | + | ||
728 | +#endif | ||
729 | + | ||
730 | +float64 syst_float64_add( float64 a, float64 b ) | ||
731 | +{ | ||
732 | + float64 z; | ||
733 | + | ||
734 | + *( (double *) &z ) = *( (double *) &a ) + *( (double *) &b ); | ||
735 | + spefscr = __builtin_spe_mfspefscr(); | ||
736 | + return z; | ||
737 | + | ||
738 | +} | ||
739 | + | ||
740 | +float64 syst_float64_sub( float64 a, float64 b ) | ||
741 | +{ | ||
742 | + float64 z; | ||
743 | + | ||
744 | + *( (double *) &z ) = *( (double *) &a ) - *( (double *) &b ); | ||
745 | + spefscr = __builtin_spe_mfspefscr(); | ||
746 | + return z; | ||
747 | + | ||
748 | +} | ||
749 | + | ||
750 | +float64 syst_float64_mul( float64 a, float64 b ) | ||
751 | +{ | ||
752 | + float64 z; | ||
753 | + | ||
754 | + *( (double *) &z ) = *( (double *) &a ) * *( (double *) &b ); | ||
755 | + spefscr = __builtin_spe_mfspefscr(); | ||
756 | + return z; | ||
757 | + | ||
758 | +} | ||
759 | + | ||
760 | +float64 syst_float64_div( float64 a, float64 b ) | ||
761 | +{ | ||
762 | + float64 z; | ||
763 | + | ||
764 | + *( (double *) &z ) = *( (double *) &a ) / *( (double *) &b ); | ||
765 | + spefscr = __builtin_spe_mfspefscr(); | ||
766 | + return z; | ||
767 | + | ||
768 | +} | ||
769 | + | ||
770 | +float64 syst_float64_sqrt( float64 a ) | ||
771 | +{ | ||
772 | + /* Ebony | ||
773 | + float64 z; | ||
774 | + | ||
775 | + *( (double *) &z ) = sqrt( *( (double *) &a ) ); | ||
776 | + spefscr = __builtin_spe_mfspefscr(); | ||
777 | + return z; | ||
778 | + */ | ||
779 | + | ||
780 | +} | ||
781 | + | ||
782 | +flag syst_float64_eq( float64 a, float64 b ) | ||
783 | +{ | ||
784 | + flag f = ( *( (double *) &a ) == *( (double *) &b ) ); | ||
785 | + spefscr = __builtin_spe_mfspefscr(); | ||
786 | + return f; | ||
787 | + | ||
788 | +} | ||
789 | + | ||
790 | +flag syst_float64_le( float64 a, float64 b ) | ||
791 | +{ | ||
792 | + flag f = ( *( (double *) &a ) <= *( (double *) &b ) ); | ||
793 | + spefscr = __builtin_spe_mfspefscr(); | ||
794 | + return f; | ||
795 | + | ||
796 | +} | ||
797 | + | ||
798 | +flag syst_float64_lt( float64 a, float64 b ) | ||
799 | +{ | ||
800 | + flag f = ( *( (double *) &a ) < *( (double *) &b ) ); | ||
801 | + spefscr = __builtin_spe_mfspefscr(); | ||
802 | + return f; | ||
803 | + | ||
804 | +} | ||
805 | + | ||
806 | +#if defined( FLOATX80 ) && defined( LONG_DOUBLE_IS_FLOATX80 ) | ||
807 | + | ||
808 | +int32 syst_floatx80_to_int32_round_to_zero( floatx80 a ) | ||
809 | +{ | ||
810 | + | ||
811 | + return *( (long double *) &a ); | ||
812 | + | ||
813 | +} | ||
814 | + | ||
815 | +#ifdef BITS64 | ||
816 | + | ||
817 | +int64 syst_floatx80_to_int64_round_to_zero( floatx80 a ) | ||
818 | +{ | ||
819 | + | ||
820 | + return *( (long double *) &a ); | ||
821 | + | ||
822 | +} | ||
823 | + | ||
824 | +#endif | ||
825 | + | ||
826 | +float32 syst_floatx80_to_float32( floatx80 a ) | ||
827 | +{ | ||
828 | + float32 z; | ||
829 | + | ||
830 | + *( (float *) &z ) = *( (long double *) &a ); | ||
831 | + return z; | ||
832 | + | ||
833 | +} | ||
834 | + | ||
835 | +float64 syst_floatx80_to_float64( floatx80 a ) | ||
836 | +{ | ||
837 | + float64 z; | ||
838 | + | ||
839 | + *( (double *) &z ) = *( (long double *) &a ); | ||
840 | + return z; | ||
841 | + | ||
842 | +} | ||
843 | + | ||
844 | +floatx80 syst_floatx80_add( floatx80 a, floatx80 b ) | ||
845 | +{ | ||
846 | + floatx80 z; | ||
847 | + | ||
848 | + *( (long double *) &z ) = | ||
849 | + *( (long double *) &a ) + *( (long double *) &b ); | ||
850 | + return z; | ||
851 | + | ||
852 | +} | ||
853 | + | ||
854 | +floatx80 syst_floatx80_sub( floatx80 a, floatx80 b ) | ||
855 | +{ | ||
856 | + floatx80 z; | ||
857 | + | ||
858 | + *( (long double *) &z ) = | ||
859 | + *( (long double *) &a ) - *( (long double *) &b ); | ||
860 | + return z; | ||
861 | + | ||
862 | +} | ||
863 | + | ||
864 | +floatx80 syst_floatx80_mul( floatx80 a, floatx80 b ) | ||
865 | +{ | ||
866 | + floatx80 z; | ||
867 | + | ||
868 | + *( (long double *) &z ) = | ||
869 | + *( (long double *) &a ) * *( (long double *) &b ); | ||
870 | + return z; | ||
871 | + | ||
872 | +} | ||
873 | + | ||
874 | +floatx80 syst_floatx80_div( floatx80 a, floatx80 b ) | ||
875 | +{ | ||
876 | + floatx80 z; | ||
877 | + | ||
878 | + *( (long double *) &z ) = | ||
879 | + *( (long double *) &a ) / *( (long double *) &b ); | ||
880 | + spefscr = __builtin_spe_mfspefscr(); | ||
881 | + return z; | ||
882 | + | ||
883 | +} | ||
884 | + | ||
885 | +flag syst_floatx80_eq( floatx80 a, floatx80 b ) | ||
886 | +{ | ||
887 | + | ||
888 | + return ( *( (long double *) &a ) == *( (long double *) &b ) ); | ||
889 | + | ||
890 | +} | ||
891 | + | ||
892 | +flag syst_floatx80_le( floatx80 a, floatx80 b ) | ||
893 | +{ | ||
894 | + | ||
895 | + return ( *( (long double *) &a ) <= *( (long double *) &b ) ); | ||
896 | + | ||
897 | +} | ||
898 | + | ||
899 | +flag syst_floatx80_lt( floatx80 a, floatx80 b ) | ||
900 | +{ | ||
901 | + | ||
902 | + return ( *( (long double *) &a ) < *( (long double *) &b ) ); | ||
903 | + | ||
904 | +} | ||
905 | + | ||
906 | +#endif | ||
907 | + | ||
908 | +#if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 ) | ||
909 | + | ||
910 | +int32 syst_float128_to_int32_round_to_zero( float128 a ) | ||
911 | +{ | ||
912 | + | ||
913 | + return *( (long double *) &a ); | ||
914 | + | ||
915 | +} | ||
916 | + | ||
917 | +#ifdef BITS64 | ||
918 | + | ||
919 | +int64 syst_float128_to_int64_round_to_zero( float128 a ) | ||
920 | +{ | ||
921 | + | ||
922 | + return *( (long double *) &a ); | ||
923 | + | ||
924 | +} | ||
925 | + | ||
926 | +#endif | ||
927 | + | ||
928 | +float32 syst_float128_to_float32( float128 a ) | ||
929 | +{ | ||
930 | + float32 z; | ||
931 | + | ||
932 | + *( (float *) &z ) = *( (long double *) &a ); | ||
933 | + return z; | ||
934 | + | ||
935 | +} | ||
936 | + | ||
937 | +float64 syst_float128_to_float64( float128 a ) | ||
938 | +{ | ||
939 | + float64 z; | ||
940 | + | ||
941 | + *( (double *) &z ) = *( (long double *) &a ); | ||
942 | + return z; | ||
943 | + | ||
944 | +} | ||
945 | + | ||
946 | +float128 syst_float128_add( float128 a, float128 b ) | ||
947 | +{ | ||
948 | + float128 z; | ||
949 | + | ||
950 | + *( (long double *) &z ) = | ||
951 | + *( (long double *) &a ) + *( (long double *) &b ); | ||
952 | + return z; | ||
953 | + | ||
954 | +} | ||
955 | + | ||
956 | +float128 syst_float128_sub( float128 a, float128 b ) | ||
957 | +{ | ||
958 | + float128 z; | ||
959 | + | ||
960 | + *( (long double *) &z ) = | ||
961 | + *( (long double *) &a ) - *( (long double *) &b ); | ||
962 | + return z; | ||
963 | + | ||
964 | +} | ||
965 | + | ||
966 | +float128 syst_float128_mul( float128 a, float128 b ) | ||
967 | +{ | ||
968 | + float128 z; | ||
969 | + | ||
970 | + *( (long double *) &z ) = | ||
971 | + *( (long double *) &a ) * *( (long double *) &b ); | ||
972 | + return z; | ||
973 | + | ||
974 | +} | ||
975 | + | ||
976 | +float128 syst_float128_div( float128 a, float128 b ) | ||
977 | +{ | ||
978 | + float128 z; | ||
979 | + | ||
980 | + *( (long double *) &z ) = | ||
981 | + *( (long double *) &a ) / *( (long double *) &b ); | ||
982 | + spefscr = __builtin_spe_mfspefscr(); | ||
983 | + return z; | ||
984 | + | ||
985 | +} | ||
986 | + | ||
987 | +flag syst_float128_eq( float128 a, float128 b ) | ||
988 | +{ | ||
989 | + | ||
990 | + return ( *( (long double *) &a ) == *( (long double *) &b ) ); | ||
991 | + | ||
992 | +} | ||
993 | + | ||
994 | +flag syst_float128_le( float128 a, float128 b ) | ||
995 | +{ | ||
996 | + | ||
997 | + return ( *( (long double *) &a ) <= *( (long double *) &b ) ); | ||
998 | + | ||
999 | +} | ||
1000 | + | ||
1001 | +flag syst_float128_lt( float128 a, float128 b ) | ||
1002 | +{ | ||
1003 | + | ||
1004 | + return ( *( (long double *) &a ) < *( (long double *) &b ) ); | ||
1005 | + | ||
1006 | +} | ||
1007 | + | ||
1008 | +#endif | ||
1009 | + | ||
1010 | diff --git a/testfloat/powerpc-linux-gcc/systmodes.c b/testfloat/powerpc-linux-gcc/systmodes.c | ||
1011 | new file mode 100644 | ||
1012 | index 0000000..143cdea | ||
1013 | --- /dev/null | ||
1014 | +++ b/testfloat/powerpc-linux-gcc/systmodes.c | ||
1015 | @@ -0,0 +1,67 @@ | ||
1016 | +/* | ||
1017 | + * This file is derived from testfloat/386-Win32-gcc/systmodes.S, | ||
1018 | + * the copyright for that material belongs to the original owners. | ||
1019 | + * | ||
1020 | + * Additional material and changes where applicable is: | ||
1021 | + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights reserved. | ||
1022 | + * | ||
1023 | + * Author: Ebony Zhu, <ebony.zhu@freescale.com> | ||
1024 | + * Yu Liu, <yu.liu@freescale.com> | ||
1025 | + */ | ||
1026 | + | ||
1027 | +/* | ||
1028 | +=============================================================================== | ||
1029 | + | ||
1030 | +This C source file is part of TestFloat, Release 2a, a package of programs | ||
1031 | +for testing the correctness of floating-point arithmetic complying to the | ||
1032 | +IEC/IEEE Standard for Floating-Point. | ||
1033 | + | ||
1034 | +Written by John R. Hauser. More information is available through the Web | ||
1035 | +page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'. | ||
1036 | + | ||
1037 | +THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort | ||
1038 | +has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT | ||
1039 | +TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO | ||
1040 | +PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY | ||
1041 | +AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE. | ||
1042 | + | ||
1043 | +Derivative works are acceptable, even for commercial purposes, so long as | ||
1044 | +(1) they include prominent notice that the work is derivative, and (2) they | ||
1045 | +include prominent notice akin to these four paragraphs for those parts of | ||
1046 | +this code that are retained. | ||
1047 | + | ||
1048 | +=============================================================================== | ||
1049 | +*/ | ||
1050 | + | ||
1051 | +#include <fenv.h> | ||
1052 | +#include "milieu.h" | ||
1053 | +#include "systmodes.h" | ||
1054 | +/* | ||
1055 | +------------------------------------------------------------------------------- | ||
1056 | +Sets the system's IEC/IEEE floating-point rounding mode. Also disables all | ||
1057 | +system exception traps. | ||
1058 | +------------------------------------------------------------------------------- | ||
1059 | +*/ | ||
1060 | +int rounding; | ||
1061 | + | ||
1062 | +void syst_float_set_rounding_mode( int8 roundingMode ) | ||
1063 | +{ | ||
1064 | + (void) fesetround ( roundingMode ); | ||
1065 | + rounding = roundingMode; | ||
1066 | +} | ||
1067 | + | ||
1068 | +/* | ||
1069 | +------------------------------------------------------------------------------- | ||
1070 | +Sets the rounding precision of subsequent extended double-precision | ||
1071 | +operations. The `precision' argument should be one of 0, 32, 64, or 80. | ||
1072 | +If `precision' is 32, the rounding precision is set equivalent to single | ||
1073 | +precision; else if `precision' is 64, the rounding precision is set | ||
1074 | +equivalent to double precision; else the rounding precision is set to full | ||
1075 | +extended double precision. | ||
1076 | +------------------------------------------------------------------------------- | ||
1077 | +*/ | ||
1078 | +void syst_float_set_rounding_precision( int8 precision ) | ||
1079 | +{ | ||
1080 | + | ||
1081 | +} | ||
1082 | + | ||
1083 | diff --git a/testfloat/templates/Makefile b/testfloat/templates/Makefile | ||
1084 | index f5f3cde..18cffe0 100644 | ||
1085 | --- a/testfloat/templates/Makefile | ||
1086 | +++ b/testfloat/templates/Makefile | ||
1087 | @@ -1,15 +1,21 @@ | ||
1088 | |||
1089 | -PROCESSOR_H = ../../processors/!!!processor.h | ||
1090 | +#PROCESSOR_H = ../../processors/!!!processor.h | ||
1091 | +PROCESSOR_H = ../../processors/POWERPC-gcc.h | ||
1092 | SOFTFLOAT_VERSION = bits64 | ||
1093 | -TARGET = !!!target | ||
1094 | -SOFTFLOAT_DIR = ../../softfloat/$(SOFTFLOAT_VERSION)/$(TARGET) | ||
1095 | + | ||
1096 | +#TARGET = !!!target | ||
1097 | +TARGET = powerpc-GCC | ||
1098 | +SOFTFLOAT_DIR = ../../../SoftFloat-2b/softfloat/$(SOFTFLOAT_VERSION)/$(TARGET) | ||
1099 | |||
1100 | OBJ = .o | ||
1101 | EXE = | ||
1102 | INCLUDES = -I. -I.. -I$(SOFTFLOAT_DIR) | ||
1103 | -COMPILE_C = gcc -c -o $@ $(INCLUDES) -I- -O2 | ||
1104 | -COMPILE_SLOWFLOAT_C = gcc -c -o $@ $(INCLUDES) -I- -O3 | ||
1105 | -LINK = gcc -o $@ | ||
1106 | +#COMPILE_C = gcc -c -o $@ $(INCLUDES) -I- -O2 | ||
1107 | +#COMPILE_SLOWFLOAT_C = gcc -c -o $@ $(INCLUDES) -I- -O3 | ||
1108 | +#LINK = gcc -o $@ | ||
1109 | +COMPILE_C = /opt/mtwk/usr/local/gcc-3_4-e500-glibc-2.3.4-dp/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc -c -o $@ $(INCLUDES) -I- -O2 | ||
1110 | +COMPILE_SLOWFLOAT_C = /opt/mtwk/usr/local/gcc-3_4-e500-glibc-2.3.4-dp/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc -c -o $@ $(INCLUDES) -I- -O3 | ||
1111 | +LINK = /opt/mtwk/usr/local/gcc-3_4-e500-glibc-2.3.4-dp/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc -o $@ | ||
1112 | |||
1113 | SOFTFLOAT_H = $(SOFTFLOAT_DIR)/softfloat.h | ||
1114 | SOFTFLOAT_OBJ = $(SOFTFLOAT_DIR)/softfloat$(OBJ) | ||
1115 | diff --git a/testfloat/templates/milieu.h b/testfloat/templates/milieu.h | ||
1116 | index 56d3ac4..3214ca8 100644 | ||
1117 | --- a/testfloat/templates/milieu.h | ||
1118 | +++ b/testfloat/templates/milieu.h | ||
1119 | @@ -28,7 +28,7 @@ this code that are retained. | ||
1120 | Include common integer types and flags. | ||
1121 | ------------------------------------------------------------------------------- | ||
1122 | */ | ||
1123 | -#include "../../processors/!!!processor.h" | ||
1124 | +#include "../../processors/SPARC-gcc.h" | ||
1125 | |||
1126 | /* | ||
1127 | ------------------------------------------------------------------------------- | ||
1128 | diff --git a/testfloat/testFunction.h b/testfloat/testFunction.h | ||
1129 | index 04bf856..00139a7 100644 | ||
1130 | --- a/testfloat/testFunction.h | ||
1131 | +++ b/testfloat/testFunction.h | ||
1132 | @@ -126,8 +126,8 @@ extern const flag functionExists[ NUM_FUNCTIONS ]; | ||
1133 | enum { | ||
1134 | ROUND_NEAREST_EVEN = 1, | ||
1135 | ROUND_TO_ZERO, | ||
1136 | - ROUND_DOWN, | ||
1137 | ROUND_UP, | ||
1138 | + ROUND_DOWN, | ||
1139 | NUM_ROUNDINGMODES | ||
1140 | }; | ||
1141 | |||
1142 | diff --git a/testfloat/testLoops.c b/testfloat/testLoops.c | ||
1143 | index 8ba92f3..ba05548 100644 | ||
1144 | --- a/testfloat/testLoops.c | ||
1145 | +++ b/testfloat/testLoops.c | ||
1146 | @@ -488,6 +488,11 @@ void | ||
1147 | (void) testFlagsFunctionPtr(); | ||
1148 | testZ = testFunction( testCases_a_int32 ); | ||
1149 | testFlags = testFlagsFunctionPtr(); | ||
1150 | +#ifdef TEST_KERNEL_EMU | ||
1151 | + if (! syst_float_is_soft_emu()){ | ||
1152 | + continue; | ||
1153 | + } | ||
1154 | +#endif | ||
1155 | --count; | ||
1156 | if ( count == 0 ) { | ||
1157 | checkEarlyExit(); | ||
1158 | @@ -539,6 +544,11 @@ void | ||
1159 | (void) testFlagsFunctionPtr(); | ||
1160 | testZ = testFunction( testCases_a_int32 ); | ||
1161 | testFlags = testFlagsFunctionPtr(); | ||
1162 | +#ifdef TEST_KERNEL_EMU | ||
1163 | + if (! syst_float_is_soft_emu()){ | ||
1164 | + continue; | ||
1165 | + } | ||
1166 | +#endif | ||
1167 | --count; | ||
1168 | if ( count == 0 ) { | ||
1169 | checkEarlyExit(); | ||
1170 | @@ -592,6 +602,11 @@ void | ||
1171 | (void) testFlagsFunctionPtr(); | ||
1172 | testZ = testFunction( testCases_a_int32 ); | ||
1173 | testFlags = testFlagsFunctionPtr(); | ||
1174 | +#ifdef TEST_KERNEL_EMU | ||
1175 | + if (! syst_float_is_soft_emu()){ | ||
1176 | + continue; | ||
1177 | + } | ||
1178 | +#endif | ||
1179 | --count; | ||
1180 | if ( count == 0 ) { | ||
1181 | checkEarlyExit(); | ||
1182 | @@ -647,6 +662,11 @@ void | ||
1183 | (void) testFlagsFunctionPtr(); | ||
1184 | testZ = testFunction( testCases_a_int32 ); | ||
1185 | testFlags = testFlagsFunctionPtr(); | ||
1186 | +#ifdef TEST_KERNEL_EMU | ||
1187 | + if (! syst_float_is_soft_emu()){ | ||
1188 | + continue; | ||
1189 | + } | ||
1190 | +#endif | ||
1191 | --count; | ||
1192 | if ( count == 0 ) { | ||
1193 | checkEarlyExit(); | ||
1194 | @@ -702,6 +722,11 @@ void | ||
1195 | (void) testFlagsFunctionPtr(); | ||
1196 | testZ = testFunction( testCases_a_int64 ); | ||
1197 | testFlags = testFlagsFunctionPtr(); | ||
1198 | +#ifdef TEST_KERNEL_EMU | ||
1199 | + if (! syst_float_is_soft_emu()){ | ||
1200 | + continue; | ||
1201 | + } | ||
1202 | +#endif | ||
1203 | --count; | ||
1204 | if ( count == 0 ) { | ||
1205 | checkEarlyExit(); | ||
1206 | @@ -753,6 +778,11 @@ void | ||
1207 | (void) testFlagsFunctionPtr(); | ||
1208 | testZ = testFunction( testCases_a_int64 ); | ||
1209 | testFlags = testFlagsFunctionPtr(); | ||
1210 | +#ifdef TEST_KERNEL_EMU | ||
1211 | + if (! syst_float_is_soft_emu()){ | ||
1212 | + continue; | ||
1213 | + } | ||
1214 | +#endif | ||
1215 | --count; | ||
1216 | if ( count == 0 ) { | ||
1217 | checkEarlyExit(); | ||
1218 | @@ -806,6 +836,11 @@ void | ||
1219 | (void) testFlagsFunctionPtr(); | ||
1220 | testZ = testFunction( testCases_a_int64 ); | ||
1221 | testFlags = testFlagsFunctionPtr(); | ||
1222 | +#ifdef TEST_KERNEL_EMU | ||
1223 | + if (! syst_float_is_soft_emu()){ | ||
1224 | + continue; | ||
1225 | + } | ||
1226 | +#endif | ||
1227 | --count; | ||
1228 | if ( count == 0 ) { | ||
1229 | checkEarlyExit(); | ||
1230 | @@ -861,6 +896,11 @@ void | ||
1231 | (void) testFlagsFunctionPtr(); | ||
1232 | testZ = testFunction( testCases_a_int64 ); | ||
1233 | testFlags = testFlagsFunctionPtr(); | ||
1234 | +#ifdef TEST_KERNEL_EMU | ||
1235 | + if (! syst_float_is_soft_emu()){ | ||
1236 | + continue; | ||
1237 | + } | ||
1238 | +#endif | ||
1239 | --count; | ||
1240 | if ( count == 0 ) { | ||
1241 | checkEarlyExit(); | ||
1242 | @@ -916,6 +956,11 @@ void | ||
1243 | (void) testFlagsFunctionPtr(); | ||
1244 | testZ = testFunction( testCases_a_float32 ); | ||
1245 | testFlags = testFlagsFunctionPtr(); | ||
1246 | +#ifdef TEST_KERNEL_EMU | ||
1247 | + if (! syst_float_is_soft_emu()){ | ||
1248 | + continue; | ||
1249 | + } | ||
1250 | +#endif | ||
1251 | --count; | ||
1252 | if ( count == 0 ) { | ||
1253 | checkEarlyExit(); | ||
1254 | @@ -973,6 +1018,11 @@ void | ||
1255 | (void) testFlagsFunctionPtr(); | ||
1256 | testZ = testFunction( testCases_a_float32 ); | ||
1257 | testFlags = testFlagsFunctionPtr(); | ||
1258 | +#ifdef TEST_KERNEL_EMU | ||
1259 | + if (! syst_float_is_soft_emu()){ | ||
1260 | + continue; | ||
1261 | + } | ||
1262 | +#endif | ||
1263 | --count; | ||
1264 | if ( count == 0 ) { | ||
1265 | checkEarlyExit(); | ||
1266 | @@ -1030,6 +1080,11 @@ void | ||
1267 | (void) testFlagsFunctionPtr(); | ||
1268 | testZ = testFunction( testCases_a_float32 ); | ||
1269 | testFlags = testFlagsFunctionPtr(); | ||
1270 | +#ifdef TEST_KERNEL_EMU | ||
1271 | + if (! syst_float_is_soft_emu()){ | ||
1272 | + continue; | ||
1273 | + } | ||
1274 | +#endif | ||
1275 | --count; | ||
1276 | if ( count == 0 ) { | ||
1277 | checkEarlyExit(); | ||
1278 | @@ -1087,6 +1142,11 @@ void | ||
1279 | (void) testFlagsFunctionPtr(); | ||
1280 | testZ = testFunction( testCases_a_float32 ); | ||
1281 | testFlags = testFlagsFunctionPtr(); | ||
1282 | +#ifdef TEST_KERNEL_EMU | ||
1283 | + if (! syst_float_is_soft_emu()){ | ||
1284 | + continue; | ||
1285 | + } | ||
1286 | +#endif | ||
1287 | --count; | ||
1288 | if ( count == 0 ) { | ||
1289 | checkEarlyExit(); | ||
1290 | @@ -1146,6 +1206,11 @@ void | ||
1291 | (void) testFlagsFunctionPtr(); | ||
1292 | testZ = testFunction( testCases_a_float32 ); | ||
1293 | testFlags = testFlagsFunctionPtr(); | ||
1294 | +#ifdef TEST_KERNEL_EMU | ||
1295 | + if (! syst_float_is_soft_emu()){ | ||
1296 | + continue; | ||
1297 | + } | ||
1298 | +#endif | ||
1299 | --count; | ||
1300 | if ( count == 0 ) { | ||
1301 | checkEarlyExit(); | ||
1302 | @@ -1203,6 +1268,11 @@ void | ||
1303 | (void) testFlagsFunctionPtr(); | ||
1304 | testZ = testFunction( testCases_a_float32 ); | ||
1305 | testFlags = testFlagsFunctionPtr(); | ||
1306 | +#ifdef TEST_KERNEL_EMU | ||
1307 | + if (! syst_float_is_soft_emu()){ | ||
1308 | + continue; | ||
1309 | + } | ||
1310 | +#endif | ||
1311 | --count; | ||
1312 | if ( count == 0 ) { | ||
1313 | checkEarlyExit(); | ||
1314 | @@ -1260,6 +1330,11 @@ void | ||
1315 | (void) testFlagsFunctionPtr(); | ||
1316 | testZ = testFunction( testCases_a_float32, testCases_b_float32 ); | ||
1317 | testFlags = testFlagsFunctionPtr(); | ||
1318 | +#ifdef TEST_KERNEL_EMU | ||
1319 | + if (! syst_float_is_soft_emu()){ | ||
1320 | + continue; | ||
1321 | + } | ||
1322 | +#endif | ||
1323 | --count; | ||
1324 | if ( count == 0 ) { | ||
1325 | checkEarlyExit(); | ||
1326 | @@ -1312,6 +1387,25 @@ void | ||
1327 | (void) testFlagsFunctionPtr(); | ||
1328 | testZ = testFunction( testCases_a_float32, testCases_b_float32 ); | ||
1329 | testFlags = testFlagsFunctionPtr(); | ||
1330 | + | ||
1331 | +if(testCases_a_float32 == 0x7ffffe && testCases_b_float32 == 0x3f7ffffe) | ||
1332 | +{ | ||
1333 | + | ||
1334 | + writeErrorFound( 10000 - count ); | ||
1335 | + writeInputs_ab_float32(); | ||
1336 | + fputs( " ", stdout ); | ||
1337 | + writeOutputs_z_float32( trueZ, trueFlags, testZ, testFlags ); | ||
1338 | + fflush( stdout ); | ||
1339 | + if (! syst_float_is_soft_emu()){ | ||
1340 | + exit(-1); | ||
1341 | + } | ||
1342 | +} | ||
1343 | +#ifdef TEST_KERNEL_EMU | ||
1344 | + if (! syst_float_is_soft_emu()){ | ||
1345 | + continue; | ||
1346 | + } | ||
1347 | +#endif | ||
1348 | + | ||
1349 | --count; | ||
1350 | if ( count == 0 ) { | ||
1351 | checkEarlyExit(); | ||
1352 | @@ -1370,6 +1464,11 @@ void | ||
1353 | (void) testFlagsFunctionPtr(); | ||
1354 | testZ = testFunction( testCases_a_float64 ); | ||
1355 | testFlags = testFlagsFunctionPtr(); | ||
1356 | +#ifdef TEST_KERNEL_EMU | ||
1357 | + if (! syst_float_is_soft_emu()){ | ||
1358 | + continue; | ||
1359 | + } | ||
1360 | +#endif | ||
1361 | --count; | ||
1362 | if ( count == 0 ) { | ||
1363 | checkEarlyExit(); | ||
1364 | @@ -1427,6 +1526,11 @@ void | ||
1365 | (void) testFlagsFunctionPtr(); | ||
1366 | testZ = testFunction( testCases_a_float64 ); | ||
1367 | testFlags = testFlagsFunctionPtr(); | ||
1368 | +#ifdef TEST_KERNEL_EMU | ||
1369 | + if (! syst_float_is_soft_emu()){ | ||
1370 | + continue; | ||
1371 | + } | ||
1372 | +#endif | ||
1373 | --count; | ||
1374 | if ( count == 0 ) { | ||
1375 | checkEarlyExit(); | ||
1376 | @@ -1484,6 +1588,11 @@ void | ||
1377 | (void) testFlagsFunctionPtr(); | ||
1378 | testZ = testFunction( testCases_a_float64 ); | ||
1379 | testFlags = testFlagsFunctionPtr(); | ||
1380 | +#ifdef TEST_KERNEL_EMU | ||
1381 | + if (! syst_float_is_soft_emu()){ | ||
1382 | + continue; | ||
1383 | + } | ||
1384 | +#endif | ||
1385 | --count; | ||
1386 | if ( count == 0 ) { | ||
1387 | checkEarlyExit(); | ||
1388 | @@ -1541,6 +1650,11 @@ void | ||
1389 | (void) testFlagsFunctionPtr(); | ||
1390 | testZ = testFunction( testCases_a_float64 ); | ||
1391 | testFlags = testFlagsFunctionPtr(); | ||
1392 | +#ifdef TEST_KERNEL_EMU | ||
1393 | + if (! syst_float_is_soft_emu()){ | ||
1394 | + continue; | ||
1395 | + } | ||
1396 | +#endif | ||
1397 | --count; | ||
1398 | if ( count == 0 ) { | ||
1399 | checkEarlyExit(); | ||
1400 | @@ -1600,6 +1714,11 @@ void | ||
1401 | (void) testFlagsFunctionPtr(); | ||
1402 | testZ = testFunction( testCases_a_float64 ); | ||
1403 | testFlags = testFlagsFunctionPtr(); | ||
1404 | +#ifdef TEST_KERNEL_EMU | ||
1405 | + if (! syst_float_is_soft_emu()){ | ||
1406 | + continue; | ||
1407 | + } | ||
1408 | +#endif | ||
1409 | --count; | ||
1410 | if ( count == 0 ) { | ||
1411 | checkEarlyExit(); | ||
1412 | @@ -1657,6 +1776,11 @@ void | ||
1413 | (void) testFlagsFunctionPtr(); | ||
1414 | testZ = testFunction( testCases_a_float64 ); | ||
1415 | testFlags = testFlagsFunctionPtr(); | ||
1416 | +#ifdef TEST_KERNEL_EMU | ||
1417 | + if (! syst_float_is_soft_emu()){ | ||
1418 | + continue; | ||
1419 | + } | ||
1420 | +#endif | ||
1421 | --count; | ||
1422 | if ( count == 0 ) { | ||
1423 | checkEarlyExit(); | ||
1424 | @@ -1714,6 +1838,11 @@ void | ||
1425 | (void) testFlagsFunctionPtr(); | ||
1426 | testZ = testFunction( testCases_a_float64, testCases_b_float64 ); | ||
1427 | testFlags = testFlagsFunctionPtr(); | ||
1428 | +#ifdef TEST_KERNEL_EMU | ||
1429 | + if (! syst_float_is_soft_emu()){ | ||
1430 | + continue; | ||
1431 | + } | ||
1432 | +#endif | ||
1433 | --count; | ||
1434 | if ( count == 0 ) { | ||
1435 | checkEarlyExit(); | ||
1436 | @@ -1766,6 +1895,13 @@ void | ||
1437 | (void) testFlagsFunctionPtr(); | ||
1438 | testZ = testFunction( testCases_a_float64, testCases_b_float64 ); | ||
1439 | testFlags = testFlagsFunctionPtr(); | ||
1440 | + | ||
1441 | +#ifdef TEST_KERNEL_EMU | ||
1442 | + if (! syst_float_is_soft_emu()){ | ||
1443 | + continue; | ||
1444 | + } | ||
1445 | +#endif | ||
1446 | + | ||
1447 | --count; | ||
1448 | if ( count == 0 ) { | ||
1449 | checkEarlyExit(); | ||
1450 | @@ -1826,6 +1962,11 @@ void | ||
1451 | (void) testFlagsFunctionPtr(); | ||
1452 | testZ = testFunction( testCases_a_floatx80 ); | ||
1453 | testFlags = testFlagsFunctionPtr(); | ||
1454 | +#ifdef TEST_KERNEL_EMU | ||
1455 | + if (! syst_float_is_soft_emu()){ | ||
1456 | + continue; | ||
1457 | + } | ||
1458 | +#endif | ||
1459 | --count; | ||
1460 | if ( count == 0 ) { | ||
1461 | checkEarlyExit(); | ||
1462 | @@ -1883,6 +2024,11 @@ void | ||
1463 | (void) testFlagsFunctionPtr(); | ||
1464 | testZ = testFunction( testCases_a_floatx80 ); | ||
1465 | testFlags = testFlagsFunctionPtr(); | ||
1466 | +#ifdef TEST_KERNEL_EMU | ||
1467 | + if (! syst_float_is_soft_emu()){ | ||
1468 | + continue; | ||
1469 | + } | ||
1470 | +#endif | ||
1471 | --count; | ||
1472 | if ( count == 0 ) { | ||
1473 | checkEarlyExit(); | ||
1474 | @@ -1940,6 +2086,11 @@ void | ||
1475 | (void) testFlagsFunctionPtr(); | ||
1476 | testZ = testFunction( testCases_a_floatx80 ); | ||
1477 | testFlags = testFlagsFunctionPtr(); | ||
1478 | +#ifdef TEST_KERNEL_EMU | ||
1479 | + if (! syst_float_is_soft_emu()){ | ||
1480 | + continue; | ||
1481 | + } | ||
1482 | +#endif | ||
1483 | --count; | ||
1484 | if ( count == 0 ) { | ||
1485 | checkEarlyExit(); | ||
1486 | @@ -1995,6 +2146,11 @@ void | ||
1487 | (void) testFlagsFunctionPtr(); | ||
1488 | testZ = testFunction( testCases_a_floatx80 ); | ||
1489 | testFlags = testFlagsFunctionPtr(); | ||
1490 | +#ifdef TEST_KERNEL_EMU | ||
1491 | + if (! syst_float_is_soft_emu()){ | ||
1492 | + continue; | ||
1493 | + } | ||
1494 | +#endif | ||
1495 | --count; | ||
1496 | if ( count == 0 ) { | ||
1497 | checkEarlyExit(); | ||
1498 | @@ -2052,6 +2208,11 @@ void | ||
1499 | (void) testFlagsFunctionPtr(); | ||
1500 | testZ = testFunction( testCases_a_floatx80 ); | ||
1501 | testFlags = testFlagsFunctionPtr(); | ||
1502 | +#ifdef TEST_KERNEL_EMU | ||
1503 | + if (! syst_float_is_soft_emu()){ | ||
1504 | + continue; | ||
1505 | + } | ||
1506 | +#endif | ||
1507 | --count; | ||
1508 | if ( count == 0 ) { | ||
1509 | checkEarlyExit(); | ||
1510 | @@ -2109,6 +2270,11 @@ void | ||
1511 | (void) testFlagsFunctionPtr(); | ||
1512 | testZ = testFunction( testCases_a_floatx80 ); | ||
1513 | testFlags = testFlagsFunctionPtr(); | ||
1514 | +#ifdef TEST_KERNEL_EMU | ||
1515 | + if (! syst_float_is_soft_emu()){ | ||
1516 | + continue; | ||
1517 | + } | ||
1518 | +#endif | ||
1519 | --count; | ||
1520 | if ( count == 0 ) { | ||
1521 | checkEarlyExit(); | ||
1522 | @@ -2166,6 +2332,11 @@ void | ||
1523 | (void) testFlagsFunctionPtr(); | ||
1524 | testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 ); | ||
1525 | testFlags = testFlagsFunctionPtr(); | ||
1526 | +#ifdef TEST_KERNEL_EMU | ||
1527 | + if (! syst_float_is_soft_emu()){ | ||
1528 | + continue; | ||
1529 | + } | ||
1530 | +#endif | ||
1531 | --count; | ||
1532 | if ( count == 0 ) { | ||
1533 | checkEarlyExit(); | ||
1534 | @@ -2218,6 +2389,11 @@ void | ||
1535 | (void) testFlagsFunctionPtr(); | ||
1536 | testZ = testFunction( testCases_a_floatx80, testCases_b_floatx80 ); | ||
1537 | testFlags = testFlagsFunctionPtr(); | ||
1538 | +#ifdef TEST_KERNEL_EMU | ||
1539 | + if (! syst_float_is_soft_emu()){ | ||
1540 | + continue; | ||
1541 | + } | ||
1542 | +#endif | ||
1543 | --count; | ||
1544 | if ( count == 0 ) { | ||
1545 | checkEarlyExit(); | ||
1546 | @@ -2280,6 +2456,11 @@ void | ||
1547 | (void) testFlagsFunctionPtr(); | ||
1548 | testZ = testFunction( testCases_a_float128 ); | ||
1549 | testFlags = testFlagsFunctionPtr(); | ||
1550 | +#ifdef TEST_KERNEL_EMU | ||
1551 | + if (! syst_float_is_soft_emu()){ | ||
1552 | + continue; | ||
1553 | + } | ||
1554 | +#endif | ||
1555 | --count; | ||
1556 | if ( count == 0 ) { | ||
1557 | checkEarlyExit(); | ||
1558 | @@ -2337,6 +2518,11 @@ void | ||
1559 | (void) testFlagsFunctionPtr(); | ||
1560 | testZ = testFunction( testCases_a_float128 ); | ||
1561 | testFlags = testFlagsFunctionPtr(); | ||
1562 | +#ifdef TEST_KERNEL_EMU | ||
1563 | + if (! syst_float_is_soft_emu()){ | ||
1564 | + continue; | ||
1565 | + } | ||
1566 | +#endif | ||
1567 | --count; | ||
1568 | if ( count == 0 ) { | ||
1569 | checkEarlyExit(); | ||
1570 | @@ -2394,6 +2580,11 @@ void | ||
1571 | (void) testFlagsFunctionPtr(); | ||
1572 | testZ = testFunction( testCases_a_float128 ); | ||
1573 | testFlags = testFlagsFunctionPtr(); | ||
1574 | +#ifdef TEST_KERNEL_EMU | ||
1575 | + if (! syst_float_is_soft_emu()){ | ||
1576 | + continue; | ||
1577 | + } | ||
1578 | +#endif | ||
1579 | --count; | ||
1580 | if ( count == 0 ) { | ||
1581 | checkEarlyExit(); | ||
1582 | @@ -2449,6 +2640,11 @@ void | ||
1583 | (void) testFlagsFunctionPtr(); | ||
1584 | testZ = testFunction( testCases_a_float128 ); | ||
1585 | testFlags = testFlagsFunctionPtr(); | ||
1586 | +#ifdef TEST_KERNEL_EMU | ||
1587 | + if (! syst_float_is_soft_emu()){ | ||
1588 | + continue; | ||
1589 | + } | ||
1590 | +#endif | ||
1591 | --count; | ||
1592 | if ( count == 0 ) { | ||
1593 | checkEarlyExit(); | ||
1594 | @@ -2506,6 +2702,11 @@ void | ||
1595 | (void) testFlagsFunctionPtr(); | ||
1596 | testZ = testFunction( testCases_a_float128 ); | ||
1597 | testFlags = testFlagsFunctionPtr(); | ||
1598 | +#ifdef TEST_KERNEL_EMU | ||
1599 | + if (! syst_float_is_soft_emu()){ | ||
1600 | + continue; | ||
1601 | + } | ||
1602 | +#endif | ||
1603 | --count; | ||
1604 | if ( count == 0 ) { | ||
1605 | checkEarlyExit(); | ||
1606 | @@ -2563,6 +2764,11 @@ void | ||
1607 | (void) testFlagsFunctionPtr(); | ||
1608 | testZ = testFunction( testCases_a_float128 ); | ||
1609 | testFlags = testFlagsFunctionPtr(); | ||
1610 | +#ifdef TEST_KERNEL_EMU | ||
1611 | + if (! syst_float_is_soft_emu()){ | ||
1612 | + continue; | ||
1613 | + } | ||
1614 | +#endif | ||
1615 | --count; | ||
1616 | if ( count == 0 ) { | ||
1617 | checkEarlyExit(); | ||
1618 | @@ -2620,6 +2826,11 @@ void | ||
1619 | (void) testFlagsFunctionPtr(); | ||
1620 | testZ = testFunction( testCases_a_float128, testCases_b_float128 ); | ||
1621 | testFlags = testFlagsFunctionPtr(); | ||
1622 | +#ifdef TEST_KERNEL_EMU | ||
1623 | + if (! syst_float_is_soft_emu()){ | ||
1624 | + continue; | ||
1625 | + } | ||
1626 | +#endif | ||
1627 | --count; | ||
1628 | if ( count == 0 ) { | ||
1629 | checkEarlyExit(); | ||
1630 | @@ -2672,6 +2883,11 @@ void | ||
1631 | (void) testFlagsFunctionPtr(); | ||
1632 | testZ = testFunction( testCases_a_float128, testCases_b_float128 ); | ||
1633 | testFlags = testFlagsFunctionPtr(); | ||
1634 | +#ifdef TEST_KERNEL_EMU | ||
1635 | + if (! syst_float_is_soft_emu()){ | ||
1636 | + continue; | ||
1637 | + } | ||
1638 | +#endif | ||
1639 | --count; | ||
1640 | if ( count == 0 ) { | ||
1641 | checkEarlyExit(); | ||
1642 | -- | ||
1643 | 1.5.4 | ||
1644 | |||
diff --git a/recipes-extended/testfloat/files/Yocto-replace-COMPILE_PREFIX-gcc.patch b/recipes-extended/testfloat/files/Yocto-replace-COMPILE_PREFIX-gcc.patch new file mode 100644 index 00000000..42de56d3 --- /dev/null +++ b/recipes-extended/testfloat/files/Yocto-replace-COMPILE_PREFIX-gcc.patch | |||
@@ -0,0 +1,67 @@ | |||
1 | From 6c7567e05c28b8cb6c7dc68c278950a32feb6f64 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ting Liu <b28495@freescale.com> | ||
3 | Date: Wed, 9 May 2012 02:42:57 -0500 | ||
4 | Subject: [PATCH] Yocto: replace $(COMPILE_PREFIX)gcc with $(CC) and remove -te500v2 flags | ||
5 | |||
6 | Signed-off-by: Ting Liu <b28495@freescale.com> | ||
7 | --- | ||
8 | SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | 4 ++-- | ||
9 | SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | 4 ++-- | ||
10 | testfloat/powerpc-linux-gcc/Makefile | 8 ++++---- | ||
11 | 3 files changed, 8 insertions(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
14 | index 28f1e33..4098048 100644 | ||
15 | --- a/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
16 | +++ b/SoftFloat-2b/softfloat/bits32/powerpc-GCC/Makefile | ||
17 | @@ -5,8 +5,8 @@ SOFTFLOAT_MACROS = ../softfloat-macros | ||
18 | OBJ = .o | ||
19 | EXE = | ||
20 | INCLUDES = -I. -I.. | ||
21 | -COMPILE_C = $(COMPILE_PREFIX)gcc -msoft-float -c -o $@ $(INCLUDES) -I- -O2 | ||
22 | -LINK = $(COMPILE_PREFIX)gcc -o $@ | ||
23 | +COMPILE_C = $(CC) -msoft-float -c -o $@ $(INCLUDES) -I- -O2 | ||
24 | +LINK = $(CC) -o $@ | ||
25 | |||
26 | ALL: softfloat$(OBJ) timesoftfloat$(EXE) | ||
27 | |||
28 | diff --git a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
29 | index a5e2cc7..c34e16e 100644 | ||
30 | --- a/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
31 | +++ b/SoftFloat-2b/softfloat/bits64/powerpc-GCC/Makefile | ||
32 | @@ -5,8 +5,8 @@ SOFTFLOAT_MACROS = ../softfloat-macros | ||
33 | OBJ = .o | ||
34 | EXE = | ||
35 | INCLUDES = -I. -I.. | ||
36 | -COMPILE_C = $(COMPILE_PREFIX) -mcpu=8548 -mhard-float -mfloat-gprs=double -o $@ $(INCLUDES) -I- -O2 | ||
37 | -LINK = $(COMPILE_PREFIX) -o $@ | ||
38 | +COMPILE_C = $(CC) -mcpu=8548 -mhard-float -mfloat-gprs=double -o $@ $(INCLUDES) -I- -O2 | ||
39 | +LINK = $(CC) -o $@ | ||
40 | |||
41 | ALL: softfloat$(OBJ) timesoftfloat$(EXE) | ||
42 | |||
43 | diff --git a/testfloat/powerpc-linux-gcc/Makefile b/testfloat/powerpc-linux-gcc/Makefile | ||
44 | index de50aad..1a8b5f7 100644 | ||
45 | --- a/testfloat/powerpc-linux-gcc/Makefile | ||
46 | +++ b/testfloat/powerpc-linux-gcc/Makefile | ||
47 | @@ -8,13 +8,13 @@ OBJ = .o | ||
48 | EXE = | ||
49 | INCLUDES = -I. -I.. -I$(SOFTFLOAT_DIR) | ||
50 | |||
51 | -COMPILE_C = $(COMPILE_PREFIX)gcc -c -o $@ $(INCLUDES) -I- -O $(EXTRA_CFLAGS) | ||
52 | +COMPILE_C = $(CC) -c -o $@ $(INCLUDES) -I- -O $(EXTRA_CFLAGS) | ||
53 | |||
54 | -COMPILE_C_HARD = $(COMPILE_PREFIX)gcc -c -te500v2 -o $@ $(INCLUDES) | ||
55 | +COMPILE_C_HARD = $(CC) -c -o $@ $(INCLUDES) | ||
56 | |||
57 | -COMPILE_SLOWFLOAT_C = $(COMPILE_PREFIX)gcc -c -o $@ $(INCLUDES) -I- -O | ||
58 | +COMPILE_SLOWFLOAT_C = $(CC) -c -o $@ $(INCLUDES) -I- -O | ||
59 | |||
60 | -LINK = $(COMPILE_PREFIX)gcc -lm -o $@ | ||
61 | +LINK = $(CC) -lm -o $@ | ||
62 | |||
63 | SOFTFLOAT_H = $(SOFTFLOAT_DIR)/softfloat.h | ||
64 | SOFTFLOAT_OBJ = $(SOFTFLOAT_DIR)/softfloat$(OBJ) | ||
65 | -- | ||
66 | 1.7.3.4 | ||
67 | |||