ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/fpu/types.h
Revision: 1.8
Committed: 2005-01-30T21:42:16Z (19 years, 5 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
CVS Tags: nigel-build-17
Changes since 1.7: +1 -1 lines
Log Message:
Happy New Year!

File Contents

# Content
1 /*
2 * types.h - basic types for fpu registers
3 *
4 * Basilisk II (C) 1997-2005 Christian Bauer
5 *
6 * MC68881/68040 fpu emulation
7 *
8 * Original UAE FPU, copyright 1996 Herman ten Brugge
9 * Rewrite for x86, copyright 1999-2000 Lauri Pesonen
10 * New framework, copyright 2000 Gwenole Beauchesne
11 * Adapted for JIT compilation (c) Bernd Meyer, 2000
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 */
27
28 #ifndef FPU_TYPES_H
29 #define FPU_TYPES_H
30
31 #include "sysdeps.h"
32
33 /* Default behavior is *not* to use long doubles */
34 #undef USE_LONG_DOUBLE
35 #undef USE_QUAD_DOUBLE
36
37 /* -------------------------------------------------------------------------- */
38 /* --- Original UAE fpu core --- */
39 /* -------------------------------------------------------------------------- */
40
41 #if defined(FPU_UAE)
42
43 /* 4-byte floats */
44 #if SIZEOF_FLOAT == 4
45 typedef float uae_f32;
46 #elif SIZEOF_DOUBLE == 4
47 typedef double uae_f32;
48 #else
49 #error "No 4 byte float type, you lose."
50 #endif
51
52 /* 8-byte floats */
53 #if SIZEOF_DOUBLE == 8
54 typedef double uae_f64;
55 #elif SIZEOF_LONG_DOUBLE == 8
56 typedef long double uae_f64;
57 #else
58 #error "No 8 byte float type, you lose."
59 #endif
60
61 /* Original UAE FPU registers are only 8 bytes long */
62 typedef uae_f64 fpu_register;
63 typedef fpu_register fpu_extended;
64 typedef uae_f64 fpu_double;
65 typedef uae_f32 fpu_single;
66
67 /* -------------------------------------------------------------------------- */
68 /* --- Optimized core for x86 --- */
69 /* -------------------------------------------------------------------------- */
70
71 #elif defined(FPU_X86)
72
73 /* 4-byte floats */
74 #if SIZEOF_FLOAT == 4
75 typedef float uae_f32;
76 #elif SIZEOF_DOUBLE == 4
77 typedef double uae_f32;
78 #else
79 #error "No 4 byte float type, you lose."
80 #endif
81
82 /* 8-byte floats */
83 #if SIZEOF_DOUBLE == 8
84 typedef float uae_f64;
85 #elif SIZEOF_LONG_DOUBLE == 8
86 typedef double uae_f64;
87 #else
88 #error "No 8 byte float type, you lose."
89 #endif
90
91 /* At least 10-byte floats are required */
92 #if SIZEOF_LONG_DOUBLE >= 10
93 typedef long double fpu_register;
94 #else
95 #error "No float type at least 10 bytes long, you lose."
96 #endif
97
98 /* X86 FPU has a custom register type that maps to a native X86 register */
99 typedef fpu_register fpu_extended;
100 typedef uae_f64 fpu_double;
101 typedef uae_f32 fpu_single;
102
103 /* -------------------------------------------------------------------------- */
104 /* --- C99 implementation --- */
105 /* -------------------------------------------------------------------------- */
106
107 #elif defined(FPU_IEEE)
108
109 #if HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
110 #error "No IEEE float format, you lose."
111 #endif
112
113 /* 4-byte floats */
114 #if SIZEOF_FLOAT == 4
115 typedef float uae_f32;
116 #elif SIZEOF_DOUBLE == 4
117 typedef double uae_f32;
118 #else
119 #error "No 4 byte float type, you lose."
120 #endif
121
122 /* 8-byte floats */
123 #if SIZEOF_DOUBLE == 8
124 typedef double uae_f64;
125 #elif SIZEOF_LONG_DOUBLE == 8
126 typedef long double uae_f64;
127 #else
128 #error "No 8 byte float type, you lose."
129 #endif
130
131 /* 12-byte or 16-byte floats */
132 #if SIZEOF_LONG_DOUBLE == 12
133 typedef long double uae_f96;
134 typedef uae_f96 fpu_register;
135 #define USE_LONG_DOUBLE 1
136 #elif SIZEOF_LONG_DOUBLE == 16 && defined(__x86_64__)
137 /* Long doubles on x86-64 are really held in old x87 FPU stack. */
138 typedef long double uae_f128;
139 typedef uae_f128 fpu_register;
140 #define USE_LONG_DOUBLE 1
141 #elif 0
142 /* Disable for now and probably for good as (i) the emulator
143 implementation is not correct, (ii) I don't know of any CPU which
144 handles this kind of format *natively* with conformance to IEEE. */
145 typedef long double uae_f128;
146 typedef uae_f128 fpu_register;
147 #define USE_QUAD_DOUBLE 1
148 #else
149 typedef uae_f64 fpu_register;
150 #endif
151
152 /* We need all those floating-point types */
153 typedef fpu_register fpu_extended;
154 typedef uae_f64 fpu_double;
155 typedef uae_f32 fpu_single;
156
157 #endif
158
159 #endif /* FPU_TYPES_H */