1 |
/* |
2 |
* fpu/fpu_uae.h - Extra Definitions for the old UAE FPU core |
3 |
* |
4 |
* Basilisk II (C) 1997-2008 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_IEEE_H |
29 |
#define FPU_IEEE_H |
30 |
|
31 |
/* NOTE: this file shall be included from fpu/fpu_uae.cpp */ |
32 |
#undef PUBLIC |
33 |
#define PUBLIC extern |
34 |
|
35 |
#undef PRIVATE |
36 |
#define PRIVATE static |
37 |
|
38 |
#undef FFPU |
39 |
#define FFPU /**/ |
40 |
|
41 |
#undef FPU |
42 |
#define FPU fpu. |
43 |
|
44 |
// Lauri-- full words to avoid partial register stalls. |
45 |
struct double_flags { |
46 |
uae_u32 in_range; |
47 |
uae_u32 zero; |
48 |
uae_u32 infinity; |
49 |
uae_u32 nan; |
50 |
uae_u32 negative; |
51 |
}; |
52 |
PRIVATE double_flags fl_source; |
53 |
PRIVATE double_flags fl_dest; |
54 |
PRIVATE inline void FFPU get_dest_flags(fpu_register const & r); |
55 |
PRIVATE inline void FFPU get_source_flags(fpu_register const & r); |
56 |
|
57 |
PRIVATE inline void FFPU make_nan(fpu_register & r); |
58 |
PRIVATE inline void FFPU make_zero_positive(fpu_register & r); |
59 |
PRIVATE inline void FFPU make_zero_negative(fpu_register & r); |
60 |
PRIVATE inline void FFPU make_inf_positive(fpu_register & r); |
61 |
PRIVATE inline void FFPU make_inf_negative(fpu_register & r); |
62 |
|
63 |
PRIVATE inline void FFPU fast_scale(fpu_register & r, int add); |
64 |
PRIVATE inline fpu_register FFPU fast_fgetexp(fpu_register const & r); |
65 |
|
66 |
// May be optimized for particular processors |
67 |
#ifndef FPU_USE_NATIVE_FLAGS |
68 |
PRIVATE inline void FFPU make_fpsr(fpu_register const & r); |
69 |
#endif |
70 |
|
71 |
// Normalize to range 1..2 |
72 |
PRIVATE inline void FFPU fast_remove_exponent(fpu_register & r); |
73 |
|
74 |
// The sign of the quotient is the exclusive-OR of the sign bits |
75 |
// of the source and destination operands. |
76 |
PRIVATE inline uae_u32 FFPU get_quotient_sign( |
77 |
fpu_register const & ra, fpu_register const & rb |
78 |
); |
79 |
|
80 |
// Quotient Byte is loaded with the sign and least significant |
81 |
// seven bits of the quotient. |
82 |
PRIVATE inline void FFPU make_quotient( |
83 |
fpu_register const & quotient, uae_u32 sign |
84 |
); |
85 |
|
86 |
// to_single |
87 |
PRIVATE inline fpu_register FFPU make_single( |
88 |
uae_u32 value |
89 |
); |
90 |
|
91 |
// from_single |
92 |
PRIVATE inline uae_u32 FFPU extract_single( |
93 |
fpu_register const & src |
94 |
); |
95 |
|
96 |
// to_exten |
97 |
PRIVATE inline fpu_register FFPU make_extended( |
98 |
uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3 |
99 |
); |
100 |
|
101 |
/* |
102 |
Would be so much easier with full size floats :( |
103 |
... this is so vague. |
104 |
*/ |
105 |
// to_exten_no_normalize |
106 |
PRIVATE inline void FFPU make_extended_no_normalize( |
107 |
uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3, fpu_register & result |
108 |
); |
109 |
|
110 |
// from_exten |
111 |
PRIVATE inline void FFPU extract_extended(fpu_register const & src, |
112 |
uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3 |
113 |
); |
114 |
|
115 |
// to_double |
116 |
PRIVATE inline fpu_register FFPU make_double( |
117 |
uae_u32 wrd1, uae_u32 wrd2 |
118 |
); |
119 |
|
120 |
// from_double |
121 |
PRIVATE inline void FFPU extract_double(fpu_register const & src, |
122 |
uae_u32 * wrd1, uae_u32 * wrd2 |
123 |
); |
124 |
|
125 |
PRIVATE inline fpu_register FFPU make_packed( |
126 |
uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3 |
127 |
); |
128 |
|
129 |
PRIVATE inline void FFPU extract_packed( |
130 |
fpu_register const & src, uae_u32 * wrd1, uae_u32 * wrd2, uae_u32 * wrd3 |
131 |
); |
132 |
|
133 |
PRIVATE inline int FFPU get_fp_value( |
134 |
uae_u32 opcode, uae_u16 extra, fpu_register & src |
135 |
); |
136 |
|
137 |
PRIVATE inline int FFPU put_fp_value( |
138 |
uae_u32 opcode, uae_u16 extra, fpu_register const & value |
139 |
); |
140 |
|
141 |
PRIVATE inline int FFPU get_fp_ad( |
142 |
uae_u32 opcode, uae_u32 * ad |
143 |
); |
144 |
|
145 |
PRIVATE inline int FFPU fpp_cond( |
146 |
int condition |
147 |
); |
148 |
|
149 |
#endif /* FPU_IEEE_H */ |