Revision c31da136 target-i386/exec.h

b/target-i386/exec.h
98 98

  
99 99
#endif /* !defined(CONFIG_USER_ONLY) */
100 100

  
101
#ifdef USE_X86LDOUBLE
102
/* use long double functions */
103
#define floatx_to_int32 floatx80_to_int32
104
#define floatx_to_int64 floatx80_to_int64
105
#define floatx_to_int32_round_to_zero floatx80_to_int32_round_to_zero
106
#define floatx_to_int64_round_to_zero floatx80_to_int64_round_to_zero
107
#define int32_to_floatx int32_to_floatx80
108
#define int64_to_floatx int64_to_floatx80
109
#define float32_to_floatx float32_to_floatx80
110
#define float64_to_floatx float64_to_floatx80
111
#define floatx_to_float32 floatx80_to_float32
112
#define floatx_to_float64 floatx80_to_float64
113
#define floatx_add floatx80_add
114
#define floatx_div floatx80_div
115
#define floatx_mul floatx80_mul
116
#define floatx_sub floatx80_sub
117
#define floatx_sqrt floatx80_sqrt
118
#define floatx_abs floatx80_abs
119
#define floatx_chs floatx80_chs
120
#define floatx_scalbn floatx80_scalbn
121
#define floatx_round_to_int floatx80_round_to_int
122
#define floatx_compare floatx80_compare
123
#define floatx_compare_quiet floatx80_compare_quiet
124
#define floatx_is_any_nan floatx80_is_any_nan
125
#define floatx_is_neg floatx80_is_neg
126
#define floatx_is_zero floatx80_is_zero
127
#define floatx_zero floatx80_zero
128
#define floatx_one floatx80_one
129
#define floatx_ln2 floatx80_ln2
130
#define floatx_pi floatx80_pi
131
#else
132
#define floatx_to_int32 float64_to_int32
133
#define floatx_to_int64 float64_to_int64
134
#define floatx_to_int32_round_to_zero float64_to_int32_round_to_zero
135
#define floatx_to_int64_round_to_zero float64_to_int64_round_to_zero
136
#define int32_to_floatx int32_to_float64
137
#define int64_to_floatx int64_to_float64
138
#define float32_to_floatx float32_to_float64
139
#define float64_to_floatx(x, e) (x)
140
#define floatx_to_float32 float64_to_float32
141
#define floatx_to_float64(x, e) (x)
142
#define floatx_add float64_add
143
#define floatx_div float64_div
144
#define floatx_mul float64_mul
145
#define floatx_sub float64_sub
146
#define floatx_sqrt float64_sqrt
147
#define floatx_abs float64_abs
148
#define floatx_chs float64_chs
149
#define floatx_scalbn float64_scalbn
150
#define floatx_round_to_int float64_round_to_int
151
#define floatx_compare float64_compare
152
#define floatx_compare_quiet float64_compare_quiet
153
#define floatx_is_any_nan float64_is_any_nan
154
#define floatx_is_neg float64_is_neg
155
#define floatx_is_zero float64_is_zero
156
#define floatx_zero float64_zero
157
#define floatx_one float64_one
158
#define floatx_ln2 float64_ln2
159
#define floatx_pi float64_pi
160
#endif
161

  
162 101
#define RC_MASK         0xc00
163 102
#define RC_NEAR		0x000
164 103
#define RC_DOWN		0x400
......
167 106

  
168 107
#define MAXTAN 9223372036854775808.0
169 108

  
170
#ifdef USE_X86LDOUBLE
171

  
172
/* only for x86 */
173
typedef CPU_LDoubleU CPU86_LDoubleU;
174

  
175 109
/* the following deal with x86 long double-precision numbers */
176 110
#define MAXEXPD 0x7fff
177 111
#define EXPBIAS 16383
......
180 114
#define MANTD(fp)       (fp.l.lower)
181 115
#define BIASEXPONENT(fp) fp.l.upper = (fp.l.upper & ~(0x7fff)) | EXPBIAS
182 116

  
183
#else
184

  
185
typedef CPU_DoubleU CPU86_LDoubleU;
186

  
187
/* the following deal with IEEE double-precision numbers */
188
#define MAXEXPD 0x7ff
189
#define EXPBIAS 1023
190
#define EXPD(fp)	(((fp.l.upper) >> 20) & 0x7FF)
191
#define SIGND(fp)	((fp.l.upper) & 0x80000000)
192
#ifdef __arm__
193
#define MANTD(fp)	(fp.l.lower | ((uint64_t)(fp.l.upper & ((1 << 20) - 1)) << 32))
194
#else
195
#define MANTD(fp)	(fp.ll & ((1LL << 52) - 1))
196
#endif
197
#define BIASEXPONENT(fp) fp.l.upper = (fp.l.upper & ~(0x7ff << 20)) | (EXPBIAS << 20)
198
#endif
199

  
200 117
static inline void fpush(void)
201 118
{
202 119
    env->fpstt = (env->fpstt - 1) & 7;
......
209 126
    env->fpstt = (env->fpstt + 1) & 7;
210 127
}
211 128

  
212
#ifndef USE_X86LDOUBLE
213
static inline CPU86_LDouble helper_fldt(target_ulong ptr)
214
{
215
    CPU86_LDoubleU temp;
216
    int upper, e;
217
    uint64_t ll;
218

  
219
    /* mantissa */
220
    upper = lduw(ptr + 8);
221
    /* XXX: handle overflow ? */
222
    e = (upper & 0x7fff) - 16383 + EXPBIAS; /* exponent */
223
    e |= (upper >> 4) & 0x800; /* sign */
224
    ll = (ldq(ptr) >> 11) & ((1LL << 52) - 1);
225
#ifdef __arm__
226
    temp.l.upper = (e << 20) | (ll >> 32);
227
    temp.l.lower = ll;
228
#else
229
    temp.ll = ll | ((uint64_t)e << 52);
230
#endif
231
    return temp.d;
232
}
233

  
234
static inline void helper_fstt(CPU86_LDouble f, target_ulong ptr)
129
static inline floatx80 helper_fldt(target_ulong ptr)
235 130
{
236
    CPU86_LDoubleU temp;
237
    int e;
238

  
239
    temp.d = f;
240
    /* mantissa */
241
    stq(ptr, (MANTD(temp) << 11) | (1LL << 63));
242
    /* exponent + sign */
243
    e = EXPD(temp) - EXPBIAS + 16383;
244
    e |= SIGND(temp) >> 16;
245
    stw(ptr + 8, e);
246
}
247
#else
248

  
249
/* we use memory access macros */
250

  
251
static inline CPU86_LDouble helper_fldt(target_ulong ptr)
252
{
253
    CPU86_LDoubleU temp;
131
    CPU_LDoubleU temp;
254 132

  
255 133
    temp.l.lower = ldq(ptr);
256 134
    temp.l.upper = lduw(ptr + 8);
257 135
    return temp.d;
258 136
}
259 137

  
260
static inline void helper_fstt(CPU86_LDouble f, target_ulong ptr)
138
static inline void helper_fstt(floatx80 f, target_ulong ptr)
261 139
{
262
    CPU86_LDoubleU temp;
140
    CPU_LDoubleU temp;
263 141

  
264 142
    temp.d = f;
265 143
    stq(ptr, temp.l.lower);
266 144
    stw(ptr + 8, temp.l.upper);
267 145
}
268 146

  
269
#endif /* USE_X86LDOUBLE */
270

  
271 147
#define FPUS_IE (1 << 0)
272 148
#define FPUS_DE (1 << 1)
273 149
#define FPUS_ZE (1 << 2)

Also available in: Unified diff