ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/fpu/types.h
Revision: 1.2
Committed: 2002-09-15T18:21:13Z (21 years, 10 months ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.1: +8 -8 lines
Log Message:
Fix "ieee" FPU core on big endian and without long double > double support
- Handle conversions to/from host double for m68k long doubles formats
- Make mathlib aware of sizeof(long double) == sizeof(double) arches
- Attempt to fix FSCALE implementation

File Contents

# Content
1 /*
2 * types.h - basic types for fpu registers
3 *
4 * Basilisk II (C) 1997-1999 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 /* 4-byte floats */
110 #if SIZEOF_FLOAT == 4
111 typedef float uae_f32;
112 #elif SIZEOF_DOUBLE == 4
113 typedef double uae_f32;
114 #else
115 #error "No 4 byte float type, you lose."
116 #endif
117
118 /* 8-byte floats */
119 #if SIZEOF_DOUBLE == 8
120 typedef double uae_f64;
121 #elif SIZEOF_LONG_DOUBLE == 8
122 typedef long double uae_f64;
123 #else
124 #error "No 8 byte float type, you lose."
125 #endif
126
127 /* 12-byte or 16-byte floats */
128 #if SIZEOF_LONG_DOUBLE == 12
129 typedef long double uae_f96;
130 typedef uae_f96 fpu_register;
131 #define USE_LONG_DOUBLE 1
132 #elif SIZEOF_LONG_DOUBLE == 16
133 typedef long double uae_f128;
134 typedef uae_f128 fpu_register;
135 #define USE_LONG_DOUBLE 1
136 #define USE_QUAD_DOUBLE 1
137 #else
138 typedef uae_f64 fpu_register;
139 #endif
140
141 /* We need all those floating-point types */
142 typedef fpu_register fpu_extended;
143 typedef uae_f64 fpu_double;
144 typedef uae_f32 fpu_single;
145
146 #endif
147
148 #endif /* FPU_TYPES_H */