root / target-mips / op_helper.c @ 5fafdf24
History | View | Annotate | Download (43 kB)
1 | 6af0bf9c | bellard | /*
|
---|---|---|---|
2 | 6af0bf9c | bellard | * MIPS emulation helpers for qemu.
|
3 | 5fafdf24 | ths | *
|
4 | 6af0bf9c | bellard | * Copyright (c) 2004-2005 Jocelyn Mayer
|
5 | 6af0bf9c | bellard | *
|
6 | 6af0bf9c | bellard | * This library is free software; you can redistribute it and/or
|
7 | 6af0bf9c | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | 6af0bf9c | bellard | * License as published by the Free Software Foundation; either
|
9 | 6af0bf9c | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | 6af0bf9c | bellard | *
|
11 | 6af0bf9c | bellard | * This library is distributed in the hope that it will be useful,
|
12 | 6af0bf9c | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 6af0bf9c | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 6af0bf9c | bellard | * Lesser General Public License for more details.
|
15 | 6af0bf9c | bellard | *
|
16 | 6af0bf9c | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | 6af0bf9c | bellard | * License along with this library; if not, write to the Free Software
|
18 | 6af0bf9c | bellard | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | 6af0bf9c | bellard | */
|
20 | 2d0e944d | ths | #include <stdlib.h> |
21 | 6af0bf9c | bellard | #include "exec.h" |
22 | 6af0bf9c | bellard | |
23 | 4ad40f36 | bellard | #define GETPC() (__builtin_return_address(0)) |
24 | 4ad40f36 | bellard | |
25 | 6af0bf9c | bellard | /*****************************************************************************/
|
26 | 6af0bf9c | bellard | /* Exceptions processing helpers */
|
27 | 6af0bf9c | bellard | |
28 | 6af0bf9c | bellard | void do_raise_exception_err (uint32_t exception, int error_code) |
29 | 6af0bf9c | bellard | { |
30 | 6af0bf9c | bellard | #if 1 |
31 | 6af0bf9c | bellard | if (logfile && exception < 0x100) |
32 | 6af0bf9c | bellard | fprintf(logfile, "%s: %d %d\n", __func__, exception, error_code);
|
33 | 6af0bf9c | bellard | #endif
|
34 | 6af0bf9c | bellard | env->exception_index = exception; |
35 | 6af0bf9c | bellard | env->error_code = error_code; |
36 | 6af0bf9c | bellard | T0 = 0;
|
37 | 6af0bf9c | bellard | cpu_loop_exit(); |
38 | 6af0bf9c | bellard | } |
39 | 6af0bf9c | bellard | |
40 | 6af0bf9c | bellard | void do_raise_exception (uint32_t exception)
|
41 | 6af0bf9c | bellard | { |
42 | 6af0bf9c | bellard | do_raise_exception_err(exception, 0);
|
43 | 6af0bf9c | bellard | } |
44 | 6af0bf9c | bellard | |
45 | 4ad40f36 | bellard | void do_restore_state (void *pc_ptr) |
46 | 4ad40f36 | bellard | { |
47 | 4ad40f36 | bellard | TranslationBlock *tb; |
48 | 4ad40f36 | bellard | unsigned long pc = (unsigned long) pc_ptr; |
49 | 4ad40f36 | bellard | |
50 | 4ad40f36 | bellard | tb = tb_find_pc (pc); |
51 | 4ad40f36 | bellard | cpu_restore_state (tb, env, pc, NULL);
|
52 | 4ad40f36 | bellard | } |
53 | 4ad40f36 | bellard | |
54 | e397ee33 | ths | void do_raise_exception_direct_err (uint32_t exception, int error_code) |
55 | 4ad40f36 | bellard | { |
56 | 4ad40f36 | bellard | do_restore_state (GETPC ()); |
57 | e397ee33 | ths | do_raise_exception_err (exception, error_code); |
58 | e397ee33 | ths | } |
59 | e397ee33 | ths | |
60 | e397ee33 | ths | void do_raise_exception_direct (uint32_t exception)
|
61 | e397ee33 | ths | { |
62 | e397ee33 | ths | do_raise_exception_direct_err (exception, 0);
|
63 | 4ad40f36 | bellard | } |
64 | 4ad40f36 | bellard | |
65 | 6af0bf9c | bellard | #define MEMSUFFIX _raw
|
66 | 6af0bf9c | bellard | #include "op_helper_mem.c" |
67 | 6af0bf9c | bellard | #undef MEMSUFFIX
|
68 | 6af0bf9c | bellard | #if !defined(CONFIG_USER_ONLY)
|
69 | 6af0bf9c | bellard | #define MEMSUFFIX _user
|
70 | 6af0bf9c | bellard | #include "op_helper_mem.c" |
71 | 6af0bf9c | bellard | #undef MEMSUFFIX
|
72 | 6af0bf9c | bellard | #define MEMSUFFIX _kernel
|
73 | 6af0bf9c | bellard | #include "op_helper_mem.c" |
74 | 6af0bf9c | bellard | #undef MEMSUFFIX
|
75 | 6af0bf9c | bellard | #endif
|
76 | 6af0bf9c | bellard | |
77 | 60aa19ab | ths | #ifdef TARGET_MIPS64
|
78 | c570fd16 | ths | #if TARGET_LONG_BITS > HOST_LONG_BITS
|
79 | c570fd16 | ths | /* Those might call libgcc functions. */
|
80 | c570fd16 | ths | void do_dsll (void) |
81 | c570fd16 | ths | { |
82 | c570fd16 | ths | T0 = T0 << T1; |
83 | c570fd16 | ths | } |
84 | c570fd16 | ths | |
85 | c570fd16 | ths | void do_dsll32 (void) |
86 | c570fd16 | ths | { |
87 | c570fd16 | ths | T0 = T0 << (T1 + 32);
|
88 | c570fd16 | ths | } |
89 | c570fd16 | ths | |
90 | c570fd16 | ths | void do_dsra (void) |
91 | c570fd16 | ths | { |
92 | c570fd16 | ths | T0 = (int64_t)T0 >> T1; |
93 | c570fd16 | ths | } |
94 | c570fd16 | ths | |
95 | c570fd16 | ths | void do_dsra32 (void) |
96 | c570fd16 | ths | { |
97 | c570fd16 | ths | T0 = (int64_t)T0 >> (T1 + 32);
|
98 | c570fd16 | ths | } |
99 | c570fd16 | ths | |
100 | c570fd16 | ths | void do_dsrl (void) |
101 | c570fd16 | ths | { |
102 | c570fd16 | ths | T0 = T0 >> T1; |
103 | c570fd16 | ths | } |
104 | c570fd16 | ths | |
105 | c570fd16 | ths | void do_dsrl32 (void) |
106 | c570fd16 | ths | { |
107 | c570fd16 | ths | T0 = T0 >> (T1 + 32);
|
108 | c570fd16 | ths | } |
109 | c570fd16 | ths | |
110 | c570fd16 | ths | void do_drotr (void) |
111 | c570fd16 | ths | { |
112 | c570fd16 | ths | target_ulong tmp; |
113 | c570fd16 | ths | |
114 | c570fd16 | ths | if (T1) {
|
115 | c570fd16 | ths | tmp = T0 << (0x40 - T1);
|
116 | c570fd16 | ths | T0 = (T0 >> T1) | tmp; |
117 | 5a63bcb2 | ths | } |
118 | c570fd16 | ths | } |
119 | c570fd16 | ths | |
120 | c570fd16 | ths | void do_drotr32 (void) |
121 | c570fd16 | ths | { |
122 | c570fd16 | ths | target_ulong tmp; |
123 | c570fd16 | ths | |
124 | c570fd16 | ths | if (T1) {
|
125 | c570fd16 | ths | tmp = T0 << (0x40 - (32 + T1)); |
126 | c570fd16 | ths | T0 = (T0 >> (32 + T1)) | tmp;
|
127 | 5a63bcb2 | ths | } |
128 | c570fd16 | ths | } |
129 | c570fd16 | ths | |
130 | c570fd16 | ths | void do_dsllv (void) |
131 | c570fd16 | ths | { |
132 | c570fd16 | ths | T0 = T1 << (T0 & 0x3F);
|
133 | c570fd16 | ths | } |
134 | c570fd16 | ths | |
135 | c570fd16 | ths | void do_dsrav (void) |
136 | c570fd16 | ths | { |
137 | c570fd16 | ths | T0 = (int64_t)T1 >> (T0 & 0x3F);
|
138 | c570fd16 | ths | } |
139 | c570fd16 | ths | |
140 | c570fd16 | ths | void do_dsrlv (void) |
141 | c570fd16 | ths | { |
142 | c570fd16 | ths | T0 = T1 >> (T0 & 0x3F);
|
143 | c570fd16 | ths | } |
144 | c570fd16 | ths | |
145 | c570fd16 | ths | void do_drotrv (void) |
146 | c570fd16 | ths | { |
147 | c570fd16 | ths | target_ulong tmp; |
148 | c570fd16 | ths | |
149 | c570fd16 | ths | T0 &= 0x3F;
|
150 | c570fd16 | ths | if (T0) {
|
151 | c570fd16 | ths | tmp = T1 << (0x40 - T0);
|
152 | c570fd16 | ths | T0 = (T1 >> T0) | tmp; |
153 | c570fd16 | ths | } else
|
154 | c570fd16 | ths | T0 = T1; |
155 | c570fd16 | ths | } |
156 | c570fd16 | ths | #endif /* TARGET_LONG_BITS > HOST_LONG_BITS */ |
157 | 60aa19ab | ths | #endif /* TARGET_MIPS64 */ |
158 | c570fd16 | ths | |
159 | 6af0bf9c | bellard | /* 64 bits arithmetic for 32 bits hosts */
|
160 | c570fd16 | ths | #if TARGET_LONG_BITS > HOST_LONG_BITS
|
161 | 6af0bf9c | bellard | static inline uint64_t get_HILO (void) |
162 | 6af0bf9c | bellard | { |
163 | ead9360e | ths | return (env->HI[0][env->current_tc] << 32) | (uint32_t)env->LO[0][env->current_tc]; |
164 | 6af0bf9c | bellard | } |
165 | 6af0bf9c | bellard | |
166 | 6af0bf9c | bellard | static inline void set_HILO (uint64_t HILO) |
167 | 6af0bf9c | bellard | { |
168 | ead9360e | ths | env->LO[0][env->current_tc] = (int32_t)HILO;
|
169 | ead9360e | ths | env->HI[0][env->current_tc] = (int32_t)(HILO >> 32); |
170 | 6af0bf9c | bellard | } |
171 | 6af0bf9c | bellard | |
172 | 6af0bf9c | bellard | void do_mult (void) |
173 | 6af0bf9c | bellard | { |
174 | 4ad40f36 | bellard | set_HILO((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1); |
175 | 6af0bf9c | bellard | } |
176 | 6af0bf9c | bellard | |
177 | 6af0bf9c | bellard | void do_multu (void) |
178 | 6af0bf9c | bellard | { |
179 | c570fd16 | ths | set_HILO((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1); |
180 | 6af0bf9c | bellard | } |
181 | 6af0bf9c | bellard | |
182 | 6af0bf9c | bellard | void do_madd (void) |
183 | 6af0bf9c | bellard | { |
184 | 6af0bf9c | bellard | int64_t tmp; |
185 | 6af0bf9c | bellard | |
186 | 4ad40f36 | bellard | tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1); |
187 | 6af0bf9c | bellard | set_HILO((int64_t)get_HILO() + tmp); |
188 | 6af0bf9c | bellard | } |
189 | 6af0bf9c | bellard | |
190 | 6af0bf9c | bellard | void do_maddu (void) |
191 | 6af0bf9c | bellard | { |
192 | 6af0bf9c | bellard | uint64_t tmp; |
193 | 6af0bf9c | bellard | |
194 | c570fd16 | ths | tmp = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1); |
195 | 6af0bf9c | bellard | set_HILO(get_HILO() + tmp); |
196 | 6af0bf9c | bellard | } |
197 | 6af0bf9c | bellard | |
198 | 6af0bf9c | bellard | void do_msub (void) |
199 | 6af0bf9c | bellard | { |
200 | 6af0bf9c | bellard | int64_t tmp; |
201 | 6af0bf9c | bellard | |
202 | 4ad40f36 | bellard | tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1); |
203 | 6af0bf9c | bellard | set_HILO((int64_t)get_HILO() - tmp); |
204 | 6af0bf9c | bellard | } |
205 | 6af0bf9c | bellard | |
206 | 6af0bf9c | bellard | void do_msubu (void) |
207 | 6af0bf9c | bellard | { |
208 | 6af0bf9c | bellard | uint64_t tmp; |
209 | 6af0bf9c | bellard | |
210 | c570fd16 | ths | tmp = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1); |
211 | 6af0bf9c | bellard | set_HILO(get_HILO() - tmp); |
212 | 6af0bf9c | bellard | } |
213 | 6af0bf9c | bellard | #endif
|
214 | 6af0bf9c | bellard | |
215 | 80c27194 | ths | #if HOST_LONG_BITS < 64 |
216 | 80c27194 | ths | void do_div (void) |
217 | 80c27194 | ths | { |
218 | 80c27194 | ths | /* 64bit datatypes because we may see overflow/underflow. */
|
219 | 80c27194 | ths | if (T1 != 0) { |
220 | ead9360e | ths | env->LO[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 / (int32_t)T1);
|
221 | ead9360e | ths | env->HI[0][env->current_tc] = (int32_t)((int64_t)(int32_t)T0 % (int32_t)T1);
|
222 | 80c27194 | ths | } |
223 | 80c27194 | ths | } |
224 | 80c27194 | ths | #endif
|
225 | 80c27194 | ths | |
226 | 60aa19ab | ths | #ifdef TARGET_MIPS64
|
227 | c570fd16 | ths | void do_ddiv (void) |
228 | c570fd16 | ths | { |
229 | c570fd16 | ths | if (T1 != 0) { |
230 | 2d0e944d | ths | lldiv_t res = lldiv((int64_t)T0, (int64_t)T1); |
231 | ead9360e | ths | env->LO[0][env->current_tc] = res.quot;
|
232 | ead9360e | ths | env->HI[0][env->current_tc] = res.rem;
|
233 | c570fd16 | ths | } |
234 | c570fd16 | ths | } |
235 | c570fd16 | ths | |
236 | 12a4b2aa | ths | #if TARGET_LONG_BITS > HOST_LONG_BITS
|
237 | c570fd16 | ths | void do_ddivu (void) |
238 | c570fd16 | ths | { |
239 | c570fd16 | ths | if (T1 != 0) { |
240 | ead9360e | ths | env->LO[0][env->current_tc] = T0 / T1;
|
241 | ead9360e | ths | env->HI[0][env->current_tc] = T0 % T1;
|
242 | c570fd16 | ths | } |
243 | c570fd16 | ths | } |
244 | c570fd16 | ths | #endif
|
245 | 12a4b2aa | ths | #endif /* TARGET_MIPS64 */ |
246 | c570fd16 | ths | |
247 | 5fafdf24 | ths | #if defined(CONFIG_USER_ONLY)
|
248 | 873eb012 | ths | void do_mfc0_random (void) |
249 | 048f6b4d | bellard | { |
250 | 873eb012 | ths | cpu_abort(env, "mfc0 random\n");
|
251 | 048f6b4d | bellard | } |
252 | 873eb012 | ths | |
253 | 873eb012 | ths | void do_mfc0_count (void) |
254 | 873eb012 | ths | { |
255 | 873eb012 | ths | cpu_abort(env, "mfc0 count\n");
|
256 | 873eb012 | ths | } |
257 | 873eb012 | ths | |
258 | 8c0fdd85 | ths | void cpu_mips_store_count(CPUState *env, uint32_t value)
|
259 | 048f6b4d | bellard | { |
260 | 8c0fdd85 | ths | cpu_abort(env, "mtc0 count\n");
|
261 | 8c0fdd85 | ths | } |
262 | 8c0fdd85 | ths | |
263 | 8c0fdd85 | ths | void cpu_mips_store_compare(CPUState *env, uint32_t value)
|
264 | 8c0fdd85 | ths | { |
265 | 8c0fdd85 | ths | cpu_abort(env, "mtc0 compare\n");
|
266 | 8c0fdd85 | ths | } |
267 | 8c0fdd85 | ths | |
268 | 4de9b249 | ths | void cpu_mips_update_irq(CPUState *env)
|
269 | 4de9b249 | ths | { |
270 | 4de9b249 | ths | cpu_abort(env, "mtc0 status / mtc0 cause\n");
|
271 | 4de9b249 | ths | } |
272 | 4de9b249 | ths | |
273 | 8c0fdd85 | ths | void do_mtc0_status_debug(uint32_t old, uint32_t val)
|
274 | 8c0fdd85 | ths | { |
275 | 7a387fff | ths | cpu_abort(env, "mtc0 status debug\n");
|
276 | 8c0fdd85 | ths | } |
277 | 8c0fdd85 | ths | |
278 | 7a387fff | ths | void do_mtc0_status_irqraise_debug (void) |
279 | 8c0fdd85 | ths | { |
280 | 7a387fff | ths | cpu_abort(env, "mtc0 status irqraise debug\n");
|
281 | 048f6b4d | bellard | } |
282 | 048f6b4d | bellard | |
283 | 8c0fdd85 | ths | void cpu_mips_tlb_flush (CPUState *env, int flush_global) |
284 | 8c0fdd85 | ths | { |
285 | 8c0fdd85 | ths | cpu_abort(env, "mips_tlb_flush\n");
|
286 | 8c0fdd85 | ths | } |
287 | 8c0fdd85 | ths | |
288 | 048f6b4d | bellard | #else
|
289 | 048f6b4d | bellard | |
290 | 6af0bf9c | bellard | /* CP0 helpers */
|
291 | 873eb012 | ths | void do_mfc0_random (void) |
292 | 6af0bf9c | bellard | { |
293 | 5dc4b744 | ths | T0 = (int32_t)cpu_mips_get_random(env); |
294 | 873eb012 | ths | } |
295 | 6af0bf9c | bellard | |
296 | 873eb012 | ths | void do_mfc0_count (void) |
297 | 873eb012 | ths | { |
298 | 5dc4b744 | ths | T0 = (int32_t)cpu_mips_get_count(env); |
299 | 6af0bf9c | bellard | } |
300 | 6af0bf9c | bellard | |
301 | 8c0fdd85 | ths | void do_mtc0_status_debug(uint32_t old, uint32_t val)
|
302 | 6af0bf9c | bellard | { |
303 | f41c52f1 | ths | fprintf(logfile, "Status %08x (%08x) => %08x (%08x) Cause %08x",
|
304 | f41c52f1 | ths | old, old & env->CP0_Cause & CP0Ca_IP_mask, |
305 | f41c52f1 | ths | val, val & env->CP0_Cause & CP0Ca_IP_mask, |
306 | f41c52f1 | ths | env->CP0_Cause); |
307 | f41c52f1 | ths | (env->hflags & MIPS_HFLAG_UM) ? fputs(", UM\n", logfile)
|
308 | f41c52f1 | ths | : fputs("\n", logfile);
|
309 | 8c0fdd85 | ths | } |
310 | 8c0fdd85 | ths | |
311 | 8c0fdd85 | ths | void do_mtc0_status_irqraise_debug(void) |
312 | 8c0fdd85 | ths | { |
313 | 8c0fdd85 | ths | fprintf(logfile, "Raise pending IRQs\n");
|
314 | 6af0bf9c | bellard | } |
315 | 6af0bf9c | bellard | |
316 | 6ea83fed | bellard | void fpu_handle_exception(void) |
317 | 6ea83fed | bellard | { |
318 | 6ea83fed | bellard | #ifdef CONFIG_SOFTFLOAT
|
319 | ead9360e | ths | int flags = get_float_exception_flags(&env->fpu->fp_status);
|
320 | 6ea83fed | bellard | unsigned int cpuflags = 0, enable, cause = 0; |
321 | 6ea83fed | bellard | |
322 | ead9360e | ths | enable = GET_FP_ENABLE(env->fpu->fcr31); |
323 | 6ea83fed | bellard | |
324 | 5fafdf24 | ths | /* determine current flags */
|
325 | 6ea83fed | bellard | if (flags & float_flag_invalid) {
|
326 | 6ea83fed | bellard | cpuflags |= FP_INVALID; |
327 | 6ea83fed | bellard | cause |= FP_INVALID & enable; |
328 | 6ea83fed | bellard | } |
329 | 6ea83fed | bellard | if (flags & float_flag_divbyzero) {
|
330 | 5fafdf24 | ths | cpuflags |= FP_DIV0; |
331 | 6ea83fed | bellard | cause |= FP_DIV0 & enable; |
332 | 6ea83fed | bellard | } |
333 | 6ea83fed | bellard | if (flags & float_flag_overflow) {
|
334 | 5fafdf24 | ths | cpuflags |= FP_OVERFLOW; |
335 | 6ea83fed | bellard | cause |= FP_OVERFLOW & enable; |
336 | 6ea83fed | bellard | } |
337 | 6ea83fed | bellard | if (flags & float_flag_underflow) {
|
338 | 5fafdf24 | ths | cpuflags |= FP_UNDERFLOW; |
339 | 6ea83fed | bellard | cause |= FP_UNDERFLOW & enable; |
340 | 6ea83fed | bellard | } |
341 | 6ea83fed | bellard | if (flags & float_flag_inexact) {
|
342 | 5fafdf24 | ths | cpuflags |= FP_INEXACT; |
343 | 6ea83fed | bellard | cause |= FP_INEXACT & enable; |
344 | 6ea83fed | bellard | } |
345 | ead9360e | ths | SET_FP_FLAGS(env->fpu->fcr31, cpuflags); |
346 | ead9360e | ths | SET_FP_CAUSE(env->fpu->fcr31, cause); |
347 | 6ea83fed | bellard | #else
|
348 | ead9360e | ths | SET_FP_FLAGS(env->fpu->fcr31, 0);
|
349 | ead9360e | ths | SET_FP_CAUSE(env->fpu->fcr31, 0);
|
350 | 6ea83fed | bellard | #endif
|
351 | 6ea83fed | bellard | } |
352 | 6ea83fed | bellard | |
353 | 6af0bf9c | bellard | /* TLB management */
|
354 | 814b9a47 | ths | void cpu_mips_tlb_flush (CPUState *env, int flush_global) |
355 | 814b9a47 | ths | { |
356 | 814b9a47 | ths | /* Flush qemu's TLB and discard all shadowed entries. */
|
357 | 814b9a47 | ths | tlb_flush (env, flush_global); |
358 | ead9360e | ths | env->tlb->tlb_in_use = env->tlb->nb_tlb; |
359 | 814b9a47 | ths | } |
360 | 814b9a47 | ths | |
361 | 29929e34 | ths | static void r4k_mips_tlb_flush_extra (CPUState *env, int first) |
362 | 814b9a47 | ths | { |
363 | 814b9a47 | ths | /* Discard entries from env->tlb[first] onwards. */
|
364 | ead9360e | ths | while (env->tlb->tlb_in_use > first) {
|
365 | ead9360e | ths | r4k_invalidate_tlb(env, --env->tlb->tlb_in_use, 0);
|
366 | 814b9a47 | ths | } |
367 | 814b9a47 | ths | } |
368 | 814b9a47 | ths | |
369 | 29929e34 | ths | static void r4k_fill_tlb (int idx) |
370 | 6af0bf9c | bellard | { |
371 | 29929e34 | ths | r4k_tlb_t *tlb; |
372 | 6af0bf9c | bellard | |
373 | 6af0bf9c | bellard | /* XXX: detect conflicting TLBs and raise a MCHECK exception when needed */
|
374 | ead9360e | ths | tlb = &env->tlb->mmu.r4k.tlb[idx]; |
375 | f2e9ebef | ths | tlb->VPN = env->CP0_EntryHi & (TARGET_PAGE_MASK << 1);
|
376 | 100ce988 | ths | #ifdef TARGET_MIPS64
|
377 | e034e2c3 | ths | tlb->VPN &= env->SEGMask; |
378 | 100ce988 | ths | #endif
|
379 | 98c1b82b | pbrook | tlb->ASID = env->CP0_EntryHi & 0xFF;
|
380 | 3b1c8be4 | ths | tlb->PageMask = env->CP0_PageMask; |
381 | 6af0bf9c | bellard | tlb->G = env->CP0_EntryLo0 & env->CP0_EntryLo1 & 1;
|
382 | 98c1b82b | pbrook | tlb->V0 = (env->CP0_EntryLo0 & 2) != 0; |
383 | 98c1b82b | pbrook | tlb->D0 = (env->CP0_EntryLo0 & 4) != 0; |
384 | 98c1b82b | pbrook | tlb->C0 = (env->CP0_EntryLo0 >> 3) & 0x7; |
385 | 6af0bf9c | bellard | tlb->PFN[0] = (env->CP0_EntryLo0 >> 6) << 12; |
386 | 98c1b82b | pbrook | tlb->V1 = (env->CP0_EntryLo1 & 2) != 0; |
387 | 98c1b82b | pbrook | tlb->D1 = (env->CP0_EntryLo1 & 4) != 0; |
388 | 98c1b82b | pbrook | tlb->C1 = (env->CP0_EntryLo1 >> 3) & 0x7; |
389 | 6af0bf9c | bellard | tlb->PFN[1] = (env->CP0_EntryLo1 >> 6) << 12; |
390 | 6af0bf9c | bellard | } |
391 | 6af0bf9c | bellard | |
392 | 29929e34 | ths | void r4k_do_tlbwi (void) |
393 | 6af0bf9c | bellard | { |
394 | 814b9a47 | ths | /* Discard cached TLB entries. We could avoid doing this if the
|
395 | 814b9a47 | ths | tlbwi is just upgrading access permissions on the current entry;
|
396 | 814b9a47 | ths | that might be a further win. */
|
397 | ead9360e | ths | r4k_mips_tlb_flush_extra (env, env->tlb->nb_tlb); |
398 | 814b9a47 | ths | |
399 | ead9360e | ths | r4k_invalidate_tlb(env, env->CP0_Index % env->tlb->nb_tlb, 0);
|
400 | ead9360e | ths | r4k_fill_tlb(env->CP0_Index % env->tlb->nb_tlb); |
401 | 6af0bf9c | bellard | } |
402 | 6af0bf9c | bellard | |
403 | 29929e34 | ths | void r4k_do_tlbwr (void) |
404 | 6af0bf9c | bellard | { |
405 | 6af0bf9c | bellard | int r = cpu_mips_get_random(env);
|
406 | 6af0bf9c | bellard | |
407 | 29929e34 | ths | r4k_invalidate_tlb(env, r, 1);
|
408 | 29929e34 | ths | r4k_fill_tlb(r); |
409 | 6af0bf9c | bellard | } |
410 | 6af0bf9c | bellard | |
411 | 29929e34 | ths | void r4k_do_tlbp (void) |
412 | 6af0bf9c | bellard | { |
413 | 29929e34 | ths | r4k_tlb_t *tlb; |
414 | f2e9ebef | ths | target_ulong mask; |
415 | 6af0bf9c | bellard | target_ulong tag; |
416 | f2e9ebef | ths | target_ulong VPN; |
417 | 6af0bf9c | bellard | uint8_t ASID; |
418 | 6af0bf9c | bellard | int i;
|
419 | 6af0bf9c | bellard | |
420 | 3d9fb9fe | bellard | ASID = env->CP0_EntryHi & 0xFF;
|
421 | ead9360e | ths | for (i = 0; i < env->tlb->nb_tlb; i++) { |
422 | ead9360e | ths | tlb = &env->tlb->mmu.r4k.tlb[i]; |
423 | f2e9ebef | ths | /* 1k pages are not supported. */
|
424 | f2e9ebef | ths | mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1);
|
425 | f2e9ebef | ths | tag = env->CP0_EntryHi & ~mask; |
426 | f2e9ebef | ths | VPN = tlb->VPN & ~mask; |
427 | 6af0bf9c | bellard | /* Check ASID, virtual page number & size */
|
428 | f2e9ebef | ths | if ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) { |
429 | 6af0bf9c | bellard | /* TLB match */
|
430 | 9c2149c8 | ths | env->CP0_Index = i; |
431 | 6af0bf9c | bellard | break;
|
432 | 6af0bf9c | bellard | } |
433 | 6af0bf9c | bellard | } |
434 | ead9360e | ths | if (i == env->tlb->nb_tlb) {
|
435 | 814b9a47 | ths | /* No match. Discard any shadow entries, if any of them match. */
|
436 | ead9360e | ths | for (i = env->tlb->nb_tlb; i < env->tlb->tlb_in_use; i++) {
|
437 | ead9360e | ths | tlb = &env->tlb->mmu.r4k.tlb[i]; |
438 | f2e9ebef | ths | /* 1k pages are not supported. */
|
439 | f2e9ebef | ths | mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1);
|
440 | f2e9ebef | ths | tag = env->CP0_EntryHi & ~mask; |
441 | f2e9ebef | ths | VPN = tlb->VPN & ~mask; |
442 | 814b9a47 | ths | /* Check ASID, virtual page number & size */
|
443 | f2e9ebef | ths | if ((tlb->G == 1 || tlb->ASID == ASID) && VPN == tag) { |
444 | 29929e34 | ths | r4k_mips_tlb_flush_extra (env, i); |
445 | 814b9a47 | ths | break;
|
446 | 814b9a47 | ths | } |
447 | 814b9a47 | ths | } |
448 | 814b9a47 | ths | |
449 | 9c2149c8 | ths | env->CP0_Index |= 0x80000000;
|
450 | 6af0bf9c | bellard | } |
451 | 6af0bf9c | bellard | } |
452 | 6af0bf9c | bellard | |
453 | 29929e34 | ths | void r4k_do_tlbr (void) |
454 | 6af0bf9c | bellard | { |
455 | 29929e34 | ths | r4k_tlb_t *tlb; |
456 | 09c56b84 | pbrook | uint8_t ASID; |
457 | 6af0bf9c | bellard | |
458 | 09c56b84 | pbrook | ASID = env->CP0_EntryHi & 0xFF;
|
459 | ead9360e | ths | tlb = &env->tlb->mmu.r4k.tlb[env->CP0_Index % env->tlb->nb_tlb]; |
460 | 4ad40f36 | bellard | |
461 | 4ad40f36 | bellard | /* If this will change the current ASID, flush qemu's TLB. */
|
462 | 814b9a47 | ths | if (ASID != tlb->ASID)
|
463 | 814b9a47 | ths | cpu_mips_tlb_flush (env, 1);
|
464 | 814b9a47 | ths | |
465 | ead9360e | ths | r4k_mips_tlb_flush_extra(env, env->tlb->nb_tlb); |
466 | 4ad40f36 | bellard | |
467 | 6af0bf9c | bellard | env->CP0_EntryHi = tlb->VPN | tlb->ASID; |
468 | 3b1c8be4 | ths | env->CP0_PageMask = tlb->PageMask; |
469 | 7495fd0f | ths | env->CP0_EntryLo0 = tlb->G | (tlb->V0 << 1) | (tlb->D0 << 2) | |
470 | 7495fd0f | ths | (tlb->C0 << 3) | (tlb->PFN[0] >> 6); |
471 | 7495fd0f | ths | env->CP0_EntryLo1 = tlb->G | (tlb->V1 << 1) | (tlb->D1 << 2) | |
472 | 7495fd0f | ths | (tlb->C1 << 3) | (tlb->PFN[1] >> 6); |
473 | 6af0bf9c | bellard | } |
474 | 6af0bf9c | bellard | |
475 | 048f6b4d | bellard | #endif /* !CONFIG_USER_ONLY */ |
476 | 048f6b4d | bellard | |
477 | c570fd16 | ths | void dump_ldst (const unsigned char *func) |
478 | 6af0bf9c | bellard | { |
479 | 6af0bf9c | bellard | if (loglevel)
|
480 | 3594c774 | ths | fprintf(logfile, "%s => " TARGET_FMT_lx " " TARGET_FMT_lx "\n", __func__, T0, T1); |
481 | 6af0bf9c | bellard | } |
482 | 6af0bf9c | bellard | |
483 | 6af0bf9c | bellard | void dump_sc (void) |
484 | 6af0bf9c | bellard | { |
485 | 6af0bf9c | bellard | if (loglevel) {
|
486 | 3594c774 | ths | fprintf(logfile, "%s " TARGET_FMT_lx " at " TARGET_FMT_lx " (" TARGET_FMT_lx ")\n", __func__, |
487 | 6af0bf9c | bellard | T1, T0, env->CP0_LLAddr); |
488 | 6af0bf9c | bellard | } |
489 | 6af0bf9c | bellard | } |
490 | 6af0bf9c | bellard | |
491 | f41c52f1 | ths | void debug_pre_eret (void) |
492 | 6af0bf9c | bellard | { |
493 | f41c52f1 | ths | fprintf(logfile, "ERET: PC " TARGET_FMT_lx " EPC " TARGET_FMT_lx, |
494 | ead9360e | ths | env->PC[env->current_tc], env->CP0_EPC); |
495 | f41c52f1 | ths | if (env->CP0_Status & (1 << CP0St_ERL)) |
496 | f41c52f1 | ths | fprintf(logfile, " ErrorEPC " TARGET_FMT_lx, env->CP0_ErrorEPC);
|
497 | f41c52f1 | ths | if (env->hflags & MIPS_HFLAG_DM)
|
498 | f41c52f1 | ths | fprintf(logfile, " DEPC " TARGET_FMT_lx, env->CP0_DEPC);
|
499 | f41c52f1 | ths | fputs("\n", logfile);
|
500 | f41c52f1 | ths | } |
501 | f41c52f1 | ths | |
502 | f41c52f1 | ths | void debug_post_eret (void) |
503 | f41c52f1 | ths | { |
504 | 744e0915 | ths | fprintf(logfile, " => PC " TARGET_FMT_lx " EPC " TARGET_FMT_lx, |
505 | ead9360e | ths | env->PC[env->current_tc], env->CP0_EPC); |
506 | f41c52f1 | ths | if (env->CP0_Status & (1 << CP0St_ERL)) |
507 | f41c52f1 | ths | fprintf(logfile, " ErrorEPC " TARGET_FMT_lx, env->CP0_ErrorEPC);
|
508 | f41c52f1 | ths | if (env->hflags & MIPS_HFLAG_DM)
|
509 | f41c52f1 | ths | fprintf(logfile, " DEPC " TARGET_FMT_lx, env->CP0_DEPC);
|
510 | f41c52f1 | ths | if (env->hflags & MIPS_HFLAG_UM)
|
511 | f41c52f1 | ths | fputs(", UM\n", logfile);
|
512 | f41c52f1 | ths | else
|
513 | 24c7b0e3 | ths | fputs("\n", logfile);
|
514 | 6af0bf9c | bellard | } |
515 | 6af0bf9c | bellard | |
516 | 6af0bf9c | bellard | void do_pmon (int function) |
517 | 6af0bf9c | bellard | { |
518 | 6af0bf9c | bellard | function /= 2;
|
519 | 6af0bf9c | bellard | switch (function) {
|
520 | 6af0bf9c | bellard | case 2: /* TODO: char inbyte(int waitflag); */ |
521 | ead9360e | ths | if (env->gpr[4][env->current_tc] == 0) |
522 | ead9360e | ths | env->gpr[2][env->current_tc] = -1; |
523 | 6af0bf9c | bellard | /* Fall through */
|
524 | 6af0bf9c | bellard | case 11: /* TODO: char inbyte (void); */ |
525 | ead9360e | ths | env->gpr[2][env->current_tc] = -1; |
526 | 6af0bf9c | bellard | break;
|
527 | 6af0bf9c | bellard | case 3: |
528 | 6af0bf9c | bellard | case 12: |
529 | ead9360e | ths | printf("%c", (char)(env->gpr[4][env->current_tc] & 0xFF)); |
530 | 6af0bf9c | bellard | break;
|
531 | 6af0bf9c | bellard | case 17: |
532 | 6af0bf9c | bellard | break;
|
533 | 6af0bf9c | bellard | case 158: |
534 | 6af0bf9c | bellard | { |
535 | ead9360e | ths | unsigned char *fmt = (void *)(unsigned long)env->gpr[4][env->current_tc]; |
536 | 6af0bf9c | bellard | printf("%s", fmt);
|
537 | 6af0bf9c | bellard | } |
538 | 6af0bf9c | bellard | break;
|
539 | 6af0bf9c | bellard | } |
540 | 6af0bf9c | bellard | } |
541 | e37e863f | bellard | |
542 | 5fafdf24 | ths | #if !defined(CONFIG_USER_ONLY)
|
543 | e37e863f | bellard | |
544 | 4ad40f36 | bellard | static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr); |
545 | 4ad40f36 | bellard | |
546 | e37e863f | bellard | #define MMUSUFFIX _mmu
|
547 | 4ad40f36 | bellard | #define ALIGNED_ONLY
|
548 | e37e863f | bellard | |
549 | e37e863f | bellard | #define SHIFT 0 |
550 | e37e863f | bellard | #include "softmmu_template.h" |
551 | e37e863f | bellard | |
552 | e37e863f | bellard | #define SHIFT 1 |
553 | e37e863f | bellard | #include "softmmu_template.h" |
554 | e37e863f | bellard | |
555 | e37e863f | bellard | #define SHIFT 2 |
556 | e37e863f | bellard | #include "softmmu_template.h" |
557 | e37e863f | bellard | |
558 | e37e863f | bellard | #define SHIFT 3 |
559 | e37e863f | bellard | #include "softmmu_template.h" |
560 | e37e863f | bellard | |
561 | 4ad40f36 | bellard | static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr) |
562 | 4ad40f36 | bellard | { |
563 | 4ad40f36 | bellard | env->CP0_BadVAddr = addr; |
564 | 4ad40f36 | bellard | do_restore_state (retaddr); |
565 | 4ad40f36 | bellard | do_raise_exception ((is_write == 1) ? EXCP_AdES : EXCP_AdEL);
|
566 | 4ad40f36 | bellard | } |
567 | 4ad40f36 | bellard | |
568 | e37e863f | bellard | void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr) |
569 | e37e863f | bellard | { |
570 | e37e863f | bellard | TranslationBlock *tb; |
571 | e37e863f | bellard | CPUState *saved_env; |
572 | e37e863f | bellard | unsigned long pc; |
573 | e37e863f | bellard | int ret;
|
574 | e37e863f | bellard | |
575 | e37e863f | bellard | /* XXX: hack to restore env in all cases, even if not called from
|
576 | e37e863f | bellard | generated code */
|
577 | e37e863f | bellard | saved_env = env; |
578 | e37e863f | bellard | env = cpu_single_env; |
579 | e37e863f | bellard | ret = cpu_mips_handle_mmu_fault(env, addr, is_write, is_user, 1);
|
580 | e37e863f | bellard | if (ret) {
|
581 | e37e863f | bellard | if (retaddr) {
|
582 | e37e863f | bellard | /* now we have a real cpu fault */
|
583 | e37e863f | bellard | pc = (unsigned long)retaddr; |
584 | e37e863f | bellard | tb = tb_find_pc(pc); |
585 | e37e863f | bellard | if (tb) {
|
586 | e37e863f | bellard | /* the PC is inside the translated code. It means that we have
|
587 | e37e863f | bellard | a virtual CPU fault */
|
588 | e37e863f | bellard | cpu_restore_state(tb, env, pc, NULL);
|
589 | e37e863f | bellard | } |
590 | e37e863f | bellard | } |
591 | e37e863f | bellard | do_raise_exception_err(env->exception_index, env->error_code); |
592 | e37e863f | bellard | } |
593 | e37e863f | bellard | env = saved_env; |
594 | e37e863f | bellard | } |
595 | e37e863f | bellard | |
596 | e37e863f | bellard | #endif
|
597 | fd4a04eb | ths | |
598 | fd4a04eb | ths | /* Complex FPU operations which may need stack space. */
|
599 | fd4a04eb | ths | |
600 | 8dfdb87c | ths | #define FLOAT_SIGN32 (1 << 31) |
601 | 8dfdb87c | ths | #define FLOAT_SIGN64 (1ULL << 63) |
602 | 8dfdb87c | ths | #define FLOAT_ONE32 (0x3f8 << 20) |
603 | 8dfdb87c | ths | #define FLOAT_ONE64 (0x3ffULL << 52) |
604 | 8dfdb87c | ths | #define FLOAT_TWO32 (1 << 30) |
605 | 8dfdb87c | ths | #define FLOAT_TWO64 (1ULL << 62) |
606 | 8dfdb87c | ths | |
607 | fd4a04eb | ths | /* convert MIPS rounding mode in FCR31 to IEEE library */
|
608 | fd4a04eb | ths | unsigned int ieee_rm[] = { |
609 | fd4a04eb | ths | float_round_nearest_even, |
610 | fd4a04eb | ths | float_round_to_zero, |
611 | fd4a04eb | ths | float_round_up, |
612 | fd4a04eb | ths | float_round_down |
613 | fd4a04eb | ths | }; |
614 | fd4a04eb | ths | |
615 | fd4a04eb | ths | #define RESTORE_ROUNDING_MODE \
|
616 | ead9360e | ths | set_float_rounding_mode(ieee_rm[env->fpu->fcr31 & 3], &env->fpu->fp_status)
|
617 | fd4a04eb | ths | |
618 | ead9360e | ths | void do_cfc1 (int reg) |
619 | fd4a04eb | ths | { |
620 | ead9360e | ths | switch (reg) {
|
621 | ead9360e | ths | case 0: |
622 | ead9360e | ths | T0 = (int32_t)env->fpu->fcr0; |
623 | ead9360e | ths | break;
|
624 | ead9360e | ths | case 25: |
625 | ead9360e | ths | T0 = ((env->fpu->fcr31 >> 24) & 0xfe) | ((env->fpu->fcr31 >> 23) & 0x1); |
626 | ead9360e | ths | break;
|
627 | ead9360e | ths | case 26: |
628 | ead9360e | ths | T0 = env->fpu->fcr31 & 0x0003f07c;
|
629 | ead9360e | ths | break;
|
630 | ead9360e | ths | case 28: |
631 | ead9360e | ths | T0 = (env->fpu->fcr31 & 0x00000f83) | ((env->fpu->fcr31 >> 22) & 0x4); |
632 | ead9360e | ths | break;
|
633 | ead9360e | ths | default:
|
634 | ead9360e | ths | T0 = (int32_t)env->fpu->fcr31; |
635 | ead9360e | ths | break;
|
636 | ead9360e | ths | } |
637 | ead9360e | ths | } |
638 | ead9360e | ths | |
639 | ead9360e | ths | void do_ctc1 (int reg) |
640 | ead9360e | ths | { |
641 | ead9360e | ths | switch(reg) {
|
642 | fd4a04eb | ths | case 25: |
643 | fd4a04eb | ths | if (T0 & 0xffffff00) |
644 | fd4a04eb | ths | return;
|
645 | ead9360e | ths | env->fpu->fcr31 = (env->fpu->fcr31 & 0x017fffff) | ((T0 & 0xfe) << 24) | |
646 | fd4a04eb | ths | ((T0 & 0x1) << 23); |
647 | fd4a04eb | ths | break;
|
648 | fd4a04eb | ths | case 26: |
649 | fd4a04eb | ths | if (T0 & 0x007c0000) |
650 | fd4a04eb | ths | return;
|
651 | ead9360e | ths | env->fpu->fcr31 = (env->fpu->fcr31 & 0xfffc0f83) | (T0 & 0x0003f07c); |
652 | fd4a04eb | ths | break;
|
653 | fd4a04eb | ths | case 28: |
654 | fd4a04eb | ths | if (T0 & 0x007c0000) |
655 | fd4a04eb | ths | return;
|
656 | ead9360e | ths | env->fpu->fcr31 = (env->fpu->fcr31 & 0xfefff07c) | (T0 & 0x00000f83) | |
657 | fd4a04eb | ths | ((T0 & 0x4) << 22); |
658 | fd4a04eb | ths | break;
|
659 | fd4a04eb | ths | case 31: |
660 | fd4a04eb | ths | if (T0 & 0x007c0000) |
661 | fd4a04eb | ths | return;
|
662 | ead9360e | ths | env->fpu->fcr31 = T0; |
663 | fd4a04eb | ths | break;
|
664 | fd4a04eb | ths | default:
|
665 | fd4a04eb | ths | return;
|
666 | fd4a04eb | ths | } |
667 | fd4a04eb | ths | /* set rounding mode */
|
668 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
669 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
670 | ead9360e | ths | if ((GET_FP_ENABLE(env->fpu->fcr31) | 0x20) & GET_FP_CAUSE(env->fpu->fcr31)) |
671 | fd4a04eb | ths | do_raise_exception(EXCP_FPE); |
672 | fd4a04eb | ths | } |
673 | fd4a04eb | ths | |
674 | fd4a04eb | ths | inline char ieee_ex_to_mips(char xcpt) |
675 | fd4a04eb | ths | { |
676 | fd4a04eb | ths | return (xcpt & float_flag_inexact) >> 5 | |
677 | fd4a04eb | ths | (xcpt & float_flag_underflow) >> 3 |
|
678 | fd4a04eb | ths | (xcpt & float_flag_overflow) >> 1 |
|
679 | fd4a04eb | ths | (xcpt & float_flag_divbyzero) << 1 |
|
680 | fd4a04eb | ths | (xcpt & float_flag_invalid) << 4;
|
681 | fd4a04eb | ths | } |
682 | fd4a04eb | ths | |
683 | fd4a04eb | ths | inline char mips_ex_to_ieee(char xcpt) |
684 | fd4a04eb | ths | { |
685 | fd4a04eb | ths | return (xcpt & FP_INEXACT) << 5 | |
686 | fd4a04eb | ths | (xcpt & FP_UNDERFLOW) << 3 |
|
687 | fd4a04eb | ths | (xcpt & FP_OVERFLOW) << 1 |
|
688 | fd4a04eb | ths | (xcpt & FP_DIV0) >> 1 |
|
689 | fd4a04eb | ths | (xcpt & FP_INVALID) >> 4;
|
690 | fd4a04eb | ths | } |
691 | fd4a04eb | ths | |
692 | fd4a04eb | ths | inline void update_fcr31(void) |
693 | fd4a04eb | ths | { |
694 | ead9360e | ths | int tmp = ieee_ex_to_mips(get_float_exception_flags(&env->fpu->fp_status));
|
695 | fd4a04eb | ths | |
696 | ead9360e | ths | SET_FP_CAUSE(env->fpu->fcr31, tmp); |
697 | ead9360e | ths | if (GET_FP_ENABLE(env->fpu->fcr31) & tmp)
|
698 | fd4a04eb | ths | do_raise_exception(EXCP_FPE); |
699 | fd4a04eb | ths | else
|
700 | ead9360e | ths | UPDATE_FP_FLAGS(env->fpu->fcr31, tmp); |
701 | fd4a04eb | ths | } |
702 | fd4a04eb | ths | |
703 | fd4a04eb | ths | #define FLOAT_OP(name, p) void do_float_##name##_##p(void) |
704 | fd4a04eb | ths | |
705 | fd4a04eb | ths | FLOAT_OP(cvtd, s) |
706 | fd4a04eb | ths | { |
707 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
708 | ead9360e | ths | FDT2 = float32_to_float64(FST0, &env->fpu->fp_status); |
709 | fd4a04eb | ths | update_fcr31(); |
710 | fd4a04eb | ths | } |
711 | fd4a04eb | ths | FLOAT_OP(cvtd, w) |
712 | fd4a04eb | ths | { |
713 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
714 | ead9360e | ths | FDT2 = int32_to_float64(WT0, &env->fpu->fp_status); |
715 | fd4a04eb | ths | update_fcr31(); |
716 | fd4a04eb | ths | } |
717 | fd4a04eb | ths | FLOAT_OP(cvtd, l) |
718 | fd4a04eb | ths | { |
719 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
720 | ead9360e | ths | FDT2 = int64_to_float64(DT0, &env->fpu->fp_status); |
721 | fd4a04eb | ths | update_fcr31(); |
722 | fd4a04eb | ths | } |
723 | fd4a04eb | ths | FLOAT_OP(cvtl, d) |
724 | fd4a04eb | ths | { |
725 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
726 | ead9360e | ths | DT2 = float64_to_int64(FDT0, &env->fpu->fp_status); |
727 | fd4a04eb | ths | update_fcr31(); |
728 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
729 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
730 | fd4a04eb | ths | } |
731 | fd4a04eb | ths | FLOAT_OP(cvtl, s) |
732 | fd4a04eb | ths | { |
733 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
734 | ead9360e | ths | DT2 = float32_to_int64(FST0, &env->fpu->fp_status); |
735 | fd4a04eb | ths | update_fcr31(); |
736 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
737 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
738 | fd4a04eb | ths | } |
739 | fd4a04eb | ths | |
740 | fd4a04eb | ths | FLOAT_OP(cvtps, pw) |
741 | fd4a04eb | ths | { |
742 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
743 | ead9360e | ths | FST2 = int32_to_float32(WT0, &env->fpu->fp_status); |
744 | ead9360e | ths | FSTH2 = int32_to_float32(WTH0, &env->fpu->fp_status); |
745 | fd4a04eb | ths | update_fcr31(); |
746 | fd4a04eb | ths | } |
747 | fd4a04eb | ths | FLOAT_OP(cvtpw, ps) |
748 | fd4a04eb | ths | { |
749 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
750 | ead9360e | ths | WT2 = float32_to_int32(FST0, &env->fpu->fp_status); |
751 | ead9360e | ths | WTH2 = float32_to_int32(FSTH0, &env->fpu->fp_status); |
752 | fd4a04eb | ths | update_fcr31(); |
753 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
754 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
755 | fd4a04eb | ths | } |
756 | fd4a04eb | ths | FLOAT_OP(cvts, d) |
757 | fd4a04eb | ths | { |
758 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
759 | ead9360e | ths | FST2 = float64_to_float32(FDT0, &env->fpu->fp_status); |
760 | fd4a04eb | ths | update_fcr31(); |
761 | fd4a04eb | ths | } |
762 | fd4a04eb | ths | FLOAT_OP(cvts, w) |
763 | fd4a04eb | ths | { |
764 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
765 | ead9360e | ths | FST2 = int32_to_float32(WT0, &env->fpu->fp_status); |
766 | fd4a04eb | ths | update_fcr31(); |
767 | fd4a04eb | ths | } |
768 | fd4a04eb | ths | FLOAT_OP(cvts, l) |
769 | fd4a04eb | ths | { |
770 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
771 | ead9360e | ths | FST2 = int64_to_float32(DT0, &env->fpu->fp_status); |
772 | fd4a04eb | ths | update_fcr31(); |
773 | fd4a04eb | ths | } |
774 | fd4a04eb | ths | FLOAT_OP(cvts, pl) |
775 | fd4a04eb | ths | { |
776 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
777 | fd4a04eb | ths | WT2 = WT0; |
778 | fd4a04eb | ths | update_fcr31(); |
779 | fd4a04eb | ths | } |
780 | fd4a04eb | ths | FLOAT_OP(cvts, pu) |
781 | fd4a04eb | ths | { |
782 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
783 | fd4a04eb | ths | WT2 = WTH0; |
784 | fd4a04eb | ths | update_fcr31(); |
785 | fd4a04eb | ths | } |
786 | fd4a04eb | ths | FLOAT_OP(cvtw, s) |
787 | fd4a04eb | ths | { |
788 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
789 | ead9360e | ths | WT2 = float32_to_int32(FST0, &env->fpu->fp_status); |
790 | fd4a04eb | ths | update_fcr31(); |
791 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
792 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
793 | fd4a04eb | ths | } |
794 | fd4a04eb | ths | FLOAT_OP(cvtw, d) |
795 | fd4a04eb | ths | { |
796 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
797 | ead9360e | ths | WT2 = float64_to_int32(FDT0, &env->fpu->fp_status); |
798 | fd4a04eb | ths | update_fcr31(); |
799 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
800 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
801 | fd4a04eb | ths | } |
802 | fd4a04eb | ths | |
803 | fd4a04eb | ths | FLOAT_OP(roundl, d) |
804 | fd4a04eb | ths | { |
805 | ead9360e | ths | set_float_rounding_mode(float_round_nearest_even, &env->fpu->fp_status); |
806 | ead9360e | ths | DT2 = float64_to_int64(FDT0, &env->fpu->fp_status); |
807 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
808 | fd4a04eb | ths | update_fcr31(); |
809 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
810 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
811 | fd4a04eb | ths | } |
812 | fd4a04eb | ths | FLOAT_OP(roundl, s) |
813 | fd4a04eb | ths | { |
814 | ead9360e | ths | set_float_rounding_mode(float_round_nearest_even, &env->fpu->fp_status); |
815 | ead9360e | ths | DT2 = float32_to_int64(FST0, &env->fpu->fp_status); |
816 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
817 | fd4a04eb | ths | update_fcr31(); |
818 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
819 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
820 | fd4a04eb | ths | } |
821 | fd4a04eb | ths | FLOAT_OP(roundw, d) |
822 | fd4a04eb | ths | { |
823 | ead9360e | ths | set_float_rounding_mode(float_round_nearest_even, &env->fpu->fp_status); |
824 | ead9360e | ths | WT2 = float64_to_int32(FDT0, &env->fpu->fp_status); |
825 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
826 | fd4a04eb | ths | update_fcr31(); |
827 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
828 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
829 | fd4a04eb | ths | } |
830 | fd4a04eb | ths | FLOAT_OP(roundw, s) |
831 | fd4a04eb | ths | { |
832 | ead9360e | ths | set_float_rounding_mode(float_round_nearest_even, &env->fpu->fp_status); |
833 | ead9360e | ths | WT2 = float32_to_int32(FST0, &env->fpu->fp_status); |
834 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
835 | fd4a04eb | ths | update_fcr31(); |
836 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
837 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
838 | fd4a04eb | ths | } |
839 | fd4a04eb | ths | |
840 | fd4a04eb | ths | FLOAT_OP(truncl, d) |
841 | fd4a04eb | ths | { |
842 | ead9360e | ths | DT2 = float64_to_int64_round_to_zero(FDT0, &env->fpu->fp_status); |
843 | fd4a04eb | ths | update_fcr31(); |
844 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
845 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
846 | fd4a04eb | ths | } |
847 | fd4a04eb | ths | FLOAT_OP(truncl, s) |
848 | fd4a04eb | ths | { |
849 | ead9360e | ths | DT2 = float32_to_int64_round_to_zero(FST0, &env->fpu->fp_status); |
850 | fd4a04eb | ths | update_fcr31(); |
851 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
852 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
853 | fd4a04eb | ths | } |
854 | fd4a04eb | ths | FLOAT_OP(truncw, d) |
855 | fd4a04eb | ths | { |
856 | ead9360e | ths | WT2 = float64_to_int32_round_to_zero(FDT0, &env->fpu->fp_status); |
857 | fd4a04eb | ths | update_fcr31(); |
858 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
859 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
860 | fd4a04eb | ths | } |
861 | fd4a04eb | ths | FLOAT_OP(truncw, s) |
862 | fd4a04eb | ths | { |
863 | ead9360e | ths | WT2 = float32_to_int32_round_to_zero(FST0, &env->fpu->fp_status); |
864 | fd4a04eb | ths | update_fcr31(); |
865 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
866 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
867 | fd4a04eb | ths | } |
868 | fd4a04eb | ths | |
869 | fd4a04eb | ths | FLOAT_OP(ceill, d) |
870 | fd4a04eb | ths | { |
871 | ead9360e | ths | set_float_rounding_mode(float_round_up, &env->fpu->fp_status); |
872 | ead9360e | ths | DT2 = float64_to_int64(FDT0, &env->fpu->fp_status); |
873 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
874 | fd4a04eb | ths | update_fcr31(); |
875 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
876 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
877 | fd4a04eb | ths | } |
878 | fd4a04eb | ths | FLOAT_OP(ceill, s) |
879 | fd4a04eb | ths | { |
880 | ead9360e | ths | set_float_rounding_mode(float_round_up, &env->fpu->fp_status); |
881 | ead9360e | ths | DT2 = float32_to_int64(FST0, &env->fpu->fp_status); |
882 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
883 | fd4a04eb | ths | update_fcr31(); |
884 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
885 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
886 | fd4a04eb | ths | } |
887 | fd4a04eb | ths | FLOAT_OP(ceilw, d) |
888 | fd4a04eb | ths | { |
889 | ead9360e | ths | set_float_rounding_mode(float_round_up, &env->fpu->fp_status); |
890 | ead9360e | ths | WT2 = float64_to_int32(FDT0, &env->fpu->fp_status); |
891 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
892 | fd4a04eb | ths | update_fcr31(); |
893 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
894 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
895 | fd4a04eb | ths | } |
896 | fd4a04eb | ths | FLOAT_OP(ceilw, s) |
897 | fd4a04eb | ths | { |
898 | ead9360e | ths | set_float_rounding_mode(float_round_up, &env->fpu->fp_status); |
899 | ead9360e | ths | WT2 = float32_to_int32(FST0, &env->fpu->fp_status); |
900 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
901 | fd4a04eb | ths | update_fcr31(); |
902 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
903 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
904 | fd4a04eb | ths | } |
905 | fd4a04eb | ths | |
906 | fd4a04eb | ths | FLOAT_OP(floorl, d) |
907 | fd4a04eb | ths | { |
908 | ead9360e | ths | set_float_rounding_mode(float_round_down, &env->fpu->fp_status); |
909 | ead9360e | ths | DT2 = float64_to_int64(FDT0, &env->fpu->fp_status); |
910 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
911 | fd4a04eb | ths | update_fcr31(); |
912 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
913 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
914 | fd4a04eb | ths | } |
915 | fd4a04eb | ths | FLOAT_OP(floorl, s) |
916 | fd4a04eb | ths | { |
917 | ead9360e | ths | set_float_rounding_mode(float_round_down, &env->fpu->fp_status); |
918 | ead9360e | ths | DT2 = float32_to_int64(FST0, &env->fpu->fp_status); |
919 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
920 | fd4a04eb | ths | update_fcr31(); |
921 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
922 | fd4a04eb | ths | DT2 = 0x7fffffffffffffffULL;
|
923 | fd4a04eb | ths | } |
924 | fd4a04eb | ths | FLOAT_OP(floorw, d) |
925 | fd4a04eb | ths | { |
926 | ead9360e | ths | set_float_rounding_mode(float_round_down, &env->fpu->fp_status); |
927 | ead9360e | ths | WT2 = float64_to_int32(FDT0, &env->fpu->fp_status); |
928 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
929 | fd4a04eb | ths | update_fcr31(); |
930 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
931 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
932 | fd4a04eb | ths | } |
933 | fd4a04eb | ths | FLOAT_OP(floorw, s) |
934 | fd4a04eb | ths | { |
935 | ead9360e | ths | set_float_rounding_mode(float_round_down, &env->fpu->fp_status); |
936 | ead9360e | ths | WT2 = float32_to_int32(FST0, &env->fpu->fp_status); |
937 | fd4a04eb | ths | RESTORE_ROUNDING_MODE; |
938 | fd4a04eb | ths | update_fcr31(); |
939 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & (FP_OVERFLOW | FP_INVALID))
|
940 | fd4a04eb | ths | WT2 = 0x7fffffff;
|
941 | fd4a04eb | ths | } |
942 | fd4a04eb | ths | |
943 | 8dfdb87c | ths | /* MIPS specific unary operations */
|
944 | 8dfdb87c | ths | FLOAT_OP(recip, d) |
945 | 8dfdb87c | ths | { |
946 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
947 | ead9360e | ths | FDT2 = float64_div(FLOAT_ONE64, FDT0, &env->fpu->fp_status); |
948 | 8dfdb87c | ths | update_fcr31(); |
949 | 8dfdb87c | ths | } |
950 | 8dfdb87c | ths | FLOAT_OP(recip, s) |
951 | 8dfdb87c | ths | { |
952 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
953 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST0, &env->fpu->fp_status); |
954 | 8dfdb87c | ths | update_fcr31(); |
955 | 57fa1fb3 | ths | } |
956 | 57fa1fb3 | ths | |
957 | 8dfdb87c | ths | FLOAT_OP(rsqrt, d) |
958 | 8dfdb87c | ths | { |
959 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
960 | ead9360e | ths | FDT2 = float64_sqrt(FDT0, &env->fpu->fp_status); |
961 | ead9360e | ths | FDT2 = float64_div(FLOAT_ONE64, FDT2, &env->fpu->fp_status); |
962 | 8dfdb87c | ths | update_fcr31(); |
963 | 8dfdb87c | ths | } |
964 | 8dfdb87c | ths | FLOAT_OP(rsqrt, s) |
965 | 8dfdb87c | ths | { |
966 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
967 | ead9360e | ths | FST2 = float32_sqrt(FST0, &env->fpu->fp_status); |
968 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST2, &env->fpu->fp_status); |
969 | 8dfdb87c | ths | update_fcr31(); |
970 | 8dfdb87c | ths | } |
971 | 8dfdb87c | ths | |
972 | 8dfdb87c | ths | FLOAT_OP(recip1, d) |
973 | 8dfdb87c | ths | { |
974 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
975 | ead9360e | ths | FDT2 = float64_div(FLOAT_ONE64, FDT0, &env->fpu->fp_status); |
976 | 8dfdb87c | ths | update_fcr31(); |
977 | 8dfdb87c | ths | } |
978 | 8dfdb87c | ths | FLOAT_OP(recip1, s) |
979 | 8dfdb87c | ths | { |
980 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
981 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST0, &env->fpu->fp_status); |
982 | 8dfdb87c | ths | update_fcr31(); |
983 | 8dfdb87c | ths | } |
984 | 8dfdb87c | ths | FLOAT_OP(recip1, ps) |
985 | 8dfdb87c | ths | { |
986 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
987 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST0, &env->fpu->fp_status); |
988 | ead9360e | ths | FSTH2 = float32_div(FLOAT_ONE32, FSTH0, &env->fpu->fp_status); |
989 | 8dfdb87c | ths | update_fcr31(); |
990 | 8dfdb87c | ths | } |
991 | 8dfdb87c | ths | |
992 | 8dfdb87c | ths | FLOAT_OP(rsqrt1, d) |
993 | 8dfdb87c | ths | { |
994 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
995 | ead9360e | ths | FDT2 = float64_sqrt(FDT0, &env->fpu->fp_status); |
996 | ead9360e | ths | FDT2 = float64_div(FLOAT_ONE64, FDT2, &env->fpu->fp_status); |
997 | 8dfdb87c | ths | update_fcr31(); |
998 | 8dfdb87c | ths | } |
999 | 8dfdb87c | ths | FLOAT_OP(rsqrt1, s) |
1000 | 8dfdb87c | ths | { |
1001 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1002 | ead9360e | ths | FST2 = float32_sqrt(FST0, &env->fpu->fp_status); |
1003 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST2, &env->fpu->fp_status); |
1004 | 8dfdb87c | ths | update_fcr31(); |
1005 | 8dfdb87c | ths | } |
1006 | 8dfdb87c | ths | FLOAT_OP(rsqrt1, ps) |
1007 | 8dfdb87c | ths | { |
1008 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1009 | ead9360e | ths | FST2 = float32_sqrt(FST0, &env->fpu->fp_status); |
1010 | ead9360e | ths | FSTH2 = float32_sqrt(FSTH0, &env->fpu->fp_status); |
1011 | ead9360e | ths | FST2 = float32_div(FLOAT_ONE32, FST2, &env->fpu->fp_status); |
1012 | ead9360e | ths | FSTH2 = float32_div(FLOAT_ONE32, FSTH2, &env->fpu->fp_status); |
1013 | 8dfdb87c | ths | update_fcr31(); |
1014 | 57fa1fb3 | ths | } |
1015 | 57fa1fb3 | ths | |
1016 | fd4a04eb | ths | /* binary operations */
|
1017 | fd4a04eb | ths | #define FLOAT_BINOP(name) \
|
1018 | fd4a04eb | ths | FLOAT_OP(name, d) \ |
1019 | fd4a04eb | ths | { \ |
1020 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status); \
|
1021 | ead9360e | ths | FDT2 = float64_ ## name (FDT0, FDT1, &env->fpu->fp_status); \ |
1022 | ead9360e | ths | update_fcr31(); \ |
1023 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) \
|
1024 | ead9360e | ths | FDT2 = 0x7ff7ffffffffffffULL; \
|
1025 | ead9360e | ths | else if (GET_FP_CAUSE(env->fpu->fcr31) & FP_UNDERFLOW) { \ |
1026 | ead9360e | ths | if ((env->fpu->fcr31 & 0x3) == 0) \ |
1027 | ead9360e | ths | FDT2 &= FLOAT_SIGN64; \ |
1028 | 3a5b360d | ths | } \ |
1029 | fd4a04eb | ths | } \ |
1030 | fd4a04eb | ths | FLOAT_OP(name, s) \ |
1031 | fd4a04eb | ths | { \ |
1032 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status); \
|
1033 | ead9360e | ths | FST2 = float32_ ## name (FST0, FST1, &env->fpu->fp_status); \ |
1034 | ead9360e | ths | update_fcr31(); \ |
1035 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) \
|
1036 | ead9360e | ths | FST2 = 0x7fbfffff; \
|
1037 | ead9360e | ths | else if (GET_FP_CAUSE(env->fpu->fcr31) & FP_UNDERFLOW) { \ |
1038 | ead9360e | ths | if ((env->fpu->fcr31 & 0x3) == 0) \ |
1039 | ead9360e | ths | FST2 &= FLOAT_SIGN32; \ |
1040 | 3a5b360d | ths | } \ |
1041 | fd4a04eb | ths | } \ |
1042 | fd4a04eb | ths | FLOAT_OP(name, ps) \ |
1043 | fd4a04eb | ths | { \ |
1044 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status); \
|
1045 | ead9360e | ths | FST2 = float32_ ## name (FST0, FST1, &env->fpu->fp_status); \ |
1046 | ead9360e | ths | FSTH2 = float32_ ## name (FSTH0, FSTH1, &env->fpu->fp_status); \ |
1047 | fd4a04eb | ths | update_fcr31(); \ |
1048 | ead9360e | ths | if (GET_FP_CAUSE(env->fpu->fcr31) & FP_INVALID) { \
|
1049 | ead9360e | ths | FST2 = 0x7fbfffff; \
|
1050 | ead9360e | ths | FSTH2 = 0x7fbfffff; \
|
1051 | ead9360e | ths | } else if (GET_FP_CAUSE(env->fpu->fcr31) & FP_UNDERFLOW) { \ |
1052 | ead9360e | ths | if ((env->fpu->fcr31 & 0x3) == 0) { \ |
1053 | ead9360e | ths | FST2 &= FLOAT_SIGN32; \ |
1054 | ead9360e | ths | FSTH2 &= FLOAT_SIGN32; \ |
1055 | 3a5b360d | ths | } \ |
1056 | 3a5b360d | ths | } \ |
1057 | fd4a04eb | ths | } |
1058 | fd4a04eb | ths | FLOAT_BINOP(add) |
1059 | fd4a04eb | ths | FLOAT_BINOP(sub) |
1060 | fd4a04eb | ths | FLOAT_BINOP(mul) |
1061 | fd4a04eb | ths | FLOAT_BINOP(div) |
1062 | fd4a04eb | ths | #undef FLOAT_BINOP
|
1063 | fd4a04eb | ths | |
1064 | 8dfdb87c | ths | /* MIPS specific binary operations */
|
1065 | 8dfdb87c | ths | FLOAT_OP(recip2, d) |
1066 | 8dfdb87c | ths | { |
1067 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1068 | ead9360e | ths | FDT2 = float64_mul(FDT0, FDT2, &env->fpu->fp_status); |
1069 | ead9360e | ths | FDT2 = float64_sub(FDT2, FLOAT_ONE64, &env->fpu->fp_status) ^ FLOAT_SIGN64; |
1070 | 8dfdb87c | ths | update_fcr31(); |
1071 | 8dfdb87c | ths | } |
1072 | 8dfdb87c | ths | FLOAT_OP(recip2, s) |
1073 | 8dfdb87c | ths | { |
1074 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1075 | ead9360e | ths | FST2 = float32_mul(FST0, FST2, &env->fpu->fp_status); |
1076 | ead9360e | ths | FST2 = float32_sub(FST2, FLOAT_ONE32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1077 | 8dfdb87c | ths | update_fcr31(); |
1078 | 8dfdb87c | ths | } |
1079 | 8dfdb87c | ths | FLOAT_OP(recip2, ps) |
1080 | 8dfdb87c | ths | { |
1081 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1082 | ead9360e | ths | FST2 = float32_mul(FST0, FST2, &env->fpu->fp_status); |
1083 | ead9360e | ths | FSTH2 = float32_mul(FSTH0, FSTH2, &env->fpu->fp_status); |
1084 | ead9360e | ths | FST2 = float32_sub(FST2, FLOAT_ONE32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1085 | ead9360e | ths | FSTH2 = float32_sub(FSTH2, FLOAT_ONE32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1086 | 8dfdb87c | ths | update_fcr31(); |
1087 | 8dfdb87c | ths | } |
1088 | 8dfdb87c | ths | |
1089 | 8dfdb87c | ths | FLOAT_OP(rsqrt2, d) |
1090 | 8dfdb87c | ths | { |
1091 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1092 | ead9360e | ths | FDT2 = float64_mul(FDT0, FDT2, &env->fpu->fp_status); |
1093 | ead9360e | ths | FDT2 = float64_sub(FDT2, FLOAT_ONE64, &env->fpu->fp_status); |
1094 | ead9360e | ths | FDT2 = float64_div(FDT2, FLOAT_TWO64, &env->fpu->fp_status) ^ FLOAT_SIGN64; |
1095 | 8dfdb87c | ths | update_fcr31(); |
1096 | 8dfdb87c | ths | } |
1097 | 8dfdb87c | ths | FLOAT_OP(rsqrt2, s) |
1098 | 8dfdb87c | ths | { |
1099 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1100 | ead9360e | ths | FST2 = float32_mul(FST0, FST2, &env->fpu->fp_status); |
1101 | ead9360e | ths | FST2 = float32_sub(FST2, FLOAT_ONE32, &env->fpu->fp_status); |
1102 | ead9360e | ths | FST2 = float32_div(FST2, FLOAT_TWO32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1103 | 8dfdb87c | ths | update_fcr31(); |
1104 | 8dfdb87c | ths | } |
1105 | 8dfdb87c | ths | FLOAT_OP(rsqrt2, ps) |
1106 | 8dfdb87c | ths | { |
1107 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1108 | ead9360e | ths | FST2 = float32_mul(FST0, FST2, &env->fpu->fp_status); |
1109 | ead9360e | ths | FSTH2 = float32_mul(FSTH0, FSTH2, &env->fpu->fp_status); |
1110 | ead9360e | ths | FST2 = float32_sub(FST2, FLOAT_ONE32, &env->fpu->fp_status); |
1111 | ead9360e | ths | FSTH2 = float32_sub(FSTH2, FLOAT_ONE32, &env->fpu->fp_status); |
1112 | ead9360e | ths | FST2 = float32_div(FST2, FLOAT_TWO32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1113 | ead9360e | ths | FSTH2 = float32_div(FSTH2, FLOAT_TWO32, &env->fpu->fp_status) ^ FLOAT_SIGN32; |
1114 | 8dfdb87c | ths | update_fcr31(); |
1115 | 57fa1fb3 | ths | } |
1116 | 57fa1fb3 | ths | |
1117 | fd4a04eb | ths | FLOAT_OP(addr, ps) |
1118 | fd4a04eb | ths | { |
1119 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1120 | ead9360e | ths | FST2 = float32_add (FST0, FSTH0, &env->fpu->fp_status); |
1121 | ead9360e | ths | FSTH2 = float32_add (FST1, FSTH1, &env->fpu->fp_status); |
1122 | fd4a04eb | ths | update_fcr31(); |
1123 | fd4a04eb | ths | } |
1124 | fd4a04eb | ths | |
1125 | 57fa1fb3 | ths | FLOAT_OP(mulr, ps) |
1126 | 57fa1fb3 | ths | { |
1127 | ead9360e | ths | set_float_exception_flags(0, &env->fpu->fp_status);
|
1128 | ead9360e | ths | FST2 = float32_mul (FST0, FSTH0, &env->fpu->fp_status); |
1129 | ead9360e | ths | FSTH2 = float32_mul (FST1, FSTH1, &env->fpu->fp_status); |
1130 | 57fa1fb3 | ths | update_fcr31(); |
1131 | 57fa1fb3 | ths | } |
1132 | 57fa1fb3 | ths | |
1133 | 8dfdb87c | ths | /* compare operations */
|
1134 | fd4a04eb | ths | #define FOP_COND_D(op, cond) \
|
1135 | fd4a04eb | ths | void do_cmp_d_ ## op (long cc) \ |
1136 | fd4a04eb | ths | { \ |
1137 | fd4a04eb | ths | int c = cond; \
|
1138 | fd4a04eb | ths | update_fcr31(); \ |
1139 | fd4a04eb | ths | if (c) \
|
1140 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1141 | fd4a04eb | ths | else \
|
1142 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1143 | fd4a04eb | ths | } \ |
1144 | fd4a04eb | ths | void do_cmpabs_d_ ## op (long cc) \ |
1145 | fd4a04eb | ths | { \ |
1146 | fd4a04eb | ths | int c; \
|
1147 | 8dfdb87c | ths | FDT0 &= ~FLOAT_SIGN64; \ |
1148 | 8dfdb87c | ths | FDT1 &= ~FLOAT_SIGN64; \ |
1149 | fd4a04eb | ths | c = cond; \ |
1150 | fd4a04eb | ths | update_fcr31(); \ |
1151 | fd4a04eb | ths | if (c) \
|
1152 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1153 | fd4a04eb | ths | else \
|
1154 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1155 | fd4a04eb | ths | } |
1156 | fd4a04eb | ths | |
1157 | fd4a04eb | ths | int float64_is_unordered(int sig, float64 a, float64 b STATUS_PARAM) |
1158 | fd4a04eb | ths | { |
1159 | fd4a04eb | ths | if (float64_is_signaling_nan(a) ||
|
1160 | fd4a04eb | ths | float64_is_signaling_nan(b) || |
1161 | fd4a04eb | ths | (sig && (float64_is_nan(a) || float64_is_nan(b)))) { |
1162 | fd4a04eb | ths | float_raise(float_flag_invalid, status); |
1163 | fd4a04eb | ths | return 1; |
1164 | fd4a04eb | ths | } else if (float64_is_nan(a) || float64_is_nan(b)) { |
1165 | fd4a04eb | ths | return 1; |
1166 | fd4a04eb | ths | } else {
|
1167 | fd4a04eb | ths | return 0; |
1168 | fd4a04eb | ths | } |
1169 | fd4a04eb | ths | } |
1170 | fd4a04eb | ths | |
1171 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1172 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1173 | ead9360e | ths | FOP_COND_D(f, (float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status), 0)) |
1174 | ead9360e | ths | FOP_COND_D(un, float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status))
|
1175 | ead9360e | ths | FOP_COND_D(eq, !float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) && float64_eq(FDT0, FDT1, &env->fpu->fp_status))
|
1176 | ead9360e | ths | FOP_COND_D(ueq, float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) || float64_eq(FDT0, FDT1, &env->fpu->fp_status))
|
1177 | ead9360e | ths | FOP_COND_D(olt, !float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) && float64_lt(FDT0, FDT1, &env->fpu->fp_status))
|
1178 | ead9360e | ths | FOP_COND_D(ult, float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) || float64_lt(FDT0, FDT1, &env->fpu->fp_status))
|
1179 | ead9360e | ths | FOP_COND_D(ole, !float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) && float64_le(FDT0, FDT1, &env->fpu->fp_status))
|
1180 | ead9360e | ths | FOP_COND_D(ule, float64_is_unordered(0, FDT1, FDT0, &env->fpu->fp_status) || float64_le(FDT0, FDT1, &env->fpu->fp_status))
|
1181 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1182 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1183 | ead9360e | ths | FOP_COND_D(sf, (float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status), 0)) |
1184 | ead9360e | ths | FOP_COND_D(ngle,float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status))
|
1185 | ead9360e | ths | FOP_COND_D(seq, !float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) && float64_eq(FDT0, FDT1, &env->fpu->fp_status))
|
1186 | ead9360e | ths | FOP_COND_D(ngl, float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) || float64_eq(FDT0, FDT1, &env->fpu->fp_status))
|
1187 | ead9360e | ths | FOP_COND_D(lt, !float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) && float64_lt(FDT0, FDT1, &env->fpu->fp_status))
|
1188 | ead9360e | ths | FOP_COND_D(nge, float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) || float64_lt(FDT0, FDT1, &env->fpu->fp_status))
|
1189 | ead9360e | ths | FOP_COND_D(le, !float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) && float64_le(FDT0, FDT1, &env->fpu->fp_status))
|
1190 | ead9360e | ths | FOP_COND_D(ngt, float64_is_unordered(1, FDT1, FDT0, &env->fpu->fp_status) || float64_le(FDT0, FDT1, &env->fpu->fp_status))
|
1191 | fd4a04eb | ths | |
1192 | fd4a04eb | ths | #define FOP_COND_S(op, cond) \
|
1193 | fd4a04eb | ths | void do_cmp_s_ ## op (long cc) \ |
1194 | fd4a04eb | ths | { \ |
1195 | fd4a04eb | ths | int c = cond; \
|
1196 | fd4a04eb | ths | update_fcr31(); \ |
1197 | fd4a04eb | ths | if (c) \
|
1198 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1199 | fd4a04eb | ths | else \
|
1200 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1201 | fd4a04eb | ths | } \ |
1202 | fd4a04eb | ths | void do_cmpabs_s_ ## op (long cc) \ |
1203 | fd4a04eb | ths | { \ |
1204 | fd4a04eb | ths | int c; \
|
1205 | 8dfdb87c | ths | FST0 &= ~FLOAT_SIGN32; \ |
1206 | 8dfdb87c | ths | FST1 &= ~FLOAT_SIGN32; \ |
1207 | fd4a04eb | ths | c = cond; \ |
1208 | fd4a04eb | ths | update_fcr31(); \ |
1209 | fd4a04eb | ths | if (c) \
|
1210 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1211 | fd4a04eb | ths | else \
|
1212 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1213 | fd4a04eb | ths | } |
1214 | fd4a04eb | ths | |
1215 | fd4a04eb | ths | flag float32_is_unordered(int sig, float32 a, float32 b STATUS_PARAM)
|
1216 | fd4a04eb | ths | { |
1217 | fd4a04eb | ths | if (float32_is_signaling_nan(a) ||
|
1218 | fd4a04eb | ths | float32_is_signaling_nan(b) || |
1219 | fd4a04eb | ths | (sig && (float32_is_nan(a) || float32_is_nan(b)))) { |
1220 | fd4a04eb | ths | float_raise(float_flag_invalid, status); |
1221 | fd4a04eb | ths | return 1; |
1222 | fd4a04eb | ths | } else if (float32_is_nan(a) || float32_is_nan(b)) { |
1223 | fd4a04eb | ths | return 1; |
1224 | fd4a04eb | ths | } else {
|
1225 | fd4a04eb | ths | return 0; |
1226 | fd4a04eb | ths | } |
1227 | fd4a04eb | ths | } |
1228 | fd4a04eb | ths | |
1229 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1230 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1231 | ead9360e | ths | FOP_COND_S(f, (float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status), 0)) |
1232 | ead9360e | ths | FOP_COND_S(un, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status))
|
1233 | ead9360e | ths | FOP_COND_S(eq, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_eq(FST0, FST1, &env->fpu->fp_status))
|
1234 | ead9360e | ths | FOP_COND_S(ueq, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_eq(FST0, FST1, &env->fpu->fp_status))
|
1235 | ead9360e | ths | FOP_COND_S(olt, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_lt(FST0, FST1, &env->fpu->fp_status))
|
1236 | ead9360e | ths | FOP_COND_S(ult, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_lt(FST0, FST1, &env->fpu->fp_status))
|
1237 | ead9360e | ths | FOP_COND_S(ole, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_le(FST0, FST1, &env->fpu->fp_status))
|
1238 | ead9360e | ths | FOP_COND_S(ule, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_le(FST0, FST1, &env->fpu->fp_status))
|
1239 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1240 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1241 | ead9360e | ths | FOP_COND_S(sf, (float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status), 0)) |
1242 | ead9360e | ths | FOP_COND_S(ngle,float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status))
|
1243 | ead9360e | ths | FOP_COND_S(seq, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_eq(FST0, FST1, &env->fpu->fp_status))
|
1244 | ead9360e | ths | FOP_COND_S(ngl, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_eq(FST0, FST1, &env->fpu->fp_status))
|
1245 | ead9360e | ths | FOP_COND_S(lt, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_lt(FST0, FST1, &env->fpu->fp_status))
|
1246 | ead9360e | ths | FOP_COND_S(nge, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_lt(FST0, FST1, &env->fpu->fp_status))
|
1247 | ead9360e | ths | FOP_COND_S(le, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_le(FST0, FST1, &env->fpu->fp_status))
|
1248 | ead9360e | ths | FOP_COND_S(ngt, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_le(FST0, FST1, &env->fpu->fp_status))
|
1249 | fd4a04eb | ths | |
1250 | fd4a04eb | ths | #define FOP_COND_PS(op, condl, condh) \
|
1251 | fd4a04eb | ths | void do_cmp_ps_ ## op (long cc) \ |
1252 | fd4a04eb | ths | { \ |
1253 | fd4a04eb | ths | int cl = condl; \
|
1254 | fd4a04eb | ths | int ch = condh; \
|
1255 | fd4a04eb | ths | update_fcr31(); \ |
1256 | fd4a04eb | ths | if (cl) \
|
1257 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1258 | fd4a04eb | ths | else \
|
1259 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1260 | fd4a04eb | ths | if (ch) \
|
1261 | ead9360e | ths | SET_FP_COND(cc + 1, env->fpu); \
|
1262 | fd4a04eb | ths | else \
|
1263 | ead9360e | ths | CLEAR_FP_COND(cc + 1, env->fpu); \
|
1264 | fd4a04eb | ths | } \ |
1265 | fd4a04eb | ths | void do_cmpabs_ps_ ## op (long cc) \ |
1266 | fd4a04eb | ths | { \ |
1267 | fd4a04eb | ths | int cl, ch; \
|
1268 | 8dfdb87c | ths | FST0 &= ~FLOAT_SIGN32; \ |
1269 | 8dfdb87c | ths | FSTH0 &= ~FLOAT_SIGN32; \ |
1270 | 8dfdb87c | ths | FST1 &= ~FLOAT_SIGN32; \ |
1271 | 8dfdb87c | ths | FSTH1 &= ~FLOAT_SIGN32; \ |
1272 | fd4a04eb | ths | cl = condl; \ |
1273 | fd4a04eb | ths | ch = condh; \ |
1274 | fd4a04eb | ths | update_fcr31(); \ |
1275 | fd4a04eb | ths | if (cl) \
|
1276 | ead9360e | ths | SET_FP_COND(cc, env->fpu); \ |
1277 | fd4a04eb | ths | else \
|
1278 | ead9360e | ths | CLEAR_FP_COND(cc, env->fpu); \ |
1279 | fd4a04eb | ths | if (ch) \
|
1280 | ead9360e | ths | SET_FP_COND(cc + 1, env->fpu); \
|
1281 | fd4a04eb | ths | else \
|
1282 | ead9360e | ths | CLEAR_FP_COND(cc + 1, env->fpu); \
|
1283 | fd4a04eb | ths | } |
1284 | fd4a04eb | ths | |
1285 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1286 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1287 | ead9360e | ths | FOP_COND_PS(f, (float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status), 0), |
1288 | ead9360e | ths | (float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status), 0)) |
1289 | ead9360e | ths | FOP_COND_PS(un, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status),
|
1290 | ead9360e | ths | float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status))
|
1291 | ead9360e | ths | FOP_COND_PS(eq, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_eq(FST0, FST1, &env->fpu->fp_status),
|
1292 | ead9360e | ths | !float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) && float32_eq(FSTH0, FSTH1, &env->fpu->fp_status))
|
1293 | ead9360e | ths | FOP_COND_PS(ueq, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_eq(FST0, FST1, &env->fpu->fp_status),
|
1294 | ead9360e | ths | float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) || float32_eq(FSTH0, FSTH1, &env->fpu->fp_status))
|
1295 | ead9360e | ths | FOP_COND_PS(olt, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_lt(FST0, FST1, &env->fpu->fp_status),
|
1296 | ead9360e | ths | !float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) && float32_lt(FSTH0, FSTH1, &env->fpu->fp_status))
|
1297 | ead9360e | ths | FOP_COND_PS(ult, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_lt(FST0, FST1, &env->fpu->fp_status),
|
1298 | ead9360e | ths | float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) || float32_lt(FSTH0, FSTH1, &env->fpu->fp_status))
|
1299 | ead9360e | ths | FOP_COND_PS(ole, !float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) && float32_le(FST0, FST1, &env->fpu->fp_status),
|
1300 | ead9360e | ths | !float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) && float32_le(FSTH0, FSTH1, &env->fpu->fp_status))
|
1301 | ead9360e | ths | FOP_COND_PS(ule, float32_is_unordered(0, FST1, FST0, &env->fpu->fp_status) || float32_le(FST0, FST1, &env->fpu->fp_status),
|
1302 | ead9360e | ths | float32_is_unordered(0, FSTH1, FSTH0, &env->fpu->fp_status) || float32_le(FSTH0, FSTH1, &env->fpu->fp_status))
|
1303 | fd4a04eb | ths | /* NOTE: the comma operator will make "cond" to eval to false,
|
1304 | fd4a04eb | ths | * but float*_is_unordered() is still called. */
|
1305 | ead9360e | ths | FOP_COND_PS(sf, (float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status), 0), |
1306 | ead9360e | ths | (float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status), 0)) |
1307 | ead9360e | ths | FOP_COND_PS(ngle,float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status),
|
1308 | ead9360e | ths | float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status))
|
1309 | ead9360e | ths | FOP_COND_PS(seq, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_eq(FST0, FST1, &env->fpu->fp_status),
|
1310 | ead9360e | ths | !float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) && float32_eq(FSTH0, FSTH1, &env->fpu->fp_status))
|
1311 | ead9360e | ths | FOP_COND_PS(ngl, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_eq(FST0, FST1, &env->fpu->fp_status),
|
1312 | ead9360e | ths | float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) || float32_eq(FSTH0, FSTH1, &env->fpu->fp_status))
|
1313 | ead9360e | ths | FOP_COND_PS(lt, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_lt(FST0, FST1, &env->fpu->fp_status),
|
1314 | ead9360e | ths | !float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) && float32_lt(FSTH0, FSTH1, &env->fpu->fp_status))
|
1315 | ead9360e | ths | FOP_COND_PS(nge, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_lt(FST0, FST1, &env->fpu->fp_status),
|
1316 | ead9360e | ths | float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) || float32_lt(FSTH0, FSTH1, &env->fpu->fp_status))
|
1317 | ead9360e | ths | FOP_COND_PS(le, !float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) && float32_le(FST0, FST1, &env->fpu->fp_status),
|
1318 | ead9360e | ths | !float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) && float32_le(FSTH0, FSTH1, &env->fpu->fp_status))
|
1319 | ead9360e | ths | FOP_COND_PS(ngt, float32_is_unordered(1, FST1, FST0, &env->fpu->fp_status) || float32_le(FST0, FST1, &env->fpu->fp_status),
|
1320 | ead9360e | ths | float32_is_unordered(1, FSTH1, FSTH0, &env->fpu->fp_status) || float32_le(FSTH0, FSTH1, &env->fpu->fp_status)) |