[0/5] x86 pseudo-normal numbers

Message ID 20201215141339.2684384-1-siddhesh@sourceware.org
Headers
Series x86 pseudo-normal numbers |

Message

Siddhesh Poyarekar Dec. 15, 2020, 2:13 p.m. UTC
  Hi,

Following is the patchset that harmonizes classification of
pseudo-normal numbers with gcc.  Pseudo-NaNs, Pseudo-Infinities and
unnormal numbers are considered as signaling NaN as per classification
since that is how they behave when used as operands in x86.

Pseudo-denormal numbers are not catered for in this patch.  The x86 CPU
supposedly treats these numbers as denormals, but both gcc and glibc
currently treat them as normals.

In summary, the patchset does the following:

- Update fpclassify to cater for pseudo-normal numbers
- Consolidate isnanl so that it can be used by isnanl as well as
  issignalingl.
- Update isnanl logic to return true for all pseudo-normal numbers
- Add an x86-specific issignalingl that returns true for all
  pseudo-normals.

Siddhesh Poyarekar (5):
  x86 long double: Support pseudo numbers in fpclassifyl
  x86 long double: Support pseudo numbers in isnanl
  Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61
  x86 long double: Consider pseudo numbers as signaling
  x86 long double: Add tests for pseudo normal numbers

 sysdeps/i386/fpu/s_fpclassifyl.c         |   4 +
 sysdeps/i386/fpu/s_isnanl.c              |  10 +-
 sysdeps/ieee754/ldbl-96/s_issignalingl.c |   2 -
 sysdeps/x86/fpu/Makefile                 |   3 +-
 sysdeps/x86/fpu/isnanl_common.h          |  32 ++++
 sysdeps/x86/fpu/s_issignalingl.c         |  39 +++++
 sysdeps/x86/fpu/test-unnormal.c          | 196 +++++++++++++++++++++++
 sysdeps/x86/ldbl2mpn.c                   |   8 -
 8 files changed, 275 insertions(+), 19 deletions(-)
 create mode 100644 sysdeps/x86/fpu/isnanl_common.h
 create mode 100644 sysdeps/x86/fpu/s_issignalingl.c
 create mode 100644 sysdeps/x86/fpu/test-unnormal.c
  

Comments

Joseph Myers Dec. 15, 2020, 6:26 p.m. UTC | #1
On Tue, 15 Dec 2020, Siddhesh Poyarekar via Libc-alpha wrote:

> Pseudo-denormal numbers are not catered for in this patch.  The x86 CPU
> supposedly treats these numbers as denormals, but both gcc and glibc
> currently treat them as normals.

The CPU treats them as denormals in that it signals the (x86-specific) 
"denormal operand" exception for them, but otherwise treats them as if the 
biased exponent were 1.  Since the "denormal operand" exception is not 
part of ISO C or FE_ALL_EXCEPT and glibc does not attempt to produce any 
particular semantics for when it is raised, making glibc handle them the 
same as the processor does means handling them the same as the 
corresponding normal representations.
  
Siddhesh Poyarekar Dec. 15, 2020, 6:29 p.m. UTC | #2
On 12/15/20 11:56 PM, Joseph Myers wrote:
> On Tue, 15 Dec 2020, Siddhesh Poyarekar via Libc-alpha wrote:
> 
>> Pseudo-denormal numbers are not catered for in this patch.  The x86 CPU
>> supposedly treats these numbers as denormals, but both gcc and glibc
>> currently treat them as normals.
> 
> The CPU treats them as denormals in that it signals the (x86-specific)
> "denormal operand" exception for them, but otherwise treats them as if the
> biased exponent were 1.  Since the "denormal operand" exception is not
> part of ISO C or FE_ALL_EXCEPT and glibc does not attempt to produce any
> particular semantics for when it is raised, making glibc handle them the
> same as the processor does means handling them the same as the
> corresponding normal representations.

That's perfect, I'll not bother with them anymore then.

Thanks,
Siddhesh