All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Morrell via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Subject: Re: Denormal input handling
Date: Wed, 26 May 2021 19:52:29 +0000 (UTC)	[thread overview]
Message-ID: <1098669241.332748.1622058749094@mail.yahoo.com> (raw)
In-Reply-To: <b6cc921d-afad-9b39-e13a-9789bd873f99@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2098 bytes --]

 Richard,

How is what I suggested wrong for x86? It matches the spec and actual behavior:

== Start quote ==
10.2.3.4 Denormals-Are-Zeros

Bit 6 (DAZ) of the MXCSR register enables the denormals-are-zeros mode, which controls the processor’s response 
to a SIMD floating-point denormal operand condition. When the denormals-are-zeros flag is set, the processor 
converts all denormal source operands to a zero with the sign of the original operand before performing any 
computations on them. The processor does not set the denormal-operand exception flag (DE), regardless of the 
setting of the denormal-operand exception mask bit (DM); and it does not generate a denormal-operand exception 
if the exception is unmasked.
== End quote ==

So, DE should not be set for a denormal input if DAZ is set (it is set only when DAZ is 0 -- the default "IEEE mode").

Can you point me to the ARM documentation?

 Michael
     On Wednesday, May 26, 2021, 12:28:38 PM PDT, Richard Henderson <richard.henderson@linaro.org> wrote:  
 
 On 5/26/21 12:23 PM, Richard Henderson wrote:
> On 5/26/21 12:02 PM, Michael Morrell via wrote:
>> I think the behavior should be for denormal inputs that if 
>> "flush_inputs_to_zero" is true, then set the value to zero (without setting 
>> the "input denormal" flag); 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).
> 
> It is not.
> 
> Intel Architectures SDM Vol 1, Section 11.5.2.2:
>    The denormal operand exception is not affected by
>    flush-to-zero mode.

Ho hum, I misread what you wrote outside the quoted context.

Both your suggestion and the current behaviour are wrong for x86.  The current 
behavior is correct for arm.

What we need are two separate softfloat flags, one for "any denormal seen on 
input" and another for "denormal flushed to zero on input".

The target emulation code then chooses what set of bits needs exporting to 
target architecture state.


r~
  

[-- Attachment #2: Type: text/html, Size: 3198 bytes --]

  reply	other threads:[~2021-05-26 19:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <746277332.296230.1622055775751.ref@mail.yahoo.com>
2021-05-26 19:02 ` Denormal input handling Michael Morrell via
2021-05-26 19:23   ` Richard Henderson
2021-05-26 19:28     ` Richard Henderson
2021-05-26 19:52       ` Michael Morrell via [this message]
2021-05-26 20:15         ` Richard Henderson
2021-05-26 17:37 Michael Morrell
2021-05-26 20:18 ` Peter Maydell
2021-05-26 21:59   ` Michael Morrell
2021-05-27  1:14     ` Richard Henderson
2021-06-21 23:13 ` Michael Morrell
2021-06-21 23:30   ` Richard Henderson
2021-06-21 23:39     ` Michael Morrell
2021-06-22  0:57     ` Michael Morrell
2021-06-22 18:50       ` Michael Morrell

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=1098669241.332748.1622058749094@mail.yahoo.com \
    --to=qemu-devel@nongnu.org \
    --cc=morrell@alumni.ucsd.edu \
    --cc=richard.henderson@linaro.org \
    /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.