trunk/src/emu/cpu/i386/x87ops.inc
| r244931 | r244932 | |
| 2185 | 2185 | } |
| 2186 | 2186 | else |
| 2187 | 2187 | { |
| 2188 | | floatx80 a = ST(0); |
| 2189 | | floatx80 b = ST(1); |
| 2188 | floatx80 a0 = ST(0); |
| 2189 | floatx80 b1 = ST(1); |
| 2190 | 2190 | |
| 2191 | 2191 | m_x87_sw &= ~X87_SW_C2; |
| 2192 | 2192 | |
| 2193 | | // TODO: Implement Cx bits |
| 2194 | | result = floatx80_rem(a, b); |
| 2193 | //int d=extractFloatx80Exp(a0)-extractFloatx80Exp(b1); |
| 2194 | int d = (a0.high & 0x7FFF) - (b1.high & 0x7FFF); |
| 2195 | if (d < 64) { |
| 2196 | floatx80 t=floatx80_div(a0, b1); |
| 2197 | int64 q = floatx80_to_int64_round_to_zero(t); |
| 2198 | floatx80 qf = int64_to_floatx80(q); |
| 2199 | floatx80 tt = floatx80_mul(b1, qf); |
| 2200 | result = floatx80_sub(a0, tt); |
| 2201 | // C2 already 0 |
| 2202 | m_x87_sw &= ~(X87_SW_C0|X87_SW_C3|X87_SW_C1); |
| 2203 | if (q & 1) |
| 2204 | m_x87_sw |= X87_SW_C1; |
| 2205 | if (q & 2) |
| 2206 | m_x87_sw |= X87_SW_C3; |
| 2207 | if (q & 4) |
| 2208 | m_x87_sw |= X87_SW_C0; |
| 2209 | } |
| 2210 | else { |
| 2211 | m_x87_sw |= X87_SW_C2; |
| 2212 | int n = 63; |
| 2213 | int e = 1 << (d - n); |
| 2214 | floatx80 ef = int32_to_floatx80(e); |
| 2215 | floatx80 t=floatx80_div(a0, b1); |
| 2216 | floatx80 td = floatx80_div(t, ef); |
| 2217 | int64 qq = floatx80_to_int64_round_to_zero(td); |
| 2218 | floatx80 qqf = int64_to_floatx80(qq); |
| 2219 | floatx80 tt = floatx80_mul(b1, qqf); |
| 2220 | floatx80 ttt = floatx80_mul(tt, ef); |
| 2221 | result = floatx80_sub(a0, ttt); |
| 2222 | } |
| 2195 | 2223 | } |
| 2196 | 2224 | |
| 2197 | 2225 | if (x87_check_exceptions()) |