public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: <libc-alpha@sourceware.org>, <fweimer@redhat.com>
Subject: Re: [PATCH v3 2/2] x86 long double: Add tests for pseudo normal numbers
Date: Thu, 31 Dec 2020 23:09:15 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2012312258220.929441@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20201224024554.3579622-3-siddhesh@sourceware.org>

On Thu, 24 Dec 2020, Siddhesh Poyarekar via Libc-alpha wrote:

> Add some tests for fpclassify, isnan, isinf and issignaling.

This looks like these tests get duplicated for every floating-point type 
for which they are run.  They should only be run for long double and 
_Float64x; when the libm tests are run for other floating-point types 
(choices of FLOAT), these new tests should be compiled out.

Note that "f" in the test macro names means FLOAT, but these tests seem 
always to test long double, indpendent of the choice of FLOAT, not FLOAT.  
(The second argument of nexttoward is the only case where it's *correct* 
for a math/ test to use long double independent of FLOAT.)

Properly testing _Float64x (i.e. with that as the argument type to the 
macro, not long double, when FLOAT is _Float64x) may need further changes; 
either not using the math_ldbl.h unions but a local union with FLOAT, or 
casting the argument to type FLOAT.

> +/* For pseudo-normal number tests.  */
> +#if HANDLE_PSEUDO_NUMBERS
> +# include <math_ldbl.h>
> +#define pseudo_inf { .parts = { 0x00000000, 0x00000000, 0x7fff }}
> +#define pseudo_zero { .parts = { 0x00000000, 0x00000000, 0x0100 }}
> +#define pseudo_qnan { .parts = { 0x00000001, 0x00000000, 0x7fff }}
> +#define pseudo_snan { .parts = { 0x00000001, 0x40000000, 0x7fff }}
> +#define pseudo_unnormal { .parts = { 0x00000001, 0x40000000, 0x0100 }}

I think the right condition here (and everywhere in this patch) is 
TEST_COND_intel96: a condition on the format for which the tests are being 
run rather than on how glibc is built.  The tests are both specific to 
rules for that format about which encodings are valid (the high bit of the 
significand is unspecified for NaNs and infinities for m68k), and, in the 
form in which they're written here, also specific to little-endian, since 
you're relying on the ordering of initializer elements rather than using 
designated initializers, so wouldn't work on m68k for that reason as well.

If you need to avoid these tests for ia64 because of different rules on 
such encodings for ia64, some other condition might then be used *inside* 
a TEST_COND_intel96 condition.

-- 
Joseph S. Myers
joseph@codesourcery.com

      parent reply	other threads:[~2020-12-31 23:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24  2:45 [PATCH v3 0/2] x86 pseudo-normal numbers Siddhesh Poyarekar
2020-12-24  2:45 ` [PATCH v3 1/2] x86 long double: Consider pseudo numbers as signaling Siddhesh Poyarekar
2020-12-28 16:57   ` Adhemerval Zanella
2020-12-30  5:31     ` [COMMITTED] " Siddhesh Poyarekar
2020-12-31 22:58   ` [PATCH v3 1/2] " Joseph Myers
2020-12-31 23:23     ` Andreas Schwab
2021-01-04  9:30     ` [COMMITTED] Move generic nan-pseudo-number.h to ldbl-96 Siddhesh Poyarekar
2020-12-24  2:45 ` [PATCH v3 2/2] x86 long double: Add tests for pseudo normal numbers Siddhesh Poyarekar
2020-12-28 17:04   ` Adhemerval Zanella
2020-12-31 23:09   ` Joseph Myers [this message]

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.22.394.2012312258220.929441@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).