public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>,
	GCC patches <gcc-patches@gcc.gnu.org>,
	 Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [PATCH] [range-ops] Implement sqrt.
Date: Mon, 14 Nov 2022 08:45:28 +0100	[thread overview]
Message-ID: <CAGm3qMXPO7Q8V406-RvKQJ1Ozqh5CziksuX_-jrsSbZVpt2oew@mail.gmail.com> (raw)
In-Reply-To: <Y3FV51Pds4bllqvD@tucnak>

On Sun, Nov 13, 2022 at 9:39 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Sun, Nov 13, 2022 at 09:05:53PM +0100, Aldy Hernandez wrote:
> > It seems SQRT is relatively straightforward, and it's something Jakub
> > wanted for this release.
> >
> > Jakub, what do you think?
> >
> > p.s. Too tired to think about op1_range.
>
> That would be multiplication of the same value twice, i.e.
> fop_mult with trio that has op1_op2 () == VREL_EQ?
> But see below, as sqrt won't be always precise, we need to account for
> some errors.
>
> > gcc/ChangeLog:
> >
> >       * gimple-range-op.cc (class cfn_sqrt): New.
> >       (gimple_range_op_handler::maybe_builtin_call): Add cases for sqrt.
>
> Yes, I'd like to see SQRT support in.
> The only thing I'm worried is that unlike {+,-,*,/}, negation etc. typically
> implemented in hardware or precise soft-float, sqrt is often implemented
> in library using multiple floating point arithmetic functions.  And different
> implementations have different accuracy.
>
> So, I wonder if we don't need to add a target hook where targets will be
> able to provide upper bound on error for floating point functions for
> different floating point modes and some way to signal unknown accuracy/can't
> be trusted, in which case we would give up or return just the range for
> VARYING.
> Then, we could write some tests that say in a loop constructs random
> floating point values (perhaps sanitized to be non-NAN), calls libm function
> and the same mpfr one and return maximum error in ulps.
> And then record those, initially for glibc and most common targets and
> gradually maintainers could supply more.
>
> If we add an infrastructure for that within a few days, then we could start
> filling the details.  One would hope that sqrt has < 10ulps accuracy if not
> already the 0.5ulp one, but for various other functions I think it can be

I don't know what would possess me to think that sqrt would be easy
;-).  Sure, I can sink a few days to flesh this out if you're willing
to review it.

Aldy


  reply	other threads:[~2022-11-14  7:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13 20:05 Aldy Hernandez
2022-11-13 20:39 ` Jakub Jelinek
2022-11-14  7:45   ` Aldy Hernandez [this message]
2022-11-14 14:30     ` Jeff Law
2022-11-14 14:35       ` Jakub Jelinek
2022-11-14 14:48         ` Jeff Law
2022-11-14 15:01         ` Aldy Hernandez
2022-11-14 21:55   ` Joseph Myers
2022-11-16 20:32     ` Jakub Jelinek
2022-11-17 16:40       ` Aldy Hernandez
2022-11-17 16:48         ` Aldy Hernandez
2022-11-17 17:42           ` Aldy Hernandez
2022-11-17 18:59         ` Joseph Myers
2022-11-17 19:37           ` Jakub Jelinek
2022-11-17 20:43             ` Joseph Myers
2022-11-18  8:39             ` Richard Biener
2022-11-18 10:37               ` Aldy Hernandez
2022-11-18 10:44                 ` Jakub Jelinek
2022-11-18 11:20                   ` Aldy Hernandez
2022-11-18 11:57                     ` Aldy Hernandez
2022-11-18 12:14                   ` Richard Biener

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=CAGm3qMXPO7Q8V406-RvKQJ1Ozqh5CziksuX_-jrsSbZVpt2oew@mail.gmail.com \
    --to=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    /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).