public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
@ 2022-03-09 17:53 ` redi at gcc dot gnu.org
  2022-03-09 18:05 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-09 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this should be rejects-valid not a missed-optimization enhancement. For
C++20 we reject valid code:

#include <limits>
constexpr long double x = 1.0L + std::numeric_limits<long double>::epsilon();

<stdin>:1:32: error: ‘(1.0e+0l + 4.94065645841246544176568792868221e-324l)’ is
not a constant expression


The code reduces to:

constexpr long double x = 1.0L + __LDBL_EPSILON__;

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
  2022-03-09 17:53 ` [Bug middle-end/19779] IBM 128bit long double format is not constant folded redi at gcc dot gnu.org
@ 2022-03-09 18:05 ` jakub at gcc dot gnu.org
  2022-03-09 18:14 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-09 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We do fold it with -ffast-math or -funsafe-math-optimizations.
PR19405 explains the reasons why we can't fold those results that aren't
exactly representable in double double.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
  2022-03-09 17:53 ` [Bug middle-end/19779] IBM 128bit long double format is not constant folded redi at gcc dot gnu.org
  2022-03-09 18:05 ` jakub at gcc dot gnu.org
@ 2022-03-09 18:14 ` redi at gcc dot gnu.org
  2022-05-12  9:27 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-09 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yeah, I'm not asking for it to be fixed, just noting here that it affects C++
constant expressions.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-03-09 18:14 ` redi at gcc dot gnu.org
@ 2022-05-12  9:27 ` pinskia at gcc dot gnu.org
  2022-11-18  9:14 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-12  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liushuyu011 at gmail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 105578 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-05-12  9:27 ` pinskia at gcc dot gnu.org
@ 2022-11-18  9:14 ` pinskia at gcc dot gnu.org
  2024-02-19 10:08 ` vital.had at gmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-18  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Sebastian at SSpaeth dot de

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107745 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-11-18  9:14 ` pinskia at gcc dot gnu.org
@ 2024-02-19 10:08 ` vital.had at gmail dot com
  2024-02-19 10:12 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: vital.had at gmail dot com @ 2024-02-19 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Sergey Fedorov <vital.had at gmail dot com> ---
(In reply to Andrew Pinski from comment #0)
> This is the new bug for PR 19405. Keeping track of that we no longer
> constant fold long doubles in the 
> IBM 128bit long double format.

What is the current status of the issue?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2024-02-19 10:08 ` vital.had at gmail dot com
@ 2024-02-19 10:12 ` jakub at gcc dot gnu.org
  2024-02-19 10:13 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-19 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Unlikely to be ever fixed, at least Linux has migrated to IEEE quad long double
on powerpc64le.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2024-02-19 10:12 ` jakub at gcc dot gnu.org
@ 2024-02-19 10:13 ` pinskia at gcc dot gnu.org
  2024-02-19 10:18 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-19 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sergey Fedorov from comment #6)
> (In reply to Andrew Pinski from comment #0)
> > This is the new bug for PR 19405. Keeping track of that we no longer
> > constant fold long doubles in the 
> > IBM 128bit long double format.
> 
> What is the current status of the issue?

Nothing has changed here that much. Though powerpc64 le is heading towards
doing IEEE 128bit FP by default so this might be much much less of an issue for
most people which means this is more likely never get fixed.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2024-02-19 10:13 ` pinskia at gcc dot gnu.org
@ 2024-02-19 10:18 ` iains at gcc dot gnu.org
  2024-02-19 10:32 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: iains at gcc dot gnu.org @ 2024-02-19 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Sergey Fedorov from comment #6)
> > (In reply to Andrew Pinski from comment #0)
> > > This is the new bug for PR 19405. Keeping track of that we no longer
> > > constant fold long doubles in the 
> > > IBM 128bit long double format.
> > 
> > What is the current status of the issue?
> 
> Nothing has changed here that much. Though powerpc64 le is heading towards
> doing IEEE 128bit FP by default so this might be much much less of an issue
> for most people which means this is more likely never get fixed.

it occasionally causes grief, but so far there's been a work-around; I guess if
someone really wanted to make a patch - they'd have to use MPFR et. al. to do
the work.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2024-02-19 10:18 ` iains at gcc dot gnu.org
@ 2024-02-19 10:32 ` jakub at gcc dot gnu.org
  2024-02-19 19:11 ` vital.had at gmail dot com
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-19 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #9)
> (In reply to Andrew Pinski from comment #8)
> > (In reply to Sergey Fedorov from comment #6)
> > > (In reply to Andrew Pinski from comment #0)
> > > > This is the new bug for PR 19405. Keeping track of that we no longer
> > > > constant fold long doubles in the 
> > > > IBM 128bit long double format.
> > > 
> > > What is the current status of the issue?
> > 
> > Nothing has changed here that much. Though powerpc64 le is heading towards
> > doing IEEE 128bit FP by default so this might be much much less of an issue
> > for most people which means this is more likely never get fixed.
> 
> it occasionally causes grief, but so far there's been a work-around; I guess
> if someone really wanted to make a patch - they'd have to use MPFR et. al.
> to do the work.

MPFR won't really help, after all, it doesn't have any double double arithmetic
support at all.
The problem is that real.cc pretends that IBM double double is a sane floating
point format with 106bit precision, which is not the case.
In GCC, basic floating point operations are performed by performing stuff in
the GCC internal format, which is something with sufficient precision and
exponent range to cover all the sane supported formats including some extra
precision bits and then converting that to the appropriate mode.
That doesn't work for double double, which has precision between 53 to some
thousands bits of precision, so in order to emulate in the compiler basic
floating point, it would need to be handled like it is actually at runtime,
which is hold the REAL_CST/CONST_DOUBLE double double values as a pair of
DFmode values rather than a single real_internal_format value (because the
latter can't express all the double double values), perform whatever
__gcc_qadd/__gcc_qsub/__gcc_qmul/__gcc_qdiv etc. perform at runtime on the
DFmode values, etc.  And then there is a question what to do about emulation of
libm functions - how to map that e.g. to mpfr operations, because what libm
actually does for those is sometimes quite weird and hard to define.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2024-02-19 10:32 ` jakub at gcc dot gnu.org
@ 2024-02-19 19:11 ` vital.had at gmail dot com
  2024-02-19 19:19 ` redi at gcc dot gnu.org
  2024-02-19 19:21 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 15+ messages in thread
From: vital.had at gmail dot com @ 2024-02-19 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Sergey Fedorov <vital.had at gmail dot com> ---
(In reply to Jakub Jelinek from comment #7)
> Unlikely to be ever fixed, at least Linux has migrated to IEEE quad long
> double on powerpc64le.

Perhaps several *BSDs and AIX are using IBM format though.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2024-02-19 19:11 ` vital.had at gmail dot com
@ 2024-02-19 19:19 ` redi at gcc dot gnu.org
  2024-02-19 19:21 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2024-02-19 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Then the maintainers or users of those targets should consider contributing a
fix.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2024-02-19 19:19 ` redi at gcc dot gnu.org
@ 2024-02-19 19:21 ` jakub at gcc dot gnu.org
  12 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-19 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Nobody is blocking proper double double evaluation support.  But somebody needs
to do the work, spend a few weeks on it and submit that.  I'm just saying that
is highly unlikely.  If somebody was really bothered about that there wouldn't
be 19 years of it being unfixed.  More so in the years when it was the typical
long double on Linux powerpc64le as well.  It is still the usually supported
long double on Linux powerpc64 and powerpc, but those are rarely used these
days.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <20050203154757.19779.pinskia@gcc.gnu.org>
  2005-02-08 16:43 ` steven at gcc dot gnu dot org
@ 2005-02-20 19:41 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-20 19:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-20 14:18:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19779


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19779] IBM 128bit long double format is not constant folded.
       [not found] <20050203154757.19779.pinskia@gcc.gnu.org>
@ 2005-02-08 16:43 ` steven at gcc dot gnu dot org
  2005-02-20 19:41 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-02-08 16:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|IBM 128bit long double      |IBM 128bit long double
                   |format is not constant      |format is not constant
                   |foldded.                    |folded.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19779


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-19 19:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19779-4@http.gcc.gnu.org/bugzilla/>
2022-03-09 17:53 ` [Bug middle-end/19779] IBM 128bit long double format is not constant folded redi at gcc dot gnu.org
2022-03-09 18:05 ` jakub at gcc dot gnu.org
2022-03-09 18:14 ` redi at gcc dot gnu.org
2022-05-12  9:27 ` pinskia at gcc dot gnu.org
2022-11-18  9:14 ` pinskia at gcc dot gnu.org
2024-02-19 10:08 ` vital.had at gmail dot com
2024-02-19 10:12 ` jakub at gcc dot gnu.org
2024-02-19 10:13 ` pinskia at gcc dot gnu.org
2024-02-19 10:18 ` iains at gcc dot gnu.org
2024-02-19 10:32 ` jakub at gcc dot gnu.org
2024-02-19 19:11 ` vital.had at gmail dot com
2024-02-19 19:19 ` redi at gcc dot gnu.org
2024-02-19 19:21 ` jakub at gcc dot gnu.org
     [not found] <20050203154757.19779.pinskia@gcc.gnu.org>
2005-02-08 16:43 ` steven at gcc dot gnu dot org
2005-02-20 19:41 ` pinskia at gcc dot gnu dot org

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).