public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/107370] long double sqrtl constant folding is wrong
Date: Mon, 24 Oct 2022 19:27:26 +0000	[thread overview]
Message-ID: <bug-107370-4-CuRut4uGXd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107370-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On powerpc64le-linux with -O2 -nostdinc -mlong-double-128 -mabi=ieeelongdouble
int main() { __builtin_printf("%.20Lg \n",__builtin_sqrtl(2.0L)); }
we also emit on the trunk:
        .long   325511829
        .long   -922176773
        .long   -429395012
        .long   1073703433
And similarly for:
long double foo (long double x) { return __builtin_hypotl (x, x); }
with -O2 -nostdinc -mlong-double-128 -mabi=ieeelongdouble -ffast-math where we
optimize the hypotl to fabs(x) * M_PI2l (dconst_sqrt2) it is the same constant.
const REAL_VALUE_TYPE *
dconst_sqrt2_ptr (void)
{
  static REAL_VALUE_TYPE value;

  /* Initialize mathematical constants for constant folding builtins.
     These constants need to be given to at least 160 bits precision.  */
  if (value.cl == rvc_zero)
    {
      mpfr_t m;
      mpfr_init2 (m, SIGNIFICAND_BITS);
      mpfr_sqrt_ui (m, 2, MPFR_RNDN);
      real_from_mpfr (&value, m, NULL_TREE, MPFR_RNDN);
      mpfr_clear (m);
    }
  return &value;
}

  parent reply	other threads:[~2022-10-24 19:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24  6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
2022-10-24  6:22 ` [Bug c/107370] " jacob at jacob dot remcomp.fr
2022-10-24 15:19 ` [Bug target/107370] " pinskia at gcc dot gnu.org
2022-10-24 18:33 ` jacob at jacob dot remcomp.fr
2022-10-24 18:40 ` [Bug middle-end/107370] long double sqrtl constant folding is wrong pinskia at gcc dot gnu.org
2022-10-24 19:27 ` jakub at gcc dot gnu.org [this message]
2022-10-24 19:53 ` jacob at jacob dot remcomp.fr
2022-10-24 19:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:00 ` joseph at codesourcery dot com
2022-10-24 20:01 ` jacob at jacob dot remcomp.fr
2022-10-24 20:08 ` jacob at jacob dot remcomp.fr
2022-10-24 20:09 ` jacob at jacob dot remcomp.fr
2022-10-24 20:21 ` jakub at gcc dot gnu.org
2022-10-24 20:25 ` jakub at gcc dot gnu.org
2022-10-24 20:32 ` jakub at gcc dot gnu.org
2022-10-24 20:50 ` jacob at jacob dot remcomp.fr
2022-10-24 20:51 ` jacob at jacob dot remcomp.fr
2022-10-24 20:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:59 ` jacob at jacob dot remcomp.fr
2022-10-24 21:01 ` jacob at jacob dot remcomp.fr
2022-10-24 21:02 ` jakub at gcc dot gnu.org
2022-10-24 21:03 ` jacob at jacob dot remcomp.fr
2022-10-24 21:06 ` jacob at jacob dot remcomp.fr
2022-10-24 21:09 ` jakub at gcc dot gnu.org
2022-10-24 21:26 ` jacob at jacob dot remcomp.fr
2022-10-24 21:29 ` pinskia at gcc dot gnu.org
2022-10-24 21:31 ` pinskia at gcc dot gnu.org

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=bug-107370-4-CuRut4uGXd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).