From: Joseph Myers <joseph@codesourcery.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com,
rth@twiddle.net
Subject: Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising
Date: Tue, 19 May 2020 18:12:10 +0000 [thread overview]
Message-ID: <alpine.DEB.2.21.2005191757210.10766@digraph.polyomino.org.uk> (raw)
In-Reply-To: <5dd2d81c-cedd-7835-6b3c-7e089254dc95@linaro.org>
On Tue, 19 May 2020, Richard Henderson wrote:
> To retain the hard float fast path, we need to leave float_flag_invalid set
> when the accrued exception bit is set. To me this suggests keep all of the
> FPUS_* bits in fp_status and only convert to FPUS_* when we read the fp status
> word.
There is no hard float fast path that I can see for floatx80. The issue
of the fast path might be relevant for fixing SSE exception handling
(which has some similar issues to x87), but not for floatx80.
Note that another bug in the x87 emulation is the lack of setting C1 for
most instructions with inexact results based on the direction of rounding
(which will require a new feature to be added to the softfloat code to
record that information so the x87 emulation can use it).
> When it comes to raising unmasked exceptions... I have a couple of thoughts.
I expect some code will be needed in each individual instruction
implementation, and probably extra softfloat code, to handle unmasked
exceptions. Some exceptions, when unmasked, should result in instructions
not popping inputs from the stack and not updating destinations. The
softfloat case needs to provide information about the exact underflow case
that targets can use when that exception is set to trap. x87 overflow and
underflow, when unmasked and with a register destination, are supposed to
compute and store a result with a biased exponent for use by the trap
handler. The code will also need to know exactly which instructions
should result in a trap handler being called rather than only doing it for
fwait. Stack underflow and overflow need to be checked for, regardless of
exception masking. (There are other issues relating to trapped exception
handling as well, but that's a summary of the main ones I've noticed.)
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2020-05-19 18:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 21:19 [PATCH 0/2] target/i386: x87 exceptions fixes Joseph Myers
2020-05-15 21:20 ` [PATCH 1/2] target/i386: fix fisttpl, fisttpll handling of out-of-range values Joseph Myers
2020-05-15 21:21 ` [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising Joseph Myers
2020-05-19 17:43 ` Richard Henderson
2020-05-19 18:12 ` Joseph Myers [this message]
2020-05-19 18:24 ` Richard Henderson
2020-05-19 18:28 ` Joseph Myers
2021-05-20 17:38 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2005191757210.10766@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.