Among the various bugs in the x87 floating-point emulation that show up through a combination of glibc testing and code inspection, there are several in the implementations of the fxtract and fscale instructions. This series fixes those bugs.
Bugs in other instructions, and bugs relating to floating-point exceptions and flag setting, will be addressed separately. In particular, while some of these patches add code that sets exception flags in the softfloat state, it's generally the case that the x87 emulation ignores exceptions in that state rather than propagating them to the status word (and to generating traps where appropriate). I intend to address that missing propagation of exceptions in a subsequent patch series; until it's addressed, the code setting exceptions won't actually do anything useful. (There is also code in the x87 emulation, including that of fscale, that would result in spurious exceptions being set from a naive propagation of exceptions from the softfloat state, and thus will need updating to avoid propagating inappropriate exceptions when such propagation is implemented.) Joseph Myers (5): target/i386: implement special cases for fxtract target/i386: fix fscale handling of signaling NaN target/i386: fix fscale handling of invalid exponent encodings target/i386: fix fscale handling of infinite exponents target/i386: fix fscale handling of rounding precision target/i386/fpu_helper.c | 59 +++++++++++++- tests/tcg/i386/test-i386-fscale.c | 108 ++++++++++++++++++++++++++ tests/tcg/i386/test-i386-fxtract.c | 120 +++++++++++++++++++++++++++++ 3 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/i386/test-i386-fscale.c create mode 100644 tests/tcg/i386/test-i386-fxtract.c -- 2.17.1 -- Joseph S. Myers jos...@codesourcery.com