public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types
@ 2020-08-07 15:56 redi at gcc dot gnu.org
2020-08-07 19:01 ` [Bug c++/96526] " joseph at codesourcery dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-07 15:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96526
Bug ID: 96526
Summary: New built-in needed to implement std::strong_order
total order on floating point types
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
https://wg21.link/cmp.alg#1.3 requires a total order for floating point types,
which includes ordering NaNs and infinities, and must be usable in constant
expressions.
The most robust way to do that is probably to make the compiler know how to do
it, possibly using mpfr_total_order_p from MPFR 4.1.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96526] New built-in needed to implement std::strong_order total order on floating point types
2020-08-07 15:56 [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types redi at gcc dot gnu.org
@ 2020-08-07 19:01 ` joseph at codesourcery dot com
2022-03-01 15:40 ` [Bug libstdc++/96526] " redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2020-08-07 19:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96526
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
You could define __builtin_totalorder functions, but watch out for the
change made to totalorder functions following a TS 18661-1 clarification
request, from floating-point argument types to pointer argument types (so
you'd need to handle all the cases of libm not having the functions, libm
having them with the old prototypes as in glibc 2.25 through 2.30, libm
having them with the new prototypes as in glibc 2.31 and later).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/96526] New built-in needed to implement std::strong_order total order on floating point types
2020-08-07 15:56 [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types redi at gcc dot gnu.org
2020-08-07 19:01 ` [Bug c++/96526] " joseph at codesourcery dot com
@ 2022-03-01 15:40 ` redi at gcc dot gnu.org
2022-03-03 22:35 ` [Bug libstdc++/96526] " cvs-commit at gcc dot gnu.org
2022-03-03 22:40 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-01 15:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96526
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2022-03-01
Component|c++ |libstdc++
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Now that we have __builtin_bit_cast I think this can be done entirely as C++
library code, so re-assigning.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/96526] implement std::strong_order total order on floating point types
2020-08-07 15:56 [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types redi at gcc dot gnu.org
2020-08-07 19:01 ` [Bug c++/96526] " joseph at codesourcery dot com
2022-03-01 15:40 ` [Bug libstdc++/96526] " redi at gcc dot gnu.org
@ 2022-03-03 22:35 ` cvs-commit at gcc dot gnu.org
2022-03-03 22:40 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-03 22:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96526
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:9805965e3551b66b5bd751d6076791d00cdeb137
commit r12-7468-g9805965e3551b66b5bd751d6076791d00cdeb137
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Mar 3 12:34:27 2022 +0000
libstdc++: Implement std::strong_order for floating-point types [PR96526]
This removes a FIXME in <compare>, defining the total order for
floating-point types. I originally opened PR96526 to request a new
compiler built-in to implement this, but now that we have std::bit_cast
it can be done entirely in the library.
The implementation is based on the glibc definitions of totalorder,
totalorderf, totalorderl etc.
I think this works for all the types that satisfy std::floating_point
today, and should also work for the types expected to be added by P1467
except for std::bfloat16_t. It also supports some additional types that
don't currently satisfy std::floating_point, such as __float80, but we
probably do want that to satisfy the concept for non-strict modes.
libstdc++-v3/ChangeLog:
PR libstdc++/96526
* libsupc++/compare (strong_order): Add missing support for
floating-point types.
*
testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/96526] implement std::strong_order total order on floating point types
2020-08-07 15:56 [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types redi at gcc dot gnu.org
` (2 preceding siblings ...)
2022-03-03 22:35 ` [Bug libstdc++/96526] " cvs-commit at gcc dot gnu.org
@ 2022-03-03 22:40 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-03 22:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96526
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 12. I might backport this to gcc-11 later.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-03 22:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 15:56 [Bug c++/96526] New: New built-in needed to implement std::strong_order total order on floating point types redi at gcc dot gnu.org
2020-08-07 19:01 ` [Bug c++/96526] " joseph at codesourcery dot com
2022-03-01 15:40 ` [Bug libstdc++/96526] " redi at gcc dot gnu.org
2022-03-03 22:35 ` [Bug libstdc++/96526] " cvs-commit at gcc dot gnu.org
2022-03-03 22:40 ` redi at gcc dot gnu.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).