CPU with softfloat: Added softfloat versions of the i686 FX opcodes while preserving the existing non-softfloat ones.
This commit is contained in:
@@ -439,6 +439,79 @@ FPU_tagof(const floatx80 reg)
|
||||
return X87_TAG_VALID;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
pack_FPU_TW(uint16_t twd)
|
||||
{
|
||||
uint8_t tag_byte = 0;
|
||||
|
||||
if ((twd & 0x0003) != 0x0003) tag_byte |= 0x01;
|
||||
if ((twd & 0x000c) != 0x000c) tag_byte |= 0x02;
|
||||
if ((twd & 0x0030) != 0x0030) tag_byte |= 0x04;
|
||||
if ((twd & 0x00c0) != 0x00c0) tag_byte |= 0x08;
|
||||
if ((twd & 0x0300) != 0x0300) tag_byte |= 0x10;
|
||||
if ((twd & 0x0c00) != 0x0c00) tag_byte |= 0x20;
|
||||
if ((twd & 0x3000) != 0x3000) tag_byte |= 0x40;
|
||||
if ((twd & 0xc000) != 0xc000) tag_byte |= 0x80;
|
||||
|
||||
return tag_byte;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
unpack_FPU_TW(uint16_t tag_byte)
|
||||
{
|
||||
uint32_t twd = 0;
|
||||
|
||||
/* FTW
|
||||
*
|
||||
* Note that the original format for FTW can be recreated from the stored
|
||||
* FTW valid bits and the stored 80-bit FP data (assuming the stored data
|
||||
* was not the contents of MMX registers) using the following table:
|
||||
|
||||
| Exponent | Exponent | Fraction | J,M bits | FTW valid | x87 FTW |
|
||||
| all 1s | all 0s | all 0s | | | |
|
||||
-------------------------------------------------------------------
|
||||
| 0 | 0 | 0 | 0x | 1 | S 10 |
|
||||
| 0 | 0 | 0 | 1x | 1 | V 00 |
|
||||
-------------------------------------------------------------------
|
||||
| 0 | 0 | 1 | 00 | 1 | S 10 |
|
||||
| 0 | 0 | 1 | 10 | 1 | V 00 |
|
||||
-------------------------------------------------------------------
|
||||
| 0 | 1 | 0 | 0x | 1 | S 10 |
|
||||
| 0 | 1 | 0 | 1x | 1 | S 10 |
|
||||
-------------------------------------------------------------------
|
||||
| 0 | 1 | 1 | 00 | 1 | Z 01 |
|
||||
| 0 | 1 | 1 | 10 | 1 | S 10 |
|
||||
-------------------------------------------------------------------
|
||||
| 1 | 0 | 0 | 1x | 1 | S 10 |
|
||||
| 1 | 0 | 0 | 1x | 1 | S 10 |
|
||||
-------------------------------------------------------------------
|
||||
| 1 | 0 | 1 | 00 | 1 | S 10 |
|
||||
| 1 | 0 | 1 | 10 | 1 | S 10 |
|
||||
-------------------------------------------------------------------
|
||||
| all combinations above | 0 | E 11 |
|
||||
|
||||
*
|
||||
* The J-bit is defined to be the 1-bit binary integer to the left of
|
||||
* the decimal place in the significand.
|
||||
*
|
||||
* The M-bit is defined to be the most significant bit of the fractional
|
||||
* portion of the significand (i.e., the bit immediately to the right of
|
||||
* the decimal place). When the M-bit is the most significant bit of the
|
||||
* fractional portion of the significand, it must be 0 if the fraction
|
||||
* is all 0's.
|
||||
*/
|
||||
|
||||
for (int index = 7; index >= 0; index--, twd <<= 2, tag_byte <<= 1) {
|
||||
if (tag_byte & 0x80) {
|
||||
const floatx80 *fpu_reg = &fpu_state.st_space[index & 7];
|
||||
twd |= FPU_tagof(*fpu_reg);
|
||||
} else {
|
||||
twd |= X87_TAG_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
return (twd >> 2);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_808X_LOG
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user