gcc/libstdc++-v3/include/bits
Jakub Jelinek a23225fb4f libstdc++: Partial library support for std::float{16,32,64,128}_t and std::bfloat16_t
The following patch is partial support for std::float{16,32,64,128}_t
and std::bfloat16_t in libstdc++.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1467r9.html
says that <ostream>, <istream>, <charconv> and <complex>
need changes toom, but that isn't implemented so far.
In <cmath> the only thing missing I'm aware of is
std::nextafter std::float16_t and std::bfloat16_t overloads (I think
we probably need to implement that out of line somewhere, or inline? - might
need inline asm barriers) and std::nexttoward overloads (those are
intentional, you said there is a LWG issue about that).
Also, this patch has the glibc 2.26+ std::float128_t support for platforms
where long double isn't IEEE quad format temporarily disabled
because it depends on
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html
changes which aren't in yet.

The patch also doesn't include any testcases to cover the <type_traits>
changes, it isn't clear to me where to put that.

2022-10-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106652
	* include/std/stdfloat: New file.
	* include/std/numbers (__glibcxx_numbers): Define and use it
	for __float128 explicit instantiations as well as
	_Float{16,32,64,128} and __gnu_cxx::__bfloat16_t.
	* include/std/atomic (atomic<_Float16>, atomic<_Float32>,
	atomic<_Float64>, atomic<_Float128>, atomic<__gnu_cxx::__bfloat16_t>):
	New explicit instantiations.
	* include/std/type_traits (__is_floating_point_helper<_Float16>,
	__is_floating_point_helper<_Float32>,
	__is_floating_point_helper<_Float64>,
	__is_floating_point_helper<_Float128>,
	__is_floating_point_helper<__gnu_cxx::__bfloat16_t>): Likewise.
	* include/std/limits (__glibcxx_concat3_, __glibcxx_concat3,
	__glibcxx_float_n): Define.
	(numeric_limits<_Float16>, numeric_limits<_Float32>,
	numeric_limits<_Float64>, numeric_limits<_Float128>,
	numeric_limits<__gnu_cxx::__bfloat16_t>): New explicit instantiations.
	* include/bits/std_abs.h (abs): New overloads for
	_Float{16,32,64,128} and __gnu_cxx::__bfloat16_t.
	* include/bits/c++config (_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128): Define
	if long double is IEEE quad.
	(__gnu_cxx::__bfloat16_t): New using.
	* include/c_global/cmath (acos, asin, atan, atan2, ceil, cos, cosh,
	exp, fabs, floor, fmod, frexp, ldexp, log, log10, modf, pow, sin,
	sinh, sqrt, tan, tanh, fpclassify, isfinite, isinf, isnan, isnormal,
	signbit, isgreater, isgreaterequal, isless, islessequal,
	islessgreater, isunordered, acosh, asinh, atanh, cbrt, copysign, erf,
	erfc, exp2, expm1, fdim, fma, fmax, fmin, hypot, ilogb, lgamma,
	llrint, llround, log1p, log2, logb, lrint, lround, nearbyint,
	nextafter, remainder, rint, round, scalbln, scalbn, tgamma, trunc,
	lerp): New overloads with _Float{16,32,64,128} or
	__gnu_cxx::__bfloat16_t types.
	* config/os/gnu-linux/os_defines.h (_GLIBCXX_HAVE_FLOAT128_MATH):
	Prepare for definition if glibc 2.26 and later implements *f128 APIs
	but comment out the actual definition for now.
	* include/ext/type_traits.h (__promote<_Float16>, __promote<_Float32>,
	__promote<_Float64>, __promote<_Float128>,
	__promote<__gnu_cxx::__bfloat16_t>): New specializations.
	* include/Makefile.am (std_headers): Add stdfloat.
	* include/Makefile.in: Regenerated.
	* include/precompiled/stdc++.h: Include stdfloat.
	* testsuite/18_support/headers/stdfloat/types_std.cc: New test.
	* testsuite/18_support/headers/limits/synopsis_cxx23.cc: New test.
	* testsuite/26_numerics/headers/cmath/c99_classification_macros_c++23.cc:
	New test.
	* testsuite/26_numerics/headers/cmath/functions_std_c++23.cc: New test.
	* testsuite/26_numerics/numbers/4.cc: New test.
	* testsuite/29_atomics/atomic_float/requirements_cxx23.cc: New test.
2022-10-18 11:37:13 +02:00
..
algorithmfwd.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
align.h Update copyright years. 2022-01-03 10:42:10 +01:00
alloc_traits.h libstdc++: Simplify detection idiom using concepts 2022-09-24 15:18:11 +01:00
allocated_ptr.h Update copyright years. 2022-01-03 10:42:10 +01:00
allocator.h libstdc++: Move allocator-related helpers to <bits/alloc_traits.h> 2022-09-16 21:35:43 +01:00
atomic_base.h libstdc++: Rename parameter to avoid darwin __weak qualifier 2022-09-09 21:11:14 +01:00
atomic_futex.h Update copyright years. 2022-01-03 10:42:10 +01:00
atomic_timed_wait.h Update copyright years. 2022-01-03 10:42:10 +01:00
atomic_wait.h libstdc++: Unblock atomic wait on non-futex platforms [PR106183] 2022-08-04 13:09:39 +01:00
basic_ios.h Update copyright years. 2022-01-03 10:42:10 +01:00
basic_ios.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
basic_string.h libstdc++: Outline the overlapping case of string _M_replace into a separate function [PR105329] 2022-09-12 11:36:58 +02:00
basic_string.tcc libstdc++: Outline the overlapping case of string _M_replace into a separate function [PR105329] 2022-09-12 11:36:58 +02:00
boost_concept_check.h libstdc++: Fix link failure in _OutputIteratorConcept 2022-02-02 16:30:51 +00:00
c++0x_warning.h Update copyright years. 2022-01-03 10:42:10 +01:00
c++config libstdc++: Partial library support for std::float{16,32,64,128}_t and std::bfloat16_t 2022-10-18 11:37:13 +02:00
char_traits.h libstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074] 2022-07-07 17:38:14 +01:00
charconv.h libstdc++: Implement constexpr std::to_chars for C++23 (P2291R3) 2022-10-15 21:20:47 +01:00
chrono.h libstdc++: Invert relationship between std::is_clock and std::is_clock_v 2022-06-27 11:08:16 +01:00
codecvt.h Update copyright years. 2022-01-03 10:42:10 +01:00
concept_check.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
cow_string.h libstdc++: Add nonnull to starts_with/ends_with/contains string members 2022-08-26 15:29:03 +01:00
cpp_type_traits.h Update copyright years. 2022-01-03 10:42:10 +01:00
deque.tcc libstdc++: Prevent -Wstringop-overread warning in std::deque [PR100516] 2022-01-27 23:31:03 +00:00
enable_special_members.h Update copyright years. 2022-01-03 10:42:10 +01:00
erase_if.h Update copyright years. 2022-01-03 10:42:10 +01:00
forward_list.h Update copyright years. 2022-01-03 10:42:10 +01:00
forward_list.tcc libstdc++: Add self-merge check to std::forward_list::merge [PR103853] 2022-01-06 14:56:48 +00:00
fs_dir.h libstdc++: Add comparisons to std::default_sentinel_t (LWG 3719) 2022-08-04 19:37:56 +01:00
fs_fwd.h libstdc++: Fix filesystem::remove_all races [PR104161] 2022-02-04 19:51:26 +00:00
fs_ops.h libstdc++: Add nodiscard attribute to filesystem operations 2022-07-01 11:50:18 +01:00
fs_path.h libstdc++: Simplify fs::path construction using variable template 2022-06-27 11:08:16 +01:00
fstream.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
functexcept.h libstdc++: Define <bits/functexcept.h> functions for freestanding [PR107135] 2022-10-04 15:03:28 +01:00
functional_hash.h libstdc++: Refactor includes for unordered containers 2022-05-26 10:44:45 +01:00
gslice.h Update copyright years. 2022-01-03 10:42:10 +01:00
gslice_array.h Update copyright years. 2022-01-03 10:42:10 +01:00
hashtable.h libstdc++: [_Hashtable] Insert range of types convertible to value_type PR 105717 2022-06-15 20:21:52 +02:00
hashtable_policy.h libstdc++: [_Hashtable] Insert range of types convertible to value_type PR 105717 2022-06-15 20:21:52 +02:00
indirect_array.h Update copyright years. 2022-01-03 10:42:10 +01:00
invoke.h libstdc++: Guard use of new built-in with __has_builtin 2022-10-05 13:39:28 +01:00
ios_base.h libstdc++: Update value of __cpp_lib_ios_noreplace macro 2022-08-04 13:10:24 +01:00
istream.tcc libstdc++: Avoid some more warnings [PR104019] 2022-01-25 21:05:16 +00:00
iterator_concepts.h libstdc++: Add comparisons to std::default_sentinel_t (LWG 3719) 2022-08-04 19:37:56 +01:00
list.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
locale_classes.h Update copyright years. 2022-01-03 10:42:10 +01:00
locale_classes.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
locale_conv.h Update copyright years. 2022-01-03 10:42:10 +01:00
locale_facets.h Update copyright years. 2022-01-03 10:42:10 +01:00
locale_facets.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
locale_facets_nonio.h libstdc++: Remove whitespace before preprocessor directives 2022-05-12 18:04:01 +01:00
locale_facets_nonio.tcc libstdc++: Work around clang misdesign in time_get<>::get [PR104990] 2022-03-21 11:02:04 +01:00
localefwd.h Update copyright years. 2022-01-03 10:42:10 +01:00
mask_array.h Update copyright years. 2022-01-03 10:42:10 +01:00
max_size_type.h Update copyright years. 2022-01-03 10:42:10 +01:00
memory_resource.h libstdc++: Ensure pmr aliases work without <memory_resource> 2022-05-19 23:38:23 +01:00
memoryfwd.h libstdc++: Add preprocessor conditions for freestanding [PR106953] 2022-09-16 21:47:19 +01:00
mofunc_impl.h libstdc++: Fix typo in doxygen @headerfile command 2022-05-13 13:32:21 +01:00
move.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
move_only_function.h libstdc++: Make std::move_only_function never valueless in std::variant 2022-06-27 11:08:16 +01:00
new_allocator.h libstdc++: Fix indentation in allocator base classes 2022-06-14 21:07:47 +01:00
node_handle.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
ostream.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
ostream_insert.h libstdc++: Improve doxygen docs for algorithms and more 2022-05-13 13:32:22 +01:00
parse_numbers.h Update copyright years. 2022-01-03 10:42:10 +01:00
postypes.h Update copyright years. 2022-01-03 10:42:10 +01:00
predefined_ops.h Update copyright years. 2022-01-03 10:42:10 +01:00
ptr_traits.h libstdc++: Update std::pointer_traits to match new LWG 3545 wording 2022-09-26 23:47:37 +01:00
quoted_string.h Update copyright years. 2022-01-03 10:42:10 +01:00
random.h libstdc++: Refactor seed sequence constraints in <random> 2022-10-04 17:42:59 +01:00
random.tcc libstdc++: Simplify std::normal_distribution equality operator 2022-05-06 23:54:09 +01:00
range_access.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
ranges_algo.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
ranges_algobase.h libstdc++: Remove some unnecessary includes 2022-05-26 10:44:45 +01:00
ranges_base.h libstdc++: Add <initializer_list> to ranges_base.h header 2022-09-21 08:42:00 +01:00
ranges_cmp.h libstdc++: Implement P2415R2 changes to viewable_range / views::all 2022-02-22 09:37:58 -05:00
ranges_uninitialized.h Update copyright years. 2022-01-03 10:42:10 +01:00
ranges_util.h libstdc++: Implement ranges::chunk_by_view from P2443R1 2022-09-15 13:16:51 -04:00
refwrap.h libstdc++: Add noexcept-specifier to std::reference_wrapper::operator() 2022-08-31 14:28:03 +01:00
regex.h libstdc++: Add comparisons to std::default_sentinel_t (LWG 3719) 2022-08-04 19:37:56 +01:00
regex.tcc libstdc++: Reduce template instantiations in <regex> 2022-01-05 13:47:01 +00:00
regex_automaton.h Update copyright years. 2022-01-03 10:42:10 +01:00
regex_automaton.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
regex_compiler.h libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984] 2022-03-01 15:25:39 +00:00
regex_compiler.tcc libstdc++: Check for overflow in regex back-reference [PR106607] 2022-08-22 22:52:24 +01:00
regex_constants.h libstdc++: Improve doxygen docs for <regex> 2022-05-13 13:32:22 +01:00
regex_error.h libstdc++: Improve doxygen docs for <regex> 2022-05-13 13:32:22 +01:00
regex_executor.h Update copyright years. 2022-01-03 10:42:10 +01:00
regex_executor.tcc libstdc++: Reduce template instantiations in <regex> 2022-01-05 13:47:01 +00:00
regex_scanner.h Update copyright years. 2022-01-03 10:42:10 +01:00
regex_scanner.tcc libstdc++: Improve std::regex_error::what() strings 2022-01-05 13:47:00 +00:00
requires_hosted.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
semaphore_base.h Update copyright years. 2022-01-03 10:42:10 +01:00
shared_ptr.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
shared_ptr_atomic.h libstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>> 2022-09-15 21:04:36 +01:00
shared_ptr_base.h libstdc++: Avoid some more warnings [PR104019] 2022-01-25 21:05:16 +00:00
slice_array.h Update copyright years. 2022-01-03 10:42:10 +01:00
specfun.h libstdc++: Do not use #include inside push visibility scope [PR99871] 2022-05-06 14:43:39 +01:00
sstream.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
std_abs.h libstdc++: Partial library support for std::float{16,32,64,128}_t and std::bfloat16_t 2022-10-18 11:37:13 +02:00
std_function.h libstdc++: Shuffle header dependencies of <functional> 2022-10-07 12:55:33 +01:00
std_mutex.h libstdc++: Improve doxygen docs for <mutex> 2022-05-13 13:32:23 +01:00
std_thread.h libstdc++: Fix for explicit copy ctors in <thread> and <future> [PR106695] 2022-08-22 22:52:24 +01:00
stl_algo.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
stl_algobase.h libstdc++: Add preprocessor conditions for freestanding [PR106953] 2022-09-16 21:47:19 +01:00
stl_bvector.h libstdc++: Implement std::pair/tuple/misc enhancements from P2321R2 2022-08-23 13:42:37 -04:00
stl_construct.h libstdc++: Ignore cv-quals when std::allocator<void> constructs 2022-01-14 10:14:25 +00:00
stl_deque.h libstdc++: Avoid -Wzero-as-null-pointer-constant warning [PR103848] 2022-01-05 13:47:02 +00:00
stl_function.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
stl_heap.h libstdc++: Make headers include their prerequisites 2022-05-26 10:44:45 +01:00
stl_iterator.h libstdc++: Tweak common_iterator::operator-> return type [PR104443] 2022-07-29 10:10:00 +01:00
stl_iterator_base_funcs.h libstdc++: Make headers include their prerequisites 2022-05-26 10:44:45 +01:00
stl_iterator_base_types.h libstdc++: Add attribute to features deprecated in C++17 [PR91260] 2022-01-14 11:27:50 +00:00
stl_list.h libstdc++: Remove __alloc_neq helper 2022-09-16 15:54:41 +01:00
stl_map.h libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677) 2022-10-15 21:17:48 +01:00
stl_multimap.h libstdc++: Add attribute to features deprecated in C++17 [PR91260] 2022-01-14 11:27:50 +00:00
stl_multiset.h Update copyright years. 2022-01-03 10:42:10 +01:00
stl_numeric.h libstdc++: Improve doxygen docs for algorithms and more 2022-05-13 13:32:22 +01:00
stl_pair.h libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677) 2022-10-15 21:17:48 +01:00
stl_queue.h Update copyright years. 2022-01-03 10:42:10 +01:00
stl_raw_storage_iter.h libstdc++: Add attribute to features deprecated in C++17 [PR91260] 2022-01-14 11:27:50 +00:00
stl_relops.h Update copyright years. 2022-01-03 10:42:10 +01:00
stl_set.h Update copyright years. 2022-01-03 10:42:10 +01:00
stl_stack.h Update copyright years. 2022-01-03 10:42:10 +01:00
stl_tempbuf.h libstdc++: Make more internal headers include their own dependencies 2022-09-16 21:23:24 +01:00
stl_tree.h libstdc++: Ensure all feature test macros have type long [PR87193] 2022-01-21 16:07:34 +00:00
stl_uninitialized.h libstdc++: Add preprocessor conditions for freestanding [PR106953] 2022-09-16 21:47:19 +01:00
stl_vector.h libstdc++: Fix missing and incorrect feature test macros [PR105269] 2022-04-14 11:02:37 +01:00
stream_iterator.h libstdc++: Make more internal headers include their own dependencies 2022-09-16 21:23:24 +01:00
streambuf.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
streambuf_iterator.h libstdc++: Make more internal headers include their own dependencies 2022-09-16 21:23:24 +01:00
string_view.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
stringfwd.h Update copyright years. 2022-01-03 10:42:10 +01:00
this_thread_sleep.h libstdc++: Move closing brace outside #endif [PR104866] 2022-03-10 21:04:01 +00:00
uniform_int_dist.h Update copyright years. 2022-01-03 10:42:10 +01:00
unique_lock.h libstdc++: Improve doxygen docs for <mutex> 2022-05-13 13:32:23 +01:00
unique_ptr.h c++: implement __remove_cv, __remove_reference and __remove_cvref 2022-09-29 09:18:40 -04:00
unordered_map.h libstdc++: Refactor includes for unordered containers 2022-05-26 10:44:45 +01:00
unordered_set.h libstdc++: Refactor includes for unordered containers 2022-05-26 10:44:45 +01:00
uses_allocator.h Update copyright years. 2022-01-03 10:42:10 +01:00
uses_allocator_args.h libstdc++: Fix uses_allocator_construction args for cv pair (LWG 3677) 2022-10-15 21:17:48 +01:00
utility.h libstdc++: Prefer const T to std::add_const_t<T> 2022-07-12 09:13:45 +01:00
valarray_after.h Update copyright years. 2022-01-03 10:42:10 +01:00
valarray_array.h Update copyright years. 2022-01-03 10:42:10 +01:00
valarray_array.tcc Update copyright years. 2022-01-03 10:42:10 +01:00
valarray_before.h Update copyright years. 2022-01-03 10:42:10 +01:00
vector.tcc Update copyright years. 2022-01-03 10:42:10 +01:00