1 |
gbeauche |
1.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 |
gbeauche |
1.2 |
#undef USE_LONG_DOUBLE |
35 |
|
|
#undef USE_QUAD_DOUBLE |
36 |
gbeauche |
1.1 |
|
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 |
gbeauche |
1.3 |
#if HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT |
110 |
|
|
#error "No IEEE float format, you lose." |
111 |
|
|
#endif |
112 |
|
|
|
113 |
gbeauche |
1.1 |
/* 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 |
gbeauche |
1.2 |
#define USE_LONG_DOUBLE 1 |
136 |
gbeauche |
1.1 |
#elif SIZEOF_LONG_DOUBLE == 16 |
137 |
|
|
typedef long double uae_f128; |
138 |
|
|
typedef uae_f128 fpu_register; |
139 |
gbeauche |
1.2 |
#define USE_QUAD_DOUBLE 1 |
140 |
gbeauche |
1.1 |
#else |
141 |
gbeauche |
1.2 |
typedef uae_f64 fpu_register; |
142 |
gbeauche |
1.1 |
#endif |
143 |
|
|
|
144 |
|
|
/* We need all those floating-point types */ |
145 |
|
|
typedef fpu_register fpu_extended; |
146 |
gbeauche |
1.2 |
typedef uae_f64 fpu_double; |
147 |
|
|
typedef uae_f32 fpu_single; |
148 |
gbeauche |
1.1 |
|
149 |
|
|
#endif |
150 |
|
|
|
151 |
|
|
#endif /* FPU_TYPES_H */ |