[libc++] Implements 128-bit support in to_chars.This is required by the Standard and makes it possible to add full128-bit support to format.The patch also fixes 128-bit from_chars "support". One
[libc++] Implements 128-bit support in to_chars.This is required by the Standard and makes it possible to add full128-bit support to format.The patch also fixes 128-bit from_chars "support". One unit testrequired a too large value, this failed on 128-bit; the fix was to addmore characters to the input.Note only base 10 has been optimized. Other bases can be optimized.Note the 128-bit lookup table could be made smaller. This will be done later. Ireally want to get 128-bit working in to_chars and format in the upcommingLLVM 15 release, these optimizations aren't critical.Reviewed By: #libc, ldionneDifferential Revision: https://reviews.llvm.org/D128929
show more ...
[libc++] Improve charconv base10 algorithm.This change is a preparation to add the 128-bit integral output.Before```--------------------------------------------------------------Benchmark
[libc++] Improve charconv base10 algorithm.This change is a preparation to add the 128-bit integral output.Before```--------------------------------------------------------------Benchmark Time CPU Iterations--------------------------------------------------------------BM_to_chars_good/2 20.1 ns 20.1 ns 35045000BM_to_chars_good/3 117 ns 117 ns 5916000BM_to_chars_good/4 83.7 ns 83.7 ns 8401000BM_to_chars_good/5 70.6 ns 70.6 ns 9915000BM_to_chars_good/6 59.9 ns 59.9 ns 11678000BM_to_chars_good/7 53.9 ns 53.8 ns 12995000BM_to_chars_good/8 19.0 ns 19.0 ns 37110000BM_to_chars_good/9 45.9 ns 45.8 ns 15278000BM_to_chars_good/10 9.24 ns 9.24 ns 75343000BM_to_chars_good/11 42.6 ns 42.6 ns 16449000BM_to_chars_good/12 38.8 ns 38.8 ns 18101000BM_to_chars_good/13 38.8 ns 38.8 ns 17999000BM_to_chars_good/14 37.7 ns 37.6 ns 18571000BM_to_chars_good/15 35.8 ns 35.8 ns 19660000BM_to_chars_good/16 15.4 ns 15.4 ns 46129000BM_to_chars_good/17 32.3 ns 32.3 ns 21763000BM_to_chars_good/18 32.8 ns 32.8 ns 21396000BM_to_chars_good/19 33.4 ns 33.4 ns 21078000BM_to_chars_good/20 33.3 ns 33.3 ns 21020000BM_to_chars_good/21 32.3 ns 32.3 ns 21807000BM_to_chars_good/22 31.6 ns 31.6 ns 22057000BM_to_chars_good/23 30.7 ns 30.7 ns 22938000BM_to_chars_good/24 28.3 ns 28.3 ns 24659000BM_to_chars_good/25 28.2 ns 28.2 ns 24790000BM_to_chars_good/26 28.4 ns 28.4 ns 24410000BM_to_chars_good/27 28.7 ns 28.7 ns 24423000BM_to_chars_good/28 28.9 ns 28.9 ns 24139000BM_to_chars_good/29 28.9 ns 28.9 ns 24347000BM_to_chars_good/30 29.2 ns 29.2 ns 24141000BM_to_chars_good/31 29.6 ns 29.6 ns 23699000BM_to_chars_good/32 29.5 ns 29.5 ns 23933000BM_to_chars_good/33 28.9 ns 28.9 ns 24042000BM_to_chars_good/34 28.7 ns 28.7 ns 24361000BM_to_chars_good/35 28.3 ns 28.3 ns 24703000BM_to_chars_good/36 28.1 ns 28.1 ns 24924000BM_to_chars_bad/2 6.16 ns 6.15 ns 114101000BM_to_chars_bad/3 14.5 ns 14.5 ns 48244000BM_to_chars_bad/4 16.9 ns 16.9 ns 41974000BM_to_chars_bad/5 12.5 ns 12.5 ns 56080000BM_to_chars_bad/6 10.9 ns 10.9 ns 64036000BM_to_chars_bad/7 14.5 ns 14.5 ns 47294000BM_to_chars_bad/8 6.36 ns 6.35 ns 110430000BM_to_chars_bad/9 12.4 ns 12.4 ns 56448000BM_to_chars_bad/10 5.13 ns 5.13 ns 137596000BM_to_chars_bad/11 9.88 ns 9.88 ns 69015000BM_to_chars_bad/12 10.8 ns 10.8 ns 63990000BM_to_chars_bad/13 10.7 ns 10.7 ns 65066000BM_to_chars_bad/14 9.71 ns 9.71 ns 71775000BM_to_chars_bad/15 9.18 ns 9.18 ns 75267000BM_to_chars_bad/16 6.12 ns 6.12 ns 115000000BM_to_chars_bad/17 10.7 ns 10.7 ns 65504000BM_to_chars_bad/18 10.6 ns 10.6 ns 65685000BM_to_chars_bad/19 9.98 ns 9.98 ns 69894000BM_to_chars_bad/20 9.74 ns 9.74 ns 72098000BM_to_chars_bad/21 9.25 ns 9.25 ns 75184000BM_to_chars_bad/22 9.10 ns 9.10 ns 75602000BM_to_chars_bad/23 9.48 ns 9.48 ns 72824000BM_to_chars_bad/24 9.27 ns 9.27 ns 75112000BM_to_chars_bad/25 9.61 ns 9.61 ns 72080000BM_to_chars_bad/26 9.72 ns 9.72 ns 72178000BM_to_chars_bad/27 10.0 ns 10.0 ns 69733000BM_to_chars_bad/28 10.3 ns 10.3 ns 67409000BM_to_chars_bad/29 9.97 ns 9.97 ns 69193000BM_to_chars_bad/30 10.1 ns 10.1 ns 69007000BM_to_chars_bad/31 9.68 ns 9.68 ns 72232000BM_to_chars_bad/32 8.99 ns 8.99 ns 76825000BM_to_chars_bad/33 8.82 ns 8.82 ns 79293000BM_to_chars_bad/34 8.64 ns 8.64 ns 80441000BM_to_chars_bad/35 8.96 ns 8.96 ns 75320000BM_to_chars_bad/36 8.87 ns 8.87 ns 77293000```After```--------------------------------------------------------------Benchmark Time CPU Iterations--------------------------------------------------------------BM_to_chars_good/2 14.7 ns 14.7 ns 47583000BM_to_chars_good/3 101 ns 101 ns 6901000BM_to_chars_good/4 68.4 ns 68.4 ns 10088000BM_to_chars_good/5 58.2 ns 58.2 ns 12007000BM_to_chars_good/6 51.1 ns 51.1 ns 13687000BM_to_chars_good/7 45.6 ns 45.6 ns 15323000BM_to_chars_good/8 14.6 ns 14.6 ns 47795000BM_to_chars_good/9 40.7 ns 40.7 ns 17371000BM_to_chars_good/10 7.48 ns 7.48 ns 90931000BM_to_chars_good/11 37.6 ns 37.6 ns 18542000BM_to_chars_good/12 35.2 ns 35.2 ns 19922000BM_to_chars_good/13 34.9 ns 34.9 ns 20105000BM_to_chars_good/14 33.5 ns 33.5 ns 20863000BM_to_chars_good/15 31.9 ns 31.9 ns 22014000BM_to_chars_good/16 11.7 ns 11.7 ns 60012000BM_to_chars_good/17 28.9 ns 28.9 ns 24148000BM_to_chars_good/18 29.0 ns 29.0 ns 24317000BM_to_chars_good/19 28.7 ns 28.7 ns 24363000BM_to_chars_good/20 28.1 ns 28.1 ns 24899000BM_to_chars_good/21 27.5 ns 27.5 ns 25499000BM_to_chars_good/22 26.9 ns 26.9 ns 25929000BM_to_chars_good/23 26.2 ns 26.2 ns 26828000BM_to_chars_good/24 25.1 ns 25.1 ns 27742000BM_to_chars_good/25 25.3 ns 25.3 ns 27720000BM_to_chars_good/26 25.2 ns 25.2 ns 27789000BM_to_chars_good/27 25.3 ns 25.3 ns 27777000BM_to_chars_good/28 25.3 ns 25.3 ns 27643000BM_to_chars_good/29 25.3 ns 25.3 ns 27750000BM_to_chars_good/30 25.4 ns 25.4 ns 27566000BM_to_chars_good/31 25.4 ns 25.4 ns 27611000BM_to_chars_good/32 25.8 ns 25.8 ns 27218000BM_to_chars_good/33 25.7 ns 25.7 ns 27070000BM_to_chars_good/34 26.1 ns 26.1 ns 26693000BM_to_chars_good/35 26.4 ns 26.4 ns 26486000BM_to_chars_good/36 26.3 ns 26.3 ns 26619000BM_to_chars_bad/2 5.99 ns 5.99 ns 118787000BM_to_chars_bad/3 14.3 ns 14.3 ns 48567000BM_to_chars_bad/4 16.0 ns 16.0 ns 43239000BM_to_chars_bad/5 12.6 ns 12.6 ns 55354000BM_to_chars_bad/6 10.7 ns 10.7 ns 65491000BM_to_chars_bad/7 14.4 ns 14.4 ns 48723000BM_to_chars_bad/8 6.50 ns 6.50 ns 104967000BM_to_chars_bad/9 12.0 ns 12.0 ns 56552000BM_to_chars_bad/10 5.16 ns 5.16 ns 136380000BM_to_chars_bad/11 10.5 ns 10.5 ns 66764000BM_to_chars_bad/12 10.7 ns 10.7 ns 65534000BM_to_chars_bad/13 11.0 ns 11.0 ns 63426000BM_to_chars_bad/14 9.90 ns 9.90 ns 68575000BM_to_chars_bad/15 9.52 ns 9.52 ns 70932000BM_to_chars_bad/16 6.14 ns 6.14 ns 111762000BM_to_chars_bad/17 10.6 ns 10.6 ns 65883000BM_to_chars_bad/18 10.5 ns 10.5 ns 67606000BM_to_chars_bad/19 9.96 ns 9.96 ns 68898000BM_to_chars_bad/20 9.40 ns 9.41 ns 73116000BM_to_chars_bad/21 9.12 ns 9.12 ns 78647000BM_to_chars_bad/22 8.95 ns 8.95 ns 80211000BM_to_chars_bad/23 9.50 ns 9.49 ns 73571000BM_to_chars_bad/24 9.29 ns 9.29 ns 74690000BM_to_chars_bad/25 9.65 ns 9.65 ns 72877000BM_to_chars_bad/26 9.78 ns 9.78 ns 70171000BM_to_chars_bad/27 10.1 ns 10.1 ns 69543000BM_to_chars_bad/28 10.4 ns 10.4 ns 67582000BM_to_chars_bad/29 10.00 ns 10.00 ns 70806000BM_to_chars_bad/30 9.99 ns 9.99 ns 70340000BM_to_chars_bad/31 9.56 ns 9.56 ns 74159000BM_to_chars_bad/32 8.97 ns 8.97 ns 78052000BM_to_chars_bad/33 8.86 ns 8.86 ns 78586000BM_to_chars_bad/34 8.81 ns 8.81 ns 78562000BM_to_chars_bad/35 8.90 ns 8.90 ns 77384000BM_to_chars_bad/36 9.04 ns 9.04 ns 77263000```Reviewed By: #libc, ldionneDifferential Revision: https://reviews.llvm.org/D127764
[libc++] Don't use static constexpr in headers.This was noticed in the review of D125704. In that commit only the newtable has been adapted. This adapts the existing tables.Note since libc++'s c
[libc++] Don't use static constexpr in headers.This was noticed in the review of D125704. In that commit only the newtable has been adapted. This adapts the existing tables.Note since libc++'s charconv is backported to C++11 it's not possible touse inline constexpr variables. The were introduced in C++17.Reviewed By: #libc, ldionneDifferential Revision: https://reviews.llvm.org/D126887
[libc++] Make to_chars base 10 header only.The functions to_chars and from_chars should offer 128-bit support. Thisis the first step to implement 128-bit version of to_chars. Beforeimplementing 1
[libc++] Make to_chars base 10 header only.The functions to_chars and from_chars should offer 128-bit support. Thisis the first step to implement 128-bit version of to_chars. Beforeimplementing 128-bit support the current code will be polished.This moves the code from the dylib to the header in prepartion ofP2291 "Add Constexpr Modifiers to Functions to_chars and from_chars forIntegral Types in <charconv> Header"Note some more cleanups will be done in follow-up commits- Remove the _LIBCPP_AVAILABILITY_TO_CHARS from to_chars. With all code in the header the availablilty macro is no longer needed. This requires enabling the unit tests for additional platforms.- The code in the dylib can switch to using the header implementation. This allows removing the code duplicated in the header and the dylib.Reviewed By: #libc, ldionneDifferential Revision: https://reviews.llvm.org/D125704
[libc++] Revert "Protect users from relying on detail headers" & related changesThis commit reverts 5aaefa51 (and also partly 7f285f48e77 and b6d75682f9,which were related to the original commit).
[libc++] Revert "Protect users from relying on detail headers" & related changesThis commit reverts 5aaefa51 (and also partly 7f285f48e77 and b6d75682f9,which were related to the original commit). As landed, 5aaefa51 hadunintended consequences on some downstream bots and didn't have propercoverage upstream due to a few subtle things. Implementing this issomething we should do in libc++, however we'll first need to addressa few issues listed in https://reviews.llvm.org/D106124#3349710.Differential Revision: https://reviews.llvm.org/D120683
[libcxx][modules] protects users from relying on detail headerslibc++ has started splicing standard library headers into much morefine-grained content for maintainability. It's very likely that ou
[libcxx][modules] protects users from relying on detail headerslibc++ has started splicing standard library headers into much morefine-grained content for maintainability. It's very likely that outdatedand naive tooling (some of which is outside of LLVM's scope) willsuggest users include things such as <__ranges/access.h> instead of<ranges>, and Hyrum's law suggests that users will eventually begin torely on this without the help of tooling. As such, this commitintends to protect users from themselves, by making it a hard error foranyone outside of the standard library to include libc++ detail headers.Differential Revision: https://reviews.llvm.org/D106124
[libc++] Normalize all our '#pragma GCC system_header', and regression-test.Now we'll notice if a header forgets to include this magic phrase.Differential Revision: https://reviews.llvm.org/D1188
[libc++] Normalize all our '#pragma GCC system_header', and regression-test.Now we'll notice if a header forgets to include this magic phrase.Differential Revision: https://reviews.llvm.org/D118800
[libc++] Adds (to|from)_chars_result operator==.Implements part of P1614 The Mothership has Landed.Reviewed By: #libc, Quuxplusone, MordanteDifferential Revision: https://reviews.llvm.org/D1123
[libc++] Adds (to|from)_chars_result operator==.Implements part of P1614 The Mothership has Landed.Reviewed By: #libc, Quuxplusone, MordanteDifferential Revision: https://reviews.llvm.org/D112366
[libc++][NFC] split <charconv>.This move the helper types `chars_format`, `to_chars_result` and`from_chars_result` to a separate header. The first two are needed forD70631 the third for consisten
[libc++][NFC] split <charconv>.This move the helper types `chars_format`, `to_chars_result` and`from_chars_result` to a separate header. The first two are needed forD70631 the third for consistency.The header `__charconv/ryu.h` uses these types and it can't depend on thetypes in `<charconv>` in a modular build. Moving them to the ryu headerwould be an odd place and doesn't work since the header is included in themiddle of `<charconv>`.Reviewed By: #libc, ldionne, QuuxplusoneDifferential Revision: https://reviews.llvm.org/D108927