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 via email to