[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Denormal input handling
From: |
Michael Morrell |
Subject: |
RE: Denormal input handling |
Date: |
Wed, 26 May 2021 21:59:25 +0000 |
First, I apologize for the duplicate thread. I thought the first attempt
didn't go through.
I agree with Richard that we need an extra flag bit. The current behavior is
not right for SSE on x86 (it lopls like x87 might be different still). For
ARM, setting FPCR.FZ to 1 will result in FPSR.IDC being set for a denormal
input (and that input will be flushed to 0), whereas for x86/SSE, setting
MXCSR.DAZ to 0 will result in MXCSR.DE being set for a denormal input (and
MXCSR.DAZ = 1 flushes that input to 0).
I'm a little surprised there are no x86 test cases that cover this.
Richard, are you willing to make the change or do you want me to try?
Thanks,
Michael
-----Original Message-----
From: Peter Maydell <peter.maydell@linaro.org>
Sent: Wednesday, May 26, 2021 1:19 PM
To: Michael Morrell <mmorrell@tachyum.com>
Cc: qemu-devel@nongnu.org; Richard Henderson <richard.henderson@linaro.org>
Subject: Re: Denormal input handling
On Wed, 26 May 2021 at 20:07, Michael Morrell <mmorrell@tachyum.com> wrote:
> I see support in QEMU for architectures which have a denormal input
> flag bit and those that have a "flush inputs to zero" control bit, but
> the implementation is not specializable and seems wrong for x86 at
> least.
> For example, in sf_canonicalize, if the input is denormal and
> "flush_inputs_to_zero" is true, the "input denormal" flag is set and
> then the value is set to a zero value, and if the input is denormal
> and "flush_inputs_to_zero" is false, then the input is simply
> normalized.
This is the intended behaviour -- if a target arch needs "denormalized inputs
should be flushed to zero", it sets the float_status flush_inputs_to_zero flag.
If it also wants to be able to detect when this has happened, it can then look
at the input_denormal flag. This matches the behaviour that Arm needs, and it
is for Arm that the flush_inputs_to_zero and input_denormal flags were
introduced.
> I think the behavior should be for denormal inputs that if
> "flush_inputs_to_zero" is true, then the value is set to zero; and if
> "flush_inputs_to_zero" is false, set the "input denormal"
> flag and normalize the input.
> This matches what x86 does (I'm not sure about other architectures).
What in particular does x86 want that it isn't getting at the moment? If it
needs some additional variation of behaviour we can look at adding a new status
flag to control that.
thanks
-- PMM