public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110011] -mfull-toc (-mfp-in-toc) yields incorrect _Float128 constants on power9
Date: Sun, 28 May 2023 03:41:11 +0000	[thread overview]
Message-ID: <bug-110011-4-nsTwwwB302@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110011-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|-mfull-toc yields incorrect |-mfull-toc (-mfp-in-toc)
                   |_Float128 constants on      |yields incorrect _Float128
                   |power9                      |constants on power9
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-28

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-mfull-toc does
```
      opts->x_rs6000_isa_flags &= ~OPTION_MASK_MINIMAL_TOC;
      opts->x_TARGET_NO_FP_IN_TOC = 0;
      opts->x_TARGET_NO_SUM_IN_TOC = 0;
      opts_set->x_rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC;
```
And then:
```
  /* Place FP constants in the constant pool instead of TOC
     if section anchors enabled.  */
  if (flag_section_anchors
      && !OPTION_SET_P (TARGET_NO_FP_IN_TOC))
    TARGET_NO_FP_IN_TOC = 1;
```


Short testcase which shows the issue at -O2 -mfull-toc (or -O2 -mfp-in-toc):
```
#define MPFR_FLOAT128_MAX 0x1.ffffffffffffffffffffffffffffp+16383f128
  _Float128 m1 = MPFR_FLOAT128_MAX, n1 = -MPFR_FLOAT128_MAX;

  _Float128 f()
  {
        return MPFR_FLOAT128_MAX ;
  }

  _Float128 f1()
  {
        return -MPFR_FLOAT128_MAX ;
  }
```

m1 is:
```
m1:
        .long   -1
        .long   -1
        .long   -1
        .long   2147418111
```
While the toc version is:
```
.LC0:
        .quad   0x7ff0000000000000,0x000000000
```

That is just totally different. (I can't comment on which one is correct but
them being different seems wrong).

  reply	other threads:[~2023-05-28  3:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28  0:32 [Bug target/110011] New: -mfull-toc " vincent-gcc at vinc17 dot net
2023-05-28  3:41 ` pinskia at gcc dot gnu.org [this message]
2023-05-28  3:54 ` [Bug target/110011] -mfull-toc (-mfp-in-toc) " pinskia at gcc dot gnu.org
2023-05-30  6:47 ` linkw at gcc dot gnu.org
2023-05-30  7:51 ` vincent-gcc at vinc17 dot net
2023-05-30  8:09 ` linkw at gcc dot gnu.org
2023-05-30  8:11 ` linkw at gcc dot gnu.org
2023-06-12  6:10 ` cvs-commit at gcc dot gnu.org
2023-06-19  9:29 ` cvs-commit at gcc dot gnu.org
2023-06-20  3:20 ` cvs-commit at gcc dot gnu.org
2023-06-20  3:21 ` cvs-commit at gcc dot gnu.org
2023-06-20  8:24 ` cvs-commit at gcc dot gnu.org
2023-06-20  8:27 ` LpSolit at gmail dot com

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-110011-4-nsTwwwB302@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).