authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 06:48:29+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 06:48:29+02:00
log9fe22a29b34e274af4f1d67a08c7757d2d0bc1fa
treef07150b07bce601b2378cb6f1de41233f00b3eac
parent6c78e9250de36f2e21e710940e6f8d0e8516556f
parent0375ec45ab2036b4a971f09d9710c577c11da492
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Merge branch 'llvm23'


923 files changed, 30386 insertions(+), 18366 deletions(-)

CMakeLists.txt+3-6
......@@ -133,9 +133,9 @@ else()
133133 set(ZIG_SYSTEM_LIBCXX "stdc++" CACHE STRING "system libcxx name for build.zig")
134134endif()
135135
136find_package(llvm 22)
137find_package(clang 22)
138find_package(lld 22)
136find_package(llvm 23)
137find_package(clang 23)
138find_package(lld 23)
139139
140140if(ZIG_STATIC_ZLIB)
141141 if (MSVC)
......@@ -614,9 +614,6 @@ else()
614614 set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99")
615615 set(ZIG1_COMPILE_FLAGS "-std=c99 -Oz -fno-strict-aliasing")
616616 set(ZIG2_COMPILE_FLAGS "-std=c99 -Oz -fno-sanitize=undefined -fno-stack-protector -fno-strict-aliasing")
617 if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ZIG_HOST_TARGET_ARCH STREQUAL "s390x")
618 string(REPLACE -Oz -O0 ZIG2_COMPILE_FLAGS "${ZIG2_COMPILE_FLAGS}") # llvm 22 assertion failure
619 endif()
620617 # Must match the condition in build.zig.
621618 if(ZIG_HOST_TARGET_ARCH MATCHES "^(arm|thumb)(eb)?$" OR ZIG_HOST_TARGET_ARCH EQUAL "hexagon" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$")
622619 set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -ffunction-sections -fdata-sections")
README.md+41-41
......@@ -47,7 +47,7 @@ Ensure you have the required dependencies:
4747
4848 * CMake >= 3.15
4949 * System C/C++ Toolchain
50 * LLVM, Clang, LLD development libraries, version 22.x, compiled with the
50 * LLVM, Clang, LLD development libraries, version 23.x, compiled with the
5151 same system C/C++ toolchain.
5252 - If the system package manager lacks these libraries, or has them misconfigured,
5353 see below for how to build them from source.
......@@ -257,15 +257,15 @@ that you have **no** trailing slash (`/` or `\`) at the end of the
257257
258258Install [CMake](https://cmake.org/), version 3.20.0 or newer.
259259
260[Download LLVM, Clang, and LLD sources](https://releases.llvm.org/download.html#22.0.0)
260[Download LLVM, Clang, and LLD sources](https://releases.llvm.org/download.html#23.0.0)
261261The downloads from llvm lead to the github release pages, where the source's
262will be listed as : `llvm-22.X.X.src.tar.xz`, `clang-22.X.X.src.tar.xz`,
263`lld-22.X.X.src.tar.xz`. Unzip each to their own directory. Ensure no
262will be listed as : `llvm-23.X.X.src.tar.xz`, `clang-23.X.X.src.tar.xz`,
263`lld-23.X.X.src.tar.xz`. Unzip each to their own directory. Ensure no
264264directories have spaces in them. For example:
265265
266 * `C:\Users\Andy\llvm-22.0.0.src`
267 * `C:\Users\Andy\clang-22.0.0.src`
268 * `C:\Users\Andy\lld-22.0.0.src`
266 * `C:\Users\Andy\llvm-23.0.0.src`
267 * `C:\Users\Andy\clang-23.0.0.src`
268 * `C:\Users\Andy\lld-23.0.0.src`
269269
270270Install [Build Tools for Visual Studio
2712712019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019).
......@@ -298,9 +298,9 @@ Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and ex
298298##### Release Mode
299299
300300```bat
301mkdir C:\Users\Andy\llvm-22.0.0.src\build-release
302cd C:\Users\Andy\llvm-22.0.0.src\build-release
303"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-release-mt -
301mkdir C:\Users\Andy\llvm-23.0.0.src\build-release
302cd C:\Users\Andy\llvm-23.0.0.src\build-release
303"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-release-mt -
304304DLLVM_ENABLE_ZLIB=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_RELEASE=MT
305305msbuild /m -p:Configuration=Release INSTALL.vcxproj
306306```
......@@ -308,10 +308,10 @@ msbuild /m -p:Configuration=Release INSTALL.vcxproj
308308##### Debug Mode
309309
310310```bat
311mkdir C:\Users\Andy\llvm-22.0.0.src\build-debug
312cd C:\Users\Andy\llvm-22.0.0.src\build-debug
313"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -
314DLLVM_ENABLE_ZLIB=OFF -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_DEBUG=MTd
311mkdir C:\Users\Andy\llvm-23.0.0.src\build-debug
312cd C:\Users\Andy\llvm-23.0.0.src\build-debug
313"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -
314DLLVM_ENABLE_ZLIB=OFF -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_DEBUG=MTd
315315msbuild /m INSTALL.vcxproj
316316```
317317
......@@ -322,18 +322,18 @@ Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and ex
322322##### Release Mode
323323
324324```bat
325mkdir C:\Users\Andy\lld-22.0.0.src\build-release
326cd C:\Users\Andy\lld-22.0.0.src\build-release
327"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-14.0.6-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
325mkdir C:\Users\Andy\lld-23.0.0.src\build-release
326cd C:\Users\Andy\lld-23.0.0.src\build-release
327"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-14.0.6-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
328328msbuild /m -p:Configuration=Release INSTALL.vcxproj
329329```
330330
331331##### Debug Mode
332332
333333```bat
334mkdir C:\Users\Andy\lld-22.0.0.src\build-debug
335cd C:\Users\Andy\lld-22.0.0.src\build-debug
336"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
334mkdir C:\Users\Andy\lld-23.0.0.src\build-debug
335cd C:\Users\Andy\lld-23.0.0.src\build-debug
336"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
337337msbuild /m INSTALL.vcxproj
338338```
339339
......@@ -344,18 +344,18 @@ Using the start menu, run **x64 Native Tools Command Prompt for VS 2019** and ex
344344##### Release Mode
345345
346346```bat
347mkdir C:\Users\Andy\clang-22.0.0.src\build-release
348cd C:\Users\Andy\clang-22.0.0.src\build-release
349"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
347mkdir C:\Users\Andy\clang-23.0.0.src\build-release
348cd C:\Users\Andy\clang-23.0.0.src\build-release
349"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\Andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-release-mt -DCMAKE_PREFIX_PATH=C:\Users\Andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-release-mt -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_CRT_RELEASE=MT
350350msbuild /m -p:Configuration=Release INSTALL.vcxproj
351351```
352352
353353##### Debug Mode
354354
355355```bat
356mkdir C:\Users\Andy\clang-22.0.0.src\build-debug
357cd C:\Users\Andy\clang-22.0.0.src\build-debug
358"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-22.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
356mkdir C:\Users\Andy\clang-23.0.0.src\build-debug
357cd C:\Users\Andy\clang-23.0.0.src\build-debug
358"c:\Program Files\CMake\bin\cmake.exe" .. -Thost=x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -DCMAKE_PREFIX_PATH=C:\Users\andy\llvm+clang+lld-23.0.0-x86_64-windows-msvc-debug -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_CRT_DEBUG=MTd
359359msbuild /m INSTALL.vcxproj
360360```
361361
......@@ -371,14 +371,14 @@ This is the generally recommended approach.
371371
372372```sh
373373cd ~/Downloads
374git clone --depth 1 --branch release/22.x https://github.com/llvm/llvm-project llvm-project-22
375cd llvm-project-22
376git checkout release/22.x
374git clone --depth 1 --branch release/23.x https://github.com/llvm/llvm-project llvm-project-23
375cd llvm-project-23
376git checkout release/23.x
377377
378378mkdir build-release
379379cd build-release
380380cmake ../llvm \
381 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm22-assert \
381 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm23-assert \
382382 -DCMAKE_BUILD_TYPE=Release \
383383 -DLLVM_ENABLE_PROJECTS="lld;clang" \
384384 -DLLVM_ENABLE_LIBXML2=OFF \
......@@ -399,16 +399,16 @@ others are in Release mode.
399399
400400```sh
401401cd ~/Downloads
402git clone --depth 1 --branch release/22.x https://github.com/llvm/llvm-project llvm-project-22
403cd llvm-project-22
404git checkout release/22.x
402git clone --depth 1 --branch release/23.x https://github.com/llvm/llvm-project llvm-project-23
403cd llvm-project-23
404git checkout release/23.x
405405
406406# LLVM
407407mkdir llvm/build-debug
408408cd llvm/build-debug
409409cmake .. \
410 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm22-debug \
411 -DCMAKE_PREFIX_PATH=$HOME/local/llvm22-debug \
410 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm23-debug \
411 -DCMAKE_PREFIX_PATH=$HOME/local/llvm23-debug \
412412 -DCMAKE_BUILD_TYPE=Debug \
413413 -DLLVM_ENABLE_LIBXML2=OFF \
414414 -DLLVM_ENABLE_TERMINFO=OFF \
......@@ -422,8 +422,8 @@ cd ../..
422422mkdir lld/build-debug
423423cd lld/build-debug
424424cmake .. \
425 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm22-debug \
426 -DCMAKE_PREFIX_PATH=$HOME/local/llvm22-debug \
425 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm23-debug \
426 -DCMAKE_PREFIX_PATH=$HOME/local/llvm23-debug \
427427 -DCMAKE_BUILD_TYPE=Release \
428428 -DLLVM_PARALLEL_LINK_JOBS=1 \
429429 -DCMAKE_CXX_STANDARD=17 \
......@@ -435,8 +435,8 @@ cd ../..
435435mkdir clang/build-debug
436436cd clang/build-debug
437437cmake .. \
438 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm22-debug \
439 -DCMAKE_PREFIX_PATH=$HOME/local/llvm22-debug \
438 -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm23-debug \
439 -DCMAKE_PREFIX_PATH=$HOME/local/llvm23-debug \
440440 -DCMAKE_BUILD_TYPE=Release \
441441 -DLLVM_PARALLEL_LINK_JOBS=1 \
442442 -DLLVM_INCLUDE_TESTS=OFF \
......@@ -446,8 +446,8 @@ cd ../..
446446```
447447
448448Then add to your Zig CMake line that you got from the README.md:
449`-DCMAKE_PREFIX_PATH=$HOME/local/llvm22-debug` or
450`-DCMAKE_PREFIX_PATH=$HOME/local/llvm22-assert` depending on whether you want
449`-DCMAKE_PREFIX_PATH=$HOME/local/llvm23-debug` or
450`-DCMAKE_PREFIX_PATH=$HOME/local/llvm23-assert` depending on whether you want
451451Debug or Release LLVM.
452452
453453
build.zig+8-4
......@@ -1362,20 +1362,23 @@ const clang_libs = [_][]const u8{
13621362 "clangStaticAnalyzerCheckers",
13631363 "clangStaticAnalyzerCore",
13641364 "clangCrossTU",
1365 "clangFrontend",
13661365 "clangDriver",
1366 "clangScalableStaticAnalysisAnalyses",
1367 "clangScalableStaticAnalysisCore",
1368 "clangScalableStaticAnalysisFrontend",
1369 "clangScalableStaticAnalysisSourceTransformation",
1370 "clangDependencyScanning",
1371 "clangFrontend",
13671372 "clangOptions",
13681373 "clangSerialization",
13691374 "clangSema",
13701375 "clangAnalysisLifetimeSafety",
13711376 "clangAnalysis",
13721377 "clangASTMatchers",
1373 "clangAST",
13741378 "clangParse",
1375 "clangSema",
13761379 "clangAPINotes",
1377 "clangBasic",
13781380 "clangEdit",
1381 "clangUnifiedSymbolResolution",
13791382 "clangLex",
13801383 "clangRewriteFrontend",
13811384 "clangRewrite",
......@@ -1387,6 +1390,7 @@ const clang_libs = [_][]const u8{
13871390 "clangSupport",
13881391 "clangInstallAPI",
13891392 "clangAST",
1393 "clangBasic",
13901394};
13911395const lld_libs = [_][]const u8{
13921396 "lldMinGW",
ci/aarch64-freebsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-freebsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-freebsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-freebsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-macos-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-macos-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-macos-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-macos-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-netbsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-netbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-netbsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-netbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-openbsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-openbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.2030+f955266cf"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-openbsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="aarch64-openbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.2030+f955266cf"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/aarch64-windows-debug.ps1+1-1
......@@ -1,6 +1,6 @@
11$TARGET = "aarch64-windows-gnu"
22$MCPU = "baseline"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
66
ci/aarch64-windows-release.ps1+1-1
......@@ -1,6 +1,6 @@
11$TARGET = "aarch64-windows-gnu"
22$MCPU = "baseline"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
66
ci/loongarch64-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="loongarch64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/loongarch64-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="loongarch64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/powerpc64le-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="powerpc64le-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/powerpc64le-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="powerpc64le-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/riscv64-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="riscv64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/riscv64-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="riscv64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/s390x-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="s390x-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/s390x-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="s390x-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-freebsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-freebsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-freebsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-freebsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-linux-debug-llvm.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-linux-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-linux-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-linux-musl"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-netbsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-netbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-netbsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-netbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-openbsd-debug.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-openbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-openbsd-release.sh+1-1
......@@ -7,7 +7,7 @@ set -e
77
88TARGET="x86_64-openbsd-none"
99MCPU="baseline"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
10CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
1111PREFIX="$HOME/deps/$CACHE_BASENAME"
1212ZIG="$PREFIX/bin/zig"
1313
ci/x86_64-windows-debug.ps1+1-1
......@@ -1,6 +1,6 @@
11$TARGET = "x86_64-windows-gnu"
22$MCPU = "baseline"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
66
ci/x86_64-windows-release.ps1+1-1
......@@ -1,6 +1,6 @@
11$TARGET = "x86_64-windows-gnu"
22$MCPU = "baseline"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.17.0-dev.203+073889523"
3$PREFIX_PATH = "$($Env:USERPROFILE)\deps\zig+llvm+lld+clang-$TARGET-0.18.0-dev.92+1e1964473"
44$ZIG = "$PREFIX_PATH\bin\zig.exe"
55$ZSF_MAX_RSS = if ($Env:ZSF_MAX_RSS) { $Env:ZSF_MAX_RSS } else { 0 }
66
cmake/Findclang.cmake+11-5
......@@ -17,10 +17,10 @@ find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
1717if(${LLVM_LINK_MODE} STREQUAL "shared")
1818 find_library(CLANG_LIBRARIES
1919 NAMES
20 libclang-cpp.so.22
21 libclang-cpp.so.22.1
22 clang-cpp-22.0
23 clang-cpp220
20 libclang-cpp.so.23
21 libclang-cpp.so.23.1
22 clang-cpp-23.0
23 clang-cpp230
2424 clang-cpp
2525 NAMES_PER_DIR
2626 HINTS "${LLVM_LIBDIRS}"
......@@ -48,8 +48,13 @@ else()
4848 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCheckers)
4949 FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCore)
5050 FIND_AND_ADD_CLANG_LIB(clangCrossTU)
51 FIND_AND_ADD_CLANG_LIB(clangFrontend)
5251 FIND_AND_ADD_CLANG_LIB(clangDriver)
52 FIND_AND_ADD_CLANG_LIB(clangScalableStaticAnalysisAnalyses)
53 FIND_AND_ADD_CLANG_LIB(clangScalableStaticAnalysisCore)
54 FIND_AND_ADD_CLANG_LIB(clangScalableStaticAnalysisFrontend)
55 FIND_AND_ADD_CLANG_LIB(clangScalableStaticAnalysisSourceTransformation)
56 FIND_AND_ADD_CLANG_LIB(clangDependencyScanning)
57 FIND_AND_ADD_CLANG_LIB(clangFrontend)
5358 FIND_AND_ADD_CLANG_LIB(clangOptions)
5459 FIND_AND_ADD_CLANG_LIB(clangSerialization)
5560 FIND_AND_ADD_CLANG_LIB(clangSema)
......@@ -59,6 +64,7 @@ else()
5964 FIND_AND_ADD_CLANG_LIB(clangParse)
6065 FIND_AND_ADD_CLANG_LIB(clangAPINotes)
6166 FIND_AND_ADD_CLANG_LIB(clangEdit)
67 FIND_AND_ADD_CLANG_LIB(clangUnifiedSymbolResolution)
6268 FIND_AND_ADD_CLANG_LIB(clangLex)
6369 FIND_AND_ADD_CLANG_LIB(clangRewriteFrontend)
6470 FIND_AND_ADD_CLANG_LIB(clangRewrite)
cmake/Findlld.cmake+19-19
......@@ -9,23 +9,23 @@
99find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h
1010 HINTS ${LLVM_INCLUDE_DIRS}
1111 PATHS
12 /usr/lib/llvm-22/include
13 /usr/local/llvm220/include
14 /usr/local/llvm22/include
15 /usr/local/opt/lld@22/include
16 /opt/homebrew/opt/lld@22/include
17 /home/linuxbrew/.linuxbrew/opt/lld@22/include
12 /usr/lib/llvm-23/include
13 /usr/local/llvm230/include
14 /usr/local/llvm23/include
15 /usr/local/opt/lld@23/include
16 /opt/homebrew/opt/lld@23/include
17 /home/linuxbrew/.linuxbrew/opt/lld@23/include
1818 /mingw64/include)
1919
20find_library(LLD_LIBRARY NAMES lld-22.0 lld220 lld NAMES_PER_DIR
20find_library(LLD_LIBRARY NAMES lld-23.0 lld230 lld NAMES_PER_DIR
2121 HINTS ${LLVM_LIBDIRS}
2222 PATHS
23 /usr/lib/llvm-22/lib
24 /usr/local/llvm220/lib
25 /usr/local/llvm22/lib
26 /usr/local/opt/lld@22/lib
27 /opt/homebrew/opt/lld@22/lib
28 /home/linuxbrew/.linuxbrew/opt/lld@22/lib
23 /usr/lib/llvm-23/lib
24 /usr/local/llvm230/lib
25 /usr/local/llvm23/lib
26 /usr/local/opt/lld@23/lib
27 /opt/homebrew/opt/lld@23/lib
28 /home/linuxbrew/.linuxbrew/opt/lld@23/lib
2929)
3030if(EXISTS ${LLD_LIBRARY})
3131 set(LLD_LIBRARIES ${LLD_LIBRARY})
......@@ -36,12 +36,12 @@ else()
3636 HINTS ${LLVM_LIBDIRS}
3737 PATHS
3838 ${LLD_LIBDIRS}
39 /usr/lib/llvm-22/lib
40 /usr/local/llvm220/lib
41 /usr/local/llvm22/lib
42 /usr/local/opt/lld@22/lib
43 /opt/homebrew/opt/lld@22/lib
44 /home/linuxbrew/.linuxbrew/opt/lld@22/lib
39 /usr/lib/llvm-23/lib
40 /usr/local/llvm230/lib
41 /usr/local/llvm23/lib
42 /usr/local/opt/lld@23/lib
43 /opt/homebrew/opt/lld@23/lib
44 /home/linuxbrew/.linuxbrew/opt/lld@23/lib
4545 /mingw64/lib
4646 /c/msys64/mingw64/lib
4747 c:/msys64/mingw64/lib)
cmake/Findllvm.cmake+6-6
......@@ -17,12 +17,12 @@ if(ZIG_USE_LLVM_CONFIG)
1717 # terminate when the right LLVM version is not found.
1818 unset(LLVM_CONFIG_EXE CACHE)
1919 find_program(LLVM_CONFIG_EXE
20 NAMES llvm-config-22 llvm-config-22.0 llvm-config220 llvm-config22 llvm-config NAMES_PER_DIR
20 NAMES llvm-config-23 llvm-config-23.0 llvm-config230 llvm-config23 llvm-config NAMES_PER_DIR
2121 PATHS
2222 "/mingw64/bin"
2323 "/c/msys64/mingw64/bin"
2424 "c:/msys64/mingw64/bin"
25 "C:/Libraries/llvm-22.0.0/bin")
25 "C:/Libraries/llvm-23.0.0/bin")
2626
2727 if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
2828 if (NOT LLVM_CONFIG_ERROR_MESSAGES STREQUAL "")
......@@ -40,9 +40,9 @@ if(ZIG_USE_LLVM_CONFIG)
4040 OUTPUT_STRIP_TRAILING_WHITESPACE)
4141
4242 get_filename_component(LLVM_CONFIG_DIR "${LLVM_CONFIG_EXE}" DIRECTORY)
43 if("${LLVM_CONFIG_VERSION}" VERSION_LESS 22 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 23 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 23)
43 if("${LLVM_CONFIG_VERSION}" VERSION_LESS 23 OR "${LLVM_CONFIG_VERSION}" VERSION_EQUAL 24 OR "${LLVM_CONFIG_VERSION}" VERSION_GREATER 24)
4444 # Save the error message, in case this is the last llvm-config we find
45 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 22.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
45 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "expected LLVM 23.x but found ${LLVM_CONFIG_VERSION} using ${LLVM_CONFIG_EXE}")
4646
4747 # Ignore this directory and try the search again
4848 list(APPEND CMAKE_IGNORE_PATH "${LLVM_CONFIG_DIR}")
......@@ -66,9 +66,9 @@ if(ZIG_USE_LLVM_CONFIG)
6666 if (LLVM_CONFIG_ERROR)
6767 # Save the error message, in case this is the last llvm-config we find
6868 if (ZIG_SHARED_LLVM)
69 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 22.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
69 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 23.x found at ${LLVM_CONFIG_EXE} does not support linking as a shared library")
7070 else()
71 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 22.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
71 list(APPEND LLVM_CONFIG_ERROR_MESSAGES "LLVM 23.x found at ${LLVM_CONFIG_EXE} does not support linking as a static library")
7272 endif()
7373
7474 # Ignore this directory and try the search again
lib/c/wchar.zig+1-6
......@@ -14,7 +14,6 @@ comptime {
1414 symbol(&wmemcpy, "wmemcpy");
1515 symbol(&wmemmove, "wmemmove");
1616 symbol(&wmemset, "wmemset");
17 symbol(&wcslen, "wcslen");
1817 symbol(&wcsnlen, "wcsnlen");
1918 symbol(&wcscmp, "wcscmp");
2019 symbol(&wcsncmp, "wcsncmp");
......@@ -81,10 +80,6 @@ fn wmemset(dest: [*]wchar_t, elem: wchar_t, len: usize) callconv(.c) [*]wchar_t
8180 return dest;
8281}
8382
84fn wcslen(str: [*:0]const wchar_t) callconv(.c) usize {
85 return std.mem.len(str);
86}
87
8883fn wcsnlen(str: [*:0]const wchar_t, max: usize) callconv(.c) usize {
8984 for (0..max) |i| {
9085 if (str[i] == 0) return i;
......@@ -199,7 +194,7 @@ fn wcswcs(noalias haystack: [*:0]const wchar_t, noalias needle: [*:0]const wchar
199194}
200195
201196fn wcsdup(str: [*:0]const wchar_t) callconv(.c) ?[*:0]wchar_t {
202 const len = wcslen(str);
197 const len = c.wcslen(str);
203198 const size = (len + 1) * @sizeOf(wchar_t);
204199 const d_opaque = c.malloc(size) orelse return null;
205200 const d: [*]wchar_t = @ptrCast(@alignCast(d_opaque));
lib/compiler/aro/aro/Compilation.zig-1
......@@ -675,7 +675,6 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void {
675675 .{ .amx_fp8, "__AMX_FP8__" },
676676 .{ .amx_movrs, "__AMX_MOVRS__" },
677677 .{ .amx_avx512, "__AMX_AVX512__" },
678 .{ .amx_tf32, "__AMX_TF32__" },
679678 .{ .cmpccxadd, "__CMPCCXADD__" },
680679 .{ .raoint, "__RAOINT__" },
681680 .{ .avxifma, "__AVXIFMA__" },
lib/compiler_rt.zig+5
......@@ -162,6 +162,7 @@ comptime {
162162 symbol(&bcmp, "bcmp");
163163 _ = @import("compiler_rt/ssp.zig");
164164 symbol(&strlen, "strlen");
165 symbol(&wcslen, "wcslen");
165166 }
166167
167168 _ = @import("compiler_rt/elf.zig");
......@@ -178,6 +179,10 @@ fn strlen(s: [*:0]const c_char) callconv(.c) usize {
178179 return std.mem.len(s);
179180}
180181
182fn wcslen(s: [*:0]const std.c.wchar_t) callconv(.c) usize {
183 return std.mem.len(s);
184}
185
181186fn memcmp(vl: [*]const u8, vr: [*]const u8, n: usize) callconv(.c) c_int {
182187 var i: usize = 0;
183188 while (i < n) : (i += 1) {
lib/compiler_rt/float_from_int.zig-9
......@@ -287,10 +287,6 @@ comptime {
287287 } else {
288288 if (builtin.cpu.arch == .x86) {
289289 symbol(&__floatuntitf_x86, "__floatuntitf");
290 } else if (builtin.cpu.arch == .x86_64 and
291 (builtin.os.tag == .windows or builtin.os.tag == .uefi))
292 {
293 symbol(&__floatuntitf_x86_64_windows, "__floatuntitf");
294290 } else {
295291 symbol(&__floatuntitf, "__floatuntitf");
296292 }
......@@ -452,11 +448,6 @@ fn __floatuntitf(a: u128) callconv(.c) compiler_rt.f128.Abi {
452448fn __floatuntitf_x86(a: f128) callconv(.c) compiler_rt.f128.Abi {
453449 return compiler_rt.f128.toAbi(f128_floatFromInt_u128(@bitCast(a)));
454450}
455fn __floatuntitf_x86_64_windows(a_lo: u64, a_hi: u64) callconv(.c) compiler_rt.f128.Abi {
456 return compiler_rt.f128.toAbi(f128_floatFromInt_u128(@bitCast(
457 packed struct { lo: u64, hi: u64 }{ .lo = a_lo, .hi = a_hi },
458 )));
459}
460451pub fn f128_floatFromInt_u128(a: u128) f128 {
461452 return floatFromInt(f128, a);
462453}
lib/compiler_rt/udivmodei4.zig+1
......@@ -164,6 +164,7 @@ test "__udivei4/__umodei4" {
164164 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
165165 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
166166 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
167 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch == .sparc64) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37056
167168
168169 const RndGen = std.Random.DefaultPrng;
169170 var rnd = RndGen.init(42);
lib/include/__clang_spirv_libdevice_declares.h created+170
......@@ -0,0 +1,170 @@
1/*===-- __clang_spirv_libdevice_declares.h - decls for libdevice functions --===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __CLANG_SPIRV_LIBDEVICE_DECLARES_H__
11#define __CLANG_SPIRV_LIBDEVICE_DECLARES_H__
12
13#if defined(__cplusplus)
14extern "C" {
15#else
16_Pragma("push_macro(\"bool\")");
17#define bool _Bool
18#endif
19
20#define _CLC_OVERLOAD [[clang::overloadable]]
21#define _CLC_CONSTFN [[gnu::const]]
22// TODO: Add vector versions of the API in case it is required.
23_CLC_OVERLOAD _CLC_CONSTFN unsigned int __spirv_ocl_s_abs(int);
24_CLC_OVERLOAD _CLC_CONSTFN unsigned long __spirv_ocl_s_abs(long);
25_CLC_OVERLOAD _CLC_CONSTFN unsigned long long __spirv_ocl_s_abs(long long);
26_CLC_OVERLOAD _CLC_CONSTFN int __spirv_ocl_s_max(int, int);
27_CLC_OVERLOAD _CLC_CONSTFN long __spirv_ocl_s_max(long, long);
28_CLC_OVERLOAD _CLC_CONSTFN long long __spirv_ocl_s_max(long long, long long);
29_CLC_OVERLOAD _CLC_CONSTFN int __spirv_ocl_s_min(int, int);
30_CLC_OVERLOAD _CLC_CONSTFN long __spirv_ocl_s_min(long, long);
31_CLC_OVERLOAD _CLC_CONSTFN long long __spirv_ocl_s_min(long long, long long);
32_CLC_OVERLOAD _CLC_CONSTFN unsigned int __spirv_ocl_u_max(unsigned int,
33 unsigned int);
34_CLC_OVERLOAD _CLC_CONSTFN unsigned long __spirv_ocl_u_max(unsigned long,
35 unsigned long);
36_CLC_OVERLOAD _CLC_CONSTFN unsigned long long
37__spirv_ocl_u_max(unsigned long long, unsigned long long);
38_CLC_OVERLOAD _CLC_CONSTFN unsigned int __spirv_ocl_u_min(unsigned int,
39 unsigned int);
40_CLC_OVERLOAD _CLC_CONSTFN unsigned long __spirv_ocl_u_min(unsigned long,
41 unsigned long);
42_CLC_OVERLOAD _CLC_CONSTFN unsigned long long
43__spirv_ocl_u_min(unsigned long long, unsigned long long);
44_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_acos(float);
45_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_acos(double);
46_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_acosh(float);
47_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_acosh(double);
48_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_asin(float);
49_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_asin(double);
50_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_asinh(float);
51_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_asinh(double);
52_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_atan(float);
53_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_atan(double);
54_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_atan2(float, float);
55_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_atan2(double, double);
56_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_atanh(float);
57_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_atanh(double);
58_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_cbrt(float);
59_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_cbrt(double);
60_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_ceil(float);
61_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_ceil(double);
62_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_cos(float);
63_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_cos(double);
64_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_cosh(float);
65_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_cosh(double);
66_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_cospi(float);
67_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_cospi(double);
68_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_erf(float);
69_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_erf(double);
70_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_erfc(float);
71_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_erfc(double);
72_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_exp(float);
73_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_exp(double);
74_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_exp2(float);
75_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_exp2(double);
76_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_exp10(float);
77_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_exp10(double);
78_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_expm1(float);
79_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_expm1(double);
80_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsNan(float);
81_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsNan(double);
82_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsInf(float);
83_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsInf(double);
84_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsFinite(float);
85_CLC_OVERLOAD _CLC_CONSTFN bool __spirv_IsFinite(double);
86_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_copysign(float, float);
87_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_copysign(double, double);
88_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_ldexp(float, int);
89_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_ldexp(double, int);
90_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fabs(float);
91_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fabs(double);
92_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_logb(float);
93_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_logb(double);
94_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fmax(float, float);
95_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fmax(double, double);
96_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fmin(float, float);
97_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fmin(double, double);
98_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fdim(float, float);
99_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fdim(double, double);
100_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_floor(float);
101_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_floor(double);
102_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fma(float, float, float);
103_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fma(double, double, double);
104_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fmod(float, float);
105_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fmod(double, double);
106_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_frexp(float, int *);
107_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_frexp(double, int *);
108_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_hypot(float, float);
109_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_hypot(double, double);
110_CLC_OVERLOAD _CLC_CONSTFN int __spirv_ocl_ilogb(float);
111_CLC_OVERLOAD _CLC_CONSTFN int __spirv_ocl_ilogb(double);
112_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_lgamma(float);
113_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_lgamma(double);
114_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_round(float);
115_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_round(double);
116_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_log(float);
117_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_log(double);
118_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_log10(float);
119_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_log10(double);
120_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_log1p(float);
121_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_log1p(double);
122_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_log2(float);
123_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_log2(double);
124_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_modf(float, float *);
125_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_modf(double, double *);
126_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_nan(int);
127_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_nan(unsigned int);
128_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_nan(long);
129_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_nan(unsigned long);
130_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_nextafter(float, float);
131_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_nextafter(double, double);
132_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_sqrt(float);
133_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_sqrt(double);
134_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_rsqrt(float);
135_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_rsqrt(double);
136_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_pow(float, float);
137_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_pow(double, double);
138_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_pown(float, int);
139_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_pown(double, int);
140_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_remainder(float, float);
141_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_remainder(double, double);
142_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_remquo(float, float, int *);
143_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_remquo(double, double, int *);
144_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_sin(float);
145_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_sin(double);
146_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_sincos(float, float *);
147_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_sincos(double, double *);
148_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_sinh(float);
149_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_sinh(double);
150_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_sinpi(float);
151_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_sinpi(double);
152_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_tan(float);
153_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_tan(double);
154_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_tanh(float);
155_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_tanh(double);
156_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_tgamma(float);
157_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_tgamma(double);
158_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_trunc(float);
159_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_trunc(double);
160_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_rint(float);
161_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_rint(double);
162_CLC_OVERLOAD _CLC_CONSTFN float __spirv_ocl_fclamp(float, float, float);
163_CLC_OVERLOAD _CLC_CONSTFN double __spirv_ocl_fclamp(double, double, double);
164
165#if defined(__cplusplus)
166} // extern "C"
167#else
168_Pragma("pop_macro(\"bool\")");
169#endif
170#endif // __CLANG_SPIRV_LIBDEVICE_DECLARES_H__
lib/include/__clang_spirv_math.h created+719
......@@ -0,0 +1,719 @@
1/*===---- __clang_spirv_math.h - Device-side SPIRV math support ------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9#ifndef __CLANG_SPIRV_MATH_H__
10#define __CLANG_SPIRV_MATH_H__
11
12#if !defined(__SPIRV__) && !defined(__OPENMP_SPIRV__)
13#error "This file is for SPIRV and OpenMP SPIRV device compilation only."
14#endif
15
16// The __CLANG_GPU_DISABLE_MATH_WRAPPERS macro provides a way to let standard
17// libcalls reach the link step instead of being eagerly replaced.
18#ifndef __CLANG_GPU_DISABLE_MATH_WRAPPERS
19
20// __DEVICE__ is a helper macro with common set of attributes for the wrappers
21// we implement in this file. We need static in order to avoid emitting unused
22// functions and __forceinline__ helps inlining these wrappers at -O1.
23#pragma push_macro("__DEVICE__")
24#ifdef __OPENMP_SPIRV__
25#if defined(__cplusplus)
26#define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
27#else
28#define __DEVICE__ static __attribute__((always_inline, nothrow))
29#endif
30#else
31#define __DEVICE__ static __device__ __forceinline__
32#endif
33
34__DEVICE__
35float __cosf(float __x) { return __spirv_ocl_cos(__x); }
36__DEVICE__
37float __exp10f(float __x) { return __spirv_ocl_exp10(__x); }
38__DEVICE__
39float __expf(float __x) { return __spirv_ocl_exp(__x); }
40
41__DEVICE__
42float __fadd_rd(float __x, float __y) {
43 float sum = __x + __y;
44 float rounded = __spirv_ocl_floor(sum);
45 if (rounded > sum)
46 rounded -= 1.0f;
47 return rounded;
48}
49
50__DEVICE__
51float __fadd_rn(float __x, float __y) { return __spirv_ocl_rint(__x + __y); }
52__DEVICE__
53float __fadd_ru(float __x, float __y) { return __spirv_ocl_ceil(__x + __y); }
54__DEVICE__
55float __fadd_rz(float __x, float __y) { return __spirv_ocl_trunc(__x + __y); }
56
57__DEVICE__
58float __fdiv_rd(float __x, float __y) {
59 float res = __x / __y;
60 float rounded = __spirv_ocl_floor(res);
61 if (rounded > res)
62 rounded -= 1.0f;
63 return rounded;
64}
65__DEVICE__
66float __fdiv_rn(float __x, float __y) { return __spirv_ocl_rint(__x / __y); }
67__DEVICE__
68float __fdiv_ru(float __x, float __y) { return __spirv_ocl_ceil(__x / __y); }
69__DEVICE__
70float __fdiv_rz(float __x, float __y) { return __spirv_ocl_trunc(__x / __y); }
71__DEVICE__
72float __fdividef(float __x, float __y) { return __x / __y; }
73
74__DEVICE__
75float __fmaf_rd(float __x, float __y, float __z) {
76 float res = __x * __y + __z;
77 float rounded = __spirv_ocl_floor(res);
78 if (rounded > res)
79 rounded -= 1.0f;
80 return rounded;
81}
82__DEVICE__
83float __fmaf_rn(float __x, float __y, float __z) {
84 return __spirv_ocl_rint(__x * __y + __z);
85}
86__DEVICE__
87float __fmaf_ru(float __x, float __y, float __z) {
88 return __spirv_ocl_ceil(__x * __y + __z);
89}
90__DEVICE__
91float __fmaf_rz(float __x, float __y, float __z) {
92 return __spirv_ocl_trunc(__x * __y + __z);
93}
94
95__DEVICE__
96float __fmul_rd(float __x, float __y) {
97 float res = __x * __y;
98 float rounded = __spirv_ocl_floor(res);
99 if (rounded > res)
100 rounded -= 1.0f;
101 return rounded;
102}
103__DEVICE__
104float __fmul_rn(float __x, float __y) { return __spirv_ocl_rint(__x * __y); }
105__DEVICE__
106float __fmul_ru(float __x, float __y) { return __spirv_ocl_ceil(__x * __y); }
107__DEVICE__
108float __fmul_rz(float __x, float __y) { return __spirv_ocl_trunc(__x * __y); }
109
110__DEVICE__
111float __frcp_rd(float __x) { return __fdiv_rd(1.0f, __x); }
112__DEVICE__
113float __frcp_rn(float __x) { return __fdiv_rn(1.0f, __x); }
114__DEVICE__
115float __frcp_ru(float __x) { return __fdiv_ru(1.0f, __x); }
116__DEVICE__
117float __frcp_rz(float __x) { return __fdiv_rz(1.0f, __x); }
118__DEVICE__
119
120float __frsqrt_rn(float __x) {
121 return __spirv_ocl_rint(__spirv_ocl_rsqrt(__x));
122}
123
124__DEVICE__
125float __fsqrt_rd(float __x) {
126 float res = __spirv_ocl_sqrt(__x);
127 float rounded = __spirv_ocl_floor(res);
128 if (rounded > res)
129 rounded -= 1.0f;
130 return rounded;
131}
132__DEVICE__
133float __fsqrt_rn(float __x) { return __spirv_ocl_rint(__spirv_ocl_sqrt(__x)); }
134__DEVICE__
135float __fsqrt_ru(float __x) { return __spirv_ocl_ceil(__spirv_ocl_sqrt(__x)); }
136__DEVICE__
137float __fsqrt_rz(float __x) { return __spirv_ocl_trunc(__spirv_ocl_sqrt(__x)); }
138
139__DEVICE__
140float __fsub_rd(float __x, float __y) {
141 float res = __x - __y;
142 float rounded = __spirv_ocl_floor(res);
143 if (rounded > res)
144 rounded -= 1.0f;
145 return rounded;
146}
147__DEVICE__
148float __fsub_rn(float __x, float __y) { return __spirv_ocl_rint(__x - __y); }
149__DEVICE__
150float __fsub_ru(float __x, float __y) { return __spirv_ocl_ceil(__x - __y); }
151__DEVICE__
152float __fsub_rz(float __x, float __y) { return __spirv_ocl_trunc(__x - __y); }
153__DEVICE__
154float __log10f(float __x) { return __spirv_ocl_log10(__x); }
155__DEVICE__
156float __log2f(float __x) { return __spirv_ocl_log2(__x); }
157__DEVICE__
158float __logf(float __x) { return __spirv_ocl_log(__x); }
159__DEVICE__
160float __powf(float __x, float __y) { return __spirv_ocl_pow(__x, __y); }
161
162__DEVICE__
163float __saturatef(float __x) { return __spirv_ocl_fclamp(__x, 0.0f, 1.0f); }
164
165__DEVICE__
166void __sincosf(float __x, float *__sinptr, float *__cosptr) {
167 *__sinptr = __spirv_ocl_sincos(__x, __cosptr);
168}
169
170__DEVICE__
171float __sinf(float __x) { return __spirv_ocl_sin(__x); }
172
173__DEVICE__
174float __tanf(float __x) { return __spirv_ocl_tan(__x); }
175
176__DEVICE__
177int __finitef(float __x) { return !__spirv_IsInf(__x) && !__spirv_IsNan(__x); }
178__DEVICE__
179int __isinff(float __x) { return __spirv_IsInf(__x); }
180__DEVICE__
181int __isnanf(float __x) { return __spirv_IsNan(__x); }
182__DEVICE__
183int __signbitf(float __x) { return __builtin_signbitf(__x); }
184
185__DEVICE__
186int __finite(double __x) { return !__spirv_IsInf(__x) && !__spirv_IsNan(__x); }
187
188__DEVICE__
189int __isinf(double __x) { return __spirv_IsInf(__x); }
190
191__DEVICE__
192int __isnan(double __x) { return __spirv_IsNan(__x); }
193__DEVICE__
194int __signbit(double __x) { return __builtin_signbit(__x); }
195
196__DEVICE__
197double __dadd_rd(double __x, double __y) {
198 double sum = __x + __y;
199 double rounded = __spirv_ocl_floor(sum);
200 if (rounded > sum)
201 rounded -= 1.0;
202 return rounded;
203}
204__DEVICE__
205double __dadd_rn(double __x, double __y) { return __spirv_ocl_rint(__x + __y); }
206__DEVICE__
207double __dadd_ru(double __x, double __y) { return __spirv_ocl_ceil(__x + __y); }
208__DEVICE__
209double __dadd_rz(double __x, double __y) {
210 return __spirv_ocl_trunc(__x + __y);
211}
212__DEVICE__
213double __ddiv_rd(double __x, double __y) {
214 double res = __x / __y;
215 double rounded = __spirv_ocl_floor(res);
216 if (rounded > res)
217 rounded -= 1.0;
218 return rounded;
219}
220__DEVICE__
221double __ddiv_rn(double __x, double __y) { return __spirv_ocl_rint(__x / __y); }
222__DEVICE__
223double __ddiv_ru(double __x, double __y) { return __spirv_ocl_ceil(__x / __y); }
224__DEVICE__
225double __ddiv_rz(double __x, double __y) {
226 return __spirv_ocl_trunc(__x / __y);
227}
228
229__DEVICE__
230double __dmul_rd(double __x, double __y) {
231 double res = __x * __y;
232 double rounded = __spirv_ocl_floor(res);
233 if (rounded > res)
234 rounded -= 1.0;
235 return rounded;
236}
237__DEVICE__
238double __dmul_rn(double __x, double __y) { return __spirv_ocl_rint(__x * __y); }
239__DEVICE__
240double __dmul_ru(double __x, double __y) { return __spirv_ocl_ceil(__x * __y); }
241__DEVICE__
242double __dmul_rz(double __x, double __y) {
243 return __spirv_ocl_trunc(__x * __y);
244}
245
246__DEVICE__
247double __drcp_rd(double __x) { return __ddiv_rd(1.0, __x); }
248__DEVICE__
249double __drcp_rn(double __x) { return __ddiv_rn(1.0, __x); }
250__DEVICE__
251double __drcp_ru(double __x) { return __ddiv_ru(1.0, __x); }
252__DEVICE__
253double __drcp_rz(double __x) { return __ddiv_rz(1.0, __x); }
254
255__DEVICE__
256double __dsqrt_rd(double __x) {
257 double res = __spirv_ocl_sqrt(__x);
258 double rounded = __spirv_ocl_floor(res);
259 if (rounded > res)
260 rounded -= 1.0;
261 return rounded;
262}
263__DEVICE__
264double __dsqrt_rn(double __x) {
265 return __spirv_ocl_rint(__spirv_ocl_sqrt(__x));
266}
267__DEVICE__
268double __dsqrt_ru(double __x) {
269 return __spirv_ocl_ceil(__spirv_ocl_sqrt(__x));
270}
271__DEVICE__
272double __dsqrt_rz(double __x) {
273 return __spirv_ocl_trunc(__spirv_ocl_sqrt(__x));
274}
275
276__DEVICE__
277double __dsub_rd(double __x, double __y) {
278 double res = __x - __y;
279 double rounded = __spirv_ocl_floor(res);
280 if (rounded > res)
281 rounded -= 1.0;
282 return rounded;
283}
284__DEVICE__
285double __dsub_rn(double __x, double __y) { return __spirv_ocl_rint(__x - __y); }
286__DEVICE__
287double __dsub_ru(double __x, double __y) { return __spirv_ocl_ceil(__x - __y); }
288__DEVICE__
289double __dsub_rz(double __x, double __y) {
290 return __spirv_ocl_trunc(__x - __y);
291}
292
293__DEVICE__
294double __fma_rd(double __x, double __y, double __z) {
295 double res = __x * __y + __z;
296 double rounded = __spirv_ocl_floor(res);
297 if (rounded > res)
298 rounded -= 1.0;
299 return rounded;
300}
301__DEVICE__
302double __fma_rn(double __x, double __y, double __z) {
303 return __spirv_ocl_rint(__x * __y + __z);
304}
305__DEVICE__
306double __fma_ru(double __x, double __y, double __z) {
307 return __spirv_ocl_ceil(__x * __y + __z);
308}
309__DEVICE__
310double __fma_rz(double __x, double __y, double __z) {
311 return __spirv_ocl_trunc(__x * __y + __z);
312}
313
314__DEVICE__ int abs(int __a) { return __spirv_ocl_s_abs(__a); }
315__DEVICE__ double fabs(double __a) { return __spirv_ocl_fabs(__a); }
316__DEVICE__ double acos(double __a) { return __spirv_ocl_acos(__a); }
317__DEVICE__ float acosf(float __a) { return __spirv_ocl_acos(__a); }
318__DEVICE__ double acosh(double __a) { return __spirv_ocl_acosh(__a); }
319__DEVICE__ float acoshf(float __a) { return __spirv_ocl_acosh(__a); }
320__DEVICE__ double asin(double __a) { return __spirv_ocl_asin(__a); }
321__DEVICE__ float asinf(float __a) { return __spirv_ocl_asin(__a); }
322__DEVICE__ double asinh(double __a) { return __spirv_ocl_asinh(__a); }
323__DEVICE__ float asinhf(float __a) { return __spirv_ocl_asinh(__a); }
324__DEVICE__ double atan(double __a) { return __spirv_ocl_atan(__a); }
325__DEVICE__ double atan2(double __a, double __b) {
326 return __spirv_ocl_atan2(__a, __b);
327}
328__DEVICE__ float atan2f(float __a, float __b) {
329 return __spirv_ocl_atan2(__a, __b);
330}
331__DEVICE__ float atanf(float __a) { return __spirv_ocl_atan(__a); }
332__DEVICE__ double atanh(double __a) { return __spirv_ocl_atanh(__a); }
333__DEVICE__ float atanhf(float __a) { return __spirv_ocl_atanh(__a); }
334__DEVICE__ double cbrt(double __a) { return __spirv_ocl_cbrt(__a); }
335__DEVICE__ float cbrtf(float __a) { return __spirv_ocl_cbrt(__a); }
336__DEVICE__ double ceil(double __a) { return __spirv_ocl_ceil(__a); }
337__DEVICE__ float ceilf(float __a) { return __spirv_ocl_ceil(__a); }
338__DEVICE__ double copysign(double __a, double __b) {
339 return __spirv_ocl_copysign(__a, __b);
340}
341__DEVICE__ float copysignf(float __a, float __b) {
342 return __spirv_ocl_copysign(__a, __b);
343}
344__DEVICE__ double cos(double __a) { return __spirv_ocl_cos(__a); }
345__DEVICE__ float cosf(float __a) { return __spirv_ocl_cos(__a); }
346__DEVICE__ double cosh(double __a) { return __spirv_ocl_cosh(__a); }
347__DEVICE__ float coshf(float __a) { return __spirv_ocl_cosh(__a); }
348__DEVICE__ double cospi(double __a) { return __spirv_ocl_cospi(__a); }
349__DEVICE__ float cospif(float __a) { return __spirv_ocl_cospi(__a); }
350__DEVICE__ double erf(double __a) { return __spirv_ocl_erf(__a); }
351__DEVICE__ double erfc(double __a) { return __spirv_ocl_erfc(__a); }
352__DEVICE__ float erfcf(float __a) { return __spirv_ocl_erfc(__a); }
353__DEVICE__ double erfcx(double __a) {
354 return __spirv_ocl_exp(__a * __a) * __spirv_ocl_erfc(__a);
355}
356__DEVICE__ float erfcxf(float __a) {
357 return __spirv_ocl_exp(__a * __a) * __spirv_ocl_erfc(__a);
358}
359__DEVICE__ float erff(float __a) { return __spirv_ocl_erf(__a); }
360__DEVICE__ double exp(double __a) { return __spirv_ocl_exp(__a); }
361__DEVICE__ double exp10(double __a) { return __spirv_ocl_exp10(__a); }
362__DEVICE__ float exp10f(float __a) { return __spirv_ocl_exp10(__a); }
363__DEVICE__ double exp2(double __a) { return __spirv_ocl_exp2(__a); }
364__DEVICE__ float exp2f(float __a) { return __spirv_ocl_exp2(__a); }
365__DEVICE__ float expf(float __a) { return __spirv_ocl_exp(__a); }
366__DEVICE__ double expm1(double __a) { return __spirv_ocl_expm1(__a); }
367__DEVICE__ float expm1f(float __a) { return __spirv_ocl_expm1(__a); }
368__DEVICE__ float fabsf(float __a) { return __spirv_ocl_fabs(__a); }
369__DEVICE__ double fdim(double __a, double __b) {
370 return __spirv_ocl_fdim(__a, __b);
371}
372__DEVICE__ float fdimf(float __a, float __b) {
373 return __spirv_ocl_fdim(__a, __b);
374}
375__DEVICE__ double fdivide(double __a, double __b) { return __a / __b; }
376__DEVICE__ float fdividef(float __a, float __b) { return __a / __b; }
377__DEVICE__ double floor(double __f) { return __spirv_ocl_floor(__f); }
378__DEVICE__ float floorf(float __f) { return __spirv_ocl_floor(__f); }
379__DEVICE__ double fma(double __a, double __b, double __c) {
380 return __spirv_ocl_fma(__a, __b, __c);
381}
382__DEVICE__ float fmaf(float __a, float __b, float __c) {
383 return __spirv_ocl_fma(__a, __b, __c);
384}
385__DEVICE__ double fmax(double __a, double __b) {
386 return __spirv_ocl_fmax(__a, __b);
387}
388__DEVICE__ float fmaxf(float __a, float __b) {
389 return __spirv_ocl_fmax(__a, __b);
390}
391__DEVICE__ double fmin(double __a, double __b) {
392 return __spirv_ocl_fmin(__a, __b);
393}
394__DEVICE__ float fminf(float __a, float __b) {
395 return __spirv_ocl_fmin(__a, __b);
396}
397__DEVICE__ double fmod(double __a, double __b) {
398 return __spirv_ocl_fmod(__a, __b);
399}
400__DEVICE__ float fmodf(float __a, float __b) {
401 return __spirv_ocl_fmod(__a, __b);
402}
403__DEVICE__ double frexp(double __a, int *__b) {
404 return __spirv_ocl_frexp(__a, __b);
405}
406__DEVICE__ float frexpf(float __a, int *__b) {
407 return __spirv_ocl_frexp(__a, __b);
408}
409__DEVICE__ double hypot(double __a, double __b) {
410 return __spirv_ocl_hypot(__a, __b);
411}
412__DEVICE__ float hypotf(float __a, float __b) {
413 return __spirv_ocl_hypot(__a, __b);
414}
415__DEVICE__ int ilogb(double __a) { return __spirv_ocl_ilogb(__a); }
416__DEVICE__ int ilogbf(float __a) { return __spirv_ocl_ilogb(__a); }
417__DEVICE__ long labs(long __a) { return __spirv_ocl_s_abs(__a); };
418__DEVICE__ double ldexp(double __a, int __b) {
419 return __spirv_ocl_ldexp(__a, __b);
420}
421__DEVICE__ float ldexpf(float __a, int __b) {
422 return __spirv_ocl_ldexp(__a, __b);
423}
424__DEVICE__ double lgamma(double __a) { return __spirv_ocl_lgamma(__a); }
425__DEVICE__ float lgammaf(float __a) { return __spirv_ocl_lgamma(__a); }
426__DEVICE__ long long llabs(long long __a) { return __spirv_ocl_s_abs(__a); }
427__DEVICE__ long long llmax(long long __a, long long __b) {
428 return __spirv_ocl_s_max(__a, __b);
429}
430__DEVICE__ long long llmin(long long __a, long long __b) {
431 return __spirv_ocl_s_min(__a, __b);
432}
433__DEVICE__ long long llrint(double __a) { return __builtin_rint(__a); }
434__DEVICE__ long long llrintf(float __a) { return __builtin_rintf(__a); }
435__DEVICE__ long long llround(double __a) { return __builtin_round(__a); }
436__DEVICE__ long long llroundf(float __a) { return __builtin_roundf(__a); }
437__DEVICE__ double round(double __a) { return __spirv_ocl_round(__a); }
438__DEVICE__ float roundf(float __a) { return __spirv_ocl_round(__a); }
439__DEVICE__ double log(double __a) { return __spirv_ocl_log(__a); }
440__DEVICE__ double log10(double __a) { return __spirv_ocl_log10(__a); }
441__DEVICE__ float log10f(float __a) { return __spirv_ocl_log10(__a); }
442__DEVICE__ double log1p(double __a) { return __spirv_ocl_log1p(__a); }
443__DEVICE__ float log1pf(float __a) { return __spirv_ocl_log1p(__a); }
444__DEVICE__ double log2(double __a) { return __spirv_ocl_log2(__a); }
445__DEVICE__ float log2f(float __a) { return __spirv_ocl_log2(__a); }
446__DEVICE__ double logb(double __a) { return __spirv_ocl_logb(__a); }
447__DEVICE__ float logbf(float __a) { return __spirv_ocl_logb(__a); }
448__DEVICE__ float logf(float __a) { return __spirv_ocl_log(__a); }
449__DEVICE__ long lrint(double __a) { return __builtin_rint(__a); }
450__DEVICE__ long lrintf(float __a) { return __builtin_rintf(__a); }
451__DEVICE__ long lround(double __a) { return __builtin_round(__a); }
452__DEVICE__ long lroundf(float __a) { return __builtin_roundf(__a); }
453__DEVICE__ int max(int __a, int __b) { return __spirv_ocl_s_max(__a, __b); }
454__DEVICE__ int min(int __a, int __b) { return __spirv_ocl_s_min(__a, __b); }
455__DEVICE__ double modf(double __a, double *__b) {
456 return __spirv_ocl_modf(__a, __b);
457}
458__DEVICE__ float modff(float __a, float *__b) {
459 return __spirv_ocl_modf(__a, __b);
460}
461__DEVICE__ double nearbyint(double __a) { return __spirv_ocl_rint(__a); }
462__DEVICE__ float nearbyintf(float __a) { return __spirv_ocl_rint(__a); }
463__DEVICE__ double nextafter(double __a, double __b) {
464 return __spirv_ocl_nextafter(__a, __b);
465}
466__DEVICE__ float nextafterf(float __a, float __b) {
467 return __spirv_ocl_nextafter(__a, __b);
468}
469
470__DEVICE__ double norm(int __dim, const double *__a) {
471 double __r = 0;
472 while (__dim--) {
473 __r += __a[0] * __a[0];
474 ++__a;
475 }
476
477 return __spirv_ocl_sqrt(__r);
478}
479__DEVICE__ double norm3d(double __a, double __b, double __c) {
480 return __spirv_ocl_sqrt(__a * __a + __b * __b + __c * __c);
481}
482__DEVICE__ float norm3df(float __a, float __b, float __c) {
483 return __spirv_ocl_sqrt(__a * __a + __b * __b + __c * __c);
484}
485__DEVICE__ double norm4d(double __a, double __b, double __c, double __d) {
486 return __spirv_ocl_sqrt(__a * __a + __b * __b + __c * __c + __d * __d);
487}
488__DEVICE__ float norm4df(float __a, float __b, float __c, float __d) {
489 return __spirv_ocl_sqrt(__a * __a + __b * __b + __c * __c + __d * __d);
490}
491__DEVICE__ double normcdf(double __a) {
492 return 0.5 * (1.0 + __spirv_ocl_erf(__a * __spirv_ocl_rsqrt(2.0)));
493}
494__DEVICE__ float normcdff(float __a) {
495 return 0.5f * (1.0f + __spirv_ocl_erf(__a * __spirv_ocl_rsqrt(2.0f)));
496}
497__DEVICE__ float normf(int __dim, const float *__a) {
498 float __r = 0;
499 while (__dim--) {
500 __r += __a[0] * __a[0];
501 ++__a;
502 }
503 return __spirv_ocl_sqrt(__r);
504}
505__DEVICE__ double pow(double __a, double __b) {
506 return __spirv_ocl_pow(__a, __b);
507}
508__DEVICE__ float powf(float __a, float __b) {
509 return __spirv_ocl_pow(__a, __b);
510}
511__DEVICE__ double powi(double __a, int __b) { return pow(__a, (double)__b); }
512__DEVICE__ float powif(float __a, int __b) { return pow(__a, (float)__b); }
513__DEVICE__ double rcbrt(double __a) { return 1.0 / __spirv_ocl_cbrt(__a); }
514__DEVICE__ float rcbrtf(float __a) { return 1.0f / __spirv_ocl_cbrt(__a); }
515__DEVICE__ double remainder(double __a, double __b) {
516 return __spirv_ocl_remainder(__a, __b);
517}
518__DEVICE__ float remainderf(float __a, float __b) {
519 return __spirv_ocl_remainder(__a, __b);
520}
521__DEVICE__ double remquo(double __a, double __b, int *__c) {
522 return __spirv_ocl_remquo(__a, __b, __c);
523}
524__DEVICE__ float remquof(float __a, float __b, int *__c) {
525 return __spirv_ocl_remquo(__a, __b, __c);
526}
527__DEVICE__ double rhypot(double __a, double __b) {
528 return __spirv_ocl_hypot(__a, __b);
529}
530__DEVICE__ float rhypotf(float __a, float __b) {
531 return __spirv_ocl_hypot(__a, __b);
532}
533__DEVICE__ double rint(double __a) { return __spirv_ocl_rint(__a); }
534__DEVICE__ float rintf(float __a) { return __spirv_ocl_rint(__a); }
535__DEVICE__ double rnorm(int __dim, const double *__a) {
536 double __r = 0;
537 while (__dim--) {
538 __r += __a[0] * __a[0];
539 ++__a;
540 }
541
542 return __spirv_ocl_rsqrt(__r);
543}
544__DEVICE__ double rnorm3d(double __a, double __b, double __c) {
545 return __spirv_ocl_rsqrt(__a * __a + __b * __b + __c * __c);
546}
547__DEVICE__ float rnorm3df(float __a, float __b, float __c) {
548 return __spirv_ocl_rsqrt(__a * __a + __b * __b + __c * __c);
549}
550__DEVICE__ double rnorm4d(double __a, double __b, double __c, double __d) {
551 return __spirv_ocl_rsqrt(__a * __a + __b * __b + __c * __c + __d * __d);
552}
553__DEVICE__ float rnorm4df(float __a, float __b, float __c, float __d) {
554 return __spirv_ocl_rsqrt(__a * __a + __b * __b + __c * __c + __d * __d);
555}
556__DEVICE__ float rnormf(int __dim, const float *__a) {
557 float __r = 0;
558 while (__dim--) {
559 __r += __a[0] * __a[0];
560 ++__a;
561 }
562
563 return __spirv_ocl_rsqrt(__r);
564}
565__DEVICE__ double rsqrt(double __a) { return __spirv_ocl_rsqrt(__a); }
566__DEVICE__ float rsqrtf(float __a) { return __spirv_ocl_rsqrt(__a); }
567__DEVICE__ double scalbn(double __a, int __b) {
568 return __spirv_ocl_ldexp(__a, __b);
569}
570__DEVICE__ float scalbnf(float __a, int __b) {
571 return __spirv_ocl_ldexp(__a, __b);
572}
573__DEVICE__ double scalbln(double __a, long __b) {
574 if (__b > INT_MAX)
575 return __a > 0 ? HUGE_VAL : -HUGE_VAL;
576 if (__b < INT_MIN)
577 return __a > 0 ? 0.0 : -0.0;
578 return scalbn(__a, (int)__b);
579}
580__DEVICE__ float scalblnf(float __a, long __b) {
581 if (__b > INT_MAX)
582 return __a > 0 ? HUGE_VALF : -HUGE_VALF;
583 if (__b < INT_MIN)
584 return __a > 0 ? 0.f : -0.f;
585 return scalbnf(__a, (int)__b);
586}
587__DEVICE__ double sin(double __a) { return __spirv_ocl_sin(__a); }
588__DEVICE__ void sincos(double __a, double *__s, double *__c) {
589 *__s = __spirv_ocl_sincos(__a, __c);
590}
591__DEVICE__ void sincosf(float __a, float *__s, float *__c) {
592 *__s = __spirv_ocl_sincos(__a, __c);
593}
594__DEVICE__ void sincospi(double __a, double *__s, double *__c) {
595 *__s = __spirv_ocl_sinpi(__a);
596 *__c = __spirv_ocl_cospi(__a);
597}
598__DEVICE__ void sincospif(float __a, float *__s, float *__c) {
599 *__s = __spirv_ocl_sinpi(__a);
600 *__c = __spirv_ocl_cospi(__a);
601}
602__DEVICE__ float sinf(float __a) { return __spirv_ocl_sin(__a); }
603__DEVICE__ double sinh(double __a) { return __spirv_ocl_sinh(__a); }
604__DEVICE__ float sinhf(float __a) { return __spirv_ocl_sinh(__a); }
605__DEVICE__ double sinpi(double __a) { return __spirv_ocl_sinpi(__a); }
606__DEVICE__ float sinpif(float __a) { return __spirv_ocl_sinpi(__a); }
607__DEVICE__ double sqrt(double __a) { return __spirv_ocl_sqrt(__a); }
608__DEVICE__ float sqrtf(float __a) { return __spirv_ocl_sqrt(__a); }
609__DEVICE__ double tan(double __a) { return __spirv_ocl_tan(__a); }
610__DEVICE__ float tanf(float __a) { return __spirv_ocl_tan(__a); }
611__DEVICE__ double tanh(double __a) { return __spirv_ocl_tanh(__a); }
612__DEVICE__ float tanhf(float __a) { return __spirv_ocl_tanh(__a); }
613__DEVICE__ double tgamma(double __a) { return __spirv_ocl_tgamma(__a); }
614__DEVICE__ float tgammaf(float __a) { return __spirv_ocl_tgamma(__a); }
615__DEVICE__ double trunc(double __a) { return __spirv_ocl_trunc(__a); }
616__DEVICE__ float truncf(float __a) { return __spirv_ocl_trunc(__a); }
617__DEVICE__ unsigned long long ullmax(unsigned long long __a,
618 unsigned long long __b) {
619 return __spirv_ocl_u_max(__a, __b);
620}
621__DEVICE__ unsigned long long ullmin(unsigned long long __a,
622 unsigned long long __b) {
623 return __spirv_ocl_u_min(__a, __b);
624}
625__DEVICE__ unsigned int umax(unsigned int __a, unsigned int __b) {
626 return __spirv_ocl_u_max(__a, __b);
627}
628__DEVICE__ unsigned int umin(unsigned int __a, unsigned int __b) {
629 return __spirv_ocl_u_min(__a, __b);
630}
631
632#if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
633#define isfinite(__x) _Generic((__x), float: __finitef, double: __finite)(__x)
634#define isinf(__x) _Generic((__x), float: __isinff, double: __isinf)(__x)
635#define isnan(__x) _Generic((__x), float: __isnanf, double: __isnan)(__x)
636#define signbit(__x) _Generic((__x), float: __signbitf, double: __signbit)(__x)
637#endif // !defined(__cplusplus) && __STDC_VERSION__ >= 201112L
638
639__DEVICE__
640unsigned long __make_mantissa_base8(const char *__tagp) {
641 unsigned long __r = 0;
642 while (*__tagp != '\0') {
643 char __tmp = *__tagp;
644
645 if (__tmp >= '0' && __tmp <= '7')
646 __r = (__r * 8u) + __tmp - '0';
647 else
648 return 0;
649
650 ++__tagp;
651 }
652
653 return __r;
654}
655
656__DEVICE__
657unsigned long __make_mantissa_base10(const char *__tagp) {
658 unsigned long __r = 0;
659 while (*__tagp != '\0') {
660 char __tmp = *__tagp;
661
662 if (__tmp >= '0' && __tmp <= '9')
663 __r = (__r * 10u) + __tmp - '0';
664 else
665 return 0;
666
667 ++__tagp;
668 }
669
670 return __r;
671}
672
673__DEVICE__
674unsigned long __make_mantissa_base16(const char *__tagp) {
675 unsigned long __r = 0;
676 while (*__tagp != '\0') {
677 char __tmp = *__tagp;
678
679 if (__tmp >= '0' && __tmp <= '9')
680 __r = (__r * 16u) + __tmp - '0';
681 else if (__tmp >= 'a' && __tmp <= 'f')
682 __r = (__r * 16u) + __tmp - 'a' + 10;
683 else if (__tmp >= 'A' && __tmp <= 'F')
684 __r = (__r * 16u) + __tmp - 'A' + 10;
685 else
686 return 0;
687
688 ++__tagp;
689 }
690
691 return __r;
692}
693
694__DEVICE__
695unsigned long __make_mantissa(const char *__tagp) {
696 if (!__tagp)
697 return 0;
698 if (*__tagp == '0') {
699 ++__tagp;
700
701 if (*__tagp == 'x' || *__tagp == 'X')
702 return __make_mantissa_base16(++__tagp);
703 else
704 return __make_mantissa_base8(__tagp);
705 }
706
707 return __make_mantissa_base10(__tagp);
708}
709
710float nanf(const char *__tagp) {
711 return __spirv_ocl_nan((unsigned int)__make_mantissa(__tagp));
712}
713double nan(const char *__tagp) {
714 return __spirv_ocl_nan(__make_mantissa(__tagp));
715}
716
717#pragma pop_macro("__DEVICE__")
718#endif // __CLANG_GPU_DISABLE_MATH_WRAPPERS
719#endif // __CLANG_SPIRV_MATH_H__
lib/include/altivec.h+79-9
......@@ -2117,7 +2117,7 @@ vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
21172117}
21182118#endif
21192119
2120#ifdef __VSX__
2120#ifdef __POWER8_VECTOR__
21212121static __inline__ vector bool long long __ATTRS_o_ai
21222122vec_cmpne(vector double __a, vector double __b) {
21232123 return (vector bool long long)
......@@ -6404,6 +6404,18 @@ vec_mulh(vector unsigned long long __a, vector unsigned long long __b) {
64046404}
64056405#endif
64066406
6407#ifdef __FUTURE_VECTOR__
6408static __inline__ vector signed short
6409 __ATTRS_o_ai vec_mulh(vector signed short __a, vector signed short __b) {
6410 return __builtin_altivec_vmulhsh(__a, __b);
6411}
6412
6413static __inline__ vector unsigned short __ATTRS_o_ai
6414vec_mulh(vector unsigned short __a, vector unsigned short __b) {
6415 return __builtin_altivec_vmulhuh(__a, __b);
6416}
6417#endif
6418
64076419/* vec_mulo */
64086420
64096421static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
......@@ -17809,6 +17821,7 @@ vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
1780917821/* vec_xl_be */
1781017822
1781117823#ifdef __LITTLE_ENDIAN__
17824#ifdef __VSX__
1781217825static __inline__ vector signed char __ATTRS_o_ai
1781317826vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) {
1781417827 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
......@@ -17850,7 +17863,6 @@ vec_xl_be(signed long long __offset, const float *__ptr) {
1785017863 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
1785117864}
1785217865
17853#ifdef __VSX__
1785417866static __inline__ vector signed long long __ATTRS_o_ai
1785517867vec_xl_be(signed long long __offset, const signed long long *__ptr) {
1785617868 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
......@@ -17865,7 +17877,6 @@ static __inline__ vector double __ATTRS_o_ai
1786517877vec_xl_be(signed long long __offset, const double *__ptr) {
1786617878 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
1786717879}
17868#endif
1786917880
1787017881#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
1787117882 defined(__SIZEOF_INT128__)
......@@ -17879,8 +17890,9 @@ vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
1787917890 return vec_xl(__offset, __ptr);
1788017891}
1788117892#endif
17882#else
17883 #define vec_xl_be vec_xl
17893#endif // __VSX__
17894#else // ! __LITTLE_ENDIAN__
17895#define vec_xl_be vec_xl
1788417896#endif
1788517897
1788617898#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
......@@ -18130,6 +18142,7 @@ vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
1813018142/* vec_xst_be */
1813118143
1813218144#ifdef __LITTLE_ENDIAN__
18145#ifdef __VSX__
1813318146static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
1813418147 signed long long __offset,
1813518148 signed char *__ptr) {
......@@ -18186,7 +18199,6 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
1818618199 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
1818718200}
1818818201
18189#ifdef __VSX__
1819018202static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
1819118203 signed long long __offset,
1819218204 signed long long *__ptr) {
......@@ -18204,7 +18216,6 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
1820418216 double *__ptr) {
1820518217 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
1820618218}
18207#endif
1820818219
1820918220#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
1821018221 defined(__SIZEOF_INT128__)
......@@ -18220,8 +18231,9 @@ static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
1822018231 vec_xst(__vec, __offset, __ptr);
1822118232}
1822218233#endif
18223#else
18224 #define vec_xst_be vec_xst
18234#endif // VSX
18235#else // ! __LITTLE_ENDIAN__
18236#define vec_xst_be vec_xst
1822518237#endif
1822618238
1822718239#ifdef __POWER9_VECTOR__
......@@ -19314,6 +19326,64 @@ vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) {
1931419326#endif /* __SIZEOF_INT128__ */
1931519327#endif /* __POWER10_VECTOR__ */
1931619328
19329#ifdef __FUTURE_VECTOR__
19330
19331/* vec_uncompress* - Deeply Compressed Weights builtins */
19332
19333static __inline__ vector unsigned char __ATTRS_o_ai
19334vec_uncompresshn(vector unsigned char __a, vector unsigned char __b) {
19335 return __builtin_altivec_vucmprhn(__a, __b);
19336}
19337
19338static __inline__ vector unsigned char __ATTRS_o_ai
19339vec_uncompressln(vector unsigned char __a, vector unsigned char __b) {
19340 return __builtin_altivec_vucmprln(__a, __b);
19341}
19342
19343static __inline__ vector unsigned char __ATTRS_o_ai
19344vec_uncompresshb(vector unsigned char __a, vector unsigned char __b) {
19345 return __builtin_altivec_vucmprhb(__a, __b);
19346}
19347
19348static __inline__ vector unsigned char __ATTRS_o_ai
19349vec_uncompresslb(vector unsigned char __a, vector unsigned char __b) {
19350 return __builtin_altivec_vucmprlb(__a, __b);
19351}
19352
19353static __inline__ vector unsigned char __ATTRS_o_ai
19354vec_uncompresshh(vector unsigned char __a, vector unsigned char __b) {
19355 return __builtin_altivec_vucmprhh(__a, __b);
19356}
19357
19358static __inline__ vector unsigned char __ATTRS_o_ai
19359vec_uncompresslh(vector unsigned char __a, vector unsigned char __b) {
19360 return __builtin_altivec_vucmprlh(__a, __b);
19361}
19362
19363static __inline__ vector unsigned char __ATTRS_o_ai
19364vec_unpack_hsn_to_byte(vector unsigned char __a) {
19365 return __builtin_altivec_vupkhsntob(__a);
19366}
19367
19368static __inline__ vector unsigned char __ATTRS_o_ai
19369vec_unpack_lsn_to_byte(vector unsigned char __a) {
19370 return __builtin_altivec_vupklsntob(__a);
19371}
19372
19373#define vec_unpack_int4_to_bf16(__a, __imm) \
19374 __builtin_altivec_vupkint4tobf16((__a), (__imm))
19375
19376#define vec_unpack_int8_to_bf16(__a, __imm) \
19377 __builtin_altivec_vupkint8tobf16((__a), (__imm))
19378
19379#define vec_unpack_int4_to_fp32(__a, __imm) \
19380 __builtin_altivec_vupkint4tofp32((__a), (__imm))
19381
19382#define vec_unpack_int8_to_fp32(__a, __imm) \
19383 __builtin_altivec_vupkint8tofp32((__a), (__imm))
19384
19385#endif /* __FUTURE_VECTOR__ */
19386
1931719387#ifdef __POWER8_VECTOR__
1931819388#define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps))
1931919389#define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps))
lib/include/amdhsa_abi.h created+83
......@@ -0,0 +1,83 @@
1//===-- amdhsa_abi.h - AMDHSA ABI definition utilities --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef __AMDHSA_ABI_H
10#define __AMDHSA_ABI_H
11
12#include <stddef.h>
13#include <stdint.h>
14
15typedef struct __attribute__((aligned(8))) amdhsa_implicit_kernarg_v5 {
16 uint32_t block_count[3];
17 uint16_t group_size[3];
18 uint16_t remainder[3];
19 char reserved0[16];
20 uint64_t global_offset[3];
21 uint16_t grid_dims;
22 char reserved1[6];
23 __attribute__((opencl_global)) void *printf_buffer;
24 __attribute__((opencl_global)) void *hostcall_buffer;
25 __attribute__((opencl_global)) void *multigrid_sync_arg;
26 __attribute__((opencl_global)) void *heap_v1;
27 __attribute__((opencl_global)) void *default_queue;
28 __attribute__((opencl_global)) void *completion_action;
29 char reserved2[72];
30 uint32_t private_base; // Unused on gfx9+
31 uint32_t shared_base; // Unused on gfx9+
32 __attribute__((opencl_global)) void *queue_ptr;
33 char reserved3[48];
34} amdhsa_implicit_kernarg_v5;
35
36_Static_assert(sizeof(amdhsa_implicit_kernarg_v5) == 256, "wrong struct size");
37
38_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[0]) == 0,
39 "wrong offset");
40_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[1]) == 4,
41 "wrong offset");
42_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, block_count[2]) == 8,
43 "wrong offset");
44_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[0]) == 12,
45 "wrong offset");
46_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[1]) == 14,
47 "wrong offset");
48_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, group_size[2]) == 16,
49 "wrong offset");
50_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[0]) == 18,
51 "wrong offset");
52_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[1]) == 20,
53 "wrong offset");
54_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, remainder[2]) == 22,
55 "wrong offset");
56_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[0]) == 40,
57 "wrong offset");
58_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[1]) == 48,
59 "wrong offset");
60_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, global_offset[2]) == 56,
61 "wrong offset");
62_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, grid_dims) == 64,
63 "wrong offset");
64_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, printf_buffer) == 72,
65 "wrong offset");
66_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, hostcall_buffer) == 80,
67 "wrong offset");
68_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, multigrid_sync_arg) == 88,
69 "wrong offset");
70_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, heap_v1) == 96,
71 "wrong offset");
72_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, default_queue) == 104,
73 "wrong offset");
74_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, completion_action) == 112,
75 "wrong offset");
76_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, private_base) == 192,
77 "wrong offset");
78_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, shared_base) == 196,
79 "wrong offset");
80_Static_assert(offsetof(amdhsa_implicit_kernarg_v5, queue_ptr) == 200,
81 "wrong offset");
82
83#endif // __AMDHSA_ABI_H
lib/include/amo.h+89
......@@ -124,6 +124,95 @@ static inline int64_t amo_ldat_sswap(int64_t *ptr, int64_t val) {
124124 return __builtin_amo_ldat_s(ptr, val, _AMO_LD_SWAP);
125125}
126126
127/* AMO Store Operation Codes (FC values) */
128enum _AMO_ST {
129 _AMO_ST_ADD = 0x00, /* Store Add */
130 _AMO_ST_XOR = 0x01, /* Store Xor */
131 _AMO_ST_IOR = 0x02, /* Store Ior */
132 _AMO_ST_AND = 0x03, /* Store And */
133 _AMO_ST_UMAX = 0x04, /* Store Unsigned Maximum */
134 _AMO_ST_SMAX = 0x05, /* Store Signed Maximum */
135 _AMO_ST_UMIN = 0x06, /* Store Unsigned Minimum */
136 _AMO_ST_SMIN = 0x07, /* Store Signed Minimum */
137 _AMO_ST_TWIN = 0x18 /* Store Twin */
138};
139
140/* 32-bit unsigned AMO store operations */
141static inline void amo_stwat_add(uint32_t *ptr, uint32_t val) {
142 __builtin_amo_stwat(ptr, val, _AMO_ST_ADD);
143}
144
145static inline void amo_stwat_xor(uint32_t *ptr, uint32_t val) {
146 __builtin_amo_stwat(ptr, val, _AMO_ST_XOR);
147}
148
149static inline void amo_stwat_ior(uint32_t *ptr, uint32_t val) {
150 __builtin_amo_stwat(ptr, val, _AMO_ST_IOR);
151}
152
153static inline void amo_stwat_and(uint32_t *ptr, uint32_t val) {
154 __builtin_amo_stwat(ptr, val, _AMO_ST_AND);
155}
156
157static inline void amo_stwat_umax(uint32_t *ptr, uint32_t val) {
158 __builtin_amo_stwat(ptr, val, _AMO_ST_UMAX);
159}
160
161static inline void amo_stwat_umin(uint32_t *ptr, uint32_t val) {
162 __builtin_amo_stwat(ptr, val, _AMO_ST_UMIN);
163}
164
165/* 32-bit signed AMO store operations */
166static inline void amo_stwat_sadd(int32_t *ptr, int32_t val) {
167 __builtin_amo_stwat_s(ptr, val, _AMO_ST_ADD);
168}
169
170static inline void amo_stwat_smax(int32_t *ptr, int32_t val) {
171 __builtin_amo_stwat_s(ptr, val, _AMO_ST_SMAX);
172}
173
174static inline void amo_stwat_smin(int32_t *ptr, int32_t val) {
175 __builtin_amo_stwat_s(ptr, val, _AMO_ST_SMIN);
176}
177
178/* 64-bit unsigned AMO store operations */
179static inline void amo_stdat_add(uint64_t *ptr, uint64_t val) {
180 __builtin_amo_stdat(ptr, val, _AMO_ST_ADD);
181}
182
183static inline void amo_stdat_xor(uint64_t *ptr, uint64_t val) {
184 __builtin_amo_stdat(ptr, val, _AMO_ST_XOR);
185}
186
187static inline void amo_stdat_ior(uint64_t *ptr, uint64_t val) {
188 __builtin_amo_stdat(ptr, val, _AMO_ST_IOR);
189}
190
191static inline void amo_stdat_and(uint64_t *ptr, uint64_t val) {
192 __builtin_amo_stdat(ptr, val, _AMO_ST_AND);
193}
194
195static inline void amo_stdat_umax(uint64_t *ptr, uint64_t val) {
196 __builtin_amo_stdat(ptr, val, _AMO_ST_UMAX);
197}
198
199static inline void amo_stdat_umin(uint64_t *ptr, uint64_t val) {
200 __builtin_amo_stdat(ptr, val, _AMO_ST_UMIN);
201}
202
203/* 64-bit signed AMO store operations */
204static inline void amo_stdat_sadd(int64_t *ptr, int64_t val) {
205 __builtin_amo_stdat_s(ptr, val, _AMO_ST_ADD);
206}
207
208static inline void amo_stdat_smax(int64_t *ptr, int64_t val) {
209 __builtin_amo_stdat_s(ptr, val, _AMO_ST_SMAX);
210}
211
212static inline void amo_stdat_smin(int64_t *ptr, int64_t val) {
213 __builtin_amo_stdat_s(ptr, val, _AMO_ST_SMIN);
214}
215
127216#ifdef __cplusplus
128217}
129218#endif
lib/include/amxtf32intrin.h deleted-108
......@@ -1,108 +0,0 @@
1/*===------------- amxtf32intrin.h - AMX_TF32 intrinsics -*- C++ -*---------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===------------------------------------------------------------------------===
8 */
9
10#ifndef __IMMINTRIN_H
11#error "Never use <amxtf32intrin.h> directly; include <immintrin.h> instead."
12#endif // __IMMINTRIN_H
13
14#ifndef __AMX_TF32INTRIN_H
15#define __AMX_TF32INTRIN_H
16#ifdef __x86_64__
17
18#define __DEFAULT_FN_ATTRS_TF32 \
19 __attribute__((__always_inline__, __nodebug__, __target__("amx-tf32")))
20
21/// Do Matrix Multiplication of \a a and \a b, and then do Matrix Plus
22/// with \a srcdst.
23/// All the calculation is base on float32 but with the lower 13-bit set to 0.
24///
25/// \headerfile <immintrin.h>
26///
27/// \code
28/// void _tile_mmultf32ps(constexpr int srcdst, constexpr int a, \
29/// constexpr int b);
30/// \endcode
31///
32/// This intrinsic corresponds to the <c> TMMULTF32PS </c> instruction.
33///
34/// \param srcdst
35/// The destination tile. Max size is 1024 Bytes.
36/// \param a
37/// The 1st source tile. Max size is 1024 Bytes.
38/// \param b
39/// The 2nd source tile. Max size is 1024 Bytes.
40///
41/// \code{.operation}
42/// DEFINE zero_lower_mantissa_bits_fp32(x[31:0]) {
43/// dword[12:0] := 0
44/// dword[31:13] := x[31:13]
45/// return dword
46/// }
47///
48/// DEFINE silence_snan_fp32(x[31:0]) {
49/// IF (x.exponent == 255 and x.fraction != 0 and x.fraction[22] == 0)
50/// x.fraction[22] := 1
51/// return x
52/// }
53///
54/// elements_a := a.colsb / 4
55/// elements_dest := srcdst.colsb / 4
56///
57/// FOR m = 0 TO (srcdst.rows-1)
58/// tmp[511:0] := 0
59/// FOR k = 0 TO (elements_a-1)
60/// FOR n = 0 TO (elements_dest-1)
61/// af := silence_snan_fp32(a.row[m].fp32[k])
62/// bf := silence_snan_fp32(b.row[k].fp32[n])
63/// tmp.fp32[n] += zero_lower_mantissa_bits_fp32(af)
64/// * zero_lower_mantissa_bits_fp32(bf)
65/// ENDFOR
66/// ENDFOR
67///
68/// FOR n = 0 TO (elements_dest-1)
69/// tmp.fp32[n] += srcdst.row[m].fp32[n]
70/// ENDFOR
71/// write_row_and_zero(srcdst, m, tmp, srcdst.colsb)
72///
73/// ENDFOR
74///
75/// zero_upper_rows(srcdst, srcdst.rows)
76/// zero_tileconfig_start()
77/// \endcode
78#define _tile_mmultf32ps(srcdst, a, b) \
79 __builtin_ia32_tmmultf32ps((srcdst), (a), (b))
80
81static __inline__ _tile1024i __DEFAULT_FN_ATTRS_TF32
82_tile_mmultf32ps_internal(unsigned short m, unsigned short n, unsigned short k,
83 _tile1024i dst, _tile1024i src1, _tile1024i src2) {
84 return __builtin_ia32_tmmultf32ps_internal(m, n, k, dst, src1, src2);
85}
86
87/// Do Matrix Multiplication of src0 and src1, and then do Matrix Plus with dst.
88/// All the calculation is base on float32 but with the lower 13-bit set to 0.
89///
90/// \headerfile <immintrin.h>
91///
92/// This intrinsic corresponds to the <c> TMMULTF32PS </c> instruction.
93///
94/// \param dst
95/// The destination tile. Max size is 1024 Bytes.
96/// \param src0
97/// The 1st source tile. Max size is 1024 Bytes.
98/// \param src1
99/// The 2nd source tile. Max size is 1024 Bytes.
100__DEFAULT_FN_ATTRS_TF32
101static void __tile_mmultf32ps(__tile1024i *dst, __tile1024i src0,
102 __tile1024i src1) {
103 dst->tile = _tile_mmultf32ps_internal(src0.row, src1.col, src0.col, dst->tile,
104 src0.tile, src1.tile);
105}
106
107#endif // __x86_64__
108#endif // __AMX_TF32INTRIN_H
lib/include/andes_vector.h+5
......@@ -13,4 +13,9 @@
1313
1414#pragma clang riscv intrinsic andes_vector
1515
16#define __riscv_intrinsic_xandesvbfhcvt 1
17#define __riscv_intrinsic_xandesvdot 1
18#define __riscv_intrinsic_xandesvpackfph 1
19#define __riscv_intrinsic_xandesvsintload 1
20
1621#endif //_ANDES_VECTOR_H_
lib/include/arm64_neon.h created+21
......@@ -0,0 +1,21 @@
1/*===---- arm64_neon.h - ARM64 NEON intrinsics -----------------------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10/* Only include this if we're compiling for the windows platform. */
11#ifndef _MSC_VER
12#include_next <arm64_neon.h>
13#else
14
15#ifndef __ARM64_NEON_H
16#define __ARM64_NEON_H
17
18#include <arm_neon.h>
19
20#endif /* __ARM64_NEON_H */
21#endif /* _MSC_VER */
lib/include/arm64intr.h+10
......@@ -15,6 +15,16 @@
1515#ifndef __ARM64INTR_H
1616#define __ARM64INTR_H
1717
18/* Encode an AArch64 system register for use with
19 _ReadStatusReg/_WriteStatusReg. op0 must be 2 or 3; only the low bit is
20 stored. */
21#define ARM64_SYSREG(op0, op1, CRn, CRm, op2) \
22 ((((op0) & 0x1) << 14) | (((op1) & 0x7) << 11) | (((CRn) & 0xF) << 7) | \
23 (((CRm) & 0xF) << 3) | ((op2) & 0x7))
24
25#define ARM64_FPCR ARM64_SYSREG(3, 3, 4, 4, 0)
26#define ARM64_FPSR ARM64_SYSREG(3, 3, 4, 4, 1)
27
1828typedef enum
1929{
2030 _ARM64_BARRIER_SY = 0xF,
lib/include/arm_acle.h+1
......@@ -115,6 +115,7 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
115115#else
116116#define __plix(cache_level, retention_policy, addr) \
117117 __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
118#define __pldir(addr) __builtin_arm_prefetch_ir(addr)
118119#endif
119120
120121/* 7.7 NOP */
lib/include/arm_neon.h+3922-3754
......@@ -145,1431 +145,125 @@ typedef struct poly64x2x4_t {
145145#endif
146146#endif
147147#ifdef __LITTLE_ENDIAN__
148#define splatq_lane_bf16(__p0, __p1) __extension__ ({ \
149 bfloat16x8_t __ret; \
150 bfloat16x4_t __s0 = __p0; \
151 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
152 __ret; \
153})
154#else
155#define splatq_lane_bf16(__p0, __p1) __extension__ ({ \
156 bfloat16x8_t __ret; \
157 bfloat16x4_t __s0 = __p0; \
158 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
159 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_bf16(__builtin_bit_cast(int8x8_t, __rev0), __p1, 11)); \
160 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
161 __ret; \
162})
163#define __noswap_splatq_lane_bf16(__p0, __p1) __extension__ ({ \
164 bfloat16x8_t __ret; \
165 bfloat16x4_t __s0 = __p0; \
166 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
167 __ret; \
168})
169#endif
170
171#ifdef __LITTLE_ENDIAN__
172#define splat_lane_bf16(__p0, __p1) __extension__ ({ \
173 bfloat16x4_t __ret; \
174 bfloat16x4_t __s0 = __p0; \
175 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
176 __ret; \
177})
178#else
179#define splat_lane_bf16(__p0, __p1) __extension__ ({ \
180 bfloat16x4_t __ret; \
181 bfloat16x4_t __s0 = __p0; \
182 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
183 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_bf16(__builtin_bit_cast(int8x8_t, __rev0), __p1, 11)); \
184 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
185 __ret; \
186})
187#define __noswap_splat_lane_bf16(__p0, __p1) __extension__ ({ \
188 bfloat16x4_t __ret; \
189 bfloat16x4_t __s0 = __p0; \
190 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
191 __ret; \
192})
193#endif
194
195#ifdef __LITTLE_ENDIAN__
196#define splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
197 bfloat16x8_t __ret; \
198 bfloat16x8_t __s0 = __p0; \
199 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
200 __ret; \
201})
202#else
203#define splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
204 bfloat16x8_t __ret; \
205 bfloat16x8_t __s0 = __p0; \
206 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
207 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_bf16(__builtin_bit_cast(int8x16_t, __rev0), __p1, 43)); \
208 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
209 __ret; \
210})
211#define __noswap_splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
212 bfloat16x8_t __ret; \
213 bfloat16x8_t __s0 = __p0; \
214 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
215 __ret; \
216})
217#endif
218
219#ifdef __LITTLE_ENDIAN__
220#define splat_laneq_bf16(__p0, __p1) __extension__ ({ \
221 bfloat16x4_t __ret; \
222 bfloat16x8_t __s0 = __p0; \
223 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
224 __ret; \
225})
226#else
227#define splat_laneq_bf16(__p0, __p1) __extension__ ({ \
228 bfloat16x4_t __ret; \
229 bfloat16x8_t __s0 = __p0; \
230 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
231 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_bf16(__builtin_bit_cast(int8x16_t, __rev0), __p1, 43)); \
232 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
233 __ret; \
234})
235#define __noswap_splat_laneq_bf16(__p0, __p1) __extension__ ({ \
236 bfloat16x4_t __ret; \
237 bfloat16x8_t __s0 = __p0; \
238 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
239 __ret; \
240})
241#endif
242
243#ifdef __LITTLE_ENDIAN__
244__ai __attribute__((target("bf16,neon"))) float32x4_t vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
245 float32x4_t __ret;
246 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
247 return __ret;
248}
249#else
250__ai __attribute__((target("bf16,neon"))) float32x4_t vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
251 float32x4_t __ret;
252 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
253 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
254 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
255 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
256 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
257 return __ret;
258}
259__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
260 float32x4_t __ret;
261 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
262 return __ret;
263}
264#endif
265
266#ifdef __LITTLE_ENDIAN__
267__ai __attribute__((target("bf16,neon"))) float32x2_t vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
268 float32x2_t __ret;
269 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), __builtin_bit_cast(int8x8_t, __p2), 9));
270 return __ret;
271}
272#else
273__ai __attribute__((target("bf16,neon"))) float32x2_t vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
274 float32x2_t __ret;
275 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
276 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
277 bfloat16x4_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_64_16);
278 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __builtin_bit_cast(int8x8_t, __rev2), 9));
279 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
280 return __ret;
281}
282__ai __attribute__((target("bf16,neon"))) float32x2_t __noswap_vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
283 float32x2_t __ret;
284 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), __builtin_bit_cast(int8x8_t, __p2), 9));
285 return __ret;
286}
287#endif
288
289#ifdef __LITTLE_ENDIAN__
290__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
291 float32x4_t __ret;
292 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
293 return __ret;
294}
295#else
296__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
297 float32x4_t __ret;
298 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
299 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
300 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
301 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
302 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
303 return __ret;
304}
305__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
306 float32x4_t __ret;
307 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
308 return __ret;
309}
310#endif
311
312#ifdef __LITTLE_ENDIAN__
313__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
314 float32x4_t __ret;
315 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
316 return __ret;
317}
318#else
319__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
320 float32x4_t __ret;
321 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
322 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
323 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
324 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
325 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
326 return __ret;
327}
328__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
329 float32x4_t __ret;
330 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
331 return __ret;
332}
333#endif
334
335#ifdef __LITTLE_ENDIAN__
336__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmmlaq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
337 float32x4_t __ret;
338 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmmlaq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
339 return __ret;
340}
341#else
342__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmmlaq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
343 float32x4_t __ret;
344 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
345 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
346 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
347 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmmlaq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
348 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
349 return __ret;
350}
351#endif
352
353#ifdef __LITTLE_ENDIAN__
354__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
355 bfloat16x8_t __ret;
356 __ret = __builtin_shufflevector(__p0, __p1, 0, 1, 2, 3, 4, 5, 6, 7);
357 return __ret;
358}
359#else
360__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
361 bfloat16x8_t __ret;
362 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
363 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
364 __ret = __builtin_shufflevector(__rev0, __rev1, 0, 1, 2, 3, 4, 5, 6, 7);
365 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
366 return __ret;
367}
368__ai __attribute__((target("bf16,neon"))) bfloat16x8_t __noswap_vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
369 bfloat16x8_t __ret;
370 __ret = __builtin_shufflevector(__p0, __p1, 0, 1, 2, 3, 4, 5, 6, 7);
371 return __ret;
372}
373#endif
374
375#define vcreate_bf16(__p0) __extension__ ({ \
376 bfloat16x4_t __ret; \
377 uint64_t __promote = __p0; \
378 __ret = __builtin_bit_cast(bfloat16x4_t, __promote); \
379 __ret; \
380})
381__ai __attribute__((target("bf16,neon"))) float32_t vcvtah_f32_bf16(bfloat16_t __p0) {
382 float32_t __ret;
383 __ret = __builtin_bit_cast(float32_t, (uint32_t)(__builtin_bit_cast(uint16_t, __p0)) << 16);
384 return __ret;
385}
386__ai __attribute__((target("bf16,neon"))) bfloat16_t vcvth_bf16_f32(float32_t __p0) {
387 bfloat16_t __ret;
388 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vcvth_bf16_f32(__p0));
389 return __ret;
390}
391#ifdef __LITTLE_ENDIAN__
392#define vduph_lane_bf16(__p0, __p1) __extension__ ({ \
393 bfloat16_t __ret; \
394 bfloat16x4_t __s0 = __p0; \
395 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_lane_bf16(__s0, __p1)); \
396 __ret; \
397})
398#else
399#define vduph_lane_bf16(__p0, __p1) __extension__ ({ \
400 bfloat16_t __ret; \
401 bfloat16x4_t __s0 = __p0; \
402 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
403 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_lane_bf16(__rev0, __p1)); \
404 __ret; \
405})
406#endif
407
408#ifdef __LITTLE_ENDIAN__
409#define vdupq_lane_bf16(__p0_0, __p1_0) __extension__ ({ \
410 bfloat16x8_t __ret_0; \
411 bfloat16x4_t __s0_0 = __p0_0; \
412 __ret_0 = splatq_lane_bf16(__s0_0, __p1_0); \
413 __ret_0; \
414})
415#else
416#define vdupq_lane_bf16(__p0_1, __p1_1) __extension__ ({ \
417 bfloat16x8_t __ret_1; \
418 bfloat16x4_t __s0_1 = __p0_1; \
419 bfloat16x4_t __rev0_1; __rev0_1 = __builtin_shufflevector(__s0_1, __s0_1, __lane_reverse_64_16); \
420 __ret_1 = __noswap_splatq_lane_bf16(__rev0_1, __p1_1); \
421 __ret_1 = __builtin_shufflevector(__ret_1, __ret_1, __lane_reverse_128_16); \
422 __ret_1; \
423})
424#endif
425
426#ifdef __LITTLE_ENDIAN__
427#define vdup_lane_bf16(__p0_2, __p1_2) __extension__ ({ \
428 bfloat16x4_t __ret_2; \
429 bfloat16x4_t __s0_2 = __p0_2; \
430 __ret_2 = splat_lane_bf16(__s0_2, __p1_2); \
431 __ret_2; \
432})
433#else
434#define vdup_lane_bf16(__p0_3, __p1_3) __extension__ ({ \
435 bfloat16x4_t __ret_3; \
436 bfloat16x4_t __s0_3 = __p0_3; \
437 bfloat16x4_t __rev0_3; __rev0_3 = __builtin_shufflevector(__s0_3, __s0_3, __lane_reverse_64_16); \
438 __ret_3 = __noswap_splat_lane_bf16(__rev0_3, __p1_3); \
439 __ret_3 = __builtin_shufflevector(__ret_3, __ret_3, __lane_reverse_64_16); \
440 __ret_3; \
441})
442#endif
443
444#ifdef __LITTLE_ENDIAN__
445#define vduph_laneq_bf16(__p0, __p1) __extension__ ({ \
446 bfloat16_t __ret; \
447 bfloat16x8_t __s0 = __p0; \
448 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_laneq_bf16(__s0, __p1)); \
449 __ret; \
450})
451#else
452#define vduph_laneq_bf16(__p0, __p1) __extension__ ({ \
453 bfloat16_t __ret; \
454 bfloat16x8_t __s0 = __p0; \
455 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
456 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_laneq_bf16(__rev0, __p1)); \
457 __ret; \
458})
459#endif
460
461#ifdef __LITTLE_ENDIAN__
462#define vdupq_laneq_bf16(__p0_4, __p1_4) __extension__ ({ \
463 bfloat16x8_t __ret_4; \
464 bfloat16x8_t __s0_4 = __p0_4; \
465 __ret_4 = splatq_laneq_bf16(__s0_4, __p1_4); \
466 __ret_4; \
467})
468#else
469#define vdupq_laneq_bf16(__p0_5, __p1_5) __extension__ ({ \
470 bfloat16x8_t __ret_5; \
471 bfloat16x8_t __s0_5 = __p0_5; \
472 bfloat16x8_t __rev0_5; __rev0_5 = __builtin_shufflevector(__s0_5, __s0_5, __lane_reverse_128_16); \
473 __ret_5 = __noswap_splatq_laneq_bf16(__rev0_5, __p1_5); \
474 __ret_5 = __builtin_shufflevector(__ret_5, __ret_5, __lane_reverse_128_16); \
475 __ret_5; \
476})
477#endif
478
479#ifdef __LITTLE_ENDIAN__
480#define vdup_laneq_bf16(__p0_6, __p1_6) __extension__ ({ \
481 bfloat16x4_t __ret_6; \
482 bfloat16x8_t __s0_6 = __p0_6; \
483 __ret_6 = splat_laneq_bf16(__s0_6, __p1_6); \
484 __ret_6; \
485})
486#else
487#define vdup_laneq_bf16(__p0_7, __p1_7) __extension__ ({ \
488 bfloat16x4_t __ret_7; \
489 bfloat16x8_t __s0_7 = __p0_7; \
490 bfloat16x8_t __rev0_7; __rev0_7 = __builtin_shufflevector(__s0_7, __s0_7, __lane_reverse_128_16); \
491 __ret_7 = __noswap_splat_laneq_bf16(__rev0_7, __p1_7); \
492 __ret_7 = __builtin_shufflevector(__ret_7, __ret_7, __lane_reverse_64_16); \
493 __ret_7; \
494})
495#endif
496
497#ifdef __LITTLE_ENDIAN__
498__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vdupq_n_bf16(bfloat16_t __p0) {
499 bfloat16x8_t __ret;
500 __ret = (bfloat16x8_t) {__p0, __p0, __p0, __p0, __p0, __p0, __p0, __p0};
501 return __ret;
502}
503#else
504__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vdupq_n_bf16(bfloat16_t __p0) {
505 bfloat16x8_t __ret;
506 __ret = (bfloat16x8_t) {__p0, __p0, __p0, __p0, __p0, __p0, __p0, __p0};
507 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
508 return __ret;
509}
510#endif
511
512#ifdef __LITTLE_ENDIAN__
513__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vdup_n_bf16(bfloat16_t __p0) {
514 bfloat16x4_t __ret;
515 __ret = (bfloat16x4_t) {__p0, __p0, __p0, __p0};
516 return __ret;
517}
518#else
519__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vdup_n_bf16(bfloat16_t __p0) {
520 bfloat16x4_t __ret;
521 __ret = (bfloat16x4_t) {__p0, __p0, __p0, __p0};
522 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
523 return __ret;
524}
525#endif
526
527#ifdef __LITTLE_ENDIAN__
528__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vget_high_bf16(bfloat16x8_t __p0) {
529 bfloat16x4_t __ret;
530 __ret = __builtin_shufflevector(__p0, __p0, 4, 5, 6, 7);
531 return __ret;
532}
533#else
534__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vget_high_bf16(bfloat16x8_t __p0) {
535 bfloat16x4_t __ret;
536 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
537 __ret = __builtin_shufflevector(__rev0, __rev0, 4, 5, 6, 7);
538 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
539 return __ret;
540}
541__ai __attribute__((target("bf16,neon"))) bfloat16x4_t __noswap_vget_high_bf16(bfloat16x8_t __p0) {
542 bfloat16x4_t __ret;
543 __ret = __builtin_shufflevector(__p0, __p0, 4, 5, 6, 7);
544 return __ret;
545}
546#endif
547
548#ifdef __LITTLE_ENDIAN__
549#define vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
550 bfloat16_t __ret; \
551 bfloat16x8_t __s0 = __p0; \
552 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__s0, __p1)); \
553 __ret; \
554})
555#else
556#define vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
557 bfloat16_t __ret; \
558 bfloat16x8_t __s0 = __p0; \
559 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
560 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__rev0, __p1)); \
561 __ret; \
562})
563#define __noswap_vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
564 bfloat16_t __ret; \
565 bfloat16x8_t __s0 = __p0; \
566 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__s0, __p1)); \
567 __ret; \
568})
569#endif
570
571#ifdef __LITTLE_ENDIAN__
572#define vget_lane_bf16(__p0, __p1) __extension__ ({ \
573 bfloat16_t __ret; \
574 bfloat16x4_t __s0 = __p0; \
575 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__s0, __p1)); \
576 __ret; \
577})
578#else
579#define vget_lane_bf16(__p0, __p1) __extension__ ({ \
580 bfloat16_t __ret; \
581 bfloat16x4_t __s0 = __p0; \
582 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
583 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__rev0, __p1)); \
584 __ret; \
585})
586#define __noswap_vget_lane_bf16(__p0, __p1) __extension__ ({ \
587 bfloat16_t __ret; \
588 bfloat16x4_t __s0 = __p0; \
589 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__s0, __p1)); \
590 __ret; \
591})
592#endif
593
594#ifdef __LITTLE_ENDIAN__
595__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vget_low_bf16(bfloat16x8_t __p0) {
596 bfloat16x4_t __ret;
597 __ret = __builtin_shufflevector(__p0, __p0, 0, 1, 2, 3);
598 return __ret;
599}
600#else
601__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vget_low_bf16(bfloat16x8_t __p0) {
602 bfloat16x4_t __ret;
603 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
604 __ret = __builtin_shufflevector(__rev0, __rev0, 0, 1, 2, 3);
605 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
606 return __ret;
607}
608__ai __attribute__((target("bf16,neon"))) bfloat16x4_t __noswap_vget_low_bf16(bfloat16x8_t __p0) {
609 bfloat16x4_t __ret;
610 __ret = __builtin_shufflevector(__p0, __p0, 0, 1, 2, 3);
611 return __ret;
612}
613#endif
614
615#ifdef __LITTLE_ENDIAN__
616#define vld1q_bf16(__p0) __extension__ ({ \
617 bfloat16x8_t __ret; \
618 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_bf16(__p0, 43)); \
619 __ret; \
620})
621#else
622#define vld1q_bf16(__p0) __extension__ ({ \
623 bfloat16x8_t __ret; \
624 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_bf16(__p0, 43)); \
625 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
626 __ret; \
627})
628#endif
629
630#ifdef __LITTLE_ENDIAN__
631#define vld1_bf16(__p0) __extension__ ({ \
632 bfloat16x4_t __ret; \
633 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_bf16(__p0, 11)); \
634 __ret; \
635})
636#else
637#define vld1_bf16(__p0) __extension__ ({ \
638 bfloat16x4_t __ret; \
639 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_bf16(__p0, 11)); \
640 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
641 __ret; \
642})
643#endif
644
645#ifdef __LITTLE_ENDIAN__
646#define vld1q_dup_bf16(__p0) __extension__ ({ \
647 bfloat16x8_t __ret; \
648 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_dup_bf16(__p0, 43)); \
649 __ret; \
650})
651#else
652#define vld1q_dup_bf16(__p0) __extension__ ({ \
653 bfloat16x8_t __ret; \
654 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_dup_bf16(__p0, 43)); \
655 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
656 __ret; \
657})
658#endif
659
660#ifdef __LITTLE_ENDIAN__
661#define vld1_dup_bf16(__p0) __extension__ ({ \
662 bfloat16x4_t __ret; \
663 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_dup_bf16(__p0, 11)); \
664 __ret; \
665})
666#else
667#define vld1_dup_bf16(__p0) __extension__ ({ \
668 bfloat16x4_t __ret; \
669 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_dup_bf16(__p0, 11)); \
670 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
671 __ret; \
672})
673#endif
674
675#ifdef __LITTLE_ENDIAN__
676#define vld1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
677 bfloat16x8_t __ret; \
678 bfloat16x8_t __s1 = __p1; \
679 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
680 __ret; \
681})
682#else
683#define vld1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
684 bfloat16x8_t __ret; \
685 bfloat16x8_t __s1 = __p1; \
686 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
687 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
688 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
689 __ret; \
690})
691#endif
692
693#ifdef __LITTLE_ENDIAN__
694#define vld1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
695 bfloat16x4_t __ret; \
696 bfloat16x4_t __s1 = __p1; \
697 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1), __p2, 11)); \
698 __ret; \
699})
700#else
701#define vld1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
702 bfloat16x4_t __ret; \
703 bfloat16x4_t __s1 = __p1; \
704 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
705 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1), __p2, 11)); \
706 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
707 __ret; \
708})
709#endif
710
711#ifdef __LITTLE_ENDIAN__
712#define vld1q_bf16_x2(__p0) __extension__ ({ \
713 bfloat16x8x2_t __ret; \
714 __builtin_neon_vld1q_bf16_x2(&__ret, __p0, 43); \
715 __ret; \
716})
717#else
718#define vld1q_bf16_x2(__p0) __extension__ ({ \
719 bfloat16x8x2_t __ret; \
720 __builtin_neon_vld1q_bf16_x2(&__ret, __p0, 43); \
721 \
722 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
723 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
724 __ret; \
725})
726#endif
727
728#ifdef __LITTLE_ENDIAN__
729#define vld1_bf16_x2(__p0) __extension__ ({ \
730 bfloat16x4x2_t __ret; \
731 __builtin_neon_vld1_bf16_x2(&__ret, __p0, 11); \
732 __ret; \
733})
734#else
735#define vld1_bf16_x2(__p0) __extension__ ({ \
736 bfloat16x4x2_t __ret; \
737 __builtin_neon_vld1_bf16_x2(&__ret, __p0, 11); \
738 \
739 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
740 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
741 __ret; \
742})
743#endif
744
745#ifdef __LITTLE_ENDIAN__
746#define vld1q_bf16_x3(__p0) __extension__ ({ \
747 bfloat16x8x3_t __ret; \
748 __builtin_neon_vld1q_bf16_x3(&__ret, __p0, 43); \
749 __ret; \
750})
751#else
752#define vld1q_bf16_x3(__p0) __extension__ ({ \
753 bfloat16x8x3_t __ret; \
754 __builtin_neon_vld1q_bf16_x3(&__ret, __p0, 43); \
755 \
756 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
757 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
758 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
759 __ret; \
760})
761#endif
762
763#ifdef __LITTLE_ENDIAN__
764#define vld1_bf16_x3(__p0) __extension__ ({ \
765 bfloat16x4x3_t __ret; \
766 __builtin_neon_vld1_bf16_x3(&__ret, __p0, 11); \
767 __ret; \
768})
769#else
770#define vld1_bf16_x3(__p0) __extension__ ({ \
771 bfloat16x4x3_t __ret; \
772 __builtin_neon_vld1_bf16_x3(&__ret, __p0, 11); \
773 \
774 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
775 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
776 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
777 __ret; \
778})
779#endif
780
781#ifdef __LITTLE_ENDIAN__
782#define vld1q_bf16_x4(__p0) __extension__ ({ \
783 bfloat16x8x4_t __ret; \
784 __builtin_neon_vld1q_bf16_x4(&__ret, __p0, 43); \
785 __ret; \
786})
787#else
788#define vld1q_bf16_x4(__p0) __extension__ ({ \
789 bfloat16x8x4_t __ret; \
790 __builtin_neon_vld1q_bf16_x4(&__ret, __p0, 43); \
791 \
792 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
793 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
794 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
795 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
796 __ret; \
797})
798#endif
799
800#ifdef __LITTLE_ENDIAN__
801#define vld1_bf16_x4(__p0) __extension__ ({ \
802 bfloat16x4x4_t __ret; \
803 __builtin_neon_vld1_bf16_x4(&__ret, __p0, 11); \
804 __ret; \
805})
806#else
807#define vld1_bf16_x4(__p0) __extension__ ({ \
808 bfloat16x4x4_t __ret; \
809 __builtin_neon_vld1_bf16_x4(&__ret, __p0, 11); \
810 \
811 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
812 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
813 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
814 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
815 __ret; \
816})
817#endif
818
819#ifdef __LITTLE_ENDIAN__
820#define vld2q_bf16(__p0) __extension__ ({ \
821 bfloat16x8x2_t __ret; \
822 __builtin_neon_vld2q_bf16(&__ret, __p0, 43); \
823 __ret; \
824})
825#else
826#define vld2q_bf16(__p0) __extension__ ({ \
827 bfloat16x8x2_t __ret; \
828 __builtin_neon_vld2q_bf16(&__ret, __p0, 43); \
829 \
830 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
831 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
832 __ret; \
833})
834#endif
835
836#ifdef __LITTLE_ENDIAN__
837#define vld2_bf16(__p0) __extension__ ({ \
838 bfloat16x4x2_t __ret; \
839 __builtin_neon_vld2_bf16(&__ret, __p0, 11); \
840 __ret; \
841})
842#else
843#define vld2_bf16(__p0) __extension__ ({ \
844 bfloat16x4x2_t __ret; \
845 __builtin_neon_vld2_bf16(&__ret, __p0, 11); \
846 \
847 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
848 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
849 __ret; \
850})
851#endif
852
853#ifdef __LITTLE_ENDIAN__
854#define vld2q_dup_bf16(__p0) __extension__ ({ \
855 bfloat16x8x2_t __ret; \
856 __builtin_neon_vld2q_dup_bf16(&__ret, __p0, 43); \
857 __ret; \
858})
859#else
860#define vld2q_dup_bf16(__p0) __extension__ ({ \
861 bfloat16x8x2_t __ret; \
862 __builtin_neon_vld2q_dup_bf16(&__ret, __p0, 43); \
863 \
864 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
865 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
866 __ret; \
867})
868#endif
869
870#ifdef __LITTLE_ENDIAN__
871#define vld2_dup_bf16(__p0) __extension__ ({ \
872 bfloat16x4x2_t __ret; \
873 __builtin_neon_vld2_dup_bf16(&__ret, __p0, 11); \
874 __ret; \
875})
876#else
877#define vld2_dup_bf16(__p0) __extension__ ({ \
878 bfloat16x4x2_t __ret; \
879 __builtin_neon_vld2_dup_bf16(&__ret, __p0, 11); \
880 \
881 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
882 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
883 __ret; \
884})
885#endif
886
887#ifdef __LITTLE_ENDIAN__
888#define vld2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
889 bfloat16x8x2_t __ret; \
890 bfloat16x8x2_t __s1 = __p1; \
891 __builtin_neon_vld2q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __p2, 43); \
892 __ret; \
893})
894#else
895#define vld2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
896 bfloat16x8x2_t __ret; \
897 bfloat16x8x2_t __s1 = __p1; \
898 bfloat16x8x2_t __rev1; \
899 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
900 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
901 __builtin_neon_vld2q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __p2, 43); \
902 \
903 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
904 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
905 __ret; \
906})
907#endif
908
909#ifdef __LITTLE_ENDIAN__
910#define vld2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
911 bfloat16x4x2_t __ret; \
912 bfloat16x4x2_t __s1 = __p1; \
913 __builtin_neon_vld2_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __p2, 11); \
914 __ret; \
915})
916#else
917#define vld2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
918 bfloat16x4x2_t __ret; \
919 bfloat16x4x2_t __s1 = __p1; \
920 bfloat16x4x2_t __rev1; \
921 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
922 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
923 __builtin_neon_vld2_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __p2, 11); \
924 \
925 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
926 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
927 __ret; \
928})
929#endif
930
931#ifdef __LITTLE_ENDIAN__
932#define vld3q_bf16(__p0) __extension__ ({ \
933 bfloat16x8x3_t __ret; \
934 __builtin_neon_vld3q_bf16(&__ret, __p0, 43); \
935 __ret; \
936})
937#else
938#define vld3q_bf16(__p0) __extension__ ({ \
939 bfloat16x8x3_t __ret; \
940 __builtin_neon_vld3q_bf16(&__ret, __p0, 43); \
941 \
942 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
943 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
944 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
945 __ret; \
946})
947#endif
948
949#ifdef __LITTLE_ENDIAN__
950#define vld3_bf16(__p0) __extension__ ({ \
951 bfloat16x4x3_t __ret; \
952 __builtin_neon_vld3_bf16(&__ret, __p0, 11); \
953 __ret; \
954})
955#else
956#define vld3_bf16(__p0) __extension__ ({ \
957 bfloat16x4x3_t __ret; \
958 __builtin_neon_vld3_bf16(&__ret, __p0, 11); \
959 \
960 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
961 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
962 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
963 __ret; \
964})
965#endif
966
967#ifdef __LITTLE_ENDIAN__
968#define vld3q_dup_bf16(__p0) __extension__ ({ \
969 bfloat16x8x3_t __ret; \
970 __builtin_neon_vld3q_dup_bf16(&__ret, __p0, 43); \
971 __ret; \
972})
973#else
974#define vld3q_dup_bf16(__p0) __extension__ ({ \
975 bfloat16x8x3_t __ret; \
976 __builtin_neon_vld3q_dup_bf16(&__ret, __p0, 43); \
977 \
978 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
979 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
980 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
981 __ret; \
982})
983#endif
984
985#ifdef __LITTLE_ENDIAN__
986#define vld3_dup_bf16(__p0) __extension__ ({ \
987 bfloat16x4x3_t __ret; \
988 __builtin_neon_vld3_dup_bf16(&__ret, __p0, 11); \
989 __ret; \
990})
991#else
992#define vld3_dup_bf16(__p0) __extension__ ({ \
993 bfloat16x4x3_t __ret; \
994 __builtin_neon_vld3_dup_bf16(&__ret, __p0, 11); \
995 \
996 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
997 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
998 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
999 __ret; \
1000})
1001#endif
1002
1003#ifdef __LITTLE_ENDIAN__
1004#define vld3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1005 bfloat16x8x3_t __ret; \
1006 bfloat16x8x3_t __s1 = __p1; \
1007 __builtin_neon_vld3q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __p2, 43); \
1008 __ret; \
1009})
1010#else
1011#define vld3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1012 bfloat16x8x3_t __ret; \
1013 bfloat16x8x3_t __s1 = __p1; \
1014 bfloat16x8x3_t __rev1; \
1015 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1016 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1017 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1018 __builtin_neon_vld3q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __p2, 43); \
1019 \
1020 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
1021 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
1022 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
1023 __ret; \
1024})
1025#endif
1026
1027#ifdef __LITTLE_ENDIAN__
1028#define vld3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1029 bfloat16x4x3_t __ret; \
1030 bfloat16x4x3_t __s1 = __p1; \
1031 __builtin_neon_vld3_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __p2, 11); \
1032 __ret; \
1033})
1034#else
1035#define vld3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1036 bfloat16x4x3_t __ret; \
1037 bfloat16x4x3_t __s1 = __p1; \
1038 bfloat16x4x3_t __rev1; \
1039 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1040 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1041 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1042 __builtin_neon_vld3_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __p2, 11); \
1043 \
1044 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
1045 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
1046 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
1047 __ret; \
1048})
1049#endif
1050
1051#ifdef __LITTLE_ENDIAN__
1052#define vld4q_bf16(__p0) __extension__ ({ \
1053 bfloat16x8x4_t __ret; \
1054 __builtin_neon_vld4q_bf16(&__ret, __p0, 43); \
1055 __ret; \
1056})
1057#else
1058#define vld4q_bf16(__p0) __extension__ ({ \
1059 bfloat16x8x4_t __ret; \
1060 __builtin_neon_vld4q_bf16(&__ret, __p0, 43); \
1061 \
1062 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
1063 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
1064 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
1065 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
1066 __ret; \
1067})
1068#endif
1069
1070#ifdef __LITTLE_ENDIAN__
1071#define vld4_bf16(__p0) __extension__ ({ \
1072 bfloat16x4x4_t __ret; \
1073 __builtin_neon_vld4_bf16(&__ret, __p0, 11); \
1074 __ret; \
1075})
1076#else
1077#define vld4_bf16(__p0) __extension__ ({ \
1078 bfloat16x4x4_t __ret; \
1079 __builtin_neon_vld4_bf16(&__ret, __p0, 11); \
1080 \
1081 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
1082 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
1083 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
1084 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
1085 __ret; \
1086})
1087#endif
1088
1089#ifdef __LITTLE_ENDIAN__
1090#define vld4q_dup_bf16(__p0) __extension__ ({ \
1091 bfloat16x8x4_t __ret; \
1092 __builtin_neon_vld4q_dup_bf16(&__ret, __p0, 43); \
1093 __ret; \
1094})
1095#else
1096#define vld4q_dup_bf16(__p0) __extension__ ({ \
1097 bfloat16x8x4_t __ret; \
1098 __builtin_neon_vld4q_dup_bf16(&__ret, __p0, 43); \
1099 \
1100 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
1101 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
1102 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
1103 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
1104 __ret; \
1105})
1106#endif
1107
1108#ifdef __LITTLE_ENDIAN__
1109#define vld4_dup_bf16(__p0) __extension__ ({ \
1110 bfloat16x4x4_t __ret; \
1111 __builtin_neon_vld4_dup_bf16(&__ret, __p0, 11); \
1112 __ret; \
1113})
1114#else
1115#define vld4_dup_bf16(__p0) __extension__ ({ \
1116 bfloat16x4x4_t __ret; \
1117 __builtin_neon_vld4_dup_bf16(&__ret, __p0, 11); \
1118 \
1119 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
1120 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
1121 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
1122 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
1123 __ret; \
1124})
1125#endif
1126
1127#ifdef __LITTLE_ENDIAN__
1128#define vld4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1129 bfloat16x8x4_t __ret; \
1130 bfloat16x8x4_t __s1 = __p1; \
1131 __builtin_neon_vld4q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), __p2, 43); \
1132 __ret; \
1133})
1134#else
1135#define vld4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1136 bfloat16x8x4_t __ret; \
1137 bfloat16x8x4_t __s1 = __p1; \
1138 bfloat16x8x4_t __rev1; \
1139 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1140 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1141 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1142 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
1143 __builtin_neon_vld4q_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), __p2, 43); \
1144 \
1145 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
1146 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
1147 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
1148 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
1149 __ret; \
1150})
1151#endif
1152
1153#ifdef __LITTLE_ENDIAN__
1154#define vld4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1155 bfloat16x4x4_t __ret; \
1156 bfloat16x4x4_t __s1 = __p1; \
1157 __builtin_neon_vld4_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), __p2, 11); \
1158 __ret; \
1159})
1160#else
1161#define vld4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1162 bfloat16x4x4_t __ret; \
1163 bfloat16x4x4_t __s1 = __p1; \
1164 bfloat16x4x4_t __rev1; \
1165 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1166 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1167 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1168 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
1169 __builtin_neon_vld4_lane_bf16(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), __p2, 11); \
1170 \
1171 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
1172 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
1173 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
1174 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
1175 __ret; \
1176})
1177#endif
1178
1179#ifdef __LITTLE_ENDIAN__
1180#define vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1181 bfloat16x8_t __ret; \
1182 bfloat16_t __s0 = __p0; \
1183 bfloat16x8_t __s1 = __p1; \
1184 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __s1, __p2)); \
1185 __ret; \
1186})
1187#else
1188#define vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1189 bfloat16x8_t __ret; \
1190 bfloat16_t __s0 = __p0; \
1191 bfloat16x8_t __s1 = __p1; \
1192 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
1193 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __rev1, __p2)); \
1194 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
1195 __ret; \
1196})
1197#define __noswap_vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1198 bfloat16x8_t __ret; \
1199 bfloat16_t __s0 = __p0; \
1200 bfloat16x8_t __s1 = __p1; \
1201 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __s1, __p2)); \
1202 __ret; \
1203})
1204#endif
1205
1206#ifdef __LITTLE_ENDIAN__
1207#define vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1208 bfloat16x4_t __ret; \
1209 bfloat16_t __s0 = __p0; \
1210 bfloat16x4_t __s1 = __p1; \
1211 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __s1, __p2)); \
1212 __ret; \
1213})
1214#else
1215#define vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1216 bfloat16x4_t __ret; \
1217 bfloat16_t __s0 = __p0; \
1218 bfloat16x4_t __s1 = __p1; \
1219 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
1220 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __rev1, __p2)); \
1221 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
1222 __ret; \
1223})
1224#define __noswap_vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1225 bfloat16x4_t __ret; \
1226 bfloat16_t __s0 = __p0; \
1227 bfloat16x4_t __s1 = __p1; \
1228 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __s1, __p2)); \
1229 __ret; \
1230})
1231#endif
1232
1233#ifdef __LITTLE_ENDIAN__
1234#define vst1q_bf16(__p0, __p1) __extension__ ({ \
1235 bfloat16x8_t __s1 = __p1; \
1236 __builtin_neon_vst1q_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1), 43); \
1237})
1238#else
1239#define vst1q_bf16(__p0, __p1) __extension__ ({ \
1240 bfloat16x8_t __s1 = __p1; \
1241 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
1242 __builtin_neon_vst1q_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1), 43); \
1243})
1244#endif
1245
1246#ifdef __LITTLE_ENDIAN__
1247#define vst1_bf16(__p0, __p1) __extension__ ({ \
1248 bfloat16x4_t __s1 = __p1; \
1249 __builtin_neon_vst1_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1), 11); \
1250})
1251#else
1252#define vst1_bf16(__p0, __p1) __extension__ ({ \
1253 bfloat16x4_t __s1 = __p1; \
1254 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
1255 __builtin_neon_vst1_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1), 11); \
1256})
1257#endif
1258
1259#ifdef __LITTLE_ENDIAN__
1260#define vst1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1261 bfloat16x8_t __s1 = __p1; \
1262 __builtin_neon_vst1q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1), __p2, 43); \
1263})
1264#else
1265#define vst1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1266 bfloat16x8_t __s1 = __p1; \
1267 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
1268 __builtin_neon_vst1q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1), __p2, 43); \
1269})
1270#endif
1271
1272#ifdef __LITTLE_ENDIAN__
1273#define vst1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1274 bfloat16x4_t __s1 = __p1; \
1275 __builtin_neon_vst1_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1), __p2, 11); \
1276})
1277#else
1278#define vst1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1279 bfloat16x4_t __s1 = __p1; \
1280 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
1281 __builtin_neon_vst1_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1), __p2, 11); \
1282})
1283#endif
1284
1285#ifdef __LITTLE_ENDIAN__
1286#define vst1q_bf16_x2(__p0, __p1) __extension__ ({ \
1287 bfloat16x8x2_t __s1 = __p1; \
1288 __builtin_neon_vst1q_bf16_x2(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), 43); \
1289})
1290#else
1291#define vst1q_bf16_x2(__p0, __p1) __extension__ ({ \
1292 bfloat16x8x2_t __s1 = __p1; \
1293 bfloat16x8x2_t __rev1; \
1294 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1295 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1296 __builtin_neon_vst1q_bf16_x2(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), 43); \
1297})
1298#endif
1299
1300#ifdef __LITTLE_ENDIAN__
1301#define vst1_bf16_x2(__p0, __p1) __extension__ ({ \
1302 bfloat16x4x2_t __s1 = __p1; \
1303 __builtin_neon_vst1_bf16_x2(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), 11); \
1304})
1305#else
1306#define vst1_bf16_x2(__p0, __p1) __extension__ ({ \
1307 bfloat16x4x2_t __s1 = __p1; \
1308 bfloat16x4x2_t __rev1; \
1309 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1310 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1311 __builtin_neon_vst1_bf16_x2(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), 11); \
1312})
1313#endif
1314
1315#ifdef __LITTLE_ENDIAN__
1316#define vst1q_bf16_x3(__p0, __p1) __extension__ ({ \
1317 bfloat16x8x3_t __s1 = __p1; \
1318 __builtin_neon_vst1q_bf16_x3(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), 43); \
1319})
1320#else
1321#define vst1q_bf16_x3(__p0, __p1) __extension__ ({ \
1322 bfloat16x8x3_t __s1 = __p1; \
1323 bfloat16x8x3_t __rev1; \
1324 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1325 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1326 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1327 __builtin_neon_vst1q_bf16_x3(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), 43); \
1328})
1329#endif
1330
1331#ifdef __LITTLE_ENDIAN__
1332#define vst1_bf16_x3(__p0, __p1) __extension__ ({ \
1333 bfloat16x4x3_t __s1 = __p1; \
1334 __builtin_neon_vst1_bf16_x3(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), 11); \
1335})
1336#else
1337#define vst1_bf16_x3(__p0, __p1) __extension__ ({ \
1338 bfloat16x4x3_t __s1 = __p1; \
1339 bfloat16x4x3_t __rev1; \
1340 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1341 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1342 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1343 __builtin_neon_vst1_bf16_x3(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), 11); \
1344})
1345#endif
1346
1347#ifdef __LITTLE_ENDIAN__
1348#define vst1q_bf16_x4(__p0, __p1) __extension__ ({ \
1349 bfloat16x8x4_t __s1 = __p1; \
1350 __builtin_neon_vst1q_bf16_x4(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), 43); \
1351})
1352#else
1353#define vst1q_bf16_x4(__p0, __p1) __extension__ ({ \
1354 bfloat16x8x4_t __s1 = __p1; \
1355 bfloat16x8x4_t __rev1; \
1356 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1357 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1358 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1359 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
1360 __builtin_neon_vst1q_bf16_x4(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), 43); \
1361})
1362#endif
1363
1364#ifdef __LITTLE_ENDIAN__
1365#define vst1_bf16_x4(__p0, __p1) __extension__ ({ \
1366 bfloat16x4x4_t __s1 = __p1; \
1367 __builtin_neon_vst1_bf16_x4(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), 11); \
1368})
1369#else
1370#define vst1_bf16_x4(__p0, __p1) __extension__ ({ \
1371 bfloat16x4x4_t __s1 = __p1; \
1372 bfloat16x4x4_t __rev1; \
1373 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1374 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1375 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1376 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
1377 __builtin_neon_vst1_bf16_x4(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), 11); \
1378})
1379#endif
1380
1381#ifdef __LITTLE_ENDIAN__
1382#define vst2q_bf16(__p0, __p1) __extension__ ({ \
1383 bfloat16x8x2_t __s1 = __p1; \
1384 __builtin_neon_vst2q_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), 43); \
1385})
1386#else
1387#define vst2q_bf16(__p0, __p1) __extension__ ({ \
1388 bfloat16x8x2_t __s1 = __p1; \
1389 bfloat16x8x2_t __rev1; \
1390 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1391 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1392 __builtin_neon_vst2q_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), 43); \
1393})
1394#endif
1395
1396#ifdef __LITTLE_ENDIAN__
1397#define vst2_bf16(__p0, __p1) __extension__ ({ \
1398 bfloat16x4x2_t __s1 = __p1; \
1399 __builtin_neon_vst2_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), 11); \
1400})
1401#else
1402#define vst2_bf16(__p0, __p1) __extension__ ({ \
1403 bfloat16x4x2_t __s1 = __p1; \
1404 bfloat16x4x2_t __rev1; \
1405 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1406 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1407 __builtin_neon_vst2_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), 11); \
1408})
1409#endif
1410
1411#ifdef __LITTLE_ENDIAN__
1412#define vst2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1413 bfloat16x8x2_t __s1 = __p1; \
1414 __builtin_neon_vst2q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __p2, 43); \
1415})
1416#else
1417#define vst2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1418 bfloat16x8x2_t __s1 = __p1; \
1419 bfloat16x8x2_t __rev1; \
1420 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1421 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1422 __builtin_neon_vst2q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __p2, 43); \
1423})
1424#endif
1425
1426#ifdef __LITTLE_ENDIAN__
1427#define vst2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1428 bfloat16x4x2_t __s1 = __p1; \
1429 __builtin_neon_vst2_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __p2, 11); \
1430})
1431#else
1432#define vst2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1433 bfloat16x4x2_t __s1 = __p1; \
1434 bfloat16x4x2_t __rev1; \
1435 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1436 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1437 __builtin_neon_vst2_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __p2, 11); \
1438})
1439#endif
1440
1441#ifdef __LITTLE_ENDIAN__
1442#define vst3q_bf16(__p0, __p1) __extension__ ({ \
1443 bfloat16x8x3_t __s1 = __p1; \
1444 __builtin_neon_vst3q_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), 43); \
1445})
1446#else
1447#define vst3q_bf16(__p0, __p1) __extension__ ({ \
1448 bfloat16x8x3_t __s1 = __p1; \
1449 bfloat16x8x3_t __rev1; \
1450 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1451 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1452 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1453 __builtin_neon_vst3q_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), 43); \
1454})
1455#endif
1456
1457#ifdef __LITTLE_ENDIAN__
1458#define vst3_bf16(__p0, __p1) __extension__ ({ \
1459 bfloat16x4x3_t __s1 = __p1; \
1460 __builtin_neon_vst3_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), 11); \
1461})
1462#else
1463#define vst3_bf16(__p0, __p1) __extension__ ({ \
1464 bfloat16x4x3_t __s1 = __p1; \
1465 bfloat16x4x3_t __rev1; \
1466 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1467 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1468 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1469 __builtin_neon_vst3_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), 11); \
1470})
1471#endif
1472
1473#ifdef __LITTLE_ENDIAN__
1474#define vst3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1475 bfloat16x8x3_t __s1 = __p1; \
1476 __builtin_neon_vst3q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __p2, 43); \
1477})
1478#else
1479#define vst3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1480 bfloat16x8x3_t __s1 = __p1; \
1481 bfloat16x8x3_t __rev1; \
1482 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1483 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1484 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1485 __builtin_neon_vst3q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __p2, 43); \
1486})
1487#endif
1488
1489#ifdef __LITTLE_ENDIAN__
1490#define vst3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1491 bfloat16x4x3_t __s1 = __p1; \
1492 __builtin_neon_vst3_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __p2, 11); \
1493})
148__ai __attribute__((target("bf16,neon"))) float32x4_t vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
149 float32x4_t __ret;
150 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
151 return __ret;
152}
1494153#else
1495#define vst3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1496 bfloat16x4x3_t __s1 = __p1; \
1497 bfloat16x4x3_t __rev1; \
1498 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1499 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1500 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1501 __builtin_neon_vst3_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __p2, 11); \
1502})
154__ai __attribute__((target("bf16,neon"))) float32x4_t vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
155 float32x4_t __ret;
156 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
157 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
158 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
159 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
160 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
161 return __ret;
162}
163__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfdotq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
164 float32x4_t __ret;
165 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfdotq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
166 return __ret;
167}
1503168#endif
1504169
1505170#ifdef __LITTLE_ENDIAN__
1506#define vst4q_bf16(__p0, __p1) __extension__ ({ \
1507 bfloat16x8x4_t __s1 = __p1; \
1508 __builtin_neon_vst4q_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), 43); \
1509})
171__ai __attribute__((target("bf16,neon"))) float32x2_t vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
172 float32x2_t __ret;
173 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), __builtin_bit_cast(int8x8_t, __p2), 9));
174 return __ret;
175}
1510176#else
1511#define vst4q_bf16(__p0, __p1) __extension__ ({ \
1512 bfloat16x8x4_t __s1 = __p1; \
1513 bfloat16x8x4_t __rev1; \
1514 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1515 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1516 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1517 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
1518 __builtin_neon_vst4q_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), 43); \
1519})
177__ai __attribute__((target("bf16,neon"))) float32x2_t vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
178 float32x2_t __ret;
179 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
180 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
181 bfloat16x4_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_64_16);
182 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __builtin_bit_cast(int8x8_t, __rev2), 9));
183 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
184 return __ret;
185}
186__ai __attribute__((target("bf16,neon"))) float32x2_t __noswap_vbfdot_f32(float32x2_t __p0, bfloat16x4_t __p1, bfloat16x4_t __p2) {
187 float32x2_t __ret;
188 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vbfdot_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), __builtin_bit_cast(int8x8_t, __p2), 9));
189 return __ret;
190}
1520191#endif
1521192
1522193#ifdef __LITTLE_ENDIAN__
1523#define vst4_bf16(__p0, __p1) __extension__ ({ \
1524 bfloat16x4x4_t __s1 = __p1; \
1525 __builtin_neon_vst4_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), 11); \
1526})
194__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
195 float32x4_t __ret;
196 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
197 return __ret;
198}
1527199#else
1528#define vst4_bf16(__p0, __p1) __extension__ ({ \
1529 bfloat16x4x4_t __s1 = __p1; \
1530 bfloat16x4x4_t __rev1; \
1531 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1532 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1533 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1534 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
1535 __builtin_neon_vst4_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), 11); \
1536})
200__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
201 float32x4_t __ret;
202 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
203 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
204 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
205 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
206 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
207 return __ret;
208}
209__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfmlalbq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
210 float32x4_t __ret;
211 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlalbq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
212 return __ret;
213}
1537214#endif
1538215
1539216#ifdef __LITTLE_ENDIAN__
1540#define vst4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1541 bfloat16x8x4_t __s1 = __p1; \
1542 __builtin_neon_vst4q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), __p2, 43); \
1543})
217__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
218 float32x4_t __ret;
219 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
220 return __ret;
221}
1544222#else
1545#define vst4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1546 bfloat16x8x4_t __s1 = __p1; \
1547 bfloat16x8x4_t __rev1; \
1548 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
1549 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
1550 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
1551 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
1552 __builtin_neon_vst4q_lane_bf16(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), __p2, 43); \
1553})
223__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
224 float32x4_t __ret;
225 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
226 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
227 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
228 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
229 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
230 return __ret;
231}
232__ai __attribute__((target("bf16,neon"))) float32x4_t __noswap_vbfmlaltq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
233 float32x4_t __ret;
234 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmlaltq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
235 return __ret;
236}
1554237#endif
1555238
1556239#ifdef __LITTLE_ENDIAN__
1557#define vst4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1558 bfloat16x4x4_t __s1 = __p1; \
1559 __builtin_neon_vst4_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), __p2, 11); \
1560})
240__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmmlaq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
241 float32x4_t __ret;
242 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmmlaq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
243 return __ret;
244}
1561245#else
1562#define vst4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
1563 bfloat16x4x4_t __s1 = __p1; \
1564 bfloat16x4x4_t __rev1; \
1565 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
1566 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
1567 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
1568 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
1569 __builtin_neon_vst4_lane_bf16(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), __p2, 11); \
1570})
246__ai __attribute__((target("bf16,neon"))) float32x4_t vbfmmlaq_f32(float32x4_t __p0, bfloat16x8_t __p1, bfloat16x8_t __p2) {
247 float32x4_t __ret;
248 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
249 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
250 bfloat16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
251 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vbfmmlaq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
252 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
253 return __ret;
254}
1571255#endif
1572256
257__ai __attribute__((target("bf16,neon"))) float32_t vcvtah_f32_bf16(bfloat16_t __p0) {
258 float32_t __ret;
259 __ret = __builtin_bit_cast(float32_t, (uint32_t)(__builtin_bit_cast(uint16_t, __p0)) << 16);
260 return __ret;
261}
262__ai __attribute__((target("bf16,neon"))) bfloat16_t vcvth_bf16_f32(float32_t __p0) {
263 bfloat16_t __ret;
264 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vcvth_bf16_f32(__p0));
265 return __ret;
266}
1573267#ifdef __LITTLE_ENDIAN__
1574268__ai __attribute__((target("dotprod,neon"))) uint32x4_t vdotq_u32(uint32x4_t __p0, uint8x16_t __p1, uint8x16_t __p2) {
1575269 uint32x4_t __ret;
......@@ -3925,6 +2619,54 @@ __ai __attribute__((target("i8mm,neon"))) int32x4_t vusmmlaq_s32(int32x4_t __p0,
39252619})
39262620#endif
39272621
2622#ifdef __LITTLE_ENDIAN__
2623#define splatq_lane_bf16(__p0, __p1) __extension__ ({ \
2624 bfloat16x8_t __ret; \
2625 bfloat16x4_t __s0 = __p0; \
2626 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_v(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
2627 __ret; \
2628})
2629#else
2630#define splatq_lane_bf16(__p0, __p1) __extension__ ({ \
2631 bfloat16x8_t __ret; \
2632 bfloat16x4_t __s0 = __p0; \
2633 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
2634 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_v(__builtin_bit_cast(int8x8_t, __rev0), __p1, 11)); \
2635 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
2636 __ret; \
2637})
2638#define __noswap_splatq_lane_bf16(__p0, __p1) __extension__ ({ \
2639 bfloat16x8_t __ret; \
2640 bfloat16x4_t __s0 = __p0; \
2641 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_lane_v(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
2642 __ret; \
2643})
2644#endif
2645
2646#ifdef __LITTLE_ENDIAN__
2647#define splat_lane_bf16(__p0, __p1) __extension__ ({ \
2648 bfloat16x4_t __ret; \
2649 bfloat16x4_t __s0 = __p0; \
2650 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_v(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
2651 __ret; \
2652})
2653#else
2654#define splat_lane_bf16(__p0, __p1) __extension__ ({ \
2655 bfloat16x4_t __ret; \
2656 bfloat16x4_t __s0 = __p0; \
2657 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
2658 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_v(__builtin_bit_cast(int8x8_t, __rev0), __p1, 11)); \
2659 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
2660 __ret; \
2661})
2662#define __noswap_splat_lane_bf16(__p0, __p1) __extension__ ({ \
2663 bfloat16x4_t __ret; \
2664 bfloat16x4_t __s0 = __p0; \
2665 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_lane_v(__builtin_bit_cast(int8x8_t, __s0), __p1, 11)); \
2666 __ret; \
2667})
2668#endif
2669
39282670#ifdef __LITTLE_ENDIAN__
39292671#define splat_laneq_p8(__p0, __p1) __extension__ ({ \
39302672 poly8x8_t __ret; \
......@@ -4593,6 +3335,54 @@ __ai __attribute__((target("i8mm,neon"))) int32x4_t vusmmlaq_s32(int32x4_t __p0,
45933335})
45943336#endif
45953337
3338#ifdef __LITTLE_ENDIAN__
3339#define splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
3340 bfloat16x8_t __ret; \
3341 bfloat16x8_t __s0 = __p0; \
3342 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_v(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
3343 __ret; \
3344})
3345#else
3346#define splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
3347 bfloat16x8_t __ret; \
3348 bfloat16x8_t __s0 = __p0; \
3349 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
3350 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_v(__builtin_bit_cast(int8x16_t, __rev0), __p1, 43)); \
3351 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
3352 __ret; \
3353})
3354#define __noswap_splatq_laneq_bf16(__p0, __p1) __extension__ ({ \
3355 bfloat16x8_t __ret; \
3356 bfloat16x8_t __s0 = __p0; \
3357 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_splatq_laneq_v(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
3358 __ret; \
3359})
3360#endif
3361
3362#ifdef __LITTLE_ENDIAN__
3363#define splat_laneq_bf16(__p0, __p1) __extension__ ({ \
3364 bfloat16x4_t __ret; \
3365 bfloat16x8_t __s0 = __p0; \
3366 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_v(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
3367 __ret; \
3368})
3369#else
3370#define splat_laneq_bf16(__p0, __p1) __extension__ ({ \
3371 bfloat16x4_t __ret; \
3372 bfloat16x8_t __s0 = __p0; \
3373 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
3374 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_v(__builtin_bit_cast(int8x16_t, __rev0), __p1, 43)); \
3375 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
3376 __ret; \
3377})
3378#define __noswap_splat_laneq_bf16(__p0, __p1) __extension__ ({ \
3379 bfloat16x4_t __ret; \
3380 bfloat16x8_t __s0 = __p0; \
3381 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_splat_laneq_v(__builtin_bit_cast(int8x16_t, __s0), __p1, 43)); \
3382 __ret; \
3383})
3384#endif
3385
45963386#ifdef __LITTLE_ENDIAN__
45973387__ai __attribute__((target("neon"))) uint8x16_t vabdq_u8(uint8x16_t __p0, uint8x16_t __p1) {
45983388 uint8x16_t __ret;
......@@ -8505,6 +7295,28 @@ __ai __attribute__((target("neon"))) int16x8_t __noswap_vcombine_s16(int16x4_t _
85057295}
85067296#endif
85077297
7298#ifdef __LITTLE_ENDIAN__
7299__ai __attribute__((target("neon"))) bfloat16x8_t vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
7300 bfloat16x8_t __ret;
7301 __ret = __builtin_shufflevector(__p0, __p1, 0, 1, 2, 3, 4, 5, 6, 7);
7302 return __ret;
7303}
7304#else
7305__ai __attribute__((target("neon"))) bfloat16x8_t vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
7306 bfloat16x8_t __ret;
7307 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
7308 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
7309 __ret = __builtin_shufflevector(__rev0, __rev1, 0, 1, 2, 3, 4, 5, 6, 7);
7310 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
7311 return __ret;
7312}
7313__ai __attribute__((target("neon"))) bfloat16x8_t __noswap_vcombine_bf16(bfloat16x4_t __p0, bfloat16x4_t __p1) {
7314 bfloat16x8_t __ret;
7315 __ret = __builtin_shufflevector(__p0, __p1, 0, 1, 2, 3, 4, 5, 6, 7);
7316 return __ret;
7317}
7318#endif
7319
85087320#define vcreate_p8(__p0) __extension__ ({ \
85097321 poly8x8_t __ret; \
85107322 uint64_t __promote = __p0; \
......@@ -8577,6 +7389,12 @@ __ai __attribute__((target("neon"))) int16x8_t __noswap_vcombine_s16(int16x4_t _
85777389 __ret = __builtin_bit_cast(int16x4_t, __promote); \
85787390 __ret; \
85797391})
7392#define vcreate_bf16(__p0) __extension__ ({ \
7393 bfloat16x4_t __ret; \
7394 uint64_t __promote = __p0; \
7395 __ret = __builtin_bit_cast(bfloat16x4_t, __promote); \
7396 __ret; \
7397})
85807398#ifdef __LITTLE_ENDIAN__
85817399__ai __attribute__((target("neon"))) float32x4_t vcvtq_f32_u32(uint32x4_t __p0) {
85827400 float32x4_t __ret;
......@@ -8850,406 +7668,512 @@ __ai __attribute__((target("neon"))) uint32x2_t vcvt_u32_f32(float32x2_t __p0) {
88507668#endif
88517669
88527670#ifdef __LITTLE_ENDIAN__
8853#define vdup_lane_p8(__p0_8, __p1_8) __extension__ ({ \
8854 poly8x8_t __ret_8; \
8855 poly8x8_t __s0_8 = __p0_8; \
8856 __ret_8 = splat_lane_p8(__s0_8, __p1_8); \
7671#define vduph_lane_bf16(__p0, __p1) __extension__ ({ \
7672 bfloat16_t __ret; \
7673 bfloat16x4_t __s0 = __p0; \
7674 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_lane_bf16(__s0, __p1)); \
7675 __ret; \
7676})
7677#else
7678#define vduph_lane_bf16(__p0, __p1) __extension__ ({ \
7679 bfloat16_t __ret; \
7680 bfloat16x4_t __s0 = __p0; \
7681 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
7682 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_lane_bf16(__rev0, __p1)); \
7683 __ret; \
7684})
7685#endif
7686
7687#ifdef __LITTLE_ENDIAN__
7688#define vdup_lane_p8(__p0_0, __p1_0) __extension__ ({ \
7689 poly8x8_t __ret_0; \
7690 poly8x8_t __s0_0 = __p0_0; \
7691 __ret_0 = splat_lane_p8(__s0_0, __p1_0); \
7692 __ret_0; \
7693})
7694#else
7695#define vdup_lane_p8(__p0_1, __p1_1) __extension__ ({ \
7696 poly8x8_t __ret_1; \
7697 poly8x8_t __s0_1 = __p0_1; \
7698 poly8x8_t __rev0_1; __rev0_1 = __builtin_shufflevector(__s0_1, __s0_1, __lane_reverse_64_8); \
7699 __ret_1 = __noswap_splat_lane_p8(__rev0_1, __p1_1); \
7700 __ret_1 = __builtin_shufflevector(__ret_1, __ret_1, __lane_reverse_64_8); \
7701 __ret_1; \
7702})
7703#endif
7704
7705#ifdef __LITTLE_ENDIAN__
7706#define vdup_lane_p16(__p0_2, __p1_2) __extension__ ({ \
7707 poly16x4_t __ret_2; \
7708 poly16x4_t __s0_2 = __p0_2; \
7709 __ret_2 = splat_lane_p16(__s0_2, __p1_2); \
7710 __ret_2; \
7711})
7712#else
7713#define vdup_lane_p16(__p0_3, __p1_3) __extension__ ({ \
7714 poly16x4_t __ret_3; \
7715 poly16x4_t __s0_3 = __p0_3; \
7716 poly16x4_t __rev0_3; __rev0_3 = __builtin_shufflevector(__s0_3, __s0_3, __lane_reverse_64_16); \
7717 __ret_3 = __noswap_splat_lane_p16(__rev0_3, __p1_3); \
7718 __ret_3 = __builtin_shufflevector(__ret_3, __ret_3, __lane_reverse_64_16); \
7719 __ret_3; \
7720})
7721#endif
7722
7723#ifdef __LITTLE_ENDIAN__
7724#define vdupq_lane_p8(__p0_4, __p1_4) __extension__ ({ \
7725 poly8x16_t __ret_4; \
7726 poly8x8_t __s0_4 = __p0_4; \
7727 __ret_4 = splatq_lane_p8(__s0_4, __p1_4); \
7728 __ret_4; \
7729})
7730#else
7731#define vdupq_lane_p8(__p0_5, __p1_5) __extension__ ({ \
7732 poly8x16_t __ret_5; \
7733 poly8x8_t __s0_5 = __p0_5; \
7734 poly8x8_t __rev0_5; __rev0_5 = __builtin_shufflevector(__s0_5, __s0_5, __lane_reverse_64_8); \
7735 __ret_5 = __noswap_splatq_lane_p8(__rev0_5, __p1_5); \
7736 __ret_5 = __builtin_shufflevector(__ret_5, __ret_5, __lane_reverse_128_8); \
7737 __ret_5; \
7738})
7739#endif
7740
7741#ifdef __LITTLE_ENDIAN__
7742#define vdupq_lane_p16(__p0_6, __p1_6) __extension__ ({ \
7743 poly16x8_t __ret_6; \
7744 poly16x4_t __s0_6 = __p0_6; \
7745 __ret_6 = splatq_lane_p16(__s0_6, __p1_6); \
7746 __ret_6; \
7747})
7748#else
7749#define vdupq_lane_p16(__p0_7, __p1_7) __extension__ ({ \
7750 poly16x8_t __ret_7; \
7751 poly16x4_t __s0_7 = __p0_7; \
7752 poly16x4_t __rev0_7; __rev0_7 = __builtin_shufflevector(__s0_7, __s0_7, __lane_reverse_64_16); \
7753 __ret_7 = __noswap_splatq_lane_p16(__rev0_7, __p1_7); \
7754 __ret_7 = __builtin_shufflevector(__ret_7, __ret_7, __lane_reverse_128_16); \
7755 __ret_7; \
7756})
7757#endif
7758
7759#ifdef __LITTLE_ENDIAN__
7760#define vdupq_lane_u8(__p0_8, __p1_8) __extension__ ({ \
7761 uint8x16_t __ret_8; \
7762 uint8x8_t __s0_8 = __p0_8; \
7763 __ret_8 = splatq_lane_u8(__s0_8, __p1_8); \
88577764 __ret_8; \
88587765})
88597766#else
8860#define vdup_lane_p8(__p0_9, __p1_9) __extension__ ({ \
8861 poly8x8_t __ret_9; \
8862 poly8x8_t __s0_9 = __p0_9; \
8863 poly8x8_t __rev0_9; __rev0_9 = __builtin_shufflevector(__s0_9, __s0_9, __lane_reverse_64_8); \
8864 __ret_9 = __noswap_splat_lane_p8(__rev0_9, __p1_9); \
8865 __ret_9 = __builtin_shufflevector(__ret_9, __ret_9, __lane_reverse_64_8); \
7767#define vdupq_lane_u8(__p0_9, __p1_9) __extension__ ({ \
7768 uint8x16_t __ret_9; \
7769 uint8x8_t __s0_9 = __p0_9; \
7770 uint8x8_t __rev0_9; __rev0_9 = __builtin_shufflevector(__s0_9, __s0_9, __lane_reverse_64_8); \
7771 __ret_9 = __noswap_splatq_lane_u8(__rev0_9, __p1_9); \
7772 __ret_9 = __builtin_shufflevector(__ret_9, __ret_9, __lane_reverse_128_8); \
88667773 __ret_9; \
88677774})
88687775#endif
88697776
88707777#ifdef __LITTLE_ENDIAN__
8871#define vdup_lane_p16(__p0_10, __p1_10) __extension__ ({ \
8872 poly16x4_t __ret_10; \
8873 poly16x4_t __s0_10 = __p0_10; \
8874 __ret_10 = splat_lane_p16(__s0_10, __p1_10); \
7778#define vdupq_lane_u32(__p0_10, __p1_10) __extension__ ({ \
7779 uint32x4_t __ret_10; \
7780 uint32x2_t __s0_10 = __p0_10; \
7781 __ret_10 = splatq_lane_u32(__s0_10, __p1_10); \
88757782 __ret_10; \
88767783})
88777784#else
8878#define vdup_lane_p16(__p0_11, __p1_11) __extension__ ({ \
8879 poly16x4_t __ret_11; \
8880 poly16x4_t __s0_11 = __p0_11; \
8881 poly16x4_t __rev0_11; __rev0_11 = __builtin_shufflevector(__s0_11, __s0_11, __lane_reverse_64_16); \
8882 __ret_11 = __noswap_splat_lane_p16(__rev0_11, __p1_11); \
8883 __ret_11 = __builtin_shufflevector(__ret_11, __ret_11, __lane_reverse_64_16); \
7785#define vdupq_lane_u32(__p0_11, __p1_11) __extension__ ({ \
7786 uint32x4_t __ret_11; \
7787 uint32x2_t __s0_11 = __p0_11; \
7788 uint32x2_t __rev0_11; __rev0_11 = __builtin_shufflevector(__s0_11, __s0_11, __lane_reverse_64_32); \
7789 __ret_11 = __noswap_splatq_lane_u32(__rev0_11, __p1_11); \
7790 __ret_11 = __builtin_shufflevector(__ret_11, __ret_11, __lane_reverse_128_32); \
88847791 __ret_11; \
88857792})
88867793#endif
88877794
88887795#ifdef __LITTLE_ENDIAN__
8889#define vdupq_lane_p8(__p0_12, __p1_12) __extension__ ({ \
8890 poly8x16_t __ret_12; \
8891 poly8x8_t __s0_12 = __p0_12; \
8892 __ret_12 = splatq_lane_p8(__s0_12, __p1_12); \
7796#define vdupq_lane_u64(__p0_12, __p1_12) __extension__ ({ \
7797 uint64x2_t __ret_12; \
7798 uint64x1_t __s0_12 = __p0_12; \
7799 __ret_12 = splatq_lane_u64(__s0_12, __p1_12); \
88937800 __ret_12; \
88947801})
88957802#else
8896#define vdupq_lane_p8(__p0_13, __p1_13) __extension__ ({ \
8897 poly8x16_t __ret_13; \
8898 poly8x8_t __s0_13 = __p0_13; \
8899 poly8x8_t __rev0_13; __rev0_13 = __builtin_shufflevector(__s0_13, __s0_13, __lane_reverse_64_8); \
8900 __ret_13 = __noswap_splatq_lane_p8(__rev0_13, __p1_13); \
8901 __ret_13 = __builtin_shufflevector(__ret_13, __ret_13, __lane_reverse_128_8); \
7803#define vdupq_lane_u64(__p0_13, __p1_13) __extension__ ({ \
7804 uint64x2_t __ret_13; \
7805 uint64x1_t __s0_13 = __p0_13; \
7806 __ret_13 = __noswap_splatq_lane_u64(__s0_13, __p1_13); \
7807 __ret_13 = __builtin_shufflevector(__ret_13, __ret_13, __lane_reverse_128_64); \
89027808 __ret_13; \
89037809})
89047810#endif
89057811
89067812#ifdef __LITTLE_ENDIAN__
8907#define vdupq_lane_p16(__p0_14, __p1_14) __extension__ ({ \
8908 poly16x8_t __ret_14; \
8909 poly16x4_t __s0_14 = __p0_14; \
8910 __ret_14 = splatq_lane_p16(__s0_14, __p1_14); \
7813#define vdupq_lane_u16(__p0_14, __p1_14) __extension__ ({ \
7814 uint16x8_t __ret_14; \
7815 uint16x4_t __s0_14 = __p0_14; \
7816 __ret_14 = splatq_lane_u16(__s0_14, __p1_14); \
89117817 __ret_14; \
89127818})
89137819#else
8914#define vdupq_lane_p16(__p0_15, __p1_15) __extension__ ({ \
8915 poly16x8_t __ret_15; \
8916 poly16x4_t __s0_15 = __p0_15; \
8917 poly16x4_t __rev0_15; __rev0_15 = __builtin_shufflevector(__s0_15, __s0_15, __lane_reverse_64_16); \
8918 __ret_15 = __noswap_splatq_lane_p16(__rev0_15, __p1_15); \
7820#define vdupq_lane_u16(__p0_15, __p1_15) __extension__ ({ \
7821 uint16x8_t __ret_15; \
7822 uint16x4_t __s0_15 = __p0_15; \
7823 uint16x4_t __rev0_15; __rev0_15 = __builtin_shufflevector(__s0_15, __s0_15, __lane_reverse_64_16); \
7824 __ret_15 = __noswap_splatq_lane_u16(__rev0_15, __p1_15); \
89197825 __ret_15 = __builtin_shufflevector(__ret_15, __ret_15, __lane_reverse_128_16); \
89207826 __ret_15; \
89217827})
89227828#endif
89237829
89247830#ifdef __LITTLE_ENDIAN__
8925#define vdupq_lane_u8(__p0_16, __p1_16) __extension__ ({ \
8926 uint8x16_t __ret_16; \
8927 uint8x8_t __s0_16 = __p0_16; \
8928 __ret_16 = splatq_lane_u8(__s0_16, __p1_16); \
7831#define vdupq_lane_s8(__p0_16, __p1_16) __extension__ ({ \
7832 int8x16_t __ret_16; \
7833 int8x8_t __s0_16 = __p0_16; \
7834 __ret_16 = splatq_lane_s8(__s0_16, __p1_16); \
89297835 __ret_16; \
89307836})
89317837#else
8932#define vdupq_lane_u8(__p0_17, __p1_17) __extension__ ({ \
8933 uint8x16_t __ret_17; \
8934 uint8x8_t __s0_17 = __p0_17; \
8935 uint8x8_t __rev0_17; __rev0_17 = __builtin_shufflevector(__s0_17, __s0_17, __lane_reverse_64_8); \
8936 __ret_17 = __noswap_splatq_lane_u8(__rev0_17, __p1_17); \
7838#define vdupq_lane_s8(__p0_17, __p1_17) __extension__ ({ \
7839 int8x16_t __ret_17; \
7840 int8x8_t __s0_17 = __p0_17; \
7841 int8x8_t __rev0_17; __rev0_17 = __builtin_shufflevector(__s0_17, __s0_17, __lane_reverse_64_8); \
7842 __ret_17 = __noswap_splatq_lane_s8(__rev0_17, __p1_17); \
89377843 __ret_17 = __builtin_shufflevector(__ret_17, __ret_17, __lane_reverse_128_8); \
89387844 __ret_17; \
89397845})
89407846#endif
89417847
89427848#ifdef __LITTLE_ENDIAN__
8943#define vdupq_lane_u32(__p0_18, __p1_18) __extension__ ({ \
8944 uint32x4_t __ret_18; \
8945 uint32x2_t __s0_18 = __p0_18; \
8946 __ret_18 = splatq_lane_u32(__s0_18, __p1_18); \
7849#define vdupq_lane_f32(__p0_18, __p1_18) __extension__ ({ \
7850 float32x4_t __ret_18; \
7851 float32x2_t __s0_18 = __p0_18; \
7852 __ret_18 = splatq_lane_f32(__s0_18, __p1_18); \
89477853 __ret_18; \
89487854})
89497855#else
8950#define vdupq_lane_u32(__p0_19, __p1_19) __extension__ ({ \
8951 uint32x4_t __ret_19; \
8952 uint32x2_t __s0_19 = __p0_19; \
8953 uint32x2_t __rev0_19; __rev0_19 = __builtin_shufflevector(__s0_19, __s0_19, __lane_reverse_64_32); \
8954 __ret_19 = __noswap_splatq_lane_u32(__rev0_19, __p1_19); \
7856#define vdupq_lane_f32(__p0_19, __p1_19) __extension__ ({ \
7857 float32x4_t __ret_19; \
7858 float32x2_t __s0_19 = __p0_19; \
7859 float32x2_t __rev0_19; __rev0_19 = __builtin_shufflevector(__s0_19, __s0_19, __lane_reverse_64_32); \
7860 __ret_19 = __noswap_splatq_lane_f32(__rev0_19, __p1_19); \
89557861 __ret_19 = __builtin_shufflevector(__ret_19, __ret_19, __lane_reverse_128_32); \
89567862 __ret_19; \
89577863})
89587864#endif
89597865
89607866#ifdef __LITTLE_ENDIAN__
8961#define vdupq_lane_u64(__p0_20, __p1_20) __extension__ ({ \
8962 uint64x2_t __ret_20; \
8963 uint64x1_t __s0_20 = __p0_20; \
8964 __ret_20 = splatq_lane_u64(__s0_20, __p1_20); \
7867#define vdupq_lane_f16(__p0_20, __p1_20) __extension__ ({ \
7868 float16x8_t __ret_20; \
7869 float16x4_t __s0_20 = __p0_20; \
7870 __ret_20 = splatq_lane_f16(__s0_20, __p1_20); \
89657871 __ret_20; \
89667872})
89677873#else
8968#define vdupq_lane_u64(__p0_21, __p1_21) __extension__ ({ \
8969 uint64x2_t __ret_21; \
8970 uint64x1_t __s0_21 = __p0_21; \
8971 __ret_21 = __noswap_splatq_lane_u64(__s0_21, __p1_21); \
8972 __ret_21 = __builtin_shufflevector(__ret_21, __ret_21, __lane_reverse_128_64); \
7874#define vdupq_lane_f16(__p0_21, __p1_21) __extension__ ({ \
7875 float16x8_t __ret_21; \
7876 float16x4_t __s0_21 = __p0_21; \
7877 float16x4_t __rev0_21; __rev0_21 = __builtin_shufflevector(__s0_21, __s0_21, __lane_reverse_64_16); \
7878 __ret_21 = __noswap_splatq_lane_f16(__rev0_21, __p1_21); \
7879 __ret_21 = __builtin_shufflevector(__ret_21, __ret_21, __lane_reverse_128_16); \
89737880 __ret_21; \
89747881})
89757882#endif
89767883
89777884#ifdef __LITTLE_ENDIAN__
8978#define vdupq_lane_u16(__p0_22, __p1_22) __extension__ ({ \
8979 uint16x8_t __ret_22; \
8980 uint16x4_t __s0_22 = __p0_22; \
8981 __ret_22 = splatq_lane_u16(__s0_22, __p1_22); \
7885#define vdupq_lane_s32(__p0_22, __p1_22) __extension__ ({ \
7886 int32x4_t __ret_22; \
7887 int32x2_t __s0_22 = __p0_22; \
7888 __ret_22 = splatq_lane_s32(__s0_22, __p1_22); \
89827889 __ret_22; \
89837890})
89847891#else
8985#define vdupq_lane_u16(__p0_23, __p1_23) __extension__ ({ \
8986 uint16x8_t __ret_23; \
8987 uint16x4_t __s0_23 = __p0_23; \
8988 uint16x4_t __rev0_23; __rev0_23 = __builtin_shufflevector(__s0_23, __s0_23, __lane_reverse_64_16); \
8989 __ret_23 = __noswap_splatq_lane_u16(__rev0_23, __p1_23); \
8990 __ret_23 = __builtin_shufflevector(__ret_23, __ret_23, __lane_reverse_128_16); \
7892#define vdupq_lane_s32(__p0_23, __p1_23) __extension__ ({ \
7893 int32x4_t __ret_23; \
7894 int32x2_t __s0_23 = __p0_23; \
7895 int32x2_t __rev0_23; __rev0_23 = __builtin_shufflevector(__s0_23, __s0_23, __lane_reverse_64_32); \
7896 __ret_23 = __noswap_splatq_lane_s32(__rev0_23, __p1_23); \
7897 __ret_23 = __builtin_shufflevector(__ret_23, __ret_23, __lane_reverse_128_32); \
89917898 __ret_23; \
89927899})
89937900#endif
89947901
89957902#ifdef __LITTLE_ENDIAN__
8996#define vdupq_lane_s8(__p0_24, __p1_24) __extension__ ({ \
8997 int8x16_t __ret_24; \
8998 int8x8_t __s0_24 = __p0_24; \
8999 __ret_24 = splatq_lane_s8(__s0_24, __p1_24); \
7903#define vdupq_lane_s64(__p0_24, __p1_24) __extension__ ({ \
7904 int64x2_t __ret_24; \
7905 int64x1_t __s0_24 = __p0_24; \
7906 __ret_24 = splatq_lane_s64(__s0_24, __p1_24); \
90007907 __ret_24; \
90017908})
90027909#else
9003#define vdupq_lane_s8(__p0_25, __p1_25) __extension__ ({ \
9004 int8x16_t __ret_25; \
9005 int8x8_t __s0_25 = __p0_25; \
9006 int8x8_t __rev0_25; __rev0_25 = __builtin_shufflevector(__s0_25, __s0_25, __lane_reverse_64_8); \
9007 __ret_25 = __noswap_splatq_lane_s8(__rev0_25, __p1_25); \
9008 __ret_25 = __builtin_shufflevector(__ret_25, __ret_25, __lane_reverse_128_8); \
7910#define vdupq_lane_s64(__p0_25, __p1_25) __extension__ ({ \
7911 int64x2_t __ret_25; \
7912 int64x1_t __s0_25 = __p0_25; \
7913 __ret_25 = __noswap_splatq_lane_s64(__s0_25, __p1_25); \
7914 __ret_25 = __builtin_shufflevector(__ret_25, __ret_25, __lane_reverse_128_64); \
90097915 __ret_25; \
90107916})
90117917#endif
90127918
90137919#ifdef __LITTLE_ENDIAN__
9014#define vdupq_lane_f32(__p0_26, __p1_26) __extension__ ({ \
9015 float32x4_t __ret_26; \
9016 float32x2_t __s0_26 = __p0_26; \
9017 __ret_26 = splatq_lane_f32(__s0_26, __p1_26); \
7920#define vdupq_lane_s16(__p0_26, __p1_26) __extension__ ({ \
7921 int16x8_t __ret_26; \
7922 int16x4_t __s0_26 = __p0_26; \
7923 __ret_26 = splatq_lane_s16(__s0_26, __p1_26); \
90187924 __ret_26; \
90197925})
90207926#else
9021#define vdupq_lane_f32(__p0_27, __p1_27) __extension__ ({ \
9022 float32x4_t __ret_27; \
9023 float32x2_t __s0_27 = __p0_27; \
9024 float32x2_t __rev0_27; __rev0_27 = __builtin_shufflevector(__s0_27, __s0_27, __lane_reverse_64_32); \
9025 __ret_27 = __noswap_splatq_lane_f32(__rev0_27, __p1_27); \
9026 __ret_27 = __builtin_shufflevector(__ret_27, __ret_27, __lane_reverse_128_32); \
7927#define vdupq_lane_s16(__p0_27, __p1_27) __extension__ ({ \
7928 int16x8_t __ret_27; \
7929 int16x4_t __s0_27 = __p0_27; \
7930 int16x4_t __rev0_27; __rev0_27 = __builtin_shufflevector(__s0_27, __s0_27, __lane_reverse_64_16); \
7931 __ret_27 = __noswap_splatq_lane_s16(__rev0_27, __p1_27); \
7932 __ret_27 = __builtin_shufflevector(__ret_27, __ret_27, __lane_reverse_128_16); \
90277933 __ret_27; \
90287934})
90297935#endif
90307936
90317937#ifdef __LITTLE_ENDIAN__
9032#define vdupq_lane_f16(__p0_28, __p1_28) __extension__ ({ \
9033 float16x8_t __ret_28; \
9034 float16x4_t __s0_28 = __p0_28; \
9035 __ret_28 = splatq_lane_f16(__s0_28, __p1_28); \
7938#define vdup_lane_u8(__p0_28, __p1_28) __extension__ ({ \
7939 uint8x8_t __ret_28; \
7940 uint8x8_t __s0_28 = __p0_28; \
7941 __ret_28 = splat_lane_u8(__s0_28, __p1_28); \
90367942 __ret_28; \
90377943})
90387944#else
9039#define vdupq_lane_f16(__p0_29, __p1_29) __extension__ ({ \
9040 float16x8_t __ret_29; \
9041 float16x4_t __s0_29 = __p0_29; \
9042 float16x4_t __rev0_29; __rev0_29 = __builtin_shufflevector(__s0_29, __s0_29, __lane_reverse_64_16); \
9043 __ret_29 = __noswap_splatq_lane_f16(__rev0_29, __p1_29); \
9044 __ret_29 = __builtin_shufflevector(__ret_29, __ret_29, __lane_reverse_128_16); \
7945#define vdup_lane_u8(__p0_29, __p1_29) __extension__ ({ \
7946 uint8x8_t __ret_29; \
7947 uint8x8_t __s0_29 = __p0_29; \
7948 uint8x8_t __rev0_29; __rev0_29 = __builtin_shufflevector(__s0_29, __s0_29, __lane_reverse_64_8); \
7949 __ret_29 = __noswap_splat_lane_u8(__rev0_29, __p1_29); \
7950 __ret_29 = __builtin_shufflevector(__ret_29, __ret_29, __lane_reverse_64_8); \
90457951 __ret_29; \
90467952})
90477953#endif
90487954
90497955#ifdef __LITTLE_ENDIAN__
9050#define vdupq_lane_s32(__p0_30, __p1_30) __extension__ ({ \
9051 int32x4_t __ret_30; \
9052 int32x2_t __s0_30 = __p0_30; \
9053 __ret_30 = splatq_lane_s32(__s0_30, __p1_30); \
7956#define vdup_lane_u32(__p0_30, __p1_30) __extension__ ({ \
7957 uint32x2_t __ret_30; \
7958 uint32x2_t __s0_30 = __p0_30; \
7959 __ret_30 = splat_lane_u32(__s0_30, __p1_30); \
90547960 __ret_30; \
90557961})
90567962#else
9057#define vdupq_lane_s32(__p0_31, __p1_31) __extension__ ({ \
9058 int32x4_t __ret_31; \
9059 int32x2_t __s0_31 = __p0_31; \
9060 int32x2_t __rev0_31; __rev0_31 = __builtin_shufflevector(__s0_31, __s0_31, __lane_reverse_64_32); \
9061 __ret_31 = __noswap_splatq_lane_s32(__rev0_31, __p1_31); \
9062 __ret_31 = __builtin_shufflevector(__ret_31, __ret_31, __lane_reverse_128_32); \
7963#define vdup_lane_u32(__p0_31, __p1_31) __extension__ ({ \
7964 uint32x2_t __ret_31; \
7965 uint32x2_t __s0_31 = __p0_31; \
7966 uint32x2_t __rev0_31; __rev0_31 = __builtin_shufflevector(__s0_31, __s0_31, __lane_reverse_64_32); \
7967 __ret_31 = __noswap_splat_lane_u32(__rev0_31, __p1_31); \
7968 __ret_31 = __builtin_shufflevector(__ret_31, __ret_31, __lane_reverse_64_32); \
90637969 __ret_31; \
90647970})
90657971#endif
90667972
9067#ifdef __LITTLE_ENDIAN__
9068#define vdupq_lane_s64(__p0_32, __p1_32) __extension__ ({ \
9069 int64x2_t __ret_32; \
9070 int64x1_t __s0_32 = __p0_32; \
9071 __ret_32 = splatq_lane_s64(__s0_32, __p1_32); \
7973#define vdup_lane_u64(__p0_32, __p1_32) __extension__ ({ \
7974 uint64x1_t __ret_32; \
7975 uint64x1_t __s0_32 = __p0_32; \
7976 __ret_32 = splat_lane_u64(__s0_32, __p1_32); \
90727977 __ret_32; \
90737978})
9074#else
9075#define vdupq_lane_s64(__p0_33, __p1_33) __extension__ ({ \
9076 int64x2_t __ret_33; \
9077 int64x1_t __s0_33 = __p0_33; \
9078 __ret_33 = __noswap_splatq_lane_s64(__s0_33, __p1_33); \
9079 __ret_33 = __builtin_shufflevector(__ret_33, __ret_33, __lane_reverse_128_64); \
7979#ifdef __LITTLE_ENDIAN__
7980#define vdup_lane_u16(__p0_33, __p1_33) __extension__ ({ \
7981 uint16x4_t __ret_33; \
7982 uint16x4_t __s0_33 = __p0_33; \
7983 __ret_33 = splat_lane_u16(__s0_33, __p1_33); \
90807984 __ret_33; \
90817985})
7986#else
7987#define vdup_lane_u16(__p0_34, __p1_34) __extension__ ({ \
7988 uint16x4_t __ret_34; \
7989 uint16x4_t __s0_34 = __p0_34; \
7990 uint16x4_t __rev0_34; __rev0_34 = __builtin_shufflevector(__s0_34, __s0_34, __lane_reverse_64_16); \
7991 __ret_34 = __noswap_splat_lane_u16(__rev0_34, __p1_34); \
7992 __ret_34 = __builtin_shufflevector(__ret_34, __ret_34, __lane_reverse_64_16); \
7993 __ret_34; \
7994})
90827995#endif
90837996
90847997#ifdef __LITTLE_ENDIAN__
9085#define vdupq_lane_s16(__p0_34, __p1_34) __extension__ ({ \
9086 int16x8_t __ret_34; \
9087 int16x4_t __s0_34 = __p0_34; \
9088 __ret_34 = splatq_lane_s16(__s0_34, __p1_34); \
9089 __ret_34; \
7998#define vdup_lane_s8(__p0_35, __p1_35) __extension__ ({ \
7999 int8x8_t __ret_35; \
8000 int8x8_t __s0_35 = __p0_35; \
8001 __ret_35 = splat_lane_s8(__s0_35, __p1_35); \
8002 __ret_35; \
90908003})
90918004#else
9092#define vdupq_lane_s16(__p0_35, __p1_35) __extension__ ({ \
9093 int16x8_t __ret_35; \
9094 int16x4_t __s0_35 = __p0_35; \
9095 int16x4_t __rev0_35; __rev0_35 = __builtin_shufflevector(__s0_35, __s0_35, __lane_reverse_64_16); \
9096 __ret_35 = __noswap_splatq_lane_s16(__rev0_35, __p1_35); \
9097 __ret_35 = __builtin_shufflevector(__ret_35, __ret_35, __lane_reverse_128_16); \
9098 __ret_35; \
8005#define vdup_lane_s8(__p0_36, __p1_36) __extension__ ({ \
8006 int8x8_t __ret_36; \
8007 int8x8_t __s0_36 = __p0_36; \
8008 int8x8_t __rev0_36; __rev0_36 = __builtin_shufflevector(__s0_36, __s0_36, __lane_reverse_64_8); \
8009 __ret_36 = __noswap_splat_lane_s8(__rev0_36, __p1_36); \
8010 __ret_36 = __builtin_shufflevector(__ret_36, __ret_36, __lane_reverse_64_8); \
8011 __ret_36; \
90998012})
91008013#endif
91018014
91028015#ifdef __LITTLE_ENDIAN__
9103#define vdup_lane_u8(__p0_36, __p1_36) __extension__ ({ \
9104 uint8x8_t __ret_36; \
9105 uint8x8_t __s0_36 = __p0_36; \
9106 __ret_36 = splat_lane_u8(__s0_36, __p1_36); \
9107 __ret_36; \
8016#define vdup_lane_f32(__p0_37, __p1_37) __extension__ ({ \
8017 float32x2_t __ret_37; \
8018 float32x2_t __s0_37 = __p0_37; \
8019 __ret_37 = splat_lane_f32(__s0_37, __p1_37); \
8020 __ret_37; \
91088021})
91098022#else
9110#define vdup_lane_u8(__p0_37, __p1_37) __extension__ ({ \
9111 uint8x8_t __ret_37; \
9112 uint8x8_t __s0_37 = __p0_37; \
9113 uint8x8_t __rev0_37; __rev0_37 = __builtin_shufflevector(__s0_37, __s0_37, __lane_reverse_64_8); \
9114 __ret_37 = __noswap_splat_lane_u8(__rev0_37, __p1_37); \
9115 __ret_37 = __builtin_shufflevector(__ret_37, __ret_37, __lane_reverse_64_8); \
9116 __ret_37; \
8023#define vdup_lane_f32(__p0_38, __p1_38) __extension__ ({ \
8024 float32x2_t __ret_38; \
8025 float32x2_t __s0_38 = __p0_38; \
8026 float32x2_t __rev0_38; __rev0_38 = __builtin_shufflevector(__s0_38, __s0_38, __lane_reverse_64_32); \
8027 __ret_38 = __noswap_splat_lane_f32(__rev0_38, __p1_38); \
8028 __ret_38 = __builtin_shufflevector(__ret_38, __ret_38, __lane_reverse_64_32); \
8029 __ret_38; \
91178030})
91188031#endif
91198032
91208033#ifdef __LITTLE_ENDIAN__
9121#define vdup_lane_u32(__p0_38, __p1_38) __extension__ ({ \
9122 uint32x2_t __ret_38; \
9123 uint32x2_t __s0_38 = __p0_38; \
9124 __ret_38 = splat_lane_u32(__s0_38, __p1_38); \
9125 __ret_38; \
8034#define vdup_lane_f16(__p0_39, __p1_39) __extension__ ({ \
8035 float16x4_t __ret_39; \
8036 float16x4_t __s0_39 = __p0_39; \
8037 __ret_39 = splat_lane_f16(__s0_39, __p1_39); \
8038 __ret_39; \
91268039})
91278040#else
9128#define vdup_lane_u32(__p0_39, __p1_39) __extension__ ({ \
9129 uint32x2_t __ret_39; \
9130 uint32x2_t __s0_39 = __p0_39; \
9131 uint32x2_t __rev0_39; __rev0_39 = __builtin_shufflevector(__s0_39, __s0_39, __lane_reverse_64_32); \
9132 __ret_39 = __noswap_splat_lane_u32(__rev0_39, __p1_39); \
9133 __ret_39 = __builtin_shufflevector(__ret_39, __ret_39, __lane_reverse_64_32); \
9134 __ret_39; \
8041#define vdup_lane_f16(__p0_40, __p1_40) __extension__ ({ \
8042 float16x4_t __ret_40; \
8043 float16x4_t __s0_40 = __p0_40; \
8044 float16x4_t __rev0_40; __rev0_40 = __builtin_shufflevector(__s0_40, __s0_40, __lane_reverse_64_16); \
8045 __ret_40 = __noswap_splat_lane_f16(__rev0_40, __p1_40); \
8046 __ret_40 = __builtin_shufflevector(__ret_40, __ret_40, __lane_reverse_64_16); \
8047 __ret_40; \
91358048})
91368049#endif
91378050
9138#define vdup_lane_u64(__p0_40, __p1_40) __extension__ ({ \
9139 uint64x1_t __ret_40; \
9140 uint64x1_t __s0_40 = __p0_40; \
9141 __ret_40 = splat_lane_u64(__s0_40, __p1_40); \
9142 __ret_40; \
9143})
91448051#ifdef __LITTLE_ENDIAN__
9145#define vdup_lane_u16(__p0_41, __p1_41) __extension__ ({ \
9146 uint16x4_t __ret_41; \
9147 uint16x4_t __s0_41 = __p0_41; \
9148 __ret_41 = splat_lane_u16(__s0_41, __p1_41); \
8052#define vdup_lane_s32(__p0_41, __p1_41) __extension__ ({ \
8053 int32x2_t __ret_41; \
8054 int32x2_t __s0_41 = __p0_41; \
8055 __ret_41 = splat_lane_s32(__s0_41, __p1_41); \
91498056 __ret_41; \
91508057})
91518058#else
9152#define vdup_lane_u16(__p0_42, __p1_42) __extension__ ({ \
9153 uint16x4_t __ret_42; \
9154 uint16x4_t __s0_42 = __p0_42; \
9155 uint16x4_t __rev0_42; __rev0_42 = __builtin_shufflevector(__s0_42, __s0_42, __lane_reverse_64_16); \
9156 __ret_42 = __noswap_splat_lane_u16(__rev0_42, __p1_42); \
9157 __ret_42 = __builtin_shufflevector(__ret_42, __ret_42, __lane_reverse_64_16); \
8059#define vdup_lane_s32(__p0_42, __p1_42) __extension__ ({ \
8060 int32x2_t __ret_42; \
8061 int32x2_t __s0_42 = __p0_42; \
8062 int32x2_t __rev0_42; __rev0_42 = __builtin_shufflevector(__s0_42, __s0_42, __lane_reverse_64_32); \
8063 __ret_42 = __noswap_splat_lane_s32(__rev0_42, __p1_42); \
8064 __ret_42 = __builtin_shufflevector(__ret_42, __ret_42, __lane_reverse_64_32); \
91588065 __ret_42; \
91598066})
91608067#endif
91618068
9162#ifdef __LITTLE_ENDIAN__
9163#define vdup_lane_s8(__p0_43, __p1_43) __extension__ ({ \
9164 int8x8_t __ret_43; \
9165 int8x8_t __s0_43 = __p0_43; \
9166 __ret_43 = splat_lane_s8(__s0_43, __p1_43); \
8069#define vdup_lane_s64(__p0_43, __p1_43) __extension__ ({ \
8070 int64x1_t __ret_43; \
8071 int64x1_t __s0_43 = __p0_43; \
8072 __ret_43 = splat_lane_s64(__s0_43, __p1_43); \
91678073 __ret_43; \
91688074})
9169#else
9170#define vdup_lane_s8(__p0_44, __p1_44) __extension__ ({ \
9171 int8x8_t __ret_44; \
9172 int8x8_t __s0_44 = __p0_44; \
9173 int8x8_t __rev0_44; __rev0_44 = __builtin_shufflevector(__s0_44, __s0_44, __lane_reverse_64_8); \
9174 __ret_44 = __noswap_splat_lane_s8(__rev0_44, __p1_44); \
9175 __ret_44 = __builtin_shufflevector(__ret_44, __ret_44, __lane_reverse_64_8); \
8075#ifdef __LITTLE_ENDIAN__
8076#define vdup_lane_s16(__p0_44, __p1_44) __extension__ ({ \
8077 int16x4_t __ret_44; \
8078 int16x4_t __s0_44 = __p0_44; \
8079 __ret_44 = splat_lane_s16(__s0_44, __p1_44); \
91768080 __ret_44; \
91778081})
8082#else
8083#define vdup_lane_s16(__p0_45, __p1_45) __extension__ ({ \
8084 int16x4_t __ret_45; \
8085 int16x4_t __s0_45 = __p0_45; \
8086 int16x4_t __rev0_45; __rev0_45 = __builtin_shufflevector(__s0_45, __s0_45, __lane_reverse_64_16); \
8087 __ret_45 = __noswap_splat_lane_s16(__rev0_45, __p1_45); \
8088 __ret_45 = __builtin_shufflevector(__ret_45, __ret_45, __lane_reverse_64_16); \
8089 __ret_45; \
8090})
91788091#endif
91798092
91808093#ifdef __LITTLE_ENDIAN__
9181#define vdup_lane_f32(__p0_45, __p1_45) __extension__ ({ \
9182 float32x2_t __ret_45; \
9183 float32x2_t __s0_45 = __p0_45; \
9184 __ret_45 = splat_lane_f32(__s0_45, __p1_45); \
9185 __ret_45; \
8094#define vdupq_lane_bf16(__p0_46, __p1_46) __extension__ ({ \
8095 bfloat16x8_t __ret_46; \
8096 bfloat16x4_t __s0_46 = __p0_46; \
8097 __ret_46 = splatq_lane_bf16(__s0_46, __p1_46); \
8098 __ret_46; \
91868099})
91878100#else
9188#define vdup_lane_f32(__p0_46, __p1_46) __extension__ ({ \
9189 float32x2_t __ret_46; \
9190 float32x2_t __s0_46 = __p0_46; \
9191 float32x2_t __rev0_46; __rev0_46 = __builtin_shufflevector(__s0_46, __s0_46, __lane_reverse_64_32); \
9192 __ret_46 = __noswap_splat_lane_f32(__rev0_46, __p1_46); \
9193 __ret_46 = __builtin_shufflevector(__ret_46, __ret_46, __lane_reverse_64_32); \
9194 __ret_46; \
8101#define vdupq_lane_bf16(__p0_47, __p1_47) __extension__ ({ \
8102 bfloat16x8_t __ret_47; \
8103 bfloat16x4_t __s0_47 = __p0_47; \
8104 bfloat16x4_t __rev0_47; __rev0_47 = __builtin_shufflevector(__s0_47, __s0_47, __lane_reverse_64_16); \
8105 __ret_47 = __noswap_splatq_lane_bf16(__rev0_47, __p1_47); \
8106 __ret_47 = __builtin_shufflevector(__ret_47, __ret_47, __lane_reverse_128_16); \
8107 __ret_47; \
91958108})
91968109#endif
91978110
91988111#ifdef __LITTLE_ENDIAN__
9199#define vdup_lane_f16(__p0_47, __p1_47) __extension__ ({ \
9200 float16x4_t __ret_47; \
9201 float16x4_t __s0_47 = __p0_47; \
9202 __ret_47 = splat_lane_f16(__s0_47, __p1_47); \
9203 __ret_47; \
8112#define vdup_lane_bf16(__p0_48, __p1_48) __extension__ ({ \
8113 bfloat16x4_t __ret_48; \
8114 bfloat16x4_t __s0_48 = __p0_48; \
8115 __ret_48 = splat_lane_bf16(__s0_48, __p1_48); \
8116 __ret_48; \
92048117})
92058118#else
9206#define vdup_lane_f16(__p0_48, __p1_48) __extension__ ({ \
9207 float16x4_t __ret_48; \
9208 float16x4_t __s0_48 = __p0_48; \
9209 float16x4_t __rev0_48; __rev0_48 = __builtin_shufflevector(__s0_48, __s0_48, __lane_reverse_64_16); \
9210 __ret_48 = __noswap_splat_lane_f16(__rev0_48, __p1_48); \
9211 __ret_48 = __builtin_shufflevector(__ret_48, __ret_48, __lane_reverse_64_16); \
9212 __ret_48; \
8119#define vdup_lane_bf16(__p0_49, __p1_49) __extension__ ({ \
8120 bfloat16x4_t __ret_49; \
8121 bfloat16x4_t __s0_49 = __p0_49; \
8122 bfloat16x4_t __rev0_49; __rev0_49 = __builtin_shufflevector(__s0_49, __s0_49, __lane_reverse_64_16); \
8123 __ret_49 = __noswap_splat_lane_bf16(__rev0_49, __p1_49); \
8124 __ret_49 = __builtin_shufflevector(__ret_49, __ret_49, __lane_reverse_64_16); \
8125 __ret_49; \
92138126})
92148127#endif
92158128
92168129#ifdef __LITTLE_ENDIAN__
9217#define vdup_lane_s32(__p0_49, __p1_49) __extension__ ({ \
9218 int32x2_t __ret_49; \
9219 int32x2_t __s0_49 = __p0_49; \
9220 __ret_49 = splat_lane_s32(__s0_49, __p1_49); \
9221 __ret_49; \
8130#define vduph_laneq_bf16(__p0, __p1) __extension__ ({ \
8131 bfloat16_t __ret; \
8132 bfloat16x8_t __s0 = __p0; \
8133 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_laneq_bf16(__s0, __p1)); \
8134 __ret; \
92228135})
92238136#else
9224#define vdup_lane_s32(__p0_50, __p1_50) __extension__ ({ \
9225 int32x2_t __ret_50; \
9226 int32x2_t __s0_50 = __p0_50; \
9227 int32x2_t __rev0_50; __rev0_50 = __builtin_shufflevector(__s0_50, __s0_50, __lane_reverse_64_32); \
9228 __ret_50 = __noswap_splat_lane_s32(__rev0_50, __p1_50); \
9229 __ret_50 = __builtin_shufflevector(__ret_50, __ret_50, __lane_reverse_64_32); \
9230 __ret_50; \
8137#define vduph_laneq_bf16(__p0, __p1) __extension__ ({ \
8138 bfloat16_t __ret; \
8139 bfloat16x8_t __s0 = __p0; \
8140 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
8141 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vduph_laneq_bf16(__rev0, __p1)); \
8142 __ret; \
92318143})
92328144#endif
92338145
9234#define vdup_lane_s64(__p0_51, __p1_51) __extension__ ({ \
9235 int64x1_t __ret_51; \
9236 int64x1_t __s0_51 = __p0_51; \
9237 __ret_51 = splat_lane_s64(__s0_51, __p1_51); \
8146#ifdef __LITTLE_ENDIAN__
8147#define vdupq_laneq_bf16(__p0_50, __p1_50) __extension__ ({ \
8148 bfloat16x8_t __ret_50; \
8149 bfloat16x8_t __s0_50 = __p0_50; \
8150 __ret_50 = splatq_laneq_bf16(__s0_50, __p1_50); \
8151 __ret_50; \
8152})
8153#else
8154#define vdupq_laneq_bf16(__p0_51, __p1_51) __extension__ ({ \
8155 bfloat16x8_t __ret_51; \
8156 bfloat16x8_t __s0_51 = __p0_51; \
8157 bfloat16x8_t __rev0_51; __rev0_51 = __builtin_shufflevector(__s0_51, __s0_51, __lane_reverse_128_16); \
8158 __ret_51 = __noswap_splatq_laneq_bf16(__rev0_51, __p1_51); \
8159 __ret_51 = __builtin_shufflevector(__ret_51, __ret_51, __lane_reverse_128_16); \
92388160 __ret_51; \
92398161})
8162#endif
8163
92408164#ifdef __LITTLE_ENDIAN__
9241#define vdup_lane_s16(__p0_52, __p1_52) __extension__ ({ \
9242 int16x4_t __ret_52; \
9243 int16x4_t __s0_52 = __p0_52; \
9244 __ret_52 = splat_lane_s16(__s0_52, __p1_52); \
8165#define vdup_laneq_bf16(__p0_52, __p1_52) __extension__ ({ \
8166 bfloat16x4_t __ret_52; \
8167 bfloat16x8_t __s0_52 = __p0_52; \
8168 __ret_52 = splat_laneq_bf16(__s0_52, __p1_52); \
92458169 __ret_52; \
92468170})
92478171#else
9248#define vdup_lane_s16(__p0_53, __p1_53) __extension__ ({ \
9249 int16x4_t __ret_53; \
9250 int16x4_t __s0_53 = __p0_53; \
9251 int16x4_t __rev0_53; __rev0_53 = __builtin_shufflevector(__s0_53, __s0_53, __lane_reverse_64_16); \
9252 __ret_53 = __noswap_splat_lane_s16(__rev0_53, __p1_53); \
8172#define vdup_laneq_bf16(__p0_53, __p1_53) __extension__ ({ \
8173 bfloat16x4_t __ret_53; \
8174 bfloat16x8_t __s0_53 = __p0_53; \
8175 bfloat16x8_t __rev0_53; __rev0_53 = __builtin_shufflevector(__s0_53, __s0_53, __lane_reverse_128_16); \
8176 __ret_53 = __noswap_splat_laneq_bf16(__rev0_53, __p1_53); \
92538177 __ret_53 = __builtin_shufflevector(__ret_53, __ret_53, __lane_reverse_64_16); \
92548178 __ret_53; \
92558179})
......@@ -9599,6 +8523,36 @@ __ai __attribute__((target("neon"))) int16x4_t vdup_n_s16(int16_t __p0) {
95998523}
96008524#endif
96018525
8526#ifdef __LITTLE_ENDIAN__
8527__ai __attribute__((target("neon"))) bfloat16x8_t vdupq_n_bf16(bfloat16_t __p0) {
8528 bfloat16x8_t __ret;
8529 __ret = (bfloat16x8_t) {__p0, __p0, __p0, __p0, __p0, __p0, __p0, __p0};
8530 return __ret;
8531}
8532#else
8533__ai __attribute__((target("neon"))) bfloat16x8_t vdupq_n_bf16(bfloat16_t __p0) {
8534 bfloat16x8_t __ret;
8535 __ret = (bfloat16x8_t) {__p0, __p0, __p0, __p0, __p0, __p0, __p0, __p0};
8536 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
8537 return __ret;
8538}
8539#endif
8540
8541#ifdef __LITTLE_ENDIAN__
8542__ai __attribute__((target("neon"))) bfloat16x4_t vdup_n_bf16(bfloat16_t __p0) {
8543 bfloat16x4_t __ret;
8544 __ret = (bfloat16x4_t) {__p0, __p0, __p0, __p0};
8545 return __ret;
8546}
8547#else
8548__ai __attribute__((target("neon"))) bfloat16x4_t vdup_n_bf16(bfloat16_t __p0) {
8549 bfloat16x4_t __ret;
8550 __ret = (bfloat16x4_t) {__p0, __p0, __p0, __p0};
8551 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
8552 return __ret;
8553}
8554#endif
8555
96028556#ifdef __LITTLE_ENDIAN__
96038557__ai __attribute__((target("neon"))) uint8x16_t veorq_u8(uint8x16_t __p0, uint8x16_t __p1) {
96048558 uint8x16_t __ret;
......@@ -10558,6 +9512,27 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
105589512}
105599513#endif
105609514
9515#ifdef __LITTLE_ENDIAN__
9516__ai __attribute__((target("neon"))) bfloat16x4_t vget_high_bf16(bfloat16x8_t __p0) {
9517 bfloat16x4_t __ret;
9518 __ret = __builtin_shufflevector(__p0, __p0, 4, 5, 6, 7);
9519 return __ret;
9520}
9521#else
9522__ai __attribute__((target("neon"))) bfloat16x4_t vget_high_bf16(bfloat16x8_t __p0) {
9523 bfloat16x4_t __ret;
9524 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
9525 __ret = __builtin_shufflevector(__rev0, __rev0, 4, 5, 6, 7);
9526 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
9527 return __ret;
9528}
9529__ai __attribute__((target("neon"))) bfloat16x4_t __noswap_vget_high_bf16(bfloat16x8_t __p0) {
9530 bfloat16x4_t __ret;
9531 __ret = __builtin_shufflevector(__p0, __p0, 4, 5, 6, 7);
9532 return __ret;
9533}
9534#endif
9535
105619536#ifdef __LITTLE_ENDIAN__
105629537#define vget_lane_p8(__p0, __p1) __extension__ ({ \
105639538 poly8_t __ret; \
......@@ -11030,6 +10005,52 @@ __ai __attribute__((target("neon"))) int16x4_t __noswap_vget_high_s16(int16x8_t
1103010005})
1103110006#endif
1103210007
10008#ifdef __LITTLE_ENDIAN__
10009#define vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
10010 bfloat16_t __ret; \
10011 bfloat16x8_t __s0 = __p0; \
10012 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__s0, __p1)); \
10013 __ret; \
10014})
10015#else
10016#define vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
10017 bfloat16_t __ret; \
10018 bfloat16x8_t __s0 = __p0; \
10019 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
10020 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__rev0, __p1)); \
10021 __ret; \
10022})
10023#define __noswap_vgetq_lane_bf16(__p0, __p1) __extension__ ({ \
10024 bfloat16_t __ret; \
10025 bfloat16x8_t __s0 = __p0; \
10026 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vgetq_lane_bf16(__s0, __p1)); \
10027 __ret; \
10028})
10029#endif
10030
10031#ifdef __LITTLE_ENDIAN__
10032#define vget_lane_bf16(__p0, __p1) __extension__ ({ \
10033 bfloat16_t __ret; \
10034 bfloat16x4_t __s0 = __p0; \
10035 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__s0, __p1)); \
10036 __ret; \
10037})
10038#else
10039#define vget_lane_bf16(__p0, __p1) __extension__ ({ \
10040 bfloat16_t __ret; \
10041 bfloat16x4_t __s0 = __p0; \
10042 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
10043 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__rev0, __p1)); \
10044 __ret; \
10045})
10046#define __noswap_vget_lane_bf16(__p0, __p1) __extension__ ({ \
10047 bfloat16_t __ret; \
10048 bfloat16x4_t __s0 = __p0; \
10049 __ret = __builtin_bit_cast(bfloat16_t, __builtin_neon_vget_lane_bf16(__s0, __p1)); \
10050 __ret; \
10051})
10052#endif
10053
1103310054#ifdef __LITTLE_ENDIAN__
1103410055__ai __attribute__((target("neon"))) poly8x8_t vget_low_p8(poly8x16_t __p0) {
1103510056 poly8x8_t __ret;
......@@ -11220,6 +10241,27 @@ __ai __attribute__((target("neon"))) int16x4_t vget_low_s16(int16x8_t __p0) {
1122010241}
1122110242#endif
1122210243
10244#ifdef __LITTLE_ENDIAN__
10245__ai __attribute__((target("neon"))) bfloat16x4_t vget_low_bf16(bfloat16x8_t __p0) {
10246 bfloat16x4_t __ret;
10247 __ret = __builtin_shufflevector(__p0, __p0, 0, 1, 2, 3);
10248 return __ret;
10249}
10250#else
10251__ai __attribute__((target("neon"))) bfloat16x4_t vget_low_bf16(bfloat16x8_t __p0) {
10252 bfloat16x4_t __ret;
10253 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
10254 __ret = __builtin_shufflevector(__rev0, __rev0, 0, 1, 2, 3);
10255 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
10256 return __ret;
10257}
10258__ai __attribute__((target("neon"))) bfloat16x4_t __noswap_vget_low_bf16(bfloat16x8_t __p0) {
10259 bfloat16x4_t __ret;
10260 __ret = __builtin_shufflevector(__p0, __p0, 0, 1, 2, 3);
10261 return __ret;
10262}
10263#endif
10264
1122310265#ifdef __LITTLE_ENDIAN__
1122410266__ai __attribute__((target("neon"))) uint8x16_t vhaddq_u8(uint8x16_t __p0, uint8x16_t __p1) {
1122510267 uint8x16_t __ret;
......@@ -11938,6 +10980,36 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1193810980})
1193910981#endif
1194010982
10983#ifdef __LITTLE_ENDIAN__
10984#define vld1q_bf16(__p0) __extension__ ({ \
10985 bfloat16x8_t __ret; \
10986 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_v(__p0, 43)); \
10987 __ret; \
10988})
10989#else
10990#define vld1q_bf16(__p0) __extension__ ({ \
10991 bfloat16x8_t __ret; \
10992 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_v(__p0, 43)); \
10993 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
10994 __ret; \
10995})
10996#endif
10997
10998#ifdef __LITTLE_ENDIAN__
10999#define vld1_bf16(__p0) __extension__ ({ \
11000 bfloat16x4_t __ret; \
11001 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_v(__p0, 11)); \
11002 __ret; \
11003})
11004#else
11005#define vld1_bf16(__p0) __extension__ ({ \
11006 bfloat16x4_t __ret; \
11007 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_v(__p0, 11)); \
11008 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
11009 __ret; \
11010})
11011#endif
11012
1194111013#ifdef __LITTLE_ENDIAN__
1194211014#define vld1_dup_p8(__p0) __extension__ ({ \
1194311015 poly8x8_t __ret; \
......@@ -12248,6 +11320,36 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1224811320})
1224911321#endif
1225011322
11323#ifdef __LITTLE_ENDIAN__
11324#define vld1q_dup_bf16(__p0) __extension__ ({ \
11325 bfloat16x8_t __ret; \
11326 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_dup_v(__p0, 43)); \
11327 __ret; \
11328})
11329#else
11330#define vld1q_dup_bf16(__p0) __extension__ ({ \
11331 bfloat16x8_t __ret; \
11332 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_dup_v(__p0, 43)); \
11333 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
11334 __ret; \
11335})
11336#endif
11337
11338#ifdef __LITTLE_ENDIAN__
11339#define vld1_dup_bf16(__p0) __extension__ ({ \
11340 bfloat16x4_t __ret; \
11341 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_dup_v(__p0, 11)); \
11342 __ret; \
11343})
11344#else
11345#define vld1_dup_bf16(__p0) __extension__ ({ \
11346 bfloat16x4_t __ret; \
11347 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_dup_v(__p0, 11)); \
11348 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
11349 __ret; \
11350})
11351#endif
11352
1225111353#ifdef __LITTLE_ENDIAN__
1225211354#define vld1_lane_p8(__p0, __p1, __p2) __extension__ ({ \
1225311355 poly8x8_t __ret; \
......@@ -12620,6 +11722,42 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1262011722})
1262111723#endif
1262211724
11725#ifdef __LITTLE_ENDIAN__
11726#define vld1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
11727 bfloat16x8_t __ret; \
11728 bfloat16x8_t __s1 = __p1; \
11729 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
11730 __ret; \
11731})
11732#else
11733#define vld1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
11734 bfloat16x8_t __ret; \
11735 bfloat16x8_t __s1 = __p1; \
11736 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
11737 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vld1q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
11738 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
11739 __ret; \
11740})
11741#endif
11742
11743#ifdef __LITTLE_ENDIAN__
11744#define vld1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
11745 bfloat16x4_t __ret; \
11746 bfloat16x4_t __s1 = __p1; \
11747 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_lane_v(__p0, __builtin_bit_cast(int8x8_t, __s1), __p2, 11)); \
11748 __ret; \
11749})
11750#else
11751#define vld1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
11752 bfloat16x4_t __ret; \
11753 bfloat16x4_t __s1 = __p1; \
11754 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
11755 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vld1_lane_v(__p0, __builtin_bit_cast(int8x8_t, __rev1), __p2, 11)); \
11756 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
11757 __ret; \
11758})
11759#endif
11760
1262311761#ifdef __LITTLE_ENDIAN__
1262411762#define vld1_p8_x2(__p0) __extension__ ({ \
1262511763 poly8x8x2_t __ret; \
......@@ -12970,6 +12108,40 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1297012108})
1297112109#endif
1297212110
12111#ifdef __LITTLE_ENDIAN__
12112#define vld1q_bf16_x2(__p0) __extension__ ({ \
12113 bfloat16x8x2_t __ret; \
12114 __builtin_neon_vld1q_x2_v(&__ret, __p0, 43); \
12115 __ret; \
12116})
12117#else
12118#define vld1q_bf16_x2(__p0) __extension__ ({ \
12119 bfloat16x8x2_t __ret; \
12120 __builtin_neon_vld1q_x2_v(&__ret, __p0, 43); \
12121 \
12122 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
12123 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
12124 __ret; \
12125})
12126#endif
12127
12128#ifdef __LITTLE_ENDIAN__
12129#define vld1_bf16_x2(__p0) __extension__ ({ \
12130 bfloat16x4x2_t __ret; \
12131 __builtin_neon_vld1_x2_v(&__ret, __p0, 11); \
12132 __ret; \
12133})
12134#else
12135#define vld1_bf16_x2(__p0) __extension__ ({ \
12136 bfloat16x4x2_t __ret; \
12137 __builtin_neon_vld1_x2_v(&__ret, __p0, 11); \
12138 \
12139 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
12140 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
12141 __ret; \
12142})
12143#endif
12144
1297312145#ifdef __LITTLE_ENDIAN__
1297412146#define vld1_p8_x3(__p0) __extension__ ({ \
1297512147 poly8x8x3_t __ret; \
......@@ -13340,6 +12512,42 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1334012512})
1334112513#endif
1334212514
12515#ifdef __LITTLE_ENDIAN__
12516#define vld1q_bf16_x3(__p0) __extension__ ({ \
12517 bfloat16x8x3_t __ret; \
12518 __builtin_neon_vld1q_x3_v(&__ret, __p0, 43); \
12519 __ret; \
12520})
12521#else
12522#define vld1q_bf16_x3(__p0) __extension__ ({ \
12523 bfloat16x8x3_t __ret; \
12524 __builtin_neon_vld1q_x3_v(&__ret, __p0, 43); \
12525 \
12526 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
12527 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
12528 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
12529 __ret; \
12530})
12531#endif
12532
12533#ifdef __LITTLE_ENDIAN__
12534#define vld1_bf16_x3(__p0) __extension__ ({ \
12535 bfloat16x4x3_t __ret; \
12536 __builtin_neon_vld1_x3_v(&__ret, __p0, 11); \
12537 __ret; \
12538})
12539#else
12540#define vld1_bf16_x3(__p0) __extension__ ({ \
12541 bfloat16x4x3_t __ret; \
12542 __builtin_neon_vld1_x3_v(&__ret, __p0, 11); \
12543 \
12544 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
12545 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
12546 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
12547 __ret; \
12548})
12549#endif
12550
1334312551#ifdef __LITTLE_ENDIAN__
1334412552#define vld1_p8_x4(__p0) __extension__ ({ \
1334512553 poly8x8x4_t __ret; \
......@@ -13730,6 +12938,44 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1373012938})
1373112939#endif
1373212940
12941#ifdef __LITTLE_ENDIAN__
12942#define vld1q_bf16_x4(__p0) __extension__ ({ \
12943 bfloat16x8x4_t __ret; \
12944 __builtin_neon_vld1q_x4_v(&__ret, __p0, 43); \
12945 __ret; \
12946})
12947#else
12948#define vld1q_bf16_x4(__p0) __extension__ ({ \
12949 bfloat16x8x4_t __ret; \
12950 __builtin_neon_vld1q_x4_v(&__ret, __p0, 43); \
12951 \
12952 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
12953 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
12954 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
12955 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
12956 __ret; \
12957})
12958#endif
12959
12960#ifdef __LITTLE_ENDIAN__
12961#define vld1_bf16_x4(__p0) __extension__ ({ \
12962 bfloat16x4x4_t __ret; \
12963 __builtin_neon_vld1_x4_v(&__ret, __p0, 11); \
12964 __ret; \
12965})
12966#else
12967#define vld1_bf16_x4(__p0) __extension__ ({ \
12968 bfloat16x4x4_t __ret; \
12969 __builtin_neon_vld1_x4_v(&__ret, __p0, 11); \
12970 \
12971 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
12972 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
12973 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
12974 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
12975 __ret; \
12976})
12977#endif
12978
1373312979#ifdef __LITTLE_ENDIAN__
1373412980#define vld2_p8(__p0) __extension__ ({ \
1373512981 poly8x8x2_t __ret; \
......@@ -14046,6 +13292,40 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1404613292})
1404713293#endif
1404813294
13295#ifdef __LITTLE_ENDIAN__
13296#define vld2q_bf16(__p0) __extension__ ({ \
13297 bfloat16x8x2_t __ret; \
13298 __builtin_neon_vld2q_v(&__ret, __p0, 43); \
13299 __ret; \
13300})
13301#else
13302#define vld2q_bf16(__p0) __extension__ ({ \
13303 bfloat16x8x2_t __ret; \
13304 __builtin_neon_vld2q_v(&__ret, __p0, 43); \
13305 \
13306 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
13307 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
13308 __ret; \
13309})
13310#endif
13311
13312#ifdef __LITTLE_ENDIAN__
13313#define vld2_bf16(__p0) __extension__ ({ \
13314 bfloat16x4x2_t __ret; \
13315 __builtin_neon_vld2_v(&__ret, __p0, 11); \
13316 __ret; \
13317})
13318#else
13319#define vld2_bf16(__p0) __extension__ ({ \
13320 bfloat16x4x2_t __ret; \
13321 __builtin_neon_vld2_v(&__ret, __p0, 11); \
13322 \
13323 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
13324 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
13325 __ret; \
13326})
13327#endif
13328
1404913329#ifdef __LITTLE_ENDIAN__
1405013330#define vld2_dup_p8(__p0) __extension__ ({ \
1405113331 poly8x8x2_t __ret; \
......@@ -14396,6 +13676,40 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1439613676})
1439713677#endif
1439813678
13679#ifdef __LITTLE_ENDIAN__
13680#define vld2q_dup_bf16(__p0) __extension__ ({ \
13681 bfloat16x8x2_t __ret; \
13682 __builtin_neon_vld2q_dup_v(&__ret, __p0, 43); \
13683 __ret; \
13684})
13685#else
13686#define vld2q_dup_bf16(__p0) __extension__ ({ \
13687 bfloat16x8x2_t __ret; \
13688 __builtin_neon_vld2q_dup_v(&__ret, __p0, 43); \
13689 \
13690 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
13691 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
13692 __ret; \
13693})
13694#endif
13695
13696#ifdef __LITTLE_ENDIAN__
13697#define vld2_dup_bf16(__p0) __extension__ ({ \
13698 bfloat16x4x2_t __ret; \
13699 __builtin_neon_vld2_dup_v(&__ret, __p0, 11); \
13700 __ret; \
13701})
13702#else
13703#define vld2_dup_bf16(__p0) __extension__ ({ \
13704 bfloat16x4x2_t __ret; \
13705 __builtin_neon_vld2_dup_v(&__ret, __p0, 11); \
13706 \
13707 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
13708 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
13709 __ret; \
13710})
13711#endif
13712
1439913713#ifdef __LITTLE_ENDIAN__
1440013714#define vld2_lane_p8(__p0, __p1, __p2) __extension__ ({ \
1440113715 poly8x8x2_t __ret; \
......@@ -14726,6 +14040,50 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1472614040})
1472714041#endif
1472814042
14043#ifdef __LITTLE_ENDIAN__
14044#define vld2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
14045 bfloat16x8x2_t __ret; \
14046 bfloat16x8x2_t __s1 = __p1; \
14047 __builtin_neon_vld2q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __p2, 43); \
14048 __ret; \
14049})
14050#else
14051#define vld2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
14052 bfloat16x8x2_t __ret; \
14053 bfloat16x8x2_t __s1 = __p1; \
14054 bfloat16x8x2_t __rev1; \
14055 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
14056 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
14057 __builtin_neon_vld2q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __p2, 43); \
14058 \
14059 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
14060 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
14061 __ret; \
14062})
14063#endif
14064
14065#ifdef __LITTLE_ENDIAN__
14066#define vld2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
14067 bfloat16x4x2_t __ret; \
14068 bfloat16x4x2_t __s1 = __p1; \
14069 __builtin_neon_vld2_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __p2, 11); \
14070 __ret; \
14071})
14072#else
14073#define vld2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
14074 bfloat16x4x2_t __ret; \
14075 bfloat16x4x2_t __s1 = __p1; \
14076 bfloat16x4x2_t __rev1; \
14077 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
14078 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
14079 __builtin_neon_vld2_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __p2, 11); \
14080 \
14081 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
14082 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
14083 __ret; \
14084})
14085#endif
14086
1472914087#ifdef __LITTLE_ENDIAN__
1473014088#define vld3_p8(__p0) __extension__ ({ \
1473114089 poly8x8x3_t __ret; \
......@@ -15060,6 +14418,42 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1506014418})
1506114419#endif
1506214420
14421#ifdef __LITTLE_ENDIAN__
14422#define vld3q_bf16(__p0) __extension__ ({ \
14423 bfloat16x8x3_t __ret; \
14424 __builtin_neon_vld3q_v(&__ret, __p0, 43); \
14425 __ret; \
14426})
14427#else
14428#define vld3q_bf16(__p0) __extension__ ({ \
14429 bfloat16x8x3_t __ret; \
14430 __builtin_neon_vld3q_v(&__ret, __p0, 43); \
14431 \
14432 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
14433 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
14434 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
14435 __ret; \
14436})
14437#endif
14438
14439#ifdef __LITTLE_ENDIAN__
14440#define vld3_bf16(__p0) __extension__ ({ \
14441 bfloat16x4x3_t __ret; \
14442 __builtin_neon_vld3_v(&__ret, __p0, 11); \
14443 __ret; \
14444})
14445#else
14446#define vld3_bf16(__p0) __extension__ ({ \
14447 bfloat16x4x3_t __ret; \
14448 __builtin_neon_vld3_v(&__ret, __p0, 11); \
14449 \
14450 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
14451 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
14452 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
14453 __ret; \
14454})
14455#endif
14456
1506314457#ifdef __LITTLE_ENDIAN__
1506414458#define vld3_dup_p8(__p0) __extension__ ({ \
1506514459 poly8x8x3_t __ret; \
......@@ -15430,6 +14824,42 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1543014824})
1543114825#endif
1543214826
14827#ifdef __LITTLE_ENDIAN__
14828#define vld3q_dup_bf16(__p0) __extension__ ({ \
14829 bfloat16x8x3_t __ret; \
14830 __builtin_neon_vld3q_dup_v(&__ret, __p0, 43); \
14831 __ret; \
14832})
14833#else
14834#define vld3q_dup_bf16(__p0) __extension__ ({ \
14835 bfloat16x8x3_t __ret; \
14836 __builtin_neon_vld3q_dup_v(&__ret, __p0, 43); \
14837 \
14838 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
14839 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
14840 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
14841 __ret; \
14842})
14843#endif
14844
14845#ifdef __LITTLE_ENDIAN__
14846#define vld3_dup_bf16(__p0) __extension__ ({ \
14847 bfloat16x4x3_t __ret; \
14848 __builtin_neon_vld3_dup_v(&__ret, __p0, 11); \
14849 __ret; \
14850})
14851#else
14852#define vld3_dup_bf16(__p0) __extension__ ({ \
14853 bfloat16x4x3_t __ret; \
14854 __builtin_neon_vld3_dup_v(&__ret, __p0, 11); \
14855 \
14856 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
14857 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
14858 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
14859 __ret; \
14860})
14861#endif
14862
1543314863#ifdef __LITTLE_ENDIAN__
1543414864#define vld3_lane_p8(__p0, __p1, __p2) __extension__ ({ \
1543514865 poly8x8x3_t __ret; \
......@@ -15790,6 +15220,54 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1579015220})
1579115221#endif
1579215222
15223#ifdef __LITTLE_ENDIAN__
15224#define vld3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
15225 bfloat16x8x3_t __ret; \
15226 bfloat16x8x3_t __s1 = __p1; \
15227 __builtin_neon_vld3q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __p2, 43); \
15228 __ret; \
15229})
15230#else
15231#define vld3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
15232 bfloat16x8x3_t __ret; \
15233 bfloat16x8x3_t __s1 = __p1; \
15234 bfloat16x8x3_t __rev1; \
15235 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
15236 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
15237 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
15238 __builtin_neon_vld3q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __p2, 43); \
15239 \
15240 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
15241 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
15242 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
15243 __ret; \
15244})
15245#endif
15246
15247#ifdef __LITTLE_ENDIAN__
15248#define vld3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
15249 bfloat16x4x3_t __ret; \
15250 bfloat16x4x3_t __s1 = __p1; \
15251 __builtin_neon_vld3_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __p2, 11); \
15252 __ret; \
15253})
15254#else
15255#define vld3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
15256 bfloat16x4x3_t __ret; \
15257 bfloat16x4x3_t __s1 = __p1; \
15258 bfloat16x4x3_t __rev1; \
15259 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
15260 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
15261 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
15262 __builtin_neon_vld3_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __p2, 11); \
15263 \
15264 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
15265 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
15266 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
15267 __ret; \
15268})
15269#endif
15270
1579315271#ifdef __LITTLE_ENDIAN__
1579415272#define vld4_p8(__p0) __extension__ ({ \
1579515273 poly8x8x4_t __ret; \
......@@ -16142,6 +15620,44 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1614215620})
1614315621#endif
1614415622
15623#ifdef __LITTLE_ENDIAN__
15624#define vld4q_bf16(__p0) __extension__ ({ \
15625 bfloat16x8x4_t __ret; \
15626 __builtin_neon_vld4q_v(&__ret, __p0, 43); \
15627 __ret; \
15628})
15629#else
15630#define vld4q_bf16(__p0) __extension__ ({ \
15631 bfloat16x8x4_t __ret; \
15632 __builtin_neon_vld4q_v(&__ret, __p0, 43); \
15633 \
15634 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
15635 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
15636 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
15637 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
15638 __ret; \
15639})
15640#endif
15641
15642#ifdef __LITTLE_ENDIAN__
15643#define vld4_bf16(__p0) __extension__ ({ \
15644 bfloat16x4x4_t __ret; \
15645 __builtin_neon_vld4_v(&__ret, __p0, 11); \
15646 __ret; \
15647})
15648#else
15649#define vld4_bf16(__p0) __extension__ ({ \
15650 bfloat16x4x4_t __ret; \
15651 __builtin_neon_vld4_v(&__ret, __p0, 11); \
15652 \
15653 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
15654 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
15655 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
15656 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
15657 __ret; \
15658})
15659#endif
15660
1614515661#ifdef __LITTLE_ENDIAN__
1614615662#define vld4_dup_p8(__p0) __extension__ ({ \
1614715663 poly8x8x4_t __ret; \
......@@ -16532,6 +16048,44 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1653216048})
1653316049#endif
1653416050
16051#ifdef __LITTLE_ENDIAN__
16052#define vld4q_dup_bf16(__p0) __extension__ ({ \
16053 bfloat16x8x4_t __ret; \
16054 __builtin_neon_vld4q_dup_v(&__ret, __p0, 43); \
16055 __ret; \
16056})
16057#else
16058#define vld4q_dup_bf16(__p0) __extension__ ({ \
16059 bfloat16x8x4_t __ret; \
16060 __builtin_neon_vld4q_dup_v(&__ret, __p0, 43); \
16061 \
16062 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
16063 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
16064 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
16065 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
16066 __ret; \
16067})
16068#endif
16069
16070#ifdef __LITTLE_ENDIAN__
16071#define vld4_dup_bf16(__p0) __extension__ ({ \
16072 bfloat16x4x4_t __ret; \
16073 __builtin_neon_vld4_dup_v(&__ret, __p0, 11); \
16074 __ret; \
16075})
16076#else
16077#define vld4_dup_bf16(__p0) __extension__ ({ \
16078 bfloat16x4x4_t __ret; \
16079 __builtin_neon_vld4_dup_v(&__ret, __p0, 11); \
16080 \
16081 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
16082 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
16083 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
16084 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
16085 __ret; \
16086})
16087#endif
16088
1653516089#ifdef __LITTLE_ENDIAN__
1653616090#define vld4_lane_p8(__p0, __p1, __p2) __extension__ ({ \
1653716091 poly8x8x4_t __ret; \
......@@ -16922,6 +16476,58 @@ __ai __attribute__((target("neon"))) int16x4_t vhsub_s16(int16x4_t __p0, int16x4
1692216476})
1692316477#endif
1692416478
16479#ifdef __LITTLE_ENDIAN__
16480#define vld4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
16481 bfloat16x8x4_t __ret; \
16482 bfloat16x8x4_t __s1 = __p1; \
16483 __builtin_neon_vld4q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), __p2, 43); \
16484 __ret; \
16485})
16486#else
16487#define vld4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
16488 bfloat16x8x4_t __ret; \
16489 bfloat16x8x4_t __s1 = __p1; \
16490 bfloat16x8x4_t __rev1; \
16491 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
16492 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
16493 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
16494 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
16495 __builtin_neon_vld4q_lane_v(&__ret, __p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), __p2, 43); \
16496 \
16497 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_128_16); \
16498 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_128_16); \
16499 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_128_16); \
16500 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_128_16); \
16501 __ret; \
16502})
16503#endif
16504
16505#ifdef __LITTLE_ENDIAN__
16506#define vld4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
16507 bfloat16x4x4_t __ret; \
16508 bfloat16x4x4_t __s1 = __p1; \
16509 __builtin_neon_vld4_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), __p2, 11); \
16510 __ret; \
16511})
16512#else
16513#define vld4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
16514 bfloat16x4x4_t __ret; \
16515 bfloat16x4x4_t __s1 = __p1; \
16516 bfloat16x4x4_t __rev1; \
16517 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
16518 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
16519 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
16520 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
16521 __builtin_neon_vld4_lane_v(&__ret, __p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), __p2, 11); \
16522 \
16523 __ret.val[0] = __builtin_shufflevector(__ret.val[0], __ret.val[0], __lane_reverse_64_16); \
16524 __ret.val[1] = __builtin_shufflevector(__ret.val[1], __ret.val[1], __lane_reverse_64_16); \
16525 __ret.val[2] = __builtin_shufflevector(__ret.val[2], __ret.val[2], __lane_reverse_64_16); \
16526 __ret.val[3] = __builtin_shufflevector(__ret.val[3], __ret.val[3], __lane_reverse_64_16); \
16527 __ret; \
16528})
16529#endif
16530
1692516531#ifdef __LITTLE_ENDIAN__
1692616532__ai __attribute__((target("neon"))) uint8x16_t vmaxq_u8(uint8x16_t __p0, uint8x16_t __p1) {
1692716533 uint8x16_t __ret;
......@@ -27576,6 +27182,60 @@ __ai __attribute__((target("neon"))) int8x8_t __noswap_vrsubhn_s16(int16x8_t __p
2757627182})
2757727183#endif
2757827184
27185#ifdef __LITTLE_ENDIAN__
27186#define vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27187 bfloat16x8_t __ret; \
27188 bfloat16_t __s0 = __p0; \
27189 bfloat16x8_t __s1 = __p1; \
27190 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __s1, __p2)); \
27191 __ret; \
27192})
27193#else
27194#define vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27195 bfloat16x8_t __ret; \
27196 bfloat16_t __s0 = __p0; \
27197 bfloat16x8_t __s1 = __p1; \
27198 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
27199 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __rev1, __p2)); \
27200 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
27201 __ret; \
27202})
27203#define __noswap_vsetq_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27204 bfloat16x8_t __ret; \
27205 bfloat16_t __s0 = __p0; \
27206 bfloat16x8_t __s1 = __p1; \
27207 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vsetq_lane_bf16(__s0, __s1, __p2)); \
27208 __ret; \
27209})
27210#endif
27211
27212#ifdef __LITTLE_ENDIAN__
27213#define vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27214 bfloat16x4_t __ret; \
27215 bfloat16_t __s0 = __p0; \
27216 bfloat16x4_t __s1 = __p1; \
27217 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __s1, __p2)); \
27218 __ret; \
27219})
27220#else
27221#define vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27222 bfloat16x4_t __ret; \
27223 bfloat16_t __s0 = __p0; \
27224 bfloat16x4_t __s1 = __p1; \
27225 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
27226 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __rev1, __p2)); \
27227 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
27228 __ret; \
27229})
27230#define __noswap_vset_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
27231 bfloat16x4_t __ret; \
27232 bfloat16_t __s0 = __p0; \
27233 bfloat16x4_t __s1 = __p1; \
27234 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vset_lane_bf16(__s0, __s1, __p2)); \
27235 __ret; \
27236})
27237#endif
27238
2757927239#ifdef __LITTLE_ENDIAN__
2758027240__ai __attribute__((target("neon"))) uint8x16_t vshlq_u8(uint8x16_t __p0, int8x16_t __p1) {
2758127241 uint8x16_t __ret;
......@@ -30000,6 +29660,32 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3000029660})
3000129661#endif
3000229662
29663#ifdef __LITTLE_ENDIAN__
29664#define vst1q_bf16(__p0, __p1) __extension__ ({ \
29665 bfloat16x8_t __s1 = __p1; \
29666 __builtin_neon_vst1q_v(__p0, __builtin_bit_cast(int8x16_t, __s1), 43); \
29667})
29668#else
29669#define vst1q_bf16(__p0, __p1) __extension__ ({ \
29670 bfloat16x8_t __s1 = __p1; \
29671 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
29672 __builtin_neon_vst1q_v(__p0, __builtin_bit_cast(int8x16_t, __rev1), 43); \
29673})
29674#endif
29675
29676#ifdef __LITTLE_ENDIAN__
29677#define vst1_bf16(__p0, __p1) __extension__ ({ \
29678 bfloat16x4_t __s1 = __p1; \
29679 __builtin_neon_vst1_v(__p0, __builtin_bit_cast(int8x8_t, __s1), 11); \
29680})
29681#else
29682#define vst1_bf16(__p0, __p1) __extension__ ({ \
29683 bfloat16x4_t __s1 = __p1; \
29684 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
29685 __builtin_neon_vst1_v(__p0, __builtin_bit_cast(int8x8_t, __rev1), 11); \
29686})
29687#endif
29688
3000329689#ifdef __LITTLE_ENDIAN__
3000429690#define vst1_lane_p8(__p0, __p1, __p2) __extension__ ({ \
3000529691 poly8x8_t __s1 = __p1; \
......@@ -30268,6 +29954,32 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3026829954})
3026929955#endif
3027029956
29957#ifdef __LITTLE_ENDIAN__
29958#define vst1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
29959 bfloat16x8_t __s1 = __p1; \
29960 __builtin_neon_vst1q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __s1), __p2, 43); \
29961})
29962#else
29963#define vst1q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
29964 bfloat16x8_t __s1 = __p1; \
29965 bfloat16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
29966 __builtin_neon_vst1q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __rev1), __p2, 43); \
29967})
29968#endif
29969
29970#ifdef __LITTLE_ENDIAN__
29971#define vst1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
29972 bfloat16x4_t __s1 = __p1; \
29973 __builtin_neon_vst1_lane_v(__p0, __builtin_bit_cast(int8x8_t, __s1), __p2, 11); \
29974})
29975#else
29976#define vst1_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
29977 bfloat16x4_t __s1 = __p1; \
29978 bfloat16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
29979 __builtin_neon_vst1_lane_v(__p0, __builtin_bit_cast(int8x8_t, __rev1), __p2, 11); \
29980})
29981#endif
29982
3027129983#ifdef __LITTLE_ENDIAN__
3027229984#define vst1_p8_x2(__p0, __p1) __extension__ ({ \
3027329985 poly8x8x2_t __s1 = __p1; \
......@@ -30576,6 +30288,36 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3057630288})
3057730289#endif
3057830290
30291#ifdef __LITTLE_ENDIAN__
30292#define vst1q_bf16_x2(__p0, __p1) __extension__ ({ \
30293 bfloat16x8x2_t __s1 = __p1; \
30294 __builtin_neon_vst1q_x2_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), 43); \
30295})
30296#else
30297#define vst1q_bf16_x2(__p0, __p1) __extension__ ({ \
30298 bfloat16x8x2_t __s1 = __p1; \
30299 bfloat16x8x2_t __rev1; \
30300 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
30301 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
30302 __builtin_neon_vst1q_x2_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), 43); \
30303})
30304#endif
30305
30306#ifdef __LITTLE_ENDIAN__
30307#define vst1_bf16_x2(__p0, __p1) __extension__ ({ \
30308 bfloat16x4x2_t __s1 = __p1; \
30309 __builtin_neon_vst1_x2_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), 11); \
30310})
30311#else
30312#define vst1_bf16_x2(__p0, __p1) __extension__ ({ \
30313 bfloat16x4x2_t __s1 = __p1; \
30314 bfloat16x4x2_t __rev1; \
30315 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
30316 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
30317 __builtin_neon_vst1_x2_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), 11); \
30318})
30319#endif
30320
3057930321#ifdef __LITTLE_ENDIAN__
3058030322#define vst1_p8_x3(__p0, __p1) __extension__ ({ \
3058130323 poly8x8x3_t __s1 = __p1; \
......@@ -30904,6 +30646,38 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3090430646})
3090530647#endif
3090630648
30649#ifdef __LITTLE_ENDIAN__
30650#define vst1q_bf16_x3(__p0, __p1) __extension__ ({ \
30651 bfloat16x8x3_t __s1 = __p1; \
30652 __builtin_neon_vst1q_x3_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), 43); \
30653})
30654#else
30655#define vst1q_bf16_x3(__p0, __p1) __extension__ ({ \
30656 bfloat16x8x3_t __s1 = __p1; \
30657 bfloat16x8x3_t __rev1; \
30658 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
30659 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
30660 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
30661 __builtin_neon_vst1q_x3_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), 43); \
30662})
30663#endif
30664
30665#ifdef __LITTLE_ENDIAN__
30666#define vst1_bf16_x3(__p0, __p1) __extension__ ({ \
30667 bfloat16x4x3_t __s1 = __p1; \
30668 __builtin_neon_vst1_x3_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), 11); \
30669})
30670#else
30671#define vst1_bf16_x3(__p0, __p1) __extension__ ({ \
30672 bfloat16x4x3_t __s1 = __p1; \
30673 bfloat16x4x3_t __rev1; \
30674 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
30675 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
30676 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
30677 __builtin_neon_vst1_x3_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), 11); \
30678})
30679#endif
30680
3090730681#ifdef __LITTLE_ENDIAN__
3090830682#define vst1_p8_x4(__p0, __p1) __extension__ ({ \
3090930683 poly8x8x4_t __s1 = __p1; \
......@@ -31252,6 +31026,40 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3125231026})
3125331027#endif
3125431028
31029#ifdef __LITTLE_ENDIAN__
31030#define vst1q_bf16_x4(__p0, __p1) __extension__ ({ \
31031 bfloat16x8x4_t __s1 = __p1; \
31032 __builtin_neon_vst1q_x4_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), 43); \
31033})
31034#else
31035#define vst1q_bf16_x4(__p0, __p1) __extension__ ({ \
31036 bfloat16x8x4_t __s1 = __p1; \
31037 bfloat16x8x4_t __rev1; \
31038 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
31039 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
31040 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
31041 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
31042 __builtin_neon_vst1q_x4_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), 43); \
31043})
31044#endif
31045
31046#ifdef __LITTLE_ENDIAN__
31047#define vst1_bf16_x4(__p0, __p1) __extension__ ({ \
31048 bfloat16x4x4_t __s1 = __p1; \
31049 __builtin_neon_vst1_x4_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), 11); \
31050})
31051#else
31052#define vst1_bf16_x4(__p0, __p1) __extension__ ({ \
31053 bfloat16x4x4_t __s1 = __p1; \
31054 bfloat16x4x4_t __rev1; \
31055 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
31056 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
31057 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
31058 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
31059 __builtin_neon_vst1_x4_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), 11); \
31060})
31061#endif
31062
3125531063#ifdef __LITTLE_ENDIAN__
3125631064#define vst2_p8(__p0, __p1) __extension__ ({ \
3125731065 poly8x8x2_t __s1 = __p1; \
......@@ -31530,6 +31338,36 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3153031338})
3153131339#endif
3153231340
31341#ifdef __LITTLE_ENDIAN__
31342#define vst2q_bf16(__p0, __p1) __extension__ ({ \
31343 bfloat16x8x2_t __s1 = __p1; \
31344 __builtin_neon_vst2q_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), 43); \
31345})
31346#else
31347#define vst2q_bf16(__p0, __p1) __extension__ ({ \
31348 bfloat16x8x2_t __s1 = __p1; \
31349 bfloat16x8x2_t __rev1; \
31350 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
31351 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
31352 __builtin_neon_vst2q_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), 43); \
31353})
31354#endif
31355
31356#ifdef __LITTLE_ENDIAN__
31357#define vst2_bf16(__p0, __p1) __extension__ ({ \
31358 bfloat16x4x2_t __s1 = __p1; \
31359 __builtin_neon_vst2_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), 11); \
31360})
31361#else
31362#define vst2_bf16(__p0, __p1) __extension__ ({ \
31363 bfloat16x4x2_t __s1 = __p1; \
31364 bfloat16x4x2_t __rev1; \
31365 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
31366 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
31367 __builtin_neon_vst2_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), 11); \
31368})
31369#endif
31370
3153331371#ifdef __LITTLE_ENDIAN__
3153431372#define vst2_lane_p8(__p0, __p1, __p2) __extension__ ({ \
3153531373 poly8x8x2_t __s1 = __p1; \
......@@ -31755,6 +31593,36 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3175531593})
3175631594#endif
3175731595
31596#ifdef __LITTLE_ENDIAN__
31597#define vst2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
31598 bfloat16x8x2_t __s1 = __p1; \
31599 __builtin_neon_vst2q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __p2, 43); \
31600})
31601#else
31602#define vst2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
31603 bfloat16x8x2_t __s1 = __p1; \
31604 bfloat16x8x2_t __rev1; \
31605 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
31606 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
31607 __builtin_neon_vst2q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __p2, 43); \
31608})
31609#endif
31610
31611#ifdef __LITTLE_ENDIAN__
31612#define vst2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
31613 bfloat16x4x2_t __s1 = __p1; \
31614 __builtin_neon_vst2_lane_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __p2, 11); \
31615})
31616#else
31617#define vst2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
31618 bfloat16x4x2_t __s1 = __p1; \
31619 bfloat16x4x2_t __rev1; \
31620 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
31621 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
31622 __builtin_neon_vst2_lane_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __p2, 11); \
31623})
31624#endif
31625
3175831626#ifdef __LITTLE_ENDIAN__
3175931627#define vst3_p8(__p0, __p1) __extension__ ({ \
3176031628 poly8x8x3_t __s1 = __p1; \
......@@ -32051,6 +31919,38 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3205131919})
3205231920#endif
3205331921
31922#ifdef __LITTLE_ENDIAN__
31923#define vst3q_bf16(__p0, __p1) __extension__ ({ \
31924 bfloat16x8x3_t __s1 = __p1; \
31925 __builtin_neon_vst3q_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), 43); \
31926})
31927#else
31928#define vst3q_bf16(__p0, __p1) __extension__ ({ \
31929 bfloat16x8x3_t __s1 = __p1; \
31930 bfloat16x8x3_t __rev1; \
31931 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
31932 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
31933 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
31934 __builtin_neon_vst3q_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), 43); \
31935})
31936#endif
31937
31938#ifdef __LITTLE_ENDIAN__
31939#define vst3_bf16(__p0, __p1) __extension__ ({ \
31940 bfloat16x4x3_t __s1 = __p1; \
31941 __builtin_neon_vst3_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), 11); \
31942})
31943#else
31944#define vst3_bf16(__p0, __p1) __extension__ ({ \
31945 bfloat16x4x3_t __s1 = __p1; \
31946 bfloat16x4x3_t __rev1; \
31947 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
31948 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
31949 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
31950 __builtin_neon_vst3_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), 11); \
31951})
31952#endif
31953
3205431954#ifdef __LITTLE_ENDIAN__
3205531955#define vst3_lane_p8(__p0, __p1, __p2) __extension__ ({ \
3205631956 poly8x8x3_t __s1 = __p1; \
......@@ -32291,6 +32191,38 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3229132191})
3229232192#endif
3229332193
32194#ifdef __LITTLE_ENDIAN__
32195#define vst3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32196 bfloat16x8x3_t __s1 = __p1; \
32197 __builtin_neon_vst3q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __p2, 43); \
32198})
32199#else
32200#define vst3q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32201 bfloat16x8x3_t __s1 = __p1; \
32202 bfloat16x8x3_t __rev1; \
32203 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
32204 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
32205 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
32206 __builtin_neon_vst3q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __p2, 43); \
32207})
32208#endif
32209
32210#ifdef __LITTLE_ENDIAN__
32211#define vst3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32212 bfloat16x4x3_t __s1 = __p1; \
32213 __builtin_neon_vst3_lane_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __p2, 11); \
32214})
32215#else
32216#define vst3_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32217 bfloat16x4x3_t __s1 = __p1; \
32218 bfloat16x4x3_t __rev1; \
32219 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
32220 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
32221 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
32222 __builtin_neon_vst3_lane_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __p2, 11); \
32223})
32224#endif
32225
3229432226#ifdef __LITTLE_ENDIAN__
3229532227#define vst4_p8(__p0, __p1) __extension__ ({ \
3229632228 poly8x8x4_t __s1 = __p1; \
......@@ -32605,6 +32537,40 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3260532537})
3260632538#endif
3260732539
32540#ifdef __LITTLE_ENDIAN__
32541#define vst4q_bf16(__p0, __p1) __extension__ ({ \
32542 bfloat16x8x4_t __s1 = __p1; \
32543 __builtin_neon_vst4q_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), 43); \
32544})
32545#else
32546#define vst4q_bf16(__p0, __p1) __extension__ ({ \
32547 bfloat16x8x4_t __s1 = __p1; \
32548 bfloat16x8x4_t __rev1; \
32549 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
32550 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
32551 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
32552 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
32553 __builtin_neon_vst4q_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), 43); \
32554})
32555#endif
32556
32557#ifdef __LITTLE_ENDIAN__
32558#define vst4_bf16(__p0, __p1) __extension__ ({ \
32559 bfloat16x4x4_t __s1 = __p1; \
32560 __builtin_neon_vst4_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), 11); \
32561})
32562#else
32563#define vst4_bf16(__p0, __p1) __extension__ ({ \
32564 bfloat16x4x4_t __s1 = __p1; \
32565 bfloat16x4x4_t __rev1; \
32566 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
32567 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
32568 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
32569 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
32570 __builtin_neon_vst4_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), 11); \
32571})
32572#endif
32573
3260832574#ifdef __LITTLE_ENDIAN__
3260932575#define vst4_lane_p8(__p0, __p1, __p2) __extension__ ({ \
3261032576 poly8x8x4_t __s1 = __p1; \
......@@ -32860,6 +32826,40 @@ __ai __attribute__((target("neon"))) int16x4_t vshl_s16(int16x4_t __p0, int16x4_
3286032826})
3286132827#endif
3286232828
32829#ifdef __LITTLE_ENDIAN__
32830#define vst4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32831 bfloat16x8x4_t __s1 = __p1; \
32832 __builtin_neon_vst4q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __s1.val[0]), __builtin_bit_cast(int8x16_t, __s1.val[1]), __builtin_bit_cast(int8x16_t, __s1.val[2]), __builtin_bit_cast(int8x16_t, __s1.val[3]), __p2, 43); \
32833})
32834#else
32835#define vst4q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32836 bfloat16x8x4_t __s1 = __p1; \
32837 bfloat16x8x4_t __rev1; \
32838 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_128_16); \
32839 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_128_16); \
32840 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_128_16); \
32841 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_128_16); \
32842 __builtin_neon_vst4q_lane_v(__p0, __builtin_bit_cast(int8x16_t, __rev1.val[0]), __builtin_bit_cast(int8x16_t, __rev1.val[1]), __builtin_bit_cast(int8x16_t, __rev1.val[2]), __builtin_bit_cast(int8x16_t, __rev1.val[3]), __p2, 43); \
32843})
32844#endif
32845
32846#ifdef __LITTLE_ENDIAN__
32847#define vst4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32848 bfloat16x4x4_t __s1 = __p1; \
32849 __builtin_neon_vst4_lane_v(__p0, __builtin_bit_cast(int8x8_t, __s1.val[0]), __builtin_bit_cast(int8x8_t, __s1.val[1]), __builtin_bit_cast(int8x8_t, __s1.val[2]), __builtin_bit_cast(int8x8_t, __s1.val[3]), __p2, 11); \
32850})
32851#else
32852#define vst4_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
32853 bfloat16x4x4_t __s1 = __p1; \
32854 bfloat16x4x4_t __rev1; \
32855 __rev1.val[0] = __builtin_shufflevector(__s1.val[0], __s1.val[0], __lane_reverse_64_16); \
32856 __rev1.val[1] = __builtin_shufflevector(__s1.val[1], __s1.val[1], __lane_reverse_64_16); \
32857 __rev1.val[2] = __builtin_shufflevector(__s1.val[2], __s1.val[2], __lane_reverse_64_16); \
32858 __rev1.val[3] = __builtin_shufflevector(__s1.val[3], __s1.val[3], __lane_reverse_64_16); \
32859 __builtin_neon_vst4_lane_v(__p0, __builtin_bit_cast(int8x8_t, __rev1.val[0]), __builtin_bit_cast(int8x8_t, __rev1.val[1]), __builtin_bit_cast(int8x8_t, __rev1.val[2]), __builtin_bit_cast(int8x8_t, __rev1.val[3]), __p2, 11); \
32860})
32861#endif
32862
3286332863#ifdef __LITTLE_ENDIAN__
3286432864__ai __attribute__((target("neon"))) uint8x16_t vsubq_u8(uint8x16_t __p0, uint8x16_t __p1) {
3286532865 uint8x16_t __ret;
......@@ -37083,266 +37083,6 @@ __ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_low_bf16_f32(float3
3708337083}
3708437084#endif
3708537085
37086__ai __attribute__((target("bf16,neon"))) poly8x8_t vreinterpret_p8_bf16(bfloat16x4_t __p0) {
37087 poly8x8_t __ret;
37088 __ret = __builtin_bit_cast(poly8x8_t, __p0);
37089 return __ret;
37090}
37091__ai __attribute__((target("bf16,neon"))) poly64x1_t vreinterpret_p64_bf16(bfloat16x4_t __p0) {
37092 poly64x1_t __ret;
37093 __ret = __builtin_bit_cast(poly64x1_t, __p0);
37094 return __ret;
37095}
37096__ai __attribute__((target("bf16,neon"))) poly16x4_t vreinterpret_p16_bf16(bfloat16x4_t __p0) {
37097 poly16x4_t __ret;
37098 __ret = __builtin_bit_cast(poly16x4_t, __p0);
37099 return __ret;
37100}
37101__ai __attribute__((target("bf16,neon"))) poly8x16_t vreinterpretq_p8_bf16(bfloat16x8_t __p0) {
37102 poly8x16_t __ret;
37103 __ret = __builtin_bit_cast(poly8x16_t, __p0);
37104 return __ret;
37105}
37106__ai __attribute__((target("bf16,neon"))) poly64x2_t vreinterpretq_p64_bf16(bfloat16x8_t __p0) {
37107 poly64x2_t __ret;
37108 __ret = __builtin_bit_cast(poly64x2_t, __p0);
37109 return __ret;
37110}
37111__ai __attribute__((target("bf16,neon"))) poly16x8_t vreinterpretq_p16_bf16(bfloat16x8_t __p0) {
37112 poly16x8_t __ret;
37113 __ret = __builtin_bit_cast(poly16x8_t, __p0);
37114 return __ret;
37115}
37116__ai __attribute__((target("bf16,neon"))) uint8x16_t vreinterpretq_u8_bf16(bfloat16x8_t __p0) {
37117 uint8x16_t __ret;
37118 __ret = __builtin_bit_cast(uint8x16_t, __p0);
37119 return __ret;
37120}
37121__ai __attribute__((target("bf16,neon"))) uint32x4_t vreinterpretq_u32_bf16(bfloat16x8_t __p0) {
37122 uint32x4_t __ret;
37123 __ret = __builtin_bit_cast(uint32x4_t, __p0);
37124 return __ret;
37125}
37126__ai __attribute__((target("bf16,neon"))) uint64x2_t vreinterpretq_u64_bf16(bfloat16x8_t __p0) {
37127 uint64x2_t __ret;
37128 __ret = __builtin_bit_cast(uint64x2_t, __p0);
37129 return __ret;
37130}
37131__ai __attribute__((target("bf16,neon"))) uint16x8_t vreinterpretq_u16_bf16(bfloat16x8_t __p0) {
37132 uint16x8_t __ret;
37133 __ret = __builtin_bit_cast(uint16x8_t, __p0);
37134 return __ret;
37135}
37136__ai __attribute__((target("bf16,neon"))) int8x16_t vreinterpretq_s8_bf16(bfloat16x8_t __p0) {
37137 int8x16_t __ret;
37138 __ret = __builtin_bit_cast(int8x16_t, __p0);
37139 return __ret;
37140}
37141__ai __attribute__((target("bf16,neon"))) float32x4_t vreinterpretq_f32_bf16(bfloat16x8_t __p0) {
37142 float32x4_t __ret;
37143 __ret = __builtin_bit_cast(float32x4_t, __p0);
37144 return __ret;
37145}
37146__ai __attribute__((target("bf16,neon"))) float16x8_t vreinterpretq_f16_bf16(bfloat16x8_t __p0) {
37147 float16x8_t __ret;
37148 __ret = __builtin_bit_cast(float16x8_t, __p0);
37149 return __ret;
37150}
37151__ai __attribute__((target("bf16,neon"))) int32x4_t vreinterpretq_s32_bf16(bfloat16x8_t __p0) {
37152 int32x4_t __ret;
37153 __ret = __builtin_bit_cast(int32x4_t, __p0);
37154 return __ret;
37155}
37156__ai __attribute__((target("bf16,neon"))) int64x2_t vreinterpretq_s64_bf16(bfloat16x8_t __p0) {
37157 int64x2_t __ret;
37158 __ret = __builtin_bit_cast(int64x2_t, __p0);
37159 return __ret;
37160}
37161__ai __attribute__((target("bf16,neon"))) int16x8_t vreinterpretq_s16_bf16(bfloat16x8_t __p0) {
37162 int16x8_t __ret;
37163 __ret = __builtin_bit_cast(int16x8_t, __p0);
37164 return __ret;
37165}
37166__ai __attribute__((target("bf16,neon"))) uint8x8_t vreinterpret_u8_bf16(bfloat16x4_t __p0) {
37167 uint8x8_t __ret;
37168 __ret = __builtin_bit_cast(uint8x8_t, __p0);
37169 return __ret;
37170}
37171__ai __attribute__((target("bf16,neon"))) uint32x2_t vreinterpret_u32_bf16(bfloat16x4_t __p0) {
37172 uint32x2_t __ret;
37173 __ret = __builtin_bit_cast(uint32x2_t, __p0);
37174 return __ret;
37175}
37176__ai __attribute__((target("bf16,neon"))) uint64x1_t vreinterpret_u64_bf16(bfloat16x4_t __p0) {
37177 uint64x1_t __ret;
37178 __ret = __builtin_bit_cast(uint64x1_t, __p0);
37179 return __ret;
37180}
37181__ai __attribute__((target("bf16,neon"))) uint16x4_t vreinterpret_u16_bf16(bfloat16x4_t __p0) {
37182 uint16x4_t __ret;
37183 __ret = __builtin_bit_cast(uint16x4_t, __p0);
37184 return __ret;
37185}
37186__ai __attribute__((target("bf16,neon"))) int8x8_t vreinterpret_s8_bf16(bfloat16x4_t __p0) {
37187 int8x8_t __ret;
37188 __ret = __builtin_bit_cast(int8x8_t, __p0);
37189 return __ret;
37190}
37191__ai __attribute__((target("bf16,neon"))) float32x2_t vreinterpret_f32_bf16(bfloat16x4_t __p0) {
37192 float32x2_t __ret;
37193 __ret = __builtin_bit_cast(float32x2_t, __p0);
37194 return __ret;
37195}
37196__ai __attribute__((target("bf16,neon"))) float16x4_t vreinterpret_f16_bf16(bfloat16x4_t __p0) {
37197 float16x4_t __ret;
37198 __ret = __builtin_bit_cast(float16x4_t, __p0);
37199 return __ret;
37200}
37201__ai __attribute__((target("bf16,neon"))) int32x2_t vreinterpret_s32_bf16(bfloat16x4_t __p0) {
37202 int32x2_t __ret;
37203 __ret = __builtin_bit_cast(int32x2_t, __p0);
37204 return __ret;
37205}
37206__ai __attribute__((target("bf16,neon"))) int64x1_t vreinterpret_s64_bf16(bfloat16x4_t __p0) {
37207 int64x1_t __ret;
37208 __ret = __builtin_bit_cast(int64x1_t, __p0);
37209 return __ret;
37210}
37211__ai __attribute__((target("bf16,neon"))) int16x4_t vreinterpret_s16_bf16(bfloat16x4_t __p0) {
37212 int16x4_t __ret;
37213 __ret = __builtin_bit_cast(int16x4_t, __p0);
37214 return __ret;
37215}
37216__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p8(poly8x16_t __p0) {
37217 bfloat16x8_t __ret;
37218 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37219 return __ret;
37220}
37221__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p64(poly64x2_t __p0) {
37222 bfloat16x8_t __ret;
37223 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37224 return __ret;
37225}
37226__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p16(poly16x8_t __p0) {
37227 bfloat16x8_t __ret;
37228 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37229 return __ret;
37230}
37231__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u8(uint8x16_t __p0) {
37232 bfloat16x8_t __ret;
37233 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37234 return __ret;
37235}
37236__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u32(uint32x4_t __p0) {
37237 bfloat16x8_t __ret;
37238 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37239 return __ret;
37240}
37241__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u64(uint64x2_t __p0) {
37242 bfloat16x8_t __ret;
37243 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37244 return __ret;
37245}
37246__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u16(uint16x8_t __p0) {
37247 bfloat16x8_t __ret;
37248 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37249 return __ret;
37250}
37251__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s8(int8x16_t __p0) {
37252 bfloat16x8_t __ret;
37253 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37254 return __ret;
37255}
37256__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_f32(float32x4_t __p0) {
37257 bfloat16x8_t __ret;
37258 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37259 return __ret;
37260}
37261__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_f16(float16x8_t __p0) {
37262 bfloat16x8_t __ret;
37263 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37264 return __ret;
37265}
37266__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s32(int32x4_t __p0) {
37267 bfloat16x8_t __ret;
37268 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37269 return __ret;
37270}
37271__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s64(int64x2_t __p0) {
37272 bfloat16x8_t __ret;
37273 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37274 return __ret;
37275}
37276__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s16(int16x8_t __p0) {
37277 bfloat16x8_t __ret;
37278 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
37279 return __ret;
37280}
37281__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p8(poly8x8_t __p0) {
37282 bfloat16x4_t __ret;
37283 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37284 return __ret;
37285}
37286__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p64(poly64x1_t __p0) {
37287 bfloat16x4_t __ret;
37288 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37289 return __ret;
37290}
37291__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p16(poly16x4_t __p0) {
37292 bfloat16x4_t __ret;
37293 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37294 return __ret;
37295}
37296__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u8(uint8x8_t __p0) {
37297 bfloat16x4_t __ret;
37298 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37299 return __ret;
37300}
37301__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u32(uint32x2_t __p0) {
37302 bfloat16x4_t __ret;
37303 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37304 return __ret;
37305}
37306__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u64(uint64x1_t __p0) {
37307 bfloat16x4_t __ret;
37308 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37309 return __ret;
37310}
37311__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u16(uint16x4_t __p0) {
37312 bfloat16x4_t __ret;
37313 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37314 return __ret;
37315}
37316__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s8(int8x8_t __p0) {
37317 bfloat16x4_t __ret;
37318 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37319 return __ret;
37320}
37321__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_f32(float32x2_t __p0) {
37322 bfloat16x4_t __ret;
37323 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37324 return __ret;
37325}
37326__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_f16(float16x4_t __p0) {
37327 bfloat16x4_t __ret;
37328 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37329 return __ret;
37330}
37331__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s32(int32x2_t __p0) {
37332 bfloat16x4_t __ret;
37333 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37334 return __ret;
37335}
37336__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s64(int64x1_t __p0) {
37337 bfloat16x4_t __ret;
37338 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37339 return __ret;
37340}
37341__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s16(int16x4_t __p0) {
37342 bfloat16x4_t __ret;
37343 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
37344 return __ret;
37345}
3734637086#ifdef __LITTLE_ENDIAN__
3734737087#define vqdmulhq_lane_s32(__p0_214, __p1_214, __p2_214) __extension__ ({ \
3734837088 int32x4_t __ret_214; \
......@@ -38831,6 +38571,266 @@ __ai __attribute__((target("neon"))) int16x4_t vreinterpret_s16_s64(int64x1_t __
3883138571 __ret = __builtin_bit_cast(int16x4_t, __p0);
3883238572 return __ret;
3883338573}
38574__ai __attribute__((target("neon"))) poly8x8_t vreinterpret_p8_bf16(bfloat16x4_t __p0) {
38575 poly8x8_t __ret;
38576 __ret = __builtin_bit_cast(poly8x8_t, __p0);
38577 return __ret;
38578}
38579__ai __attribute__((target("neon"))) poly64x1_t vreinterpret_p64_bf16(bfloat16x4_t __p0) {
38580 poly64x1_t __ret;
38581 __ret = __builtin_bit_cast(poly64x1_t, __p0);
38582 return __ret;
38583}
38584__ai __attribute__((target("neon"))) poly16x4_t vreinterpret_p16_bf16(bfloat16x4_t __p0) {
38585 poly16x4_t __ret;
38586 __ret = __builtin_bit_cast(poly16x4_t, __p0);
38587 return __ret;
38588}
38589__ai __attribute__((target("neon"))) poly8x16_t vreinterpretq_p8_bf16(bfloat16x8_t __p0) {
38590 poly8x16_t __ret;
38591 __ret = __builtin_bit_cast(poly8x16_t, __p0);
38592 return __ret;
38593}
38594__ai __attribute__((target("neon"))) poly64x2_t vreinterpretq_p64_bf16(bfloat16x8_t __p0) {
38595 poly64x2_t __ret;
38596 __ret = __builtin_bit_cast(poly64x2_t, __p0);
38597 return __ret;
38598}
38599__ai __attribute__((target("neon"))) poly16x8_t vreinterpretq_p16_bf16(bfloat16x8_t __p0) {
38600 poly16x8_t __ret;
38601 __ret = __builtin_bit_cast(poly16x8_t, __p0);
38602 return __ret;
38603}
38604__ai __attribute__((target("neon"))) uint8x16_t vreinterpretq_u8_bf16(bfloat16x8_t __p0) {
38605 uint8x16_t __ret;
38606 __ret = __builtin_bit_cast(uint8x16_t, __p0);
38607 return __ret;
38608}
38609__ai __attribute__((target("neon"))) uint32x4_t vreinterpretq_u32_bf16(bfloat16x8_t __p0) {
38610 uint32x4_t __ret;
38611 __ret = __builtin_bit_cast(uint32x4_t, __p0);
38612 return __ret;
38613}
38614__ai __attribute__((target("neon"))) uint64x2_t vreinterpretq_u64_bf16(bfloat16x8_t __p0) {
38615 uint64x2_t __ret;
38616 __ret = __builtin_bit_cast(uint64x2_t, __p0);
38617 return __ret;
38618}
38619__ai __attribute__((target("neon"))) uint16x8_t vreinterpretq_u16_bf16(bfloat16x8_t __p0) {
38620 uint16x8_t __ret;
38621 __ret = __builtin_bit_cast(uint16x8_t, __p0);
38622 return __ret;
38623}
38624__ai __attribute__((target("neon"))) int8x16_t vreinterpretq_s8_bf16(bfloat16x8_t __p0) {
38625 int8x16_t __ret;
38626 __ret = __builtin_bit_cast(int8x16_t, __p0);
38627 return __ret;
38628}
38629__ai __attribute__((target("neon"))) float32x4_t vreinterpretq_f32_bf16(bfloat16x8_t __p0) {
38630 float32x4_t __ret;
38631 __ret = __builtin_bit_cast(float32x4_t, __p0);
38632 return __ret;
38633}
38634__ai __attribute__((target("neon"))) float16x8_t vreinterpretq_f16_bf16(bfloat16x8_t __p0) {
38635 float16x8_t __ret;
38636 __ret = __builtin_bit_cast(float16x8_t, __p0);
38637 return __ret;
38638}
38639__ai __attribute__((target("neon"))) int32x4_t vreinterpretq_s32_bf16(bfloat16x8_t __p0) {
38640 int32x4_t __ret;
38641 __ret = __builtin_bit_cast(int32x4_t, __p0);
38642 return __ret;
38643}
38644__ai __attribute__((target("neon"))) int64x2_t vreinterpretq_s64_bf16(bfloat16x8_t __p0) {
38645 int64x2_t __ret;
38646 __ret = __builtin_bit_cast(int64x2_t, __p0);
38647 return __ret;
38648}
38649__ai __attribute__((target("neon"))) int16x8_t vreinterpretq_s16_bf16(bfloat16x8_t __p0) {
38650 int16x8_t __ret;
38651 __ret = __builtin_bit_cast(int16x8_t, __p0);
38652 return __ret;
38653}
38654__ai __attribute__((target("neon"))) uint8x8_t vreinterpret_u8_bf16(bfloat16x4_t __p0) {
38655 uint8x8_t __ret;
38656 __ret = __builtin_bit_cast(uint8x8_t, __p0);
38657 return __ret;
38658}
38659__ai __attribute__((target("neon"))) uint32x2_t vreinterpret_u32_bf16(bfloat16x4_t __p0) {
38660 uint32x2_t __ret;
38661 __ret = __builtin_bit_cast(uint32x2_t, __p0);
38662 return __ret;
38663}
38664__ai __attribute__((target("neon"))) uint64x1_t vreinterpret_u64_bf16(bfloat16x4_t __p0) {
38665 uint64x1_t __ret;
38666 __ret = __builtin_bit_cast(uint64x1_t, __p0);
38667 return __ret;
38668}
38669__ai __attribute__((target("neon"))) uint16x4_t vreinterpret_u16_bf16(bfloat16x4_t __p0) {
38670 uint16x4_t __ret;
38671 __ret = __builtin_bit_cast(uint16x4_t, __p0);
38672 return __ret;
38673}
38674__ai __attribute__((target("neon"))) int8x8_t vreinterpret_s8_bf16(bfloat16x4_t __p0) {
38675 int8x8_t __ret;
38676 __ret = __builtin_bit_cast(int8x8_t, __p0);
38677 return __ret;
38678}
38679__ai __attribute__((target("neon"))) float32x2_t vreinterpret_f32_bf16(bfloat16x4_t __p0) {
38680 float32x2_t __ret;
38681 __ret = __builtin_bit_cast(float32x2_t, __p0);
38682 return __ret;
38683}
38684__ai __attribute__((target("neon"))) float16x4_t vreinterpret_f16_bf16(bfloat16x4_t __p0) {
38685 float16x4_t __ret;
38686 __ret = __builtin_bit_cast(float16x4_t, __p0);
38687 return __ret;
38688}
38689__ai __attribute__((target("neon"))) int32x2_t vreinterpret_s32_bf16(bfloat16x4_t __p0) {
38690 int32x2_t __ret;
38691 __ret = __builtin_bit_cast(int32x2_t, __p0);
38692 return __ret;
38693}
38694__ai __attribute__((target("neon"))) int64x1_t vreinterpret_s64_bf16(bfloat16x4_t __p0) {
38695 int64x1_t __ret;
38696 __ret = __builtin_bit_cast(int64x1_t, __p0);
38697 return __ret;
38698}
38699__ai __attribute__((target("neon"))) int16x4_t vreinterpret_s16_bf16(bfloat16x4_t __p0) {
38700 int16x4_t __ret;
38701 __ret = __builtin_bit_cast(int16x4_t, __p0);
38702 return __ret;
38703}
38704__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p8(poly8x16_t __p0) {
38705 bfloat16x8_t __ret;
38706 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38707 return __ret;
38708}
38709__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p64(poly64x2_t __p0) {
38710 bfloat16x8_t __ret;
38711 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38712 return __ret;
38713}
38714__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p16(poly16x8_t __p0) {
38715 bfloat16x8_t __ret;
38716 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38717 return __ret;
38718}
38719__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u8(uint8x16_t __p0) {
38720 bfloat16x8_t __ret;
38721 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38722 return __ret;
38723}
38724__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u32(uint32x4_t __p0) {
38725 bfloat16x8_t __ret;
38726 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38727 return __ret;
38728}
38729__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u64(uint64x2_t __p0) {
38730 bfloat16x8_t __ret;
38731 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38732 return __ret;
38733}
38734__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u16(uint16x8_t __p0) {
38735 bfloat16x8_t __ret;
38736 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38737 return __ret;
38738}
38739__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s8(int8x16_t __p0) {
38740 bfloat16x8_t __ret;
38741 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38742 return __ret;
38743}
38744__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_f32(float32x4_t __p0) {
38745 bfloat16x8_t __ret;
38746 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38747 return __ret;
38748}
38749__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_f16(float16x8_t __p0) {
38750 bfloat16x8_t __ret;
38751 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38752 return __ret;
38753}
38754__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s32(int32x4_t __p0) {
38755 bfloat16x8_t __ret;
38756 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38757 return __ret;
38758}
38759__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s64(int64x2_t __p0) {
38760 bfloat16x8_t __ret;
38761 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38762 return __ret;
38763}
38764__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s16(int16x8_t __p0) {
38765 bfloat16x8_t __ret;
38766 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
38767 return __ret;
38768}
38769__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p8(poly8x8_t __p0) {
38770 bfloat16x4_t __ret;
38771 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38772 return __ret;
38773}
38774__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p64(poly64x1_t __p0) {
38775 bfloat16x4_t __ret;
38776 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38777 return __ret;
38778}
38779__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p16(poly16x4_t __p0) {
38780 bfloat16x4_t __ret;
38781 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38782 return __ret;
38783}
38784__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u8(uint8x8_t __p0) {
38785 bfloat16x4_t __ret;
38786 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38787 return __ret;
38788}
38789__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u32(uint32x2_t __p0) {
38790 bfloat16x4_t __ret;
38791 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38792 return __ret;
38793}
38794__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u64(uint64x1_t __p0) {
38795 bfloat16x4_t __ret;
38796 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38797 return __ret;
38798}
38799__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u16(uint16x4_t __p0) {
38800 bfloat16x4_t __ret;
38801 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38802 return __ret;
38803}
38804__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s8(int8x8_t __p0) {
38805 bfloat16x4_t __ret;
38806 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38807 return __ret;
38808}
38809__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_f32(float32x2_t __p0) {
38810 bfloat16x4_t __ret;
38811 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38812 return __ret;
38813}
38814__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_f16(float16x4_t __p0) {
38815 bfloat16x4_t __ret;
38816 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38817 return __ret;
38818}
38819__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s32(int32x2_t __p0) {
38820 bfloat16x4_t __ret;
38821 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38822 return __ret;
38823}
38824__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s64(int64x1_t __p0) {
38825 bfloat16x4_t __ret;
38826 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38827 return __ret;
38828}
38829__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s16(int16x4_t __p0) {
38830 bfloat16x4_t __ret;
38831 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
38832 return __ret;
38833}
3883438834#endif
3883538835#if (__ARM_FP & 2)
3883638836#ifdef __LITTLE_ENDIAN__
......@@ -41141,6 +41141,174 @@ __ai __attribute__((target("neon"))) float32x2_t vfms_f32(float32x2_t __p0, floa
4114141141
4114241142#endif
4114341143#if defined(__aarch64__)
41144#ifdef __LITTLE_ENDIAN__
41145__ai __attribute__((target("f16f32dot,neon"))) float32x4_t vdotq_f32_f16(float32x4_t __p0, float16x8_t __p1, float16x8_t __p2) {
41146 float32x4_t __ret;
41147 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_f32_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
41148 return __ret;
41149}
41150#else
41151__ai __attribute__((target("f16f32dot,neon"))) float32x4_t vdotq_f32_f16(float32x4_t __p0, float16x8_t __p1, float16x8_t __p2) {
41152 float32x4_t __ret;
41153 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
41154 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
41155 float16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
41156 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_f32_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
41157 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
41158 return __ret;
41159}
41160#endif
41161
41162#ifdef __LITTLE_ENDIAN__
41163__ai __attribute__((target("f16f32dot,neon"))) float32x2_t vdot_f32_f16(float32x2_t __p0, float16x4_t __p1, float16x4_t __p2) {
41164 float32x2_t __ret;
41165 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_f32_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), __builtin_bit_cast(int8x8_t, __p2), 9));
41166 return __ret;
41167}
41168#else
41169__ai __attribute__((target("f16f32dot,neon"))) float32x2_t vdot_f32_f16(float32x2_t __p0, float16x4_t __p1, float16x4_t __p2) {
41170 float32x2_t __ret;
41171 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
41172 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
41173 float16x4_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_64_16);
41174 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_f32_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __builtin_bit_cast(int8x8_t, __rev2), 9));
41175 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
41176 return __ret;
41177}
41178#endif
41179
41180#ifdef __LITTLE_ENDIAN__
41181#define vdotq_lane_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41182 float32x4_t __ret; \
41183 float32x4_t __s0 = __p0; \
41184 float16x8_t __s1 = __p1; \
41185 float16x4_t __s2 = __p2; \
41186 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_lane_f32_f16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __builtin_bit_cast(int8x8_t, __s2), __p3, 41)); \
41187 __ret; \
41188})
41189#else
41190#define vdotq_lane_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41191 float32x4_t __ret; \
41192 float32x4_t __s0 = __p0; \
41193 float16x8_t __s1 = __p1; \
41194 float16x4_t __s2 = __p2; \
41195 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_32); \
41196 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
41197 float16x4_t __rev2; __rev2 = __builtin_shufflevector(__s2, __s2, __lane_reverse_64_16); \
41198 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_lane_f32_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x8_t, __rev2), __p3, 41)); \
41199 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32); \
41200 __ret; \
41201})
41202#endif
41203
41204#ifdef __LITTLE_ENDIAN__
41205#define vdot_lane_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41206 float32x2_t __ret; \
41207 float32x2_t __s0 = __p0; \
41208 float16x4_t __s1 = __p1; \
41209 float16x4_t __s2 = __p2; \
41210 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_lane_f32_f16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __builtin_bit_cast(int8x8_t, __s2), __p3, 9)); \
41211 __ret; \
41212})
41213#else
41214#define vdot_lane_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41215 float32x2_t __ret; \
41216 float32x2_t __s0 = __p0; \
41217 float16x4_t __s1 = __p1; \
41218 float16x4_t __s2 = __p2; \
41219 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_32); \
41220 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
41221 float16x4_t __rev2; __rev2 = __builtin_shufflevector(__s2, __s2, __lane_reverse_64_16); \
41222 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_lane_f32_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __builtin_bit_cast(int8x8_t, __rev2), __p3, 9)); \
41223 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32); \
41224 __ret; \
41225})
41226#endif
41227
41228#ifdef __LITTLE_ENDIAN__
41229#define vdotq_laneq_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41230 float32x4_t __ret; \
41231 float32x4_t __s0 = __p0; \
41232 float16x8_t __s1 = __p1; \
41233 float16x8_t __s2 = __p2; \
41234 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_laneq_f32_f16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __builtin_bit_cast(int8x16_t, __s2), __p3, 41)); \
41235 __ret; \
41236})
41237#else
41238#define vdotq_laneq_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41239 float32x4_t __ret; \
41240 float32x4_t __s0 = __p0; \
41241 float16x8_t __s1 = __p1; \
41242 float16x8_t __s2 = __p2; \
41243 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_32); \
41244 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
41245 float16x8_t __rev2; __rev2 = __builtin_shufflevector(__s2, __s2, __lane_reverse_128_16); \
41246 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vdotq_laneq_f32_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), __p3, 41)); \
41247 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32); \
41248 __ret; \
41249})
41250#endif
41251
41252#ifdef __LITTLE_ENDIAN__
41253#define vdot_laneq_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41254 float32x2_t __ret; \
41255 float32x2_t __s0 = __p0; \
41256 float16x4_t __s1 = __p1; \
41257 float16x8_t __s2 = __p2; \
41258 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_laneq_f32_f16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __builtin_bit_cast(int8x16_t, __s2), __p3, 9)); \
41259 __ret; \
41260})
41261#else
41262#define vdot_laneq_f32_f16(__p0, __p1, __p2, __p3) __extension__ ({ \
41263 float32x2_t __ret; \
41264 float32x2_t __s0 = __p0; \
41265 float16x4_t __s1 = __p1; \
41266 float16x8_t __s2 = __p2; \
41267 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_32); \
41268 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
41269 float16x8_t __rev2; __rev2 = __builtin_shufflevector(__s2, __s2, __lane_reverse_128_16); \
41270 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vdot_laneq_f32_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), __p3, 9)); \
41271 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32); \
41272 __ret; \
41273})
41274#endif
41275
41276#ifdef __LITTLE_ENDIAN__
41277__ai __attribute__((target("f16f32mm,neon"))) float32x4_t vmmlaq_f32_f16(float32x4_t __p0, float16x8_t __p1, float16x8_t __p2) {
41278 float32x4_t __ret;
41279 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vmmlaq_f32_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 41));
41280 return __ret;
41281}
41282#else
41283__ai __attribute__((target("f16f32mm,neon"))) float32x4_t vmmlaq_f32_f16(float32x4_t __p0, float16x8_t __p1, float16x8_t __p2) {
41284 float32x4_t __ret;
41285 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
41286 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
41287 float16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
41288 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vmmlaq_f32_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 41));
41289 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
41290 return __ret;
41291}
41292#endif
41293
41294#ifdef __LITTLE_ENDIAN__
41295__ai __attribute__((target("f16mm,neon"))) float16x8_t vmmlaq_f16(float16x8_t __p0, float16x8_t __p1, float16x8_t __p2) {
41296 float16x8_t __ret;
41297 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmmlaq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), __builtin_bit_cast(int8x16_t, __p2), 40));
41298 return __ret;
41299}
41300#else
41301__ai __attribute__((target("f16mm,neon"))) float16x8_t vmmlaq_f16(float16x8_t __p0, float16x8_t __p1, float16x8_t __p2) {
41302 float16x8_t __ret;
41303 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
41304 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
41305 float16x8_t __rev2; __rev2 = __builtin_shufflevector(__p2, __p2, __lane_reverse_128_16);
41306 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmmlaq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __builtin_bit_cast(int8x16_t, __rev2), 40));
41307 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
41308 return __ret;
41309}
41310#endif
41311
4114441312#ifdef __LITTLE_ENDIAN__
4114541313__ai __attribute__((target("f8f16mm,neon"))) float16x8_t vmmlaq_f16_mf8_fpm(float16x8_t __p0, mfloat8x16_t __p1, mfloat8x16_t __p2, fpm_t __p3) {
4114641314 float16x8_t __ret;
......@@ -42391,6 +42559,48 @@ __ai __attribute__((target("fp8fma,neon"))) float16x8_t vmlaltq_f16_mf8_fpm(floa
4239142559})
4239242560#endif
4239342561
42562#ifdef __LITTLE_ENDIAN__
42563#define vluti2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
42564 bfloat16x8_t __ret; \
42565 bfloat16x8_t __s0 = __p0; \
42566 uint8x8_t __s1 = __p1; \
42567 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_lane_bf16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
42568 __ret; \
42569})
42570#else
42571#define vluti2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
42572 bfloat16x8_t __ret; \
42573 bfloat16x8_t __s0 = __p0; \
42574 uint8x8_t __s1 = __p1; \
42575 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
42576 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
42577 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_lane_bf16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
42578 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
42579 __ret; \
42580})
42581#endif
42582
42583#ifdef __LITTLE_ENDIAN__
42584#define vluti2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
42585 bfloat16x8_t __ret; \
42586 bfloat16x4_t __s0 = __p0; \
42587 uint8x8_t __s1 = __p1; \
42588 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
42589 __ret; \
42590})
42591#else
42592#define vluti2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
42593 bfloat16x8_t __ret; \
42594 bfloat16x4_t __s0 = __p0; \
42595 uint8x8_t __s1 = __p1; \
42596 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
42597 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
42598 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_lane_bf16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
42599 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
42600 __ret; \
42601})
42602#endif
42603
4239442604#ifdef __LITTLE_ENDIAN__
4239542605#define vluti2_lane_p16(__p0, __p1, __p2) __extension__ ({ \
4239642606 poly16x8_t __ret; \
......@@ -42559,6 +42769,48 @@ __ai __attribute__((target("fp8fma,neon"))) float16x8_t vmlaltq_f16_mf8_fpm(floa
4255942769})
4256042770#endif
4256142771
42772#ifdef __LITTLE_ENDIAN__
42773#define vluti2q_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
42774 bfloat16x8_t __ret; \
42775 bfloat16x8_t __s0 = __p0; \
42776 uint8x16_t __s1 = __p1; \
42777 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
42778 __ret; \
42779})
42780#else
42781#define vluti2q_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
42782 bfloat16x8_t __ret; \
42783 bfloat16x8_t __s0 = __p0; \
42784 uint8x16_t __s1 = __p1; \
42785 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
42786 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
42787 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_laneq_bf16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
42788 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
42789 __ret; \
42790})
42791#endif
42792
42793#ifdef __LITTLE_ENDIAN__
42794#define vluti2_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
42795 bfloat16x8_t __ret; \
42796 bfloat16x4_t __s0 = __p0; \
42797 uint8x16_t __s1 = __p1; \
42798 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_laneq_bf16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
42799 __ret; \
42800})
42801#else
42802#define vluti2_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
42803 bfloat16x8_t __ret; \
42804 bfloat16x4_t __s0 = __p0; \
42805 uint8x16_t __s1 = __p1; \
42806 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
42807 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
42808 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_laneq_bf16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
42809 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
42810 __ret; \
42811})
42812#endif
42813
4256242814#ifdef __LITTLE_ENDIAN__
4256342815#define vluti2_laneq_p8(__p0, __p1, __p2) __extension__ ({ \
4256442816 poly8x16_t __ret; \
......@@ -42979,6 +43231,29 @@ __ai __attribute__((target("fp8fma,neon"))) float16x8_t vmlaltq_f16_mf8_fpm(floa
4297943231})
4298043232#endif
4298143233
43234#ifdef __LITTLE_ENDIAN__
43235#define vluti4q_lane_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43236 bfloat16x8_t __ret; \
43237 bfloat16x8x2_t __s0 = __p0; \
43238 uint8x8_t __s1 = __p1; \
43239 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_lane_bf16_x2(__builtin_bit_cast(int8x16_t, __s0.val[0]), __builtin_bit_cast(int8x16_t, __s0.val[1]), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
43240 __ret; \
43241})
43242#else
43243#define vluti4q_lane_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43244 bfloat16x8_t __ret; \
43245 bfloat16x8x2_t __s0 = __p0; \
43246 uint8x8_t __s1 = __p1; \
43247 bfloat16x8x2_t __rev0; \
43248 __rev0.val[0] = __builtin_shufflevector(__s0.val[0], __s0.val[0], __lane_reverse_128_16); \
43249 __rev0.val[1] = __builtin_shufflevector(__s0.val[1], __s0.val[1], __lane_reverse_128_16); \
43250 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
43251 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_lane_bf16_x2(__builtin_bit_cast(int8x16_t, __rev0.val[0]), __builtin_bit_cast(int8x16_t, __rev0.val[1]), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
43252 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43253 __ret; \
43254})
43255#endif
43256
4298243257#ifdef __LITTLE_ENDIAN__
4298343258#define vluti4q_lane_p16_x2(__p0, __p1, __p2) __extension__ ({ \
4298443259 poly16x8_t __ret; \
......@@ -43155,6 +43430,29 @@ __ai __attribute__((target("fp8fma,neon"))) float16x8_t vmlaltq_f16_mf8_fpm(floa
4315543430})
4315643431#endif
4315743432
43433#ifdef __LITTLE_ENDIAN__
43434#define vluti4q_laneq_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43435 bfloat16x8_t __ret; \
43436 bfloat16x8x2_t __s0 = __p0; \
43437 uint8x16_t __s1 = __p1; \
43438 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_laneq_bf16_x2(__builtin_bit_cast(int8x16_t, __s0.val[0]), __builtin_bit_cast(int8x16_t, __s0.val[1]), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
43439 __ret; \
43440})
43441#else
43442#define vluti4q_laneq_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43443 bfloat16x8_t __ret; \
43444 bfloat16x8x2_t __s0 = __p0; \
43445 uint8x16_t __s1 = __p1; \
43446 bfloat16x8x2_t __rev0; \
43447 __rev0.val[0] = __builtin_shufflevector(__s0.val[0], __s0.val[0], __lane_reverse_128_16); \
43448 __rev0.val[1] = __builtin_shufflevector(__s0.val[1], __s0.val[1], __lane_reverse_128_16); \
43449 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
43450 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_laneq_bf16_x2(__builtin_bit_cast(int8x16_t, __rev0.val[0]), __builtin_bit_cast(int8x16_t, __rev0.val[1]), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
43451 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43452 __ret; \
43453})
43454#endif
43455
4315843456#ifdef __LITTLE_ENDIAN__
4315943457#define vluti4q_laneq_p16_x2(__p0, __p1, __p2) __extension__ ({ \
4316043458 poly16x8_t __ret; \
......@@ -43247,136 +43545,6 @@ __ai __attribute__((target("fp8fma,neon"))) float16x8_t vmlaltq_f16_mf8_fpm(floa
4324743545})
4324843546#endif
4324943547
43250#ifdef __LITTLE_ENDIAN__
43251#define vluti2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
43252 bfloat16x8_t __ret; \
43253 bfloat16x8_t __s0 = __p0; \
43254 uint8x8_t __s1 = __p1; \
43255 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_lane_bf16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
43256 __ret; \
43257})
43258#else
43259#define vluti2q_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
43260 bfloat16x8_t __ret; \
43261 bfloat16x8_t __s0 = __p0; \
43262 uint8x8_t __s1 = __p1; \
43263 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
43264 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
43265 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_lane_bf16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
43266 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43267 __ret; \
43268})
43269#endif
43270
43271#ifdef __LITTLE_ENDIAN__
43272#define vluti2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
43273 bfloat16x8_t __ret; \
43274 bfloat16x4_t __s0 = __p0; \
43275 uint8x8_t __s1 = __p1; \
43276 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_lane_bf16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
43277 __ret; \
43278})
43279#else
43280#define vluti2_lane_bf16(__p0, __p1, __p2) __extension__ ({ \
43281 bfloat16x8_t __ret; \
43282 bfloat16x4_t __s0 = __p0; \
43283 uint8x8_t __s1 = __p1; \
43284 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
43285 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
43286 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_lane_bf16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
43287 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43288 __ret; \
43289})
43290#endif
43291
43292#ifdef __LITTLE_ENDIAN__
43293#define vluti2q_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
43294 bfloat16x8_t __ret; \
43295 bfloat16x8_t __s0 = __p0; \
43296 uint8x16_t __s1 = __p1; \
43297 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_laneq_bf16(__builtin_bit_cast(int8x16_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
43298 __ret; \
43299})
43300#else
43301#define vluti2q_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
43302 bfloat16x8_t __ret; \
43303 bfloat16x8_t __s0 = __p0; \
43304 uint8x16_t __s1 = __p1; \
43305 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
43306 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
43307 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2q_laneq_bf16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
43308 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43309 __ret; \
43310})
43311#endif
43312
43313#ifdef __LITTLE_ENDIAN__
43314#define vluti2_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
43315 bfloat16x8_t __ret; \
43316 bfloat16x4_t __s0 = __p0; \
43317 uint8x16_t __s1 = __p1; \
43318 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_laneq_bf16(__builtin_bit_cast(int8x8_t, __s0), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
43319 __ret; \
43320})
43321#else
43322#define vluti2_laneq_bf16(__p0, __p1, __p2) __extension__ ({ \
43323 bfloat16x8_t __ret; \
43324 bfloat16x4_t __s0 = __p0; \
43325 uint8x16_t __s1 = __p1; \
43326 bfloat16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
43327 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
43328 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti2_laneq_bf16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
43329 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43330 __ret; \
43331})
43332#endif
43333
43334#ifdef __LITTLE_ENDIAN__
43335#define vluti4q_lane_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43336 bfloat16x8_t __ret; \
43337 bfloat16x8x2_t __s0 = __p0; \
43338 uint8x8_t __s1 = __p1; \
43339 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_lane_bf16_x2(__builtin_bit_cast(int8x16_t, __s0.val[0]), __builtin_bit_cast(int8x16_t, __s0.val[1]), __builtin_bit_cast(int8x8_t, __s1), __p2, 43)); \
43340 __ret; \
43341})
43342#else
43343#define vluti4q_lane_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43344 bfloat16x8_t __ret; \
43345 bfloat16x8x2_t __s0 = __p0; \
43346 uint8x8_t __s1 = __p1; \
43347 bfloat16x8x2_t __rev0; \
43348 __rev0.val[0] = __builtin_shufflevector(__s0.val[0], __s0.val[0], __lane_reverse_128_16); \
43349 __rev0.val[1] = __builtin_shufflevector(__s0.val[1], __s0.val[1], __lane_reverse_128_16); \
43350 uint8x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_8); \
43351 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_lane_bf16_x2(__builtin_bit_cast(int8x16_t, __rev0.val[0]), __builtin_bit_cast(int8x16_t, __rev0.val[1]), __builtin_bit_cast(int8x8_t, __rev1), __p2, 43)); \
43352 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43353 __ret; \
43354})
43355#endif
43356
43357#ifdef __LITTLE_ENDIAN__
43358#define vluti4q_laneq_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43359 bfloat16x8_t __ret; \
43360 bfloat16x8x2_t __s0 = __p0; \
43361 uint8x16_t __s1 = __p1; \
43362 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_laneq_bf16_x2(__builtin_bit_cast(int8x16_t, __s0.val[0]), __builtin_bit_cast(int8x16_t, __s0.val[1]), __builtin_bit_cast(int8x16_t, __s1), __p2, 43)); \
43363 __ret; \
43364})
43365#else
43366#define vluti4q_laneq_bf16_x2(__p0, __p1, __p2) __extension__ ({ \
43367 bfloat16x8_t __ret; \
43368 bfloat16x8x2_t __s0 = __p0; \
43369 uint8x16_t __s1 = __p1; \
43370 bfloat16x8x2_t __rev0; \
43371 __rev0.val[0] = __builtin_shufflevector(__s0.val[0], __s0.val[0], __lane_reverse_128_16); \
43372 __rev0.val[1] = __builtin_shufflevector(__s0.val[1], __s0.val[1], __lane_reverse_128_16); \
43373 uint8x16_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_8); \
43374 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vluti4q_laneq_bf16_x2(__builtin_bit_cast(int8x16_t, __rev0.val[0]), __builtin_bit_cast(int8x16_t, __rev0.val[1]), __builtin_bit_cast(int8x16_t, __rev1), __p2, 43)); \
43375 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
43376 __ret; \
43377})
43378#endif
43379
4338043548#ifdef __LITTLE_ENDIAN__
4338143549#define splatq_lane_mf8(__p0, __p1) __extension__ ({ \
4338243550 mfloat8x16_t __ret; \
......@@ -44171,698 +44339,324 @@ __ai __attribute__((target("neon"))) mfloat8x8x2_t vzip_mf8(mfloat8x8_t __p0, mf
4417144339#endif
4417244340
4417344341#ifdef __LITTLE_ENDIAN__
44174__ai __attribute__((target("neon,faminmax"))) float64x2_t vamaxq_f64(float64x2_t __p0, float64x2_t __p1) {
44175 float64x2_t __ret;
44176 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vamaxq_f64(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 42));
44177 return __ret;
44178}
44179#else
44180__ai __attribute__((target("neon,faminmax"))) float64x2_t vamaxq_f64(float64x2_t __p0, float64x2_t __p1) {
44181 float64x2_t __ret;
44182 float64x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_64);
44183 float64x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_64);
44184 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vamaxq_f64(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 42));
44185 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_64);
44186 return __ret;
44187}
44188#endif
44189
44190#ifdef __LITTLE_ENDIAN__
44191__ai __attribute__((target("neon,faminmax"))) float32x4_t vamaxq_f32(float32x4_t __p0, float32x4_t __p1) {
44192 float32x4_t __ret;
44193 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vamaxq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 41));
44194 return __ret;
44195}
44196#else
44197__ai __attribute__((target("neon,faminmax"))) float32x4_t vamaxq_f32(float32x4_t __p0, float32x4_t __p1) {
44198 float32x4_t __ret;
44199 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44200 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44201 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vamaxq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 41));
44202 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
44203 return __ret;
44204}
44205#endif
44206
44207#ifdef __LITTLE_ENDIAN__
44208__ai __attribute__((target("neon,faminmax"))) float16x8_t vamaxq_f16(float16x8_t __p0, float16x8_t __p1) {
44209 float16x8_t __ret;
44210 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vamaxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
44211 return __ret;
44212}
44213#else
44214__ai __attribute__((target("neon,faminmax"))) float16x8_t vamaxq_f16(float16x8_t __p0, float16x8_t __p1) {
44215 float16x8_t __ret;
44216 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44217 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
44218 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vamaxq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
44219 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
44220 return __ret;
44221}
44222#endif
44223
44224#ifdef __LITTLE_ENDIAN__
44225__ai __attribute__((target("neon,faminmax"))) float32x2_t vamax_f32(float32x2_t __p0, float32x2_t __p1) {
44226 float32x2_t __ret;
44227 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamax_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 9));
44228 return __ret;
44229}
44230#else
44231__ai __attribute__((target("neon,faminmax"))) float32x2_t vamax_f32(float32x2_t __p0, float32x2_t __p1) {
44232 float32x2_t __ret;
44233 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
44234 float32x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_32);
44235 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamax_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 9));
44236 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
44237 return __ret;
44238}
44239#endif
44240
44241#ifdef __LITTLE_ENDIAN__
44242__ai __attribute__((target("neon,faminmax"))) float16x4_t vamax_f16(float16x4_t __p0, float16x4_t __p1) {
44243 float16x4_t __ret;
44244 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamax_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
44245 return __ret;
44246}
44247#else
44248__ai __attribute__((target("neon,faminmax"))) float16x4_t vamax_f16(float16x4_t __p0, float16x4_t __p1) {
44249 float16x4_t __ret;
44250 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
44251 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
44252 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamax_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
44253 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
44254 return __ret;
44255}
44256#endif
44257
44258#ifdef __LITTLE_ENDIAN__
44259__ai __attribute__((target("neon,faminmax"))) float64x2_t vaminq_f64(float64x2_t __p0, float64x2_t __p1) {
44260 float64x2_t __ret;
44261 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vaminq_f64(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 42));
44262 return __ret;
44263}
44264#else
44265__ai __attribute__((target("neon,faminmax"))) float64x2_t vaminq_f64(float64x2_t __p0, float64x2_t __p1) {
44266 float64x2_t __ret;
44267 float64x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_64);
44268 float64x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_64);
44269 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vaminq_f64(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 42));
44270 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_64);
44271 return __ret;
44272}
44273#endif
44274
44275#ifdef __LITTLE_ENDIAN__
44276__ai __attribute__((target("neon,faminmax"))) float32x4_t vaminq_f32(float32x4_t __p0, float32x4_t __p1) {
44277 float32x4_t __ret;
44278 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vaminq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 41));
44279 return __ret;
44280}
44281#else
44282__ai __attribute__((target("neon,faminmax"))) float32x4_t vaminq_f32(float32x4_t __p0, float32x4_t __p1) {
44283 float32x4_t __ret;
44284 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44285 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44286 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vaminq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 41));
44287 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
44288 return __ret;
44289}
44290#endif
44291
44292#ifdef __LITTLE_ENDIAN__
44293__ai __attribute__((target("neon,faminmax"))) float16x8_t vaminq_f16(float16x8_t __p0, float16x8_t __p1) {
44294 float16x8_t __ret;
44295 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vaminq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
44296 return __ret;
44297}
44298#else
44299__ai __attribute__((target("neon,faminmax"))) float16x8_t vaminq_f16(float16x8_t __p0, float16x8_t __p1) {
44300 float16x8_t __ret;
44301 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44302 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
44303 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vaminq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
44304 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
44305 return __ret;
44306}
44307#endif
44308
44309#ifdef __LITTLE_ENDIAN__
44310__ai __attribute__((target("neon,faminmax"))) float32x2_t vamin_f32(float32x2_t __p0, float32x2_t __p1) {
44311 float32x2_t __ret;
44312 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamin_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 9));
44313 return __ret;
44314}
44315#else
44316__ai __attribute__((target("neon,faminmax"))) float32x2_t vamin_f32(float32x2_t __p0, float32x2_t __p1) {
44317 float32x2_t __ret;
44318 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
44319 float32x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_32);
44320 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamin_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 9));
44321 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
44322 return __ret;
44323}
44324#endif
44325
44326#ifdef __LITTLE_ENDIAN__
44327__ai __attribute__((target("neon,faminmax"))) float16x4_t vamin_f16(float16x4_t __p0, float16x4_t __p1) {
44328 float16x4_t __ret;
44329 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamin_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
44330 return __ret;
44331}
44332#else
44333__ai __attribute__((target("neon,faminmax"))) float16x4_t vamin_f16(float16x4_t __p0, float16x4_t __p1) {
44334 float16x4_t __ret;
44335 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
44336 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
44337 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamin_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
44338 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
44339 return __ret;
44340}
44341#endif
44342
44343#endif
44344#if defined(__aarch64__) || defined(__arm64ec__)
44345__ai __attribute__((target("aes,neon"))) poly128_t vmull_p64(poly64_t __p0, poly64_t __p1) {
44346 poly128_t __ret;
44347 __ret = __builtin_bit_cast(poly128_t, __builtin_neon_vmull_p64(__p0, __p1));
44348 return __ret;
44349}
44350#ifdef __LITTLE_ENDIAN__
44351#define vcopyq_lane_bf16(__p0_234, __p1_234, __p2_234, __p3_234) __extension__ ({ \
44352 bfloat16x8_t __ret_234; \
44353 bfloat16x8_t __s0_234 = __p0_234; \
44354 bfloat16x4_t __s2_234 = __p2_234; \
44355 __ret_234 = vsetq_lane_bf16(vget_lane_bf16(__s2_234, __p3_234), __s0_234, __p1_234); \
44356 __ret_234; \
44357})
44358#else
44359#define vcopyq_lane_bf16(__p0_235, __p1_235, __p2_235, __p3_235) __extension__ ({ \
44360 bfloat16x8_t __ret_235; \
44361 bfloat16x8_t __s0_235 = __p0_235; \
44362 bfloat16x4_t __s2_235 = __p2_235; \
44363 bfloat16x8_t __rev0_235; __rev0_235 = __builtin_shufflevector(__s0_235, __s0_235, __lane_reverse_128_16); \
44364 bfloat16x4_t __rev2_235; __rev2_235 = __builtin_shufflevector(__s2_235, __s2_235, __lane_reverse_64_16); \
44365 __ret_235 = __noswap_vsetq_lane_bf16(__noswap_vget_lane_bf16(__rev2_235, __p3_235), __rev0_235, __p1_235); \
44366 __ret_235 = __builtin_shufflevector(__ret_235, __ret_235, __lane_reverse_128_16); \
44367 __ret_235; \
44368})
44369#endif
44370
44371#ifdef __LITTLE_ENDIAN__
44372#define vcopy_lane_bf16(__p0_236, __p1_236, __p2_236, __p3_236) __extension__ ({ \
44373 bfloat16x4_t __ret_236; \
44374 bfloat16x4_t __s0_236 = __p0_236; \
44375 bfloat16x4_t __s2_236 = __p2_236; \
44376 __ret_236 = vset_lane_bf16(vget_lane_bf16(__s2_236, __p3_236), __s0_236, __p1_236); \
44377 __ret_236; \
44378})
44379#else
44380#define vcopy_lane_bf16(__p0_237, __p1_237, __p2_237, __p3_237) __extension__ ({ \
44381 bfloat16x4_t __ret_237; \
44382 bfloat16x4_t __s0_237 = __p0_237; \
44383 bfloat16x4_t __s2_237 = __p2_237; \
44384 bfloat16x4_t __rev0_237; __rev0_237 = __builtin_shufflevector(__s0_237, __s0_237, __lane_reverse_64_16); \
44385 bfloat16x4_t __rev2_237; __rev2_237 = __builtin_shufflevector(__s2_237, __s2_237, __lane_reverse_64_16); \
44386 __ret_237 = __noswap_vset_lane_bf16(__noswap_vget_lane_bf16(__rev2_237, __p3_237), __rev0_237, __p1_237); \
44387 __ret_237 = __builtin_shufflevector(__ret_237, __ret_237, __lane_reverse_64_16); \
44388 __ret_237; \
44389})
44390#endif
44391
44392#ifdef __LITTLE_ENDIAN__
44393#define vcopyq_laneq_bf16(__p0_238, __p1_238, __p2_238, __p3_238) __extension__ ({ \
44394 bfloat16x8_t __ret_238; \
44395 bfloat16x8_t __s0_238 = __p0_238; \
44396 bfloat16x8_t __s2_238 = __p2_238; \
44397 __ret_238 = vsetq_lane_bf16(vgetq_lane_bf16(__s2_238, __p3_238), __s0_238, __p1_238); \
44398 __ret_238; \
44399})
44400#else
44401#define vcopyq_laneq_bf16(__p0_239, __p1_239, __p2_239, __p3_239) __extension__ ({ \
44402 bfloat16x8_t __ret_239; \
44403 bfloat16x8_t __s0_239 = __p0_239; \
44404 bfloat16x8_t __s2_239 = __p2_239; \
44405 bfloat16x8_t __rev0_239; __rev0_239 = __builtin_shufflevector(__s0_239, __s0_239, __lane_reverse_128_16); \
44406 bfloat16x8_t __rev2_239; __rev2_239 = __builtin_shufflevector(__s2_239, __s2_239, __lane_reverse_128_16); \
44407 __ret_239 = __noswap_vsetq_lane_bf16(__noswap_vgetq_lane_bf16(__rev2_239, __p3_239), __rev0_239, __p1_239); \
44408 __ret_239 = __builtin_shufflevector(__ret_239, __ret_239, __lane_reverse_128_16); \
44409 __ret_239; \
44410})
44411#endif
44412
44413#ifdef __LITTLE_ENDIAN__
44414#define vcopy_laneq_bf16(__p0_240, __p1_240, __p2_240, __p3_240) __extension__ ({ \
44415 bfloat16x4_t __ret_240; \
44416 bfloat16x4_t __s0_240 = __p0_240; \
44417 bfloat16x8_t __s2_240 = __p2_240; \
44418 __ret_240 = vset_lane_bf16(vgetq_lane_bf16(__s2_240, __p3_240), __s0_240, __p1_240); \
44419 __ret_240; \
44420})
44421#else
44422#define vcopy_laneq_bf16(__p0_241, __p1_241, __p2_241, __p3_241) __extension__ ({ \
44423 bfloat16x4_t __ret_241; \
44424 bfloat16x4_t __s0_241 = __p0_241; \
44425 bfloat16x8_t __s2_241 = __p2_241; \
44426 bfloat16x4_t __rev0_241; __rev0_241 = __builtin_shufflevector(__s0_241, __s0_241, __lane_reverse_64_16); \
44427 bfloat16x8_t __rev2_241; __rev2_241 = __builtin_shufflevector(__s2_241, __s2_241, __lane_reverse_128_16); \
44428 __ret_241 = __noswap_vset_lane_bf16(__noswap_vgetq_lane_bf16(__rev2_241, __p3_241), __rev0_241, __p1_241); \
44429 __ret_241 = __builtin_shufflevector(__ret_241, __ret_241, __lane_reverse_64_16); \
44430 __ret_241; \
44431})
44432#endif
44433
44434#ifdef __LITTLE_ENDIAN__
44435__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vcvt_bf16_f32(float32x4_t __p0) {
44436 bfloat16x4_t __ret;
44437 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vcvt_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), 11));
44438 return __ret;
44439}
44440#else
44441__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vcvt_bf16_f32(float32x4_t __p0) {
44442 bfloat16x4_t __ret;
44443 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44444 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vcvt_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), 11));
44445 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
44446 return __ret;
44447}
44448#endif
44449
44450#ifdef __LITTLE_ENDIAN__
44451__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_high_bf16_f32(bfloat16x8_t __p0, float32x4_t __p1) {
44452 bfloat16x8_t __ret;
44453 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_high_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 43));
44454 return __ret;
44455}
44456#else
44457__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_high_bf16_f32(bfloat16x8_t __p0, float32x4_t __p1) {
44458 bfloat16x8_t __ret;
44459 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44460 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44461 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_high_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 43));
44462 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
44463 return __ret;
44464}
44465#endif
44466
44467#ifdef __LITTLE_ENDIAN__
44468__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_low_bf16_f32(float32x4_t __p0) {
44469 bfloat16x8_t __ret;
44470 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_low_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), 43));
44471 return __ret;
44472}
44473#else
44474__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_low_bf16_f32(float32x4_t __p0) {
44475 bfloat16x8_t __ret;
44476 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44477 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_low_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), 43));
44478 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
44479 return __ret;
44480}
44481#endif
44482
44483__ai __attribute__((target("bf16,neon"))) poly8x8_t vreinterpret_p8_bf16(bfloat16x4_t __p0) {
44484 poly8x8_t __ret;
44485 __ret = __builtin_bit_cast(poly8x8_t, __p0);
44486 return __ret;
44487}
44488__ai __attribute__((target("bf16,neon"))) poly64x1_t vreinterpret_p64_bf16(bfloat16x4_t __p0) {
44489 poly64x1_t __ret;
44490 __ret = __builtin_bit_cast(poly64x1_t, __p0);
44491 return __ret;
44492}
44493__ai __attribute__((target("bf16,neon"))) poly16x4_t vreinterpret_p16_bf16(bfloat16x4_t __p0) {
44494 poly16x4_t __ret;
44495 __ret = __builtin_bit_cast(poly16x4_t, __p0);
44496 return __ret;
44497}
44498__ai __attribute__((target("bf16,neon"))) poly8x16_t vreinterpretq_p8_bf16(bfloat16x8_t __p0) {
44499 poly8x16_t __ret;
44500 __ret = __builtin_bit_cast(poly8x16_t, __p0);
44501 return __ret;
44502}
44503__ai __attribute__((target("bf16,neon"))) poly128_t vreinterpretq_p128_bf16(bfloat16x8_t __p0) {
44504 poly128_t __ret;
44505 __ret = __builtin_bit_cast(poly128_t, __p0);
44506 return __ret;
44507}
44508__ai __attribute__((target("bf16,neon"))) poly64x2_t vreinterpretq_p64_bf16(bfloat16x8_t __p0) {
44509 poly64x2_t __ret;
44510 __ret = __builtin_bit_cast(poly64x2_t, __p0);
44511 return __ret;
44512}
44513__ai __attribute__((target("bf16,neon"))) poly16x8_t vreinterpretq_p16_bf16(bfloat16x8_t __p0) {
44514 poly16x8_t __ret;
44515 __ret = __builtin_bit_cast(poly16x8_t, __p0);
44516 return __ret;
44517}
44518__ai __attribute__((target("bf16,neon"))) uint8x16_t vreinterpretq_u8_bf16(bfloat16x8_t __p0) {
44519 uint8x16_t __ret;
44520 __ret = __builtin_bit_cast(uint8x16_t, __p0);
44521 return __ret;
44522}
44523__ai __attribute__((target("bf16,neon"))) uint32x4_t vreinterpretq_u32_bf16(bfloat16x8_t __p0) {
44524 uint32x4_t __ret;
44525 __ret = __builtin_bit_cast(uint32x4_t, __p0);
44526 return __ret;
44527}
44528__ai __attribute__((target("bf16,neon"))) uint64x2_t vreinterpretq_u64_bf16(bfloat16x8_t __p0) {
44529 uint64x2_t __ret;
44530 __ret = __builtin_bit_cast(uint64x2_t, __p0);
44531 return __ret;
44532}
44533__ai __attribute__((target("bf16,neon"))) uint16x8_t vreinterpretq_u16_bf16(bfloat16x8_t __p0) {
44534 uint16x8_t __ret;
44535 __ret = __builtin_bit_cast(uint16x8_t, __p0);
44536 return __ret;
44537}
44538__ai __attribute__((target("bf16,neon"))) int8x16_t vreinterpretq_s8_bf16(bfloat16x8_t __p0) {
44539 int8x16_t __ret;
44540 __ret = __builtin_bit_cast(int8x16_t, __p0);
44541 return __ret;
44542}
44543__ai __attribute__((target("bf16,neon"))) float64x2_t vreinterpretq_f64_bf16(bfloat16x8_t __p0) {
44544 float64x2_t __ret;
44545 __ret = __builtin_bit_cast(float64x2_t, __p0);
44546 return __ret;
44547}
44548__ai __attribute__((target("bf16,neon"))) float32x4_t vreinterpretq_f32_bf16(bfloat16x8_t __p0) {
44549 float32x4_t __ret;
44550 __ret = __builtin_bit_cast(float32x4_t, __p0);
44551 return __ret;
44552}
44553__ai __attribute__((target("bf16,neon"))) float16x8_t vreinterpretq_f16_bf16(bfloat16x8_t __p0) {
44554 float16x8_t __ret;
44555 __ret = __builtin_bit_cast(float16x8_t, __p0);
44556 return __ret;
44557}
44558__ai __attribute__((target("bf16,neon"))) int32x4_t vreinterpretq_s32_bf16(bfloat16x8_t __p0) {
44559 int32x4_t __ret;
44560 __ret = __builtin_bit_cast(int32x4_t, __p0);
44561 return __ret;
44562}
44563__ai __attribute__((target("bf16,neon"))) int64x2_t vreinterpretq_s64_bf16(bfloat16x8_t __p0) {
44564 int64x2_t __ret;
44565 __ret = __builtin_bit_cast(int64x2_t, __p0);
44566 return __ret;
44567}
44568__ai __attribute__((target("bf16,neon"))) int16x8_t vreinterpretq_s16_bf16(bfloat16x8_t __p0) {
44569 int16x8_t __ret;
44570 __ret = __builtin_bit_cast(int16x8_t, __p0);
44571 return __ret;
44572}
44573__ai __attribute__((target("bf16,neon"))) uint8x8_t vreinterpret_u8_bf16(bfloat16x4_t __p0) {
44574 uint8x8_t __ret;
44575 __ret = __builtin_bit_cast(uint8x8_t, __p0);
44576 return __ret;
44577}
44578__ai __attribute__((target("bf16,neon"))) uint32x2_t vreinterpret_u32_bf16(bfloat16x4_t __p0) {
44579 uint32x2_t __ret;
44580 __ret = __builtin_bit_cast(uint32x2_t, __p0);
44581 return __ret;
44582}
44583__ai __attribute__((target("bf16,neon"))) uint64x1_t vreinterpret_u64_bf16(bfloat16x4_t __p0) {
44584 uint64x1_t __ret;
44585 __ret = __builtin_bit_cast(uint64x1_t, __p0);
44586 return __ret;
44587}
44588__ai __attribute__((target("bf16,neon"))) uint16x4_t vreinterpret_u16_bf16(bfloat16x4_t __p0) {
44589 uint16x4_t __ret;
44590 __ret = __builtin_bit_cast(uint16x4_t, __p0);
44591 return __ret;
44592}
44593__ai __attribute__((target("bf16,neon"))) int8x8_t vreinterpret_s8_bf16(bfloat16x4_t __p0) {
44594 int8x8_t __ret;
44595 __ret = __builtin_bit_cast(int8x8_t, __p0);
44596 return __ret;
44597}
44598__ai __attribute__((target("bf16,neon"))) float64x1_t vreinterpret_f64_bf16(bfloat16x4_t __p0) {
44599 float64x1_t __ret;
44600 __ret = __builtin_bit_cast(float64x1_t, __p0);
44601 return __ret;
44602}
44603__ai __attribute__((target("bf16,neon"))) float32x2_t vreinterpret_f32_bf16(bfloat16x4_t __p0) {
44604 float32x2_t __ret;
44605 __ret = __builtin_bit_cast(float32x2_t, __p0);
44606 return __ret;
44607}
44608__ai __attribute__((target("bf16,neon"))) float16x4_t vreinterpret_f16_bf16(bfloat16x4_t __p0) {
44609 float16x4_t __ret;
44610 __ret = __builtin_bit_cast(float16x4_t, __p0);
44611 return __ret;
44612}
44613__ai __attribute__((target("bf16,neon"))) int32x2_t vreinterpret_s32_bf16(bfloat16x4_t __p0) {
44614 int32x2_t __ret;
44615 __ret = __builtin_bit_cast(int32x2_t, __p0);
44616 return __ret;
44617}
44618__ai __attribute__((target("bf16,neon"))) int64x1_t vreinterpret_s64_bf16(bfloat16x4_t __p0) {
44619 int64x1_t __ret;
44620 __ret = __builtin_bit_cast(int64x1_t, __p0);
44621 return __ret;
44622}
44623__ai __attribute__((target("bf16,neon"))) int16x4_t vreinterpret_s16_bf16(bfloat16x4_t __p0) {
44624 int16x4_t __ret;
44625 __ret = __builtin_bit_cast(int16x4_t, __p0);
44626 return __ret;
44627}
44628__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p8(poly8x16_t __p0) {
44629 bfloat16x8_t __ret;
44630 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44631 return __ret;
44632}
44633__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p128(poly128_t __p0) {
44634 bfloat16x8_t __ret;
44635 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44636 return __ret;
44637}
44638__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p64(poly64x2_t __p0) {
44639 bfloat16x8_t __ret;
44640 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44342__ai __attribute__((target("neon,faminmax"))) float64x2_t vamaxq_f64(float64x2_t __p0, float64x2_t __p1) {
44343 float64x2_t __ret;
44344 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vamaxq_f64(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 42));
4464144345 return __ret;
4464244346}
44643__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_p16(poly16x8_t __p0) {
44644 bfloat16x8_t __ret;
44645 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44347#else
44348__ai __attribute__((target("neon,faminmax"))) float64x2_t vamaxq_f64(float64x2_t __p0, float64x2_t __p1) {
44349 float64x2_t __ret;
44350 float64x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_64);
44351 float64x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_64);
44352 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vamaxq_f64(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 42));
44353 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_64);
4464644354 return __ret;
4464744355}
44648__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u8(uint8x16_t __p0) {
44649 bfloat16x8_t __ret;
44650 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44356#endif
44357
44358#ifdef __LITTLE_ENDIAN__
44359__ai __attribute__((target("neon,faminmax"))) float32x4_t vamaxq_f32(float32x4_t __p0, float32x4_t __p1) {
44360 float32x4_t __ret;
44361 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vamaxq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 41));
4465144362 return __ret;
4465244363}
44653__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u32(uint32x4_t __p0) {
44654 bfloat16x8_t __ret;
44655 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44364#else
44365__ai __attribute__((target("neon,faminmax"))) float32x4_t vamaxq_f32(float32x4_t __p0, float32x4_t __p1) {
44366 float32x4_t __ret;
44367 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44368 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44369 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vamaxq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 41));
44370 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
4465644371 return __ret;
4465744372}
44658__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u64(uint64x2_t __p0) {
44659 bfloat16x8_t __ret;
44660 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44373#endif
44374
44375#ifdef __LITTLE_ENDIAN__
44376__ai __attribute__((target("neon,faminmax"))) float16x8_t vamaxq_f16(float16x8_t __p0, float16x8_t __p1) {
44377 float16x8_t __ret;
44378 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vamaxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
4466144379 return __ret;
4466244380}
44663__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_u16(uint16x8_t __p0) {
44664 bfloat16x8_t __ret;
44665 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44381#else
44382__ai __attribute__((target("neon,faminmax"))) float16x8_t vamaxq_f16(float16x8_t __p0, float16x8_t __p1) {
44383 float16x8_t __ret;
44384 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44385 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
44386 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vamaxq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
44387 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
4466644388 return __ret;
4466744389}
44668__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s8(int8x16_t __p0) {
44669 bfloat16x8_t __ret;
44670 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44390#endif
44391
44392#ifdef __LITTLE_ENDIAN__
44393__ai __attribute__((target("neon,faminmax"))) float32x2_t vamax_f32(float32x2_t __p0, float32x2_t __p1) {
44394 float32x2_t __ret;
44395 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamax_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 9));
4467144396 return __ret;
4467244397}
44673__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_f64(float64x2_t __p0) {
44674 bfloat16x8_t __ret;
44675 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44398#else
44399__ai __attribute__((target("neon,faminmax"))) float32x2_t vamax_f32(float32x2_t __p0, float32x2_t __p1) {
44400 float32x2_t __ret;
44401 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
44402 float32x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_32);
44403 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamax_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 9));
44404 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
4467644405 return __ret;
4467744406}
44678__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_f32(float32x4_t __p0) {
44679 bfloat16x8_t __ret;
44680 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44407#endif
44408
44409#ifdef __LITTLE_ENDIAN__
44410__ai __attribute__((target("neon,faminmax"))) float16x4_t vamax_f16(float16x4_t __p0, float16x4_t __p1) {
44411 float16x4_t __ret;
44412 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamax_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
4468144413 return __ret;
4468244414}
44683__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_f16(float16x8_t __p0) {
44684 bfloat16x8_t __ret;
44685 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44415#else
44416__ai __attribute__((target("neon,faminmax"))) float16x4_t vamax_f16(float16x4_t __p0, float16x4_t __p1) {
44417 float16x4_t __ret;
44418 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
44419 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
44420 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamax_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
44421 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
4468644422 return __ret;
4468744423}
44688__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s32(int32x4_t __p0) {
44689 bfloat16x8_t __ret;
44690 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44424#endif
44425
44426#ifdef __LITTLE_ENDIAN__
44427__ai __attribute__((target("neon,faminmax"))) float64x2_t vaminq_f64(float64x2_t __p0, float64x2_t __p1) {
44428 float64x2_t __ret;
44429 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vaminq_f64(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 42));
4469144430 return __ret;
4469244431}
44693__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s64(int64x2_t __p0) {
44694 bfloat16x8_t __ret;
44695 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44432#else
44433__ai __attribute__((target("neon,faminmax"))) float64x2_t vaminq_f64(float64x2_t __p0, float64x2_t __p1) {
44434 float64x2_t __ret;
44435 float64x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_64);
44436 float64x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_64);
44437 __ret = __builtin_bit_cast(float64x2_t, __builtin_neon_vaminq_f64(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 42));
44438 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_64);
4469644439 return __ret;
4469744440}
44698__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vreinterpretq_bf16_s16(int16x8_t __p0) {
44699 bfloat16x8_t __ret;
44700 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
44441#endif
44442
44443#ifdef __LITTLE_ENDIAN__
44444__ai __attribute__((target("neon,faminmax"))) float32x4_t vaminq_f32(float32x4_t __p0, float32x4_t __p1) {
44445 float32x4_t __ret;
44446 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vaminq_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 41));
4470144447 return __ret;
4470244448}
44703__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p8(poly8x8_t __p0) {
44704 bfloat16x4_t __ret;
44705 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44449#else
44450__ai __attribute__((target("neon,faminmax"))) float32x4_t vaminq_f32(float32x4_t __p0, float32x4_t __p1) {
44451 float32x4_t __ret;
44452 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44453 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44454 __ret = __builtin_bit_cast(float32x4_t, __builtin_neon_vaminq_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 41));
44455 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_32);
4470644456 return __ret;
4470744457}
44708__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p64(poly64x1_t __p0) {
44709 bfloat16x4_t __ret;
44710 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44458#endif
44459
44460#ifdef __LITTLE_ENDIAN__
44461__ai __attribute__((target("neon,faminmax"))) float16x8_t vaminq_f16(float16x8_t __p0, float16x8_t __p1) {
44462 float16x8_t __ret;
44463 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vaminq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
4471144464 return __ret;
4471244465}
44713__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_p16(poly16x4_t __p0) {
44714 bfloat16x4_t __ret;
44715 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44466#else
44467__ai __attribute__((target("neon,faminmax"))) float16x8_t vaminq_f16(float16x8_t __p0, float16x8_t __p1) {
44468 float16x8_t __ret;
44469 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44470 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
44471 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vaminq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
44472 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
4471644473 return __ret;
4471744474}
44718__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u8(uint8x8_t __p0) {
44719 bfloat16x4_t __ret;
44720 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44475#endif
44476
44477#ifdef __LITTLE_ENDIAN__
44478__ai __attribute__((target("neon,faminmax"))) float32x2_t vamin_f32(float32x2_t __p0, float32x2_t __p1) {
44479 float32x2_t __ret;
44480 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamin_f32(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 9));
4472144481 return __ret;
4472244482}
44723__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u32(uint32x2_t __p0) {
44724 bfloat16x4_t __ret;
44725 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44483#else
44484__ai __attribute__((target("neon,faminmax"))) float32x2_t vamin_f32(float32x2_t __p0, float32x2_t __p1) {
44485 float32x2_t __ret;
44486 float32x2_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_32);
44487 float32x2_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_32);
44488 __ret = __builtin_bit_cast(float32x2_t, __builtin_neon_vamin_f32(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 9));
44489 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_32);
4472644490 return __ret;
4472744491}
44728__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u64(uint64x1_t __p0) {
44729 bfloat16x4_t __ret;
44730 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44492#endif
44493
44494#ifdef __LITTLE_ENDIAN__
44495__ai __attribute__((target("neon,faminmax"))) float16x4_t vamin_f16(float16x4_t __p0, float16x4_t __p1) {
44496 float16x4_t __ret;
44497 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamin_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
4473144498 return __ret;
4473244499}
44733__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_u16(uint16x4_t __p0) {
44734 bfloat16x4_t __ret;
44735 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44500#else
44501__ai __attribute__((target("neon,faminmax"))) float16x4_t vamin_f16(float16x4_t __p0, float16x4_t __p1) {
44502 float16x4_t __ret;
44503 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
44504 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
44505 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vamin_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
44506 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
4473644507 return __ret;
4473744508}
44738__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s8(int8x8_t __p0) {
44739 bfloat16x4_t __ret;
44740 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44509#endif
44510
44511#endif
44512#if defined(__aarch64__) || defined(__arm64ec__)
44513__ai __attribute__((target("aes,neon"))) poly128_t vmull_p64(poly64_t __p0, poly64_t __p1) {
44514 poly128_t __ret;
44515 __ret = __builtin_bit_cast(poly128_t, __builtin_neon_vmull_p64(__p0, __p1));
4474144516 return __ret;
4474244517}
44743__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_f64(float64x1_t __p0) {
44518#ifdef __LITTLE_ENDIAN__
44519__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vcvt_bf16_f32(float32x4_t __p0) {
4474444520 bfloat16x4_t __ret;
44745 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44521 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vcvt_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), 11));
4474644522 return __ret;
4474744523}
44748__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_f32(float32x2_t __p0) {
44524#else
44525__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vcvt_bf16_f32(float32x4_t __p0) {
4474944526 bfloat16x4_t __ret;
44750 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44527 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44528 __ret = __builtin_bit_cast(bfloat16x4_t, __builtin_neon_vcvt_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), 11));
44529 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
4475144530 return __ret;
4475244531}
44753__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_f16(float16x4_t __p0) {
44754 bfloat16x4_t __ret;
44755 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44532#endif
44533
44534#ifdef __LITTLE_ENDIAN__
44535__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_high_bf16_f32(bfloat16x8_t __p0, float32x4_t __p1) {
44536 bfloat16x8_t __ret;
44537 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_high_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 43));
4475644538 return __ret;
4475744539}
44758__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s32(int32x2_t __p0) {
44759 bfloat16x4_t __ret;
44760 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44540#else
44541__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_high_bf16_f32(bfloat16x8_t __p0, float32x4_t __p1) {
44542 bfloat16x8_t __ret;
44543 bfloat16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
44544 float32x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_32);
44545 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_high_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 43));
44546 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
4476144547 return __ret;
4476244548}
44763__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s64(int64x1_t __p0) {
44764 bfloat16x4_t __ret;
44765 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44549#endif
44550
44551#ifdef __LITTLE_ENDIAN__
44552__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_low_bf16_f32(float32x4_t __p0) {
44553 bfloat16x8_t __ret;
44554 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_low_bf16_f32(__builtin_bit_cast(int8x16_t, __p0), 43));
4476644555 return __ret;
4476744556}
44768__ai __attribute__((target("bf16,neon"))) bfloat16x4_t vreinterpret_bf16_s16(int16x4_t __p0) {
44769 bfloat16x4_t __ret;
44770 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
44557#else
44558__ai __attribute__((target("bf16,neon"))) bfloat16x8_t vcvtq_low_bf16_f32(float32x4_t __p0) {
44559 bfloat16x8_t __ret;
44560 float32x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_32);
44561 __ret = __builtin_bit_cast(bfloat16x8_t, __builtin_neon_vcvtq_low_bf16_f32(__builtin_bit_cast(int8x16_t, __rev0), 43));
44562 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
4477144563 return __ret;
4477244564}
44565#endif
44566
4477344567#ifdef __LITTLE_ENDIAN__
44774#define vdotq_laneq_u32(__p0_242, __p1_242, __p2_242, __p3_242) __extension__ ({ \
44775 uint32x4_t __ret_242; \
44776 uint32x4_t __s0_242 = __p0_242; \
44777 uint8x16_t __s1_242 = __p1_242; \
44778 uint8x16_t __s2_242 = __p2_242; \
44779 __ret_242 = vdotq_u32(__s0_242, __s1_242, __builtin_bit_cast(uint8x16_t, splatq_laneq_u32(__builtin_bit_cast(uint32x4_t, __s2_242), __p3_242))); \
44780 __ret_242; \
44568#define vdotq_laneq_u32(__p0_234, __p1_234, __p2_234, __p3_234) __extension__ ({ \
44569 uint32x4_t __ret_234; \
44570 uint32x4_t __s0_234 = __p0_234; \
44571 uint8x16_t __s1_234 = __p1_234; \
44572 uint8x16_t __s2_234 = __p2_234; \
44573 __ret_234 = vdotq_u32(__s0_234, __s1_234, __builtin_bit_cast(uint8x16_t, splatq_laneq_u32(__builtin_bit_cast(uint32x4_t, __s2_234), __p3_234))); \
44574 __ret_234; \
4478144575})
4478244576#else
44783#define vdotq_laneq_u32(__p0_243, __p1_243, __p2_243, __p3_243) __extension__ ({ \
44784 uint32x4_t __ret_243; \
44785 uint32x4_t __s0_243 = __p0_243; \
44786 uint8x16_t __s1_243 = __p1_243; \
44787 uint8x16_t __s2_243 = __p2_243; \
44788 uint32x4_t __rev0_243; __rev0_243 = __builtin_shufflevector(__s0_243, __s0_243, __lane_reverse_128_32); \
44789 uint8x16_t __rev1_243; __rev1_243 = __builtin_shufflevector(__s1_243, __s1_243, __lane_reverse_128_8); \
44790 uint8x16_t __rev2_243; __rev2_243 = __builtin_shufflevector(__s2_243, __s2_243, __lane_reverse_128_8); \
44791 __ret_243 = __noswap_vdotq_u32(__rev0_243, __rev1_243, __builtin_bit_cast(uint8x16_t, __noswap_splatq_laneq_u32(__builtin_bit_cast(uint32x4_t, __rev2_243), __p3_243))); \
44792 __ret_243 = __builtin_shufflevector(__ret_243, __ret_243, __lane_reverse_128_32); \
44793 __ret_243; \
44577#define vdotq_laneq_u32(__p0_235, __p1_235, __p2_235, __p3_235) __extension__ ({ \
44578 uint32x4_t __ret_235; \
44579 uint32x4_t __s0_235 = __p0_235; \
44580 uint8x16_t __s1_235 = __p1_235; \
44581 uint8x16_t __s2_235 = __p2_235; \
44582 uint32x4_t __rev0_235; __rev0_235 = __builtin_shufflevector(__s0_235, __s0_235, __lane_reverse_128_32); \
44583 uint8x16_t __rev1_235; __rev1_235 = __builtin_shufflevector(__s1_235, __s1_235, __lane_reverse_128_8); \
44584 uint8x16_t __rev2_235; __rev2_235 = __builtin_shufflevector(__s2_235, __s2_235, __lane_reverse_128_8); \
44585 __ret_235 = __noswap_vdotq_u32(__rev0_235, __rev1_235, __builtin_bit_cast(uint8x16_t, __noswap_splatq_laneq_u32(__builtin_bit_cast(uint32x4_t, __rev2_235), __p3_235))); \
44586 __ret_235 = __builtin_shufflevector(__ret_235, __ret_235, __lane_reverse_128_32); \
44587 __ret_235; \
4479444588})
4479544589#endif
4479644590
4479744591#ifdef __LITTLE_ENDIAN__
44798#define vdotq_laneq_s32(__p0_244, __p1_244, __p2_244, __p3_244) __extension__ ({ \
44799 int32x4_t __ret_244; \
44800 int32x4_t __s0_244 = __p0_244; \
44801 int8x16_t __s1_244 = __p1_244; \
44802 int8x16_t __s2_244 = __p2_244; \
44803 __ret_244 = vdotq_s32(__s0_244, __s1_244, __builtin_bit_cast(int8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_244), __p3_244))); \
44804 __ret_244; \
44592#define vdotq_laneq_s32(__p0_236, __p1_236, __p2_236, __p3_236) __extension__ ({ \
44593 int32x4_t __ret_236; \
44594 int32x4_t __s0_236 = __p0_236; \
44595 int8x16_t __s1_236 = __p1_236; \
44596 int8x16_t __s2_236 = __p2_236; \
44597 __ret_236 = vdotq_s32(__s0_236, __s1_236, __builtin_bit_cast(int8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_236), __p3_236))); \
44598 __ret_236; \
4480544599})
4480644600#else
44807#define vdotq_laneq_s32(__p0_245, __p1_245, __p2_245, __p3_245) __extension__ ({ \
44808 int32x4_t __ret_245; \
44809 int32x4_t __s0_245 = __p0_245; \
44810 int8x16_t __s1_245 = __p1_245; \
44811 int8x16_t __s2_245 = __p2_245; \
44812 int32x4_t __rev0_245; __rev0_245 = __builtin_shufflevector(__s0_245, __s0_245, __lane_reverse_128_32); \
44813 int8x16_t __rev1_245; __rev1_245 = __builtin_shufflevector(__s1_245, __s1_245, __lane_reverse_128_8); \
44814 int8x16_t __rev2_245; __rev2_245 = __builtin_shufflevector(__s2_245, __s2_245, __lane_reverse_128_8); \
44815 __ret_245 = __noswap_vdotq_s32(__rev0_245, __rev1_245, __builtin_bit_cast(int8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_245), __p3_245))); \
44816 __ret_245 = __builtin_shufflevector(__ret_245, __ret_245, __lane_reverse_128_32); \
44817 __ret_245; \
44601#define vdotq_laneq_s32(__p0_237, __p1_237, __p2_237, __p3_237) __extension__ ({ \
44602 int32x4_t __ret_237; \
44603 int32x4_t __s0_237 = __p0_237; \
44604 int8x16_t __s1_237 = __p1_237; \
44605 int8x16_t __s2_237 = __p2_237; \
44606 int32x4_t __rev0_237; __rev0_237 = __builtin_shufflevector(__s0_237, __s0_237, __lane_reverse_128_32); \
44607 int8x16_t __rev1_237; __rev1_237 = __builtin_shufflevector(__s1_237, __s1_237, __lane_reverse_128_8); \
44608 int8x16_t __rev2_237; __rev2_237 = __builtin_shufflevector(__s2_237, __s2_237, __lane_reverse_128_8); \
44609 __ret_237 = __noswap_vdotq_s32(__rev0_237, __rev1_237, __builtin_bit_cast(int8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_237), __p3_237))); \
44610 __ret_237 = __builtin_shufflevector(__ret_237, __ret_237, __lane_reverse_128_32); \
44611 __ret_237; \
4481844612})
4481944613#endif
4482044614
4482144615#ifdef __LITTLE_ENDIAN__
44822#define vdot_laneq_u32(__p0_246, __p1_246, __p2_246, __p3_246) __extension__ ({ \
44823 uint32x2_t __ret_246; \
44824 uint32x2_t __s0_246 = __p0_246; \
44825 uint8x8_t __s1_246 = __p1_246; \
44826 uint8x16_t __s2_246 = __p2_246; \
44827 __ret_246 = vdot_u32(__s0_246, __s1_246, __builtin_bit_cast(uint8x8_t, splat_laneq_u32(__builtin_bit_cast(uint32x4_t, __s2_246), __p3_246))); \
44828 __ret_246; \
44616#define vdot_laneq_u32(__p0_238, __p1_238, __p2_238, __p3_238) __extension__ ({ \
44617 uint32x2_t __ret_238; \
44618 uint32x2_t __s0_238 = __p0_238; \
44619 uint8x8_t __s1_238 = __p1_238; \
44620 uint8x16_t __s2_238 = __p2_238; \
44621 __ret_238 = vdot_u32(__s0_238, __s1_238, __builtin_bit_cast(uint8x8_t, splat_laneq_u32(__builtin_bit_cast(uint32x4_t, __s2_238), __p3_238))); \
44622 __ret_238; \
4482944623})
4483044624#else
44831#define vdot_laneq_u32(__p0_247, __p1_247, __p2_247, __p3_247) __extension__ ({ \
44832 uint32x2_t __ret_247; \
44833 uint32x2_t __s0_247 = __p0_247; \
44834 uint8x8_t __s1_247 = __p1_247; \
44835 uint8x16_t __s2_247 = __p2_247; \
44836 uint32x2_t __rev0_247; __rev0_247 = __builtin_shufflevector(__s0_247, __s0_247, __lane_reverse_64_32); \
44837 uint8x8_t __rev1_247; __rev1_247 = __builtin_shufflevector(__s1_247, __s1_247, __lane_reverse_64_8); \
44838 uint8x16_t __rev2_247; __rev2_247 = __builtin_shufflevector(__s2_247, __s2_247, __lane_reverse_128_8); \
44839 __ret_247 = __noswap_vdot_u32(__rev0_247, __rev1_247, __builtin_bit_cast(uint8x8_t, __noswap_splat_laneq_u32(__builtin_bit_cast(uint32x4_t, __rev2_247), __p3_247))); \
44840 __ret_247 = __builtin_shufflevector(__ret_247, __ret_247, __lane_reverse_64_32); \
44841 __ret_247; \
44625#define vdot_laneq_u32(__p0_239, __p1_239, __p2_239, __p3_239) __extension__ ({ \
44626 uint32x2_t __ret_239; \
44627 uint32x2_t __s0_239 = __p0_239; \
44628 uint8x8_t __s1_239 = __p1_239; \
44629 uint8x16_t __s2_239 = __p2_239; \
44630 uint32x2_t __rev0_239; __rev0_239 = __builtin_shufflevector(__s0_239, __s0_239, __lane_reverse_64_32); \
44631 uint8x8_t __rev1_239; __rev1_239 = __builtin_shufflevector(__s1_239, __s1_239, __lane_reverse_64_8); \
44632 uint8x16_t __rev2_239; __rev2_239 = __builtin_shufflevector(__s2_239, __s2_239, __lane_reverse_128_8); \
44633 __ret_239 = __noswap_vdot_u32(__rev0_239, __rev1_239, __builtin_bit_cast(uint8x8_t, __noswap_splat_laneq_u32(__builtin_bit_cast(uint32x4_t, __rev2_239), __p3_239))); \
44634 __ret_239 = __builtin_shufflevector(__ret_239, __ret_239, __lane_reverse_64_32); \
44635 __ret_239; \
4484244636})
4484344637#endif
4484444638
4484544639#ifdef __LITTLE_ENDIAN__
44846#define vdot_laneq_s32(__p0_248, __p1_248, __p2_248, __p3_248) __extension__ ({ \
44847 int32x2_t __ret_248; \
44848 int32x2_t __s0_248 = __p0_248; \
44849 int8x8_t __s1_248 = __p1_248; \
44850 int8x16_t __s2_248 = __p2_248; \
44851 __ret_248 = vdot_s32(__s0_248, __s1_248, __builtin_bit_cast(int8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_248), __p3_248))); \
44852 __ret_248; \
44640#define vdot_laneq_s32(__p0_240, __p1_240, __p2_240, __p3_240) __extension__ ({ \
44641 int32x2_t __ret_240; \
44642 int32x2_t __s0_240 = __p0_240; \
44643 int8x8_t __s1_240 = __p1_240; \
44644 int8x16_t __s2_240 = __p2_240; \
44645 __ret_240 = vdot_s32(__s0_240, __s1_240, __builtin_bit_cast(int8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_240), __p3_240))); \
44646 __ret_240; \
4485344647})
4485444648#else
44855#define vdot_laneq_s32(__p0_249, __p1_249, __p2_249, __p3_249) __extension__ ({ \
44856 int32x2_t __ret_249; \
44857 int32x2_t __s0_249 = __p0_249; \
44858 int8x8_t __s1_249 = __p1_249; \
44859 int8x16_t __s2_249 = __p2_249; \
44860 int32x2_t __rev0_249; __rev0_249 = __builtin_shufflevector(__s0_249, __s0_249, __lane_reverse_64_32); \
44861 int8x8_t __rev1_249; __rev1_249 = __builtin_shufflevector(__s1_249, __s1_249, __lane_reverse_64_8); \
44862 int8x16_t __rev2_249; __rev2_249 = __builtin_shufflevector(__s2_249, __s2_249, __lane_reverse_128_8); \
44863 __ret_249 = __noswap_vdot_s32(__rev0_249, __rev1_249, __builtin_bit_cast(int8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_249), __p3_249))); \
44864 __ret_249 = __builtin_shufflevector(__ret_249, __ret_249, __lane_reverse_64_32); \
44865 __ret_249; \
44649#define vdot_laneq_s32(__p0_241, __p1_241, __p2_241, __p3_241) __extension__ ({ \
44650 int32x2_t __ret_241; \
44651 int32x2_t __s0_241 = __p0_241; \
44652 int8x8_t __s1_241 = __p1_241; \
44653 int8x16_t __s2_241 = __p2_241; \
44654 int32x2_t __rev0_241; __rev0_241 = __builtin_shufflevector(__s0_241, __s0_241, __lane_reverse_64_32); \
44655 int8x8_t __rev1_241; __rev1_241 = __builtin_shufflevector(__s1_241, __s1_241, __lane_reverse_64_8); \
44656 int8x16_t __rev2_241; __rev2_241 = __builtin_shufflevector(__s2_241, __s2_241, __lane_reverse_128_8); \
44657 __ret_241 = __noswap_vdot_s32(__rev0_241, __rev1_241, __builtin_bit_cast(int8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_241), __p3_241))); \
44658 __ret_241 = __builtin_shufflevector(__ret_241, __ret_241, __lane_reverse_64_32); \
44659 __ret_241; \
4486644660})
4486744661#endif
4486844662
......@@ -45317,533 +45111,533 @@ __ai __attribute__((target("fullfp16,neon"))) float16x4_t vdiv_f16(float16x4_t _
4531745111#endif
4531845112
4531945113#ifdef __LITTLE_ENDIAN__
45320#define vfmsh_lane_f16(__p0_250, __p1_250, __p2_250, __p3_250) __extension__ ({ \
45321 float16_t __ret_250; \
45322 float16_t __s0_250 = __p0_250; \
45323 float16_t __s1_250 = __p1_250; \
45324 float16x4_t __s2_250 = __p2_250; \
45325 __ret_250 = vfmah_lane_f16(__s0_250, -__s1_250, __s2_250, __p3_250); \
45114#define vfmsh_lane_f16(__p0_242, __p1_242, __p2_242, __p3_242) __extension__ ({ \
45115 float16_t __ret_242; \
45116 float16_t __s0_242 = __p0_242; \
45117 float16_t __s1_242 = __p1_242; \
45118 float16x4_t __s2_242 = __p2_242; \
45119 __ret_242 = vfmah_lane_f16(__s0_242, -__s1_242, __s2_242, __p3_242); \
45120 __ret_242; \
45121})
45122#else
45123#define vfmsh_lane_f16(__p0_243, __p1_243, __p2_243, __p3_243) __extension__ ({ \
45124 float16_t __ret_243; \
45125 float16_t __s0_243 = __p0_243; \
45126 float16_t __s1_243 = __p1_243; \
45127 float16x4_t __s2_243 = __p2_243; \
45128 float16x4_t __rev2_243; __rev2_243 = __builtin_shufflevector(__s2_243, __s2_243, __lane_reverse_64_16); \
45129 __ret_243 = __noswap_vfmah_lane_f16(__s0_243, -__s1_243, __rev2_243, __p3_243); \
45130 __ret_243; \
45131})
45132#endif
45133
45134#ifdef __LITTLE_ENDIAN__
45135#define vfmsq_lane_f16(__p0_244, __p1_244, __p2_244, __p3_244) __extension__ ({ \
45136 float16x8_t __ret_244; \
45137 float16x8_t __s0_244 = __p0_244; \
45138 float16x8_t __s1_244 = __p1_244; \
45139 float16x4_t __s2_244 = __p2_244; \
45140 __ret_244 = vfmaq_lane_f16(__s0_244, -__s1_244, __s2_244, __p3_244); \
45141 __ret_244; \
45142})
45143#else
45144#define vfmsq_lane_f16(__p0_245, __p1_245, __p2_245, __p3_245) __extension__ ({ \
45145 float16x8_t __ret_245; \
45146 float16x8_t __s0_245 = __p0_245; \
45147 float16x8_t __s1_245 = __p1_245; \
45148 float16x4_t __s2_245 = __p2_245; \
45149 float16x8_t __rev0_245; __rev0_245 = __builtin_shufflevector(__s0_245, __s0_245, __lane_reverse_128_16); \
45150 float16x8_t __rev1_245; __rev1_245 = __builtin_shufflevector(__s1_245, __s1_245, __lane_reverse_128_16); \
45151 float16x4_t __rev2_245; __rev2_245 = __builtin_shufflevector(__s2_245, __s2_245, __lane_reverse_64_16); \
45152 __ret_245 = __noswap_vfmaq_lane_f16(__rev0_245, -__rev1_245, __rev2_245, __p3_245); \
45153 __ret_245 = __builtin_shufflevector(__ret_245, __ret_245, __lane_reverse_128_16); \
45154 __ret_245; \
45155})
45156#endif
45157
45158#ifdef __LITTLE_ENDIAN__
45159#define vfms_lane_f16(__p0_246, __p1_246, __p2_246, __p3_246) __extension__ ({ \
45160 float16x4_t __ret_246; \
45161 float16x4_t __s0_246 = __p0_246; \
45162 float16x4_t __s1_246 = __p1_246; \
45163 float16x4_t __s2_246 = __p2_246; \
45164 __ret_246 = vfma_lane_f16(__s0_246, -__s1_246, __s2_246, __p3_246); \
45165 __ret_246; \
45166})
45167#else
45168#define vfms_lane_f16(__p0_247, __p1_247, __p2_247, __p3_247) __extension__ ({ \
45169 float16x4_t __ret_247; \
45170 float16x4_t __s0_247 = __p0_247; \
45171 float16x4_t __s1_247 = __p1_247; \
45172 float16x4_t __s2_247 = __p2_247; \
45173 float16x4_t __rev0_247; __rev0_247 = __builtin_shufflevector(__s0_247, __s0_247, __lane_reverse_64_16); \
45174 float16x4_t __rev1_247; __rev1_247 = __builtin_shufflevector(__s1_247, __s1_247, __lane_reverse_64_16); \
45175 float16x4_t __rev2_247; __rev2_247 = __builtin_shufflevector(__s2_247, __s2_247, __lane_reverse_64_16); \
45176 __ret_247 = __noswap_vfma_lane_f16(__rev0_247, -__rev1_247, __rev2_247, __p3_247); \
45177 __ret_247 = __builtin_shufflevector(__ret_247, __ret_247, __lane_reverse_64_16); \
45178 __ret_247; \
45179})
45180#endif
45181
45182#ifdef __LITTLE_ENDIAN__
45183#define vfmsh_laneq_f16(__p0_248, __p1_248, __p2_248, __p3_248) __extension__ ({ \
45184 float16_t __ret_248; \
45185 float16_t __s0_248 = __p0_248; \
45186 float16_t __s1_248 = __p1_248; \
45187 float16x8_t __s2_248 = __p2_248; \
45188 __ret_248 = vfmah_laneq_f16(__s0_248, -__s1_248, __s2_248, __p3_248); \
45189 __ret_248; \
45190})
45191#else
45192#define vfmsh_laneq_f16(__p0_249, __p1_249, __p2_249, __p3_249) __extension__ ({ \
45193 float16_t __ret_249; \
45194 float16_t __s0_249 = __p0_249; \
45195 float16_t __s1_249 = __p1_249; \
45196 float16x8_t __s2_249 = __p2_249; \
45197 float16x8_t __rev2_249; __rev2_249 = __builtin_shufflevector(__s2_249, __s2_249, __lane_reverse_128_16); \
45198 __ret_249 = __noswap_vfmah_laneq_f16(__s0_249, -__s1_249, __rev2_249, __p3_249); \
45199 __ret_249; \
45200})
45201#endif
45202
45203#ifdef __LITTLE_ENDIAN__
45204#define vfmsq_laneq_f16(__p0_250, __p1_250, __p2_250, __p3_250) __extension__ ({ \
45205 float16x8_t __ret_250; \
45206 float16x8_t __s0_250 = __p0_250; \
45207 float16x8_t __s1_250 = __p1_250; \
45208 float16x8_t __s2_250 = __p2_250; \
45209 __ret_250 = vfmaq_laneq_f16(__s0_250, -__s1_250, __s2_250, __p3_250); \
4532645210 __ret_250; \
4532745211})
4532845212#else
45329#define vfmsh_lane_f16(__p0_251, __p1_251, __p2_251, __p3_251) __extension__ ({ \
45330 float16_t __ret_251; \
45331 float16_t __s0_251 = __p0_251; \
45332 float16_t __s1_251 = __p1_251; \
45333 float16x4_t __s2_251 = __p2_251; \
45334 float16x4_t __rev2_251; __rev2_251 = __builtin_shufflevector(__s2_251, __s2_251, __lane_reverse_64_16); \
45335 __ret_251 = __noswap_vfmah_lane_f16(__s0_251, -__s1_251, __rev2_251, __p3_251); \
45213#define vfmsq_laneq_f16(__p0_251, __p1_251, __p2_251, __p3_251) __extension__ ({ \
45214 float16x8_t __ret_251; \
45215 float16x8_t __s0_251 = __p0_251; \
45216 float16x8_t __s1_251 = __p1_251; \
45217 float16x8_t __s2_251 = __p2_251; \
45218 float16x8_t __rev0_251; __rev0_251 = __builtin_shufflevector(__s0_251, __s0_251, __lane_reverse_128_16); \
45219 float16x8_t __rev1_251; __rev1_251 = __builtin_shufflevector(__s1_251, __s1_251, __lane_reverse_128_16); \
45220 float16x8_t __rev2_251; __rev2_251 = __builtin_shufflevector(__s2_251, __s2_251, __lane_reverse_128_16); \
45221 __ret_251 = __noswap_vfmaq_laneq_f16(__rev0_251, -__rev1_251, __rev2_251, __p3_251); \
45222 __ret_251 = __builtin_shufflevector(__ret_251, __ret_251, __lane_reverse_128_16); \
4533645223 __ret_251; \
4533745224})
4533845225#endif
4533945226
4534045227#ifdef __LITTLE_ENDIAN__
45341#define vfmsq_lane_f16(__p0_252, __p1_252, __p2_252, __p3_252) __extension__ ({ \
45342 float16x8_t __ret_252; \
45343 float16x8_t __s0_252 = __p0_252; \
45344 float16x8_t __s1_252 = __p1_252; \
45345 float16x4_t __s2_252 = __p2_252; \
45346 __ret_252 = vfmaq_lane_f16(__s0_252, -__s1_252, __s2_252, __p3_252); \
45228#define vfms_laneq_f16(__p0_252, __p1_252, __p2_252, __p3_252) __extension__ ({ \
45229 float16x4_t __ret_252; \
45230 float16x4_t __s0_252 = __p0_252; \
45231 float16x4_t __s1_252 = __p1_252; \
45232 float16x8_t __s2_252 = __p2_252; \
45233 __ret_252 = vfma_laneq_f16(__s0_252, -__s1_252, __s2_252, __p3_252); \
4534745234 __ret_252; \
4534845235})
4534945236#else
45350#define vfmsq_lane_f16(__p0_253, __p1_253, __p2_253, __p3_253) __extension__ ({ \
45351 float16x8_t __ret_253; \
45352 float16x8_t __s0_253 = __p0_253; \
45353 float16x8_t __s1_253 = __p1_253; \
45354 float16x4_t __s2_253 = __p2_253; \
45355 float16x8_t __rev0_253; __rev0_253 = __builtin_shufflevector(__s0_253, __s0_253, __lane_reverse_128_16); \
45356 float16x8_t __rev1_253; __rev1_253 = __builtin_shufflevector(__s1_253, __s1_253, __lane_reverse_128_16); \
45357 float16x4_t __rev2_253; __rev2_253 = __builtin_shufflevector(__s2_253, __s2_253, __lane_reverse_64_16); \
45358 __ret_253 = __noswap_vfmaq_lane_f16(__rev0_253, -__rev1_253, __rev2_253, __p3_253); \
45359 __ret_253 = __builtin_shufflevector(__ret_253, __ret_253, __lane_reverse_128_16); \
45237#define vfms_laneq_f16(__p0_253, __p1_253, __p2_253, __p3_253) __extension__ ({ \
45238 float16x4_t __ret_253; \
45239 float16x4_t __s0_253 = __p0_253; \
45240 float16x4_t __s1_253 = __p1_253; \
45241 float16x8_t __s2_253 = __p2_253; \
45242 float16x4_t __rev0_253; __rev0_253 = __builtin_shufflevector(__s0_253, __s0_253, __lane_reverse_64_16); \
45243 float16x4_t __rev1_253; __rev1_253 = __builtin_shufflevector(__s1_253, __s1_253, __lane_reverse_64_16); \
45244 float16x8_t __rev2_253; __rev2_253 = __builtin_shufflevector(__s2_253, __s2_253, __lane_reverse_128_16); \
45245 __ret_253 = __noswap_vfma_laneq_f16(__rev0_253, -__rev1_253, __rev2_253, __p3_253); \
45246 __ret_253 = __builtin_shufflevector(__ret_253, __ret_253, __lane_reverse_64_16); \
4536045247 __ret_253; \
4536145248})
4536245249#endif
4536345250
4536445251#ifdef __LITTLE_ENDIAN__
45365#define vfms_lane_f16(__p0_254, __p1_254, __p2_254, __p3_254) __extension__ ({ \
45366 float16x4_t __ret_254; \
45367 float16x4_t __s0_254 = __p0_254; \
45368 float16x4_t __s1_254 = __p1_254; \
45369 float16x4_t __s2_254 = __p2_254; \
45370 __ret_254 = vfma_lane_f16(__s0_254, -__s1_254, __s2_254, __p3_254); \
45252#define vfmsq_n_f16(__p0, __p1, __p2) __extension__ ({ \
45253 float16x8_t __ret; \
45254 float16x8_t __s0 = __p0; \
45255 float16x8_t __s1 = __p1; \
45256 float16_t __s2 = __p2; \
45257 __ret = vfmaq_f16(__s0, -__s1, (float16x8_t) {__s2, __s2, __s2, __s2, __s2, __s2, __s2, __s2}); \
45258 __ret; \
45259})
45260#else
45261#define vfmsq_n_f16(__p0, __p1, __p2) __extension__ ({ \
45262 float16x8_t __ret; \
45263 float16x8_t __s0 = __p0; \
45264 float16x8_t __s1 = __p1; \
45265 float16_t __s2 = __p2; \
45266 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45267 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
45268 __ret = __noswap_vfmaq_f16(__rev0, -__rev1, (float16x8_t) {__s2, __s2, __s2, __s2, __s2, __s2, __s2, __s2}); \
45269 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
45270 __ret; \
45271})
45272#endif
45273
45274#ifdef __LITTLE_ENDIAN__
45275#define vfms_n_f16(__p0, __p1, __p2) __extension__ ({ \
45276 float16x4_t __ret; \
45277 float16x4_t __s0 = __p0; \
45278 float16x4_t __s1 = __p1; \
45279 float16_t __s2 = __p2; \
45280 __ret = vfma_f16(__s0, -__s1, (float16x4_t) {__s2, __s2, __s2, __s2}); \
45281 __ret; \
45282})
45283#else
45284#define vfms_n_f16(__p0, __p1, __p2) __extension__ ({ \
45285 float16x4_t __ret; \
45286 float16x4_t __s0 = __p0; \
45287 float16x4_t __s1 = __p1; \
45288 float16_t __s2 = __p2; \
45289 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45290 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
45291 __ret = __noswap_vfma_f16(__rev0, -__rev1, (float16x4_t) {__s2, __s2, __s2, __s2}); \
45292 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
45293 __ret; \
45294})
45295#endif
45296
45297#ifdef __LITTLE_ENDIAN__
45298#define vmaxnmvq_f16(__p0) __extension__ ({ \
45299 float16_t __ret; \
45300 float16x8_t __s0 = __p0; \
45301 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45302 __ret; \
45303})
45304#else
45305#define vmaxnmvq_f16(__p0) __extension__ ({ \
45306 float16_t __ret; \
45307 float16x8_t __s0 = __p0; \
45308 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45309 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45310 __ret; \
45311})
45312#endif
45313
45314#ifdef __LITTLE_ENDIAN__
45315#define vmaxnmv_f16(__p0) __extension__ ({ \
45316 float16_t __ret; \
45317 float16x4_t __s0 = __p0; \
45318 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45319 __ret; \
45320})
45321#else
45322#define vmaxnmv_f16(__p0) __extension__ ({ \
45323 float16_t __ret; \
45324 float16x4_t __s0 = __p0; \
45325 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45326 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45327 __ret; \
45328})
45329#endif
45330
45331#ifdef __LITTLE_ENDIAN__
45332#define vmaxvq_f16(__p0) __extension__ ({ \
45333 float16_t __ret; \
45334 float16x8_t __s0 = __p0; \
45335 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45336 __ret; \
45337})
45338#else
45339#define vmaxvq_f16(__p0) __extension__ ({ \
45340 float16_t __ret; \
45341 float16x8_t __s0 = __p0; \
45342 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45343 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45344 __ret; \
45345})
45346#endif
45347
45348#ifdef __LITTLE_ENDIAN__
45349#define vmaxv_f16(__p0) __extension__ ({ \
45350 float16_t __ret; \
45351 float16x4_t __s0 = __p0; \
45352 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45353 __ret; \
45354})
45355#else
45356#define vmaxv_f16(__p0) __extension__ ({ \
45357 float16_t __ret; \
45358 float16x4_t __s0 = __p0; \
45359 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45360 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45361 __ret; \
45362})
45363#endif
45364
45365#ifdef __LITTLE_ENDIAN__
45366#define vminnmvq_f16(__p0) __extension__ ({ \
45367 float16_t __ret; \
45368 float16x8_t __s0 = __p0; \
45369 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45370 __ret; \
45371})
45372#else
45373#define vminnmvq_f16(__p0) __extension__ ({ \
45374 float16_t __ret; \
45375 float16x8_t __s0 = __p0; \
45376 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45377 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45378 __ret; \
45379})
45380#endif
45381
45382#ifdef __LITTLE_ENDIAN__
45383#define vminnmv_f16(__p0) __extension__ ({ \
45384 float16_t __ret; \
45385 float16x4_t __s0 = __p0; \
45386 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45387 __ret; \
45388})
45389#else
45390#define vminnmv_f16(__p0) __extension__ ({ \
45391 float16_t __ret; \
45392 float16x4_t __s0 = __p0; \
45393 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45394 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45395 __ret; \
45396})
45397#endif
45398
45399#ifdef __LITTLE_ENDIAN__
45400#define vminvq_f16(__p0) __extension__ ({ \
45401 float16_t __ret; \
45402 float16x8_t __s0 = __p0; \
45403 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45404 __ret; \
45405})
45406#else
45407#define vminvq_f16(__p0) __extension__ ({ \
45408 float16_t __ret; \
45409 float16x8_t __s0 = __p0; \
45410 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45411 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45412 __ret; \
45413})
45414#endif
45415
45416#ifdef __LITTLE_ENDIAN__
45417#define vminv_f16(__p0) __extension__ ({ \
45418 float16_t __ret; \
45419 float16x4_t __s0 = __p0; \
45420 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45421 __ret; \
45422})
45423#else
45424#define vminv_f16(__p0) __extension__ ({ \
45425 float16_t __ret; \
45426 float16x4_t __s0 = __p0; \
45427 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45428 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45429 __ret; \
45430})
45431#endif
45432
45433#ifdef __LITTLE_ENDIAN__
45434#define vmulq_laneq_f16(__p0_254, __p1_254, __p2_254) __extension__ ({ \
45435 float16x8_t __ret_254; \
45436 float16x8_t __s0_254 = __p0_254; \
45437 float16x8_t __s1_254 = __p1_254; \
45438 __ret_254 = __s0_254 * splatq_laneq_f16(__s1_254, __p2_254); \
4537145439 __ret_254; \
4537245440})
4537345441#else
45374#define vfms_lane_f16(__p0_255, __p1_255, __p2_255, __p3_255) __extension__ ({ \
45375 float16x4_t __ret_255; \
45376 float16x4_t __s0_255 = __p0_255; \
45377 float16x4_t __s1_255 = __p1_255; \
45378 float16x4_t __s2_255 = __p2_255; \
45379 float16x4_t __rev0_255; __rev0_255 = __builtin_shufflevector(__s0_255, __s0_255, __lane_reverse_64_16); \
45380 float16x4_t __rev1_255; __rev1_255 = __builtin_shufflevector(__s1_255, __s1_255, __lane_reverse_64_16); \
45381 float16x4_t __rev2_255; __rev2_255 = __builtin_shufflevector(__s2_255, __s2_255, __lane_reverse_64_16); \
45382 __ret_255 = __noswap_vfma_lane_f16(__rev0_255, -__rev1_255, __rev2_255, __p3_255); \
45383 __ret_255 = __builtin_shufflevector(__ret_255, __ret_255, __lane_reverse_64_16); \
45442#define vmulq_laneq_f16(__p0_255, __p1_255, __p2_255) __extension__ ({ \
45443 float16x8_t __ret_255; \
45444 float16x8_t __s0_255 = __p0_255; \
45445 float16x8_t __s1_255 = __p1_255; \
45446 float16x8_t __rev0_255; __rev0_255 = __builtin_shufflevector(__s0_255, __s0_255, __lane_reverse_128_16); \
45447 float16x8_t __rev1_255; __rev1_255 = __builtin_shufflevector(__s1_255, __s1_255, __lane_reverse_128_16); \
45448 __ret_255 = __rev0_255 * __noswap_splatq_laneq_f16(__rev1_255, __p2_255); \
45449 __ret_255 = __builtin_shufflevector(__ret_255, __ret_255, __lane_reverse_128_16); \
4538445450 __ret_255; \
4538545451})
4538645452#endif
4538745453
4538845454#ifdef __LITTLE_ENDIAN__
45389#define vfmsh_laneq_f16(__p0_256, __p1_256, __p2_256, __p3_256) __extension__ ({ \
45390 float16_t __ret_256; \
45391 float16_t __s0_256 = __p0_256; \
45392 float16_t __s1_256 = __p1_256; \
45393 float16x8_t __s2_256 = __p2_256; \
45394 __ret_256 = vfmah_laneq_f16(__s0_256, -__s1_256, __s2_256, __p3_256); \
45455#define vmul_laneq_f16(__p0_256, __p1_256, __p2_256) __extension__ ({ \
45456 float16x4_t __ret_256; \
45457 float16x4_t __s0_256 = __p0_256; \
45458 float16x8_t __s1_256 = __p1_256; \
45459 __ret_256 = __s0_256 * splat_laneq_f16(__s1_256, __p2_256); \
4539545460 __ret_256; \
4539645461})
4539745462#else
45398#define vfmsh_laneq_f16(__p0_257, __p1_257, __p2_257, __p3_257) __extension__ ({ \
45399 float16_t __ret_257; \
45400 float16_t __s0_257 = __p0_257; \
45401 float16_t __s1_257 = __p1_257; \
45402 float16x8_t __s2_257 = __p2_257; \
45403 float16x8_t __rev2_257; __rev2_257 = __builtin_shufflevector(__s2_257, __s2_257, __lane_reverse_128_16); \
45404 __ret_257 = __noswap_vfmah_laneq_f16(__s0_257, -__s1_257, __rev2_257, __p3_257); \
45463#define vmul_laneq_f16(__p0_257, __p1_257, __p2_257) __extension__ ({ \
45464 float16x4_t __ret_257; \
45465 float16x4_t __s0_257 = __p0_257; \
45466 float16x8_t __s1_257 = __p1_257; \
45467 float16x4_t __rev0_257; __rev0_257 = __builtin_shufflevector(__s0_257, __s0_257, __lane_reverse_64_16); \
45468 float16x8_t __rev1_257; __rev1_257 = __builtin_shufflevector(__s1_257, __s1_257, __lane_reverse_128_16); \
45469 __ret_257 = __rev0_257 * __noswap_splat_laneq_f16(__rev1_257, __p2_257); \
45470 __ret_257 = __builtin_shufflevector(__ret_257, __ret_257, __lane_reverse_64_16); \
4540545471 __ret_257; \
4540645472})
4540745473#endif
4540845474
4540945475#ifdef __LITTLE_ENDIAN__
45410#define vfmsq_laneq_f16(__p0_258, __p1_258, __p2_258, __p3_258) __extension__ ({ \
45476__ai __attribute__((target("fullfp16,neon"))) float16x8_t vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45477 float16x8_t __ret;
45478 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
45479 return __ret;
45480}
45481#else
45482__ai __attribute__((target("fullfp16,neon"))) float16x8_t vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45483 float16x8_t __ret;
45484 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
45485 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
45486 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
45487 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
45488 return __ret;
45489}
45490__ai __attribute__((target("fullfp16,neon"))) float16x8_t __noswap_vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45491 float16x8_t __ret;
45492 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
45493 return __ret;
45494}
45495#endif
45496
45497#ifdef __LITTLE_ENDIAN__
45498__ai __attribute__((target("fullfp16,neon"))) float16x4_t vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45499 float16x4_t __ret;
45500 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
45501 return __ret;
45502}
45503#else
45504__ai __attribute__((target("fullfp16,neon"))) float16x4_t vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45505 float16x4_t __ret;
45506 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
45507 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
45508 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
45509 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
45510 return __ret;
45511}
45512__ai __attribute__((target("fullfp16,neon"))) float16x4_t __noswap_vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45513 float16x4_t __ret;
45514 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
45515 return __ret;
45516}
45517#endif
45518
45519#ifdef __LITTLE_ENDIAN__
45520#define vmulxh_lane_f16(__p0, __p1, __p2) __extension__ ({ \
45521 float16_t __ret; \
45522 float16_t __s0 = __p0; \
45523 float16x4_t __s1 = __p1; \
45524 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_lane_f16(__s0, __s1, __p2)); \
45525 __ret; \
45526})
45527#else
45528#define vmulxh_lane_f16(__p0, __p1, __p2) __extension__ ({ \
45529 float16_t __ret; \
45530 float16_t __s0 = __p0; \
45531 float16x4_t __s1 = __p1; \
45532 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
45533 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_lane_f16(__s0, __rev1, __p2)); \
45534 __ret; \
45535})
45536#endif
45537
45538#ifdef __LITTLE_ENDIAN__
45539#define vmulxq_lane_f16(__p0_258, __p1_258, __p2_258) __extension__ ({ \
4541145540 float16x8_t __ret_258; \
4541245541 float16x8_t __s0_258 = __p0_258; \
45413 float16x8_t __s1_258 = __p1_258; \
45414 float16x8_t __s2_258 = __p2_258; \
45415 __ret_258 = vfmaq_laneq_f16(__s0_258, -__s1_258, __s2_258, __p3_258); \
45542 float16x4_t __s1_258 = __p1_258; \
45543 __ret_258 = vmulxq_f16(__s0_258, splatq_lane_f16(__s1_258, __p2_258)); \
4541645544 __ret_258; \
4541745545})
4541845546#else
45419#define vfmsq_laneq_f16(__p0_259, __p1_259, __p2_259, __p3_259) __extension__ ({ \
45547#define vmulxq_lane_f16(__p0_259, __p1_259, __p2_259) __extension__ ({ \
4542045548 float16x8_t __ret_259; \
4542145549 float16x8_t __s0_259 = __p0_259; \
45422 float16x8_t __s1_259 = __p1_259; \
45423 float16x8_t __s2_259 = __p2_259; \
45550 float16x4_t __s1_259 = __p1_259; \
4542445551 float16x8_t __rev0_259; __rev0_259 = __builtin_shufflevector(__s0_259, __s0_259, __lane_reverse_128_16); \
45425 float16x8_t __rev1_259; __rev1_259 = __builtin_shufflevector(__s1_259, __s1_259, __lane_reverse_128_16); \
45426 float16x8_t __rev2_259; __rev2_259 = __builtin_shufflevector(__s2_259, __s2_259, __lane_reverse_128_16); \
45427 __ret_259 = __noswap_vfmaq_laneq_f16(__rev0_259, -__rev1_259, __rev2_259, __p3_259); \
45552 float16x4_t __rev1_259; __rev1_259 = __builtin_shufflevector(__s1_259, __s1_259, __lane_reverse_64_16); \
45553 __ret_259 = __noswap_vmulxq_f16(__rev0_259, __noswap_splatq_lane_f16(__rev1_259, __p2_259)); \
4542845554 __ret_259 = __builtin_shufflevector(__ret_259, __ret_259, __lane_reverse_128_16); \
4542945555 __ret_259; \
4543045556})
4543145557#endif
4543245558
4543345559#ifdef __LITTLE_ENDIAN__
45434#define vfms_laneq_f16(__p0_260, __p1_260, __p2_260, __p3_260) __extension__ ({ \
45560#define vmulx_lane_f16(__p0_260, __p1_260, __p2_260) __extension__ ({ \
4543545561 float16x4_t __ret_260; \
4543645562 float16x4_t __s0_260 = __p0_260; \
4543745563 float16x4_t __s1_260 = __p1_260; \
45438 float16x8_t __s2_260 = __p2_260; \
45439 __ret_260 = vfma_laneq_f16(__s0_260, -__s1_260, __s2_260, __p3_260); \
45564 __ret_260 = vmulx_f16(__s0_260, splat_lane_f16(__s1_260, __p2_260)); \
4544045565 __ret_260; \
4544145566})
4544245567#else
45443#define vfms_laneq_f16(__p0_261, __p1_261, __p2_261, __p3_261) __extension__ ({ \
45568#define vmulx_lane_f16(__p0_261, __p1_261, __p2_261) __extension__ ({ \
4544445569 float16x4_t __ret_261; \
4544545570 float16x4_t __s0_261 = __p0_261; \
4544645571 float16x4_t __s1_261 = __p1_261; \
45447 float16x8_t __s2_261 = __p2_261; \
4544845572 float16x4_t __rev0_261; __rev0_261 = __builtin_shufflevector(__s0_261, __s0_261, __lane_reverse_64_16); \
4544945573 float16x4_t __rev1_261; __rev1_261 = __builtin_shufflevector(__s1_261, __s1_261, __lane_reverse_64_16); \
45450 float16x8_t __rev2_261; __rev2_261 = __builtin_shufflevector(__s2_261, __s2_261, __lane_reverse_128_16); \
45451 __ret_261 = __noswap_vfma_laneq_f16(__rev0_261, -__rev1_261, __rev2_261, __p3_261); \
45574 __ret_261 = __noswap_vmulx_f16(__rev0_261, __noswap_splat_lane_f16(__rev1_261, __p2_261)); \
4545245575 __ret_261 = __builtin_shufflevector(__ret_261, __ret_261, __lane_reverse_64_16); \
4545345576 __ret_261; \
4545445577})
4545545578#endif
4545645579
4545745580#ifdef __LITTLE_ENDIAN__
45458#define vfmsq_n_f16(__p0, __p1, __p2) __extension__ ({ \
45459 float16x8_t __ret; \
45460 float16x8_t __s0 = __p0; \
45581#define vmulxh_laneq_f16(__p0, __p1, __p2) __extension__ ({ \
45582 float16_t __ret; \
45583 float16_t __s0 = __p0; \
4546145584 float16x8_t __s1 = __p1; \
45462 float16_t __s2 = __p2; \
45463 __ret = vfmaq_f16(__s0, -__s1, (float16x8_t) {__s2, __s2, __s2, __s2, __s2, __s2, __s2, __s2}); \
45585 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_laneq_f16(__s0, __s1, __p2)); \
4546445586 __ret; \
4546545587})
4546645588#else
45467#define vfmsq_n_f16(__p0, __p1, __p2) __extension__ ({ \
45468 float16x8_t __ret; \
45469 float16x8_t __s0 = __p0; \
45589#define vmulxh_laneq_f16(__p0, __p1, __p2) __extension__ ({ \
45590 float16_t __ret; \
45591 float16_t __s0 = __p0; \
4547045592 float16x8_t __s1 = __p1; \
45471 float16_t __s2 = __p2; \
45472 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
4547345593 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
45474 __ret = __noswap_vfmaq_f16(__rev0, -__rev1, (float16x8_t) {__s2, __s2, __s2, __s2, __s2, __s2, __s2, __s2}); \
45475 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16); \
45476 __ret; \
45477})
45478#endif
45479
45480#ifdef __LITTLE_ENDIAN__
45481#define vfms_n_f16(__p0, __p1, __p2) __extension__ ({ \
45482 float16x4_t __ret; \
45483 float16x4_t __s0 = __p0; \
45484 float16x4_t __s1 = __p1; \
45485 float16_t __s2 = __p2; \
45486 __ret = vfma_f16(__s0, -__s1, (float16x4_t) {__s2, __s2, __s2, __s2}); \
45487 __ret; \
45488})
45489#else
45490#define vfms_n_f16(__p0, __p1, __p2) __extension__ ({ \
45491 float16x4_t __ret; \
45492 float16x4_t __s0 = __p0; \
45493 float16x4_t __s1 = __p1; \
45494 float16_t __s2 = __p2; \
45495 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45496 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
45497 __ret = __noswap_vfma_f16(__rev0, -__rev1, (float16x4_t) {__s2, __s2, __s2, __s2}); \
45498 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16); \
45499 __ret; \
45500})
45501#endif
45502
45503#ifdef __LITTLE_ENDIAN__
45504#define vmaxnmvq_f16(__p0) __extension__ ({ \
45505 float16_t __ret; \
45506 float16x8_t __s0 = __p0; \
45507 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45508 __ret; \
45509})
45510#else
45511#define vmaxnmvq_f16(__p0) __extension__ ({ \
45512 float16_t __ret; \
45513 float16x8_t __s0 = __p0; \
45514 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45515 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45516 __ret; \
45517})
45518#endif
45519
45520#ifdef __LITTLE_ENDIAN__
45521#define vmaxnmv_f16(__p0) __extension__ ({ \
45522 float16_t __ret; \
45523 float16x4_t __s0 = __p0; \
45524 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45525 __ret; \
45526})
45527#else
45528#define vmaxnmv_f16(__p0) __extension__ ({ \
45529 float16_t __ret; \
45530 float16x4_t __s0 = __p0; \
45531 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45532 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxnmv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45533 __ret; \
45534})
45535#endif
45536
45537#ifdef __LITTLE_ENDIAN__
45538#define vmaxvq_f16(__p0) __extension__ ({ \
45539 float16_t __ret; \
45540 float16x8_t __s0 = __p0; \
45541 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45542 __ret; \
45543})
45544#else
45545#define vmaxvq_f16(__p0) __extension__ ({ \
45546 float16_t __ret; \
45547 float16x8_t __s0 = __p0; \
45548 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45549 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45550 __ret; \
45551})
45552#endif
45553
45554#ifdef __LITTLE_ENDIAN__
45555#define vmaxv_f16(__p0) __extension__ ({ \
45556 float16_t __ret; \
45557 float16x4_t __s0 = __p0; \
45558 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45559 __ret; \
45560})
45561#else
45562#define vmaxv_f16(__p0) __extension__ ({ \
45563 float16_t __ret; \
45564 float16x4_t __s0 = __p0; \
45565 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45566 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmaxv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45567 __ret; \
45568})
45569#endif
45570
45571#ifdef __LITTLE_ENDIAN__
45572#define vminnmvq_f16(__p0) __extension__ ({ \
45573 float16_t __ret; \
45574 float16x8_t __s0 = __p0; \
45575 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45576 __ret; \
45577})
45578#else
45579#define vminnmvq_f16(__p0) __extension__ ({ \
45580 float16_t __ret; \
45581 float16x8_t __s0 = __p0; \
45582 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45583 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45584 __ret; \
45585})
45586#endif
45587
45588#ifdef __LITTLE_ENDIAN__
45589#define vminnmv_f16(__p0) __extension__ ({ \
45590 float16_t __ret; \
45591 float16x4_t __s0 = __p0; \
45592 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45593 __ret; \
45594})
45595#else
45596#define vminnmv_f16(__p0) __extension__ ({ \
45597 float16_t __ret; \
45598 float16x4_t __s0 = __p0; \
45599 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45600 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminnmv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45601 __ret; \
45602})
45603#endif
45604
45605#ifdef __LITTLE_ENDIAN__
45606#define vminvq_f16(__p0) __extension__ ({ \
45607 float16_t __ret; \
45608 float16x8_t __s0 = __p0; \
45609 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminvq_f16(__builtin_bit_cast(int8x16_t, __s0))); \
45610 __ret; \
45611})
45612#else
45613#define vminvq_f16(__p0) __extension__ ({ \
45614 float16_t __ret; \
45615 float16x8_t __s0 = __p0; \
45616 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_128_16); \
45617 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminvq_f16(__builtin_bit_cast(int8x16_t, __rev0))); \
45618 __ret; \
45619})
45620#endif
45621
45622#ifdef __LITTLE_ENDIAN__
45623#define vminv_f16(__p0) __extension__ ({ \
45624 float16_t __ret; \
45625 float16x4_t __s0 = __p0; \
45626 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminv_f16(__builtin_bit_cast(int8x8_t, __s0))); \
45627 __ret; \
45628})
45629#else
45630#define vminv_f16(__p0) __extension__ ({ \
45631 float16_t __ret; \
45632 float16x4_t __s0 = __p0; \
45633 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__s0, __s0, __lane_reverse_64_16); \
45634 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vminv_f16(__builtin_bit_cast(int8x8_t, __rev0))); \
45594 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_laneq_f16(__s0, __rev1, __p2)); \
4563545595 __ret; \
4563645596})
4563745597#endif
4563845598
4563945599#ifdef __LITTLE_ENDIAN__
45640#define vmulq_laneq_f16(__p0_262, __p1_262, __p2_262) __extension__ ({ \
45600#define vmulxq_laneq_f16(__p0_262, __p1_262, __p2_262) __extension__ ({ \
4564145601 float16x8_t __ret_262; \
4564245602 float16x8_t __s0_262 = __p0_262; \
4564345603 float16x8_t __s1_262 = __p1_262; \
45644 __ret_262 = __s0_262 * splatq_laneq_f16(__s1_262, __p2_262); \
45604 __ret_262 = vmulxq_f16(__s0_262, splatq_laneq_f16(__s1_262, __p2_262)); \
4564545605 __ret_262; \
4564645606})
4564745607#else
45648#define vmulq_laneq_f16(__p0_263, __p1_263, __p2_263) __extension__ ({ \
45608#define vmulxq_laneq_f16(__p0_263, __p1_263, __p2_263) __extension__ ({ \
4564945609 float16x8_t __ret_263; \
4565045610 float16x8_t __s0_263 = __p0_263; \
4565145611 float16x8_t __s1_263 = __p1_263; \
4565245612 float16x8_t __rev0_263; __rev0_263 = __builtin_shufflevector(__s0_263, __s0_263, __lane_reverse_128_16); \
4565345613 float16x8_t __rev1_263; __rev1_263 = __builtin_shufflevector(__s1_263, __s1_263, __lane_reverse_128_16); \
45654 __ret_263 = __rev0_263 * __noswap_splatq_laneq_f16(__rev1_263, __p2_263); \
45614 __ret_263 = __noswap_vmulxq_f16(__rev0_263, __noswap_splatq_laneq_f16(__rev1_263, __p2_263)); \
4565545615 __ret_263 = __builtin_shufflevector(__ret_263, __ret_263, __lane_reverse_128_16); \
4565645616 __ret_263; \
4565745617})
4565845618#endif
4565945619
4566045620#ifdef __LITTLE_ENDIAN__
45661#define vmul_laneq_f16(__p0_264, __p1_264, __p2_264) __extension__ ({ \
45621#define vmulx_laneq_f16(__p0_264, __p1_264, __p2_264) __extension__ ({ \
4566245622 float16x4_t __ret_264; \
4566345623 float16x4_t __s0_264 = __p0_264; \
4566445624 float16x8_t __s1_264 = __p1_264; \
45665 __ret_264 = __s0_264 * splat_laneq_f16(__s1_264, __p2_264); \
45625 __ret_264 = vmulx_f16(__s0_264, splat_laneq_f16(__s1_264, __p2_264)); \
4566645626 __ret_264; \
4566745627})
4566845628#else
45669#define vmul_laneq_f16(__p0_265, __p1_265, __p2_265) __extension__ ({ \
45629#define vmulx_laneq_f16(__p0_265, __p1_265, __p2_265) __extension__ ({ \
4567045630 float16x4_t __ret_265; \
4567145631 float16x4_t __s0_265 = __p0_265; \
4567245632 float16x8_t __s1_265 = __p1_265; \
4567345633 float16x4_t __rev0_265; __rev0_265 = __builtin_shufflevector(__s0_265, __s0_265, __lane_reverse_64_16); \
4567445634 float16x8_t __rev1_265; __rev1_265 = __builtin_shufflevector(__s1_265, __s1_265, __lane_reverse_128_16); \
45675 __ret_265 = __rev0_265 * __noswap_splat_laneq_f16(__rev1_265, __p2_265); \
45635 __ret_265 = __noswap_vmulx_f16(__rev0_265, __noswap_splat_laneq_f16(__rev1_265, __p2_265)); \
4567645636 __ret_265 = __builtin_shufflevector(__ret_265, __ret_265, __lane_reverse_64_16); \
4567745637 __ret_265; \
4567845638})
4567945639#endif
4568045640
45681#ifdef __LITTLE_ENDIAN__
45682__ai __attribute__((target("fullfp16,neon"))) float16x8_t vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45683 float16x8_t __ret;
45684 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
45685 return __ret;
45686}
45687#else
45688__ai __attribute__((target("fullfp16,neon"))) float16x8_t vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45689 float16x8_t __ret;
45690 float16x8_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_128_16);
45691 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_128_16);
45692 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __rev0), __builtin_bit_cast(int8x16_t, __rev1), 40));
45693 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_128_16);
45694 return __ret;
45695}
45696__ai __attribute__((target("fullfp16,neon"))) float16x8_t __noswap_vmulxq_f16(float16x8_t __p0, float16x8_t __p1) {
45697 float16x8_t __ret;
45698 __ret = __builtin_bit_cast(float16x8_t, __builtin_neon_vmulxq_f16(__builtin_bit_cast(int8x16_t, __p0), __builtin_bit_cast(int8x16_t, __p1), 40));
45699 return __ret;
45700}
45701#endif
45702
45703#ifdef __LITTLE_ENDIAN__
45704__ai __attribute__((target("fullfp16,neon"))) float16x4_t vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45705 float16x4_t __ret;
45706 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
45707 return __ret;
45708}
45709#else
45710__ai __attribute__((target("fullfp16,neon"))) float16x4_t vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45711 float16x4_t __ret;
45712 float16x4_t __rev0; __rev0 = __builtin_shufflevector(__p0, __p0, __lane_reverse_64_16);
45713 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__p1, __p1, __lane_reverse_64_16);
45714 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __rev0), __builtin_bit_cast(int8x8_t, __rev1), 8));
45715 __ret = __builtin_shufflevector(__ret, __ret, __lane_reverse_64_16);
45716 return __ret;
45717}
45718__ai __attribute__((target("fullfp16,neon"))) float16x4_t __noswap_vmulx_f16(float16x4_t __p0, float16x4_t __p1) {
45719 float16x4_t __ret;
45720 __ret = __builtin_bit_cast(float16x4_t, __builtin_neon_vmulx_f16(__builtin_bit_cast(int8x8_t, __p0), __builtin_bit_cast(int8x8_t, __p1), 8));
45721 return __ret;
45722}
45723#endif
45724
45725#ifdef __LITTLE_ENDIAN__
45726#define vmulxh_lane_f16(__p0, __p1, __p2) __extension__ ({ \
45727 float16_t __ret; \
45728 float16_t __s0 = __p0; \
45729 float16x4_t __s1 = __p1; \
45730 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_lane_f16(__s0, __s1, __p2)); \
45731 __ret; \
45732})
45733#else
45734#define vmulxh_lane_f16(__p0, __p1, __p2) __extension__ ({ \
45735 float16_t __ret; \
45736 float16_t __s0 = __p0; \
45737 float16x4_t __s1 = __p1; \
45738 float16x4_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_64_16); \
45739 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_lane_f16(__s0, __rev1, __p2)); \
45740 __ret; \
45741})
45742#endif
45743
45744#ifdef __LITTLE_ENDIAN__
45745#define vmulxq_lane_f16(__p0_266, __p1_266, __p2_266) __extension__ ({ \
45746 float16x8_t __ret_266; \
45747 float16x8_t __s0_266 = __p0_266; \
45748 float16x4_t __s1_266 = __p1_266; \
45749 __ret_266 = vmulxq_f16(__s0_266, splatq_lane_f16(__s1_266, __p2_266)); \
45750 __ret_266; \
45751})
45752#else
45753#define vmulxq_lane_f16(__p0_267, __p1_267, __p2_267) __extension__ ({ \
45754 float16x8_t __ret_267; \
45755 float16x8_t __s0_267 = __p0_267; \
45756 float16x4_t __s1_267 = __p1_267; \
45757 float16x8_t __rev0_267; __rev0_267 = __builtin_shufflevector(__s0_267, __s0_267, __lane_reverse_128_16); \
45758 float16x4_t __rev1_267; __rev1_267 = __builtin_shufflevector(__s1_267, __s1_267, __lane_reverse_64_16); \
45759 __ret_267 = __noswap_vmulxq_f16(__rev0_267, __noswap_splatq_lane_f16(__rev1_267, __p2_267)); \
45760 __ret_267 = __builtin_shufflevector(__ret_267, __ret_267, __lane_reverse_128_16); \
45761 __ret_267; \
45762})
45763#endif
45764
45765#ifdef __LITTLE_ENDIAN__
45766#define vmulx_lane_f16(__p0_268, __p1_268, __p2_268) __extension__ ({ \
45767 float16x4_t __ret_268; \
45768 float16x4_t __s0_268 = __p0_268; \
45769 float16x4_t __s1_268 = __p1_268; \
45770 __ret_268 = vmulx_f16(__s0_268, splat_lane_f16(__s1_268, __p2_268)); \
45771 __ret_268; \
45772})
45773#else
45774#define vmulx_lane_f16(__p0_269, __p1_269, __p2_269) __extension__ ({ \
45775 float16x4_t __ret_269; \
45776 float16x4_t __s0_269 = __p0_269; \
45777 float16x4_t __s1_269 = __p1_269; \
45778 float16x4_t __rev0_269; __rev0_269 = __builtin_shufflevector(__s0_269, __s0_269, __lane_reverse_64_16); \
45779 float16x4_t __rev1_269; __rev1_269 = __builtin_shufflevector(__s1_269, __s1_269, __lane_reverse_64_16); \
45780 __ret_269 = __noswap_vmulx_f16(__rev0_269, __noswap_splat_lane_f16(__rev1_269, __p2_269)); \
45781 __ret_269 = __builtin_shufflevector(__ret_269, __ret_269, __lane_reverse_64_16); \
45782 __ret_269; \
45783})
45784#endif
45785
45786#ifdef __LITTLE_ENDIAN__
45787#define vmulxh_laneq_f16(__p0, __p1, __p2) __extension__ ({ \
45788 float16_t __ret; \
45789 float16_t __s0 = __p0; \
45790 float16x8_t __s1 = __p1; \
45791 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_laneq_f16(__s0, __s1, __p2)); \
45792 __ret; \
45793})
45794#else
45795#define vmulxh_laneq_f16(__p0, __p1, __p2) __extension__ ({ \
45796 float16_t __ret; \
45797 float16_t __s0 = __p0; \
45798 float16x8_t __s1 = __p1; \
45799 float16x8_t __rev1; __rev1 = __builtin_shufflevector(__s1, __s1, __lane_reverse_128_16); \
45800 __ret = __builtin_bit_cast(float16_t, __builtin_neon_vmulxh_laneq_f16(__s0, __rev1, __p2)); \
45801 __ret; \
45802})
45803#endif
45804
45805#ifdef __LITTLE_ENDIAN__
45806#define vmulxq_laneq_f16(__p0_270, __p1_270, __p2_270) __extension__ ({ \
45807 float16x8_t __ret_270; \
45808 float16x8_t __s0_270 = __p0_270; \
45809 float16x8_t __s1_270 = __p1_270; \
45810 __ret_270 = vmulxq_f16(__s0_270, splatq_laneq_f16(__s1_270, __p2_270)); \
45811 __ret_270; \
45812})
45813#else
45814#define vmulxq_laneq_f16(__p0_271, __p1_271, __p2_271) __extension__ ({ \
45815 float16x8_t __ret_271; \
45816 float16x8_t __s0_271 = __p0_271; \
45817 float16x8_t __s1_271 = __p1_271; \
45818 float16x8_t __rev0_271; __rev0_271 = __builtin_shufflevector(__s0_271, __s0_271, __lane_reverse_128_16); \
45819 float16x8_t __rev1_271; __rev1_271 = __builtin_shufflevector(__s1_271, __s1_271, __lane_reverse_128_16); \
45820 __ret_271 = __noswap_vmulxq_f16(__rev0_271, __noswap_splatq_laneq_f16(__rev1_271, __p2_271)); \
45821 __ret_271 = __builtin_shufflevector(__ret_271, __ret_271, __lane_reverse_128_16); \
45822 __ret_271; \
45823})
45824#endif
45825
45826#ifdef __LITTLE_ENDIAN__
45827#define vmulx_laneq_f16(__p0_272, __p1_272, __p2_272) __extension__ ({ \
45828 float16x4_t __ret_272; \
45829 float16x4_t __s0_272 = __p0_272; \
45830 float16x8_t __s1_272 = __p1_272; \
45831 __ret_272 = vmulx_f16(__s0_272, splat_laneq_f16(__s1_272, __p2_272)); \
45832 __ret_272; \
45833})
45834#else
45835#define vmulx_laneq_f16(__p0_273, __p1_273, __p2_273) __extension__ ({ \
45836 float16x4_t __ret_273; \
45837 float16x4_t __s0_273 = __p0_273; \
45838 float16x8_t __s1_273 = __p1_273; \
45839 float16x4_t __rev0_273; __rev0_273 = __builtin_shufflevector(__s0_273, __s0_273, __lane_reverse_64_16); \
45840 float16x8_t __rev1_273; __rev1_273 = __builtin_shufflevector(__s1_273, __s1_273, __lane_reverse_128_16); \
45841 __ret_273 = __noswap_vmulx_f16(__rev0_273, __noswap_splat_laneq_f16(__rev1_273, __p2_273)); \
45842 __ret_273 = __builtin_shufflevector(__ret_273, __ret_273, __lane_reverse_64_16); \
45843 __ret_273; \
45844})
45845#endif
45846
4584745641#ifdef __LITTLE_ENDIAN__
4584845642#define vmulxq_n_f16(__p0, __p1) __extension__ ({ \
4584945643 float16x8_t __ret; \
......@@ -46068,98 +45862,98 @@ __ai __attribute__((target("fullfp16,neon"))) float16x4_t vsqrt_f16(float16x4_t
4606845862#endif
4606945863
4607045864#ifdef __LITTLE_ENDIAN__
46071#define vsudotq_laneq_s32(__p0_274, __p1_274, __p2_274, __p3_274) __extension__ ({ \
46072 int32x4_t __ret_274; \
46073 int32x4_t __s0_274 = __p0_274; \
46074 int8x16_t __s1_274 = __p1_274; \
46075 uint8x16_t __s2_274 = __p2_274; \
46076 __ret_274 = vusdotq_s32(__s0_274, __builtin_bit_cast(uint8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_274), __p3_274)), __s1_274); \
46077 __ret_274; \
45865#define vsudotq_laneq_s32(__p0_266, __p1_266, __p2_266, __p3_266) __extension__ ({ \
45866 int32x4_t __ret_266; \
45867 int32x4_t __s0_266 = __p0_266; \
45868 int8x16_t __s1_266 = __p1_266; \
45869 uint8x16_t __s2_266 = __p2_266; \
45870 __ret_266 = vusdotq_s32(__s0_266, __builtin_bit_cast(uint8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_266), __p3_266)), __s1_266); \
45871 __ret_266; \
4607845872})
4607945873#else
46080#define vsudotq_laneq_s32(__p0_275, __p1_275, __p2_275, __p3_275) __extension__ ({ \
46081 int32x4_t __ret_275; \
46082 int32x4_t __s0_275 = __p0_275; \
46083 int8x16_t __s1_275 = __p1_275; \
46084 uint8x16_t __s2_275 = __p2_275; \
46085 int32x4_t __rev0_275; __rev0_275 = __builtin_shufflevector(__s0_275, __s0_275, __lane_reverse_128_32); \
46086 int8x16_t __rev1_275; __rev1_275 = __builtin_shufflevector(__s1_275, __s1_275, __lane_reverse_128_8); \
46087 uint8x16_t __rev2_275; __rev2_275 = __builtin_shufflevector(__s2_275, __s2_275, __lane_reverse_128_8); \
46088 __ret_275 = __noswap_vusdotq_s32(__rev0_275, __builtin_bit_cast(uint8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_275), __p3_275)), __rev1_275); \
46089 __ret_275 = __builtin_shufflevector(__ret_275, __ret_275, __lane_reverse_128_32); \
46090 __ret_275; \
45874#define vsudotq_laneq_s32(__p0_267, __p1_267, __p2_267, __p3_267) __extension__ ({ \
45875 int32x4_t __ret_267; \
45876 int32x4_t __s0_267 = __p0_267; \
45877 int8x16_t __s1_267 = __p1_267; \
45878 uint8x16_t __s2_267 = __p2_267; \
45879 int32x4_t __rev0_267; __rev0_267 = __builtin_shufflevector(__s0_267, __s0_267, __lane_reverse_128_32); \
45880 int8x16_t __rev1_267; __rev1_267 = __builtin_shufflevector(__s1_267, __s1_267, __lane_reverse_128_8); \
45881 uint8x16_t __rev2_267; __rev2_267 = __builtin_shufflevector(__s2_267, __s2_267, __lane_reverse_128_8); \
45882 __ret_267 = __noswap_vusdotq_s32(__rev0_267, __builtin_bit_cast(uint8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_267), __p3_267)), __rev1_267); \
45883 __ret_267 = __builtin_shufflevector(__ret_267, __ret_267, __lane_reverse_128_32); \
45884 __ret_267; \
4609145885})
4609245886#endif
4609345887
4609445888#ifdef __LITTLE_ENDIAN__
46095#define vsudot_laneq_s32(__p0_276, __p1_276, __p2_276, __p3_276) __extension__ ({ \
46096 int32x2_t __ret_276; \
46097 int32x2_t __s0_276 = __p0_276; \
46098 int8x8_t __s1_276 = __p1_276; \
46099 uint8x16_t __s2_276 = __p2_276; \
46100 __ret_276 = vusdot_s32(__s0_276, __builtin_bit_cast(uint8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_276), __p3_276)), __s1_276); \
46101 __ret_276; \
45889#define vsudot_laneq_s32(__p0_268, __p1_268, __p2_268, __p3_268) __extension__ ({ \
45890 int32x2_t __ret_268; \
45891 int32x2_t __s0_268 = __p0_268; \
45892 int8x8_t __s1_268 = __p1_268; \
45893 uint8x16_t __s2_268 = __p2_268; \
45894 __ret_268 = vusdot_s32(__s0_268, __builtin_bit_cast(uint8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_268), __p3_268)), __s1_268); \
45895 __ret_268; \
4610245896})
4610345897#else
46104#define vsudot_laneq_s32(__p0_277, __p1_277, __p2_277, __p3_277) __extension__ ({ \
46105 int32x2_t __ret_277; \
46106 int32x2_t __s0_277 = __p0_277; \
46107 int8x8_t __s1_277 = __p1_277; \
46108 uint8x16_t __s2_277 = __p2_277; \
46109 int32x2_t __rev0_277; __rev0_277 = __builtin_shufflevector(__s0_277, __s0_277, __lane_reverse_64_32); \
46110 int8x8_t __rev1_277; __rev1_277 = __builtin_shufflevector(__s1_277, __s1_277, __lane_reverse_64_8); \
46111 uint8x16_t __rev2_277; __rev2_277 = __builtin_shufflevector(__s2_277, __s2_277, __lane_reverse_128_8); \
46112 __ret_277 = __noswap_vusdot_s32(__rev0_277, __builtin_bit_cast(uint8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_277), __p3_277)), __rev1_277); \
46113 __ret_277 = __builtin_shufflevector(__ret_277, __ret_277, __lane_reverse_64_32); \
46114 __ret_277; \
45898#define vsudot_laneq_s32(__p0_269, __p1_269, __p2_269, __p3_269) __extension__ ({ \
45899 int32x2_t __ret_269; \
45900 int32x2_t __s0_269 = __p0_269; \
45901 int8x8_t __s1_269 = __p1_269; \
45902 uint8x16_t __s2_269 = __p2_269; \
45903 int32x2_t __rev0_269; __rev0_269 = __builtin_shufflevector(__s0_269, __s0_269, __lane_reverse_64_32); \
45904 int8x8_t __rev1_269; __rev1_269 = __builtin_shufflevector(__s1_269, __s1_269, __lane_reverse_64_8); \
45905 uint8x16_t __rev2_269; __rev2_269 = __builtin_shufflevector(__s2_269, __s2_269, __lane_reverse_128_8); \
45906 __ret_269 = __noswap_vusdot_s32(__rev0_269, __builtin_bit_cast(uint8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_269), __p3_269)), __rev1_269); \
45907 __ret_269 = __builtin_shufflevector(__ret_269, __ret_269, __lane_reverse_64_32); \
45908 __ret_269; \
4611545909})
4611645910#endif
4611745911
4611845912#ifdef __LITTLE_ENDIAN__
46119#define vusdotq_laneq_s32(__p0_278, __p1_278, __p2_278, __p3_278) __extension__ ({ \
46120 int32x4_t __ret_278; \
46121 int32x4_t __s0_278 = __p0_278; \
46122 uint8x16_t __s1_278 = __p1_278; \
46123 int8x16_t __s2_278 = __p2_278; \
46124 __ret_278 = vusdotq_s32(__s0_278, __s1_278, __builtin_bit_cast(int8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_278), __p3_278))); \
46125 __ret_278; \
45913#define vusdotq_laneq_s32(__p0_270, __p1_270, __p2_270, __p3_270) __extension__ ({ \
45914 int32x4_t __ret_270; \
45915 int32x4_t __s0_270 = __p0_270; \
45916 uint8x16_t __s1_270 = __p1_270; \
45917 int8x16_t __s2_270 = __p2_270; \
45918 __ret_270 = vusdotq_s32(__s0_270, __s1_270, __builtin_bit_cast(int8x16_t, splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_270), __p3_270))); \
45919 __ret_270; \
4612645920})
4612745921#else
46128#define vusdotq_laneq_s32(__p0_279, __p1_279, __p2_279, __p3_279) __extension__ ({ \
46129 int32x4_t __ret_279; \
46130 int32x4_t __s0_279 = __p0_279; \
46131 uint8x16_t __s1_279 = __p1_279; \
46132 int8x16_t __s2_279 = __p2_279; \
46133 int32x4_t __rev0_279; __rev0_279 = __builtin_shufflevector(__s0_279, __s0_279, __lane_reverse_128_32); \
46134 uint8x16_t __rev1_279; __rev1_279 = __builtin_shufflevector(__s1_279, __s1_279, __lane_reverse_128_8); \
46135 int8x16_t __rev2_279; __rev2_279 = __builtin_shufflevector(__s2_279, __s2_279, __lane_reverse_128_8); \
46136 __ret_279 = __noswap_vusdotq_s32(__rev0_279, __rev1_279, __builtin_bit_cast(int8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_279), __p3_279))); \
46137 __ret_279 = __builtin_shufflevector(__ret_279, __ret_279, __lane_reverse_128_32); \
46138 __ret_279; \
45922#define vusdotq_laneq_s32(__p0_271, __p1_271, __p2_271, __p3_271) __extension__ ({ \
45923 int32x4_t __ret_271; \
45924 int32x4_t __s0_271 = __p0_271; \
45925 uint8x16_t __s1_271 = __p1_271; \
45926 int8x16_t __s2_271 = __p2_271; \
45927 int32x4_t __rev0_271; __rev0_271 = __builtin_shufflevector(__s0_271, __s0_271, __lane_reverse_128_32); \
45928 uint8x16_t __rev1_271; __rev1_271 = __builtin_shufflevector(__s1_271, __s1_271, __lane_reverse_128_8); \
45929 int8x16_t __rev2_271; __rev2_271 = __builtin_shufflevector(__s2_271, __s2_271, __lane_reverse_128_8); \
45930 __ret_271 = __noswap_vusdotq_s32(__rev0_271, __rev1_271, __builtin_bit_cast(int8x16_t, __noswap_splatq_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_271), __p3_271))); \
45931 __ret_271 = __builtin_shufflevector(__ret_271, __ret_271, __lane_reverse_128_32); \
45932 __ret_271; \
4613945933})
4614045934#endif
4614145935
4614245936#ifdef __LITTLE_ENDIAN__
46143#define vusdot_laneq_s32(__p0_280, __p1_280, __p2_280, __p3_280) __extension__ ({ \
46144 int32x2_t __ret_280; \
46145 int32x2_t __s0_280 = __p0_280; \
46146 uint8x8_t __s1_280 = __p1_280; \
46147 int8x16_t __s2_280 = __p2_280; \
46148 __ret_280 = vusdot_s32(__s0_280, __s1_280, __builtin_bit_cast(int8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_280), __p3_280))); \
46149 __ret_280; \
45937#define vusdot_laneq_s32(__p0_272, __p1_272, __p2_272, __p3_272) __extension__ ({ \
45938 int32x2_t __ret_272; \
45939 int32x2_t __s0_272 = __p0_272; \
45940 uint8x8_t __s1_272 = __p1_272; \
45941 int8x16_t __s2_272 = __p2_272; \
45942 __ret_272 = vusdot_s32(__s0_272, __s1_272, __builtin_bit_cast(int8x8_t, splat_laneq_s32(__builtin_bit_cast(int32x4_t, __s2_272), __p3_272))); \
45943 __ret_272; \
4615045944})
4615145945#else
46152#define vusdot_laneq_s32(__p0_281, __p1_281, __p2_281, __p3_281) __extension__ ({ \
46153 int32x2_t __ret_281; \
46154 int32x2_t __s0_281 = __p0_281; \
46155 uint8x8_t __s1_281 = __p1_281; \
46156 int8x16_t __s2_281 = __p2_281; \
46157 int32x2_t __rev0_281; __rev0_281 = __builtin_shufflevector(__s0_281, __s0_281, __lane_reverse_64_32); \
46158 uint8x8_t __rev1_281; __rev1_281 = __builtin_shufflevector(__s1_281, __s1_281, __lane_reverse_64_8); \
46159 int8x16_t __rev2_281; __rev2_281 = __builtin_shufflevector(__s2_281, __s2_281, __lane_reverse_128_8); \
46160 __ret_281 = __noswap_vusdot_s32(__rev0_281, __rev1_281, __builtin_bit_cast(int8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_281), __p3_281))); \
46161 __ret_281 = __builtin_shufflevector(__ret_281, __ret_281, __lane_reverse_64_32); \
46162 __ret_281; \
45946#define vusdot_laneq_s32(__p0_273, __p1_273, __p2_273, __p3_273) __extension__ ({ \
45947 int32x2_t __ret_273; \
45948 int32x2_t __s0_273 = __p0_273; \
45949 uint8x8_t __s1_273 = __p1_273; \
45950 int8x16_t __s2_273 = __p2_273; \
45951 int32x2_t __rev0_273; __rev0_273 = __builtin_shufflevector(__s0_273, __s0_273, __lane_reverse_64_32); \
45952 uint8x8_t __rev1_273; __rev1_273 = __builtin_shufflevector(__s1_273, __s1_273, __lane_reverse_64_8); \
45953 int8x16_t __rev2_273; __rev2_273 = __builtin_shufflevector(__s2_273, __s2_273, __lane_reverse_128_8); \
45954 __ret_273 = __noswap_vusdot_s32(__rev0_273, __rev1_273, __builtin_bit_cast(int8x8_t, __noswap_splat_laneq_s32(__builtin_bit_cast(int32x4_t, __rev2_273), __p3_273))); \
45955 __ret_273 = __builtin_shufflevector(__ret_273, __ret_273, __lane_reverse_64_32); \
45956 __ret_273; \
4616345957})
4616445958#endif
4616545959
......@@ -48579,974 +48373,1058 @@ __ai __attribute__((target("neon"))) float64x2_t vcombine_f64(float64x1_t __p0,
4857948373#endif
4858048374
4858148375#ifdef __LITTLE_ENDIAN__
48582#define vcopyq_lane_p8(__p0_282, __p1_282, __p2_282, __p3_282) __extension__ ({ \
48583 poly8x16_t __ret_282; \
48584 poly8x16_t __s0_282 = __p0_282; \
48585 poly8x8_t __s2_282 = __p2_282; \
48586 __ret_282 = vsetq_lane_p8(vget_lane_p8(__s2_282, __p3_282), __s0_282, __p1_282); \
48376#define vcopyq_lane_p8(__p0_274, __p1_274, __p2_274, __p3_274) __extension__ ({ \
48377 poly8x16_t __ret_274; \
48378 poly8x16_t __s0_274 = __p0_274; \
48379 poly8x8_t __s2_274 = __p2_274; \
48380 __ret_274 = vsetq_lane_p8(vget_lane_p8(__s2_274, __p3_274), __s0_274, __p1_274); \
48381 __ret_274; \
48382})
48383#else
48384#define vcopyq_lane_p8(__p0_275, __p1_275, __p2_275, __p3_275) __extension__ ({ \
48385 poly8x16_t __ret_275; \
48386 poly8x16_t __s0_275 = __p0_275; \
48387 poly8x8_t __s2_275 = __p2_275; \
48388 poly8x16_t __rev0_275; __rev0_275 = __builtin_shufflevector(__s0_275, __s0_275, __lane_reverse_128_8); \
48389 poly8x8_t __rev2_275; __rev2_275 = __builtin_shufflevector(__s2_275, __s2_275, __lane_reverse_64_8); \
48390 __ret_275 = __noswap_vsetq_lane_p8(__noswap_vget_lane_p8(__rev2_275, __p3_275), __rev0_275, __p1_275); \
48391 __ret_275 = __builtin_shufflevector(__ret_275, __ret_275, __lane_reverse_128_8); \
48392 __ret_275; \
48393})
48394#endif
48395
48396#ifdef __LITTLE_ENDIAN__
48397#define vcopyq_lane_p16(__p0_276, __p1_276, __p2_276, __p3_276) __extension__ ({ \
48398 poly16x8_t __ret_276; \
48399 poly16x8_t __s0_276 = __p0_276; \
48400 poly16x4_t __s2_276 = __p2_276; \
48401 __ret_276 = vsetq_lane_p16(vget_lane_p16(__s2_276, __p3_276), __s0_276, __p1_276); \
48402 __ret_276; \
48403})
48404#else
48405#define vcopyq_lane_p16(__p0_277, __p1_277, __p2_277, __p3_277) __extension__ ({ \
48406 poly16x8_t __ret_277; \
48407 poly16x8_t __s0_277 = __p0_277; \
48408 poly16x4_t __s2_277 = __p2_277; \
48409 poly16x8_t __rev0_277; __rev0_277 = __builtin_shufflevector(__s0_277, __s0_277, __lane_reverse_128_16); \
48410 poly16x4_t __rev2_277; __rev2_277 = __builtin_shufflevector(__s2_277, __s2_277, __lane_reverse_64_16); \
48411 __ret_277 = __noswap_vsetq_lane_p16(__noswap_vget_lane_p16(__rev2_277, __p3_277), __rev0_277, __p1_277); \
48412 __ret_277 = __builtin_shufflevector(__ret_277, __ret_277, __lane_reverse_128_16); \
48413 __ret_277; \
48414})
48415#endif
48416
48417#ifdef __LITTLE_ENDIAN__
48418#define vcopyq_lane_u8(__p0_278, __p1_278, __p2_278, __p3_278) __extension__ ({ \
48419 uint8x16_t __ret_278; \
48420 uint8x16_t __s0_278 = __p0_278; \
48421 uint8x8_t __s2_278 = __p2_278; \
48422 __ret_278 = vsetq_lane_u8(vget_lane_u8(__s2_278, __p3_278), __s0_278, __p1_278); \
48423 __ret_278; \
48424})
48425#else
48426#define vcopyq_lane_u8(__p0_279, __p1_279, __p2_279, __p3_279) __extension__ ({ \
48427 uint8x16_t __ret_279; \
48428 uint8x16_t __s0_279 = __p0_279; \
48429 uint8x8_t __s2_279 = __p2_279; \
48430 uint8x16_t __rev0_279; __rev0_279 = __builtin_shufflevector(__s0_279, __s0_279, __lane_reverse_128_8); \
48431 uint8x8_t __rev2_279; __rev2_279 = __builtin_shufflevector(__s2_279, __s2_279, __lane_reverse_64_8); \
48432 __ret_279 = __noswap_vsetq_lane_u8(__noswap_vget_lane_u8(__rev2_279, __p3_279), __rev0_279, __p1_279); \
48433 __ret_279 = __builtin_shufflevector(__ret_279, __ret_279, __lane_reverse_128_8); \
48434 __ret_279; \
48435})
48436#endif
48437
48438#ifdef __LITTLE_ENDIAN__
48439#define vcopyq_lane_u32(__p0_280, __p1_280, __p2_280, __p3_280) __extension__ ({ \
48440 uint32x4_t __ret_280; \
48441 uint32x4_t __s0_280 = __p0_280; \
48442 uint32x2_t __s2_280 = __p2_280; \
48443 __ret_280 = vsetq_lane_u32(vget_lane_u32(__s2_280, __p3_280), __s0_280, __p1_280); \
48444 __ret_280; \
48445})
48446#else
48447#define vcopyq_lane_u32(__p0_281, __p1_281, __p2_281, __p3_281) __extension__ ({ \
48448 uint32x4_t __ret_281; \
48449 uint32x4_t __s0_281 = __p0_281; \
48450 uint32x2_t __s2_281 = __p2_281; \
48451 uint32x4_t __rev0_281; __rev0_281 = __builtin_shufflevector(__s0_281, __s0_281, __lane_reverse_128_32); \
48452 uint32x2_t __rev2_281; __rev2_281 = __builtin_shufflevector(__s2_281, __s2_281, __lane_reverse_64_32); \
48453 __ret_281 = __noswap_vsetq_lane_u32(__noswap_vget_lane_u32(__rev2_281, __p3_281), __rev0_281, __p1_281); \
48454 __ret_281 = __builtin_shufflevector(__ret_281, __ret_281, __lane_reverse_128_32); \
48455 __ret_281; \
48456})
48457#endif
48458
48459#ifdef __LITTLE_ENDIAN__
48460#define vcopyq_lane_u64(__p0_282, __p1_282, __p2_282, __p3_282) __extension__ ({ \
48461 uint64x2_t __ret_282; \
48462 uint64x2_t __s0_282 = __p0_282; \
48463 uint64x1_t __s2_282 = __p2_282; \
48464 __ret_282 = vsetq_lane_u64(vget_lane_u64(__s2_282, __p3_282), __s0_282, __p1_282); \
4858748465 __ret_282; \
4858848466})
4858948467#else
48590#define vcopyq_lane_p8(__p0_283, __p1_283, __p2_283, __p3_283) __extension__ ({ \
48591 poly8x16_t __ret_283; \
48592 poly8x16_t __s0_283 = __p0_283; \
48593 poly8x8_t __s2_283 = __p2_283; \
48594 poly8x16_t __rev0_283; __rev0_283 = __builtin_shufflevector(__s0_283, __s0_283, __lane_reverse_128_8); \
48595 poly8x8_t __rev2_283; __rev2_283 = __builtin_shufflevector(__s2_283, __s2_283, __lane_reverse_64_8); \
48596 __ret_283 = __noswap_vsetq_lane_p8(__noswap_vget_lane_p8(__rev2_283, __p3_283), __rev0_283, __p1_283); \
48597 __ret_283 = __builtin_shufflevector(__ret_283, __ret_283, __lane_reverse_128_8); \
48468#define vcopyq_lane_u64(__p0_283, __p1_283, __p2_283, __p3_283) __extension__ ({ \
48469 uint64x2_t __ret_283; \
48470 uint64x2_t __s0_283 = __p0_283; \
48471 uint64x1_t __s2_283 = __p2_283; \
48472 uint64x2_t __rev0_283; __rev0_283 = __builtin_shufflevector(__s0_283, __s0_283, __lane_reverse_128_64); \
48473 __ret_283 = __noswap_vsetq_lane_u64(vget_lane_u64(__s2_283, __p3_283), __rev0_283, __p1_283); \
48474 __ret_283 = __builtin_shufflevector(__ret_283, __ret_283, __lane_reverse_128_64); \
4859848475 __ret_283; \
4859948476})
4860048477#endif
4860148478
4860248479#ifdef __LITTLE_ENDIAN__
48603#define vcopyq_lane_p16(__p0_284, __p1_284, __p2_284, __p3_284) __extension__ ({ \
48604 poly16x8_t __ret_284; \
48605 poly16x8_t __s0_284 = __p0_284; \
48606 poly16x4_t __s2_284 = __p2_284; \
48607 __ret_284 = vsetq_lane_p16(vget_lane_p16(__s2_284, __p3_284), __s0_284, __p1_284); \
48480#define vcopyq_lane_u16(__p0_284, __p1_284, __p2_284, __p3_284) __extension__ ({ \
48481 uint16x8_t __ret_284; \
48482 uint16x8_t __s0_284 = __p0_284; \
48483 uint16x4_t __s2_284 = __p2_284; \
48484 __ret_284 = vsetq_lane_u16(vget_lane_u16(__s2_284, __p3_284), __s0_284, __p1_284); \
4860848485 __ret_284; \
4860948486})
4861048487#else
48611#define vcopyq_lane_p16(__p0_285, __p1_285, __p2_285, __p3_285) __extension__ ({ \
48612 poly16x8_t __ret_285; \
48613 poly16x8_t __s0_285 = __p0_285; \
48614 poly16x4_t __s2_285 = __p2_285; \
48615 poly16x8_t __rev0_285; __rev0_285 = __builtin_shufflevector(__s0_285, __s0_285, __lane_reverse_128_16); \
48616 poly16x4_t __rev2_285; __rev2_285 = __builtin_shufflevector(__s2_285, __s2_285, __lane_reverse_64_16); \
48617 __ret_285 = __noswap_vsetq_lane_p16(__noswap_vget_lane_p16(__rev2_285, __p3_285), __rev0_285, __p1_285); \
48488#define vcopyq_lane_u16(__p0_285, __p1_285, __p2_285, __p3_285) __extension__ ({ \
48489 uint16x8_t __ret_285; \
48490 uint16x8_t __s0_285 = __p0_285; \
48491 uint16x4_t __s2_285 = __p2_285; \
48492 uint16x8_t __rev0_285; __rev0_285 = __builtin_shufflevector(__s0_285, __s0_285, __lane_reverse_128_16); \
48493 uint16x4_t __rev2_285; __rev2_285 = __builtin_shufflevector(__s2_285, __s2_285, __lane_reverse_64_16); \
48494 __ret_285 = __noswap_vsetq_lane_u16(__noswap_vget_lane_u16(__rev2_285, __p3_285), __rev0_285, __p1_285); \
4861848495 __ret_285 = __builtin_shufflevector(__ret_285, __ret_285, __lane_reverse_128_16); \
4861948496 __ret_285; \
4862048497})
4862148498#endif
4862248499
4862348500#ifdef __LITTLE_ENDIAN__
48624#define vcopyq_lane_u8(__p0_286, __p1_286, __p2_286, __p3_286) __extension__ ({ \
48625 uint8x16_t __ret_286; \
48626 uint8x16_t __s0_286 = __p0_286; \
48627 uint8x8_t __s2_286 = __p2_286; \
48628 __ret_286 = vsetq_lane_u8(vget_lane_u8(__s2_286, __p3_286), __s0_286, __p1_286); \
48501#define vcopyq_lane_s8(__p0_286, __p1_286, __p2_286, __p3_286) __extension__ ({ \
48502 int8x16_t __ret_286; \
48503 int8x16_t __s0_286 = __p0_286; \
48504 int8x8_t __s2_286 = __p2_286; \
48505 __ret_286 = vsetq_lane_s8(vget_lane_s8(__s2_286, __p3_286), __s0_286, __p1_286); \
4862948506 __ret_286; \
4863048507})
4863148508#else
48632#define vcopyq_lane_u8(__p0_287, __p1_287, __p2_287, __p3_287) __extension__ ({ \
48633 uint8x16_t __ret_287; \
48634 uint8x16_t __s0_287 = __p0_287; \
48635 uint8x8_t __s2_287 = __p2_287; \
48636 uint8x16_t __rev0_287; __rev0_287 = __builtin_shufflevector(__s0_287, __s0_287, __lane_reverse_128_8); \
48637 uint8x8_t __rev2_287; __rev2_287 = __builtin_shufflevector(__s2_287, __s2_287, __lane_reverse_64_8); \
48638 __ret_287 = __noswap_vsetq_lane_u8(__noswap_vget_lane_u8(__rev2_287, __p3_287), __rev0_287, __p1_287); \
48509#define vcopyq_lane_s8(__p0_287, __p1_287, __p2_287, __p3_287) __extension__ ({ \
48510 int8x16_t __ret_287; \
48511 int8x16_t __s0_287 = __p0_287; \
48512 int8x8_t __s2_287 = __p2_287; \
48513 int8x16_t __rev0_287; __rev0_287 = __builtin_shufflevector(__s0_287, __s0_287, __lane_reverse_128_8); \
48514 int8x8_t __rev2_287; __rev2_287 = __builtin_shufflevector(__s2_287, __s2_287, __lane_reverse_64_8); \
48515 __ret_287 = __noswap_vsetq_lane_s8(__noswap_vget_lane_s8(__rev2_287, __p3_287), __rev0_287, __p1_287); \
4863948516 __ret_287 = __builtin_shufflevector(__ret_287, __ret_287, __lane_reverse_128_8); \
4864048517 __ret_287; \
4864148518})
4864248519#endif
4864348520
4864448521#ifdef __LITTLE_ENDIAN__
48645#define vcopyq_lane_u32(__p0_288, __p1_288, __p2_288, __p3_288) __extension__ ({ \
48646 uint32x4_t __ret_288; \
48647 uint32x4_t __s0_288 = __p0_288; \
48648 uint32x2_t __s2_288 = __p2_288; \
48649 __ret_288 = vsetq_lane_u32(vget_lane_u32(__s2_288, __p3_288), __s0_288, __p1_288); \
48522#define vcopyq_lane_f32(__p0_288, __p1_288, __p2_288, __p3_288) __extension__ ({ \
48523 float32x4_t __ret_288; \
48524 float32x4_t __s0_288 = __p0_288; \
48525 float32x2_t __s2_288 = __p2_288; \
48526 __ret_288 = vsetq_lane_f32(vget_lane_f32(__s2_288, __p3_288), __s0_288, __p1_288); \
4865048527 __ret_288; \
4865148528})
4865248529#else
48653#define vcopyq_lane_u32(__p0_289, __p1_289, __p2_289, __p3_289) __extension__ ({ \
48654 uint32x4_t __ret_289; \
48655 uint32x4_t __s0_289 = __p0_289; \
48656 uint32x2_t __s2_289 = __p2_289; \
48657 uint32x4_t __rev0_289; __rev0_289 = __builtin_shufflevector(__s0_289, __s0_289, __lane_reverse_128_32); \
48658 uint32x2_t __rev2_289; __rev2_289 = __builtin_shufflevector(__s2_289, __s2_289, __lane_reverse_64_32); \
48659 __ret_289 = __noswap_vsetq_lane_u32(__noswap_vget_lane_u32(__rev2_289, __p3_289), __rev0_289, __p1_289); \
48530#define vcopyq_lane_f32(__p0_289, __p1_289, __p2_289, __p3_289) __extension__ ({ \
48531 float32x4_t __ret_289; \
48532 float32x4_t __s0_289 = __p0_289; \
48533 float32x2_t __s2_289 = __p2_289; \
48534 float32x4_t __rev0_289; __rev0_289 = __builtin_shufflevector(__s0_289, __s0_289, __lane_reverse_128_32); \
48535 float32x2_t __rev2_289; __rev2_289 = __builtin_shufflevector(__s2_289, __s2_289, __lane_reverse_64_32); \
48536 __ret_289 = __noswap_vsetq_lane_f32(__noswap_vget_lane_f32(__rev2_289, __p3_289), __rev0_289, __p1_289); \
4866048537 __ret_289 = __builtin_shufflevector(__ret_289, __ret_289, __lane_reverse_128_32); \
4866148538 __ret_289; \
4866248539})
4866348540#endif
4866448541
4866548542#ifdef __LITTLE_ENDIAN__
48666#define vcopyq_lane_u64(__p0_290, __p1_290, __p2_290, __p3_290) __extension__ ({ \
48667 uint64x2_t __ret_290; \
48668 uint64x2_t __s0_290 = __p0_290; \
48669 uint64x1_t __s2_290 = __p2_290; \
48670 __ret_290 = vsetq_lane_u64(vget_lane_u64(__s2_290, __p3_290), __s0_290, __p1_290); \
48543#define vcopyq_lane_s32(__p0_290, __p1_290, __p2_290, __p3_290) __extension__ ({ \
48544 int32x4_t __ret_290; \
48545 int32x4_t __s0_290 = __p0_290; \
48546 int32x2_t __s2_290 = __p2_290; \
48547 __ret_290 = vsetq_lane_s32(vget_lane_s32(__s2_290, __p3_290), __s0_290, __p1_290); \
4867148548 __ret_290; \
4867248549})
4867348550#else
48674#define vcopyq_lane_u64(__p0_291, __p1_291, __p2_291, __p3_291) __extension__ ({ \
48675 uint64x2_t __ret_291; \
48676 uint64x2_t __s0_291 = __p0_291; \
48677 uint64x1_t __s2_291 = __p2_291; \
48678 uint64x2_t __rev0_291; __rev0_291 = __builtin_shufflevector(__s0_291, __s0_291, __lane_reverse_128_64); \
48679 __ret_291 = __noswap_vsetq_lane_u64(vget_lane_u64(__s2_291, __p3_291), __rev0_291, __p1_291); \
48680 __ret_291 = __builtin_shufflevector(__ret_291, __ret_291, __lane_reverse_128_64); \
48551#define vcopyq_lane_s32(__p0_291, __p1_291, __p2_291, __p3_291) __extension__ ({ \
48552 int32x4_t __ret_291; \
48553 int32x4_t __s0_291 = __p0_291; \
48554 int32x2_t __s2_291 = __p2_291; \
48555 int32x4_t __rev0_291; __rev0_291 = __builtin_shufflevector(__s0_291, __s0_291, __lane_reverse_128_32); \
48556 int32x2_t __rev2_291; __rev2_291 = __builtin_shufflevector(__s2_291, __s2_291, __lane_reverse_64_32); \
48557 __ret_291 = __noswap_vsetq_lane_s32(__noswap_vget_lane_s32(__rev2_291, __p3_291), __rev0_291, __p1_291); \
48558 __ret_291 = __builtin_shufflevector(__ret_291, __ret_291, __lane_reverse_128_32); \
4868148559 __ret_291; \
4868248560})
4868348561#endif
4868448562
4868548563#ifdef __LITTLE_ENDIAN__
48686#define vcopyq_lane_u16(__p0_292, __p1_292, __p2_292, __p3_292) __extension__ ({ \
48687 uint16x8_t __ret_292; \
48688 uint16x8_t __s0_292 = __p0_292; \
48689 uint16x4_t __s2_292 = __p2_292; \
48690 __ret_292 = vsetq_lane_u16(vget_lane_u16(__s2_292, __p3_292), __s0_292, __p1_292); \
48564#define vcopyq_lane_s64(__p0_292, __p1_292, __p2_292, __p3_292) __extension__ ({ \
48565 int64x2_t __ret_292; \
48566 int64x2_t __s0_292 = __p0_292; \
48567 int64x1_t __s2_292 = __p2_292; \
48568 __ret_292 = vsetq_lane_s64(vget_lane_s64(__s2_292, __p3_292), __s0_292, __p1_292); \
4869148569 __ret_292; \
4869248570})
4869348571#else
48694#define vcopyq_lane_u16(__p0_293, __p1_293, __p2_293, __p3_293) __extension__ ({ \
48695 uint16x8_t __ret_293; \
48696 uint16x8_t __s0_293 = __p0_293; \
48697 uint16x4_t __s2_293 = __p2_293; \
48698 uint16x8_t __rev0_293; __rev0_293 = __builtin_shufflevector(__s0_293, __s0_293, __lane_reverse_128_16); \
48699 uint16x4_t __rev2_293; __rev2_293 = __builtin_shufflevector(__s2_293, __s2_293, __lane_reverse_64_16); \
48700 __ret_293 = __noswap_vsetq_lane_u16(__noswap_vget_lane_u16(__rev2_293, __p3_293), __rev0_293, __p1_293); \
48701 __ret_293 = __builtin_shufflevector(__ret_293, __ret_293, __lane_reverse_128_16); \
48572#define vcopyq_lane_s64(__p0_293, __p1_293, __p2_293, __p3_293) __extension__ ({ \
48573 int64x2_t __ret_293; \
48574 int64x2_t __s0_293 = __p0_293; \
48575 int64x1_t __s2_293 = __p2_293; \
48576 int64x2_t __rev0_293; __rev0_293 = __builtin_shufflevector(__s0_293, __s0_293, __lane_reverse_128_64); \
48577 __ret_293 = __noswap_vsetq_lane_s64(vget_lane_s64(__s2_293, __p3_293), __rev0_293, __p1_293); \
48578 __ret_293 = __builtin_shufflevector(__ret_293, __ret_293, __lane_reverse_128_64); \
4870248579 __ret_293; \
4870348580})
4870448581#endif
4870548582
4870648583#ifdef __LITTLE_ENDIAN__
48707#define vcopyq_lane_s8(__p0_294, __p1_294, __p2_294, __p3_294) __extension__ ({ \
48708 int8x16_t __ret_294; \
48709 int8x16_t __s0_294 = __p0_294; \
48710 int8x8_t __s2_294 = __p2_294; \
48711 __ret_294 = vsetq_lane_s8(vget_lane_s8(__s2_294, __p3_294), __s0_294, __p1_294); \
48584#define vcopyq_lane_mf8(__p0_294, __p1_294, __p2_294, __p3_294) __extension__ ({ \
48585 mfloat8x16_t __ret_294; \
48586 mfloat8x16_t __s0_294 = __p0_294; \
48587 mfloat8x8_t __s2_294 = __p2_294; \
48588 __ret_294 = vsetq_lane_mf8(vget_lane_mf8(__s2_294, __p3_294), __s0_294, __p1_294); \
4871248589 __ret_294; \
4871348590})
4871448591#else
48715#define vcopyq_lane_s8(__p0_295, __p1_295, __p2_295, __p3_295) __extension__ ({ \
48716 int8x16_t __ret_295; \
48717 int8x16_t __s0_295 = __p0_295; \
48718 int8x8_t __s2_295 = __p2_295; \
48719 int8x16_t __rev0_295; __rev0_295 = __builtin_shufflevector(__s0_295, __s0_295, __lane_reverse_128_8); \
48720 int8x8_t __rev2_295; __rev2_295 = __builtin_shufflevector(__s2_295, __s2_295, __lane_reverse_64_8); \
48721 __ret_295 = __noswap_vsetq_lane_s8(__noswap_vget_lane_s8(__rev2_295, __p3_295), __rev0_295, __p1_295); \
48592#define vcopyq_lane_mf8(__p0_295, __p1_295, __p2_295, __p3_295) __extension__ ({ \
48593 mfloat8x16_t __ret_295; \
48594 mfloat8x16_t __s0_295 = __p0_295; \
48595 mfloat8x8_t __s2_295 = __p2_295; \
48596 mfloat8x16_t __rev0_295; __rev0_295 = __builtin_shufflevector(__s0_295, __s0_295, __lane_reverse_128_8); \
48597 mfloat8x8_t __rev2_295; __rev2_295 = __builtin_shufflevector(__s2_295, __s2_295, __lane_reverse_64_8); \
48598 __ret_295 = __noswap_vsetq_lane_mf8(__noswap_vget_lane_mf8(__rev2_295, __p3_295), __rev0_295, __p1_295); \
4872248599 __ret_295 = __builtin_shufflevector(__ret_295, __ret_295, __lane_reverse_128_8); \
4872348600 __ret_295; \
4872448601})
4872548602#endif
4872648603
4872748604#ifdef __LITTLE_ENDIAN__
48728#define vcopyq_lane_f32(__p0_296, __p1_296, __p2_296, __p3_296) __extension__ ({ \
48729 float32x4_t __ret_296; \
48730 float32x4_t __s0_296 = __p0_296; \
48731 float32x2_t __s2_296 = __p2_296; \
48732 __ret_296 = vsetq_lane_f32(vget_lane_f32(__s2_296, __p3_296), __s0_296, __p1_296); \
48605#define vcopyq_lane_s16(__p0_296, __p1_296, __p2_296, __p3_296) __extension__ ({ \
48606 int16x8_t __ret_296; \
48607 int16x8_t __s0_296 = __p0_296; \
48608 int16x4_t __s2_296 = __p2_296; \
48609 __ret_296 = vsetq_lane_s16(vget_lane_s16(__s2_296, __p3_296), __s0_296, __p1_296); \
4873348610 __ret_296; \
4873448611})
4873548612#else
48736#define vcopyq_lane_f32(__p0_297, __p1_297, __p2_297, __p3_297) __extension__ ({ \
48737 float32x4_t __ret_297; \
48738 float32x4_t __s0_297 = __p0_297; \
48739 float32x2_t __s2_297 = __p2_297; \
48740 float32x4_t __rev0_297; __rev0_297 = __builtin_shufflevector(__s0_297, __s0_297, __lane_reverse_128_32); \
48741 float32x2_t __rev2_297; __rev2_297 = __builtin_shufflevector(__s2_297, __s2_297, __lane_reverse_64_32); \
48742 __ret_297 = __noswap_vsetq_lane_f32(__noswap_vget_lane_f32(__rev2_297, __p3_297), __rev0_297, __p1_297); \
48743 __ret_297 = __builtin_shufflevector(__ret_297, __ret_297, __lane_reverse_128_32); \
48613#define vcopyq_lane_s16(__p0_297, __p1_297, __p2_297, __p3_297) __extension__ ({ \
48614 int16x8_t __ret_297; \
48615 int16x8_t __s0_297 = __p0_297; \
48616 int16x4_t __s2_297 = __p2_297; \
48617 int16x8_t __rev0_297; __rev0_297 = __builtin_shufflevector(__s0_297, __s0_297, __lane_reverse_128_16); \
48618 int16x4_t __rev2_297; __rev2_297 = __builtin_shufflevector(__s2_297, __s2_297, __lane_reverse_64_16); \
48619 __ret_297 = __noswap_vsetq_lane_s16(__noswap_vget_lane_s16(__rev2_297, __p3_297), __rev0_297, __p1_297); \
48620 __ret_297 = __builtin_shufflevector(__ret_297, __ret_297, __lane_reverse_128_16); \
4874448621 __ret_297; \
4874548622})
4874648623#endif
4874748624
4874848625#ifdef __LITTLE_ENDIAN__
48749#define vcopyq_lane_s32(__p0_298, __p1_298, __p2_298, __p3_298) __extension__ ({ \
48750 int32x4_t __ret_298; \
48751 int32x4_t __s0_298 = __p0_298; \
48752 int32x2_t __s2_298 = __p2_298; \
48753 __ret_298 = vsetq_lane_s32(vget_lane_s32(__s2_298, __p3_298), __s0_298, __p1_298); \
48626#define vcopyq_lane_bf16(__p0_298, __p1_298, __p2_298, __p3_298) __extension__ ({ \
48627 bfloat16x8_t __ret_298; \
48628 bfloat16x8_t __s0_298 = __p0_298; \
48629 bfloat16x4_t __s2_298 = __p2_298; \
48630 __ret_298 = vsetq_lane_bf16(vget_lane_bf16(__s2_298, __p3_298), __s0_298, __p1_298); \
4875448631 __ret_298; \
4875548632})
4875648633#else
48757#define vcopyq_lane_s32(__p0_299, __p1_299, __p2_299, __p3_299) __extension__ ({ \
48758 int32x4_t __ret_299; \
48759 int32x4_t __s0_299 = __p0_299; \
48760 int32x2_t __s2_299 = __p2_299; \
48761 int32x4_t __rev0_299; __rev0_299 = __builtin_shufflevector(__s0_299, __s0_299, __lane_reverse_128_32); \
48762 int32x2_t __rev2_299; __rev2_299 = __builtin_shufflevector(__s2_299, __s2_299, __lane_reverse_64_32); \
48763 __ret_299 = __noswap_vsetq_lane_s32(__noswap_vget_lane_s32(__rev2_299, __p3_299), __rev0_299, __p1_299); \
48764 __ret_299 = __builtin_shufflevector(__ret_299, __ret_299, __lane_reverse_128_32); \
48634#define vcopyq_lane_bf16(__p0_299, __p1_299, __p2_299, __p3_299) __extension__ ({ \
48635 bfloat16x8_t __ret_299; \
48636 bfloat16x8_t __s0_299 = __p0_299; \
48637 bfloat16x4_t __s2_299 = __p2_299; \
48638 bfloat16x8_t __rev0_299; __rev0_299 = __builtin_shufflevector(__s0_299, __s0_299, __lane_reverse_128_16); \
48639 bfloat16x4_t __rev2_299; __rev2_299 = __builtin_shufflevector(__s2_299, __s2_299, __lane_reverse_64_16); \
48640 __ret_299 = __noswap_vsetq_lane_bf16(__noswap_vget_lane_bf16(__rev2_299, __p3_299), __rev0_299, __p1_299); \
48641 __ret_299 = __builtin_shufflevector(__ret_299, __ret_299, __lane_reverse_128_16); \
4876548642 __ret_299; \
4876648643})
4876748644#endif
4876848645
4876948646#ifdef __LITTLE_ENDIAN__
48770#define vcopyq_lane_s64(__p0_300, __p1_300, __p2_300, __p3_300) __extension__ ({ \
48771 int64x2_t __ret_300; \
48772 int64x2_t __s0_300 = __p0_300; \
48773 int64x1_t __s2_300 = __p2_300; \
48774 __ret_300 = vsetq_lane_s64(vget_lane_s64(__s2_300, __p3_300), __s0_300, __p1_300); \
48647#define vcopy_lane_p8(__p0_300, __p1_300, __p2_300, __p3_300) __extension__ ({ \
48648 poly8x8_t __ret_300; \
48649 poly8x8_t __s0_300 = __p0_300; \
48650 poly8x8_t __s2_300 = __p2_300; \
48651 __ret_300 = vset_lane_p8(vget_lane_p8(__s2_300, __p3_300), __s0_300, __p1_300); \
4877548652 __ret_300; \
4877648653})
4877748654#else
48778#define vcopyq_lane_s64(__p0_301, __p1_301, __p2_301, __p3_301) __extension__ ({ \
48779 int64x2_t __ret_301; \
48780 int64x2_t __s0_301 = __p0_301; \
48781 int64x1_t __s2_301 = __p2_301; \
48782 int64x2_t __rev0_301; __rev0_301 = __builtin_shufflevector(__s0_301, __s0_301, __lane_reverse_128_64); \
48783 __ret_301 = __noswap_vsetq_lane_s64(vget_lane_s64(__s2_301, __p3_301), __rev0_301, __p1_301); \
48784 __ret_301 = __builtin_shufflevector(__ret_301, __ret_301, __lane_reverse_128_64); \
48655#define vcopy_lane_p8(__p0_301, __p1_301, __p2_301, __p3_301) __extension__ ({ \
48656 poly8x8_t __ret_301; \
48657 poly8x8_t __s0_301 = __p0_301; \
48658 poly8x8_t __s2_301 = __p2_301; \
48659 poly8x8_t __rev0_301; __rev0_301 = __builtin_shufflevector(__s0_301, __s0_301, __lane_reverse_64_8); \
48660 poly8x8_t __rev2_301; __rev2_301 = __builtin_shufflevector(__s2_301, __s2_301, __lane_reverse_64_8); \
48661 __ret_301 = __noswap_vset_lane_p8(__noswap_vget_lane_p8(__rev2_301, __p3_301), __rev0_301, __p1_301); \
48662 __ret_301 = __builtin_shufflevector(__ret_301, __ret_301, __lane_reverse_64_8); \
4878548663 __ret_301; \
4878648664})
4878748665#endif
4878848666
4878948667#ifdef __LITTLE_ENDIAN__
48790#define vcopyq_lane_mf8(__p0_302, __p1_302, __p2_302, __p3_302) __extension__ ({ \
48791 mfloat8x16_t __ret_302; \
48792 mfloat8x16_t __s0_302 = __p0_302; \
48793 mfloat8x8_t __s2_302 = __p2_302; \
48794 __ret_302 = vsetq_lane_mf8(vget_lane_mf8(__s2_302, __p3_302), __s0_302, __p1_302); \
48668#define vcopy_lane_p16(__p0_302, __p1_302, __p2_302, __p3_302) __extension__ ({ \
48669 poly16x4_t __ret_302; \
48670 poly16x4_t __s0_302 = __p0_302; \
48671 poly16x4_t __s2_302 = __p2_302; \
48672 __ret_302 = vset_lane_p16(vget_lane_p16(__s2_302, __p3_302), __s0_302, __p1_302); \
4879548673 __ret_302; \
4879648674})
4879748675#else
48798#define vcopyq_lane_mf8(__p0_303, __p1_303, __p2_303, __p3_303) __extension__ ({ \
48799 mfloat8x16_t __ret_303; \
48800 mfloat8x16_t __s0_303 = __p0_303; \
48801 mfloat8x8_t __s2_303 = __p2_303; \
48802 mfloat8x16_t __rev0_303; __rev0_303 = __builtin_shufflevector(__s0_303, __s0_303, __lane_reverse_128_8); \
48803 mfloat8x8_t __rev2_303; __rev2_303 = __builtin_shufflevector(__s2_303, __s2_303, __lane_reverse_64_8); \
48804 __ret_303 = __noswap_vsetq_lane_mf8(__noswap_vget_lane_mf8(__rev2_303, __p3_303), __rev0_303, __p1_303); \
48805 __ret_303 = __builtin_shufflevector(__ret_303, __ret_303, __lane_reverse_128_8); \
48676#define vcopy_lane_p16(__p0_303, __p1_303, __p2_303, __p3_303) __extension__ ({ \
48677 poly16x4_t __ret_303; \
48678 poly16x4_t __s0_303 = __p0_303; \
48679 poly16x4_t __s2_303 = __p2_303; \
48680 poly16x4_t __rev0_303; __rev0_303 = __builtin_shufflevector(__s0_303, __s0_303, __lane_reverse_64_16); \
48681 poly16x4_t __rev2_303; __rev2_303 = __builtin_shufflevector(__s2_303, __s2_303, __lane_reverse_64_16); \
48682 __ret_303 = __noswap_vset_lane_p16(__noswap_vget_lane_p16(__rev2_303, __p3_303), __rev0_303, __p1_303); \
48683 __ret_303 = __builtin_shufflevector(__ret_303, __ret_303, __lane_reverse_64_16); \
4880648684 __ret_303; \
4880748685})
4880848686#endif
4880948687
4881048688#ifdef __LITTLE_ENDIAN__
48811#define vcopyq_lane_s16(__p0_304, __p1_304, __p2_304, __p3_304) __extension__ ({ \
48812 int16x8_t __ret_304; \
48813 int16x8_t __s0_304 = __p0_304; \
48814 int16x4_t __s2_304 = __p2_304; \
48815 __ret_304 = vsetq_lane_s16(vget_lane_s16(__s2_304, __p3_304), __s0_304, __p1_304); \
48689#define vcopy_lane_u8(__p0_304, __p1_304, __p2_304, __p3_304) __extension__ ({ \
48690 uint8x8_t __ret_304; \
48691 uint8x8_t __s0_304 = __p0_304; \
48692 uint8x8_t __s2_304 = __p2_304; \
48693 __ret_304 = vset_lane_u8(vget_lane_u8(__s2_304, __p3_304), __s0_304, __p1_304); \
4881648694 __ret_304; \
4881748695})
4881848696#else
48819#define vcopyq_lane_s16(__p0_305, __p1_305, __p2_305, __p3_305) __extension__ ({ \
48820 int16x8_t __ret_305; \
48821 int16x8_t __s0_305 = __p0_305; \
48822 int16x4_t __s2_305 = __p2_305; \
48823 int16x8_t __rev0_305; __rev0_305 = __builtin_shufflevector(__s0_305, __s0_305, __lane_reverse_128_16); \
48824 int16x4_t __rev2_305; __rev2_305 = __builtin_shufflevector(__s2_305, __s2_305, __lane_reverse_64_16); \
48825 __ret_305 = __noswap_vsetq_lane_s16(__noswap_vget_lane_s16(__rev2_305, __p3_305), __rev0_305, __p1_305); \
48826 __ret_305 = __builtin_shufflevector(__ret_305, __ret_305, __lane_reverse_128_16); \
48697#define vcopy_lane_u8(__p0_305, __p1_305, __p2_305, __p3_305) __extension__ ({ \
48698 uint8x8_t __ret_305; \
48699 uint8x8_t __s0_305 = __p0_305; \
48700 uint8x8_t __s2_305 = __p2_305; \
48701 uint8x8_t __rev0_305; __rev0_305 = __builtin_shufflevector(__s0_305, __s0_305, __lane_reverse_64_8); \
48702 uint8x8_t __rev2_305; __rev2_305 = __builtin_shufflevector(__s2_305, __s2_305, __lane_reverse_64_8); \
48703 __ret_305 = __noswap_vset_lane_u8(__noswap_vget_lane_u8(__rev2_305, __p3_305), __rev0_305, __p1_305); \
48704 __ret_305 = __builtin_shufflevector(__ret_305, __ret_305, __lane_reverse_64_8); \
4882748705 __ret_305; \
4882848706})
4882948707#endif
4883048708
4883148709#ifdef __LITTLE_ENDIAN__
48832#define vcopy_lane_p8(__p0_306, __p1_306, __p2_306, __p3_306) __extension__ ({ \
48833 poly8x8_t __ret_306; \
48834 poly8x8_t __s0_306 = __p0_306; \
48835 poly8x8_t __s2_306 = __p2_306; \
48836 __ret_306 = vset_lane_p8(vget_lane_p8(__s2_306, __p3_306), __s0_306, __p1_306); \
48710#define vcopy_lane_u32(__p0_306, __p1_306, __p2_306, __p3_306) __extension__ ({ \
48711 uint32x2_t __ret_306; \
48712 uint32x2_t __s0_306 = __p0_306; \
48713 uint32x2_t __s2_306 = __p2_306; \
48714 __ret_306 = vset_lane_u32(vget_lane_u32(__s2_306, __p3_306), __s0_306, __p1_306); \
4883748715 __ret_306; \
4883848716})
4883948717#else
48840#define vcopy_lane_p8(__p0_307, __p1_307, __p2_307, __p3_307) __extension__ ({ \
48841 poly8x8_t __ret_307; \
48842 poly8x8_t __s0_307 = __p0_307; \
48843 poly8x8_t __s2_307 = __p2_307; \
48844 poly8x8_t __rev0_307; __rev0_307 = __builtin_shufflevector(__s0_307, __s0_307, __lane_reverse_64_8); \
48845 poly8x8_t __rev2_307; __rev2_307 = __builtin_shufflevector(__s2_307, __s2_307, __lane_reverse_64_8); \
48846 __ret_307 = __noswap_vset_lane_p8(__noswap_vget_lane_p8(__rev2_307, __p3_307), __rev0_307, __p1_307); \
48847 __ret_307 = __builtin_shufflevector(__ret_307, __ret_307, __lane_reverse_64_8); \
48718#define vcopy_lane_u32(__p0_307, __p1_307, __p2_307, __p3_307) __extension__ ({ \
48719 uint32x2_t __ret_307; \
48720 uint32x2_t __s0_307 = __p0_307; \
48721 uint32x2_t __s2_307 = __p2_307; \
48722 uint32x2_t __rev0_307; __rev0_307 = __builtin_shufflevector(__s0_307, __s0_307, __lane_reverse_64_32); \
48723 uint32x2_t __rev2_307; __rev2_307 = __builtin_shufflevector(__s2_307, __s2_307, __lane_reverse_64_32); \
48724 __ret_307 = __noswap_vset_lane_u32(__noswap_vget_lane_u32(__rev2_307, __p3_307), __rev0_307, __p1_307); \
48725 __ret_307 = __builtin_shufflevector(__ret_307, __ret_307, __lane_reverse_64_32); \
4884848726 __ret_307; \
4884948727})
4885048728#endif
4885148729
48852#ifdef __LITTLE_ENDIAN__
48853#define vcopy_lane_p16(__p0_308, __p1_308, __p2_308, __p3_308) __extension__ ({ \
48854 poly16x4_t __ret_308; \
48855 poly16x4_t __s0_308 = __p0_308; \
48856 poly16x4_t __s2_308 = __p2_308; \
48857 __ret_308 = vset_lane_p16(vget_lane_p16(__s2_308, __p3_308), __s0_308, __p1_308); \
48730#define vcopy_lane_u64(__p0_308, __p1_308, __p2_308, __p3_308) __extension__ ({ \
48731 uint64x1_t __ret_308; \
48732 uint64x1_t __s0_308 = __p0_308; \
48733 uint64x1_t __s2_308 = __p2_308; \
48734 __ret_308 = vset_lane_u64(vget_lane_u64(__s2_308, __p3_308), __s0_308, __p1_308); \
4885848735 __ret_308; \
4885948736})
48860#else
48861#define vcopy_lane_p16(__p0_309, __p1_309, __p2_309, __p3_309) __extension__ ({ \
48862 poly16x4_t __ret_309; \
48863 poly16x4_t __s0_309 = __p0_309; \
48864 poly16x4_t __s2_309 = __p2_309; \
48865 poly16x4_t __rev0_309; __rev0_309 = __builtin_shufflevector(__s0_309, __s0_309, __lane_reverse_64_16); \
48866 poly16x4_t __rev2_309; __rev2_309 = __builtin_shufflevector(__s2_309, __s2_309, __lane_reverse_64_16); \
48867 __ret_309 = __noswap_vset_lane_p16(__noswap_vget_lane_p16(__rev2_309, __p3_309), __rev0_309, __p1_309); \
48868 __ret_309 = __builtin_shufflevector(__ret_309, __ret_309, __lane_reverse_64_16); \
48737#ifdef __LITTLE_ENDIAN__
48738#define vcopy_lane_u16(__p0_309, __p1_309, __p2_309, __p3_309) __extension__ ({ \
48739 uint16x4_t __ret_309; \
48740 uint16x4_t __s0_309 = __p0_309; \
48741 uint16x4_t __s2_309 = __p2_309; \
48742 __ret_309 = vset_lane_u16(vget_lane_u16(__s2_309, __p3_309), __s0_309, __p1_309); \
4886948743 __ret_309; \
4887048744})
48745#else
48746#define vcopy_lane_u16(__p0_310, __p1_310, __p2_310, __p3_310) __extension__ ({ \
48747 uint16x4_t __ret_310; \
48748 uint16x4_t __s0_310 = __p0_310; \
48749 uint16x4_t __s2_310 = __p2_310; \
48750 uint16x4_t __rev0_310; __rev0_310 = __builtin_shufflevector(__s0_310, __s0_310, __lane_reverse_64_16); \
48751 uint16x4_t __rev2_310; __rev2_310 = __builtin_shufflevector(__s2_310, __s2_310, __lane_reverse_64_16); \
48752 __ret_310 = __noswap_vset_lane_u16(__noswap_vget_lane_u16(__rev2_310, __p3_310), __rev0_310, __p1_310); \
48753 __ret_310 = __builtin_shufflevector(__ret_310, __ret_310, __lane_reverse_64_16); \
48754 __ret_310; \
48755})
4887148756#endif
4887248757
4887348758#ifdef __LITTLE_ENDIAN__
48874#define vcopy_lane_u8(__p0_310, __p1_310, __p2_310, __p3_310) __extension__ ({ \
48875 uint8x8_t __ret_310; \
48876 uint8x8_t __s0_310 = __p0_310; \
48877 uint8x8_t __s2_310 = __p2_310; \
48878 __ret_310 = vset_lane_u8(vget_lane_u8(__s2_310, __p3_310), __s0_310, __p1_310); \
48879 __ret_310; \
48759#define vcopy_lane_s8(__p0_311, __p1_311, __p2_311, __p3_311) __extension__ ({ \
48760 int8x8_t __ret_311; \
48761 int8x8_t __s0_311 = __p0_311; \
48762 int8x8_t __s2_311 = __p2_311; \
48763 __ret_311 = vset_lane_s8(vget_lane_s8(__s2_311, __p3_311), __s0_311, __p1_311); \
48764 __ret_311; \
4888048765})
4888148766#else
48882#define vcopy_lane_u8(__p0_311, __p1_311, __p2_311, __p3_311) __extension__ ({ \
48883 uint8x8_t __ret_311; \
48884 uint8x8_t __s0_311 = __p0_311; \
48885 uint8x8_t __s2_311 = __p2_311; \
48886 uint8x8_t __rev0_311; __rev0_311 = __builtin_shufflevector(__s0_311, __s0_311, __lane_reverse_64_8); \
48887 uint8x8_t __rev2_311; __rev2_311 = __builtin_shufflevector(__s2_311, __s2_311, __lane_reverse_64_8); \
48888 __ret_311 = __noswap_vset_lane_u8(__noswap_vget_lane_u8(__rev2_311, __p3_311), __rev0_311, __p1_311); \
48889 __ret_311 = __builtin_shufflevector(__ret_311, __ret_311, __lane_reverse_64_8); \
48890 __ret_311; \
48767#define vcopy_lane_s8(__p0_312, __p1_312, __p2_312, __p3_312) __extension__ ({ \
48768 int8x8_t __ret_312; \
48769 int8x8_t __s0_312 = __p0_312; \
48770 int8x8_t __s2_312 = __p2_312; \
48771 int8x8_t __rev0_312; __rev0_312 = __builtin_shufflevector(__s0_312, __s0_312, __lane_reverse_64_8); \
48772 int8x8_t __rev2_312; __rev2_312 = __builtin_shufflevector(__s2_312, __s2_312, __lane_reverse_64_8); \
48773 __ret_312 = __noswap_vset_lane_s8(__noswap_vget_lane_s8(__rev2_312, __p3_312), __rev0_312, __p1_312); \
48774 __ret_312 = __builtin_shufflevector(__ret_312, __ret_312, __lane_reverse_64_8); \
48775 __ret_312; \
4889148776})
4889248777#endif
4889348778
4889448779#ifdef __LITTLE_ENDIAN__
48895#define vcopy_lane_u32(__p0_312, __p1_312, __p2_312, __p3_312) __extension__ ({ \
48896 uint32x2_t __ret_312; \
48897 uint32x2_t __s0_312 = __p0_312; \
48898 uint32x2_t __s2_312 = __p2_312; \
48899 __ret_312 = vset_lane_u32(vget_lane_u32(__s2_312, __p3_312), __s0_312, __p1_312); \
48900 __ret_312; \
48780#define vcopy_lane_f32(__p0_313, __p1_313, __p2_313, __p3_313) __extension__ ({ \
48781 float32x2_t __ret_313; \
48782 float32x2_t __s0_313 = __p0_313; \
48783 float32x2_t __s2_313 = __p2_313; \
48784 __ret_313 = vset_lane_f32(vget_lane_f32(__s2_313, __p3_313), __s0_313, __p1_313); \
48785 __ret_313; \
4890148786})
4890248787#else
48903#define vcopy_lane_u32(__p0_313, __p1_313, __p2_313, __p3_313) __extension__ ({ \
48904 uint32x2_t __ret_313; \
48905 uint32x2_t __s0_313 = __p0_313; \
48906 uint32x2_t __s2_313 = __p2_313; \
48907 uint32x2_t __rev0_313; __rev0_313 = __builtin_shufflevector(__s0_313, __s0_313, __lane_reverse_64_32); \
48908 uint32x2_t __rev2_313; __rev2_313 = __builtin_shufflevector(__s2_313, __s2_313, __lane_reverse_64_32); \
48909 __ret_313 = __noswap_vset_lane_u32(__noswap_vget_lane_u32(__rev2_313, __p3_313), __rev0_313, __p1_313); \
48910 __ret_313 = __builtin_shufflevector(__ret_313, __ret_313, __lane_reverse_64_32); \
48911 __ret_313; \
48788#define vcopy_lane_f32(__p0_314, __p1_314, __p2_314, __p3_314) __extension__ ({ \
48789 float32x2_t __ret_314; \
48790 float32x2_t __s0_314 = __p0_314; \
48791 float32x2_t __s2_314 = __p2_314; \
48792 float32x2_t __rev0_314; __rev0_314 = __builtin_shufflevector(__s0_314, __s0_314, __lane_reverse_64_32); \
48793 float32x2_t __rev2_314; __rev2_314 = __builtin_shufflevector(__s2_314, __s2_314, __lane_reverse_64_32); \
48794 __ret_314 = __noswap_vset_lane_f32(__noswap_vget_lane_f32(__rev2_314, __p3_314), __rev0_314, __p1_314); \
48795 __ret_314 = __builtin_shufflevector(__ret_314, __ret_314, __lane_reverse_64_32); \
48796 __ret_314; \
4891248797})
4891348798#endif
4891448799
48915#define vcopy_lane_u64(__p0_314, __p1_314, __p2_314, __p3_314) __extension__ ({ \
48916 uint64x1_t __ret_314; \
48917 uint64x1_t __s0_314 = __p0_314; \
48918 uint64x1_t __s2_314 = __p2_314; \
48919 __ret_314 = vset_lane_u64(vget_lane_u64(__s2_314, __p3_314), __s0_314, __p1_314); \
48920 __ret_314; \
48921})
4892248800#ifdef __LITTLE_ENDIAN__
48923#define vcopy_lane_u16(__p0_315, __p1_315, __p2_315, __p3_315) __extension__ ({ \
48924 uint16x4_t __ret_315; \
48925 uint16x4_t __s0_315 = __p0_315; \
48926 uint16x4_t __s2_315 = __p2_315; \
48927 __ret_315 = vset_lane_u16(vget_lane_u16(__s2_315, __p3_315), __s0_315, __p1_315); \
48801#define vcopy_lane_s32(__p0_315, __p1_315, __p2_315, __p3_315) __extension__ ({ \
48802 int32x2_t __ret_315; \
48803 int32x2_t __s0_315 = __p0_315; \
48804 int32x2_t __s2_315 = __p2_315; \
48805 __ret_315 = vset_lane_s32(vget_lane_s32(__s2_315, __p3_315), __s0_315, __p1_315); \
4892848806 __ret_315; \
4892948807})
4893048808#else
48931#define vcopy_lane_u16(__p0_316, __p1_316, __p2_316, __p3_316) __extension__ ({ \
48932 uint16x4_t __ret_316; \
48933 uint16x4_t __s0_316 = __p0_316; \
48934 uint16x4_t __s2_316 = __p2_316; \
48935 uint16x4_t __rev0_316; __rev0_316 = __builtin_shufflevector(__s0_316, __s0_316, __lane_reverse_64_16); \
48936 uint16x4_t __rev2_316; __rev2_316 = __builtin_shufflevector(__s2_316, __s2_316, __lane_reverse_64_16); \
48937 __ret_316 = __noswap_vset_lane_u16(__noswap_vget_lane_u16(__rev2_316, __p3_316), __rev0_316, __p1_316); \
48938 __ret_316 = __builtin_shufflevector(__ret_316, __ret_316, __lane_reverse_64_16); \
48809#define vcopy_lane_s32(__p0_316, __p1_316, __p2_316, __p3_316) __extension__ ({ \
48810 int32x2_t __ret_316; \
48811 int32x2_t __s0_316 = __p0_316; \
48812 int32x2_t __s2_316 = __p2_316; \
48813 int32x2_t __rev0_316; __rev0_316 = __builtin_shufflevector(__s0_316, __s0_316, __lane_reverse_64_32); \
48814 int32x2_t __rev2_316; __rev2_316 = __builtin_shufflevector(__s2_316, __s2_316, __lane_reverse_64_32); \
48815 __ret_316 = __noswap_vset_lane_s32(__noswap_vget_lane_s32(__rev2_316, __p3_316), __rev0_316, __p1_316); \
48816 __ret_316 = __builtin_shufflevector(__ret_316, __ret_316, __lane_reverse_64_32); \
4893948817 __ret_316; \
4894048818})
4894148819#endif
4894248820
48943#ifdef __LITTLE_ENDIAN__
48944#define vcopy_lane_s8(__p0_317, __p1_317, __p2_317, __p3_317) __extension__ ({ \
48945 int8x8_t __ret_317; \
48946 int8x8_t __s0_317 = __p0_317; \
48947 int8x8_t __s2_317 = __p2_317; \
48948 __ret_317 = vset_lane_s8(vget_lane_s8(__s2_317, __p3_317), __s0_317, __p1_317); \
48821#define vcopy_lane_s64(__p0_317, __p1_317, __p2_317, __p3_317) __extension__ ({ \
48822 int64x1_t __ret_317; \
48823 int64x1_t __s0_317 = __p0_317; \
48824 int64x1_t __s2_317 = __p2_317; \
48825 __ret_317 = vset_lane_s64(vget_lane_s64(__s2_317, __p3_317), __s0_317, __p1_317); \
4894948826 __ret_317; \
4895048827})
48951#else
48952#define vcopy_lane_s8(__p0_318, __p1_318, __p2_318, __p3_318) __extension__ ({ \
48953 int8x8_t __ret_318; \
48954 int8x8_t __s0_318 = __p0_318; \
48955 int8x8_t __s2_318 = __p2_318; \
48956 int8x8_t __rev0_318; __rev0_318 = __builtin_shufflevector(__s0_318, __s0_318, __lane_reverse_64_8); \
48957 int8x8_t __rev2_318; __rev2_318 = __builtin_shufflevector(__s2_318, __s2_318, __lane_reverse_64_8); \
48958 __ret_318 = __noswap_vset_lane_s8(__noswap_vget_lane_s8(__rev2_318, __p3_318), __rev0_318, __p1_318); \
48959 __ret_318 = __builtin_shufflevector(__ret_318, __ret_318, __lane_reverse_64_8); \
48828#ifdef __LITTLE_ENDIAN__
48829#define vcopy_lane_mf8(__p0_318, __p1_318, __p2_318, __p3_318) __extension__ ({ \
48830 mfloat8x8_t __ret_318; \
48831 mfloat8x8_t __s0_318 = __p0_318; \
48832 mfloat8x8_t __s2_318 = __p2_318; \
48833 __ret_318 = vset_lane_mf8(vget_lane_mf8(__s2_318, __p3_318), __s0_318, __p1_318); \
4896048834 __ret_318; \
4896148835})
48836#else
48837#define vcopy_lane_mf8(__p0_319, __p1_319, __p2_319, __p3_319) __extension__ ({ \
48838 mfloat8x8_t __ret_319; \
48839 mfloat8x8_t __s0_319 = __p0_319; \
48840 mfloat8x8_t __s2_319 = __p2_319; \
48841 mfloat8x8_t __rev0_319; __rev0_319 = __builtin_shufflevector(__s0_319, __s0_319, __lane_reverse_64_8); \
48842 mfloat8x8_t __rev2_319; __rev2_319 = __builtin_shufflevector(__s2_319, __s2_319, __lane_reverse_64_8); \
48843 __ret_319 = __noswap_vset_lane_mf8(__noswap_vget_lane_mf8(__rev2_319, __p3_319), __rev0_319, __p1_319); \
48844 __ret_319 = __builtin_shufflevector(__ret_319, __ret_319, __lane_reverse_64_8); \
48845 __ret_319; \
48846})
4896248847#endif
4896348848
4896448849#ifdef __LITTLE_ENDIAN__
48965#define vcopy_lane_f32(__p0_319, __p1_319, __p2_319, __p3_319) __extension__ ({ \
48966 float32x2_t __ret_319; \
48967 float32x2_t __s0_319 = __p0_319; \
48968 float32x2_t __s2_319 = __p2_319; \
48969 __ret_319 = vset_lane_f32(vget_lane_f32(__s2_319, __p3_319), __s0_319, __p1_319); \
48970 __ret_319; \
48850#define vcopy_lane_s16(__p0_320, __p1_320, __p2_320, __p3_320) __extension__ ({ \
48851 int16x4_t __ret_320; \
48852 int16x4_t __s0_320 = __p0_320; \
48853 int16x4_t __s2_320 = __p2_320; \
48854 __ret_320 = vset_lane_s16(vget_lane_s16(__s2_320, __p3_320), __s0_320, __p1_320); \
48855 __ret_320; \
4897148856})
4897248857#else
48973#define vcopy_lane_f32(__p0_320, __p1_320, __p2_320, __p3_320) __extension__ ({ \
48974 float32x2_t __ret_320; \
48975 float32x2_t __s0_320 = __p0_320; \
48976 float32x2_t __s2_320 = __p2_320; \
48977 float32x2_t __rev0_320; __rev0_320 = __builtin_shufflevector(__s0_320, __s0_320, __lane_reverse_64_32); \
48978 float32x2_t __rev2_320; __rev2_320 = __builtin_shufflevector(__s2_320, __s2_320, __lane_reverse_64_32); \
48979 __ret_320 = __noswap_vset_lane_f32(__noswap_vget_lane_f32(__rev2_320, __p3_320), __rev0_320, __p1_320); \
48980 __ret_320 = __builtin_shufflevector(__ret_320, __ret_320, __lane_reverse_64_32); \
48981 __ret_320; \
48858#define vcopy_lane_s16(__p0_321, __p1_321, __p2_321, __p3_321) __extension__ ({ \
48859 int16x4_t __ret_321; \
48860 int16x4_t __s0_321 = __p0_321; \
48861 int16x4_t __s2_321 = __p2_321; \
48862 int16x4_t __rev0_321; __rev0_321 = __builtin_shufflevector(__s0_321, __s0_321, __lane_reverse_64_16); \
48863 int16x4_t __rev2_321; __rev2_321 = __builtin_shufflevector(__s2_321, __s2_321, __lane_reverse_64_16); \
48864 __ret_321 = __noswap_vset_lane_s16(__noswap_vget_lane_s16(__rev2_321, __p3_321), __rev0_321, __p1_321); \
48865 __ret_321 = __builtin_shufflevector(__ret_321, __ret_321, __lane_reverse_64_16); \
48866 __ret_321; \
4898248867})
4898348868#endif
4898448869
4898548870#ifdef __LITTLE_ENDIAN__
48986#define vcopy_lane_s32(__p0_321, __p1_321, __p2_321, __p3_321) __extension__ ({ \
48987 int32x2_t __ret_321; \
48988 int32x2_t __s0_321 = __p0_321; \
48989 int32x2_t __s2_321 = __p2_321; \
48990 __ret_321 = vset_lane_s32(vget_lane_s32(__s2_321, __p3_321), __s0_321, __p1_321); \
48991 __ret_321; \
48871#define vcopy_lane_bf16(__p0_322, __p1_322, __p2_322, __p3_322) __extension__ ({ \
48872 bfloat16x4_t __ret_322; \
48873 bfloat16x4_t __s0_322 = __p0_322; \
48874 bfloat16x4_t __s2_322 = __p2_322; \
48875 __ret_322 = vset_lane_bf16(vget_lane_bf16(__s2_322, __p3_322), __s0_322, __p1_322); \
48876 __ret_322; \
4899248877})
4899348878#else
48994#define vcopy_lane_s32(__p0_322, __p1_322, __p2_322, __p3_322) __extension__ ({ \
48995 int32x2_t __ret_322; \
48996 int32x2_t __s0_322 = __p0_322; \
48997 int32x2_t __s2_322 = __p2_322; \
48998 int32x2_t __rev0_322; __rev0_322 = __builtin_shufflevector(__s0_322, __s0_322, __lane_reverse_64_32); \
48999 int32x2_t __rev2_322; __rev2_322 = __builtin_shufflevector(__s2_322, __s2_322, __lane_reverse_64_32); \
49000 __ret_322 = __noswap_vset_lane_s32(__noswap_vget_lane_s32(__rev2_322, __p3_322), __rev0_322, __p1_322); \
49001 __ret_322 = __builtin_shufflevector(__ret_322, __ret_322, __lane_reverse_64_32); \
49002 __ret_322; \
48879#define vcopy_lane_bf16(__p0_323, __p1_323, __p2_323, __p3_323) __extension__ ({ \
48880 bfloat16x4_t __ret_323; \
48881 bfloat16x4_t __s0_323 = __p0_323; \
48882 bfloat16x4_t __s2_323 = __p2_323; \
48883 bfloat16x4_t __rev0_323; __rev0_323 = __builtin_shufflevector(__s0_323, __s0_323, __lane_reverse_64_16); \
48884 bfloat16x4_t __rev2_323; __rev2_323 = __builtin_shufflevector(__s2_323, __s2_323, __lane_reverse_64_16); \
48885 __ret_323 = __noswap_vset_lane_bf16(__noswap_vget_lane_bf16(__rev2_323, __p3_323), __rev0_323, __p1_323); \
48886 __ret_323 = __builtin_shufflevector(__ret_323, __ret_323, __lane_reverse_64_16); \
48887 __ret_323; \
4900348888})
4900448889#endif
4900548890
49006#define vcopy_lane_s64(__p0_323, __p1_323, __p2_323, __p3_323) __extension__ ({ \
49007 int64x1_t __ret_323; \
49008 int64x1_t __s0_323 = __p0_323; \
49009 int64x1_t __s2_323 = __p2_323; \
49010 __ret_323 = vset_lane_s64(vget_lane_s64(__s2_323, __p3_323), __s0_323, __p1_323); \
49011 __ret_323; \
49012})
4901348891#ifdef __LITTLE_ENDIAN__
49014#define vcopy_lane_mf8(__p0_324, __p1_324, __p2_324, __p3_324) __extension__ ({ \
49015 mfloat8x8_t __ret_324; \
49016 mfloat8x8_t __s0_324 = __p0_324; \
49017 mfloat8x8_t __s2_324 = __p2_324; \
49018 __ret_324 = vset_lane_mf8(vget_lane_mf8(__s2_324, __p3_324), __s0_324, __p1_324); \
48892#define vcopyq_laneq_p8(__p0_324, __p1_324, __p2_324, __p3_324) __extension__ ({ \
48893 poly8x16_t __ret_324; \
48894 poly8x16_t __s0_324 = __p0_324; \
48895 poly8x16_t __s2_324 = __p2_324; \
48896 __ret_324 = vsetq_lane_p8(vgetq_lane_p8(__s2_324, __p3_324), __s0_324, __p1_324); \
4901948897 __ret_324; \
4902048898})
4902148899#else
49022#define vcopy_lane_mf8(__p0_325, __p1_325, __p2_325, __p3_325) __extension__ ({ \
49023 mfloat8x8_t __ret_325; \
49024 mfloat8x8_t __s0_325 = __p0_325; \
49025 mfloat8x8_t __s2_325 = __p2_325; \
49026 mfloat8x8_t __rev0_325; __rev0_325 = __builtin_shufflevector(__s0_325, __s0_325, __lane_reverse_64_8); \
49027 mfloat8x8_t __rev2_325; __rev2_325 = __builtin_shufflevector(__s2_325, __s2_325, __lane_reverse_64_8); \
49028 __ret_325 = __noswap_vset_lane_mf8(__noswap_vget_lane_mf8(__rev2_325, __p3_325), __rev0_325, __p1_325); \
49029 __ret_325 = __builtin_shufflevector(__ret_325, __ret_325, __lane_reverse_64_8); \
48900#define vcopyq_laneq_p8(__p0_325, __p1_325, __p2_325, __p3_325) __extension__ ({ \
48901 poly8x16_t __ret_325; \
48902 poly8x16_t __s0_325 = __p0_325; \
48903 poly8x16_t __s2_325 = __p2_325; \
48904 poly8x16_t __rev0_325; __rev0_325 = __builtin_shufflevector(__s0_325, __s0_325, __lane_reverse_128_8); \
48905 poly8x16_t __rev2_325; __rev2_325 = __builtin_shufflevector(__s2_325, __s2_325, __lane_reverse_128_8); \
48906 __ret_325 = __noswap_vsetq_lane_p8(__noswap_vgetq_lane_p8(__rev2_325, __p3_325), __rev0_325, __p1_325); \
48907 __ret_325 = __builtin_shufflevector(__ret_325, __ret_325, __lane_reverse_128_8); \
4903048908 __ret_325; \
4903148909})
4903248910#endif
4903348911
4903448912#ifdef __LITTLE_ENDIAN__
49035#define vcopy_lane_s16(__p0_326, __p1_326, __p2_326, __p3_326) __extension__ ({ \
49036 int16x4_t __ret_326; \
49037 int16x4_t __s0_326 = __p0_326; \
49038 int16x4_t __s2_326 = __p2_326; \
49039 __ret_326 = vset_lane_s16(vget_lane_s16(__s2_326, __p3_326), __s0_326, __p1_326); \
48913#define vcopyq_laneq_p16(__p0_326, __p1_326, __p2_326, __p3_326) __extension__ ({ \
48914 poly16x8_t __ret_326; \
48915 poly16x8_t __s0_326 = __p0_326; \
48916 poly16x8_t __s2_326 = __p2_326; \
48917 __ret_326 = vsetq_lane_p16(vgetq_lane_p16(__s2_326, __p3_326), __s0_326, __p1_326); \
4904048918 __ret_326; \
4904148919})
4904248920#else
49043#define vcopy_lane_s16(__p0_327, __p1_327, __p2_327, __p3_327) __extension__ ({ \
49044 int16x4_t __ret_327; \
49045 int16x4_t __s0_327 = __p0_327; \
49046 int16x4_t __s2_327 = __p2_327; \
49047 int16x4_t __rev0_327; __rev0_327 = __builtin_shufflevector(__s0_327, __s0_327, __lane_reverse_64_16); \
49048 int16x4_t __rev2_327; __rev2_327 = __builtin_shufflevector(__s2_327, __s2_327, __lane_reverse_64_16); \
49049 __ret_327 = __noswap_vset_lane_s16(__noswap_vget_lane_s16(__rev2_327, __p3_327), __rev0_327, __p1_327); \
49050 __ret_327 = __builtin_shufflevector(__ret_327, __ret_327, __lane_reverse_64_16); \
48921#define vcopyq_laneq_p16(__p0_327, __p1_327, __p2_327, __p3_327) __extension__ ({ \
48922 poly16x8_t __ret_327; \
48923 poly16x8_t __s0_327 = __p0_327; \
48924 poly16x8_t __s2_327 = __p2_327; \
48925 poly16x8_t __rev0_327; __rev0_327 = __builtin_shufflevector(__s0_327, __s0_327, __lane_reverse_128_16); \
48926 poly16x8_t __rev2_327; __rev2_327 = __builtin_shufflevector(__s2_327, __s2_327, __lane_reverse_128_16); \
48927 __ret_327 = __noswap_vsetq_lane_p16(__noswap_vgetq_lane_p16(__rev2_327, __p3_327), __rev0_327, __p1_327); \
48928 __ret_327 = __builtin_shufflevector(__ret_327, __ret_327, __lane_reverse_128_16); \
4905148929 __ret_327; \
4905248930})
4905348931#endif
4905448932
4905548933#ifdef __LITTLE_ENDIAN__
49056#define vcopyq_laneq_p8(__p0_328, __p1_328, __p2_328, __p3_328) __extension__ ({ \
49057 poly8x16_t __ret_328; \
49058 poly8x16_t __s0_328 = __p0_328; \
49059 poly8x16_t __s2_328 = __p2_328; \
49060 __ret_328 = vsetq_lane_p8(vgetq_lane_p8(__s2_328, __p3_328), __s0_328, __p1_328); \
48934#define vcopyq_laneq_u8(__p0_328, __p1_328, __p2_328, __p3_328) __extension__ ({ \
48935 uint8x16_t __ret_328; \
48936 uint8x16_t __s0_328 = __p0_328; \
48937 uint8x16_t __s2_328 = __p2_328; \
48938 __ret_328 = vsetq_lane_u8(vgetq_lane_u8(__s2_328, __p3_328), __s0_328, __p1_328); \
4906148939 __ret_328; \
4906248940})
4906348941#else
49064#define vcopyq_laneq_p8(__p0_329, __p1_329, __p2_329, __p3_329) __extension__ ({ \
49065 poly8x16_t __ret_329; \
49066 poly8x16_t __s0_329 = __p0_329; \
49067 poly8x16_t __s2_329 = __p2_329; \
49068 poly8x16_t __rev0_329; __rev0_329 = __builtin_shufflevector(__s0_329, __s0_329, __lane_reverse_128_8); \
49069 poly8x16_t __rev2_329; __rev2_329 = __builtin_shufflevector(__s2_329, __s2_329, __lane_reverse_128_8); \
49070 __ret_329 = __noswap_vsetq_lane_p8(__noswap_vgetq_lane_p8(__rev2_329, __p3_329), __rev0_329, __p1_329); \
48942#define vcopyq_laneq_u8(__p0_329, __p1_329, __p2_329, __p3_329) __extension__ ({ \
48943 uint8x16_t __ret_329; \
48944 uint8x16_t __s0_329 = __p0_329; \
48945 uint8x16_t __s2_329 = __p2_329; \
48946 uint8x16_t __rev0_329; __rev0_329 = __builtin_shufflevector(__s0_329, __s0_329, __lane_reverse_128_8); \
48947 uint8x16_t __rev2_329; __rev2_329 = __builtin_shufflevector(__s2_329, __s2_329, __lane_reverse_128_8); \
48948 __ret_329 = __noswap_vsetq_lane_u8(__noswap_vgetq_lane_u8(__rev2_329, __p3_329), __rev0_329, __p1_329); \
4907148949 __ret_329 = __builtin_shufflevector(__ret_329, __ret_329, __lane_reverse_128_8); \
4907248950 __ret_329; \
4907348951})
4907448952#endif
4907548953
4907648954#ifdef __LITTLE_ENDIAN__
49077#define vcopyq_laneq_p16(__p0_330, __p1_330, __p2_330, __p3_330) __extension__ ({ \
49078 poly16x8_t __ret_330; \
49079 poly16x8_t __s0_330 = __p0_330; \
49080 poly16x8_t __s2_330 = __p2_330; \
49081 __ret_330 = vsetq_lane_p16(vgetq_lane_p16(__s2_330, __p3_330), __s0_330, __p1_330); \
48955#define vcopyq_laneq_u32(__p0_330, __p1_330, __p2_330, __p3_330) __extension__ ({ \
48956 uint32x4_t __ret_330; \
48957 uint32x4_t __s0_330 = __p0_330; \
48958 uint32x4_t __s2_330 = __p2_330; \
48959 __ret_330 = vsetq_lane_u32(vgetq_lane_u32(__s2_330, __p3_330), __s0_330, __p1_330); \
4908248960 __ret_330; \
4908348961})
4908448962#else
49085#define vcopyq_laneq_p16(__p0_331, __p1_331, __p2_331, __p3_331) __extension__ ({ \
49086 poly16x8_t __ret_331; \
49087 poly16x8_t __s0_331 = __p0_331; \
49088 poly16x8_t __s2_331 = __p2_331; \
49089 poly16x8_t __rev0_331; __rev0_331 = __builtin_shufflevector(__s0_331, __s0_331, __lane_reverse_128_16); \
49090 poly16x8_t __rev2_331; __rev2_331 = __builtin_shufflevector(__s2_331, __s2_331, __lane_reverse_128_16); \
49091 __ret_331 = __noswap_vsetq_lane_p16(__noswap_vgetq_lane_p16(__rev2_331, __p3_331), __rev0_331, __p1_331); \
49092 __ret_331 = __builtin_shufflevector(__ret_331, __ret_331, __lane_reverse_128_16); \
48963#define vcopyq_laneq_u32(__p0_331, __p1_331, __p2_331, __p3_331) __extension__ ({ \
48964 uint32x4_t __ret_331; \
48965 uint32x4_t __s0_331 = __p0_331; \
48966 uint32x4_t __s2_331 = __p2_331; \
48967 uint32x4_t __rev0_331; __rev0_331 = __builtin_shufflevector(__s0_331, __s0_331, __lane_reverse_128_32); \
48968 uint32x4_t __rev2_331; __rev2_331 = __builtin_shufflevector(__s2_331, __s2_331, __lane_reverse_128_32); \
48969 __ret_331 = __noswap_vsetq_lane_u32(__noswap_vgetq_lane_u32(__rev2_331, __p3_331), __rev0_331, __p1_331); \
48970 __ret_331 = __builtin_shufflevector(__ret_331, __ret_331, __lane_reverse_128_32); \
4909348971 __ret_331; \
4909448972})
4909548973#endif
4909648974
4909748975#ifdef __LITTLE_ENDIAN__
49098#define vcopyq_laneq_u8(__p0_332, __p1_332, __p2_332, __p3_332) __extension__ ({ \
49099 uint8x16_t __ret_332; \
49100 uint8x16_t __s0_332 = __p0_332; \
49101 uint8x16_t __s2_332 = __p2_332; \
49102 __ret_332 = vsetq_lane_u8(vgetq_lane_u8(__s2_332, __p3_332), __s0_332, __p1_332); \
48976#define vcopyq_laneq_u64(__p0_332, __p1_332, __p2_332, __p3_332) __extension__ ({ \
48977 uint64x2_t __ret_332; \
48978 uint64x2_t __s0_332 = __p0_332; \
48979 uint64x2_t __s2_332 = __p2_332; \
48980 __ret_332 = vsetq_lane_u64(vgetq_lane_u64(__s2_332, __p3_332), __s0_332, __p1_332); \
4910348981 __ret_332; \
4910448982})
4910548983#else
49106#define vcopyq_laneq_u8(__p0_333, __p1_333, __p2_333, __p3_333) __extension__ ({ \
49107 uint8x16_t __ret_333; \
49108 uint8x16_t __s0_333 = __p0_333; \
49109 uint8x16_t __s2_333 = __p2_333; \
49110 uint8x16_t __rev0_333; __rev0_333 = __builtin_shufflevector(__s0_333, __s0_333, __lane_reverse_128_8); \
49111 uint8x16_t __rev2_333; __rev2_333 = __builtin_shufflevector(__s2_333, __s2_333, __lane_reverse_128_8); \
49112 __ret_333 = __noswap_vsetq_lane_u8(__noswap_vgetq_lane_u8(__rev2_333, __p3_333), __rev0_333, __p1_333); \
49113 __ret_333 = __builtin_shufflevector(__ret_333, __ret_333, __lane_reverse_128_8); \
48984#define vcopyq_laneq_u64(__p0_333, __p1_333, __p2_333, __p3_333) __extension__ ({ \
48985 uint64x2_t __ret_333; \
48986 uint64x2_t __s0_333 = __p0_333; \
48987 uint64x2_t __s2_333 = __p2_333; \
48988 uint64x2_t __rev0_333; __rev0_333 = __builtin_shufflevector(__s0_333, __s0_333, __lane_reverse_128_64); \
48989 uint64x2_t __rev2_333; __rev2_333 = __builtin_shufflevector(__s2_333, __s2_333, __lane_reverse_128_64); \
48990 __ret_333 = __noswap_vsetq_lane_u64(__noswap_vgetq_lane_u64(__rev2_333, __p3_333), __rev0_333, __p1_333); \
48991 __ret_333 = __builtin_shufflevector(__ret_333, __ret_333, __lane_reverse_128_64); \
4911448992 __ret_333; \
4911548993})
4911648994#endif
4911748995
4911848996#ifdef __LITTLE_ENDIAN__
49119#define vcopyq_laneq_u32(__p0_334, __p1_334, __p2_334, __p3_334) __extension__ ({ \
49120 uint32x4_t __ret_334; \
49121 uint32x4_t __s0_334 = __p0_334; \
49122 uint32x4_t __s2_334 = __p2_334; \
49123 __ret_334 = vsetq_lane_u32(vgetq_lane_u32(__s2_334, __p3_334), __s0_334, __p1_334); \
48997#define vcopyq_laneq_u16(__p0_334, __p1_334, __p2_334, __p3_334) __extension__ ({ \
48998 uint16x8_t __ret_334; \
48999 uint16x8_t __s0_334 = __p0_334; \
49000 uint16x8_t __s2_334 = __p2_334; \
49001 __ret_334 = vsetq_lane_u16(vgetq_lane_u16(__s2_334, __p3_334), __s0_334, __p1_334); \
4912449002 __ret_334; \
4912549003})
4912649004#else
49127#define vcopyq_laneq_u32(__p0_335, __p1_335, __p2_335, __p3_335) __extension__ ({ \
49128 uint32x4_t __ret_335; \
49129 uint32x4_t __s0_335 = __p0_335; \
49130 uint32x4_t __s2_335 = __p2_335; \
49131 uint32x4_t __rev0_335; __rev0_335 = __builtin_shufflevector(__s0_335, __s0_335, __lane_reverse_128_32); \
49132 uint32x4_t __rev2_335; __rev2_335 = __builtin_shufflevector(__s2_335, __s2_335, __lane_reverse_128_32); \
49133 __ret_335 = __noswap_vsetq_lane_u32(__noswap_vgetq_lane_u32(__rev2_335, __p3_335), __rev0_335, __p1_335); \
49134 __ret_335 = __builtin_shufflevector(__ret_335, __ret_335, __lane_reverse_128_32); \
49005#define vcopyq_laneq_u16(__p0_335, __p1_335, __p2_335, __p3_335) __extension__ ({ \
49006 uint16x8_t __ret_335; \
49007 uint16x8_t __s0_335 = __p0_335; \
49008 uint16x8_t __s2_335 = __p2_335; \
49009 uint16x8_t __rev0_335; __rev0_335 = __builtin_shufflevector(__s0_335, __s0_335, __lane_reverse_128_16); \
49010 uint16x8_t __rev2_335; __rev2_335 = __builtin_shufflevector(__s2_335, __s2_335, __lane_reverse_128_16); \
49011 __ret_335 = __noswap_vsetq_lane_u16(__noswap_vgetq_lane_u16(__rev2_335, __p3_335), __rev0_335, __p1_335); \
49012 __ret_335 = __builtin_shufflevector(__ret_335, __ret_335, __lane_reverse_128_16); \
4913549013 __ret_335; \
4913649014})
4913749015#endif
4913849016
4913949017#ifdef __LITTLE_ENDIAN__
49140#define vcopyq_laneq_u64(__p0_336, __p1_336, __p2_336, __p3_336) __extension__ ({ \
49141 uint64x2_t __ret_336; \
49142 uint64x2_t __s0_336 = __p0_336; \
49143 uint64x2_t __s2_336 = __p2_336; \
49144 __ret_336 = vsetq_lane_u64(vgetq_lane_u64(__s2_336, __p3_336), __s0_336, __p1_336); \
49018#define vcopyq_laneq_s8(__p0_336, __p1_336, __p2_336, __p3_336) __extension__ ({ \
49019 int8x16_t __ret_336; \
49020 int8x16_t __s0_336 = __p0_336; \
49021 int8x16_t __s2_336 = __p2_336; \
49022 __ret_336 = vsetq_lane_s8(vgetq_lane_s8(__s2_336, __p3_336), __s0_336, __p1_336); \
4914549023 __ret_336; \
4914649024})
4914749025#else
49148#define vcopyq_laneq_u64(__p0_337, __p1_337, __p2_337, __p3_337) __extension__ ({ \
49149 uint64x2_t __ret_337; \
49150 uint64x2_t __s0_337 = __p0_337; \
49151 uint64x2_t __s2_337 = __p2_337; \
49152 uint64x2_t __rev0_337; __rev0_337 = __builtin_shufflevector(__s0_337, __s0_337, __lane_reverse_128_64); \
49153 uint64x2_t __rev2_337; __rev2_337 = __builtin_shufflevector(__s2_337, __s2_337, __lane_reverse_128_64); \
49154 __ret_337 = __noswap_vsetq_lane_u64(__noswap_vgetq_lane_u64(__rev2_337, __p3_337), __rev0_337, __p1_337); \
49155 __ret_337 = __builtin_shufflevector(__ret_337, __ret_337, __lane_reverse_128_64); \
49026#define vcopyq_laneq_s8(__p0_337, __p1_337, __p2_337, __p3_337) __extension__ ({ \
49027 int8x16_t __ret_337; \
49028 int8x16_t __s0_337 = __p0_337; \
49029 int8x16_t __s2_337 = __p2_337; \
49030 int8x16_t __rev0_337; __rev0_337 = __builtin_shufflevector(__s0_337, __s0_337, __lane_reverse_128_8); \
49031 int8x16_t __rev2_337; __rev2_337 = __builtin_shufflevector(__s2_337, __s2_337, __lane_reverse_128_8); \
49032 __ret_337 = __noswap_vsetq_lane_s8(__noswap_vgetq_lane_s8(__rev2_337, __p3_337), __rev0_337, __p1_337); \
49033 __ret_337 = __builtin_shufflevector(__ret_337, __ret_337, __lane_reverse_128_8); \
4915649034 __ret_337; \
4915749035})
4915849036#endif
4915949037
4916049038#ifdef __LITTLE_ENDIAN__
49161#define vcopyq_laneq_u16(__p0_338, __p1_338, __p2_338, __p3_338) __extension__ ({ \
49162 uint16x8_t __ret_338; \
49163 uint16x8_t __s0_338 = __p0_338; \
49164 uint16x8_t __s2_338 = __p2_338; \
49165 __ret_338 = vsetq_lane_u16(vgetq_lane_u16(__s2_338, __p3_338), __s0_338, __p1_338); \
49039#define vcopyq_laneq_f32(__p0_338, __p1_338, __p2_338, __p3_338) __extension__ ({ \
49040 float32x4_t __ret_338; \
49041 float32x4_t __s0_338 = __p0_338; \
49042 float32x4_t __s2_338 = __p2_338; \
49043 __ret_338 = vsetq_lane_f32(vgetq_lane_f32(__s2_338, __p3_338), __s0_338, __p1_338); \
4916649044 __ret_338; \
4916749045})
4916849046#else
49169#define vcopyq_laneq_u16(__p0_339, __p1_339, __p2_339, __p3_339) __extension__ ({ \
49170 uint16x8_t __ret_339; \
49171 uint16x8_t __s0_339 = __p0_339; \
49172 uint16x8_t __s2_339 = __p2_339; \
49173 uint16x8_t __rev0_339; __rev0_339 = __builtin_shufflevector(__s0_339, __s0_339, __lane_reverse_128_16); \
49174 uint16x8_t __rev2_339; __rev2_339 = __builtin_shufflevector(__s2_339, __s2_339, __lane_reverse_128_16); \
49175 __ret_339 = __noswap_vsetq_lane_u16(__noswap_vgetq_lane_u16(__rev2_339, __p3_339), __rev0_339, __p1_339); \
49176 __ret_339 = __builtin_shufflevector(__ret_339, __ret_339, __lane_reverse_128_16); \
49047#define vcopyq_laneq_f32(__p0_339, __p1_339, __p2_339, __p3_339) __extension__ ({ \
49048 float32x4_t __ret_339; \
49049 float32x4_t __s0_339 = __p0_339; \
49050 float32x4_t __s2_339 = __p2_339; \
49051 float32x4_t __rev0_339; __rev0_339 = __builtin_shufflevector(__s0_339, __s0_339, __lane_reverse_128_32); \
49052 float32x4_t __rev2_339; __rev2_339 = __builtin_shufflevector(__s2_339, __s2_339, __lane_reverse_128_32); \
49053 __ret_339 = __noswap_vsetq_lane_f32(__noswap_vgetq_lane_f32(__rev2_339, __p3_339), __rev0_339, __p1_339); \
49054 __ret_339 = __builtin_shufflevector(__ret_339, __ret_339, __lane_reverse_128_32); \
4917749055 __ret_339; \
4917849056})
4917949057#endif
4918049058
4918149059#ifdef __LITTLE_ENDIAN__
49182#define vcopyq_laneq_s8(__p0_340, __p1_340, __p2_340, __p3_340) __extension__ ({ \
49183 int8x16_t __ret_340; \
49184 int8x16_t __s0_340 = __p0_340; \
49185 int8x16_t __s2_340 = __p2_340; \
49186 __ret_340 = vsetq_lane_s8(vgetq_lane_s8(__s2_340, __p3_340), __s0_340, __p1_340); \
49060#define vcopyq_laneq_s32(__p0_340, __p1_340, __p2_340, __p3_340) __extension__ ({ \
49061 int32x4_t __ret_340; \
49062 int32x4_t __s0_340 = __p0_340; \
49063 int32x4_t __s2_340 = __p2_340; \
49064 __ret_340 = vsetq_lane_s32(vgetq_lane_s32(__s2_340, __p3_340), __s0_340, __p1_340); \
4918749065 __ret_340; \
4918849066})
4918949067#else
49190#define vcopyq_laneq_s8(__p0_341, __p1_341, __p2_341, __p3_341) __extension__ ({ \
49191 int8x16_t __ret_341; \
49192 int8x16_t __s0_341 = __p0_341; \
49193 int8x16_t __s2_341 = __p2_341; \
49194 int8x16_t __rev0_341; __rev0_341 = __builtin_shufflevector(__s0_341, __s0_341, __lane_reverse_128_8); \
49195 int8x16_t __rev2_341; __rev2_341 = __builtin_shufflevector(__s2_341, __s2_341, __lane_reverse_128_8); \
49196 __ret_341 = __noswap_vsetq_lane_s8(__noswap_vgetq_lane_s8(__rev2_341, __p3_341), __rev0_341, __p1_341); \
49197 __ret_341 = __builtin_shufflevector(__ret_341, __ret_341, __lane_reverse_128_8); \
49068#define vcopyq_laneq_s32(__p0_341, __p1_341, __p2_341, __p3_341) __extension__ ({ \
49069 int32x4_t __ret_341; \
49070 int32x4_t __s0_341 = __p0_341; \
49071 int32x4_t __s2_341 = __p2_341; \
49072 int32x4_t __rev0_341; __rev0_341 = __builtin_shufflevector(__s0_341, __s0_341, __lane_reverse_128_32); \
49073 int32x4_t __rev2_341; __rev2_341 = __builtin_shufflevector(__s2_341, __s2_341, __lane_reverse_128_32); \
49074 __ret_341 = __noswap_vsetq_lane_s32(__noswap_vgetq_lane_s32(__rev2_341, __p3_341), __rev0_341, __p1_341); \
49075 __ret_341 = __builtin_shufflevector(__ret_341, __ret_341, __lane_reverse_128_32); \
4919849076 __ret_341; \
4919949077})
4920049078#endif
4920149079
4920249080#ifdef __LITTLE_ENDIAN__
49203#define vcopyq_laneq_f32(__p0_342, __p1_342, __p2_342, __p3_342) __extension__ ({ \
49204 float32x4_t __ret_342; \
49205 float32x4_t __s0_342 = __p0_342; \
49206 float32x4_t __s2_342 = __p2_342; \
49207 __ret_342 = vsetq_lane_f32(vgetq_lane_f32(__s2_342, __p3_342), __s0_342, __p1_342); \
49081#define vcopyq_laneq_s64(__p0_342, __p1_342, __p2_342, __p3_342) __extension__ ({ \
49082 int64x2_t __ret_342; \
49083 int64x2_t __s0_342 = __p0_342; \
49084 int64x2_t __s2_342 = __p2_342; \
49085 __ret_342 = vsetq_lane_s64(vgetq_lane_s64(__s2_342, __p3_342), __s0_342, __p1_342); \
4920849086 __ret_342; \
4920949087})
4921049088#else
49211#define vcopyq_laneq_f32(__p0_343, __p1_343, __p2_343, __p3_343) __extension__ ({ \
49212 float32x4_t __ret_343; \
49213 float32x4_t __s0_343 = __p0_343; \
49214 float32x4_t __s2_343 = __p2_343; \
49215 float32x4_t __rev0_343; __rev0_343 = __builtin_shufflevector(__s0_343, __s0_343, __lane_reverse_128_32); \
49216 float32x4_t __rev2_343; __rev2_343 = __builtin_shufflevector(__s2_343, __s2_343, __lane_reverse_128_32); \
49217 __ret_343 = __noswap_vsetq_lane_f32(__noswap_vgetq_lane_f32(__rev2_343, __p3_343), __rev0_343, __p1_343); \
49218 __ret_343 = __builtin_shufflevector(__ret_343, __ret_343, __lane_reverse_128_32); \
49089#define vcopyq_laneq_s64(__p0_343, __p1_343, __p2_343, __p3_343) __extension__ ({ \
49090 int64x2_t __ret_343; \
49091 int64x2_t __s0_343 = __p0_343; \
49092 int64x2_t __s2_343 = __p2_343; \
49093 int64x2_t __rev0_343; __rev0_343 = __builtin_shufflevector(__s0_343, __s0_343, __lane_reverse_128_64); \
49094 int64x2_t __rev2_343; __rev2_343 = __builtin_shufflevector(__s2_343, __s2_343, __lane_reverse_128_64); \
49095 __ret_343 = __noswap_vsetq_lane_s64(__noswap_vgetq_lane_s64(__rev2_343, __p3_343), __rev0_343, __p1_343); \
49096 __ret_343 = __builtin_shufflevector(__ret_343, __ret_343, __lane_reverse_128_64); \
4921949097 __ret_343; \
4922049098})
4922149099#endif
4922249100
4922349101#ifdef __LITTLE_ENDIAN__
49224#define vcopyq_laneq_s32(__p0_344, __p1_344, __p2_344, __p3_344) __extension__ ({ \
49225 int32x4_t __ret_344; \
49226 int32x4_t __s0_344 = __p0_344; \
49227 int32x4_t __s2_344 = __p2_344; \
49228 __ret_344 = vsetq_lane_s32(vgetq_lane_s32(__s2_344, __p3_344), __s0_344, __p1_344); \
49102#define vcopyq_laneq_mf8(__p0_344, __p1_344, __p2_344, __p3_344) __extension__ ({ \
49103 mfloat8x16_t __ret_344; \
49104 mfloat8x16_t __s0_344 = __p0_344; \
49105 mfloat8x16_t __s2_344 = __p2_344; \
49106 __ret_344 = vsetq_lane_mf8(vgetq_lane_mf8(__s2_344, __p3_344), __s0_344, __p1_344); \
4922949107 __ret_344; \
4923049108})
4923149109#else
49232#define vcopyq_laneq_s32(__p0_345, __p1_345, __p2_345, __p3_345) __extension__ ({ \
49233 int32x4_t __ret_345; \
49234 int32x4_t __s0_345 = __p0_345; \
49235 int32x4_t __s2_345 = __p2_345; \
49236 int32x4_t __rev0_345; __rev0_345 = __builtin_shufflevector(__s0_345, __s0_345, __lane_reverse_128_32); \
49237 int32x4_t __rev2_345; __rev2_345 = __builtin_shufflevector(__s2_345, __s2_345, __lane_reverse_128_32); \
49238 __ret_345 = __noswap_vsetq_lane_s32(__noswap_vgetq_lane_s32(__rev2_345, __p3_345), __rev0_345, __p1_345); \
49239 __ret_345 = __builtin_shufflevector(__ret_345, __ret_345, __lane_reverse_128_32); \
49110#define vcopyq_laneq_mf8(__p0_345, __p1_345, __p2_345, __p3_345) __extension__ ({ \
49111 mfloat8x16_t __ret_345; \
49112 mfloat8x16_t __s0_345 = __p0_345; \
49113 mfloat8x16_t __s2_345 = __p2_345; \
49114 mfloat8x16_t __rev0_345; __rev0_345 = __builtin_shufflevector(__s0_345, __s0_345, __lane_reverse_128_8); \
49115 mfloat8x16_t __rev2_345; __rev2_345 = __builtin_shufflevector(__s2_345, __s2_345, __lane_reverse_128_8); \
49116 __ret_345 = __noswap_vsetq_lane_mf8(__noswap_vgetq_lane_mf8(__rev2_345, __p3_345), __rev0_345, __p1_345); \
49117 __ret_345 = __builtin_shufflevector(__ret_345, __ret_345, __lane_reverse_128_8); \
4924049118 __ret_345; \
4924149119})
4924249120#endif
4924349121
4924449122#ifdef __LITTLE_ENDIAN__
49245#define vcopyq_laneq_s64(__p0_346, __p1_346, __p2_346, __p3_346) __extension__ ({ \
49246 int64x2_t __ret_346; \
49247 int64x2_t __s0_346 = __p0_346; \
49248 int64x2_t __s2_346 = __p2_346; \
49249 __ret_346 = vsetq_lane_s64(vgetq_lane_s64(__s2_346, __p3_346), __s0_346, __p1_346); \
49123#define vcopyq_laneq_s16(__p0_346, __p1_346, __p2_346, __p3_346) __extension__ ({ \
49124 int16x8_t __ret_346; \
49125 int16x8_t __s0_346 = __p0_346; \
49126 int16x8_t __s2_346 = __p2_346; \
49127 __ret_346 = vsetq_lane_s16(vgetq_lane_s16(__s2_346, __p3_346), __s0_346, __p1_346); \
4925049128 __ret_346; \
4925149129})
4925249130#else
49253#define vcopyq_laneq_s64(__p0_347, __p1_347, __p2_347, __p3_347) __extension__ ({ \
49254 int64x2_t __ret_347; \
49255 int64x2_t __s0_347 = __p0_347; \
49256 int64x2_t __s2_347 = __p2_347; \
49257 int64x2_t __rev0_347; __rev0_347 = __builtin_shufflevector(__s0_347, __s0_347, __lane_reverse_128_64); \
49258 int64x2_t __rev2_347; __rev2_347 = __builtin_shufflevector(__s2_347, __s2_347, __lane_reverse_128_64); \
49259 __ret_347 = __noswap_vsetq_lane_s64(__noswap_vgetq_lane_s64(__rev2_347, __p3_347), __rev0_347, __p1_347); \
49260 __ret_347 = __builtin_shufflevector(__ret_347, __ret_347, __lane_reverse_128_64); \
49131#define vcopyq_laneq_s16(__p0_347, __p1_347, __p2_347, __p3_347) __extension__ ({ \
49132 int16x8_t __ret_347; \
49133 int16x8_t __s0_347 = __p0_347; \
49134 int16x8_t __s2_347 = __p2_347; \
49135 int16x8_t __rev0_347; __rev0_347 = __builtin_shufflevector(__s0_347, __s0_347, __lane_reverse_128_16); \
49136 int16x8_t __rev2_347; __rev2_347 = __builtin_shufflevector(__s2_347, __s2_347, __lane_reverse_128_16); \
49137 __ret_347 = __noswap_vsetq_lane_s16(__noswap_vgetq_lane_s16(__rev2_347, __p3_347), __rev0_347, __p1_347); \
49138 __ret_347 = __builtin_shufflevector(__ret_347, __ret_347, __lane_reverse_128_16); \
4926149139 __ret_347; \
4926249140})
4926349141#endif
4926449142
4926549143#ifdef __LITTLE_ENDIAN__
49266#define vcopyq_laneq_mf8(__p0_348, __p1_348, __p2_348, __p3_348) __extension__ ({ \
49267 mfloat8x16_t __ret_348; \
49268 mfloat8x16_t __s0_348 = __p0_348; \
49269 mfloat8x16_t __s2_348 = __p2_348; \
49270 __ret_348 = vsetq_lane_mf8(vgetq_lane_mf8(__s2_348, __p3_348), __s0_348, __p1_348); \
49144#define vcopyq_laneq_bf16(__p0_348, __p1_348, __p2_348, __p3_348) __extension__ ({ \
49145 bfloat16x8_t __ret_348; \
49146 bfloat16x8_t __s0_348 = __p0_348; \
49147 bfloat16x8_t __s2_348 = __p2_348; \
49148 __ret_348 = vsetq_lane_bf16(vgetq_lane_bf16(__s2_348, __p3_348), __s0_348, __p1_348); \
4927149149 __ret_348; \
4927249150})
4927349151#else
49274#define vcopyq_laneq_mf8(__p0_349, __p1_349, __p2_349, __p3_349) __extension__ ({ \
49275 mfloat8x16_t __ret_349; \
49276 mfloat8x16_t __s0_349 = __p0_349; \
49277 mfloat8x16_t __s2_349 = __p2_349; \
49278 mfloat8x16_t __rev0_349; __rev0_349 = __builtin_shufflevector(__s0_349, __s0_349, __lane_reverse_128_8); \
49279 mfloat8x16_t __rev2_349; __rev2_349 = __builtin_shufflevector(__s2_349, __s2_349, __lane_reverse_128_8); \
49280 __ret_349 = __noswap_vsetq_lane_mf8(__noswap_vgetq_lane_mf8(__rev2_349, __p3_349), __rev0_349, __p1_349); \
49281 __ret_349 = __builtin_shufflevector(__ret_349, __ret_349, __lane_reverse_128_8); \
49152#define vcopyq_laneq_bf16(__p0_349, __p1_349, __p2_349, __p3_349) __extension__ ({ \
49153 bfloat16x8_t __ret_349; \
49154 bfloat16x8_t __s0_349 = __p0_349; \
49155 bfloat16x8_t __s2_349 = __p2_349; \
49156 bfloat16x8_t __rev0_349; __rev0_349 = __builtin_shufflevector(__s0_349, __s0_349, __lane_reverse_128_16); \
49157 bfloat16x8_t __rev2_349; __rev2_349 = __builtin_shufflevector(__s2_349, __s2_349, __lane_reverse_128_16); \
49158 __ret_349 = __noswap_vsetq_lane_bf16(__noswap_vgetq_lane_bf16(__rev2_349, __p3_349), __rev0_349, __p1_349); \
49159 __ret_349 = __builtin_shufflevector(__ret_349, __ret_349, __lane_reverse_128_16); \
4928249160 __ret_349; \
4928349161})
4928449162#endif
4928549163
4928649164#ifdef __LITTLE_ENDIAN__
49287#define vcopyq_laneq_s16(__p0_350, __p1_350, __p2_350, __p3_350) __extension__ ({ \
49288 int16x8_t __ret_350; \
49289 int16x8_t __s0_350 = __p0_350; \
49290 int16x8_t __s2_350 = __p2_350; \
49291 __ret_350 = vsetq_lane_s16(vgetq_lane_s16(__s2_350, __p3_350), __s0_350, __p1_350); \
49165#define vcopy_laneq_p8(__p0_350, __p1_350, __p2_350, __p3_350) __extension__ ({ \
49166 poly8x8_t __ret_350; \
49167 poly8x8_t __s0_350 = __p0_350; \
49168 poly8x16_t __s2_350 = __p2_350; \
49169 __ret_350 = vset_lane_p8(vgetq_lane_p8(__s2_350, __p3_350), __s0_350, __p1_350); \
4929249170 __ret_350; \
4929349171})
4929449172#else
49295#define vcopyq_laneq_s16(__p0_351, __p1_351, __p2_351, __p3_351) __extension__ ({ \
49296 int16x8_t __ret_351; \
49297 int16x8_t __s0_351 = __p0_351; \
49298 int16x8_t __s2_351 = __p2_351; \
49299 int16x8_t __rev0_351; __rev0_351 = __builtin_shufflevector(__s0_351, __s0_351, __lane_reverse_128_16); \
49300 int16x8_t __rev2_351; __rev2_351 = __builtin_shufflevector(__s2_351, __s2_351, __lane_reverse_128_16); \
49301 __ret_351 = __noswap_vsetq_lane_s16(__noswap_vgetq_lane_s16(__rev2_351, __p3_351), __rev0_351, __p1_351); \
49302 __ret_351 = __builtin_shufflevector(__ret_351, __ret_351, __lane_reverse_128_16); \
49173#define vcopy_laneq_p8(__p0_351, __p1_351, __p2_351, __p3_351) __extension__ ({ \
49174 poly8x8_t __ret_351; \
49175 poly8x8_t __s0_351 = __p0_351; \
49176 poly8x16_t __s2_351 = __p2_351; \
49177 poly8x8_t __rev0_351; __rev0_351 = __builtin_shufflevector(__s0_351, __s0_351, __lane_reverse_64_8); \
49178 poly8x16_t __rev2_351; __rev2_351 = __builtin_shufflevector(__s2_351, __s2_351, __lane_reverse_128_8); \
49179 __ret_351 = __noswap_vset_lane_p8(__noswap_vgetq_lane_p8(__rev2_351, __p3_351), __rev0_351, __p1_351); \
49180 __ret_351 = __builtin_shufflevector(__ret_351, __ret_351, __lane_reverse_64_8); \
4930349181 __ret_351; \
4930449182})
4930549183#endif
4930649184
4930749185#ifdef __LITTLE_ENDIAN__
49308#define vcopy_laneq_p8(__p0_352, __p1_352, __p2_352, __p3_352) __extension__ ({ \
49309 poly8x8_t __ret_352; \
49310 poly8x8_t __s0_352 = __p0_352; \
49311 poly8x16_t __s2_352 = __p2_352; \
49312 __ret_352 = vset_lane_p8(vgetq_lane_p8(__s2_352, __p3_352), __s0_352, __p1_352); \
49186#define vcopy_laneq_p16(__p0_352, __p1_352, __p2_352, __p3_352) __extension__ ({ \
49187 poly16x4_t __ret_352; \
49188 poly16x4_t __s0_352 = __p0_352; \
49189 poly16x8_t __s2_352 = __p2_352; \
49190 __ret_352 = vset_lane_p16(vgetq_lane_p16(__s2_352, __p3_352), __s0_352, __p1_352); \
4931349191 __ret_352; \
4931449192})
4931549193#else
49316#define vcopy_laneq_p8(__p0_353, __p1_353, __p2_353, __p3_353) __extension__ ({ \
49317 poly8x8_t __ret_353; \
49318 poly8x8_t __s0_353 = __p0_353; \
49319 poly8x16_t __s2_353 = __p2_353; \
49320 poly8x8_t __rev0_353; __rev0_353 = __builtin_shufflevector(__s0_353, __s0_353, __lane_reverse_64_8); \
49321 poly8x16_t __rev2_353; __rev2_353 = __builtin_shufflevector(__s2_353, __s2_353, __lane_reverse_128_8); \
49322 __ret_353 = __noswap_vset_lane_p8(__noswap_vgetq_lane_p8(__rev2_353, __p3_353), __rev0_353, __p1_353); \
49323 __ret_353 = __builtin_shufflevector(__ret_353, __ret_353, __lane_reverse_64_8); \
49194#define vcopy_laneq_p16(__p0_353, __p1_353, __p2_353, __p3_353) __extension__ ({ \
49195 poly16x4_t __ret_353; \
49196 poly16x4_t __s0_353 = __p0_353; \
49197 poly16x8_t __s2_353 = __p2_353; \
49198 poly16x4_t __rev0_353; __rev0_353 = __builtin_shufflevector(__s0_353, __s0_353, __lane_reverse_64_16); \
49199 poly16x8_t __rev2_353; __rev2_353 = __builtin_shufflevector(__s2_353, __s2_353, __lane_reverse_128_16); \
49200 __ret_353 = __noswap_vset_lane_p16(__noswap_vgetq_lane_p16(__rev2_353, __p3_353), __rev0_353, __p1_353); \
49201 __ret_353 = __builtin_shufflevector(__ret_353, __ret_353, __lane_reverse_64_16); \
4932449202 __ret_353; \
4932549203})
4932649204#endif
4932749205
4932849206#ifdef __LITTLE_ENDIAN__
49329#define vcopy_laneq_p16(__p0_354, __p1_354, __p2_354, __p3_354) __extension__ ({ \
49330 poly16x4_t __ret_354; \
49331 poly16x4_t __s0_354 = __p0_354; \
49332 poly16x8_t __s2_354 = __p2_354; \
49333 __ret_354 = vset_lane_p16(vgetq_lane_p16(__s2_354, __p3_354), __s0_354, __p1_354); \
49207#define vcopy_laneq_u8(__p0_354, __p1_354, __p2_354, __p3_354) __extension__ ({ \
49208 uint8x8_t __ret_354; \
49209 uint8x8_t __s0_354 = __p0_354; \
49210 uint8x16_t __s2_354 = __p2_354; \
49211 __ret_354 = vset_lane_u8(vgetq_lane_u8(__s2_354, __p3_354), __s0_354, __p1_354); \
4933449212 __ret_354; \
4933549213})
4933649214#else
49337#define vcopy_laneq_p16(__p0_355, __p1_355, __p2_355, __p3_355) __extension__ ({ \
49338 poly16x4_t __ret_355; \
49339 poly16x4_t __s0_355 = __p0_355; \
49340 poly16x8_t __s2_355 = __p2_355; \
49341 poly16x4_t __rev0_355; __rev0_355 = __builtin_shufflevector(__s0_355, __s0_355, __lane_reverse_64_16); \
49342 poly16x8_t __rev2_355; __rev2_355 = __builtin_shufflevector(__s2_355, __s2_355, __lane_reverse_128_16); \
49343 __ret_355 = __noswap_vset_lane_p16(__noswap_vgetq_lane_p16(__rev2_355, __p3_355), __rev0_355, __p1_355); \
49344 __ret_355 = __builtin_shufflevector(__ret_355, __ret_355, __lane_reverse_64_16); \
49215#define vcopy_laneq_u8(__p0_355, __p1_355, __p2_355, __p3_355) __extension__ ({ \
49216 uint8x8_t __ret_355; \
49217 uint8x8_t __s0_355 = __p0_355; \
49218 uint8x16_t __s2_355 = __p2_355; \
49219 uint8x8_t __rev0_355; __rev0_355 = __builtin_shufflevector(__s0_355, __s0_355, __lane_reverse_64_8); \
49220 uint8x16_t __rev2_355; __rev2_355 = __builtin_shufflevector(__s2_355, __s2_355, __lane_reverse_128_8); \
49221 __ret_355 = __noswap_vset_lane_u8(__noswap_vgetq_lane_u8(__rev2_355, __p3_355), __rev0_355, __p1_355); \
49222 __ret_355 = __builtin_shufflevector(__ret_355, __ret_355, __lane_reverse_64_8); \
4934549223 __ret_355; \
4934649224})
4934749225#endif
4934849226
4934949227#ifdef __LITTLE_ENDIAN__
49350#define vcopy_laneq_u8(__p0_356, __p1_356, __p2_356, __p3_356) __extension__ ({ \
49351 uint8x8_t __ret_356; \
49352 uint8x8_t __s0_356 = __p0_356; \
49353 uint8x16_t __s2_356 = __p2_356; \
49354 __ret_356 = vset_lane_u8(vgetq_lane_u8(__s2_356, __p3_356), __s0_356, __p1_356); \
49228#define vcopy_laneq_u32(__p0_356, __p1_356, __p2_356, __p3_356) __extension__ ({ \
49229 uint32x2_t __ret_356; \
49230 uint32x2_t __s0_356 = __p0_356; \
49231 uint32x4_t __s2_356 = __p2_356; \
49232 __ret_356 = vset_lane_u32(vgetq_lane_u32(__s2_356, __p3_356), __s0_356, __p1_356); \
4935549233 __ret_356; \
4935649234})
4935749235#else
49358#define vcopy_laneq_u8(__p0_357, __p1_357, __p2_357, __p3_357) __extension__ ({ \
49359 uint8x8_t __ret_357; \
49360 uint8x8_t __s0_357 = __p0_357; \
49361 uint8x16_t __s2_357 = __p2_357; \
49362 uint8x8_t __rev0_357; __rev0_357 = __builtin_shufflevector(__s0_357, __s0_357, __lane_reverse_64_8); \
49363 uint8x16_t __rev2_357; __rev2_357 = __builtin_shufflevector(__s2_357, __s2_357, __lane_reverse_128_8); \
49364 __ret_357 = __noswap_vset_lane_u8(__noswap_vgetq_lane_u8(__rev2_357, __p3_357), __rev0_357, __p1_357); \
49365 __ret_357 = __builtin_shufflevector(__ret_357, __ret_357, __lane_reverse_64_8); \
49236#define vcopy_laneq_u32(__p0_357, __p1_357, __p2_357, __p3_357) __extension__ ({ \
49237 uint32x2_t __ret_357; \
49238 uint32x2_t __s0_357 = __p0_357; \
49239 uint32x4_t __s2_357 = __p2_357; \
49240 uint32x2_t __rev0_357; __rev0_357 = __builtin_shufflevector(__s0_357, __s0_357, __lane_reverse_64_32); \
49241 uint32x4_t __rev2_357; __rev2_357 = __builtin_shufflevector(__s2_357, __s2_357, __lane_reverse_128_32); \
49242 __ret_357 = __noswap_vset_lane_u32(__noswap_vgetq_lane_u32(__rev2_357, __p3_357), __rev0_357, __p1_357); \
49243 __ret_357 = __builtin_shufflevector(__ret_357, __ret_357, __lane_reverse_64_32); \
4936649244 __ret_357; \
4936749245})
4936849246#endif
4936949247
4937049248#ifdef __LITTLE_ENDIAN__
49371#define vcopy_laneq_u32(__p0_358, __p1_358, __p2_358, __p3_358) __extension__ ({ \
49372 uint32x2_t __ret_358; \
49373 uint32x2_t __s0_358 = __p0_358; \
49374 uint32x4_t __s2_358 = __p2_358; \
49375 __ret_358 = vset_lane_u32(vgetq_lane_u32(__s2_358, __p3_358), __s0_358, __p1_358); \
49249#define vcopy_laneq_u64(__p0_358, __p1_358, __p2_358, __p3_358) __extension__ ({ \
49250 uint64x1_t __ret_358; \
49251 uint64x1_t __s0_358 = __p0_358; \
49252 uint64x2_t __s2_358 = __p2_358; \
49253 __ret_358 = vset_lane_u64(vgetq_lane_u64(__s2_358, __p3_358), __s0_358, __p1_358); \
4937649254 __ret_358; \
4937749255})
4937849256#else
49379#define vcopy_laneq_u32(__p0_359, __p1_359, __p2_359, __p3_359) __extension__ ({ \
49380 uint32x2_t __ret_359; \
49381 uint32x2_t __s0_359 = __p0_359; \
49382 uint32x4_t __s2_359 = __p2_359; \
49383 uint32x2_t __rev0_359; __rev0_359 = __builtin_shufflevector(__s0_359, __s0_359, __lane_reverse_64_32); \
49384 uint32x4_t __rev2_359; __rev2_359 = __builtin_shufflevector(__s2_359, __s2_359, __lane_reverse_128_32); \
49385 __ret_359 = __noswap_vset_lane_u32(__noswap_vgetq_lane_u32(__rev2_359, __p3_359), __rev0_359, __p1_359); \
49386 __ret_359 = __builtin_shufflevector(__ret_359, __ret_359, __lane_reverse_64_32); \
49257#define vcopy_laneq_u64(__p0_359, __p1_359, __p2_359, __p3_359) __extension__ ({ \
49258 uint64x1_t __ret_359; \
49259 uint64x1_t __s0_359 = __p0_359; \
49260 uint64x2_t __s2_359 = __p2_359; \
49261 uint64x2_t __rev2_359; __rev2_359 = __builtin_shufflevector(__s2_359, __s2_359, __lane_reverse_128_64); \
49262 __ret_359 = vset_lane_u64(__noswap_vgetq_lane_u64(__rev2_359, __p3_359), __s0_359, __p1_359); \
4938749263 __ret_359; \
4938849264})
4938949265#endif
4939049266
4939149267#ifdef __LITTLE_ENDIAN__
49392#define vcopy_laneq_u64(__p0_360, __p1_360, __p2_360, __p3_360) __extension__ ({ \
49393 uint64x1_t __ret_360; \
49394 uint64x1_t __s0_360 = __p0_360; \
49395 uint64x2_t __s2_360 = __p2_360; \
49396 __ret_360 = vset_lane_u64(vgetq_lane_u64(__s2_360, __p3_360), __s0_360, __p1_360); \
49268#define vcopy_laneq_u16(__p0_360, __p1_360, __p2_360, __p3_360) __extension__ ({ \
49269 uint16x4_t __ret_360; \
49270 uint16x4_t __s0_360 = __p0_360; \
49271 uint16x8_t __s2_360 = __p2_360; \
49272 __ret_360 = vset_lane_u16(vgetq_lane_u16(__s2_360, __p3_360), __s0_360, __p1_360); \
4939749273 __ret_360; \
4939849274})
4939949275#else
49400#define vcopy_laneq_u64(__p0_361, __p1_361, __p2_361, __p3_361) __extension__ ({ \
49401 uint64x1_t __ret_361; \
49402 uint64x1_t __s0_361 = __p0_361; \
49403 uint64x2_t __s2_361 = __p2_361; \
49404 uint64x2_t __rev2_361; __rev2_361 = __builtin_shufflevector(__s2_361, __s2_361, __lane_reverse_128_64); \
49405 __ret_361 = vset_lane_u64(__noswap_vgetq_lane_u64(__rev2_361, __p3_361), __s0_361, __p1_361); \
49276#define vcopy_laneq_u16(__p0_361, __p1_361, __p2_361, __p3_361) __extension__ ({ \
49277 uint16x4_t __ret_361; \
49278 uint16x4_t __s0_361 = __p0_361; \
49279 uint16x8_t __s2_361 = __p2_361; \
49280 uint16x4_t __rev0_361; __rev0_361 = __builtin_shufflevector(__s0_361, __s0_361, __lane_reverse_64_16); \
49281 uint16x8_t __rev2_361; __rev2_361 = __builtin_shufflevector(__s2_361, __s2_361, __lane_reverse_128_16); \
49282 __ret_361 = __noswap_vset_lane_u16(__noswap_vgetq_lane_u16(__rev2_361, __p3_361), __rev0_361, __p1_361); \
49283 __ret_361 = __builtin_shufflevector(__ret_361, __ret_361, __lane_reverse_64_16); \
4940649284 __ret_361; \
4940749285})
4940849286#endif
4940949287
4941049288#ifdef __LITTLE_ENDIAN__
49411#define vcopy_laneq_u16(__p0_362, __p1_362, __p2_362, __p3_362) __extension__ ({ \
49412 uint16x4_t __ret_362; \
49413 uint16x4_t __s0_362 = __p0_362; \
49414 uint16x8_t __s2_362 = __p2_362; \
49415 __ret_362 = vset_lane_u16(vgetq_lane_u16(__s2_362, __p3_362), __s0_362, __p1_362); \
49289#define vcopy_laneq_s8(__p0_362, __p1_362, __p2_362, __p3_362) __extension__ ({ \
49290 int8x8_t __ret_362; \
49291 int8x8_t __s0_362 = __p0_362; \
49292 int8x16_t __s2_362 = __p2_362; \
49293 __ret_362 = vset_lane_s8(vgetq_lane_s8(__s2_362, __p3_362), __s0_362, __p1_362); \
4941649294 __ret_362; \
4941749295})
4941849296#else
49419#define vcopy_laneq_u16(__p0_363, __p1_363, __p2_363, __p3_363) __extension__ ({ \
49420 uint16x4_t __ret_363; \
49421 uint16x4_t __s0_363 = __p0_363; \
49422 uint16x8_t __s2_363 = __p2_363; \
49423 uint16x4_t __rev0_363; __rev0_363 = __builtin_shufflevector(__s0_363, __s0_363, __lane_reverse_64_16); \
49424 uint16x8_t __rev2_363; __rev2_363 = __builtin_shufflevector(__s2_363, __s2_363, __lane_reverse_128_16); \
49425 __ret_363 = __noswap_vset_lane_u16(__noswap_vgetq_lane_u16(__rev2_363, __p3_363), __rev0_363, __p1_363); \
49426 __ret_363 = __builtin_shufflevector(__ret_363, __ret_363, __lane_reverse_64_16); \
49297#define vcopy_laneq_s8(__p0_363, __p1_363, __p2_363, __p3_363) __extension__ ({ \
49298 int8x8_t __ret_363; \
49299 int8x8_t __s0_363 = __p0_363; \
49300 int8x16_t __s2_363 = __p2_363; \
49301 int8x8_t __rev0_363; __rev0_363 = __builtin_shufflevector(__s0_363, __s0_363, __lane_reverse_64_8); \
49302 int8x16_t __rev2_363; __rev2_363 = __builtin_shufflevector(__s2_363, __s2_363, __lane_reverse_128_8); \
49303 __ret_363 = __noswap_vset_lane_s8(__noswap_vgetq_lane_s8(__rev2_363, __p3_363), __rev0_363, __p1_363); \
49304 __ret_363 = __builtin_shufflevector(__ret_363, __ret_363, __lane_reverse_64_8); \
4942749305 __ret_363; \
4942849306})
4942949307#endif
4943049308
4943149309#ifdef __LITTLE_ENDIAN__
49432#define vcopy_laneq_s8(__p0_364, __p1_364, __p2_364, __p3_364) __extension__ ({ \
49433 int8x8_t __ret_364; \
49434 int8x8_t __s0_364 = __p0_364; \
49435 int8x16_t __s2_364 = __p2_364; \
49436 __ret_364 = vset_lane_s8(vgetq_lane_s8(__s2_364, __p3_364), __s0_364, __p1_364); \
49310#define vcopy_laneq_f32(__p0_364, __p1_364, __p2_364, __p3_364) __extension__ ({ \
49311 float32x2_t __ret_364; \
49312 float32x2_t __s0_364 = __p0_364; \
49313 float32x4_t __s2_364 = __p2_364; \
49314 __ret_364 = vset_lane_f32(vgetq_lane_f32(__s2_364, __p3_364), __s0_364, __p1_364); \
4943749315 __ret_364; \
4943849316})
4943949317#else
49440#define vcopy_laneq_s8(__p0_365, __p1_365, __p2_365, __p3_365) __extension__ ({ \
49441 int8x8_t __ret_365; \
49442 int8x8_t __s0_365 = __p0_365; \
49443 int8x16_t __s2_365 = __p2_365; \
49444 int8x8_t __rev0_365; __rev0_365 = __builtin_shufflevector(__s0_365, __s0_365, __lane_reverse_64_8); \
49445 int8x16_t __rev2_365; __rev2_365 = __builtin_shufflevector(__s2_365, __s2_365, __lane_reverse_128_8); \
49446 __ret_365 = __noswap_vset_lane_s8(__noswap_vgetq_lane_s8(__rev2_365, __p3_365), __rev0_365, __p1_365); \
49447 __ret_365 = __builtin_shufflevector(__ret_365, __ret_365, __lane_reverse_64_8); \
49318#define vcopy_laneq_f32(__p0_365, __p1_365, __p2_365, __p3_365) __extension__ ({ \
49319 float32x2_t __ret_365; \
49320 float32x2_t __s0_365 = __p0_365; \
49321 float32x4_t __s2_365 = __p2_365; \
49322 float32x2_t __rev0_365; __rev0_365 = __builtin_shufflevector(__s0_365, __s0_365, __lane_reverse_64_32); \
49323 float32x4_t __rev2_365; __rev2_365 = __builtin_shufflevector(__s2_365, __s2_365, __lane_reverse_128_32); \
49324 __ret_365 = __noswap_vset_lane_f32(__noswap_vgetq_lane_f32(__rev2_365, __p3_365), __rev0_365, __p1_365); \
49325 __ret_365 = __builtin_shufflevector(__ret_365, __ret_365, __lane_reverse_64_32); \
4944849326 __ret_365; \
4944949327})
4945049328#endif
4945149329
4945249330#ifdef __LITTLE_ENDIAN__
49453#define vcopy_laneq_f32(__p0_366, __p1_366, __p2_366, __p3_366) __extension__ ({ \
49454 float32x2_t __ret_366; \
49455 float32x2_t __s0_366 = __p0_366; \
49456 float32x4_t __s2_366 = __p2_366; \
49457 __ret_366 = vset_lane_f32(vgetq_lane_f32(__s2_366, __p3_366), __s0_366, __p1_366); \
49331#define vcopy_laneq_s32(__p0_366, __p1_366, __p2_366, __p3_366) __extension__ ({ \
49332 int32x2_t __ret_366; \
49333 int32x2_t __s0_366 = __p0_366; \
49334 int32x4_t __s2_366 = __p2_366; \
49335 __ret_366 = vset_lane_s32(vgetq_lane_s32(__s2_366, __p3_366), __s0_366, __p1_366); \
4945849336 __ret_366; \
4945949337})
4946049338#else
49461#define vcopy_laneq_f32(__p0_367, __p1_367, __p2_367, __p3_367) __extension__ ({ \
49462 float32x2_t __ret_367; \
49463 float32x2_t __s0_367 = __p0_367; \
49464 float32x4_t __s2_367 = __p2_367; \
49465 float32x2_t __rev0_367; __rev0_367 = __builtin_shufflevector(__s0_367, __s0_367, __lane_reverse_64_32); \
49466 float32x4_t __rev2_367; __rev2_367 = __builtin_shufflevector(__s2_367, __s2_367, __lane_reverse_128_32); \
49467 __ret_367 = __noswap_vset_lane_f32(__noswap_vgetq_lane_f32(__rev2_367, __p3_367), __rev0_367, __p1_367); \
49339#define vcopy_laneq_s32(__p0_367, __p1_367, __p2_367, __p3_367) __extension__ ({ \
49340 int32x2_t __ret_367; \
49341 int32x2_t __s0_367 = __p0_367; \
49342 int32x4_t __s2_367 = __p2_367; \
49343 int32x2_t __rev0_367; __rev0_367 = __builtin_shufflevector(__s0_367, __s0_367, __lane_reverse_64_32); \
49344 int32x4_t __rev2_367; __rev2_367 = __builtin_shufflevector(__s2_367, __s2_367, __lane_reverse_128_32); \
49345 __ret_367 = __noswap_vset_lane_s32(__noswap_vgetq_lane_s32(__rev2_367, __p3_367), __rev0_367, __p1_367); \
4946849346 __ret_367 = __builtin_shufflevector(__ret_367, __ret_367, __lane_reverse_64_32); \
4946949347 __ret_367; \
4947049348})
4947149349#endif
4947249350
4947349351#ifdef __LITTLE_ENDIAN__
49474#define vcopy_laneq_s32(__p0_368, __p1_368, __p2_368, __p3_368) __extension__ ({ \
49475 int32x2_t __ret_368; \
49476 int32x2_t __s0_368 = __p0_368; \
49477 int32x4_t __s2_368 = __p2_368; \
49478 __ret_368 = vset_lane_s32(vgetq_lane_s32(__s2_368, __p3_368), __s0_368, __p1_368); \
49352#define vcopy_laneq_s64(__p0_368, __p1_368, __p2_368, __p3_368) __extension__ ({ \
49353 int64x1_t __ret_368; \
49354 int64x1_t __s0_368 = __p0_368; \
49355 int64x2_t __s2_368 = __p2_368; \
49356 __ret_368 = vset_lane_s64(vgetq_lane_s64(__s2_368, __p3_368), __s0_368, __p1_368); \
4947949357 __ret_368; \
4948049358})
4948149359#else
49482#define vcopy_laneq_s32(__p0_369, __p1_369, __p2_369, __p3_369) __extension__ ({ \
49483 int32x2_t __ret_369; \
49484 int32x2_t __s0_369 = __p0_369; \
49485 int32x4_t __s2_369 = __p2_369; \
49486 int32x2_t __rev0_369; __rev0_369 = __builtin_shufflevector(__s0_369, __s0_369, __lane_reverse_64_32); \
49487 int32x4_t __rev2_369; __rev2_369 = __builtin_shufflevector(__s2_369, __s2_369, __lane_reverse_128_32); \
49488 __ret_369 = __noswap_vset_lane_s32(__noswap_vgetq_lane_s32(__rev2_369, __p3_369), __rev0_369, __p1_369); \
49489 __ret_369 = __builtin_shufflevector(__ret_369, __ret_369, __lane_reverse_64_32); \
49360#define vcopy_laneq_s64(__p0_369, __p1_369, __p2_369, __p3_369) __extension__ ({ \
49361 int64x1_t __ret_369; \
49362 int64x1_t __s0_369 = __p0_369; \
49363 int64x2_t __s2_369 = __p2_369; \
49364 int64x2_t __rev2_369; __rev2_369 = __builtin_shufflevector(__s2_369, __s2_369, __lane_reverse_128_64); \
49365 __ret_369 = vset_lane_s64(__noswap_vgetq_lane_s64(__rev2_369, __p3_369), __s0_369, __p1_369); \
4949049366 __ret_369; \
4949149367})
4949249368#endif
4949349369
4949449370#ifdef __LITTLE_ENDIAN__
49495#define vcopy_laneq_s64(__p0_370, __p1_370, __p2_370, __p3_370) __extension__ ({ \
49496 int64x1_t __ret_370; \
49497 int64x1_t __s0_370 = __p0_370; \
49498 int64x2_t __s2_370 = __p2_370; \
49499 __ret_370 = vset_lane_s64(vgetq_lane_s64(__s2_370, __p3_370), __s0_370, __p1_370); \
49371#define vcopy_laneq_mf8(__p0_370, __p1_370, __p2_370, __p3_370) __extension__ ({ \
49372 mfloat8x8_t __ret_370; \
49373 mfloat8x8_t __s0_370 = __p0_370; \
49374 mfloat8x16_t __s2_370 = __p2_370; \
49375 __ret_370 = vset_lane_mf8(vgetq_lane_mf8(__s2_370, __p3_370), __s0_370, __p1_370); \
4950049376 __ret_370; \
4950149377})
4950249378#else
49503#define vcopy_laneq_s64(__p0_371, __p1_371, __p2_371, __p3_371) __extension__ ({ \
49504 int64x1_t __ret_371; \
49505 int64x1_t __s0_371 = __p0_371; \
49506 int64x2_t __s2_371 = __p2_371; \
49507 int64x2_t __rev2_371; __rev2_371 = __builtin_shufflevector(__s2_371, __s2_371, __lane_reverse_128_64); \
49508 __ret_371 = vset_lane_s64(__noswap_vgetq_lane_s64(__rev2_371, __p3_371), __s0_371, __p1_371); \
49379#define vcopy_laneq_mf8(__p0_371, __p1_371, __p2_371, __p3_371) __extension__ ({ \
49380 mfloat8x8_t __ret_371; \
49381 mfloat8x8_t __s0_371 = __p0_371; \
49382 mfloat8x16_t __s2_371 = __p2_371; \
49383 mfloat8x8_t __rev0_371; __rev0_371 = __builtin_shufflevector(__s0_371, __s0_371, __lane_reverse_64_8); \
49384 mfloat8x16_t __rev2_371; __rev2_371 = __builtin_shufflevector(__s2_371, __s2_371, __lane_reverse_128_8); \
49385 __ret_371 = __noswap_vset_lane_mf8(__noswap_vgetq_lane_mf8(__rev2_371, __p3_371), __rev0_371, __p1_371); \
49386 __ret_371 = __builtin_shufflevector(__ret_371, __ret_371, __lane_reverse_64_8); \
4950949387 __ret_371; \
4951049388})
4951149389#endif
4951249390
4951349391#ifdef __LITTLE_ENDIAN__
49514#define vcopy_laneq_mf8(__p0_372, __p1_372, __p2_372, __p3_372) __extension__ ({ \
49515 mfloat8x8_t __ret_372; \
49516 mfloat8x8_t __s0_372 = __p0_372; \
49517 mfloat8x16_t __s2_372 = __p2_372; \
49518 __ret_372 = vset_lane_mf8(vgetq_lane_mf8(__s2_372, __p3_372), __s0_372, __p1_372); \
49392#define vcopy_laneq_s16(__p0_372, __p1_372, __p2_372, __p3_372) __extension__ ({ \
49393 int16x4_t __ret_372; \
49394 int16x4_t __s0_372 = __p0_372; \
49395 int16x8_t __s2_372 = __p2_372; \
49396 __ret_372 = vset_lane_s16(vgetq_lane_s16(__s2_372, __p3_372), __s0_372, __p1_372); \
4951949397 __ret_372; \
4952049398})
4952149399#else
49522#define vcopy_laneq_mf8(__p0_373, __p1_373, __p2_373, __p3_373) __extension__ ({ \
49523 mfloat8x8_t __ret_373; \
49524 mfloat8x8_t __s0_373 = __p0_373; \
49525 mfloat8x16_t __s2_373 = __p2_373; \
49526 mfloat8x8_t __rev0_373; __rev0_373 = __builtin_shufflevector(__s0_373, __s0_373, __lane_reverse_64_8); \
49527 mfloat8x16_t __rev2_373; __rev2_373 = __builtin_shufflevector(__s2_373, __s2_373, __lane_reverse_128_8); \
49528 __ret_373 = __noswap_vset_lane_mf8(__noswap_vgetq_lane_mf8(__rev2_373, __p3_373), __rev0_373, __p1_373); \
49529 __ret_373 = __builtin_shufflevector(__ret_373, __ret_373, __lane_reverse_64_8); \
49400#define vcopy_laneq_s16(__p0_373, __p1_373, __p2_373, __p3_373) __extension__ ({ \
49401 int16x4_t __ret_373; \
49402 int16x4_t __s0_373 = __p0_373; \
49403 int16x8_t __s2_373 = __p2_373; \
49404 int16x4_t __rev0_373; __rev0_373 = __builtin_shufflevector(__s0_373, __s0_373, __lane_reverse_64_16); \
49405 int16x8_t __rev2_373; __rev2_373 = __builtin_shufflevector(__s2_373, __s2_373, __lane_reverse_128_16); \
49406 __ret_373 = __noswap_vset_lane_s16(__noswap_vgetq_lane_s16(__rev2_373, __p3_373), __rev0_373, __p1_373); \
49407 __ret_373 = __builtin_shufflevector(__ret_373, __ret_373, __lane_reverse_64_16); \
4953049408 __ret_373; \
4953149409})
4953249410#endif
4953349411
4953449412#ifdef __LITTLE_ENDIAN__
49535#define vcopy_laneq_s16(__p0_374, __p1_374, __p2_374, __p3_374) __extension__ ({ \
49536 int16x4_t __ret_374; \
49537 int16x4_t __s0_374 = __p0_374; \
49538 int16x8_t __s2_374 = __p2_374; \
49539 __ret_374 = vset_lane_s16(vgetq_lane_s16(__s2_374, __p3_374), __s0_374, __p1_374); \
49413#define vcopy_laneq_bf16(__p0_374, __p1_374, __p2_374, __p3_374) __extension__ ({ \
49414 bfloat16x4_t __ret_374; \
49415 bfloat16x4_t __s0_374 = __p0_374; \
49416 bfloat16x8_t __s2_374 = __p2_374; \
49417 __ret_374 = vset_lane_bf16(vgetq_lane_bf16(__s2_374, __p3_374), __s0_374, __p1_374); \
4954049418 __ret_374; \
4954149419})
4954249420#else
49543#define vcopy_laneq_s16(__p0_375, __p1_375, __p2_375, __p3_375) __extension__ ({ \
49544 int16x4_t __ret_375; \
49545 int16x4_t __s0_375 = __p0_375; \
49546 int16x8_t __s2_375 = __p2_375; \
49547 int16x4_t __rev0_375; __rev0_375 = __builtin_shufflevector(__s0_375, __s0_375, __lane_reverse_64_16); \
49548 int16x8_t __rev2_375; __rev2_375 = __builtin_shufflevector(__s2_375, __s2_375, __lane_reverse_128_16); \
49549 __ret_375 = __noswap_vset_lane_s16(__noswap_vgetq_lane_s16(__rev2_375, __p3_375), __rev0_375, __p1_375); \
49421#define vcopy_laneq_bf16(__p0_375, __p1_375, __p2_375, __p3_375) __extension__ ({ \
49422 bfloat16x4_t __ret_375; \
49423 bfloat16x4_t __s0_375 = __p0_375; \
49424 bfloat16x8_t __s2_375 = __p2_375; \
49425 bfloat16x4_t __rev0_375; __rev0_375 = __builtin_shufflevector(__s0_375, __s0_375, __lane_reverse_64_16); \
49426 bfloat16x8_t __rev2_375; __rev2_375 = __builtin_shufflevector(__s2_375, __s2_375, __lane_reverse_128_16); \
49427 __ret_375 = __noswap_vset_lane_bf16(__noswap_vgetq_lane_bf16(__rev2_375, __p3_375), __rev0_375, __p1_375); \
4955049428 __ret_375 = __builtin_shufflevector(__ret_375, __ret_375, __lane_reverse_64_16); \
4955149429 __ret_375; \
4955249430})
......@@ -64144,6 +64022,296 @@ __ai __attribute__((target("neon"))) int16x4_t vreinterpret_s16_mf8(mfloat8x8_t
6414464022 __ret = __builtin_bit_cast(int16x4_t, __p0);
6414564023 return __ret;
6414664024}
64025__ai __attribute__((target("neon"))) poly8x8_t vreinterpret_p8_bf16(bfloat16x4_t __p0) {
64026 poly8x8_t __ret;
64027 __ret = __builtin_bit_cast(poly8x8_t, __p0);
64028 return __ret;
64029}
64030__ai __attribute__((target("neon"))) poly64x1_t vreinterpret_p64_bf16(bfloat16x4_t __p0) {
64031 poly64x1_t __ret;
64032 __ret = __builtin_bit_cast(poly64x1_t, __p0);
64033 return __ret;
64034}
64035__ai __attribute__((target("neon"))) poly16x4_t vreinterpret_p16_bf16(bfloat16x4_t __p0) {
64036 poly16x4_t __ret;
64037 __ret = __builtin_bit_cast(poly16x4_t, __p0);
64038 return __ret;
64039}
64040__ai __attribute__((target("neon"))) poly8x16_t vreinterpretq_p8_bf16(bfloat16x8_t __p0) {
64041 poly8x16_t __ret;
64042 __ret = __builtin_bit_cast(poly8x16_t, __p0);
64043 return __ret;
64044}
64045__ai __attribute__((target("neon"))) poly128_t vreinterpretq_p128_bf16(bfloat16x8_t __p0) {
64046 poly128_t __ret;
64047 __ret = __builtin_bit_cast(poly128_t, __p0);
64048 return __ret;
64049}
64050__ai __attribute__((target("neon"))) poly64x2_t vreinterpretq_p64_bf16(bfloat16x8_t __p0) {
64051 poly64x2_t __ret;
64052 __ret = __builtin_bit_cast(poly64x2_t, __p0);
64053 return __ret;
64054}
64055__ai __attribute__((target("neon"))) poly16x8_t vreinterpretq_p16_bf16(bfloat16x8_t __p0) {
64056 poly16x8_t __ret;
64057 __ret = __builtin_bit_cast(poly16x8_t, __p0);
64058 return __ret;
64059}
64060__ai __attribute__((target("neon"))) uint8x16_t vreinterpretq_u8_bf16(bfloat16x8_t __p0) {
64061 uint8x16_t __ret;
64062 __ret = __builtin_bit_cast(uint8x16_t, __p0);
64063 return __ret;
64064}
64065__ai __attribute__((target("neon"))) uint32x4_t vreinterpretq_u32_bf16(bfloat16x8_t __p0) {
64066 uint32x4_t __ret;
64067 __ret = __builtin_bit_cast(uint32x4_t, __p0);
64068 return __ret;
64069}
64070__ai __attribute__((target("neon"))) uint64x2_t vreinterpretq_u64_bf16(bfloat16x8_t __p0) {
64071 uint64x2_t __ret;
64072 __ret = __builtin_bit_cast(uint64x2_t, __p0);
64073 return __ret;
64074}
64075__ai __attribute__((target("neon"))) uint16x8_t vreinterpretq_u16_bf16(bfloat16x8_t __p0) {
64076 uint16x8_t __ret;
64077 __ret = __builtin_bit_cast(uint16x8_t, __p0);
64078 return __ret;
64079}
64080__ai __attribute__((target("neon"))) int8x16_t vreinterpretq_s8_bf16(bfloat16x8_t __p0) {
64081 int8x16_t __ret;
64082 __ret = __builtin_bit_cast(int8x16_t, __p0);
64083 return __ret;
64084}
64085__ai __attribute__((target("neon"))) float64x2_t vreinterpretq_f64_bf16(bfloat16x8_t __p0) {
64086 float64x2_t __ret;
64087 __ret = __builtin_bit_cast(float64x2_t, __p0);
64088 return __ret;
64089}
64090__ai __attribute__((target("neon"))) float32x4_t vreinterpretq_f32_bf16(bfloat16x8_t __p0) {
64091 float32x4_t __ret;
64092 __ret = __builtin_bit_cast(float32x4_t, __p0);
64093 return __ret;
64094}
64095__ai __attribute__((target("neon"))) float16x8_t vreinterpretq_f16_bf16(bfloat16x8_t __p0) {
64096 float16x8_t __ret;
64097 __ret = __builtin_bit_cast(float16x8_t, __p0);
64098 return __ret;
64099}
64100__ai __attribute__((target("neon"))) int32x4_t vreinterpretq_s32_bf16(bfloat16x8_t __p0) {
64101 int32x4_t __ret;
64102 __ret = __builtin_bit_cast(int32x4_t, __p0);
64103 return __ret;
64104}
64105__ai __attribute__((target("neon"))) int64x2_t vreinterpretq_s64_bf16(bfloat16x8_t __p0) {
64106 int64x2_t __ret;
64107 __ret = __builtin_bit_cast(int64x2_t, __p0);
64108 return __ret;
64109}
64110__ai __attribute__((target("neon"))) int16x8_t vreinterpretq_s16_bf16(bfloat16x8_t __p0) {
64111 int16x8_t __ret;
64112 __ret = __builtin_bit_cast(int16x8_t, __p0);
64113 return __ret;
64114}
64115__ai __attribute__((target("neon"))) uint8x8_t vreinterpret_u8_bf16(bfloat16x4_t __p0) {
64116 uint8x8_t __ret;
64117 __ret = __builtin_bit_cast(uint8x8_t, __p0);
64118 return __ret;
64119}
64120__ai __attribute__((target("neon"))) uint32x2_t vreinterpret_u32_bf16(bfloat16x4_t __p0) {
64121 uint32x2_t __ret;
64122 __ret = __builtin_bit_cast(uint32x2_t, __p0);
64123 return __ret;
64124}
64125__ai __attribute__((target("neon"))) uint64x1_t vreinterpret_u64_bf16(bfloat16x4_t __p0) {
64126 uint64x1_t __ret;
64127 __ret = __builtin_bit_cast(uint64x1_t, __p0);
64128 return __ret;
64129}
64130__ai __attribute__((target("neon"))) uint16x4_t vreinterpret_u16_bf16(bfloat16x4_t __p0) {
64131 uint16x4_t __ret;
64132 __ret = __builtin_bit_cast(uint16x4_t, __p0);
64133 return __ret;
64134}
64135__ai __attribute__((target("neon"))) int8x8_t vreinterpret_s8_bf16(bfloat16x4_t __p0) {
64136 int8x8_t __ret;
64137 __ret = __builtin_bit_cast(int8x8_t, __p0);
64138 return __ret;
64139}
64140__ai __attribute__((target("neon"))) float64x1_t vreinterpret_f64_bf16(bfloat16x4_t __p0) {
64141 float64x1_t __ret;
64142 __ret = __builtin_bit_cast(float64x1_t, __p0);
64143 return __ret;
64144}
64145__ai __attribute__((target("neon"))) float32x2_t vreinterpret_f32_bf16(bfloat16x4_t __p0) {
64146 float32x2_t __ret;
64147 __ret = __builtin_bit_cast(float32x2_t, __p0);
64148 return __ret;
64149}
64150__ai __attribute__((target("neon"))) float16x4_t vreinterpret_f16_bf16(bfloat16x4_t __p0) {
64151 float16x4_t __ret;
64152 __ret = __builtin_bit_cast(float16x4_t, __p0);
64153 return __ret;
64154}
64155__ai __attribute__((target("neon"))) int32x2_t vreinterpret_s32_bf16(bfloat16x4_t __p0) {
64156 int32x2_t __ret;
64157 __ret = __builtin_bit_cast(int32x2_t, __p0);
64158 return __ret;
64159}
64160__ai __attribute__((target("neon"))) int64x1_t vreinterpret_s64_bf16(bfloat16x4_t __p0) {
64161 int64x1_t __ret;
64162 __ret = __builtin_bit_cast(int64x1_t, __p0);
64163 return __ret;
64164}
64165__ai __attribute__((target("neon"))) int16x4_t vreinterpret_s16_bf16(bfloat16x4_t __p0) {
64166 int16x4_t __ret;
64167 __ret = __builtin_bit_cast(int16x4_t, __p0);
64168 return __ret;
64169}
64170__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p8(poly8x16_t __p0) {
64171 bfloat16x8_t __ret;
64172 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64173 return __ret;
64174}
64175__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p128(poly128_t __p0) {
64176 bfloat16x8_t __ret;
64177 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64178 return __ret;
64179}
64180__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p64(poly64x2_t __p0) {
64181 bfloat16x8_t __ret;
64182 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64183 return __ret;
64184}
64185__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_p16(poly16x8_t __p0) {
64186 bfloat16x8_t __ret;
64187 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64188 return __ret;
64189}
64190__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u8(uint8x16_t __p0) {
64191 bfloat16x8_t __ret;
64192 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64193 return __ret;
64194}
64195__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u32(uint32x4_t __p0) {
64196 bfloat16x8_t __ret;
64197 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64198 return __ret;
64199}
64200__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u64(uint64x2_t __p0) {
64201 bfloat16x8_t __ret;
64202 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64203 return __ret;
64204}
64205__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_u16(uint16x8_t __p0) {
64206 bfloat16x8_t __ret;
64207 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64208 return __ret;
64209}
64210__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s8(int8x16_t __p0) {
64211 bfloat16x8_t __ret;
64212 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64213 return __ret;
64214}
64215__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_f64(float64x2_t __p0) {
64216 bfloat16x8_t __ret;
64217 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64218 return __ret;
64219}
64220__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_f32(float32x4_t __p0) {
64221 bfloat16x8_t __ret;
64222 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64223 return __ret;
64224}
64225__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_f16(float16x8_t __p0) {
64226 bfloat16x8_t __ret;
64227 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64228 return __ret;
64229}
64230__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s32(int32x4_t __p0) {
64231 bfloat16x8_t __ret;
64232 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64233 return __ret;
64234}
64235__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s64(int64x2_t __p0) {
64236 bfloat16x8_t __ret;
64237 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64238 return __ret;
64239}
64240__ai __attribute__((target("neon"))) bfloat16x8_t vreinterpretq_bf16_s16(int16x8_t __p0) {
64241 bfloat16x8_t __ret;
64242 __ret = __builtin_bit_cast(bfloat16x8_t, __p0);
64243 return __ret;
64244}
64245__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p8(poly8x8_t __p0) {
64246 bfloat16x4_t __ret;
64247 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64248 return __ret;
64249}
64250__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p64(poly64x1_t __p0) {
64251 bfloat16x4_t __ret;
64252 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64253 return __ret;
64254}
64255__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_p16(poly16x4_t __p0) {
64256 bfloat16x4_t __ret;
64257 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64258 return __ret;
64259}
64260__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u8(uint8x8_t __p0) {
64261 bfloat16x4_t __ret;
64262 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64263 return __ret;
64264}
64265__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u32(uint32x2_t __p0) {
64266 bfloat16x4_t __ret;
64267 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64268 return __ret;
64269}
64270__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u64(uint64x1_t __p0) {
64271 bfloat16x4_t __ret;
64272 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64273 return __ret;
64274}
64275__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_u16(uint16x4_t __p0) {
64276 bfloat16x4_t __ret;
64277 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64278 return __ret;
64279}
64280__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s8(int8x8_t __p0) {
64281 bfloat16x4_t __ret;
64282 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64283 return __ret;
64284}
64285__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_f64(float64x1_t __p0) {
64286 bfloat16x4_t __ret;
64287 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64288 return __ret;
64289}
64290__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_f32(float32x2_t __p0) {
64291 bfloat16x4_t __ret;
64292 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64293 return __ret;
64294}
64295__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_f16(float16x4_t __p0) {
64296 bfloat16x4_t __ret;
64297 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64298 return __ret;
64299}
64300__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s32(int32x2_t __p0) {
64301 bfloat16x4_t __ret;
64302 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64303 return __ret;
64304}
64305__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s64(int64x1_t __p0) {
64306 bfloat16x4_t __ret;
64307 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64308 return __ret;
64309}
64310__ai __attribute__((target("neon"))) bfloat16x4_t vreinterpret_bf16_s16(int16x4_t __p0) {
64311 bfloat16x4_t __ret;
64312 __ret = __builtin_bit_cast(bfloat16x4_t, __p0);
64313 return __ret;
64314}
6414764315__ai __attribute__((target("neon"))) uint64_t vrshld_u64(uint64_t __p0, int64_t __p1) {
6414864316 uint64_t __ret;
6414964317 __ret = __builtin_bit_cast(uint64_t, __builtin_neon_vrshld_u64(__p0, __p1));
lib/include/arm_sme.h+12
......@@ -3732,6 +3732,18 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svzero_za64_vg4x2)))
37323732void svzero_za64_vg4x2(uint32_t);
37333733__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svzero_za64_vg4x4)))
37343734void svzero_za64_vg4x4(uint32_t);
3735__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_u8)))
3736svuint8_t svluti6_zt_u8(uint64_t, svuint8_t);
3737__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_s8)))
3738svint8_t svluti6_zt_s8(uint64_t, svuint8_t);
3739__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_mf8)))
3740svmfloat8_t svluti6_zt_mf8(uint64_t, svuint8_t);
3741__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_u8_x4)))
3742svuint8x4_t svluti6_zt_u8_x4(uint64_t, svuint8x3_t);
3743__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_s8_x4)))
3744svint8x4_t svluti6_zt_s8_x4(uint64_t, svuint8x3_t);
3745__ai __attribute__((__clang_arm_builtin_alias(__builtin_sme_svluti6_zt_mf8_x4)))
3746svmfloat8x4_t svluti6_zt_mf8_x4(uint64_t, svuint8x3_t);
37353747#ifdef __cplusplus
37363748} // extern "C"
37373749#endif
lib/include/arm_sve.h+420
......@@ -4697,6 +4697,38 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f32_x4)))
46974697svfloat32x4_t svmul(svfloat32x4_t, svfloat32x4_t);
46984698__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmul_f16_x4)))
46994699svfloat16x4_t svmul(svfloat16x4_t, svfloat16x4_t);
4700__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x4_u16_x2_u8_x2)))
4701svuint16x4_t svluti6_lane_u16_x4_u16_x2_u8_x2(svuint16x2_t, svuint8x2_t, uint64_t);
4702__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x4_bf16_x2_u8_x2)))
4703svbfloat16x4_t svluti6_lane_bf16_x4_bf16_x2_u8_x2(svbfloat16x2_t, svuint8x2_t, uint64_t);
4704__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x4_f16_x2_u8_x2)))
4705svfloat16x4_t svluti6_lane_f16_x4_f16_x2_u8_x2(svfloat16x2_t, svuint8x2_t, uint64_t);
4706__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x4_s16_x2_u8_x2)))
4707svint16x4_t svluti6_lane_s16_x4_s16_x2_u8_x2(svint16x2_t, svuint8x2_t, uint64_t);
4708__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x4_u16_x2_u8_x3)))
4709svuint16x4_t svluti6_lane_u16_x4_u16_x2_u8_x3(svuint16x2_t, svuint8x3_t, uint64_t);
4710__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x4_bf16_x2_u8_x3)))
4711svbfloat16x4_t svluti6_lane_bf16_x4_bf16_x2_u8_x3(svbfloat16x2_t, svuint8x3_t, uint64_t);
4712__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x4_f16_x2_u8_x3)))
4713svfloat16x4_t svluti6_lane_f16_x4_f16_x2_u8_x3(svfloat16x2_t, svuint8x3_t, uint64_t);
4714__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x4_s16_x2_u8_x3)))
4715svint16x4_t svluti6_lane_s16_x4_s16_x2_u8_x3(svint16x2_t, svuint8x3_t, uint64_t);
4716__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x4_u16_x2_u8_x2)))
4717svuint16x4_t svluti6_lane_u16_x4(svuint16x2_t, svuint8x2_t, uint64_t);
4718__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x4_bf16_x2_u8_x2)))
4719svbfloat16x4_t svluti6_lane_bf16_x4(svbfloat16x2_t, svuint8x2_t, uint64_t);
4720__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x4_f16_x2_u8_x2)))
4721svfloat16x4_t svluti6_lane_f16_x4(svfloat16x2_t, svuint8x2_t, uint64_t);
4722__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x4_s16_x2_u8_x2)))
4723svint16x4_t svluti6_lane_s16_x4(svint16x2_t, svuint8x2_t, uint64_t);
4724__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x4_u16_x2_u8_x3)))
4725svuint16x4_t svluti6_lane_u16_x4(svuint16x2_t, svuint8x3_t, uint64_t);
4726__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x4_bf16_x2_u8_x3)))
4727svbfloat16x4_t svluti6_lane_bf16_x4(svbfloat16x2_t, svuint8x3_t, uint64_t);
4728__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x4_f16_x2_u8_x3)))
4729svfloat16x4_t svluti6_lane_f16_x4(svfloat16x2_t, svuint8x3_t, uint64_t);
4730__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x4_s16_x2_u8_x3)))
4731svint16x4_t svluti6_lane_s16_x4(svint16x2_t, svuint8x3_t, uint64_t);
47004732__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadda_f64)))
47014733float64_t svadda_f64(svbool_t, float64_t, svfloat64_t);
47024734__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svadda_f32)))
......@@ -7223,6 +7255,12 @@ __ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcreate2_b)))
72237255svboolx2_t svcreate2_b(svbool_t, svbool_t);
72247256__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcreate4_b)))
72257257svboolx4_t svcreate4_b(svbool_t, svbool_t, svbool_t, svbool_t);
7258__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_f16)))
7259svfloat32_t svdot_n_f32_f16(svfloat32_t, svfloat16_t, float16_t);
7260__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_s32_s16)))
7261svint32_t svdot_n_s32_s16(svint32_t, svint16_t, int16_t);
7262__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_u32_u16)))
7263svuint32_t svdot_n_u32_u16(svuint32_t, svuint16_t, uint16_t);
72267264__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_f16)))
72277265svfloat32_t svdot_f32_f16(svfloat32_t, svfloat16_t, svfloat16_t);
72287266__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_s32_s16)))
......@@ -7341,6 +7379,12 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcreate2_b)))
73417379svboolx2_t svcreate2(svbool_t, svbool_t);
73427380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcreate4_b)))
73437381svboolx4_t svcreate4(svbool_t, svbool_t, svbool_t, svbool_t);
7382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_f32_f16)))
7383svfloat32_t svdot(svfloat32_t, svfloat16_t, float16_t);
7384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_s32_s16)))
7385svint32_t svdot(svint32_t, svint16_t, int16_t);
7386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_u32_u16)))
7387svuint32_t svdot(svuint32_t, svuint16_t, uint16_t);
73447388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_f32_f16)))
73457389svfloat32_t svdot(svfloat32_t, svfloat16_t, svfloat16_t);
73467390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_s32_s16)))
......@@ -9049,6 +9093,346 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_mf8)))
90499093svmfloat8_t svexpand(svbool_t, svmfloat8_t);
90509094__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svexpand_s16)))
90519095svint16_t svexpand(svbool_t, svint16_t);
9096__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s32)))
9097svint32_t svabal_n_s32(svint32_t, svint16_t, int16_t);
9098__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s64)))
9099svint64_t svabal_n_s64(svint64_t, svint32_t, int32_t);
9100__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s16)))
9101svint16_t svabal_n_s16(svint16_t, svint8_t, int8_t);
9102__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u32)))
9103svuint32_t svabal_n_u32(svuint32_t, svuint16_t, uint16_t);
9104__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u64)))
9105svuint64_t svabal_n_u64(svuint64_t, svuint32_t, uint32_t);
9106__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u16)))
9107svuint16_t svabal_n_u16(svuint16_t, svuint8_t, uint8_t);
9108__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s32)))
9109svint32_t svabal_s32(svint32_t, svint16_t, svint16_t);
9110__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s64)))
9111svint64_t svabal_s64(svint64_t, svint32_t, svint32_t);
9112__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s16)))
9113svint16_t svabal_s16(svint16_t, svint8_t, svint8_t);
9114__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u32)))
9115svuint32_t svabal_u32(svuint32_t, svuint16_t, svuint16_t);
9116__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u64)))
9117svuint64_t svabal_u64(svuint64_t, svuint32_t, svuint32_t);
9118__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u16)))
9119svuint16_t svabal_u16(svuint16_t, svuint8_t, svuint8_t);
9120__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u8)))
9121svuint8_t svaddqp_u8(svuint8_t, svuint8_t);
9122__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u32)))
9123svuint32_t svaddqp_u32(svuint32_t, svuint32_t);
9124__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u64)))
9125svuint64_t svaddqp_u64(svuint64_t, svuint64_t);
9126__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u16)))
9127svuint16_t svaddqp_u16(svuint16_t, svuint16_t);
9128__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s8)))
9129svint8_t svaddqp_s8(svint8_t, svint8_t);
9130__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s32)))
9131svint32_t svaddqp_s32(svint32_t, svint32_t);
9132__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s64)))
9133svint64_t svaddqp_s64(svint64_t, svint64_t);
9134__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s16)))
9135svint16_t svaddqp_s16(svint16_t, svint16_t);
9136__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u8)))
9137svuint8_t svaddsubp_u8(svuint8_t, svuint8_t);
9138__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u32)))
9139svuint32_t svaddsubp_u32(svuint32_t, svuint32_t);
9140__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u64)))
9141svuint64_t svaddsubp_u64(svuint64_t, svuint64_t);
9142__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u16)))
9143svuint16_t svaddsubp_u16(svuint16_t, svuint16_t);
9144__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s8)))
9145svint8_t svaddsubp_s8(svint8_t, svint8_t);
9146__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s32)))
9147svint32_t svaddsubp_s32(svint32_t, svint32_t);
9148__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s64)))
9149svint64_t svaddsubp_s64(svint64_t, svint64_t);
9150__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s16)))
9151svint16_t svaddsubp_s16(svint16_t, svint16_t);
9152__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f64_s32)))
9153svfloat64_t svcvtb_f64_s32(svint32_t);
9154__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f32_s16)))
9155svfloat32_t svcvtb_f32_s16(svint16_t);
9156__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f16_s8)))
9157svfloat16_t svcvtb_f16_s8(svint8_t);
9158__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f64_u32)))
9159svfloat64_t svcvtb_f64_u32(svuint32_t);
9160__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f32_u16)))
9161svfloat32_t svcvtb_f32_u16(svuint16_t);
9162__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f16_u8)))
9163svfloat16_t svcvtb_f16_u8(svuint8_t);
9164__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s32_f64_x2)))
9165svint32_t svcvtn_s32_f64_x2(svfloat64x2_t);
9166__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s16_f32_x2)))
9167svint16_t svcvtn_s16_f32_x2(svfloat32x2_t);
9168__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s8_f16_x2)))
9169svint8_t svcvtn_s8_f16_x2(svfloat16x2_t);
9170__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u32_f64_x2)))
9171svuint32_t svcvtn_u32_f64_x2(svfloat64x2_t);
9172__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u16_f32_x2)))
9173svuint16_t svcvtn_u16_f32_x2(svfloat32x2_t);
9174__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u8_f16_x2)))
9175svuint8_t svcvtn_u8_f16_x2(svfloat16x2_t);
9176__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f64_s32)))
9177svfloat64_t svcvtt_f64_s32(svint32_t);
9178__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f32_s16)))
9179svfloat32_t svcvtt_f32_s16(svint16_t);
9180__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f16_s8)))
9181svfloat16_t svcvtt_f16_s8(svint8_t);
9182__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f64_u32)))
9183svfloat64_t svcvtt_f64_u32(svuint32_t);
9184__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f32_u16)))
9185svfloat32_t svcvtt_f32_u16(svuint16_t);
9186__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f16_u8)))
9187svfloat16_t svcvtt_f16_u8(svuint8_t);
9188__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_s16_s8)))
9189svint16_t svdot_n_s16_s8(svint16_t, svint8_t, int8_t);
9190__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_u16_u8)))
9191svuint16_t svdot_n_u16_u8(svuint16_t, svuint8_t, uint8_t);
9192__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_s16_s8)))
9193svint16_t svdot_s16_s8(svint16_t, svint8_t, svint8_t);
9194__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_u16_u8)))
9195svuint16_t svdot_u16_u8(svuint16_t, svuint8_t, svuint8_t);
9196__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_s16_s8)))
9197svint16_t svdot_lane_s16_s8(svint16_t, svint8_t, svint8_t, uint64_t);
9198__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_u16_u8)))
9199svuint16_t svdot_lane_u16_u8(svuint16_t, svuint8_t, svuint8_t, uint64_t);
9200__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrn_n_s8_s16_x2)))
9201svint8_t svqrshrn_n_s8_s16_x2(svint16x2_t, uint64_t);
9202__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrn_n_u8_u16_x2)))
9203svuint8_t svqrshrn_n_u8_u16_x2(svuint16x2_t, uint64_t);
9204__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrun_n_u8_s16_x2)))
9205svuint8_t svqrshrun_n_u8_s16_x2(svint16x2_t, uint64_t);
9206__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_s16_s32_x2)))
9207svint16_t svqshrn_n_s16_s32_x2(svint32x2_t, uint64_t);
9208__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_s8_s16_x2)))
9209svint8_t svqshrn_n_s8_s16_x2(svint16x2_t, uint64_t);
9210__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_u16_u32_x2)))
9211svuint16_t svqshrn_n_u16_u32_x2(svuint32x2_t, uint64_t);
9212__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_u8_u16_x2)))
9213svuint8_t svqshrn_n_u8_u16_x2(svuint16x2_t, uint64_t);
9214__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrun_n_u16_s32_x2)))
9215svuint16_t svqshrun_n_u16_s32_x2(svint32x2_t, uint64_t);
9216__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrun_n_u8_s16_x2)))
9217svuint8_t svqshrun_n_u8_s16_x2(svint16x2_t, uint64_t);
9218__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_m)))
9219svuint8_t svsubp_u8_m(svbool_t, svuint8_t, svuint8_t);
9220__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_m)))
9221svuint32_t svsubp_u32_m(svbool_t, svuint32_t, svuint32_t);
9222__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_m)))
9223svuint64_t svsubp_u64_m(svbool_t, svuint64_t, svuint64_t);
9224__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_m)))
9225svuint16_t svsubp_u16_m(svbool_t, svuint16_t, svuint16_t);
9226__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_m)))
9227svint8_t svsubp_s8_m(svbool_t, svint8_t, svint8_t);
9228__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_m)))
9229svint32_t svsubp_s32_m(svbool_t, svint32_t, svint32_t);
9230__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_m)))
9231svint64_t svsubp_s64_m(svbool_t, svint64_t, svint64_t);
9232__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_m)))
9233svint16_t svsubp_s16_m(svbool_t, svint16_t, svint16_t);
9234__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_x)))
9235svuint8_t svsubp_u8_x(svbool_t, svuint8_t, svuint8_t);
9236__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_x)))
9237svuint32_t svsubp_u32_x(svbool_t, svuint32_t, svuint32_t);
9238__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_x)))
9239svuint64_t svsubp_u64_x(svbool_t, svuint64_t, svuint64_t);
9240__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_x)))
9241svuint16_t svsubp_u16_x(svbool_t, svuint16_t, svuint16_t);
9242__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_x)))
9243svint8_t svsubp_s8_x(svbool_t, svint8_t, svint8_t);
9244__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_x)))
9245svint32_t svsubp_s32_x(svbool_t, svint32_t, svint32_t);
9246__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_x)))
9247svint64_t svsubp_s64_x(svbool_t, svint64_t, svint64_t);
9248__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_x)))
9249svint16_t svsubp_s16_x(svbool_t, svint16_t, svint16_t);
9250__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_z)))
9251svuint8_t svsubp_u8_z(svbool_t, svuint8_t, svuint8_t);
9252__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_z)))
9253svuint32_t svsubp_u32_z(svbool_t, svuint32_t, svuint32_t);
9254__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_z)))
9255svuint64_t svsubp_u64_z(svbool_t, svuint64_t, svuint64_t);
9256__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_z)))
9257svuint16_t svsubp_u16_z(svbool_t, svuint16_t, svuint16_t);
9258__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_z)))
9259svint8_t svsubp_s8_z(svbool_t, svint8_t, svint8_t);
9260__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_z)))
9261svint32_t svsubp_s32_z(svbool_t, svint32_t, svint32_t);
9262__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_z)))
9263svint64_t svsubp_s64_z(svbool_t, svint64_t, svint64_t);
9264__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_z)))
9265svint16_t svsubp_s16_z(svbool_t, svint16_t, svint16_t);
9266__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s32)))
9267svint32_t svabal(svint32_t, svint16_t, int16_t);
9268__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s64)))
9269svint64_t svabal(svint64_t, svint32_t, int32_t);
9270__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_s16)))
9271svint16_t svabal(svint16_t, svint8_t, int8_t);
9272__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u32)))
9273svuint32_t svabal(svuint32_t, svuint16_t, uint16_t);
9274__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u64)))
9275svuint64_t svabal(svuint64_t, svuint32_t, uint32_t);
9276__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_n_u16)))
9277svuint16_t svabal(svuint16_t, svuint8_t, uint8_t);
9278__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s32)))
9279svint32_t svabal(svint32_t, svint16_t, svint16_t);
9280__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s64)))
9281svint64_t svabal(svint64_t, svint32_t, svint32_t);
9282__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_s16)))
9283svint16_t svabal(svint16_t, svint8_t, svint8_t);
9284__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u32)))
9285svuint32_t svabal(svuint32_t, svuint16_t, svuint16_t);
9286__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u64)))
9287svuint64_t svabal(svuint64_t, svuint32_t, svuint32_t);
9288__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabal_u16)))
9289svuint16_t svabal(svuint16_t, svuint8_t, svuint8_t);
9290__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u8)))
9291svuint8_t svaddqp(svuint8_t, svuint8_t);
9292__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u32)))
9293svuint32_t svaddqp(svuint32_t, svuint32_t);
9294__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u64)))
9295svuint64_t svaddqp(svuint64_t, svuint64_t);
9296__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_u16)))
9297svuint16_t svaddqp(svuint16_t, svuint16_t);
9298__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s8)))
9299svint8_t svaddqp(svint8_t, svint8_t);
9300__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s32)))
9301svint32_t svaddqp(svint32_t, svint32_t);
9302__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s64)))
9303svint64_t svaddqp(svint64_t, svint64_t);
9304__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddqp_s16)))
9305svint16_t svaddqp(svint16_t, svint16_t);
9306__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u8)))
9307svuint8_t svaddsubp(svuint8_t, svuint8_t);
9308__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u32)))
9309svuint32_t svaddsubp(svuint32_t, svuint32_t);
9310__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u64)))
9311svuint64_t svaddsubp(svuint64_t, svuint64_t);
9312__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_u16)))
9313svuint16_t svaddsubp(svuint16_t, svuint16_t);
9314__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s8)))
9315svint8_t svaddsubp(svint8_t, svint8_t);
9316__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s32)))
9317svint32_t svaddsubp(svint32_t, svint32_t);
9318__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s64)))
9319svint64_t svaddsubp(svint64_t, svint64_t);
9320__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaddsubp_s16)))
9321svint16_t svaddsubp(svint16_t, svint16_t);
9322__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f64_s32)))
9323svfloat64_t svcvtb_f64(svint32_t);
9324__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f32_s16)))
9325svfloat32_t svcvtb_f32(svint16_t);
9326__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f16_s8)))
9327svfloat16_t svcvtb_f16(svint8_t);
9328__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f64_u32)))
9329svfloat64_t svcvtb_f64(svuint32_t);
9330__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f32_u16)))
9331svfloat32_t svcvtb_f32(svuint16_t);
9332__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtb_f16_u8)))
9333svfloat16_t svcvtb_f16(svuint8_t);
9334__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s32_f64_x2)))
9335svint32_t svcvtn_s32(svfloat64x2_t);
9336__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s16_f32_x2)))
9337svint16_t svcvtn_s16(svfloat32x2_t);
9338__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_s8_f16_x2)))
9339svint8_t svcvtn_s8(svfloat16x2_t);
9340__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u32_f64_x2)))
9341svuint32_t svcvtn_u32(svfloat64x2_t);
9342__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u16_f32_x2)))
9343svuint16_t svcvtn_u16(svfloat32x2_t);
9344__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtn_u8_f16_x2)))
9345svuint8_t svcvtn_u8(svfloat16x2_t);
9346__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f64_s32)))
9347svfloat64_t svcvtt_f64(svint32_t);
9348__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f32_s16)))
9349svfloat32_t svcvtt_f32(svint16_t);
9350__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f16_s8)))
9351svfloat16_t svcvtt_f16(svint8_t);
9352__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f64_u32)))
9353svfloat64_t svcvtt_f64(svuint32_t);
9354__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f32_u16)))
9355svfloat32_t svcvtt_f32(svuint16_t);
9356__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svcvtt_f16_u8)))
9357svfloat16_t svcvtt_f16(svuint8_t);
9358__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_s16_s8)))
9359svint16_t svdot(svint16_t, svint8_t, int8_t);
9360__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_n_u16_u8)))
9361svuint16_t svdot(svuint16_t, svuint8_t, uint8_t);
9362__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_s16_s8)))
9363svint16_t svdot(svint16_t, svint8_t, svint8_t);
9364__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_u16_u8)))
9365svuint16_t svdot(svuint16_t, svuint8_t, svuint8_t);
9366__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_s16_s8)))
9367svint16_t svdot_lane(svint16_t, svint8_t, svint8_t, uint64_t);
9368__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdot_lane_u16_u8)))
9369svuint16_t svdot_lane(svuint16_t, svuint8_t, svuint8_t, uint64_t);
9370__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrn_n_s8_s16_x2)))
9371svint8_t svqrshrn_s8(svint16x2_t, uint64_t);
9372__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrn_n_u8_u16_x2)))
9373svuint8_t svqrshrn_u8(svuint16x2_t, uint64_t);
9374__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqrshrun_n_u8_s16_x2)))
9375svuint8_t svqrshrun_u8(svint16x2_t, uint64_t);
9376__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_s16_s32_x2)))
9377svint16_t svqshrn_s16(svint32x2_t, uint64_t);
9378__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_s8_s16_x2)))
9379svint8_t svqshrn_s8(svint16x2_t, uint64_t);
9380__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_u16_u32_x2)))
9381svuint16_t svqshrn_u16(svuint32x2_t, uint64_t);
9382__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrn_n_u8_u16_x2)))
9383svuint8_t svqshrn_u8(svuint16x2_t, uint64_t);
9384__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrun_n_u16_s32_x2)))
9385svuint16_t svqshrun_u16(svint32x2_t, uint64_t);
9386__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svqshrun_n_u8_s16_x2)))
9387svuint8_t svqshrun_u8(svint16x2_t, uint64_t);
9388__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_m)))
9389svuint8_t svsubp_m(svbool_t, svuint8_t, svuint8_t);
9390__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_m)))
9391svuint32_t svsubp_m(svbool_t, svuint32_t, svuint32_t);
9392__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_m)))
9393svuint64_t svsubp_m(svbool_t, svuint64_t, svuint64_t);
9394__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_m)))
9395svuint16_t svsubp_m(svbool_t, svuint16_t, svuint16_t);
9396__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_m)))
9397svint8_t svsubp_m(svbool_t, svint8_t, svint8_t);
9398__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_m)))
9399svint32_t svsubp_m(svbool_t, svint32_t, svint32_t);
9400__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_m)))
9401svint64_t svsubp_m(svbool_t, svint64_t, svint64_t);
9402__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_m)))
9403svint16_t svsubp_m(svbool_t, svint16_t, svint16_t);
9404__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_x)))
9405svuint8_t svsubp_x(svbool_t, svuint8_t, svuint8_t);
9406__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_x)))
9407svuint32_t svsubp_x(svbool_t, svuint32_t, svuint32_t);
9408__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_x)))
9409svuint64_t svsubp_x(svbool_t, svuint64_t, svuint64_t);
9410__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_x)))
9411svuint16_t svsubp_x(svbool_t, svuint16_t, svuint16_t);
9412__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_x)))
9413svint8_t svsubp_x(svbool_t, svint8_t, svint8_t);
9414__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_x)))
9415svint32_t svsubp_x(svbool_t, svint32_t, svint32_t);
9416__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_x)))
9417svint64_t svsubp_x(svbool_t, svint64_t, svint64_t);
9418__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_x)))
9419svint16_t svsubp_x(svbool_t, svint16_t, svint16_t);
9420__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u8_z)))
9421svuint8_t svsubp_z(svbool_t, svuint8_t, svuint8_t);
9422__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u32_z)))
9423svuint32_t svsubp_z(svbool_t, svuint32_t, svuint32_t);
9424__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u64_z)))
9425svuint64_t svsubp_z(svbool_t, svuint64_t, svuint64_t);
9426__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_u16_z)))
9427svuint16_t svsubp_z(svbool_t, svuint16_t, svuint16_t);
9428__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s8_z)))
9429svint8_t svsubp_z(svbool_t, svint8_t, svint8_t);
9430__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s32_z)))
9431svint32_t svsubp_z(svbool_t, svint32_t, svint32_t);
9432__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s64_z)))
9433svint64_t svsubp_z(svbool_t, svint64_t, svint64_t);
9434__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsubp_s16_z)))
9435svint16_t svsubp_z(svbool_t, svint16_t, svint16_t);
90529436__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaba_n_s8)))
90539437svint8_t svaba_n_s8(svint8_t, svint8_t, int8_t);
90549438__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svaba_n_s32)))
......@@ -16581,6 +16965,10 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_x)))
1658116965svbfloat16_t svsub_x(svbool_t, svbfloat16_t, svbfloat16_t);
1658216966__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svsub_bf16_z)))
1658316967svbfloat16_t svsub_z(svbool_t, svbfloat16_t, svbfloat16_t);
16968__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_bf16)))
16969svbfloat16_t svmmla_bf16(svbfloat16_t, svbfloat16_t, svbfloat16_t);
16970__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_bf16)))
16971svbfloat16_t svmmla(svbfloat16_t, svbfloat16_t, svbfloat16_t);
1658416972__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_m)))
1658516973svbfloat16_t svscale_n_bf16_m(svbool_t, svbfloat16_t, int16_t);
1658616974__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svscale_n_bf16_x)))
......@@ -19415,6 +19803,38 @@ __aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c64_s64))
1941519803svcount_t svwhilelt_c64(int64_t, int64_t, uint64_t);
1941619804__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svwhilelt_c16_s64)))
1941719805svcount_t svwhilelt_c16(int64_t, int64_t, uint64_t);
19806__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f16)))
19807svfloat16_t svmmla_f16(svfloat16_t, svfloat16_t, svfloat16_t);
19808__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svmmla_f16)))
19809svfloat16_t svmmla(svfloat16_t, svfloat16_t, svfloat16_t);
19810__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_u8_x2)))
19811svuint8_t svluti6_u8_x2(svuint8x2_t, svuint8_t);
19812__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_s8_x2)))
19813svint8_t svluti6_s8_x2(svint8x2_t, svuint8_t);
19814__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_mf8_x2)))
19815svmfloat8_t svluti6_mf8_x2(svmfloat8x2_t, svuint8_t);
19816__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_u8_x2)))
19817svuint8_t svluti6(svuint8x2_t, svuint8_t);
19818__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_s8_x2)))
19819svint8_t svluti6(svint8x2_t, svuint8_t);
19820__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_mf8_x2)))
19821svmfloat8_t svluti6(svmfloat8x2_t, svuint8_t);
19822__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x2)))
19823svuint16_t svluti6_lane_u16_x2(svuint16x2_t, svuint8_t, uint64_t);
19824__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x2)))
19825svbfloat16_t svluti6_lane_bf16_x2(svbfloat16x2_t, svuint8_t, uint64_t);
19826__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x2)))
19827svfloat16_t svluti6_lane_f16_x2(svfloat16x2_t, svuint8_t, uint64_t);
19828__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x2)))
19829svint16_t svluti6_lane_s16_x2(svint16x2_t, svuint8_t, uint64_t);
19830__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_u16_x2)))
19831svuint16_t svluti6_lane(svuint16x2_t, svuint8_t, uint64_t);
19832__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_bf16_x2)))
19833svbfloat16_t svluti6_lane(svbfloat16x2_t, svuint8_t, uint64_t);
19834__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_f16_x2)))
19835svfloat16_t svluti6_lane(svfloat16x2_t, svuint8_t, uint64_t);
19836__aio __attribute__((__clang_arm_builtin_alias(__builtin_sve_svluti6_lane_s16_x2)))
19837svint16_t svluti6_lane(svint16x2_t, svuint8_t, uint64_t);
1941819838__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabd_n_f64_m)))
1941919839svfloat64_t svabd_n_f64_m(svbool_t, svfloat64_t, float64_t);
1942019840__ai __attribute__((__clang_arm_builtin_alias(__builtin_sve_svabd_n_f32_m)))
lib/include/avx2intrin.h+4-5
......@@ -1810,10 +1810,9 @@ _mm256_or_si256(__m256i __a, __m256i __b)
18101810/// \param __b
18111811/// A 256-bit integer vector.
18121812/// \returns A 256-bit integer vector containing the result.
1813static __inline__ __m256i __DEFAULT_FN_ATTRS256
1814_mm256_sad_epu8(__m256i __a, __m256i __b)
1815{
1816 return __builtin_ia32_psadbw256((__v32qi)__a, (__v32qi)__b);
1813static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1814_mm256_sad_epu8(__m256i __a, __m256i __b) {
1815 return __builtin_ia32_psadbw256((__v32qu)__a, (__v32qu)__b);
18171816}
18181817
18191818/// Shuffles 8-bit integers in the 256-bit integer vector \a __a according
......@@ -3058,7 +3057,7 @@ _mm256_broadcastsi128_si256(__m128i __X) {
30583057/// An immediate 8-bit integer operand, with bits [7:0] specifying the
30593058/// source for each element of the result. The position of the mask bit
30603059/// corresponds to the index of a copied value. When a mask bit is 0, the
3061/// element is copied from \a V1; otherwise, it is is copied from \a V2.
3060/// element is copied from \a V1; otherwise, it is copied from \a V2.
30623061/// \returns A 256-bit vector of [8 x i32] containing the result.
30633062#define _mm256_blend_epi32(V1, V2, M) \
30643063 ((__m256i)__builtin_ia32_pblendd256((__v8si)(__m256i)(V1), \
lib/include/avx512bmmintrin.h created+174
......@@ -0,0 +1,174 @@
1/*===-------- avx512bmmintrin.h - AVX512BMM intrinsics *------------------===
2 *
3 *
4 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 * See https://llvm.org/LICENSE.txt for license information.
6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *
8 *===---------------------------------------------------------------------===
9 */
10
11#ifndef __IMMINTRIN_H
12#error "Never use <avx512bmmintrin.h> directly; include <immintrin.h> instead."
13#endif
14
15#ifndef _AVX512BMMINTRIN_H
16#define _AVX512BMMINTRIN_H
17
18/* Define the default attributes for the functions in this file. */
19#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512bmm"), \
21 __min_vector_width__(512)))
22
23#if defined(__cplusplus) && (__cplusplus >= 201103L)
24#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
25#else
26#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
27#endif
28
29/// Multiplies two 16x16 bit matrices using OR reduction and ORs the product
30/// into a third 16x16 bit matrix (which is also the destination).
31///
32/// For the 512-bit ZMM form, each register contains two 16x16 (256-bit)
33/// matrices in bits [255:0] and [511:256]. The operation performs:
34/// \code{.operation}
35/// for i in 0 to 15
36/// for j in 0 to 15
37/// reduction_bit = __C[16*i+j]
38/// for k in 0 to 15
39/// reduction_bit |= __A[16*i+k] & __B[16*k+j]
40/// end for k
41/// dest[16*i+j] = reduction_bit
42/// end for j
43/// end for i
44/// \endcode
45///
46/// \headerfile <immintrin.h>
47///
48/// This intrinsic corresponds to the <c> VBMACOR16X16X16 </c> instruction.
49///
50/// \param __A
51/// A 512-bit vector containing two 16x16 bit matrices (one per 256-bit
52/// lane).
53/// \param __B
54/// A 512-bit vector containing two 16x16 bit matrices (one per 256-bit
55/// lane).
56/// \param __C
57/// A 512-bit accumulator vector containing the initial values to OR with.
58/// \returns A 512-bit vector containing the accumulated result for each lane.
59/// \note This instruction does not support masking.
60static __inline __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
61_mm512_bmacor16x16x16(__m512i __A, __m512i __B, __m512i __C) {
62 return (__m512i)__builtin_ia32_bmacor16x16x16_v32hi(
63 (__v32hi)__A, (__v32hi)__B, (__v32hi)__C);
64}
65
66/// Multiplies two 16x16 bit matrices using XOR reduction and XORs the product
67/// into a third 16x16 bit matrix (which is also the destination).
68///
69/// For the 512-bit ZMM form, each register contains two 16x16 (256-bit)
70/// matrices in bits [255:0] and [511:256]. The operation performs:
71/// \code{.operation}
72/// for i in 0 to 15
73/// for j in 0 to 15
74/// reduction_bit = __C[16*i+j]
75/// for k in 0 to 15
76/// reduction_bit ^= __A[16*i+k] & __B[16*k+j]
77/// end for k
78/// dest[16*i+j] = reduction_bit
79/// end for j
80/// end for i
81/// \endcode
82///
83/// \headerfile <immintrin.h>
84///
85/// This intrinsic corresponds to the <c> VBMACXOR16X16X16 </c> instruction.
86///
87/// \param __A
88/// A 512-bit vector containing two 16x16 bit matrices (one per 256-bit
89/// lane).
90/// \param __B
91/// A 512-bit vector containing two 16x16 bit matrices (one per 256-bit
92/// lane).
93/// \param __C
94/// A 512-bit accumulator vector containing the initial values to XOR with.
95/// \returns A 512-bit vector containing the accumulated result for each lane.
96/// \note This instruction does not support masking.
97static __inline __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
98_mm512_bmacxor16x16x16(__m512i __A, __m512i __B, __m512i __C) {
99 return (__m512i)__builtin_ia32_bmacxor16x16x16_v32hi(
100 (__v32hi)__A, (__v32hi)__B, (__v32hi)__C);
101}
102
103/// Reverses the bits within each byte of the source vector.
104///
105/// For each byte in the source, reverses the order of its 8 bits to generate
106/// the corresponding destination byte. For example, 0b10110001 becomes
107/// 0b10001101.
108///
109/// \headerfile <immintrin.h>
110///
111/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
112///
113/// \param __A
114/// A 512-bit vector of [64 x i8] where each byte will have its bits
115/// reversed.
116/// \returns A 512-bit vector of [64 x i8] with bit-reversed bytes.
117static __inline __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
118_mm512_bitrev_epi8(__m512i __A) {
119 return (__m512i)__builtin_elementwise_bitreverse((__v64qi)__A);
120}
121
122/// Reverses the bits within each byte of the source vector, using a writemask
123/// to conditionally select elements.
124///
125/// For each byte position, if the corresponding mask bit is 1, the byte from
126/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
127/// the corresponding byte from \a B is copied to the result (merge masking).
128///
129/// \headerfile <immintrin.h>
130///
131/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
132///
133/// \param __U
134/// A 64-bit mask value where each bit controls one byte (per 8-bit element).
135/// A 1 performs bit reversal; a 0 selects the passthrough byte from __B.
136/// \param __A
137/// A 512-bit vector of [64 x i8] to be bit-reversed.
138/// \param __B
139/// A 512-bit vector of [64 x i8] providing passthrough values.
140/// \returns A 512-bit vector combining bit-reversed and passthrough bytes.
141static __inline __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
142_mm512_mask_bitrev_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
143 return (__m512i)__builtin_ia32_selectb_512(
144 (__mmask64)__U, (__v64qi)_mm512_bitrev_epi8(__A), (__v64qi)__B);
145}
146
147/// Reverses the bits within each byte of the source vector, zeroing elements
148/// based on the writemask.
149///
150/// For each byte position, if the corresponding mask bit is 1, the byte from
151/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
152/// the result byte is set to zero (zero masking).
153///
154/// \headerfile <immintrin.h>
155///
156/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
157///
158/// \param __U
159/// A 64-bit mask value where each bit controls one byte (per 8-bit element).
160/// A 1 performs bit reversal; a 0 sets the byte to zero.
161/// \param __A
162/// A 512-bit vector of [64 x i8] to be bit-reversed.
163/// \returns A 512-bit vector with bit-reversed or zeroed bytes.
164static __inline __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
165_mm512_maskz_bitrev_epi8(__mmask64 __U, __m512i __A) {
166 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
167 (__v64qi)_mm512_bitrev_epi8(__A),
168 (__v64qi)_mm512_setzero_si512());
169}
170
171#undef __DEFAULT_FN_ATTRS
172#undef __DEFAULT_FN_ATTRS_CONSTEXPR
173
174#endif
lib/include/avx512bmmvlintrin.h created+245
......@@ -0,0 +1,245 @@
1/*===------------- avx512bmmvlintrin.h - BMM intrinsics ------------------===
2 *
3 *
4 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 * See https://llvm.org/LICENSE.txt for license information.
6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *
8 *===-----------------------------------------------------------------------===
9 */
10#ifndef __IMMINTRIN_H
11#error \
12 "Never use <avx512bmmvlintrin.h> directly; include <immintrin.h> instead."
13#endif
14
15#ifndef __BMMVLINTRIN_H
16#define __BMMVLINTRIN_H
17
18/* Define the default attributes for the functions in this file. */
19#define __DEFAULT_FN_ATTRS128 \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx512bmm,avx512vl"), __min_vector_width__(128)))
22#define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512bmm,avx512vl"), __min_vector_width__(256)))
25
26#if defined(__cplusplus) && (__cplusplus >= 201103L)
27#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
28#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256 constexpr
29#else
30#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
31#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
32#endif
33
34/// Multiplies two 16x16 bit matrices using OR reduction and ORs the product
35/// into a third 16x16 bit matrix (which is also the destination).
36///
37/// For the 256-bit YMM form, the source registers/memory each contain a single
38/// 16x16 (256-bit) matrix in bits [255:0]. The operation performs:
39/// \code{.operation}
40/// for i in 0 to 15
41/// for j in 0 to 15
42/// reduction_bit = __C[16*i+j]
43/// for k in 0 to 15
44/// reduction_bit |= __A[16*i+k] & __B[16*k+j]
45/// end for k
46/// dest[16*i+j] = reduction_bit
47/// end for j
48/// end for i
49/// \endcode
50///
51/// \headerfile <immintrin.h>
52///
53/// This intrinsic corresponds to the <c> VBMACOR16X16X16 </c> instruction.
54///
55/// \param __A
56/// A 256-bit vector containing a 16x16 bit matrix.
57/// \param __B
58/// A 256-bit vector containing a 16x16 bit matrix.
59/// \param __C
60/// A 256-bit accumulator vector containing the initial values to OR with.
61/// \returns A 256-bit vector containing the accumulated result.
62/// \note This instruction does not support masking.
63static __inline __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
64_mm256_bmacor16x16x16(__m256i __A, __m256i __B, __m256i __C) {
65 return (__m256i)__builtin_ia32_bmacor16x16x16_v16hi(
66 (__v16hi)__A, (__v16hi)__B, (__v16hi)__C);
67}
68
69/// Multiplies two 16x16 bit matrices using XOR reduction and XORs the product
70/// into a third 16x16 bit matrix (which is also the destination).
71///
72/// For the 256-bit YMM form, the source registers/memory each contain a single
73/// 16x16 (256-bit) matrix in bits [255:0]. The operation performs:
74/// \code{.operation}
75/// for i in 0 to 15
76/// for j in 0 to 15
77/// reduction_bit = __C[16*i+j]
78/// for k in 0 to 15
79/// reduction_bit ^= __A[16*i+k] & __B[16*k+j]
80/// end for k
81/// dest[16*i+j] = reduction_bit
82/// end for j
83/// end for i
84/// \endcode
85///
86/// \headerfile <immintrin.h>
87///
88/// This intrinsic corresponds to the <c> VBMACXOR16X16X16 </c> instruction.
89///
90/// \param __A
91/// A 256-bit vector containing a 16x16 bit matrix.
92/// \param __B
93/// A 256-bit vector containing a 16x16 bit matrix.
94/// \param __C
95/// A 256-bit accumulator vector containing the initial values to XOR with.
96/// \returns A 256-bit vector containing the accumulated result.
97/// \note This instruction does not support masking.
98static __inline __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
99_mm256_bmacxor16x16x16(__m256i __A, __m256i __B, __m256i __C) {
100 return (__m256i)__builtin_ia32_bmacxor16x16x16_v16hi(
101 (__v16hi)__A, (__v16hi)__B, (__v16hi)__C);
102}
103
104/// Reverses the bits within each byte of the source vector.
105///
106/// For each byte in the source, reverses the order of its 8 bits to generate
107/// the corresponding destination byte. For example, 0b10110001 becomes
108/// 0b10001101.
109///
110/// \headerfile <immintrin.h>
111///
112/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
113///
114/// \param __A
115/// A 128-bit vector of [16 x i8] where each byte will have its bits
116/// reversed.
117/// \returns A 128-bit vector of [16 x i8] with bit-reversed bytes.
118static __inline __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
119_mm128_bitrev_epi8(__m128i __A) {
120 return (__m128i)__builtin_elementwise_bitreverse((__v16qi)__A);
121}
122
123/// Reverses the bits within each byte of the source vector.
124///
125/// For each byte in the source, reverses the order of its 8 bits to generate
126/// the corresponding destination byte. For example, 0b10110001 becomes
127/// 0b10001101.
128///
129/// \headerfile <immintrin.h>
130///
131/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
132///
133/// \param __A
134/// A 256-bit vector of [32 x i8] where each byte will have its bits
135/// reversed.
136/// \returns A 256-bit vector of [32 x i8] with bit-reversed bytes.
137static __inline __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
138_mm256_bitrev_epi8(__m256i __A) {
139 return (__m256i)__builtin_elementwise_bitreverse((__v32qi)__A);
140}
141
142/// Reverses the bits within each byte of the source vector, using a writemask
143/// to conditionally select elements.
144///
145/// For each byte position, if the corresponding mask bit is 1, the byte from
146/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
147/// the corresponding byte from \a B is copied to the result (merge masking).
148///
149/// \headerfile <immintrin.h>
150///
151/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
152///
153/// \param __U
154/// A 16-bit mask value where each bit controls one byte (per 8-bit element).
155/// A 1 performs bit reversal; a 0 selects the passthrough byte from __B.
156/// \param __A
157/// A 128-bit vector of [16 x i8] to be bit-reversed.
158/// \param __B
159/// A 128-bit vector of [16 x i8] providing passthrough values.
160/// \returns A 128-bit vector combining bit-reversed and passthrough bytes.
161static __inline __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
162_mm128_mask_bitrev_epi8(__mmask16 __U, __m128i __A, __m128i __B) {
163 return (__m128i)__builtin_ia32_selectb_128(
164 (__mmask16)__U, (__v16qi)_mm128_bitrev_epi8(__A), (__v16qi)__B);
165}
166
167/// Reverses the bits within each byte of the source vector, using a writemask
168/// to conditionally select elements.
169///
170/// For each byte position, if the corresponding mask bit is 1, the byte from
171/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
172/// the corresponding byte from \a B is copied to the result (merge masking).
173///
174/// \headerfile <immintrin.h>
175///
176/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
177///
178/// \param __U
179/// A 32-bit mask value where each bit controls one byte (per 8-bit element).
180/// A 1 performs bit reversal; a 0 selects the passthrough byte from __B.
181/// \param __A
182/// A 256-bit vector of [32 x i8] to be bit-reversed.
183/// \param __B
184/// A 256-bit vector of [32 x i8] providing passthrough values.
185/// \returns A 256-bit vector combining bit-reversed and passthrough bytes.
186static __inline __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
187_mm256_mask_bitrev_epi8(__mmask32 __U, __m256i __A, __m256i __B) {
188 return (__m256i)__builtin_ia32_selectb_256(
189 (__mmask32)__U, (__v32qi)_mm256_bitrev_epi8(__A), (__v32qi)__B);
190}
191
192/// Reverses the bits within each byte of the source vector, zeroing elements
193/// based on the writemask.
194///
195/// For each byte position, if the corresponding mask bit is 1, the byte from
196/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
197/// the result byte is set to zero (zero masking).
198///
199/// \headerfile <immintrin.h>
200///
201/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
202///
203/// \param __U
204/// A 16-bit mask value where each bit controls one byte (per 8-bit element).
205/// A 1 performs bit reversal; a 0 sets the byte to zero.
206/// \param __A
207/// A 128-bit vector of [16 x i8] to be bit-reversed.
208/// \returns A 128-bit vector with bit-reversed or zeroed bytes.
209static __inline __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
210_mm128_maskz_bitrev_epi8(__mmask16 __U, __m128i __A) {
211 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__U,
212 (__v16qi)_mm128_bitrev_epi8(__A),
213 (__v16qi)_mm_setzero_si128());
214}
215
216/// Reverses the bits within each byte of the source vector, zeroing elements
217/// based on the writemask.
218///
219/// For each byte position, if the corresponding mask bit is 1, the byte from
220/// \a A has its bits reversed and stored in the result. If the mask bit is 0,
221/// the result byte is set to zero (zero masking).
222///
223/// \headerfile <immintrin.h>
224///
225/// This intrinsic corresponds to the <c> VBITREV </c> instruction.
226///
227/// \param __U
228/// A 32-bit mask value where each bit controls one byte (per 8-bit element).
229/// A 1 performs bit reversal; a 0 sets the byte to zero.
230/// \param __A
231/// A 256-bit vector of [32 x i8] to be bit-reversed.
232/// \returns A 256-bit vector with bit-reversed or zeroed bytes.
233static __inline __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
234_mm256_maskz_bitrev_epi8(__mmask32 __U, __m256i __A) {
235 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__U,
236 (__v32qi)_mm256_bitrev_epi8(__A),
237 (__v32qi)_mm256_setzero_si256());
238}
239
240#undef __DEFAULT_FN_ATTRS128_CONSTEXPR
241#undef __DEFAULT_FN_ATTRS256_CONSTEXPR
242#undef __DEFAULT_FN_ATTRS128
243#undef __DEFAULT_FN_ATTRS256
244
245#endif
lib/include/avx512bwintrin.h+19-29
......@@ -1695,57 +1695,49 @@ _mm512_mask_storeu_epi8 (void *__P, __mmask64 __U, __m512i __A)
16951695 (__mmask64) __U);
16961696}
16971697
1698static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1699_mm512_test_epi8_mask (__m512i __A, __m512i __B)
1700{
1698static __inline__ __mmask64 __DEFAULT_FN_ATTRS512_CONSTEXPR
1699_mm512_test_epi8_mask(__m512i __A, __m512i __B) {
17011700 return _mm512_cmpneq_epi8_mask (_mm512_and_epi32 (__A, __B),
17021701 _mm512_setzero_si512());
17031702}
17041703
1705static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1706_mm512_mask_test_epi8_mask (__mmask64 __U, __m512i __A, __m512i __B)
1707{
1704static __inline__ __mmask64 __DEFAULT_FN_ATTRS512_CONSTEXPR
1705_mm512_mask_test_epi8_mask(__mmask64 __U, __m512i __A, __m512i __B) {
17081706 return _mm512_mask_cmpneq_epi8_mask (__U, _mm512_and_epi32 (__A, __B),
17091707 _mm512_setzero_si512());
17101708}
17111709
1712static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1713_mm512_test_epi16_mask (__m512i __A, __m512i __B)
1714{
1710static __inline__ __mmask32 __DEFAULT_FN_ATTRS512_CONSTEXPR
1711_mm512_test_epi16_mask(__m512i __A, __m512i __B) {
17151712 return _mm512_cmpneq_epi16_mask (_mm512_and_epi32 (__A, __B),
17161713 _mm512_setzero_si512());
17171714}
17181715
1719static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1720_mm512_mask_test_epi16_mask (__mmask32 __U, __m512i __A, __m512i __B)
1721{
1716static __inline__ __mmask32 __DEFAULT_FN_ATTRS512_CONSTEXPR
1717_mm512_mask_test_epi16_mask(__mmask32 __U, __m512i __A, __m512i __B) {
17221718 return _mm512_mask_cmpneq_epi16_mask (__U, _mm512_and_epi32 (__A, __B),
17231719 _mm512_setzero_si512());
17241720}
17251721
1726static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1727_mm512_testn_epi8_mask (__m512i __A, __m512i __B)
1728{
1722static __inline__ __mmask64 __DEFAULT_FN_ATTRS512_CONSTEXPR
1723_mm512_testn_epi8_mask(__m512i __A, __m512i __B) {
17291724 return _mm512_cmpeq_epi8_mask (_mm512_and_epi32 (__A, __B), _mm512_setzero_si512());
17301725}
17311726
1732static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1733_mm512_mask_testn_epi8_mask (__mmask64 __U, __m512i __A, __m512i __B)
1734{
1727static __inline__ __mmask64 __DEFAULT_FN_ATTRS512_CONSTEXPR
1728_mm512_mask_testn_epi8_mask(__mmask64 __U, __m512i __A, __m512i __B) {
17351729 return _mm512_mask_cmpeq_epi8_mask (__U, _mm512_and_epi32 (__A, __B),
17361730 _mm512_setzero_si512());
17371731}
17381732
1739static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1740_mm512_testn_epi16_mask (__m512i __A, __m512i __B)
1741{
1733static __inline__ __mmask32 __DEFAULT_FN_ATTRS512_CONSTEXPR
1734_mm512_testn_epi16_mask(__m512i __A, __m512i __B) {
17421735 return _mm512_cmpeq_epi16_mask (_mm512_and_epi32 (__A, __B),
17431736 _mm512_setzero_si512());
17441737}
17451738
1746static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1747_mm512_mask_testn_epi16_mask (__mmask32 __U, __m512i __A, __m512i __B)
1748{
1739static __inline__ __mmask32 __DEFAULT_FN_ATTRS512_CONSTEXPR
1740_mm512_mask_testn_epi16_mask(__mmask32 __U, __m512i __A, __m512i __B) {
17491741 return _mm512_mask_cmpeq_epi16_mask (__U, _mm512_and_epi32 (__A, __B),
17501742 _mm512_setzero_si512());
17511743}
......@@ -1880,11 +1872,9 @@ _mm512_mask_permutexvar_epi16(__m512i __W, __mmask32 __M, __m512i __A,
18801872 (__v32hi)_mm512_dbsad_epu8((A), (B), (imm)), \
18811873 (__v32hi)_mm512_setzero_si512()))
18821874
1883static __inline__ __m512i __DEFAULT_FN_ATTRS512
1884_mm512_sad_epu8 (__m512i __A, __m512i __B)
1885{
1886 return (__m512i) __builtin_ia32_psadbw512 ((__v64qi) __A,
1887 (__v64qi) __B);
1875static __inline__ __m512i
1876 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_sad_epu8(__m512i __A, __m512i __B) {
1877 return (__m512i)__builtin_ia32_psadbw512((__v64qu)__A, (__v64qu)__B);
18881878}
18891879
18901880#undef __DEFAULT_FN_ATTRS512
lib/include/avx512fintrin.h+62-89
......@@ -42,11 +42,12 @@ typedef unsigned char __mmask8;
4242typedef unsigned short __mmask16;
4343
4444/* Rounding mode macros. */
45#define _MM_FROUND_TO_NEAREST_INT 0x00
46#define _MM_FROUND_TO_NEG_INF 0x01
47#define _MM_FROUND_TO_POS_INF 0x02
48#define _MM_FROUND_TO_ZERO 0x03
49#define _MM_FROUND_CUR_DIRECTION 0x04
45#define _MM_FROUND_TO_NEAREST_INT 0x00
46#define _MM_FROUND_TO_NEAREST_TIES_EVEN 0x00
47#define _MM_FROUND_TO_NEG_INF 0x01
48#define _MM_FROUND_TO_POS_INF 0x02
49#define _MM_FROUND_TO_ZERO 0x03
50#define _MM_FROUND_CUR_DIRECTION 0x04
5051
5152/* Constants for integer comparison predicates */
5253typedef enum {
......@@ -986,10 +987,8 @@ _mm512_maskz_max_ps(__mmask16 __U, __m512 __A, __m512 __B) {
986987 (__v16sf)_mm512_setzero_ps());
987988}
988989
989static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_max_ss(__m128 __W,
990 __mmask8 __U,
991 __m128 __A,
992 __m128 __B) {
990static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
991_mm_mask_max_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
993992 return (__m128) __builtin_ia32_maxss_round_mask ((__v4sf) __A,
994993 (__v4sf) __B,
995994 (__v4sf) __W,
......@@ -997,9 +996,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_max_ss(__m128 __W,
997996 _MM_FROUND_CUR_DIRECTION);
998997}
999998
1000static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_max_ss(__mmask8 __U,
1001 __m128 __A,
1002 __m128 __B) {
999static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1000_mm_maskz_max_ss(__mmask8 __U, __m128 __A, __m128 __B) {
10031001 return (__m128) __builtin_ia32_maxss_round_mask ((__v4sf) __A,
10041002 (__v4sf) __B,
10051003 (__v4sf) _mm_setzero_ps (),
......@@ -1025,10 +1023,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_max_ss(__mmask8 __U,
10251023 (__v4sf)_mm_setzero_ps(), \
10261024 (__mmask8)(U), (int)(R)))
10271025
1028static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_max_sd(__m128d __W,
1029 __mmask8 __U,
1030 __m128d __A,
1031 __m128d __B) {
1026static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1027_mm_mask_max_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
10321028 return (__m128d) __builtin_ia32_maxsd_round_mask ((__v2df) __A,
10331029 (__v2df) __B,
10341030 (__v2df) __W,
......@@ -1036,9 +1032,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_max_sd(__m128d __W,
10361032 _MM_FROUND_CUR_DIRECTION);
10371033}
10381034
1039static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_maskz_max_sd(__mmask8 __U,
1040 __m128d __A,
1041 __m128d __B) {
1035static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1036_mm_maskz_max_sd(__mmask8 __U, __m128d __A, __m128d __B) {
10421037 return (__m128d) __builtin_ia32_maxsd_round_mask ((__v2df) __A,
10431038 (__v2df) __B,
10441039 (__v2df) _mm_setzero_pd (),
......@@ -1208,10 +1203,8 @@ _mm512_maskz_min_ps(__mmask16 __U, __m512 __A, __m512 __B) {
12081203 (__v16sf)_mm512_setzero_ps());
12091204}
12101205
1211static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_min_ss(__m128 __W,
1212 __mmask8 __U,
1213 __m128 __A,
1214 __m128 __B) {
1206static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1207_mm_mask_min_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
12151208 return (__m128) __builtin_ia32_minss_round_mask ((__v4sf) __A,
12161209 (__v4sf) __B,
12171210 (__v4sf) __W,
......@@ -1219,9 +1212,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_mask_min_ss(__m128 __W,
12191212 _MM_FROUND_CUR_DIRECTION);
12201213}
12211214
1222static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_min_ss(__mmask8 __U,
1223 __m128 __A,
1224 __m128 __B) {
1215static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1216_mm_maskz_min_ss(__mmask8 __U, __m128 __A, __m128 __B) {
12251217 return (__m128) __builtin_ia32_minss_round_mask ((__v4sf) __A,
12261218 (__v4sf) __B,
12271219 (__v4sf) _mm_setzero_ps (),
......@@ -1247,10 +1239,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS128 _mm_maskz_min_ss(__mmask8 __U,
12471239 (__v4sf)_mm_setzero_ps(), \
12481240 (__mmask8)(U), (int)(R)))
12491241
1250static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_min_sd(__m128d __W,
1251 __mmask8 __U,
1252 __m128d __A,
1253 __m128d __B) {
1242static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1243_mm_mask_min_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
12541244 return (__m128d) __builtin_ia32_minsd_round_mask ((__v2df) __A,
12551245 (__v2df) __B,
12561246 (__v2df) __W,
......@@ -1258,9 +1248,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_mask_min_sd(__m128d __W,
12581248 _MM_FROUND_CUR_DIRECTION);
12591249}
12601250
1261static __inline__ __m128d __DEFAULT_FN_ATTRS128 _mm_maskz_min_sd(__mmask8 __U,
1262 __m128d __A,
1263 __m128d __B) {
1251static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1252_mm_maskz_min_sd(__mmask8 __U, __m128d __A, __m128d __B) {
12641253 return (__m128d) __builtin_ia32_minsd_round_mask ((__v2df) __A,
12651254 (__v2df) __B,
12661255 (__v2df) _mm_setzero_pd (),
......@@ -8108,68 +8097,60 @@ _mm512_stream_ps (void *__P, __m512 __A)
81088097 __builtin_nontemporal_store((__v16sf_aligned)__A, (__v16sf_aligned*)__P);
81098098}
81108099
8111static __inline__ __m512d __DEFAULT_FN_ATTRS512
8112_mm512_mask_compress_pd (__m512d __W, __mmask8 __U, __m512d __A)
8113{
8100static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8101_mm512_mask_compress_pd(__m512d __W, __mmask8 __U, __m512d __A) {
81148102 return (__m512d) __builtin_ia32_compressdf512_mask ((__v8df) __A,
81158103 (__v8df) __W,
81168104 (__mmask8) __U);
81178105}
81188106
8119static __inline__ __m512d __DEFAULT_FN_ATTRS512
8120_mm512_maskz_compress_pd (__mmask8 __U, __m512d __A)
8121{
8107static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
8108_mm512_maskz_compress_pd(__mmask8 __U, __m512d __A) {
81228109 return (__m512d) __builtin_ia32_compressdf512_mask ((__v8df) __A,
81238110 (__v8df)
81248111 _mm512_setzero_pd (),
81258112 (__mmask8) __U);
81268113}
81278114
8128static __inline__ __m512i __DEFAULT_FN_ATTRS512
8129_mm512_mask_compress_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
8130{
8115static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8116_mm512_mask_compress_epi64(__m512i __W, __mmask8 __U, __m512i __A) {
81318117 return (__m512i) __builtin_ia32_compressdi512_mask ((__v8di) __A,
81328118 (__v8di) __W,
81338119 (__mmask8) __U);
81348120}
81358121
8136static __inline__ __m512i __DEFAULT_FN_ATTRS512
8137_mm512_maskz_compress_epi64 (__mmask8 __U, __m512i __A)
8138{
8122static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8123_mm512_maskz_compress_epi64(__mmask8 __U, __m512i __A) {
81398124 return (__m512i) __builtin_ia32_compressdi512_mask ((__v8di) __A,
81408125 (__v8di)
81418126 _mm512_setzero_si512 (),
81428127 (__mmask8) __U);
81438128}
81448129
8145static __inline__ __m512 __DEFAULT_FN_ATTRS512
8146_mm512_mask_compress_ps (__m512 __W, __mmask16 __U, __m512 __A)
8147{
8130static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8131_mm512_mask_compress_ps(__m512 __W, __mmask16 __U, __m512 __A) {
81488132 return (__m512) __builtin_ia32_compresssf512_mask ((__v16sf) __A,
81498133 (__v16sf) __W,
81508134 (__mmask16) __U);
81518135}
81528136
8153static __inline__ __m512 __DEFAULT_FN_ATTRS512
8154_mm512_maskz_compress_ps (__mmask16 __U, __m512 __A)
8155{
8137static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
8138_mm512_maskz_compress_ps(__mmask16 __U, __m512 __A) {
81568139 return (__m512) __builtin_ia32_compresssf512_mask ((__v16sf) __A,
81578140 (__v16sf)
81588141 _mm512_setzero_ps (),
81598142 (__mmask16) __U);
81608143}
81618144
8162static __inline__ __m512i __DEFAULT_FN_ATTRS512
8163_mm512_mask_compress_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
8164{
8145static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8146_mm512_mask_compress_epi32(__m512i __W, __mmask16 __U, __m512i __A) {
81658147 return (__m512i) __builtin_ia32_compresssi512_mask ((__v16si) __A,
81668148 (__v16si) __W,
81678149 (__mmask16) __U);
81688150}
81698151
8170static __inline__ __m512i __DEFAULT_FN_ATTRS512
8171_mm512_maskz_compress_epi32 (__mmask16 __U, __m512i __A)
8172{
8152static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
8153_mm512_maskz_compress_epi32(__mmask16 __U, __m512i __A) {
81738154 return (__m512i) __builtin_ia32_compresssi512_mask ((__v16si) __A,
81748155 (__v16si)
81758156 _mm512_setzero_si512 (),
......@@ -8222,58 +8203,50 @@ _mm512_maskz_compress_epi32 (__mmask16 __U, __m512i __A)
82228203
82238204/* Bit Test */
82248205
8225static __inline __mmask16 __DEFAULT_FN_ATTRS512
8226_mm512_test_epi32_mask (__m512i __A, __m512i __B)
8227{
8206static __inline __mmask16 __DEFAULT_FN_ATTRS512_CONSTEXPR
8207_mm512_test_epi32_mask(__m512i __A, __m512i __B) {
82288208 return _mm512_cmpneq_epi32_mask (_mm512_and_epi32(__A, __B),
82298209 _mm512_setzero_si512());
82308210}
82318211
8232static __inline__ __mmask16 __DEFAULT_FN_ATTRS512
8233_mm512_mask_test_epi32_mask (__mmask16 __U, __m512i __A, __m512i __B)
8234{
8212static __inline__ __mmask16 __DEFAULT_FN_ATTRS512_CONSTEXPR
8213_mm512_mask_test_epi32_mask(__mmask16 __U, __m512i __A, __m512i __B) {
82358214 return _mm512_mask_cmpneq_epi32_mask (__U, _mm512_and_epi32 (__A, __B),
82368215 _mm512_setzero_si512());
82378216}
82388217
8239static __inline __mmask8 __DEFAULT_FN_ATTRS512
8240_mm512_test_epi64_mask (__m512i __A, __m512i __B)
8241{
8218static __inline __mmask8 __DEFAULT_FN_ATTRS512_CONSTEXPR
8219_mm512_test_epi64_mask(__m512i __A, __m512i __B) {
82428220 return _mm512_cmpneq_epi64_mask (_mm512_and_epi32 (__A, __B),
82438221 _mm512_setzero_si512());
82448222}
82458223
8246static __inline__ __mmask8 __DEFAULT_FN_ATTRS512
8247_mm512_mask_test_epi64_mask (__mmask8 __U, __m512i __A, __m512i __B)
8248{
8224static __inline__ __mmask8 __DEFAULT_FN_ATTRS512_CONSTEXPR
8225_mm512_mask_test_epi64_mask(__mmask8 __U, __m512i __A, __m512i __B) {
82498226 return _mm512_mask_cmpneq_epi64_mask (__U, _mm512_and_epi32 (__A, __B),
82508227 _mm512_setzero_si512());
82518228}
82528229
8253static __inline__ __mmask16 __DEFAULT_FN_ATTRS512
8254_mm512_testn_epi32_mask (__m512i __A, __m512i __B)
8255{
8230static __inline__ __mmask16 __DEFAULT_FN_ATTRS512_CONSTEXPR
8231_mm512_testn_epi32_mask(__m512i __A, __m512i __B) {
82568232 return _mm512_cmpeq_epi32_mask (_mm512_and_epi32 (__A, __B),
82578233 _mm512_setzero_si512());
82588234}
82598235
8260static __inline__ __mmask16 __DEFAULT_FN_ATTRS512
8261_mm512_mask_testn_epi32_mask (__mmask16 __U, __m512i __A, __m512i __B)
8262{
8236static __inline__ __mmask16 __DEFAULT_FN_ATTRS512_CONSTEXPR
8237_mm512_mask_testn_epi32_mask(__mmask16 __U, __m512i __A, __m512i __B) {
82638238 return _mm512_mask_cmpeq_epi32_mask (__U, _mm512_and_epi32 (__A, __B),
82648239 _mm512_setzero_si512());
82658240}
82668241
8267static __inline__ __mmask8 __DEFAULT_FN_ATTRS512
8268_mm512_testn_epi64_mask (__m512i __A, __m512i __B)
8269{
8242static __inline__ __mmask8 __DEFAULT_FN_ATTRS512_CONSTEXPR
8243_mm512_testn_epi64_mask(__m512i __A, __m512i __B) {
82708244 return _mm512_cmpeq_epi64_mask (_mm512_and_epi32 (__A, __B),
82718245 _mm512_setzero_si512());
82728246}
82738247
8274static __inline__ __mmask8 __DEFAULT_FN_ATTRS512
8275_mm512_mask_testn_epi64_mask (__mmask8 __U, __m512i __A, __m512i __B)
8276{
8248static __inline__ __mmask8 __DEFAULT_FN_ATTRS512_CONSTEXPR
8249_mm512_mask_testn_epi64_mask(__mmask8 __U, __m512i __A, __m512i __B) {
82778250 return _mm512_mask_cmpeq_epi64_mask (__U, _mm512_and_epi32 (__A, __B),
82788251 _mm512_setzero_si512());
82798252}
......@@ -8403,7 +8376,7 @@ _mm_maskz_load_sd (__mmask8 __U, const double* __A)
84038376 (__v16si)_mm512_shuffle_epi32((A), (I)), \
84048377 (__v16si)_mm512_setzero_si512()))
84058378
8406static __inline__ __m512d __DEFAULT_FN_ATTRS512
8379static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
84078380_mm512_mask_expand_pd (__m512d __W, __mmask8 __U, __m512d __A)
84088381{
84098382 return (__m512d) __builtin_ia32_expanddf512_mask ((__v8df) __A,
......@@ -8411,7 +8384,7 @@ _mm512_mask_expand_pd (__m512d __W, __mmask8 __U, __m512d __A)
84118384 (__mmask8) __U);
84128385}
84138386
8414static __inline__ __m512d __DEFAULT_FN_ATTRS512
8387static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
84158388_mm512_maskz_expand_pd (__mmask8 __U, __m512d __A)
84168389{
84178390 return (__m512d) __builtin_ia32_expanddf512_mask ((__v8df) __A,
......@@ -8419,7 +8392,7 @@ _mm512_maskz_expand_pd (__mmask8 __U, __m512d __A)
84198392 (__mmask8) __U);
84208393}
84218394
8422static __inline__ __m512i __DEFAULT_FN_ATTRS512
8395static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
84238396_mm512_mask_expand_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
84248397{
84258398 return (__m512i) __builtin_ia32_expanddi512_mask ((__v8di) __A,
......@@ -8427,7 +8400,7 @@ _mm512_mask_expand_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
84278400 (__mmask8) __U);
84288401}
84298402
8430static __inline__ __m512i __DEFAULT_FN_ATTRS512
8403static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
84318404_mm512_maskz_expand_epi64 ( __mmask8 __U, __m512i __A)
84328405{
84338406 return (__m512i) __builtin_ia32_expanddi512_mask ((__v8di) __A,
......@@ -8499,7 +8472,7 @@ _mm512_maskz_expandloadu_epi32(__mmask16 __U, void const *__P)
84998472 (__mmask16) __U);
85008473}
85018474
8502static __inline__ __m512 __DEFAULT_FN_ATTRS512
8475static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
85038476_mm512_mask_expand_ps (__m512 __W, __mmask16 __U, __m512 __A)
85048477{
85058478 return (__m512) __builtin_ia32_expandsf512_mask ((__v16sf) __A,
......@@ -8507,7 +8480,7 @@ _mm512_mask_expand_ps (__m512 __W, __mmask16 __U, __m512 __A)
85078480 (__mmask16) __U);
85088481}
85098482
8510static __inline__ __m512 __DEFAULT_FN_ATTRS512
8483static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
85118484_mm512_maskz_expand_ps (__mmask16 __U, __m512 __A)
85128485{
85138486 return (__m512) __builtin_ia32_expandsf512_mask ((__v16sf) __A,
......@@ -8515,7 +8488,7 @@ _mm512_maskz_expand_ps (__mmask16 __U, __m512 __A)
85158488 (__mmask16) __U);
85168489}
85178490
8518static __inline__ __m512i __DEFAULT_FN_ATTRS512
8491static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
85198492_mm512_mask_expand_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
85208493{
85218494 return (__m512i) __builtin_ia32_expandsi512_mask ((__v16si) __A,
......@@ -8523,7 +8496,7 @@ _mm512_mask_expand_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
85238496 (__mmask16) __U);
85248497}
85258498
8526static __inline__ __m512i __DEFAULT_FN_ATTRS512
8499static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
85278500_mm512_maskz_expand_epi32 (__mmask16 __U, __m512i __A)
85288501{
85298502 return (__m512i) __builtin_ia32_expandsi512_mask ((__v16si) __A,
lib/include/avx512fp16intrin.h+12-18
......@@ -720,25 +720,22 @@ _mm_maskz_div_sh(__mmask8 __U, __m128h __A, __m128h __B) {
720720 (__v8hf)(__m128h)(A), (__v8hf)(__m128h)(B), (__v8hf)_mm_setzero_ph(), \
721721 (__mmask8)(U), (int)(R)))
722722
723static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_min_sh(__m128h __A,
724 __m128h __B) {
723static __inline__ __m128h
724 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_min_sh(__m128h __A, __m128h __B) {
725725 return (__m128h)__builtin_ia32_minsh_round_mask(
726726 (__v8hf)__A, (__v8hf)__B, (__v8hf)_mm_setzero_ph(), (__mmask8)-1,
727727 _MM_FROUND_CUR_DIRECTION);
728728}
729729
730static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_min_sh(__m128h __W,
731 __mmask8 __U,
732 __m128h __A,
733 __m128h __B) {
730static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
731_mm_mask_min_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
734732 return (__m128h)__builtin_ia32_minsh_round_mask((__v8hf)__A, (__v8hf)__B,
735733 (__v8hf)__W, (__mmask8)__U,
736734 _MM_FROUND_CUR_DIRECTION);
737735}
738736
739static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_min_sh(__mmask8 __U,
740 __m128h __A,
741 __m128h __B) {
737static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
738_mm_maskz_min_sh(__mmask8 __U, __m128h __A, __m128h __B) {
742739 return (__m128h)__builtin_ia32_minsh_round_mask(
743740 (__v8hf)__A, (__v8hf)__B, (__v8hf)_mm_setzero_ph(), (__mmask8)__U,
744741 _MM_FROUND_CUR_DIRECTION);
......@@ -759,25 +756,22 @@ static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_min_sh(__mmask8 __U,
759756 (__v8hf)(__m128h)(A), (__v8hf)(__m128h)(B), (__v8hf)_mm_setzero_ph(), \
760757 (__mmask8)(U), (int)(R)))
761758
762static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_max_sh(__m128h __A,
763 __m128h __B) {
759static __inline__ __m128h
760 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_max_sh(__m128h __A, __m128h __B) {
764761 return (__m128h)__builtin_ia32_maxsh_round_mask(
765762 (__v8hf)__A, (__v8hf)__B, (__v8hf)_mm_setzero_ph(), (__mmask8)-1,
766763 _MM_FROUND_CUR_DIRECTION);
767764}
768765
769static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_mask_max_sh(__m128h __W,
770 __mmask8 __U,
771 __m128h __A,
772 __m128h __B) {
766static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
767_mm_mask_max_sh(__m128h __W, __mmask8 __U, __m128h __A, __m128h __B) {
773768 return (__m128h)__builtin_ia32_maxsh_round_mask((__v8hf)__A, (__v8hf)__B,
774769 (__v8hf)__W, (__mmask8)__U,
775770 _MM_FROUND_CUR_DIRECTION);
776771}
777772
778static __inline__ __m128h __DEFAULT_FN_ATTRS128 _mm_maskz_max_sh(__mmask8 __U,
779 __m128h __A,
780 __m128h __B) {
773static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
774_mm_maskz_max_sh(__mmask8 __U, __m128h __A, __m128h __B) {
781775 return (__m128h)__builtin_ia32_maxsh_round_mask(
782776 (__v8hf)__A, (__v8hf)__B, (__v8hf)_mm_setzero_ph(), (__mmask8)__U,
783777 _MM_FROUND_CUR_DIRECTION);
lib/include/avx512vbmi2intrin.h+12-16
......@@ -25,33 +25,29 @@
2525#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
2626#endif
2727
28static __inline__ __m512i __DEFAULT_FN_ATTRS
29_mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D)
30{
28static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
29_mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D) {
3130 return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
3231 (__v32hi) __S,
3332 __U);
3433}
3534
36static __inline__ __m512i __DEFAULT_FN_ATTRS
37_mm512_maskz_compress_epi16(__mmask32 __U, __m512i __D)
38{
35static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
36_mm512_maskz_compress_epi16(__mmask32 __U, __m512i __D) {
3937 return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
4038 (__v32hi) _mm512_setzero_si512(),
4139 __U);
4240}
4341
44static __inline__ __m512i __DEFAULT_FN_ATTRS
45_mm512_mask_compress_epi8(__m512i __S, __mmask64 __U, __m512i __D)
46{
42static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
43_mm512_mask_compress_epi8(__m512i __S, __mmask64 __U, __m512i __D) {
4744 return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
4845 (__v64qi) __S,
4946 __U);
5047}
5148
52static __inline__ __m512i __DEFAULT_FN_ATTRS
53_mm512_maskz_compress_epi8(__mmask64 __U, __m512i __D)
54{
49static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
50_mm512_maskz_compress_epi8(__mmask64 __U, __m512i __D) {
5551 return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
5652 (__v64qi) _mm512_setzero_si512(),
5753 __U);
......@@ -71,7 +67,7 @@ _mm512_mask_compressstoreu_epi8(void *__P, __mmask64 __U, __m512i __D)
7167 __U);
7268}
7369
74static __inline__ __m512i __DEFAULT_FN_ATTRS
70static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
7571_mm512_mask_expand_epi16(__m512i __S, __mmask32 __U, __m512i __D)
7672{
7773 return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
......@@ -79,7 +75,7 @@ _mm512_mask_expand_epi16(__m512i __S, __mmask32 __U, __m512i __D)
7975 __U);
8076}
8177
82static __inline__ __m512i __DEFAULT_FN_ATTRS
78static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
8379_mm512_maskz_expand_epi16(__mmask32 __U, __m512i __D)
8480{
8581 return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
......@@ -87,7 +83,7 @@ _mm512_maskz_expand_epi16(__mmask32 __U, __m512i __D)
8783 __U);
8884}
8985
90static __inline__ __m512i __DEFAULT_FN_ATTRS
86static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
9187_mm512_mask_expand_epi8(__m512i __S, __mmask64 __U, __m512i __D)
9288{
9389 return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
......@@ -95,7 +91,7 @@ _mm512_mask_expand_epi8(__m512i __S, __mmask64 __U, __m512i __D)
9591 __U);
9692}
9793
98static __inline__ __m512i __DEFAULT_FN_ATTRS
94static __inline__ __m512i __DEFAULT_FN_ATTRS_CONSTEXPR
9995_mm512_maskz_expand_epi8(__mmask64 __U, __m512i __D)
10096{
10197 return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
lib/include/avx512vlbwintrin.h+24-36
......@@ -2394,36 +2394,31 @@ _mm256_test_epi8_mask(__m256i __A, __m256i __B) {
23942394 _mm256_setzero_si256());
23952395}
23962396
2397static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
2398_mm256_mask_test_epi8_mask (__mmask32 __U, __m256i __A, __m256i __B)
2399{
2397static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2398_mm256_mask_test_epi8_mask(__mmask32 __U, __m256i __A, __m256i __B) {
24002399 return _mm256_mask_cmpneq_epi8_mask (__U, _mm256_and_si256(__A, __B),
24012400 _mm256_setzero_si256());
24022401}
24032402
2404static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
2405_mm_test_epi16_mask (__m128i __A, __m128i __B)
2406{
2403static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
2404_mm_test_epi16_mask(__m128i __A, __m128i __B) {
24072405 return _mm_cmpneq_epi16_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
24082406}
24092407
2410static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
2411_mm_mask_test_epi16_mask (__mmask8 __U, __m128i __A, __m128i __B)
2412{
2408static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
2409_mm_mask_test_epi16_mask(__mmask8 __U, __m128i __A, __m128i __B) {
24132410 return _mm_mask_cmpneq_epi16_mask (__U, _mm_and_si128 (__A, __B),
24142411 _mm_setzero_si128());
24152412}
24162413
2417static __inline__ __mmask16 __DEFAULT_FN_ATTRS256
2418_mm256_test_epi16_mask (__m256i __A, __m256i __B)
2419{
2414static __inline__ __mmask16 __DEFAULT_FN_ATTRS256_CONSTEXPR
2415_mm256_test_epi16_mask(__m256i __A, __m256i __B) {
24202416 return _mm256_cmpneq_epi16_mask (_mm256_and_si256 (__A, __B),
24212417 _mm256_setzero_si256 ());
24222418}
24232419
2424static __inline__ __mmask16 __DEFAULT_FN_ATTRS256
2425_mm256_mask_test_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
2426{
2420static __inline__ __mmask16 __DEFAULT_FN_ATTRS256_CONSTEXPR
2421_mm256_mask_test_epi16_mask(__mmask16 __U, __m256i __A, __m256i __B) {
24272422 return _mm256_mask_cmpneq_epi16_mask (__U, _mm256_and_si256(__A, __B),
24282423 _mm256_setzero_si256());
24292424}
......@@ -2433,49 +2428,42 @@ _mm_testn_epi8_mask(__m128i __A, __m128i __B) {
24332428 return _mm_cmpeq_epi8_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
24342429}
24352430
2436static __inline__ __mmask16 __DEFAULT_FN_ATTRS128
2437_mm_mask_testn_epi8_mask (__mmask16 __U, __m128i __A, __m128i __B)
2438{
2431static __inline__ __mmask16 __DEFAULT_FN_ATTRS128_CONSTEXPR
2432_mm_mask_testn_epi8_mask(__mmask16 __U, __m128i __A, __m128i __B) {
24392433 return _mm_mask_cmpeq_epi8_mask (__U, _mm_and_si128 (__A, __B),
24402434 _mm_setzero_si128());
24412435}
24422436
2443static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
2444_mm256_testn_epi8_mask (__m256i __A, __m256i __B)
2445{
2437static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2438_mm256_testn_epi8_mask(__m256i __A, __m256i __B) {
24462439 return _mm256_cmpeq_epi8_mask (_mm256_and_si256 (__A, __B),
24472440 _mm256_setzero_si256());
24482441}
24492442
2450static __inline__ __mmask32 __DEFAULT_FN_ATTRS256
2451_mm256_mask_testn_epi8_mask (__mmask32 __U, __m256i __A, __m256i __B)
2452{
2443static __inline__ __mmask32 __DEFAULT_FN_ATTRS256_CONSTEXPR
2444_mm256_mask_testn_epi8_mask(__mmask32 __U, __m256i __A, __m256i __B) {
24532445 return _mm256_mask_cmpeq_epi8_mask (__U, _mm256_and_si256 (__A, __B),
24542446 _mm256_setzero_si256());
24552447}
24562448
2457static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
2458_mm_testn_epi16_mask (__m128i __A, __m128i __B)
2459{
2449static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
2450_mm_testn_epi16_mask(__m128i __A, __m128i __B) {
24602451 return _mm_cmpeq_epi16_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
24612452}
24622453
2463static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
2464_mm_mask_testn_epi16_mask (__mmask8 __U, __m128i __A, __m128i __B)
2465{
2454static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
2455_mm_mask_testn_epi16_mask(__mmask8 __U, __m128i __A, __m128i __B) {
24662456 return _mm_mask_cmpeq_epi16_mask (__U, _mm_and_si128(__A, __B), _mm_setzero_si128());
24672457}
24682458
2469static __inline__ __mmask16 __DEFAULT_FN_ATTRS256
2470_mm256_testn_epi16_mask (__m256i __A, __m256i __B)
2471{
2459static __inline__ __mmask16 __DEFAULT_FN_ATTRS256_CONSTEXPR
2460_mm256_testn_epi16_mask(__m256i __A, __m256i __B) {
24722461 return _mm256_cmpeq_epi16_mask (_mm256_and_si256(__A, __B),
24732462 _mm256_setzero_si256());
24742463}
24752464
2476static __inline__ __mmask16 __DEFAULT_FN_ATTRS256
2477_mm256_mask_testn_epi16_mask (__mmask16 __U, __m256i __A, __m256i __B)
2478{
2465static __inline__ __mmask16 __DEFAULT_FN_ATTRS256_CONSTEXPR
2466_mm256_mask_testn_epi16_mask(__mmask16 __U, __m256i __A, __m256i __B) {
24792467 return _mm256_mask_cmpeq_epi16_mask (__U, _mm256_and_si256 (__A, __B),
24802468 _mm256_setzero_si256());
24812469}
lib/include/avx512vlintrin.h+80-96
......@@ -1530,120 +1530,120 @@ _mm256_mask_blend_epi64(__mmask8 __U, __m256i __A, __m256i __W) {
15301530 (__v4di) __A);
15311531}
15321532
1533static __inline__ __m128d __DEFAULT_FN_ATTRS128
1534_mm_mask_compress_pd (__m128d __W, __mmask8 __U, __m128d __A) {
1533static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1534_mm_mask_compress_pd(__m128d __W, __mmask8 __U, __m128d __A) {
15351535 return (__m128d) __builtin_ia32_compressdf128_mask ((__v2df) __A,
15361536 (__v2df) __W,
15371537 (__mmask8) __U);
15381538}
15391539
1540static __inline__ __m128d __DEFAULT_FN_ATTRS128
1541_mm_maskz_compress_pd (__mmask8 __U, __m128d __A) {
1540static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
1541_mm_maskz_compress_pd(__mmask8 __U, __m128d __A) {
15421542 return (__m128d) __builtin_ia32_compressdf128_mask ((__v2df) __A,
15431543 (__v2df)
15441544 _mm_setzero_pd (),
15451545 (__mmask8) __U);
15461546}
15471547
1548static __inline__ __m256d __DEFAULT_FN_ATTRS256
1549_mm256_mask_compress_pd (__m256d __W, __mmask8 __U, __m256d __A) {
1548static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1549_mm256_mask_compress_pd(__m256d __W, __mmask8 __U, __m256d __A) {
15501550 return (__m256d) __builtin_ia32_compressdf256_mask ((__v4df) __A,
15511551 (__v4df) __W,
15521552 (__mmask8) __U);
15531553}
15541554
1555static __inline__ __m256d __DEFAULT_FN_ATTRS256
1556_mm256_maskz_compress_pd (__mmask8 __U, __m256d __A) {
1555static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
1556_mm256_maskz_compress_pd(__mmask8 __U, __m256d __A) {
15571557 return (__m256d) __builtin_ia32_compressdf256_mask ((__v4df) __A,
15581558 (__v4df)
15591559 _mm256_setzero_pd (),
15601560 (__mmask8) __U);
15611561}
15621562
1563static __inline__ __m128i __DEFAULT_FN_ATTRS128
1564_mm_mask_compress_epi64 (__m128i __W, __mmask8 __U, __m128i __A) {
1563static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1564_mm_mask_compress_epi64(__m128i __W, __mmask8 __U, __m128i __A) {
15651565 return (__m128i) __builtin_ia32_compressdi128_mask ((__v2di) __A,
15661566 (__v2di) __W,
15671567 (__mmask8) __U);
15681568}
15691569
1570static __inline__ __m128i __DEFAULT_FN_ATTRS128
1571_mm_maskz_compress_epi64 (__mmask8 __U, __m128i __A) {
1570static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1571_mm_maskz_compress_epi64(__mmask8 __U, __m128i __A) {
15721572 return (__m128i) __builtin_ia32_compressdi128_mask ((__v2di) __A,
15731573 (__v2di)
15741574 _mm_setzero_si128 (),
15751575 (__mmask8) __U);
15761576}
15771577
1578static __inline__ __m256i __DEFAULT_FN_ATTRS256
1579_mm256_mask_compress_epi64 (__m256i __W, __mmask8 __U, __m256i __A) {
1578static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1579_mm256_mask_compress_epi64(__m256i __W, __mmask8 __U, __m256i __A) {
15801580 return (__m256i) __builtin_ia32_compressdi256_mask ((__v4di) __A,
15811581 (__v4di) __W,
15821582 (__mmask8) __U);
15831583}
15841584
1585static __inline__ __m256i __DEFAULT_FN_ATTRS256
1586_mm256_maskz_compress_epi64 (__mmask8 __U, __m256i __A) {
1585static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1586_mm256_maskz_compress_epi64(__mmask8 __U, __m256i __A) {
15871587 return (__m256i) __builtin_ia32_compressdi256_mask ((__v4di) __A,
15881588 (__v4di)
15891589 _mm256_setzero_si256 (),
15901590 (__mmask8) __U);
15911591}
15921592
1593static __inline__ __m128 __DEFAULT_FN_ATTRS128
1594_mm_mask_compress_ps (__m128 __W, __mmask8 __U, __m128 __A) {
1593static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1594_mm_mask_compress_ps(__m128 __W, __mmask8 __U, __m128 __A) {
15951595 return (__m128) __builtin_ia32_compresssf128_mask ((__v4sf) __A,
15961596 (__v4sf) __W,
15971597 (__mmask8) __U);
15981598}
15991599
1600static __inline__ __m128 __DEFAULT_FN_ATTRS128
1601_mm_maskz_compress_ps (__mmask8 __U, __m128 __A) {
1600static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
1601_mm_maskz_compress_ps(__mmask8 __U, __m128 __A) {
16021602 return (__m128) __builtin_ia32_compresssf128_mask ((__v4sf) __A,
16031603 (__v4sf)
16041604 _mm_setzero_ps (),
16051605 (__mmask8) __U);
16061606}
16071607
1608static __inline__ __m256 __DEFAULT_FN_ATTRS256
1609_mm256_mask_compress_ps (__m256 __W, __mmask8 __U, __m256 __A) {
1608static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1609_mm256_mask_compress_ps(__m256 __W, __mmask8 __U, __m256 __A) {
16101610 return (__m256) __builtin_ia32_compresssf256_mask ((__v8sf) __A,
16111611 (__v8sf) __W,
16121612 (__mmask8) __U);
16131613}
16141614
1615static __inline__ __m256 __DEFAULT_FN_ATTRS256
1616_mm256_maskz_compress_ps (__mmask8 __U, __m256 __A) {
1615static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
1616_mm256_maskz_compress_ps(__mmask8 __U, __m256 __A) {
16171617 return (__m256) __builtin_ia32_compresssf256_mask ((__v8sf) __A,
16181618 (__v8sf)
16191619 _mm256_setzero_ps (),
16201620 (__mmask8) __U);
16211621}
16221622
1623static __inline__ __m128i __DEFAULT_FN_ATTRS128
1624_mm_mask_compress_epi32 (__m128i __W, __mmask8 __U, __m128i __A) {
1623static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1624_mm_mask_compress_epi32(__m128i __W, __mmask8 __U, __m128i __A) {
16251625 return (__m128i) __builtin_ia32_compresssi128_mask ((__v4si) __A,
16261626 (__v4si) __W,
16271627 (__mmask8) __U);
16281628}
16291629
1630static __inline__ __m128i __DEFAULT_FN_ATTRS128
1631_mm_maskz_compress_epi32 (__mmask8 __U, __m128i __A) {
1630static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
1631_mm_maskz_compress_epi32(__mmask8 __U, __m128i __A) {
16321632 return (__m128i) __builtin_ia32_compresssi128_mask ((__v4si) __A,
16331633 (__v4si)
16341634 _mm_setzero_si128 (),
16351635 (__mmask8) __U);
16361636}
16371637
1638static __inline__ __m256i __DEFAULT_FN_ATTRS256
1639_mm256_mask_compress_epi32 (__m256i __W, __mmask8 __U, __m256i __A) {
1638static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1639_mm256_mask_compress_epi32(__m256i __W, __mmask8 __U, __m256i __A) {
16401640 return (__m256i) __builtin_ia32_compresssi256_mask ((__v8si) __A,
16411641 (__v8si) __W,
16421642 (__mmask8) __U);
16431643}
16441644
1645static __inline__ __m256i __DEFAULT_FN_ATTRS256
1646_mm256_maskz_compress_epi32 (__mmask8 __U, __m256i __A) {
1645static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
1646_mm256_maskz_compress_epi32(__mmask8 __U, __m256i __A) {
16471647 return (__m256i) __builtin_ia32_compresssi256_mask ((__v8si) __A,
16481648 (__v8si)
16491649 _mm256_setzero_si256 (),
......@@ -2250,14 +2250,14 @@ _mm256_maskz_div_ps(__mmask8 __U, __m256 __A, __m256 __B) {
22502250 (__v8sf)_mm256_setzero_ps());
22512251}
22522252
2253static __inline__ __m128d __DEFAULT_FN_ATTRS128
2253static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
22542254_mm_mask_expand_pd (__m128d __W, __mmask8 __U, __m128d __A) {
22552255 return (__m128d) __builtin_ia32_expanddf128_mask ((__v2df) __A,
22562256 (__v2df) __W,
22572257 (__mmask8) __U);
22582258}
22592259
2260static __inline__ __m128d __DEFAULT_FN_ATTRS128
2260static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
22612261_mm_maskz_expand_pd (__mmask8 __U, __m128d __A) {
22622262 return (__m128d) __builtin_ia32_expanddf128_mask ((__v2df) __A,
22632263 (__v2df)
......@@ -2265,14 +2265,14 @@ _mm_maskz_expand_pd (__mmask8 __U, __m128d __A) {
22652265 (__mmask8) __U);
22662266}
22672267
2268static __inline__ __m256d __DEFAULT_FN_ATTRS256
2268static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
22692269_mm256_mask_expand_pd (__m256d __W, __mmask8 __U, __m256d __A) {
22702270 return (__m256d) __builtin_ia32_expanddf256_mask ((__v4df) __A,
22712271 (__v4df) __W,
22722272 (__mmask8) __U);
22732273}
22742274
2275static __inline__ __m256d __DEFAULT_FN_ATTRS256
2275static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
22762276_mm256_maskz_expand_pd (__mmask8 __U, __m256d __A) {
22772277 return (__m256d) __builtin_ia32_expanddf256_mask ((__v4df) __A,
22782278 (__v4df)
......@@ -2280,14 +2280,14 @@ _mm256_maskz_expand_pd (__mmask8 __U, __m256d __A) {
22802280 (__mmask8) __U);
22812281}
22822282
2283static __inline__ __m128i __DEFAULT_FN_ATTRS128
2283static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
22842284_mm_mask_expand_epi64 (__m128i __W, __mmask8 __U, __m128i __A) {
22852285 return (__m128i) __builtin_ia32_expanddi128_mask ((__v2di) __A,
22862286 (__v2di) __W,
22872287 (__mmask8) __U);
22882288}
22892289
2290static __inline__ __m128i __DEFAULT_FN_ATTRS128
2290static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
22912291_mm_maskz_expand_epi64 (__mmask8 __U, __m128i __A) {
22922292 return (__m128i) __builtin_ia32_expanddi128_mask ((__v2di) __A,
22932293 (__v2di)
......@@ -2295,14 +2295,14 @@ _mm_maskz_expand_epi64 (__mmask8 __U, __m128i __A) {
22952295 (__mmask8) __U);
22962296}
22972297
2298static __inline__ __m256i __DEFAULT_FN_ATTRS256
2298static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
22992299_mm256_mask_expand_epi64 (__m256i __W, __mmask8 __U, __m256i __A) {
23002300 return (__m256i) __builtin_ia32_expanddi256_mask ((__v4di) __A,
23012301 (__v4di) __W,
23022302 (__mmask8) __U);
23032303}
23042304
2305static __inline__ __m256i __DEFAULT_FN_ATTRS256
2305static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
23062306_mm256_maskz_expand_epi64 (__mmask8 __U, __m256i __A) {
23072307 return (__m256i) __builtin_ia32_expanddi256_mask ((__v4di) __A,
23082308 (__v4di)
......@@ -2445,14 +2445,14 @@ _mm256_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) {
24452445 __U);
24462446}
24472447
2448static __inline__ __m128 __DEFAULT_FN_ATTRS128
2448static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
24492449_mm_mask_expand_ps (__m128 __W, __mmask8 __U, __m128 __A) {
24502450 return (__m128) __builtin_ia32_expandsf128_mask ((__v4sf) __A,
24512451 (__v4sf) __W,
24522452 (__mmask8) __U);
24532453}
24542454
2455static __inline__ __m128 __DEFAULT_FN_ATTRS128
2455static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
24562456_mm_maskz_expand_ps (__mmask8 __U, __m128 __A) {
24572457 return (__m128) __builtin_ia32_expandsf128_mask ((__v4sf) __A,
24582458 (__v4sf)
......@@ -2460,14 +2460,14 @@ _mm_maskz_expand_ps (__mmask8 __U, __m128 __A) {
24602460 (__mmask8) __U);
24612461}
24622462
2463static __inline__ __m256 __DEFAULT_FN_ATTRS256
2463static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
24642464_mm256_mask_expand_ps (__m256 __W, __mmask8 __U, __m256 __A) {
24652465 return (__m256) __builtin_ia32_expandsf256_mask ((__v8sf) __A,
24662466 (__v8sf) __W,
24672467 (__mmask8) __U);
24682468}
24692469
2470static __inline__ __m256 __DEFAULT_FN_ATTRS256
2470static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
24712471_mm256_maskz_expand_ps (__mmask8 __U, __m256 __A) {
24722472 return (__m256) __builtin_ia32_expandsf256_mask ((__v8sf) __A,
24732473 (__v8sf)
......@@ -2475,14 +2475,14 @@ _mm256_maskz_expand_ps (__mmask8 __U, __m256 __A) {
24752475 (__mmask8) __U);
24762476}
24772477
2478static __inline__ __m128i __DEFAULT_FN_ATTRS128
2478static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
24792479_mm_mask_expand_epi32 (__m128i __W, __mmask8 __U, __m128i __A) {
24802480 return (__m128i) __builtin_ia32_expandsi128_mask ((__v4si) __A,
24812481 (__v4si) __W,
24822482 (__mmask8) __U);
24832483}
24842484
2485static __inline__ __m128i __DEFAULT_FN_ATTRS128
2485static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
24862486_mm_maskz_expand_epi32 (__mmask8 __U, __m128i __A) {
24872487 return (__m128i) __builtin_ia32_expandsi128_mask ((__v4si) __A,
24882488 (__v4si)
......@@ -2490,14 +2490,14 @@ _mm_maskz_expand_epi32 (__mmask8 __U, __m128i __A) {
24902490 (__mmask8) __U);
24912491}
24922492
2493static __inline__ __m256i __DEFAULT_FN_ATTRS256
2493static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
24942494_mm256_mask_expand_epi32 (__m256i __W, __mmask8 __U, __m256i __A) {
24952495 return (__m256i) __builtin_ia32_expandsi256_mask ((__v8si) __A,
24962496 (__v8si) __W,
24972497 (__mmask8) __U);
24982498}
24992499
2500static __inline__ __m256i __DEFAULT_FN_ATTRS256
2500static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
25012501_mm256_maskz_expand_epi32 (__mmask8 __U, __m256i __A) {
25022502 return (__m256i) __builtin_ia32_expandsi256_mask ((__v8si) __A,
25032503 (__v8si)
......@@ -5887,110 +5887,94 @@ _mm256_maskz_permutevar_ps(__mmask8 __U, __m256 __A, __m256i __C) {
58875887 (__v8sf)_mm256_setzero_ps());
58885888}
58895889
5890static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5891_mm_test_epi32_mask (__m128i __A, __m128i __B)
5892{
5890static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5891_mm_test_epi32_mask(__m128i __A, __m128i __B) {
58935892 return _mm_cmpneq_epi32_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
58945893}
58955894
5896static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5897_mm_mask_test_epi32_mask (__mmask8 __U, __m128i __A, __m128i __B)
5898{
5895static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5896_mm_mask_test_epi32_mask(__mmask8 __U, __m128i __A, __m128i __B) {
58995897 return _mm_mask_cmpneq_epi32_mask (__U, _mm_and_si128 (__A, __B),
59005898 _mm_setzero_si128());
59015899}
59025900
5903static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5904_mm256_test_epi32_mask (__m256i __A, __m256i __B)
5905{
5901static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5902_mm256_test_epi32_mask(__m256i __A, __m256i __B) {
59065903 return _mm256_cmpneq_epi32_mask (_mm256_and_si256 (__A, __B),
59075904 _mm256_setzero_si256());
59085905}
59095906
5910static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5911_mm256_mask_test_epi32_mask (__mmask8 __U, __m256i __A, __m256i __B)
5912{
5907static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5908_mm256_mask_test_epi32_mask(__mmask8 __U, __m256i __A, __m256i __B) {
59135909 return _mm256_mask_cmpneq_epi32_mask (__U, _mm256_and_si256 (__A, __B),
59145910 _mm256_setzero_si256());
59155911}
59165912
5917static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5918_mm_test_epi64_mask (__m128i __A, __m128i __B)
5919{
5913static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5914_mm_test_epi64_mask(__m128i __A, __m128i __B) {
59205915 return _mm_cmpneq_epi64_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
59215916}
59225917
5923static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5924_mm_mask_test_epi64_mask (__mmask8 __U, __m128i __A, __m128i __B)
5925{
5918static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5919_mm_mask_test_epi64_mask(__mmask8 __U, __m128i __A, __m128i __B) {
59265920 return _mm_mask_cmpneq_epi64_mask (__U, _mm_and_si128 (__A, __B),
59275921 _mm_setzero_si128());
59285922}
59295923
5930static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5931_mm256_test_epi64_mask (__m256i __A, __m256i __B)
5932{
5924static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5925_mm256_test_epi64_mask(__m256i __A, __m256i __B) {
59335926 return _mm256_cmpneq_epi64_mask (_mm256_and_si256 (__A, __B),
59345927 _mm256_setzero_si256());
59355928}
59365929
5937static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5938_mm256_mask_test_epi64_mask (__mmask8 __U, __m256i __A, __m256i __B)
5939{
5930static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5931_mm256_mask_test_epi64_mask(__mmask8 __U, __m256i __A, __m256i __B) {
59405932 return _mm256_mask_cmpneq_epi64_mask (__U, _mm256_and_si256 (__A, __B),
59415933 _mm256_setzero_si256());
59425934}
59435935
5944static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5945_mm_testn_epi32_mask (__m128i __A, __m128i __B)
5946{
5936static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5937_mm_testn_epi32_mask(__m128i __A, __m128i __B) {
59475938 return _mm_cmpeq_epi32_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
59485939}
59495940
5950static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5951_mm_mask_testn_epi32_mask (__mmask8 __U, __m128i __A, __m128i __B)
5952{
5941static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5942_mm_mask_testn_epi32_mask(__mmask8 __U, __m128i __A, __m128i __B) {
59535943 return _mm_mask_cmpeq_epi32_mask (__U, _mm_and_si128 (__A, __B),
59545944 _mm_setzero_si128());
59555945}
59565946
5957static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5958_mm256_testn_epi32_mask (__m256i __A, __m256i __B)
5959{
5947static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5948_mm256_testn_epi32_mask(__m256i __A, __m256i __B) {
59605949 return _mm256_cmpeq_epi32_mask (_mm256_and_si256 (__A, __B),
59615950 _mm256_setzero_si256());
59625951}
59635952
5964static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5965_mm256_mask_testn_epi32_mask (__mmask8 __U, __m256i __A, __m256i __B)
5966{
5953static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5954_mm256_mask_testn_epi32_mask(__mmask8 __U, __m256i __A, __m256i __B) {
59675955 return _mm256_mask_cmpeq_epi32_mask (__U, _mm256_and_si256 (__A, __B),
59685956 _mm256_setzero_si256());
59695957}
59705958
5971static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5972_mm_testn_epi64_mask (__m128i __A, __m128i __B)
5973{
5959static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5960_mm_testn_epi64_mask(__m128i __A, __m128i __B) {
59745961 return _mm_cmpeq_epi64_mask (_mm_and_si128 (__A, __B), _mm_setzero_si128());
59755962}
59765963
5977static __inline__ __mmask8 __DEFAULT_FN_ATTRS128
5978_mm_mask_testn_epi64_mask (__mmask8 __U, __m128i __A, __m128i __B)
5979{
5964static __inline__ __mmask8 __DEFAULT_FN_ATTRS128_CONSTEXPR
5965_mm_mask_testn_epi64_mask(__mmask8 __U, __m128i __A, __m128i __B) {
59805966 return _mm_mask_cmpeq_epi64_mask (__U, _mm_and_si128 (__A, __B),
59815967 _mm_setzero_si128());
59825968}
59835969
5984static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5985_mm256_testn_epi64_mask (__m256i __A, __m256i __B)
5986{
5970static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5971_mm256_testn_epi64_mask(__m256i __A, __m256i __B) {
59875972 return _mm256_cmpeq_epi64_mask (_mm256_and_si256 (__A, __B),
59885973 _mm256_setzero_si256());
59895974}
59905975
5991static __inline__ __mmask8 __DEFAULT_FN_ATTRS256
5992_mm256_mask_testn_epi64_mask (__mmask8 __U, __m256i __A, __m256i __B)
5993{
5976static __inline__ __mmask8 __DEFAULT_FN_ATTRS256_CONSTEXPR
5977_mm256_mask_testn_epi64_mask(__mmask8 __U, __m256i __A, __m256i __B) {
59945978 return _mm256_mask_cmpeq_epi64_mask (__U, _mm256_and_si256 (__A, __B),
59955979 _mm256_setzero_si256());
59965980}
lib/include/avx512vlvbmi2intrin.h+24-32
......@@ -32,33 +32,29 @@
3232#define __DEFAULT_FN_ATTRS256_CONSTEXPR __DEFAULT_FN_ATTRS256
3333#endif
3434
35static __inline__ __m128i __DEFAULT_FN_ATTRS128
36_mm_mask_compress_epi16(__m128i __S, __mmask8 __U, __m128i __D)
37{
35static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
36_mm_mask_compress_epi16(__m128i __S, __mmask8 __U, __m128i __D) {
3837 return (__m128i) __builtin_ia32_compresshi128_mask ((__v8hi) __D,
3938 (__v8hi) __S,
4039 __U);
4140}
4241
43static __inline__ __m128i __DEFAULT_FN_ATTRS128
44_mm_maskz_compress_epi16(__mmask8 __U, __m128i __D)
45{
42static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
43_mm_maskz_compress_epi16(__mmask8 __U, __m128i __D) {
4644 return (__m128i) __builtin_ia32_compresshi128_mask ((__v8hi) __D,
4745 (__v8hi) _mm_setzero_si128(),
4846 __U);
4947}
5048
51static __inline__ __m128i __DEFAULT_FN_ATTRS128
52_mm_mask_compress_epi8(__m128i __S, __mmask16 __U, __m128i __D)
53{
49static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
50_mm_mask_compress_epi8(__m128i __S, __mmask16 __U, __m128i __D) {
5451 return (__m128i) __builtin_ia32_compressqi128_mask ((__v16qi) __D,
5552 (__v16qi) __S,
5653 __U);
5754}
5855
59static __inline__ __m128i __DEFAULT_FN_ATTRS128
60_mm_maskz_compress_epi8(__mmask16 __U, __m128i __D)
61{
56static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
57_mm_maskz_compress_epi8(__mmask16 __U, __m128i __D) {
6258 return (__m128i) __builtin_ia32_compressqi128_mask ((__v16qi) __D,
6359 (__v16qi) _mm_setzero_si128(),
6460 __U);
......@@ -78,7 +74,7 @@ _mm_mask_compressstoreu_epi8(void *__P, __mmask16 __U, __m128i __D)
7874 __U);
7975}
8076
81static __inline__ __m128i __DEFAULT_FN_ATTRS128
77static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
8278_mm_mask_expand_epi16(__m128i __S, __mmask8 __U, __m128i __D)
8379{
8480 return (__m128i) __builtin_ia32_expandhi128_mask ((__v8hi) __D,
......@@ -86,7 +82,7 @@ _mm_mask_expand_epi16(__m128i __S, __mmask8 __U, __m128i __D)
8682 __U);
8783}
8884
89static __inline__ __m128i __DEFAULT_FN_ATTRS128
85static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
9086_mm_maskz_expand_epi16(__mmask8 __U, __m128i __D)
9187{
9288 return (__m128i) __builtin_ia32_expandhi128_mask ((__v8hi) __D,
......@@ -94,7 +90,7 @@ _mm_maskz_expand_epi16(__mmask8 __U, __m128i __D)
9490 __U);
9591}
9692
97static __inline__ __m128i __DEFAULT_FN_ATTRS128
93static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
9894_mm_mask_expand_epi8(__m128i __S, __mmask16 __U, __m128i __D)
9995{
10096 return (__m128i) __builtin_ia32_expandqi128_mask ((__v16qi) __D,
......@@ -102,7 +98,7 @@ _mm_mask_expand_epi8(__m128i __S, __mmask16 __U, __m128i __D)
10298 __U);
10399}
104100
105static __inline__ __m128i __DEFAULT_FN_ATTRS128
101static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
106102_mm_maskz_expand_epi8(__mmask16 __U, __m128i __D)
107103{
108104 return (__m128i) __builtin_ia32_expandqi128_mask ((__v16qi) __D,
......@@ -142,33 +138,29 @@ _mm_maskz_expandloadu_epi8(__mmask16 __U, void const *__P)
142138 __U);
143139}
144140
145static __inline__ __m256i __DEFAULT_FN_ATTRS256
146_mm256_mask_compress_epi16(__m256i __S, __mmask16 __U, __m256i __D)
147{
141static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
142_mm256_mask_compress_epi16(__m256i __S, __mmask16 __U, __m256i __D) {
148143 return (__m256i) __builtin_ia32_compresshi256_mask ((__v16hi) __D,
149144 (__v16hi) __S,
150145 __U);
151146}
152147
153static __inline__ __m256i __DEFAULT_FN_ATTRS256
154_mm256_maskz_compress_epi16(__mmask16 __U, __m256i __D)
155{
148static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
149_mm256_maskz_compress_epi16(__mmask16 __U, __m256i __D) {
156150 return (__m256i) __builtin_ia32_compresshi256_mask ((__v16hi) __D,
157151 (__v16hi) _mm256_setzero_si256(),
158152 __U);
159153}
160154
161static __inline__ __m256i __DEFAULT_FN_ATTRS256
162_mm256_mask_compress_epi8(__m256i __S, __mmask32 __U, __m256i __D)
163{
155static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
156_mm256_mask_compress_epi8(__m256i __S, __mmask32 __U, __m256i __D) {
164157 return (__m256i) __builtin_ia32_compressqi256_mask ((__v32qi) __D,
165158 (__v32qi) __S,
166159 __U);
167160}
168161
169static __inline__ __m256i __DEFAULT_FN_ATTRS256
170_mm256_maskz_compress_epi8(__mmask32 __U, __m256i __D)
171{
162static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
163_mm256_maskz_compress_epi8(__mmask32 __U, __m256i __D) {
172164 return (__m256i) __builtin_ia32_compressqi256_mask ((__v32qi) __D,
173165 (__v32qi) _mm256_setzero_si256(),
174166 __U);
......@@ -188,7 +180,7 @@ _mm256_mask_compressstoreu_epi8(void *__P, __mmask32 __U, __m256i __D)
188180 __U);
189181}
190182
191static __inline__ __m256i __DEFAULT_FN_ATTRS256
183static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
192184_mm256_mask_expand_epi16(__m256i __S, __mmask16 __U, __m256i __D)
193185{
194186 return (__m256i) __builtin_ia32_expandhi256_mask ((__v16hi) __D,
......@@ -196,7 +188,7 @@ _mm256_mask_expand_epi16(__m256i __S, __mmask16 __U, __m256i __D)
196188 __U);
197189}
198190
199static __inline__ __m256i __DEFAULT_FN_ATTRS256
191static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
200192_mm256_maskz_expand_epi16(__mmask16 __U, __m256i __D)
201193{
202194 return (__m256i) __builtin_ia32_expandhi256_mask ((__v16hi) __D,
......@@ -204,7 +196,7 @@ _mm256_maskz_expand_epi16(__mmask16 __U, __m256i __D)
204196 __U);
205197}
206198
207static __inline__ __m256i __DEFAULT_FN_ATTRS256
199static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
208200_mm256_mask_expand_epi8(__m256i __S, __mmask32 __U, __m256i __D)
209201{
210202 return (__m256i) __builtin_ia32_expandqi256_mask ((__v32qi) __D,
......@@ -212,7 +204,7 @@ _mm256_mask_expand_epi8(__m256i __S, __mmask32 __U, __m256i __D)
212204 __U);
213205}
214206
215static __inline__ __m256i __DEFAULT_FN_ATTRS256
207static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
216208_mm256_maskz_expand_epi8(__mmask32 __U, __m256i __D)
217209{
218210 return (__m256i) __builtin_ia32_expandqi256_mask ((__v32qi) __D,
lib/include/avx512vlvnniintrin.h+29-34
......@@ -15,6 +15,16 @@
1515#define __AVX512VLVNNIINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
19#define __DEFAULT_FN_ATTRS128 \
20 __attribute__((__always_inline__, __nodebug__, \
21 __target__("avx512vl,avx512vnni"), \
22 __min_vector_width__(128))) constexpr
23#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, \
25 __target__("avx512vl,avx512vnni"), \
26 __min_vector_width__(256))) constexpr
27#else
1828#define __DEFAULT_FN_ATTRS128 \
1929 __attribute__((__always_inline__, __nodebug__, \
2030 __target__("avx512vl,avx512vnni"), \
......@@ -23,6 +33,7 @@
2333 __attribute__((__always_inline__, __nodebug__, \
2434 __target__("avx512vl,avx512vnni"), \
2535 __min_vector_width__(256)))
36#endif
2637
2738/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a A with
2839/// corresponding signed 8-bit integers in \a B, producing 4 intermediate signed
......@@ -180,128 +191,112 @@
180191 ((__m128i)__builtin_ia32_vpdpwssds128((__v4si)(S), (__v8hi)(A), (__v8hi)(B)))
181192
182193static __inline__ __m256i __DEFAULT_FN_ATTRS256
183_mm256_mask_dpbusd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
184{
194_mm256_mask_dpbusd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
185195 return (__m256i)__builtin_ia32_selectd_256(__U,
186196 (__v8si)_mm256_dpbusd_epi32(__S, __A, __B),
187197 (__v8si)__S);
188198}
189199
190200static __inline__ __m256i __DEFAULT_FN_ATTRS256
191_mm256_maskz_dpbusd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
192{
201_mm256_maskz_dpbusd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
193202 return (__m256i)__builtin_ia32_selectd_256(__U,
194203 (__v8si)_mm256_dpbusd_epi32(__S, __A, __B),
195204 (__v8si)_mm256_setzero_si256());
196205}
197206
198207static __inline__ __m256i __DEFAULT_FN_ATTRS256
199_mm256_mask_dpbusds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
200{
208_mm256_mask_dpbusds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
201209 return (__m256i)__builtin_ia32_selectd_256(__U,
202210 (__v8si)_mm256_dpbusds_epi32(__S, __A, __B),
203211 (__v8si)__S);
204212}
205213
206static __inline__ __m256i __DEFAULT_FN_ATTRS256
207_mm256_maskz_dpbusds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
208{
214static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_dpbusds_epi32(
215 __mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
209216 return (__m256i)__builtin_ia32_selectd_256(__U,
210217 (__v8si)_mm256_dpbusds_epi32(__S, __A, __B),
211218 (__v8si)_mm256_setzero_si256());
212219}
213220
214221static __inline__ __m256i __DEFAULT_FN_ATTRS256
215_mm256_mask_dpwssd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
216{
222_mm256_mask_dpwssd_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
217223 return (__m256i)__builtin_ia32_selectd_256(__U,
218224 (__v8si)_mm256_dpwssd_epi32(__S, __A, __B),
219225 (__v8si)__S);
220226}
221227
222228static __inline__ __m256i __DEFAULT_FN_ATTRS256
223_mm256_maskz_dpwssd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
224{
229_mm256_maskz_dpwssd_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
225230 return (__m256i)__builtin_ia32_selectd_256(__U,
226231 (__v8si)_mm256_dpwssd_epi32(__S, __A, __B),
227232 (__v8si)_mm256_setzero_si256());
228233}
229234
230235static __inline__ __m256i __DEFAULT_FN_ATTRS256
231_mm256_mask_dpwssds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B)
232{
236_mm256_mask_dpwssds_epi32(__m256i __S, __mmask8 __U, __m256i __A, __m256i __B) {
233237 return (__m256i)__builtin_ia32_selectd_256(__U,
234238 (__v8si)_mm256_dpwssds_epi32(__S, __A, __B),
235239 (__v8si)__S);
236240}
237241
238static __inline__ __m256i __DEFAULT_FN_ATTRS256
239_mm256_maskz_dpwssds_epi32(__mmask8 __U, __m256i __S, __m256i __A, __m256i __B)
240{
242static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_dpwssds_epi32(
243 __mmask8 __U, __m256i __S, __m256i __A, __m256i __B) {
241244 return (__m256i)__builtin_ia32_selectd_256(__U,
242245 (__v8si)_mm256_dpwssds_epi32(__S, __A, __B),
243246 (__v8si)_mm256_setzero_si256());
244247}
245248
246249static __inline__ __m128i __DEFAULT_FN_ATTRS128
247_mm_mask_dpbusd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
248{
250_mm_mask_dpbusd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
249251 return (__m128i)__builtin_ia32_selectd_128(__U,
250252 (__v4si)_mm_dpbusd_epi32(__S, __A, __B),
251253 (__v4si)__S);
252254}
253255
254256static __inline__ __m128i __DEFAULT_FN_ATTRS128
255_mm_maskz_dpbusd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
256{
257_mm_maskz_dpbusd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
257258 return (__m128i)__builtin_ia32_selectd_128(__U,
258259 (__v4si)_mm_dpbusd_epi32(__S, __A, __B),
259260 (__v4si)_mm_setzero_si128());
260261}
261262
262263static __inline__ __m128i __DEFAULT_FN_ATTRS128
263_mm_mask_dpbusds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
264{
264_mm_mask_dpbusds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
265265 return (__m128i)__builtin_ia32_selectd_128(__U,
266266 (__v4si)_mm_dpbusds_epi32(__S, __A, __B),
267267 (__v4si)__S);
268268}
269269
270270static __inline__ __m128i __DEFAULT_FN_ATTRS128
271_mm_maskz_dpbusds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
272{
271_mm_maskz_dpbusds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
273272 return (__m128i)__builtin_ia32_selectd_128(__U,
274273 (__v4si)_mm_dpbusds_epi32(__S, __A, __B),
275274 (__v4si)_mm_setzero_si128());
276275}
277276
278277static __inline__ __m128i __DEFAULT_FN_ATTRS128
279_mm_mask_dpwssd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
280{
278_mm_mask_dpwssd_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
281279 return (__m128i)__builtin_ia32_selectd_128(__U,
282280 (__v4si)_mm_dpwssd_epi32(__S, __A, __B),
283281 (__v4si)__S);
284282}
285283
286284static __inline__ __m128i __DEFAULT_FN_ATTRS128
287_mm_maskz_dpwssd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
288{
285_mm_maskz_dpwssd_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
289286 return (__m128i)__builtin_ia32_selectd_128(__U,
290287 (__v4si)_mm_dpwssd_epi32(__S, __A, __B),
291288 (__v4si)_mm_setzero_si128());
292289}
293290
294291static __inline__ __m128i __DEFAULT_FN_ATTRS128
295_mm_mask_dpwssds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B)
296{
292_mm_mask_dpwssds_epi32(__m128i __S, __mmask8 __U, __m128i __A, __m128i __B) {
297293 return (__m128i)__builtin_ia32_selectd_128(__U,
298294 (__v4si)_mm_dpwssds_epi32(__S, __A, __B),
299295 (__v4si)__S);
300296}
301297
302298static __inline__ __m128i __DEFAULT_FN_ATTRS128
303_mm_maskz_dpwssds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B)
304{
299_mm_maskz_dpwssds_epi32(__mmask8 __U, __m128i __S, __m128i __A, __m128i __B) {
305300 return (__m128i)__builtin_ia32_selectd_128(__U,
306301 (__v4si)_mm_dpwssds_epi32(__S, __A, __B),
307302 (__v4si)_mm_setzero_si128());
lib/include/avx512vnniintrin.h+32-35
......@@ -15,102 +15,99 @@
1515#define __AVX512VNNIINTRIN_H
1616
1717/* Define the default attributes for the functions in this file. */
18#if defined(__cplusplus) && (__cplusplus >= 201103L)
19#define __DEFAULT_FN_ATTRS \
20 __attribute__((__always_inline__, __nodebug__, __target__("avx512vnni"), \
21 __min_vector_width__(512))) constexpr
22#else
1823#define __DEFAULT_FN_ATTRS \
1924 __attribute__((__always_inline__, __nodebug__, __target__("avx512vnni"), \
2025 __min_vector_width__(512)))
26#endif
2127
22static __inline__ __m512i __DEFAULT_FN_ATTRS
23_mm512_dpbusd_epi32(__m512i __S, __m512i __A, __m512i __B)
24{
28static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbusd_epi32(__m512i __S,
29 __m512i __A,
30 __m512i __B) {
2531 return (__m512i)__builtin_ia32_vpdpbusd512((__v16si)__S, (__v64qu)__A,
2632 (__v64qi)__B);
2733}
2834
2935static __inline__ __m512i __DEFAULT_FN_ATTRS
30_mm512_mask_dpbusd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
31{
36_mm512_mask_dpbusd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
3237 return (__m512i)__builtin_ia32_selectd_512(__U,
3338 (__v16si)_mm512_dpbusd_epi32(__S, __A, __B),
3439 (__v16si)__S);
3540}
3641
37static __inline__ __m512i __DEFAULT_FN_ATTRS
38_mm512_maskz_dpbusd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
39{
42static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbusd_epi32(
43 __mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
4044 return (__m512i)__builtin_ia32_selectd_512(__U,
4145 (__v16si)_mm512_dpbusd_epi32(__S, __A, __B),
4246 (__v16si)_mm512_setzero_si512());
4347}
4448
45static __inline__ __m512i __DEFAULT_FN_ATTRS
46_mm512_dpbusds_epi32(__m512i __S, __m512i __A, __m512i __B)
47{
49static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpbusds_epi32(__m512i __S,
50 __m512i __A,
51 __m512i __B) {
4852 return (__m512i)__builtin_ia32_vpdpbusds512((__v16si)__S, (__v64qu)__A,
4953 (__v64qi)__B);
5054}
5155
52static __inline__ __m512i __DEFAULT_FN_ATTRS
53_mm512_mask_dpbusds_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
54{
56static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpbusds_epi32(
57 __m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
5558 return (__m512i)__builtin_ia32_selectd_512(__U,
5659 (__v16si)_mm512_dpbusds_epi32(__S, __A, __B),
5760 (__v16si)__S);
5861}
5962
60static __inline__ __m512i __DEFAULT_FN_ATTRS
61_mm512_maskz_dpbusds_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
62{
63static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpbusds_epi32(
64 __mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
6365 return (__m512i)__builtin_ia32_selectd_512(__U,
6466 (__v16si)_mm512_dpbusds_epi32(__S, __A, __B),
6567 (__v16si)_mm512_setzero_si512());
6668}
6769
68static __inline__ __m512i __DEFAULT_FN_ATTRS
69_mm512_dpwssd_epi32(__m512i __S, __m512i __A, __m512i __B)
70{
70static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwssd_epi32(__m512i __S,
71 __m512i __A,
72 __m512i __B) {
7173 return (__m512i)__builtin_ia32_vpdpwssd512((__v16si)__S, (__v32hi)__A,
7274 (__v32hi)__B);
7375}
7476
7577static __inline__ __m512i __DEFAULT_FN_ATTRS
76_mm512_mask_dpwssd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
77{
78_mm512_mask_dpwssd_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
7879 return (__m512i)__builtin_ia32_selectd_512(__U,
7980 (__v16si)_mm512_dpwssd_epi32(__S, __A, __B),
8081 (__v16si)__S);
8182}
8283
83static __inline__ __m512i __DEFAULT_FN_ATTRS
84_mm512_maskz_dpwssd_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
85{
84static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwssd_epi32(
85 __mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
8686 return (__m512i)__builtin_ia32_selectd_512(__U,
8787 (__v16si)_mm512_dpwssd_epi32(__S, __A, __B),
8888 (__v16si)_mm512_setzero_si512());
8989}
9090
91static __inline__ __m512i __DEFAULT_FN_ATTRS
92_mm512_dpwssds_epi32(__m512i __S, __m512i __A, __m512i __B)
93{
91static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_dpwssds_epi32(__m512i __S,
92 __m512i __A,
93 __m512i __B) {
9494 return (__m512i)__builtin_ia32_vpdpwssds512((__v16si)__S, (__v32hi)__A,
9595 (__v32hi)__B);
9696}
9797
98static __inline__ __m512i __DEFAULT_FN_ATTRS
99_mm512_mask_dpwssds_epi32(__m512i __S, __mmask16 __U, __m512i __A, __m512i __B)
100{
98static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_dpwssds_epi32(
99 __m512i __S, __mmask16 __U, __m512i __A, __m512i __B) {
101100 return (__m512i)__builtin_ia32_selectd_512(__U,
102101 (__v16si)_mm512_dpwssds_epi32(__S, __A, __B),
103102 (__v16si)__S);
104103}
105104
106static __inline__ __m512i __DEFAULT_FN_ATTRS
107_mm512_maskz_dpwssds_epi32(__mmask16 __U, __m512i __S, __m512i __A, __m512i __B)
108{
105static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_dpwssds_epi32(
106 __mmask16 __U, __m512i __S, __m512i __A, __m512i __B) {
109107 return (__m512i)__builtin_ia32_selectd_512(__U,
110108 (__v16si)_mm512_dpwssds_epi32(__S, __A, __B),
111109 (__v16si)_mm512_setzero_si512());
112110}
113111
114112#undef __DEFAULT_FN_ATTRS
115
116113#endif
lib/include/avx512vp2intersectintrin.h+1-1
......@@ -22,7 +22,7 @@
2222 *===-----------------------------------------------------------------------===
2323 */
2424#ifndef __IMMINTRIN_H
25#error "Never use <avx512vp2intersect.h> directly; include <immintrin.h> instead."
25#error "Never use <avx512vp2intersectintrin.h> directly; include <immintrin.h> instead."
2626#endif
2727
2828#ifndef _AVX512VP2INTERSECT_H
lib/include/avxvnniintrin.h+23-18
......@@ -40,8 +40,21 @@
4040
4141/* Intrinsics with _avx_ prefix are for compatibility with msvc. */
4242/* Define the default attributes for the functions in this file. */
43#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), __min_vector_width__(256)))
44#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), __min_vector_width__(128)))
43#if defined(__cplusplus) && (__cplusplus >= 201103L)
44#define __DEFAULT_FN_ATTRS256 \
45 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), \
46 __min_vector_width__(256))) constexpr
47#define __DEFAULT_FN_ATTRS128 \
48 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), \
49 __min_vector_width__(128))) constexpr
50#else
51#define __DEFAULT_FN_ATTRS256 \
52 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), \
53 __min_vector_width__(256)))
54#define __DEFAULT_FN_ATTRS128 \
55 __attribute__((__always_inline__, __nodebug__, __target__("avxvnni"), \
56 __min_vector_width__(128)))
57#endif
4558
4659/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in \a __A with
4760/// corresponding signed 8-bit integers in \a __B, producing 4 intermediate signed
......@@ -61,8 +74,7 @@
6174/// DST[MAX:256] := 0
6275/// \endcode
6376static __inline__ __m256i __DEFAULT_FN_ATTRS256
64_mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
65{
77_mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B) {
6678 return (__m256i)__builtin_ia32_vpdpbusd256((__v8si)__S, (__v32qu)__A,
6779 (__v32qi)__B);
6880}
......@@ -85,8 +97,7 @@ _mm256_dpbusd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
8597/// DST[MAX:256] := 0
8698/// \endcode
8799static __inline__ __m256i __DEFAULT_FN_ATTRS256
88_mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
89{
100_mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B) {
90101 return (__m256i)__builtin_ia32_vpdpbusds256((__v8si)__S, (__v32qu)__A,
91102 (__v32qi)__B);
92103}
......@@ -107,8 +118,7 @@ _mm256_dpbusds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
107118/// DST[MAX:256] := 0
108119/// \endcode
109120static __inline__ __m256i __DEFAULT_FN_ATTRS256
110_mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
111{
121_mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B) {
112122 return (__m256i)__builtin_ia32_vpdpwssd256((__v8si)__S, (__v16hi)__A,
113123 (__v16hi)__B);
114124}
......@@ -129,8 +139,7 @@ _mm256_dpwssd_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
129139/// DST[MAX:256] := 0
130140/// \endcode
131141static __inline__ __m256i __DEFAULT_FN_ATTRS256
132_mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
133{
142_mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B) {
134143 return (__m256i)__builtin_ia32_vpdpwssds256((__v8si)__S, (__v16hi)__A,
135144 (__v16hi)__B);
136145}
......@@ -153,8 +162,7 @@ _mm256_dpwssds_avx_epi32(__m256i __S, __m256i __A, __m256i __B)
153162/// DST[MAX:128] := 0
154163/// \endcode
155164static __inline__ __m128i __DEFAULT_FN_ATTRS128
156_mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
157{
165_mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B) {
158166 return (__m128i)__builtin_ia32_vpdpbusd128((__v4si)__S, (__v16qu)__A,
159167 (__v16qi)__B);
160168}
......@@ -177,8 +185,7 @@ _mm_dpbusd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
177185/// DST[MAX:128] := 0
178186/// \endcode
179187static __inline__ __m128i __DEFAULT_FN_ATTRS128
180_mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
181{
188_mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B) {
182189 return (__m128i)__builtin_ia32_vpdpbusds128((__v4si)__S, (__v16qu)__A,
183190 (__v16qi)__B);
184191}
......@@ -199,8 +206,7 @@ _mm_dpbusds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
199206/// DST[MAX:128] := 0
200207/// \endcode
201208static __inline__ __m128i __DEFAULT_FN_ATTRS128
202_mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
203{
209_mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B) {
204210 return (__m128i)__builtin_ia32_vpdpwssd128((__v4si)__S, (__v8hi)__A,
205211 (__v8hi)__B);
206212}
......@@ -221,8 +227,7 @@ _mm_dpwssd_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
221227/// DST[MAX:128] := 0
222228/// \endcode
223229static __inline__ __m128i __DEFAULT_FN_ATTRS128
224_mm_dpwssds_avx_epi32(__m128i __S, __m128i __A, __m128i __B)
225{
230_mm_dpwssds_avx_epi32(__m128i __S, __m128i __A, __m128i __B) {
226231 return (__m128i)__builtin_ia32_vpdpwssds128((__v4si)__S, (__v8hi)__A,
227232 (__v8hi)__B);
228233}
lib/include/crc32intrin.h+10-8
......@@ -10,8 +10,14 @@
1010#ifndef __CRC32INTRIN_H
1111#define __CRC32INTRIN_H
1212
13/// We only declare crc32 as a constexpr if we are compiling C++ code
14#if defined(__cplusplus) && (__cplusplus >= 201103L)
15#define __DEFAULT_FN_ATTRS \
16 __attribute__((__always_inline__, __nodebug__, __target__("crc32"))) constexpr
17#else
1318#define __DEFAULT_FN_ATTRS \
1419 __attribute__((__always_inline__, __nodebug__, __target__("crc32")))
20#endif
1521
1622/// Adds the unsigned integer operand to the CRC-32C checksum of the
1723/// unsigned char operand.
......@@ -28,8 +34,7 @@
2834/// \returns The result of adding operand \a __C to the CRC-32C checksum of
2935/// operand \a __D.
3036static __inline__ unsigned int __DEFAULT_FN_ATTRS
31_mm_crc32_u8(unsigned int __C, unsigned char __D)
32{
37_mm_crc32_u8(unsigned int __C, unsigned char __D) {
3338 return __builtin_ia32_crc32qi(__C, __D);
3439}
3540
......@@ -48,8 +53,7 @@ _mm_crc32_u8(unsigned int __C, unsigned char __D)
4853/// \returns The result of adding operand \a __C to the CRC-32C checksum of
4954/// operand \a __D.
5055static __inline__ unsigned int __DEFAULT_FN_ATTRS
51_mm_crc32_u16(unsigned int __C, unsigned short __D)
52{
56_mm_crc32_u16(unsigned int __C, unsigned short __D) {
5357 return __builtin_ia32_crc32hi(__C, __D);
5458}
5559
......@@ -68,8 +72,7 @@ _mm_crc32_u16(unsigned int __C, unsigned short __D)
6872/// \returns The result of adding operand \a __C to the CRC-32C checksum of
6973/// operand \a __D.
7074static __inline__ unsigned int __DEFAULT_FN_ATTRS
71_mm_crc32_u32(unsigned int __C, unsigned int __D)
72{
75_mm_crc32_u32(unsigned int __C, unsigned int __D) {
7376 return __builtin_ia32_crc32si(__C, __D);
7477}
7578
......@@ -89,8 +92,7 @@ _mm_crc32_u32(unsigned int __C, unsigned int __D)
8992/// \returns The result of adding operand \a __C to the CRC-32C checksum of
9093/// operand \a __D.
9194static __inline__ unsigned long long __DEFAULT_FN_ATTRS
92_mm_crc32_u64(unsigned long long __C, unsigned long long __D)
93{
95_mm_crc32_u64(unsigned long long __C, unsigned long long __D) {
9496 return __builtin_ia32_crc32di(__C, __D);
9597}
9698#endif /* __x86_64__ */
lib/include/emmintrin.h+8-8
......@@ -279,8 +279,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sqrt_pd(__m128d __a) {
279279/// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
280280/// minimum value between both operands. The upper 64 bits are copied from
281281/// the upper 64 bits of the first source operand.
282static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_min_sd(__m128d __a,
283 __m128d __b) {
282static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_sd(__m128d __a,
283 __m128d __b) {
284284 return __builtin_ia32_minsd((__v2df)__a, (__v2df)__b);
285285}
286286
......@@ -325,8 +325,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_pd(__m128d __a,
325325/// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the
326326/// maximum value between both operands. The upper 64 bits are copied from
327327/// the upper 64 bits of the first source operand.
328static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_max_sd(__m128d __a,
329 __m128d __b) {
328static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR _mm_max_sd(__m128d __a,
329 __m128d __b) {
330330 return __builtin_ia32_maxsd((__v2df)__a, (__v2df)__b);
331331}
332332
......@@ -1343,7 +1343,7 @@ _mm_cvtepi32_pd(__m128i __a) {
13431343/// \returns A 128-bit vector of [4 x i32] whose lower 64 bits contain the
13441344/// converted values. The upper 64 bits are set to zero.
13451345static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cvtpd_epi32(__m128d __a) {
1346 return __builtin_ia32_cvtpd2dq((__v2df)__a);
1346 return (__m128i)__builtin_ia32_cvtpd2dq((__v2df)__a);
13471347}
13481348
13491349/// Converts the low-order element of a 128-bit vector of [2 x double]
......@@ -2481,9 +2481,9 @@ _mm_mul_epu32(__m128i __a, __m128i __b) {
24812481/// A 128-bit integer vector containing one of the source operands.
24822482/// \returns A [2 x i64] vector containing the sums of the sets of absolute
24832483/// differences between both operands.
2484static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sad_epu8(__m128i __a,
2485 __m128i __b) {
2486 return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b);
2484static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
2485_mm_sad_epu8(__m128i __a, __m128i __b) {
2486 return __builtin_ia32_psadbw128((__v16qu)__a, (__v16qu)__b);
24872487}
24882488
24892489/// Subtracts the corresponding 8-bit integer values in the operands.
lib/include/endian.h created+91
......@@ -0,0 +1,91 @@
1//===-- Definition of macros from endian.h --------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef __CLANG_ENDIAN_H
10#define __CLANG_ENDIAN_H
11
12// If the system has an endian.h, let's use that instead.
13#if __has_include_next(<endian.h>)
14#include_next <endian.h>
15#else
16
17#include <stdint.h>
18
19// Implementation taken from llvm libc endian-macros.h.
20#ifdef __cplusplus
21#define __CLANG_ENDIAN_CAST(cast, type, value) (cast<type>(value))
22#else
23#define __CLANG_ENDIAN_CAST(cast, type, value) ((type)(value))
24#endif
25
26#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
27#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
28#define PDP_ENDIAN __ORDER_PDP_ENDIAN__
29#define BYTE_ORDER __BYTE_ORDER__
30
31// Define some compatibility macros if they are not defined.
32#ifndef __BYTE_ORDER
33#define __BYTE_ORDER BYTE_ORDER
34#endif
35#ifndef __LITTLE_ENDIAN
36#define __LITTLE_ENDIAN LITTLE_ENDIAN
37#endif
38#ifndef __BIG_ENDIAN
39#define __BIG_ENDIAN BIG_ENDIAN
40#endif
41#ifndef __PDP_ENDIAN
42#define __PDP_ENDIAN PDP_ENDIAN
43#endif
44
45#if BYTE_ORDER == LITTLE_ENDIAN
46
47#define htobe16(x) \
48 __builtin_bswap16(__CLANG_ENDIAN_CAST(static_cast, uint16_t, x))
49#define htobe32(x) \
50 __builtin_bswap32(__CLANG_ENDIAN_CAST(static_cast, uint32_t, x))
51#define htobe64(x) \
52 __builtin_bswap64(__CLANG_ENDIAN_CAST(static_cast, uint64_t, x))
53#define htole16(x) __CLANG_ENDIAN_CAST(static_cast, uint16_t, x)
54#define htole32(x) __CLANG_ENDIAN_CAST(static_cast, uint32_t, x)
55#define htole64(x) __CLANG_ENDIAN_CAST(static_cast, uint64_t, x)
56#define be16toh(x) \
57 __builtin_bswap16(__CLANG_ENDIAN_CAST(static_cast, uint16_t, x))
58#define be32toh(x) \
59 __builtin_bswap32(__CLANG_ENDIAN_CAST(static_cast, uint32_t, x))
60#define be64toh(x) \
61 __builtin_bswap64(__CLANG_ENDIAN_CAST(static_cast, uint64_t, x))
62#define le16toh(x) __CLANG_ENDIAN_CAST(static_cast, uint16_t, x)
63#define le32toh(x) __CLANG_ENDIAN_CAST(static_cast, uint32_t, x)
64#define le64toh(x) __CLANG_ENDIAN_CAST(static_cast, uint64_t, x)
65
66#elif BYTE_ORDER == BIG_ENDIAN
67
68#define htobe16(x) __CLANG_ENDIAN_CAST(static_cast, uint16_t, x)
69#define htobe32(x) __CLANG_ENDIAN_CAST(static_cast, uint32_t, x)
70#define htobe64(x) __CLANG_ENDIAN_CAST(static_cast, uint64_t, x)
71#define htole16(x) \
72 __builtin_bswap16(__CLANG_ENDIAN_CAST(static_cast, uint16_t, x))
73#define htole32(x) \
74 __builtin_bswap32(__CLANG_ENDIAN_CAST(static_cast, uint32_t, x))
75#define htole64(x) \
76 __builtin_bswap64(__CLANG_ENDIAN_CAST(static_cast, uint64_t, x))
77#define be16toh(x) __CLANG_ENDIAN_CAST(static_cast, uint16_t, x)
78#define be32toh(x) __CLANG_ENDIAN_CAST(static_cast, uint32_t, x)
79#define be64toh(x) __CLANG_ENDIAN_CAST(static_cast, uint64_t, x)
80#define le16toh(x) \
81 __builtin_bswap16(__CLANG_ENDIAN_CAST(static_cast, uint16_t, x))
82#define le32toh(x) \
83 __builtin_bswap32(__CLANG_ENDIAN_CAST(static_cast, uint32_t, x))
84#define le64toh(x) \
85 __builtin_bswap64(__CLANG_ENDIAN_CAST(static_cast, uint64_t, x))
86
87#else
88#error "Unsupported endianness"
89#endif
90#endif // __has_include_next
91#endif // __CLANG_ENDIAN_H
lib/include/hvx_hexagon_protos.h+102-80
......@@ -4577,8 +4577,9 @@
45774577#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
45784578/* ==========================================================================
45794579 Assembly Syntax: Vdd32.sf=vadd(Vu32.bf,Vv32.bf)
4580 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vadd_VbfVbf(HVX_Vector Vu,
4581 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4580 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vadd_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4581 Instruction Type: CVI_VX_DV
4582 Execution Slots: SLOT23
45824583 ========================================================================== */
45834584
45844585#define Q6_Wsf_vadd_VbfVbf(Vu, Vv) \
......@@ -4636,8 +4637,9 @@
46364637#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
46374638/* ==========================================================================
46384639 Assembly Syntax: Vd32.bf=vcvt(Vu32.sf,Vv32.sf)
4639 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vcvt_VsfVsf(HVX_Vector Vu,
4640 HVX_Vector Vv) Instruction Type: CVI_VX Execution Slots: SLOT23
4640 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vcvt_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
4641 Instruction Type: CVI_VX
4642 Execution Slots: SLOT23
46414643 ========================================================================== */
46424644
46434645#define Q6_Vbf_vcvt_VsfVsf(Vu, Vv) \
......@@ -4647,8 +4649,9 @@
46474649#if __HVX_ARCH__ >= 73
46484650/* ==========================================================================
46494651 Assembly Syntax: Qd4=vcmp.gt(Vu32.bf,Vv32.bf)
4650 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VbfVbf(HVX_Vector Vu,
4651 HVX_Vector Vv) Instruction Type: CVI_VA Execution Slots: SLOT0123
4652 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gt_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4653 Instruction Type: CVI_VA
4654 Execution Slots: SLOT0123
46524655 ========================================================================== */
46534656
46544657#define Q6_Q_vcmp_gt_VbfVbf(Vu, Vv) \
......@@ -4659,9 +4662,9 @@
46594662#if __HVX_ARCH__ >= 73
46604663/* ==========================================================================
46614664 Assembly Syntax: Qx4&=vcmp.gt(Vu32.bf,Vv32.bf)
4662 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVbfVbf(HVX_VectorPred
4663 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
4664 Slots: SLOT0123
4665 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtand_QVbfVbf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
4666 Instruction Type: CVI_VA
4667 Execution Slots: SLOT0123
46654668 ========================================================================== */
46664669
46674670#define Q6_Q_vcmp_gtand_QVbfVbf(Qx, Vu, Vv) \
......@@ -4675,9 +4678,9 @@
46754678#if __HVX_ARCH__ >= 73
46764679/* ==========================================================================
46774680 Assembly Syntax: Qx4|=vcmp.gt(Vu32.bf,Vv32.bf)
4678 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVbfVbf(HVX_VectorPred
4679 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
4680 Slots: SLOT0123
4681 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtor_QVbfVbf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
4682 Instruction Type: CVI_VA
4683 Execution Slots: SLOT0123
46814684 ========================================================================== */
46824685
46834686#define Q6_Q_vcmp_gtor_QVbfVbf(Qx, Vu, Vv) \
......@@ -4691,9 +4694,9 @@
46914694#if __HVX_ARCH__ >= 73
46924695/* ==========================================================================
46934696 Assembly Syntax: Qx4^=vcmp.gt(Vu32.bf,Vv32.bf)
4694 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVbfVbf(HVX_VectorPred
4695 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
4696 Slots: SLOT0123
4697 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_gtxacc_QVbfVbf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
4698 Instruction Type: CVI_VA
4699 Execution Slots: SLOT0123
46974700 ========================================================================== */
46984701
46994702#define Q6_Q_vcmp_gtxacc_QVbfVbf(Qx, Vu, Vv) \
......@@ -4707,8 +4710,9 @@
47074710#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
47084711/* ==========================================================================
47094712 Assembly Syntax: Vd32.bf=vmax(Vu32.bf,Vv32.bf)
4710 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmax_VbfVbf(HVX_Vector Vu,
4711 HVX_Vector Vv) Instruction Type: CVI_VX_LATE Execution Slots: SLOT23
4713 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmax_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4714 Instruction Type: CVI_VX_LATE
4715 Execution Slots: SLOT23
47124716 ========================================================================== */
47134717
47144718#define Q6_Vbf_vmax_VbfVbf(Vu, Vv) \
......@@ -4718,8 +4722,9 @@
47184722#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
47194723/* ==========================================================================
47204724 Assembly Syntax: Vd32.bf=vmin(Vu32.bf,Vv32.bf)
4721 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmin_VbfVbf(HVX_Vector Vu,
4722 HVX_Vector Vv) Instruction Type: CVI_VX_LATE Execution Slots: SLOT23
4725 C Intrinsic Prototype: HVX_Vector Q6_Vbf_vmin_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4726 Instruction Type: CVI_VX_LATE
4727 Execution Slots: SLOT23
47234728 ========================================================================== */
47244729
47254730#define Q6_Vbf_vmin_VbfVbf(Vu, Vv) \
......@@ -4729,8 +4734,9 @@
47294734#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
47304735/* ==========================================================================
47314736 Assembly Syntax: Vdd32.sf=vmpy(Vu32.bf,Vv32.bf)
4732 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpy_VbfVbf(HVX_Vector Vu,
4733 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4737 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpy_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4738 Instruction Type: CVI_VX_DV
4739 Execution Slots: SLOT23
47344740 ========================================================================== */
47354741
47364742#define Q6_Wsf_vmpy_VbfVbf(Vu, Vv) \
......@@ -4740,9 +4746,9 @@
47404746#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
47414747/* ==========================================================================
47424748 Assembly Syntax: Vxx32.sf+=vmpy(Vu32.bf,Vv32.bf)
4743 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpyacc_WsfVbfVbf(HVX_VectorPair
4744 Vxx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution
4745 Slots: SLOT23
4749 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vmpyacc_WsfVbfVbf(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
4750 Instruction Type: CVI_VX_DV
4751 Execution Slots: SLOT23
47464752 ========================================================================== */
47474753
47484754#define Q6_Wsf_vmpyacc_WsfVbfVbf(Vxx, Vu, Vv) \
......@@ -4752,8 +4758,9 @@
47524758#if __HVX_ARCH__ >= 73 && defined __HVX_IEEE_FP__
47534759/* ==========================================================================
47544760 Assembly Syntax: Vdd32.sf=vsub(Vu32.bf,Vv32.bf)
4755 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vsub_VbfVbf(HVX_Vector Vu,
4756 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4761 C Intrinsic Prototype: HVX_VectorPair Q6_Wsf_vsub_VbfVbf(HVX_Vector Vu, HVX_Vector Vv)
4762 Instruction Type: CVI_VX_DV
4763 Execution Slots: SLOT23
47574764 ========================================================================== */
47584765
47594766#define Q6_Wsf_vsub_VbfVbf(Vu, Vv) \
......@@ -4775,9 +4782,9 @@
47754782#if __HVX_ARCH__ >= 79
47764783/* ==========================================================================
47774784 Assembly Syntax: Vx32|=vgetqfext(Vu32.x,Rt32)
4778 C Intrinsic Prototype: HVX_Vector Q6_V_vgetqfextor_VVR(HVX_Vector Vx,
4779 HVX_Vector Vu, Word32 Rt) Instruction Type: CVI_VX Execution Slots:
4780 SLOT23
4785 C Intrinsic Prototype: HVX_Vector Q6_V_vgetqfextor_VVR(HVX_Vector Vx, HVX_Vector Vu, Word32 Rt)
4786 Instruction Type: CVI_VX
4787 Execution Slots: SLOT23
47814788 ========================================================================== */
47824789
47834790#define Q6_V_vgetqfextor_VVR(Vx, Vu, Rt) \
......@@ -4810,8 +4817,9 @@
48104817#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
48114818/* ==========================================================================
48124819 Assembly Syntax: Vdd32.hf=vadd(Vu32.f8,Vv32.f8)
4813 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vadd_VV(HVX_Vector Vu,
4814 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4820 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vadd_VV(HVX_Vector Vu, HVX_Vector Vv)
4821 Instruction Type: CVI_VX_DV
4822 Execution Slots: SLOT23
48154823 ========================================================================== */
48164824
48174825#define Q6_Whf_vadd_VV(Vu, Vv) \
......@@ -4821,8 +4829,9 @@
48214829#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
48224830/* ==========================================================================
48234831 Assembly Syntax: Vd32.b=vcvt2(Vu32.hf,Vv32.hf)
4824 C Intrinsic Prototype: HVX_Vector Q6_Vb_vcvt2_VhfVhf(HVX_Vector Vu,
4825 HVX_Vector Vv) Instruction Type: CVI_VX Execution Slots: SLOT23
4832 C Intrinsic Prototype: HVX_Vector Q6_Vb_vcvt2_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
4833 Instruction Type: CVI_VX
4834 Execution Slots: SLOT23
48264835 ========================================================================== */
48274836
48284837#define Q6_Vb_vcvt2_VhfVhf(Vu, Vv) \
......@@ -4856,8 +4865,9 @@
48564865#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
48574866/* ==========================================================================
48584867 Assembly Syntax: Vd32.ub=vcvt2(Vu32.hf,Vv32.hf)
4859 C Intrinsic Prototype: HVX_Vector Q6_Vub_vcvt2_VhfVhf(HVX_Vector Vu,
4860 HVX_Vector Vv) Instruction Type: CVI_VX Execution Slots: SLOT23
4868 C Intrinsic Prototype: HVX_Vector Q6_Vub_vcvt2_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
4869 Instruction Type: CVI_VX
4870 Execution Slots: SLOT23
48614871 ========================================================================== */
48624872
48634873#define Q6_Vub_vcvt2_VhfVhf(Vu, Vv) \
......@@ -4867,8 +4877,9 @@
48674877#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
48684878/* ==========================================================================
48694879 Assembly Syntax: Vd32.f8=vcvt(Vu32.hf,Vv32.hf)
4870 C Intrinsic Prototype: HVX_Vector Q6_V_vcvt_VhfVhf(HVX_Vector Vu, HVX_Vector
4871 Vv) Instruction Type: CVI_VX Execution Slots: SLOT23
4880 C Intrinsic Prototype: HVX_Vector Q6_V_vcvt_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
4881 Instruction Type: CVI_VX
4882 Execution Slots: SLOT23
48724883 ========================================================================== */
48734884
48744885#define Q6_V_vcvt_VhfVhf(Vu, Vv) \
......@@ -4926,8 +4937,9 @@
49264937#if __HVX_ARCH__ >= 79
49274938/* ==========================================================================
49284939 Assembly Syntax: Vd32=vmerge(Vu32.x,Vv32.w)
4929 C Intrinsic Prototype: HVX_Vector Q6_V_vmerge_VVw(HVX_Vector Vu, HVX_Vector
4930 Vv) Instruction Type: CVI_VS Execution Slots: SLOT0123
4940 C Intrinsic Prototype: HVX_Vector Q6_V_vmerge_VVw(HVX_Vector Vu, HVX_Vector Vv)
4941 Instruction Type: CVI_VS
4942 Execution Slots: SLOT0123
49314943 ========================================================================== */
49324944
49334945#define Q6_V_vmerge_VVw(Vu, Vv) \
......@@ -4937,8 +4949,9 @@
49374949#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
49384950/* ==========================================================================
49394951 Assembly Syntax: Vdd32.hf=vmpy(Vu32.f8,Vv32.f8)
4940 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpy_VV(HVX_Vector Vu,
4941 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4952 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpy_VV(HVX_Vector Vu, HVX_Vector Vv)
4953 Instruction Type: CVI_VX_DV
4954 Execution Slots: SLOT23
49424955 ========================================================================== */
49434956
49444957#define Q6_Whf_vmpy_VV(Vu, Vv) \
......@@ -4948,9 +4961,9 @@
49484961#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
49494962/* ==========================================================================
49504963 Assembly Syntax: Vxx32.hf+=vmpy(Vu32.f8,Vv32.f8)
4951 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpyacc_WhfVV(HVX_VectorPair
4952 Vxx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution
4953 Slots: SLOT23
4964 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vmpyacc_WhfVV(HVX_VectorPair Vxx, HVX_Vector Vu, HVX_Vector Vv)
4965 Instruction Type: CVI_VX_DV
4966 Execution Slots: SLOT23
49544967 ========================================================================== */
49554968
49564969#define Q6_Whf_vmpyacc_WhfVV(Vxx, Vu, Vv) \
......@@ -4960,8 +4973,9 @@
49604973#if __HVX_ARCH__ >= 79
49614974/* ==========================================================================
49624975 Assembly Syntax: Vd32.qf16=vmpy(Vu32.hf,Rt32.hf)
4963 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vmpy_VhfRhf(HVX_Vector Vu, Word32
4964 Rt) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4976 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vmpy_VhfRhf(HVX_Vector Vu, Word32 Rt)
4977 Instruction Type: CVI_VX_DV
4978 Execution Slots: SLOT23
49654979 ========================================================================== */
49664980
49674981#define Q6_Vqf16_vmpy_VhfRhf(Vu, Rt) \
......@@ -4971,8 +4985,9 @@
49714985#if __HVX_ARCH__ >= 79
49724986/* ==========================================================================
49734987 Assembly Syntax: Vd32.qf16=vmpy(Vu32.qf16,Rt32.hf)
4974 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vmpy_Vqf16Rhf(HVX_Vector Vu,
4975 Word32 Rt) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
4988 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vmpy_Vqf16Rhf(HVX_Vector Vu, Word32 Rt)
4989 Instruction Type: CVI_VX_DV
4990 Execution Slots: SLOT23
49764991 ========================================================================== */
49774992
49784993#define Q6_Vqf16_vmpy_Vqf16Rhf(Vu, Rt) \
......@@ -4982,8 +4997,9 @@
49824997#if __HVX_ARCH__ >= 79
49834998/* ==========================================================================
49844999 Assembly Syntax: Vd32.qf32=vmpy(Vu32.sf,Rt32.sf)
4985 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vmpy_VsfRsf(HVX_Vector Vu, Word32
4986 Rt) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
5000 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vmpy_VsfRsf(HVX_Vector Vu, Word32 Rt)
5001 Instruction Type: CVI_VX_DV
5002 Execution Slots: SLOT23
49875003 ========================================================================== */
49885004
49895005#define Q6_Vqf32_vmpy_VsfRsf(Vu, Rt) \
......@@ -4993,8 +5009,9 @@
49935009#if __HVX_ARCH__ >= 79 && defined __HVX_IEEE_FP__
49945010/* ==========================================================================
49955011 Assembly Syntax: Vdd32.hf=vsub(Vu32.f8,Vv32.f8)
4996 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vsub_VV(HVX_Vector Vu,
4997 HVX_Vector Vv) Instruction Type: CVI_VX_DV Execution Slots: SLOT23
5012 C Intrinsic Prototype: HVX_VectorPair Q6_Whf_vsub_VV(HVX_Vector Vu, HVX_Vector Vv)
5013 Instruction Type: CVI_VX_DV
5014 Execution Slots: SLOT23
49985015 ========================================================================== */
49995016
50005017#define Q6_Whf_vsub_VV(Vu, Vv) \
......@@ -5052,8 +5069,9 @@
50525069#if __HVX_ARCH__ >= 81
50535070/* ==========================================================================
50545071 Assembly Syntax: Vd32=valign4(Vu32,Vv32,Rt8)
5055 C Intrinsic Prototype: HVX_Vector Q6_V_valign4_VVR(HVX_Vector Vu, HVX_Vector
5056 Vv, Word32 Rt) Instruction Type: CVI_VA Execution Slots: SLOT0123
5072 C Intrinsic Prototype: HVX_Vector Q6_V_valign4_VVR(HVX_Vector Vu, HVX_Vector Vv, Word32 Rt)
5073 Instruction Type: CVI_VA
5074 Execution Slots: SLOT0123
50575075 ========================================================================== */
50585076
50595077#define Q6_V_valign4_VVR(Vu, Vv, Rt) \
......@@ -5159,8 +5177,9 @@
51595177#if __HVX_ARCH__ >= 81
51605178/* ==========================================================================
51615179 Assembly Syntax: Qd4=vcmp.eq(Vu32.hf,Vv32.hf)
5162 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VhfVhf(HVX_Vector Vu,
5163 HVX_Vector Vv) Instruction Type: CVI_VA Execution Slots: SLOT0123
5180 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VhfVhf(HVX_Vector Vu, HVX_Vector Vv)
5181 Instruction Type: CVI_VA
5182 Execution Slots: SLOT0123
51645183 ========================================================================== */
51655184
51665185#define Q6_Q_vcmp_eq_VhfVhf(Vu, Vv) \
......@@ -5171,9 +5190,9 @@
51715190#if __HVX_ARCH__ >= 81
51725191/* ==========================================================================
51735192 Assembly Syntax: Qx4&=vcmp.eq(Vu32.hf,Vv32.hf)
5174 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVhfVhf(HVX_VectorPred
5175 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5176 Slots: SLOT0123
5193 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVhfVhf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5194 Instruction Type: CVI_VA
5195 Execution Slots: SLOT0123
51775196 ========================================================================== */
51785197
51795198#define Q6_Q_vcmp_eqand_QVhfVhf(Qx, Vu, Vv) \
......@@ -5187,9 +5206,9 @@
51875206#if __HVX_ARCH__ >= 81
51885207/* ==========================================================================
51895208 Assembly Syntax: Qx4|=vcmp.eq(Vu32.hf,Vv32.hf)
5190 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVhfVhf(HVX_VectorPred
5191 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5192 Slots: SLOT0123
5209 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVhfVhf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5210 Instruction Type: CVI_VA
5211 Execution Slots: SLOT0123
51935212 ========================================================================== */
51945213
51955214#define Q6_Q_vcmp_eqor_QVhfVhf(Qx, Vu, Vv) \
......@@ -5203,9 +5222,9 @@
52035222#if __HVX_ARCH__ >= 81
52045223/* ==========================================================================
52055224 Assembly Syntax: Qx4^=vcmp.eq(Vu32.hf,Vv32.hf)
5206 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVhfVhf(HVX_VectorPred
5207 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5208 Slots: SLOT0123
5225 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVhfVhf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5226 Instruction Type: CVI_VA
5227 Execution Slots: SLOT0123
52095228 ========================================================================== */
52105229
52115230#define Q6_Q_vcmp_eqxacc_QVhfVhf(Qx, Vu, Vv) \
......@@ -5219,8 +5238,9 @@
52195238#if __HVX_ARCH__ >= 81
52205239/* ==========================================================================
52215240 Assembly Syntax: Qd4=vcmp.eq(Vu32.sf,Vv32.sf)
5222 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VsfVsf(HVX_Vector Vu,
5223 HVX_Vector Vv) Instruction Type: CVI_VA Execution Slots: SLOT0123
5241 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eq_VsfVsf(HVX_Vector Vu, HVX_Vector Vv)
5242 Instruction Type: CVI_VA
5243 Execution Slots: SLOT0123
52245244 ========================================================================== */
52255245
52265246#define Q6_Q_vcmp_eq_VsfVsf(Vu, Vv) \
......@@ -5231,9 +5251,9 @@
52315251#if __HVX_ARCH__ >= 81
52325252/* ==========================================================================
52335253 Assembly Syntax: Qx4&=vcmp.eq(Vu32.sf,Vv32.sf)
5234 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVsfVsf(HVX_VectorPred
5235 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5236 Slots: SLOT0123
5254 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqand_QVsfVsf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5255 Instruction Type: CVI_VA
5256 Execution Slots: SLOT0123
52375257 ========================================================================== */
52385258
52395259#define Q6_Q_vcmp_eqand_QVsfVsf(Qx, Vu, Vv) \
......@@ -5247,9 +5267,9 @@
52475267#if __HVX_ARCH__ >= 81
52485268/* ==========================================================================
52495269 Assembly Syntax: Qx4|=vcmp.eq(Vu32.sf,Vv32.sf)
5250 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVsfVsf(HVX_VectorPred
5251 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5252 Slots: SLOT0123
5270 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqor_QVsfVsf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5271 Instruction Type: CVI_VA
5272 Execution Slots: SLOT0123
52535273 ========================================================================== */
52545274
52555275#define Q6_Q_vcmp_eqor_QVsfVsf(Qx, Vu, Vv) \
......@@ -5263,9 +5283,9 @@
52635283#if __HVX_ARCH__ >= 81
52645284/* ==========================================================================
52655285 Assembly Syntax: Qx4^=vcmp.eq(Vu32.sf,Vv32.sf)
5266 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVsfVsf(HVX_VectorPred
5267 Qx, HVX_Vector Vu, HVX_Vector Vv) Instruction Type: CVI_VA Execution
5268 Slots: SLOT0123
5286 C Intrinsic Prototype: HVX_VectorPred Q6_Q_vcmp_eqxacc_QVsfVsf(HVX_VectorPred Qx, HVX_Vector Vu, HVX_Vector Vv)
5287 Instruction Type: CVI_VA
5288 Execution Slots: SLOT0123
52695289 ========================================================================== */
52705290
52715291#define Q6_Q_vcmp_eqxacc_QVsfVsf(Qx, Vu, Vv) \
......@@ -5375,8 +5395,9 @@
53755395#if __HVX_ARCH__ >= 81
53765396/* ==========================================================================
53775397 Assembly Syntax: Vd32.qf16=vsub(Vu32.hf,Vv32.qf16)
5378 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vsub_VhfVqf16(HVX_Vector Vu,
5379 HVX_Vector Vv) Instruction Type: CVI_VS Execution Slots: SLOT0123
5398 C Intrinsic Prototype: HVX_Vector Q6_Vqf16_vsub_VhfVqf16(HVX_Vector Vu, HVX_Vector Vv)
5399 Instruction Type: CVI_VS
5400 Execution Slots: SLOT0123
53805401 ========================================================================== */
53815402
53825403#define Q6_Vqf16_vsub_VhfVqf16(Vu, Vv) \
......@@ -5386,8 +5407,9 @@
53865407#if __HVX_ARCH__ >= 81
53875408/* ==========================================================================
53885409 Assembly Syntax: Vd32.qf32=vsub(Vu32.sf,Vv32.qf32)
5389 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vsub_VsfVqf32(HVX_Vector Vu,
5390 HVX_Vector Vv) Instruction Type: CVI_VS Execution Slots: SLOT0123
5410 C Intrinsic Prototype: HVX_Vector Q6_Vqf32_vsub_VsfVqf32(HVX_Vector Vu, HVX_Vector Vv)
5411 Instruction Type: CVI_VS
5412 Execution Slots: SLOT0123
53915413 ========================================================================== */
53925414
53935415#define Q6_Vqf32_vsub_VsfVqf32(Vu, Vv) \
lib/include/immintrin.h+4-2
......@@ -58,6 +58,10 @@
5858
5959#include <avx512bitalgintrin.h>
6060
61#include <avx512bmmintrin.h>
62
63#include <avx512bmmvlintrin.h>
64
6165#include <avx512cdintrin.h>
6266
6367#include <avx512vpopcntdqintrin.h>
......@@ -479,8 +483,6 @@ _storebe_i64(void * __P, long long __D) {
479483
480484#include <amxavx512intrin.h>
481485
482#include <amxtf32intrin.h>
483
484486#include <avx512vp2intersectintrin.h>
485487
486488#include <avx512vlvp2intersectintrin.h>
lib/include/intrin.h+20-10
......@@ -44,8 +44,10 @@
4444
4545#if __x86_64__
4646#define __LPTRINT_TYPE__ __int64
47#define __IPTRINT_TYPE__ __int64
4748#else
4849#define __LPTRINT_TYPE__ long
50#define __IPTRINT_TYPE__ int
4951#endif
5052
5153#ifdef __cplusplus
......@@ -95,12 +97,12 @@ void __outdword(unsigned short, unsigned long);
9597void __outdwordstring(unsigned short, unsigned long *, unsigned long);
9698void __outword(unsigned short, unsigned short);
9799void __outwordstring(unsigned short, unsigned short *, unsigned long);
98unsigned long __readcr0(void);
99unsigned long __readcr2(void);
100unsigned __LPTRINT_TYPE__ __readcr0(void);
101unsigned __LPTRINT_TYPE__ __readcr2(void);
100102unsigned __LPTRINT_TYPE__ __readcr3(void);
101103unsigned __LPTRINT_TYPE__ __readcr4(void);
102unsigned __int64 __readcr8(void);
103unsigned int __readdr(unsigned int);
104unsigned __LPTRINT_TYPE__ __readcr8(void);
105unsigned __IPTRINT_TYPE__ __readdr(unsigned int);
104106#ifdef __i386__
105107unsigned char __readfsbyte(unsigned long);
106108unsigned short __readfsword(unsigned long);
......@@ -126,11 +128,12 @@ unsigned __int64 __ull_rshift(unsigned __int64, int);
126128void __vmx_off(void);
127129void __vmx_vmptrst(unsigned __int64 *);
128130void __wbinvd(void);
129void __writecr0(unsigned int);
130void __writecr3(unsigned __INTPTR_TYPE__);
131void __writecr4(unsigned __INTPTR_TYPE__);
132void __writecr8(unsigned __int64);
133void __writedr(unsigned int, unsigned int);
131void __writecr0(unsigned __IPTRINT_TYPE__);
132void __writecr2(unsigned __IPTRINT_TYPE__);
133void __writecr3(unsigned __IPTRINT_TYPE__);
134void __writecr4(unsigned __IPTRINT_TYPE__);
135void __writecr8(unsigned __IPTRINT_TYPE__);
136void __writedr(unsigned int, unsigned __IPTRINT_TYPE__);
134137void __writefsbyte(unsigned long, unsigned char);
135138void __writefsdword(unsigned long, unsigned long);
136139void __writefsqword(unsigned long, unsigned __int64);
......@@ -374,6 +377,9 @@ static __inline__ void __DEFAULT_FN_ATTRS __nop(void) {
374377\*----------------------------------------------------------------------------*/
375378#if defined(__aarch64__) || defined(__arm64ec__)
376379unsigned __int64 __getReg(int);
380double __getRegFp(int _Reg);
381void __setReg(int, unsigned __int64);
382void __setRegFp(int, double);
377383unsigned char _interlockedbittestandreset_acq(long volatile *, long);
378384unsigned char _interlockedbittestandreset_nf(long volatile *, long);
379385unsigned char _interlockedbittestandreset_rel(long volatile *, long);
......@@ -438,10 +444,13 @@ unsigned int _CountLeadingSigns(long);
438444unsigned int _CountLeadingSigns64(__int64);
439445unsigned int _CountOneBits(unsigned long);
440446unsigned int _CountOneBits64(unsigned __int64);
447unsigned int _CountTrailingZeros(unsigned long);
448unsigned int _CountTrailingZeros64(unsigned __int64);
441449
442450unsigned int __hlt(unsigned int, ...);
443451
444452void __cdecl __prefetch(const void *);
453void __cdecl __prefetch2(const void *, unsigned char);
445454
446455#endif
447456
......@@ -474,7 +483,7 @@ static __inline__ unsigned __LPTRINT_TYPE__ __DEFAULT_FN_ATTRS __readcr3(void) {
474483}
475484
476485static __inline__ void __DEFAULT_FN_ATTRS
477__writecr3(unsigned __INTPTR_TYPE__ __cr3_val) {
486__writecr3(unsigned __IPTRINT_TYPE__ __cr3_val) {
478487 __asm__ ("mov {%0, %%cr3|cr3, %0}" : : "r"(__cr3_val) : "memory");
479488}
480489#endif
......@@ -484,6 +493,7 @@ __writecr3(unsigned __INTPTR_TYPE__ __cr3_val) {
484493#endif
485494
486495#undef __LPTRINT_TYPE__
496#undef __IPTRINT_TYPE__
487497
488498#undef __DEFAULT_FN_ATTRS
489499
lib/include/larchintrin.h+2
......@@ -120,10 +120,12 @@ extern __inline int
120120
121121#define __ibar(/*ui15*/ _1) __builtin_loongarch_ibar((_1))
122122
123#ifdef __loongarch_hard_float
123124#define __movfcsr2gr(/*ui5*/ _1) __builtin_loongarch_movfcsr2gr((_1));
124125
125126#define __movgr2fcsr(/*ui5*/ _1, _2) \
126127 __builtin_loongarch_movgr2fcsr((_1), (unsigned int)_2);
128#endif
127129
128130#define __syscall(/*ui15*/ _1) __builtin_loongarch_syscall((_1))
129131
lib/include/llvm_libc_wrappers/ctype.h+3-2
......@@ -9,13 +9,14 @@
99#ifndef __CLANG_LLVM_LIBC_WRAPPERS_CTYPE_H__
1010#define __CLANG_LLVM_LIBC_WRAPPERS_CTYPE_H__
1111
12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) && \
13 !defined(__SPIRV__)
1314#error "This file is for GPU offloading compilation only"
1415#endif
1516
1617#include_next <ctype.h>
1718
18#if defined(__HIP__) || defined(__CUDA__)
19#if defined(__HIP__) || defined(__CUDA__) || defined(__SPIRV__)
1920#define __LIBC_ATTRS __attribute__((device))
2021#else
2122#define __LIBC_ATTRS
lib/include/llvm_libc_wrappers/string.h+3-2
......@@ -9,13 +9,14 @@
99#ifndef __CLANG_LLVM_LIBC_WRAPPERS_STRING_H__
1010#define __CLANG_LLVM_LIBC_WRAPPERS_STRING_H__
1111
12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
12#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) && \
13 !defined(__SPIRV__)
1314#error "This file is for GPU offloading compilation only"
1415#endif
1516
1617#include_next <string.h>
1718
18#if defined(__HIP__) || defined(__CUDA__)
19#if defined(__HIP__) || defined(__CUDA__) || defined(__SPIRV__)
1920#define __LIBC_ATTRS __attribute__((device))
2021#else
2122#define __LIBC_ATTRS
lib/include/module.modulemap+16-1
......@@ -21,10 +21,19 @@ module _Builtin_intrinsics [system] [extern_c] {
2121 export *
2222 }
2323
24 explicit module bf16 {
25 header "arm_bf16.h"
26 export *
27 }
28
29 explicit module fp16 {
30 header "arm_fp16.h"
31 export *
32 }
33
2434 explicit module neon {
2535 requires neon
2636 header "arm_neon.h"
27 header "arm_fp16.h"
2837 export *
2938 }
3039
......@@ -41,6 +50,12 @@ module _Builtin_intrinsics [system] [extern_c] {
4150
4251 header "arm64intr.h"
4352 export *
53
54 explicit module neon {
55 requires neon
56 header "arm64_neon.h"
57 export *
58 }
4459 }
4560
4661 explicit module intel {
lib/include/openmp_wrappers/__clang_openmp_device_functions.h+14
......@@ -55,6 +55,20 @@ extern "C" {
5555#pragma omp end declare variant
5656#endif
5757
58#ifdef __SPIRV__
59#pragma omp begin declare variant match( \
60 device = {arch(spirv64)}, implementation = {extension(match_any)})
61
62#define __OPENMP_SPIRV__
63
64/// Include declarations for libdevice functions.
65#include <__clang_spirv_libdevice_declares.h>
66
67#undef __OPENMP_SPIRV__
68
69#pragma omp end declare variant
70#endif
71
5872#ifdef __cplusplus
5973} // extern "C"
6074#endif
lib/include/openmp_wrappers/complex+7-1
......@@ -29,6 +29,12 @@
2929#undef __OPENMP_AMDGCN__
3030#endif // __AMDGCN__
3131
32#ifdef __SPIRV__
33#define __OPENMP_SPIRV__
34#include <__clang_cuda_complex_builtins.h>
35#undef __OPENMP_SPIRV__
36#endif // __SPIRV__
37
3238#endif
3339
3440// Grab the host header too.
......@@ -45,7 +51,7 @@
4551#ifndef _LIBCPP_STD_VER
4652
4753#pragma omp begin declare variant match( \
48 device = {arch(amdgcn, nvptx, nvptx64)}, \
54 device = {arch(amdgcn, nvptx, nvptx64, spirv64)}, \
4955 implementation = {extension(match_any, allow_templates)})
5056
5157#include <complex_cmath.h>
lib/include/openmp_wrappers/complex.h+6
......@@ -29,6 +29,12 @@
2929#undef __OPENMP_AMDGCN__
3030#endif
3131
32#ifdef __SPIRV__
33#define __OPENMP_SPIRV__
34#include <__clang_cuda_complex_builtins.h>
35#undef __OPENMP_SPIRV__
36#endif // __SPIRV__
37
3238#endif
3339
3440// Grab the host header too.
lib/include/openmp_wrappers/math.h+10
......@@ -58,4 +58,14 @@
5858#pragma omp end declare variant
5959#endif
6060
61#ifdef __SPIRV__
62#pragma omp begin declare variant match(device = {arch(spirv64)})
63
64#define __OPENMP_SPIRV__
65#include <__clang_spirv_math.h>
66#undef __OPENMP_SPIRV__
67
68#pragma omp end declare variant
69#endif
70
6171#endif
lib/include/ptrauth.h+90-12
......@@ -38,8 +38,7 @@ typedef enum {
3838 The extra data is always 0. */
3939 ptrauth_key_function_pointer = ptrauth_key_process_independent_code,
4040
41 /* The key used to sign C++ v-table pointers.
42 The extra data is always 0. */
41 /* The key used to sign pointers to C++ v-tables. */
4342 ptrauth_key_cxx_vtable_pointer = ptrauth_key_process_independent_data,
4443
4544 /* The key used to sign metadata pointers to Objective-C method-lists. */
......@@ -178,6 +177,56 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
178177 __builtin_ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key, \
179178 __new_data)
180179
180/* Authenticate a pointer using a PC-based signature scheme and resign
181 it using a different scheme.
182
183 If the result is subsequently authenticated using the new scheme, that
184 authentication is guaranteed to fail if and only if the initial
185 authentication failed.
186
187 The value must be an expression of pointer type.
188 The key must be a constant expression of type ptrauth_key.
189 The extra data must be an expression of pointer or integer type;
190 if an integer, it will be coerced to ptrauth_extra_data_t.
191 The oldpc must be an expression of pointer or integer type representing
192 the PC value where the original signature was created.
193 The result will have the same type as the original value.
194
195 This operation is guaranteed to not leave the intermediate value
196 available for attack before it is re-signed.
197
198 Do not pass a null pointer to this function. A null pointer
199 will not successfully authenticate. */
200#define ptrauth_auth_with_pc_and_resign(__value, __old_key, __old_data, \
201 __old_pc, __new_key, __new_data) \
202 __builtin_ptrauth_auth_with_pc_and_resign(__value, __old_key, __old_data, \
203 __old_pc, __new_key, __new_data)
204
205/* Authenticate a pointer using one scheme, load 32bit value at offset addend
206 from the pointer, and add this value to the pointer, sign using specified
207 scheme.
208
209 If the result is subsequently authenticated using the new scheme, that
210 authentication is guaranteed to fail if and only if the initial
211 authentication failed.
212
213 The value must be an expression of pointer type.
214 The key must be a constant expression of type ptrauth_key.
215 The extra data must be an expression of pointer or integer type;
216 if an integer, it will be coerced to ptrauth_extra_data_t.
217 The addend must be an immediate ptrdiff_t value.
218 The result will have the same type as the original value.
219
220 This operation is guaranteed to not leave the intermediate value
221 available for attack before it is re-signed.
222
223 Do not pass a null pointer to this function. A null pointer
224 will not successfully authenticate. */
225#define ptrauth_auth_load_relative_and_sign(__value, __old_key, __old_data, \
226 __new_key, __new_data, __offset) \
227 __builtin_ptrauth_auth_load_relative_and_sign( \
228 __value, __old_key, __old_data, __new_key, __new_data, __offset)
229
181230/* Authenticate a pointer using one scheme and resign it as a C
182231 function pointer.
183232
......@@ -324,30 +373,38 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
324373 __ptrauth(ptrauth_key_objc_class_ro_pointer, 1, \
325374 __ptrauth_objc_class_ro_discriminator)
326375
376#if __has_feature(ptrauth_init_fini_address_discrimination)
377#define __ptrauth_init_fini_pointer \
378 __ptrauth(ptrauth_key_init_fini_pointer, 1, __ptrauth_init_fini_discriminator)
379#else
380#define __ptrauth_init_fini_pointer \
381 __ptrauth(ptrauth_key_init_fini_pointer, 0, __ptrauth_init_fini_discriminator)
382#endif
383
327384#else
328385
329386#define ptrauth_strip(__value, __key) \
330 ({ \
387 __extension__({ \
331388 (void)__key; \
332389 __value; \
333390 })
334391
335392#define ptrauth_blend_discriminator(__pointer, __integer) \
336 ({ \
393 __extension__({ \
337394 (void)__pointer; \
338395 (void)__integer; \
339396 ((ptrauth_extra_data_t)0); \
340397 })
341398
342399#define ptrauth_sign_constant(__value, __key, __data) \
343 ({ \
400 __extension__({ \
344401 (void)__key; \
345402 (void)__data; \
346403 __value; \
347404 })
348405
349406#define ptrauth_sign_unauthenticated(__value, __key, __data) \
350 ({ \
407 __extension__({ \
351408 (void)__key; \
352409 (void)__data; \
353410 __value; \
......@@ -355,7 +412,7 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
355412
356413#define ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key, \
357414 __new_data) \
358 ({ \
415 __extension__({ \
359416 (void)__old_key; \
360417 (void)__old_data; \
361418 (void)__new_key; \
......@@ -363,22 +420,44 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
363420 __value; \
364421 })
365422
423#define ptrauth_auth_with_pc_and_resign(__value, __old_key, __old_data, \
424 __old_pc, __new_key, __new_data) \
425 __extension__({ \
426 (void)__old_key; \
427 (void)__old_data; \
428 (void)__old_pc; \
429 (void)__new_key; \
430 (void)__new_data; \
431 __value; \
432 })
433
434#define ptrauth_auth_load_relative_and_sign(__value, __old_key, __old_data, \
435 __new_key, __new_data, __offset) \
436 __extension__({ \
437 (void)__old_key; \
438 (void)__old_data; \
439 (void)__new_key; \
440 (void)__new_data; \
441 const char *__value_tmp = (const char *)(__value); \
442 (void *)(__value_tmp + *(const int *)(__value_tmp + (__offset))); \
443 })
444
366445#define ptrauth_auth_function(__value, __old_key, __old_data) \
367 ({ \
446 __extension__({ \
368447 (void)__old_key; \
369448 (void)__old_data; \
370449 __value; \
371450 })
372451
373452#define ptrauth_auth_data(__value, __old_key, __old_data) \
374 ({ \
453 __extension__({ \
375454 (void)__old_key; \
376455 (void)__old_data; \
377456 __value; \
378457 })
379458
380459#define ptrauth_string_discriminator(__string) \
381 ({ \
460 __extension__({ \
382461 (void)__string; \
383462 ((ptrauth_extra_data_t)0); \
384463 })
......@@ -388,13 +467,12 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
388467 ((ptrauth_extra_data_t)0)
389468
390469#define ptrauth_sign_generic_data(__value, __data) \
391 ({ \
470 __extension__({ \
392471 (void)__value; \
393472 (void)__data; \
394473 ((ptrauth_generic_signature_t)0); \
395474 })
396475
397
398476#define ptrauth_cxx_vtable_pointer(key, address_discrimination, \
399477 extra_discrimination...)
400478
lib/include/riscv_bitmanip.h+7
......@@ -16,6 +16,13 @@
1616extern "C" {
1717#endif
1818
19#define __riscv_intrinsic_b 1
20#define __riscv_intrinsic_zbb 1
21#define __riscv_intrinsic_zbc 1
22#define __riscv_intrinsic_zbkb 1
23#define __riscv_intrinsic_zbkc 1
24#define __riscv_intrinsic_zbkx 1
25
1926#if defined(__riscv_zbb)
2027static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
2128__riscv_orc_b_32(uint32_t __x) {
lib/include/riscv_corev_alu.h+2
......@@ -16,6 +16,8 @@
1616extern "C" {
1717#endif
1818
19#define __riscv_intrinsic_xcvalu 1
20
1921#if defined(__riscv_xcvalu)
2022
2123#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
lib/include/riscv_crypto.h+8
......@@ -16,6 +16,14 @@
1616extern "C" {
1717#endif
1818
19#define __riscv_intrinsic_zkn 1
20#define __riscv_intrinsic_zknd 1
21#define __riscv_intrinsic_zkne 1
22#define __riscv_intrinsic_zknh 1
23#define __riscv_intrinsic_zks 1
24#define __riscv_intrinsic_zksed 1
25#define __riscv_intrinsic_zksh 1
26
1927#if defined(__riscv_zknd)
2028#if __riscv_xlen == 32
2129#define __riscv_aes32dsi(x, y, bs) __builtin_riscv_aes32dsi(x, y, bs)
lib/include/riscv_mips.h+2
......@@ -14,6 +14,8 @@
1414#error "This header is only meant to be used on riscv architecture"
1515#endif
1616
17#define __riscv_intrinsic_xmipsexectl 1
18
1719#define __DEFAULT_FN_ATTRS \
1820 __attribute__((__always_inline__, __nodebug__, __target__("xmipsexectl")))
1921
lib/include/riscv_nds.h+3
......@@ -16,6 +16,9 @@
1616extern "C" {
1717#endif
1818
19#define __riscv_intrinsic_xandesbfhcvt 1
20#define __riscv_intrinsic_xandesperf 1
21
1922#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
2023
2124#if defined(__riscv_xandesperf)
lib/include/riscv_ntlh.h+2
......@@ -10,6 +10,8 @@
1010#ifndef __RISCV_NTLH_H
1111#define __RISCV_NTLH_H
1212
13#define __riscv_intrinsic_zihintntl 1
14
1315#ifndef __riscv_zihintntl
1416#error "NTLH intrinsics require the NTLH extension."
1517#endif
lib/include/riscv_packed_simd.h created+644
......@@ -0,0 +1,644 @@
1/*===---- riscv_packed_simd.h - RISC-V P intrinsics ------------------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __RISCV_PACKED_SIMD_H
11#define __RISCV_PACKED_SIMD_H
12
13#include <stdint.h>
14
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
19/* Packed SIMD Types */
20
21typedef int8_t int8x4_t __attribute__((__vector_size__(4)));
22typedef uint8_t uint8x4_t __attribute__((__vector_size__(4)));
23typedef int16_t int16x2_t __attribute__((__vector_size__(4)));
24typedef uint16_t uint16x2_t __attribute__((__vector_size__(4)));
25
26typedef int8_t int8x8_t __attribute__((__vector_size__(8)));
27typedef uint8_t uint8x8_t __attribute__((__vector_size__(8)));
28typedef int16_t int16x4_t __attribute__((__vector_size__(8)));
29typedef uint16_t uint16x4_t __attribute__((__vector_size__(8)));
30typedef int32_t int32x2_t __attribute__((__vector_size__(8)));
31typedef uint32_t uint32x2_t __attribute__((__vector_size__(8)));
32
33#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
34
35#define __packed_splat2(ty, x) ((ty){(x), (x)})
36#define __packed_splat4(ty, x) ((ty){(x), (x), (x), (x)})
37#define __packed_splat8(ty, x) ((ty){(x), (x), (x), (x), (x), (x), (x), (x)})
38
39#define __packed_splat(name, ty, scalar_ty, splat) \
40 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(scalar_ty __x) { \
41 return splat(ty, __x); \
42 }
43
44#define __packed_shift(name, ty, op, mask) \
45 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
46 unsigned __rs2) { \
47 return __rs1 op(__rs2 & (mask)); \
48 }
49#define __packed_shift8(name, ty, op) __packed_shift(name, ty, op, 0x7)
50#define __packed_shift16(name, ty, op) __packed_shift(name, ty, op, 0xf)
51#define __packed_shift32(name, ty, op) __packed_shift(name, ty, op, 0x1f)
52
53#define __packed_scalar_binary_op(name, ty, scalar_ty, op, splat) \
54 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
55 scalar_ty __rs2) { \
56 return __rs1 op splat(ty, __rs2); \
57 }
58
59#define __packed_binary_op(name, ty, op) \
60 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, ty __rs2) { \
61 return __rs1 op __rs2; \
62 }
63
64#define __packed_unary_op(name, ty, op) \
65 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
66 return op __rs1; \
67 }
68
69#define __packed_binary_builtin(name, ty, builtin) \
70 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, ty __rs2) { \
71 return builtin(__rs1, __rs2); \
72 }
73
74#define __packed_sh1add(name, ty) \
75 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, ty __rs2) { \
76 return (__rs1 << 1) + __rs2; \
77 }
78
79/* TODO: switch to sadd_sat(__builtin_elementwise_shl_sat(a, 1), b) once a
80 * generic elementwise shl_sat builtin exists. sadd_sat(a, a) is equivalent
81 * for signed types and the backend's saturating_shl1 PatFrags matches both
82 * shapes. */
83#define __packed_sh1sadd(name, ty) \
84 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, ty __rs2) { \
85 return __builtin_elementwise_add_sat( \
86 __builtin_elementwise_add_sat(__rs1, __rs1), __rs2); \
87 }
88
89#define __packed_cmp(name, ty, rty, op) \
90 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
91 ty __rs2) { \
92 return (rty)(__rs1 op __rs2); \
93 }
94
95#define __packed_pabs(name, ty, rty) \
96 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
97 return (rty)__builtin_elementwise_abs(__rs1); \
98 }
99
100#define __packed_binary_builtin_cast(name, ty, rty, builtin) \
101 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
102 ty __rs2) { \
103 return (rty)builtin(__rs1, __rs2); \
104 }
105
106#define __packed_reduction(name, rty, ty, builtin) \
107 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
108 rty __rs2) { \
109 return builtin(__rs1, __rs2); \
110 }
111
112#define __packed_merge_builtin(name, ty, mask_ty, builtin) \
113 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, ty __rs2, \
114 mask_ty __rd) { \
115 return (ty)builtin(__rs1, __rs2, __rd); \
116 }
117
118#define __packed_psabs(name, ty, builtin) \
119 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
120 return builtin(__rs1); \
121 }
122
123#define __packed_widen_convert(name, rty, ty) \
124 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
125 return __builtin_convertvector(__rs1, rty); \
126 }
127#define __packed_widen_high2(name, rty, ty) \
128 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
129 return (rty)__builtin_shufflevector((ty){0}, __rs1, 0, 2, 1, 3); \
130 }
131#define __packed_widen_high4(name, rty, ty) \
132 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
133 return (rty)__builtin_shufflevector((ty){0}, __rs1, 0, 4, 1, 5, 2, 6, 3, \
134 7); \
135 }
136
137/* Packed Reverse: reverse the order of the elements. Lowered to a single
138 * rev8/rev16/ppairoe.* by the backend's packed reverse-shuffle handling. */
139#define __packed_reverse2(name, ty) \
140 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
141 return __builtin_shufflevector(__rs1, __rs1, 1, 0); \
142 }
143#define __packed_reverse4(name, ty) \
144 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
145 return __builtin_shufflevector(__rs1, __rs1, 3, 2, 1, 0); \
146 }
147#define __packed_reverse8(name, ty) \
148 static __inline__ ty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
149 return __builtin_shufflevector(__rs1, __rs1, 7, 6, 5, 4, 3, 2, 1, 0); \
150 }
151
152#define __packed_zip2(name, rty, ty) \
153 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
154 ty __rs2) { \
155 return __builtin_shufflevector(__rs1, __rs2, 0, 2, 1, 3); \
156 }
157#define __packed_zip4(name, rty, ty) \
158 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
159 ty __rs2) { \
160 return __builtin_shufflevector(__rs1, __rs2, 0, 4, 1, 5, 2, 6, 3, 7); \
161 }
162#define __packed_unzipe2(name, rty, ty) \
163 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
164 return __builtin_shufflevector(__rs1, __rs1, 0, 2); \
165 }
166#define __packed_unzipe4(name, rty, ty) \
167 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
168 return __builtin_shufflevector(__rs1, __rs1, 0, 2, 4, 6); \
169 }
170#define __packed_unzipo2(name, rty, ty) \
171 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
172 return __builtin_shufflevector(__rs1, __rs1, 1, 3); \
173 }
174#define __packed_unzipo4(name, rty, ty) \
175 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1) { \
176 return __builtin_shufflevector(__rs1, __rs1, 1, 3, 5, 7); \
177 }
178
179#define __packed_abdsum(name, rty, ty, builtin) \
180 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(ty __rs1, \
181 ty __rs2) { \
182 return builtin(__rs1, __rs2); \
183 }
184
185#define __packed_abdsum_acc(name, rty, ty, builtin) \
186 static __inline__ rty __DEFAULT_FN_ATTRS __riscv_##name(rty __rd, ty __rs1, \
187 ty __rs2) { \
188 return builtin(__rd, __rs1, __rs2); \
189 }
190
191// clang-format off: macro call sites have no trailing semicolons, which
192// confuses clang-format into a deeply nested expression.
193
194/* Packed Splat (32-bit) */
195__packed_splat(pmv_s_u8x4, uint8x4_t, uint8_t, __packed_splat4)
196__packed_splat(pmv_s_i8x4, int8x4_t, int8_t, __packed_splat4)
197__packed_splat(pmv_s_u16x2, uint16x2_t, uint16_t, __packed_splat2)
198__packed_splat(pmv_s_i16x2, int16x2_t, int16_t, __packed_splat2)
199
200/* Packed Splat (64-bit) */
201__packed_splat(pmv_s_u8x8, uint8x8_t, uint8_t, __packed_splat8)
202__packed_splat(pmv_s_i8x8, int8x8_t, int8_t, __packed_splat8)
203__packed_splat(pmv_s_u16x4, uint16x4_t, uint16_t, __packed_splat4)
204__packed_splat(pmv_s_i16x4, int16x4_t, int16_t, __packed_splat4)
205__packed_splat(pmv_s_u32x2, uint32x2_t, uint32_t, __packed_splat2)
206__packed_splat(pmv_s_i32x2, int32x2_t, int32_t, __packed_splat2)
207
208/* Packed Addition and Subtraction (32-bit) */
209__packed_binary_op(padd_i8x4, int8x4_t, +)
210__packed_binary_op(padd_u8x4, uint8x4_t, +)
211__packed_binary_op(padd_i16x2, int16x2_t, +)
212__packed_binary_op(padd_u16x2, uint16x2_t, +)
213__packed_binary_op(psub_i8x4, int8x4_t, -)
214__packed_binary_op(psub_u8x4, uint8x4_t, -)
215__packed_binary_op(psub_i16x2, int16x2_t, -)
216__packed_binary_op(psub_u16x2, uint16x2_t, -)
217__packed_unary_op(pneg_i8x4, int8x4_t, -)
218__packed_unary_op(pneg_i16x2, int16x2_t, -)
219
220/* Packed Addition and Subtraction (64-bit) */
221__packed_binary_op(padd_i8x8, int8x8_t, +)
222__packed_binary_op(padd_u8x8, uint8x8_t, +)
223__packed_binary_op(padd_i16x4, int16x4_t, +)
224__packed_binary_op(padd_u16x4, uint16x4_t, +)
225__packed_binary_op(padd_i32x2, int32x2_t, +)
226__packed_binary_op(padd_u32x2, uint32x2_t, +)
227__packed_binary_op(psub_i8x8, int8x8_t, -)
228__packed_binary_op(psub_u8x8, uint8x8_t, -)
229__packed_binary_op(psub_i16x4, int16x4_t, -)
230__packed_binary_op(psub_u16x4, uint16x4_t, -)
231__packed_binary_op(psub_i32x2, int32x2_t, -)
232__packed_binary_op(psub_u32x2, uint32x2_t, -)
233__packed_unary_op(pneg_i8x8, int8x8_t, -)
234__packed_unary_op(pneg_i16x4, int16x4_t, -)
235__packed_unary_op(pneg_i32x2, int32x2_t, -)
236
237/* Packed Addition with Scalar (32-bit) */
238__packed_scalar_binary_op(padd_s_u8x4, uint8x4_t, uint8_t, +, __packed_splat4)
239__packed_scalar_binary_op(padd_s_i8x4, int8x4_t, int8_t, +, __packed_splat4)
240__packed_scalar_binary_op(padd_s_u16x2, uint16x2_t, uint16_t, +,
241 __packed_splat2)
242__packed_scalar_binary_op(padd_s_i16x2, int16x2_t, int16_t, +,
243 __packed_splat2)
244
245/* Packed Addition with Scalar (64-bit) */
246__packed_scalar_binary_op(padd_s_u8x8, uint8x8_t, uint8_t, +, __packed_splat8)
247__packed_scalar_binary_op(padd_s_i8x8, int8x8_t, int8_t, +, __packed_splat8)
248__packed_scalar_binary_op(padd_s_u16x4, uint16x4_t, uint16_t, +,
249 __packed_splat4)
250__packed_scalar_binary_op(padd_s_i16x4, int16x4_t, int16_t, +,
251 __packed_splat4)
252__packed_scalar_binary_op(padd_s_u32x2, uint32x2_t, uint32_t, +,
253 __packed_splat2)
254__packed_scalar_binary_op(padd_s_i32x2, int32x2_t, int32_t, +,
255 __packed_splat2)
256
257/* Packed Saturating Addition and Subtraction (32-bit) */
258__packed_binary_builtin(psadd_i8x4, int8x4_t, __builtin_elementwise_add_sat)
259__packed_binary_builtin(psadd_i16x2, int16x2_t, __builtin_elementwise_add_sat)
260__packed_binary_builtin(psaddu_u8x4, uint8x4_t, __builtin_elementwise_add_sat)
261__packed_binary_builtin(psaddu_u16x2, uint16x2_t, __builtin_elementwise_add_sat)
262__packed_binary_builtin(pssub_i8x4, int8x4_t, __builtin_elementwise_sub_sat)
263__packed_binary_builtin(pssub_i16x2, int16x2_t, __builtin_elementwise_sub_sat)
264__packed_binary_builtin(pssubu_u8x4, uint8x4_t, __builtin_elementwise_sub_sat)
265__packed_binary_builtin(pssubu_u16x2, uint16x2_t, __builtin_elementwise_sub_sat)
266
267/* Packed Saturating Addition and Subtraction (64-bit) */
268__packed_binary_builtin(psadd_i8x8, int8x8_t, __builtin_elementwise_add_sat)
269__packed_binary_builtin(psadd_i16x4, int16x4_t, __builtin_elementwise_add_sat)
270__packed_binary_builtin(psadd_i32x2, int32x2_t, __builtin_elementwise_add_sat)
271__packed_binary_builtin(psaddu_u8x8, uint8x8_t, __builtin_elementwise_add_sat)
272__packed_binary_builtin(psaddu_u16x4, uint16x4_t, __builtin_elementwise_add_sat)
273__packed_binary_builtin(psaddu_u32x2, uint32x2_t, __builtin_elementwise_add_sat)
274__packed_binary_builtin(pssub_i8x8, int8x8_t, __builtin_elementwise_sub_sat)
275__packed_binary_builtin(pssub_i16x4, int16x4_t, __builtin_elementwise_sub_sat)
276__packed_binary_builtin(pssub_i32x2, int32x2_t, __builtin_elementwise_sub_sat)
277__packed_binary_builtin(pssubu_u8x8, uint8x8_t, __builtin_elementwise_sub_sat)
278__packed_binary_builtin(pssubu_u16x4, uint16x4_t, __builtin_elementwise_sub_sat)
279__packed_binary_builtin(pssubu_u32x2, uint32x2_t, __builtin_elementwise_sub_sat)
280
281/* Packed Shift-Add (32-bit) */
282__packed_sh1add(psh1add_i16x2, int16x2_t)
283__packed_sh1add(psh1add_u16x2, uint16x2_t)
284__packed_sh1sadd(pssh1sadd_i16x2, int16x2_t)
285
286/* Packed Shift-Add (64-bit) */
287__packed_sh1add(psh1add_i16x4, int16x4_t)
288__packed_sh1add(psh1add_u16x4, uint16x4_t)
289__packed_sh1add(psh1add_i32x2, int32x2_t)
290__packed_sh1add(psh1add_u32x2, uint32x2_t)
291__packed_sh1sadd(pssh1sadd_i16x4, int16x4_t)
292__packed_sh1sadd(pssh1sadd_i32x2, int32x2_t)
293
294/* Packed Exchanged Addition and Subtraction (32-bit) */
295__packed_binary_builtin(pas_x_i16x2, int16x2_t, __builtin_riscv_pas_x_i16x2)
296__packed_binary_builtin(psa_x_i16x2, int16x2_t, __builtin_riscv_psa_x_i16x2)
297__packed_binary_builtin(psas_x_i16x2, int16x2_t, __builtin_riscv_psas_x_i16x2)
298__packed_binary_builtin(pssa_x_i16x2, int16x2_t, __builtin_riscv_pssa_x_i16x2)
299__packed_binary_builtin(paas_x_i16x2, int16x2_t, __builtin_riscv_paas_x_i16x2)
300__packed_binary_builtin(pasa_x_i16x2, int16x2_t, __builtin_riscv_pasa_x_i16x2)
301
302/* Packed Exchanged Addition and Subtraction (64-bit) */
303__packed_binary_builtin(pas_x_i16x4, int16x4_t, __builtin_riscv_pas_x_i16x4)
304__packed_binary_builtin(psa_x_i16x4, int16x4_t, __builtin_riscv_psa_x_i16x4)
305__packed_binary_builtin(psas_x_i16x4, int16x4_t, __builtin_riscv_psas_x_i16x4)
306__packed_binary_builtin(pssa_x_i16x4, int16x4_t, __builtin_riscv_pssa_x_i16x4)
307__packed_binary_builtin(paas_x_i16x4, int16x4_t, __builtin_riscv_paas_x_i16x4)
308__packed_binary_builtin(pasa_x_i16x4, int16x4_t, __builtin_riscv_pasa_x_i16x4)
309__packed_binary_builtin(pas_x_i32x2, int32x2_t, __builtin_riscv_pas_x_i32x2)
310__packed_binary_builtin(psa_x_i32x2, int32x2_t, __builtin_riscv_psa_x_i32x2)
311__packed_binary_builtin(psas_x_i32x2, int32x2_t, __builtin_riscv_psas_x_i32x2)
312__packed_binary_builtin(pssa_x_i32x2, int32x2_t, __builtin_riscv_pssa_x_i32x2)
313__packed_binary_builtin(paas_x_i32x2, int32x2_t, __builtin_riscv_paas_x_i32x2)
314__packed_binary_builtin(pasa_x_i32x2, int32x2_t, __builtin_riscv_pasa_x_i32x2)
315
316/* Packed Minimum and Maximum (32-bit) */
317__packed_binary_builtin(pmin_i8x4, int8x4_t, __builtin_elementwise_min)
318__packed_binary_builtin(pmin_i16x2, int16x2_t, __builtin_elementwise_min)
319__packed_binary_builtin(pminu_u8x4, uint8x4_t, __builtin_elementwise_min)
320__packed_binary_builtin(pminu_u16x2, uint16x2_t, __builtin_elementwise_min)
321__packed_binary_builtin(pmax_i8x4, int8x4_t, __builtin_elementwise_max)
322__packed_binary_builtin(pmax_i16x2, int16x2_t, __builtin_elementwise_max)
323__packed_binary_builtin(pmaxu_u8x4, uint8x4_t, __builtin_elementwise_max)
324__packed_binary_builtin(pmaxu_u16x2, uint16x2_t, __builtin_elementwise_max)
325
326/* Packed Minimum and Maximum (64-bit) */
327__packed_binary_builtin(pmin_i8x8, int8x8_t, __builtin_elementwise_min)
328__packed_binary_builtin(pmin_i16x4, int16x4_t, __builtin_elementwise_min)
329__packed_binary_builtin(pmin_i32x2, int32x2_t, __builtin_elementwise_min)
330__packed_binary_builtin(pminu_u8x8, uint8x8_t, __builtin_elementwise_min)
331__packed_binary_builtin(pminu_u16x4, uint16x4_t, __builtin_elementwise_min)
332__packed_binary_builtin(pminu_u32x2, uint32x2_t, __builtin_elementwise_min)
333__packed_binary_builtin(pmax_i8x8, int8x8_t, __builtin_elementwise_max)
334__packed_binary_builtin(pmax_i16x4, int16x4_t, __builtin_elementwise_max)
335__packed_binary_builtin(pmax_i32x2, int32x2_t, __builtin_elementwise_max)
336__packed_binary_builtin(pmaxu_u8x8, uint8x8_t, __builtin_elementwise_max)
337__packed_binary_builtin(pmaxu_u16x4, uint16x4_t, __builtin_elementwise_max)
338__packed_binary_builtin(pmaxu_u32x2, uint32x2_t, __builtin_elementwise_max)
339
340/* Packed Comparison (32-bit) */
341__packed_cmp(pmseq_i8x4_u8x4, int8x4_t, uint8x4_t, ==)
342__packed_cmp(pmseq_u8x4_u8x4, uint8x4_t, uint8x4_t, ==)
343__packed_cmp(pmsne_i8x4_u8x4, int8x4_t, uint8x4_t, !=)
344__packed_cmp(pmsne_u8x4_u8x4, uint8x4_t, uint8x4_t, !=)
345__packed_cmp(pmslt_u8x4, int8x4_t, uint8x4_t, <)
346__packed_cmp(pmsltu_u8x4, uint8x4_t, uint8x4_t, <)
347__packed_cmp(pmsgt_u8x4, int8x4_t, uint8x4_t, >)
348__packed_cmp(pmsgtu_u8x4, uint8x4_t, uint8x4_t, >)
349__packed_cmp(pmsge_u8x4, int8x4_t, uint8x4_t, >=)
350__packed_cmp(pmsgeu_u8x4, uint8x4_t, uint8x4_t, >=)
351__packed_cmp(pmsle_u8x4, int8x4_t, uint8x4_t, <=)
352__packed_cmp(pmsleu_u8x4, uint8x4_t, uint8x4_t, <=)
353__packed_cmp(pmseq_i16x2_u16x2, int16x2_t, uint16x2_t, ==)
354__packed_cmp(pmseq_u16x2_u16x2, uint16x2_t, uint16x2_t, ==)
355__packed_cmp(pmsne_i16x2_u16x2, int16x2_t, uint16x2_t, !=)
356__packed_cmp(pmsne_u16x2_u16x2, uint16x2_t, uint16x2_t, !=)
357__packed_cmp(pmslt_u16x2, int16x2_t, uint16x2_t, <)
358__packed_cmp(pmsltu_u16x2, uint16x2_t, uint16x2_t, <)
359__packed_cmp(pmsgt_u16x2, int16x2_t, uint16x2_t, >)
360__packed_cmp(pmsgtu_u16x2, uint16x2_t, uint16x2_t, >)
361__packed_cmp(pmsge_u16x2, int16x2_t, uint16x2_t, >=)
362__packed_cmp(pmsgeu_u16x2, uint16x2_t, uint16x2_t, >=)
363__packed_cmp(pmsle_u16x2, int16x2_t, uint16x2_t, <=)
364__packed_cmp(pmsleu_u16x2, uint16x2_t, uint16x2_t, <=)
365
366/* Packed Comparison (64-bit) */
367__packed_cmp(pmseq_i8x8_u8x8, int8x8_t, uint8x8_t, ==)
368__packed_cmp(pmseq_u8x8_u8x8, uint8x8_t, uint8x8_t, ==)
369__packed_cmp(pmsne_i8x8_u8x8, int8x8_t, uint8x8_t, !=)
370__packed_cmp(pmsne_u8x8_u8x8, uint8x8_t, uint8x8_t, !=)
371__packed_cmp(pmslt_u8x8, int8x8_t, uint8x8_t, <)
372__packed_cmp(pmsltu_u8x8, uint8x8_t, uint8x8_t, <)
373__packed_cmp(pmsgt_u8x8, int8x8_t, uint8x8_t, >)
374__packed_cmp(pmsgtu_u8x8, uint8x8_t, uint8x8_t, >)
375__packed_cmp(pmsge_u8x8, int8x8_t, uint8x8_t, >=)
376__packed_cmp(pmsgeu_u8x8, uint8x8_t, uint8x8_t, >=)
377__packed_cmp(pmsle_u8x8, int8x8_t, uint8x8_t, <=)
378__packed_cmp(pmsleu_u8x8, uint8x8_t, uint8x8_t, <=)
379__packed_cmp(pmseq_i16x4_u16x4, int16x4_t, uint16x4_t, ==)
380__packed_cmp(pmseq_u16x4_u16x4, uint16x4_t, uint16x4_t, ==)
381__packed_cmp(pmsne_i16x4_u16x4, int16x4_t, uint16x4_t, !=)
382__packed_cmp(pmsne_u16x4_u16x4, uint16x4_t, uint16x4_t, !=)
383__packed_cmp(pmslt_u16x4, int16x4_t, uint16x4_t, <)
384__packed_cmp(pmsltu_u16x4, uint16x4_t, uint16x4_t, <)
385__packed_cmp(pmsgt_u16x4, int16x4_t, uint16x4_t, >)
386__packed_cmp(pmsgtu_u16x4, uint16x4_t, uint16x4_t, >)
387__packed_cmp(pmsge_u16x4, int16x4_t, uint16x4_t, >=)
388__packed_cmp(pmsgeu_u16x4, uint16x4_t, uint16x4_t, >=)
389__packed_cmp(pmsle_u16x4, int16x4_t, uint16x4_t, <=)
390__packed_cmp(pmsleu_u16x4, uint16x4_t, uint16x4_t, <=)
391__packed_cmp(pmseq_i32x2_u32x2, int32x2_t, uint32x2_t, ==)
392__packed_cmp(pmseq_u32x2_u32x2, uint32x2_t, uint32x2_t, ==)
393__packed_cmp(pmsne_i32x2_u32x2, int32x2_t, uint32x2_t, !=)
394__packed_cmp(pmsne_u32x2_u32x2, uint32x2_t, uint32x2_t, !=)
395__packed_cmp(pmslt_u32x2, int32x2_t, uint32x2_t, <)
396__packed_cmp(pmsltu_u32x2, uint32x2_t, uint32x2_t, <)
397__packed_cmp(pmsgt_u32x2, int32x2_t, uint32x2_t, >)
398__packed_cmp(pmsgtu_u32x2, uint32x2_t, uint32x2_t, >)
399__packed_cmp(pmsge_u32x2, int32x2_t, uint32x2_t, >=)
400__packed_cmp(pmsgeu_u32x2, uint32x2_t, uint32x2_t, >=)
401__packed_cmp(pmsle_u32x2, int32x2_t, uint32x2_t, <=)
402__packed_cmp(pmsleu_u32x2, uint32x2_t, uint32x2_t, <=)
403
404/* Packed Shifts (32-bit) */
405__packed_shift8(psll_s_u8x4, uint8x4_t, <<)
406__packed_shift8(psll_s_i8x4, int8x4_t, <<)
407__packed_shift16(psll_s_u16x2, uint16x2_t, <<)
408__packed_shift16(psll_s_i16x2, int16x2_t, <<)
409__packed_shift8(psrl_s_u8x4, uint8x4_t, >>)
410__packed_shift16(psrl_s_u16x2, uint16x2_t, >>)
411__packed_shift8(psra_s_i8x4, int8x4_t, >>)
412__packed_shift16(psra_s_i16x2, int16x2_t, >>)
413
414/* Packed Shifts (64-bit) */
415__packed_shift8(psll_s_u8x8, uint8x8_t, <<)
416__packed_shift8(psll_s_i8x8, int8x8_t, <<)
417__packed_shift16(psll_s_u16x4, uint16x4_t, <<)
418__packed_shift16(psll_s_i16x4, int16x4_t, <<)
419__packed_shift32(psll_s_u32x2, uint32x2_t, <<)
420__packed_shift32(psll_s_i32x2, int32x2_t, <<)
421__packed_shift8(psrl_s_u8x8, uint8x8_t, >>)
422__packed_shift16(psrl_s_u16x4, uint16x4_t, >>)
423__packed_shift32(psrl_s_u32x2, uint32x2_t, >>)
424__packed_shift8(psra_s_i8x8, int8x8_t, >>)
425__packed_shift16(psra_s_i16x4, int16x4_t, >>)
426__packed_shift32(psra_s_i32x2, int32x2_t, >>)
427
428/* Packed Logical Operations (32-bit) */
429__packed_binary_op(pand_i8x4, int8x4_t, &)
430__packed_binary_op(pand_u8x4, uint8x4_t, &)
431__packed_binary_op(pand_i16x2, int16x2_t, &)
432__packed_binary_op(pand_u16x2, uint16x2_t, &)
433__packed_binary_op(por_i8x4, int8x4_t, |)
434__packed_binary_op(por_u8x4, uint8x4_t, |)
435__packed_binary_op(por_i16x2, int16x2_t, |)
436__packed_binary_op(por_u16x2, uint16x2_t, |)
437__packed_binary_op(pxor_i8x4, int8x4_t, ^)
438__packed_binary_op(pxor_u8x4, uint8x4_t, ^)
439__packed_binary_op(pxor_i16x2, int16x2_t, ^)
440__packed_binary_op(pxor_u16x2, uint16x2_t, ^)
441__packed_unary_op(pnot_i8x4, int8x4_t, ~)
442__packed_unary_op(pnot_u8x4, uint8x4_t, ~)
443__packed_unary_op(pnot_i16x2, int16x2_t, ~)
444__packed_unary_op(pnot_u16x2, uint16x2_t, ~)
445
446/* Packed Logical Operations (64-bit) */
447__packed_binary_op(pand_i8x8, int8x8_t, &)
448__packed_binary_op(pand_u8x8, uint8x8_t, &)
449__packed_binary_op(pand_i16x4, int16x4_t, &)
450__packed_binary_op(pand_u16x4, uint16x4_t, &)
451__packed_binary_op(pand_i32x2, int32x2_t, &)
452__packed_binary_op(pand_u32x2, uint32x2_t, &)
453__packed_binary_op(por_i8x8, int8x8_t, |)
454__packed_binary_op(por_u8x8, uint8x8_t, |)
455__packed_binary_op(por_i16x4, int16x4_t, |)
456__packed_binary_op(por_u16x4, uint16x4_t, |)
457__packed_binary_op(por_i32x2, int32x2_t, |)
458__packed_binary_op(por_u32x2, uint32x2_t, |)
459__packed_binary_op(pxor_i8x8, int8x8_t, ^)
460__packed_binary_op(pxor_u8x8, uint8x8_t, ^)
461__packed_binary_op(pxor_i16x4, int16x4_t, ^)
462__packed_binary_op(pxor_u16x4, uint16x4_t, ^)
463__packed_binary_op(pxor_i32x2, int32x2_t, ^)
464__packed_binary_op(pxor_u32x2, uint32x2_t, ^)
465__packed_unary_op(pnot_i8x8, int8x8_t, ~)
466__packed_unary_op(pnot_u8x8, uint8x8_t, ~)
467__packed_unary_op(pnot_i16x4, int16x4_t, ~)
468__packed_unary_op(pnot_u16x4, uint16x4_t, ~)
469__packed_unary_op(pnot_i32x2, int32x2_t, ~)
470__packed_unary_op(pnot_u32x2, uint32x2_t, ~)
471
472/* Packed Widening Convert */
473__packed_widen_convert(pwcvt_i16x4, int16x4_t, int8x4_t)
474__packed_widen_convert(pwcvt_i32x2, int32x2_t, int16x2_t)
475__packed_widen_convert(pwcvtu_u16x4, uint16x4_t, uint8x4_t)
476__packed_widen_convert(pwcvtu_u32x2, uint32x2_t, uint16x2_t)
477__packed_widen_high4(pwcvth_i16x4, int16x4_t, int8x4_t)
478__packed_widen_high4(pwcvth_u16x4, uint16x4_t, uint8x4_t)
479__packed_widen_high2(pwcvth_i32x2, int32x2_t, int16x2_t)
480__packed_widen_high2(pwcvth_u32x2, uint32x2_t, uint16x2_t)
481
482/* Packed Reverse (32-bit) */
483__packed_reverse4(prev_i8x4, int8x4_t)
484__packed_reverse4(prev_u8x4, uint8x4_t)
485__packed_reverse2(prev_i16x2, int16x2_t)
486__packed_reverse2(prev_u16x2, uint16x2_t)
487
488/* Packed Reverse (64-bit) */
489__packed_reverse8(prev_i8x8, int8x8_t)
490__packed_reverse8(prev_u8x8, uint8x8_t)
491__packed_reverse4(prev_i16x4, int16x4_t)
492__packed_reverse4(prev_u16x4, uint16x4_t)
493__packed_reverse2(prev_i32x2, int32x2_t)
494__packed_reverse2(prev_u32x2, uint32x2_t)
495
496/* Packed Zip */
497__packed_zip4(pzip_i8x8, int8x8_t, int8x4_t)
498__packed_zip4(pzip_u8x8, uint8x8_t, uint8x4_t)
499__packed_zip2(pzip_i16x4, int16x4_t, int16x2_t)
500__packed_zip2(pzip_u16x4, uint16x4_t, uint16x2_t)
501
502/* Packed Unzip */
503__packed_unzipe4(punzipe_i8x4, int8x4_t, int8x8_t)
504__packed_unzipo4(punzipo_i8x4, int8x4_t, int8x8_t)
505__packed_unzipe4(punzipe_u8x4, uint8x4_t, uint8x8_t)
506__packed_unzipo4(punzipo_u8x4, uint8x4_t, uint8x8_t)
507__packed_unzipe2(punzipe_i16x2, int16x2_t, int16x4_t)
508__packed_unzipo2(punzipo_i16x2, int16x2_t, int16x4_t)
509__packed_unzipe2(punzipe_u16x2, uint16x2_t, uint16x4_t)
510__packed_unzipo2(punzipo_u16x2, uint16x2_t, uint16x4_t)
511
512/* Packed Averaging Addition and Subtraction (32-bit) */
513__packed_binary_builtin(paadd_i8x4, int8x4_t, __builtin_riscv_paadd_i8x4)
514__packed_binary_builtin(paadd_i16x2, int16x2_t, __builtin_riscv_paadd_i16x2)
515__packed_binary_builtin(paaddu_u8x4, uint8x4_t, __builtin_riscv_paaddu_u8x4)
516__packed_binary_builtin(paaddu_u16x2, uint16x2_t, __builtin_riscv_paaddu_u16x2)
517__packed_binary_builtin(pasub_i8x4, int8x4_t, __builtin_riscv_pasub_i8x4)
518__packed_binary_builtin(pasub_i16x2, int16x2_t, __builtin_riscv_pasub_i16x2)
519__packed_binary_builtin(pasubu_u8x4, uint8x4_t, __builtin_riscv_pasubu_u8x4)
520__packed_binary_builtin(pasubu_u16x2, uint16x2_t, __builtin_riscv_pasubu_u16x2)
521
522/* Packed Averaging Addition and Subtraction (64-bit) */
523__packed_binary_builtin(paadd_i8x8, int8x8_t, __builtin_riscv_paadd_i8x8)
524__packed_binary_builtin(paadd_i16x4, int16x4_t, __builtin_riscv_paadd_i16x4)
525__packed_binary_builtin(paadd_i32x2, int32x2_t, __builtin_riscv_paadd_i32x2)
526__packed_binary_builtin(paaddu_u8x8, uint8x8_t, __builtin_riscv_paaddu_u8x8)
527__packed_binary_builtin(paaddu_u16x4, uint16x4_t, __builtin_riscv_paaddu_u16x4)
528__packed_binary_builtin(paaddu_u32x2, uint32x2_t, __builtin_riscv_paaddu_u32x2)
529__packed_binary_builtin(pasub_i8x8, int8x8_t, __builtin_riscv_pasub_i8x8)
530__packed_binary_builtin(pasub_i16x4, int16x4_t, __builtin_riscv_pasub_i16x4)
531__packed_binary_builtin(pasub_i32x2, int32x2_t, __builtin_riscv_pasub_i32x2)
532__packed_binary_builtin(pasubu_u8x8, uint8x8_t, __builtin_riscv_pasubu_u8x8)
533__packed_binary_builtin(pasubu_u16x4, uint16x4_t, __builtin_riscv_pasubu_u16x4)
534__packed_binary_builtin(pasubu_u32x2, uint32x2_t, __builtin_riscv_pasubu_u32x2)
535
536/* Packed Absolute Value and Absolute Difference (32-bit) */
537__packed_pabs(pabs_i8x4, int8x4_t, uint8x4_t)
538__packed_pabs(pabs_i16x2, int16x2_t, uint16x2_t)
539__packed_binary_builtin_cast(pabd_i8x4, int8x4_t, uint8x4_t, __builtin_riscv_pabd_i8x4)
540__packed_binary_builtin_cast(pabd_i16x2, int16x2_t, uint16x2_t, __builtin_riscv_pabd_i16x2)
541__packed_binary_builtin_cast(pabdu_u8x4, uint8x4_t, uint8x4_t, __builtin_riscv_pabdu_u8x4)
542__packed_binary_builtin_cast(pabdu_u16x2, uint16x2_t, uint16x2_t, __builtin_riscv_pabdu_u16x2)
543
544/* Packed Absolute Value and Absolute Difference (64-bit) */
545__packed_pabs(pabs_i8x8, int8x8_t, uint8x8_t)
546__packed_pabs(pabs_i16x4, int16x4_t, uint16x4_t)
547__packed_binary_builtin_cast(pabd_i8x8, int8x8_t, uint8x8_t, __builtin_riscv_pabd_i8x8)
548__packed_binary_builtin_cast(pabd_i16x4, int16x4_t, uint16x4_t, __builtin_riscv_pabd_i16x4)
549__packed_binary_builtin_cast(pabdu_u8x8, uint8x8_t, uint8x8_t, __builtin_riscv_pabdu_u8x8)
550__packed_binary_builtin_cast(pabdu_u16x4, uint16x4_t, uint16x4_t, __builtin_riscv_pabdu_u16x4)
551
552/* Packed Reduction Sum (32-bit) */
553__packed_reduction(predsum_i8x4_i32, int32_t, int8x4_t, __builtin_riscv_predsum_i8x4_i32)
554__packed_reduction(predsumu_u8x4_u32, uint32_t, uint8x4_t, __builtin_riscv_predsumu_u8x4_u32)
555__packed_reduction(predsum_i16x2_i32, int32_t, int16x2_t, __builtin_riscv_predsum_i16x2_i32)
556__packed_reduction(predsumu_u16x2_u32, uint32_t, uint16x2_t, __builtin_riscv_predsumu_u16x2_u32)
557
558/* Packed Reduction Sum (64-bit) */
559__packed_reduction(predsum_i8x8_i32, int32_t, int8x8_t, __builtin_riscv_predsum_i8x8_i32)
560__packed_reduction(predsumu_u8x8_u32, uint32_t, uint8x8_t, __builtin_riscv_predsumu_u8x8_u32)
561__packed_reduction(predsum_i16x4_i32, int32_t, int16x4_t, __builtin_riscv_predsum_i16x4_i32)
562__packed_reduction(predsumu_u16x4_u32, uint32_t, uint16x4_t, __builtin_riscv_predsumu_u16x4_u32)
563__packed_reduction(predsum_i8x8_i64, int64_t, int8x8_t, __builtin_riscv_predsum_i8x8_i64)
564__packed_reduction(predsumu_u8x8_u64, uint64_t, uint8x8_t, __builtin_riscv_predsumu_u8x8_u64)
565__packed_reduction(predsum_i16x4_i64, int64_t, int16x4_t, __builtin_riscv_predsum_i16x4_i64)
566__packed_reduction(predsumu_u16x4_u64, uint64_t, uint16x4_t, __builtin_riscv_predsumu_u16x4_u64)
567__packed_reduction(predsum_i32x2_i64, int64_t, int32x2_t, __builtin_riscv_predsum_i32x2_i64)
568__packed_reduction(predsumu_u32x2_u64, uint64_t, uint32x2_t, __builtin_riscv_predsumu_u32x2_u64)
569
570/* Packed Merge (32-bit) */
571__packed_merge_builtin(pmerge_u8x4, uint8x4_t, uint8x4_t, __builtin_riscv_pmerge_u8x4)
572__packed_merge_builtin(pmerge_i8x4, int8x4_t, uint8x4_t, __builtin_riscv_pmerge_i8x4)
573__packed_merge_builtin(pmerge_u16x2, uint16x2_t, uint16x2_t, __builtin_riscv_pmerge_u16x2)
574__packed_merge_builtin(pmerge_i16x2, int16x2_t, uint16x2_t, __builtin_riscv_pmerge_i16x2)
575
576/* Packed Merge (64-bit) */
577__packed_merge_builtin(pmerge_u8x8, uint8x8_t, uint8x8_t, __builtin_riscv_pmerge_u8x8)
578__packed_merge_builtin(pmerge_i8x8, int8x8_t, uint8x8_t, __builtin_riscv_pmerge_i8x8)
579__packed_merge_builtin(pmerge_u16x4, uint16x4_t, uint16x4_t, __builtin_riscv_pmerge_u16x4)
580__packed_merge_builtin(pmerge_i16x4, int16x4_t, uint16x4_t, __builtin_riscv_pmerge_i16x4)
581__packed_merge_builtin(pmerge_u32x2, uint32x2_t, uint32x2_t, __builtin_riscv_pmerge_u32x2)
582__packed_merge_builtin(pmerge_i32x2, int32x2_t, uint32x2_t, __builtin_riscv_pmerge_i32x2)
583
584/* Packed Absolute Difference Sum (32-bit) */
585__packed_abdsum(pabdsumu_u8x4_u32, uint32_t, uint8x4_t, __builtin_riscv_pabdsumu_u8x4_u32)
586__packed_abdsum_acc(pabdsumau_u8x4_u32, uint32_t, uint8x4_t, __builtin_riscv_pabdsumau_u8x4_u32)
587
588/* Packed Absolute Difference Sum (64-bit) */
589__packed_abdsum(pabdsumu_u8x8_u32, uint32_t, uint8x8_t, __builtin_riscv_pabdsumu_u8x8_u32)
590__packed_abdsum(pabdsumu_u8x8_u64, uint64_t, uint8x8_t, __builtin_riscv_pabdsumu_u8x8_u64)
591__packed_abdsum_acc(pabdsumau_u8x8_u32, uint32_t, uint8x8_t, __builtin_riscv_pabdsumau_u8x8_u32)
592__packed_abdsum_acc(pabdsumau_u8x8_u64, uint64_t, uint8x8_t, __builtin_riscv_pabdsumau_u8x8_u64)
593
594/* Packed Saturating Absolute Value (32-bit) */
595__packed_psabs(psabs_i8x4, int8x4_t, __builtin_riscv_psabs_i8x4)
596__packed_psabs(psabs_i16x2, int16x2_t, __builtin_riscv_psabs_i16x2)
597
598/* Packed Saturating Absolute Value (64-bit) */
599__packed_psabs(psabs_i8x8, int8x8_t, __builtin_riscv_psabs_i8x8)
600__packed_psabs(psabs_i16x4, int16x4_t, __builtin_riscv_psabs_i16x4)
601
602// clang-format on
603
604#undef __packed_splat2
605#undef __packed_splat4
606#undef __packed_splat8
607#undef __packed_splat
608#undef __packed_shift
609#undef __packed_shift8
610#undef __packed_shift16
611#undef __packed_shift32
612#undef __packed_scalar_binary_op
613#undef __packed_binary_op
614#undef __packed_unary_op
615#undef __packed_binary_builtin
616#undef __packed_sh1add
617#undef __packed_sh1sadd
618#undef __packed_cmp
619#undef __packed_pabs
620#undef __packed_binary_builtin_cast
621#undef __packed_reduction
622#undef __packed_merge_builtin
623#undef __packed_psabs
624#undef __packed_widen_convert
625#undef __packed_widen_high2
626#undef __packed_widen_high4
627#undef __packed_reverse2
628#undef __packed_reverse4
629#undef __packed_reverse8
630#undef __packed_zip2
631#undef __packed_zip4
632#undef __packed_unzipe2
633#undef __packed_unzipe4
634#undef __packed_unzipo2
635#undef __packed_unzipo4
636#undef __packed_abdsum
637#undef __packed_abdsum_acc
638#undef __DEFAULT_FN_ATTRS
639
640#if defined(__cplusplus)
641}
642#endif
643
644#endif /* __RISCV_PACKED_SIMD_H */
lib/include/riscv_vector.h+43
......@@ -20,6 +20,35 @@ extern "C" {
2020
2121#pragma clang riscv intrinsic vector
2222
23#define __riscv_intrinsic_v 1
24#define __riscv_intrinsic_zvabd 1
25#define __riscv_intrinsic_zvbb 1
26#define __riscv_intrinsic_zvbc 1
27#define __riscv_intrinsic_zvdot4a8i 1
28#define __riscv_intrinsic_zve32f 1
29#define __riscv_intrinsic_zve32x 1
30#define __riscv_intrinsic_zve64d 1
31#define __riscv_intrinsic_zve64f 1
32#define __riscv_intrinsic_zve64x 1
33#define __riscv_intrinsic_zvfbfa 1
34#define __riscv_intrinsic_zvfbfmin 1
35#define __riscv_intrinsic_zvfbfwma 1
36#define __riscv_intrinsic_zvfh 1
37#define __riscv_intrinsic_zvfhmin 1
38#define __riscv_intrinsic_zvfofp8min 1
39#define __riscv_intrinsic_zvkb 1
40#define __riscv_intrinsic_zvkg 1
41#define __riscv_intrinsic_zvkn 1
42#define __riscv_intrinsic_zvknc 1
43#define __riscv_intrinsic_zvkned 1
44#define __riscv_intrinsic_zvkng 1
45#define __riscv_intrinsic_zvknha 1
46#define __riscv_intrinsic_zvknhb 1
47#define __riscv_intrinsic_zvks 1
48#define __riscv_intrinsic_zvksc 1
49#define __riscv_intrinsic_zvksed 1
50#define __riscv_intrinsic_zvksg 1
51#define __riscv_intrinsic_zvksh 1
2352
2453enum __RISCV_FRM {
2554 __RISCV_FRM_RNE = 0,
......@@ -415,6 +444,20 @@ typedef __rvv_bfloat16m2x4_t vbfloat16m2x4_t;
415444typedef __rvv_bfloat16m4_t vbfloat16m4_t;
416445typedef __rvv_bfloat16m4x2_t vbfloat16m4x2_t;
417446typedef __rvv_bfloat16m8_t vbfloat16m8_t;
447typedef __rvv_float8e4m3mf8_t vfloat8e4m3mf8_t;
448typedef __rvv_float8e4m3mf4_t vfloat8e4m3mf4_t;
449typedef __rvv_float8e4m3mf2_t vfloat8e4m3mf2_t;
450typedef __rvv_float8e4m3m1_t vfloat8e4m3m1_t;
451typedef __rvv_float8e4m3m2_t vfloat8e4m3m2_t;
452typedef __rvv_float8e4m3m4_t vfloat8e4m3m4_t;
453typedef __rvv_float8e4m3m8_t vfloat8e4m3m8_t;
454typedef __rvv_float8e5m2mf8_t vfloat8e5m2mf8_t;
455typedef __rvv_float8e5m2mf4_t vfloat8e5m2mf4_t;
456typedef __rvv_float8e5m2mf2_t vfloat8e5m2mf2_t;
457typedef __rvv_float8e5m2m1_t vfloat8e5m2m1_t;
458typedef __rvv_float8e5m2m2_t vfloat8e5m2m2_t;
459typedef __rvv_float8e5m2m4_t vfloat8e5m2m4_t;
460typedef __rvv_float8e5m2m8_t vfloat8e5m2m8_t;
418461
419462#ifdef __cplusplus
420463}
lib/include/sifive_vector.h+18
......@@ -13,6 +13,24 @@
1313
1414#pragma clang riscv intrinsic sifive_vector
1515
16#define __riscv_intrinsic_xsfmm32a16f 1
17#define __riscv_intrinsic_xsfmm32a32f 1
18#define __riscv_intrinsic_xsfmm32a8f 1
19#define __riscv_intrinsic_xsfmm32a8i 1
20#define __riscv_intrinsic_xsfmm32a 1
21#define __riscv_intrinsic_xsfmm64a64f 1
22#define __riscv_intrinsic_xsfmmbase 1
23#define __riscv_intrinsic_xsfvcp 1
24#define __riscv_intrinsic_xsfvfbfexp16e 1
25#define __riscv_intrinsic_xsfvfexp16e 1
26#define __riscv_intrinsic_xsfvfexp32e 1
27#define __riscv_intrinsic_xsfvfexpa 1
28#define __riscv_intrinsic_xsfvfexpa64e 1
29#define __riscv_intrinsic_xsfvfnrclipxfqf 1
30#define __riscv_intrinsic_xsfvfwmaccqqq 1
31#define __riscv_intrinsic_xsfvqmaccdod 1
32#define __riscv_intrinsic_xsfvqmaccqoq 1
33
1634#define __riscv_sf_vc_x_se_u8mf4(p27_26, p24_20, p11_7, rs1, vl) \
1735 __riscv_sf_vc_x_se(p27_26, p24_20, p11_7, (uint8_t)rs1, 8, 6, vl)
1836#define __riscv_sf_vc_x_se_u8mf2(p27_26, p24_20, p11_7, rs1, vl) \
lib/include/spirvintrin.h+2-29
......@@ -27,9 +27,6 @@ _Pragma("omp begin declare variant match(device = {arch(spirv64)})");
2727#define __gpu_global __attribute__((address_space(1)))
2828#define __gpu_generic __attribute__((address_space(4)))
2929
30// Attribute to declare a function as a kernel.
31#define __gpu_kernel __attribute__((device_kernel, visibility("protected")))
32
3330// Returns the number of workgroups in the 'x' dimension of the grid.
3431_DEFAULT_FN_ATTRS static __inline__ uint32_t __gpu_num_blocks_x(void) {
3532 return __builtin_spirv_num_workgroups(0);
......@@ -146,37 +143,13 @@ __gpu_shuffle_idx_u32(uint64_t __lane_mask, uint32_t __idx, uint32_t __x,
146143 return __builtin_spirv_subgroup_shuffle(__x, __lane);
147144}
148145
149// Returns a bitmask marking all lanes that have the same value of __x.
150_DEFAULT_FN_ATTRS static __inline__ uint64_t
151__gpu_match_any_u32(uint64_t __lane_mask, uint32_t __x) {
152 return __gpu_match_any_u32_impl(__lane_mask, __x);
153}
154
155// Returns a bitmask marking all lanes that have the same value of __x.
156_DEFAULT_FN_ATTRS static __inline__ uint64_t
157__gpu_match_any_u64(uint64_t __lane_mask, uint64_t __x) {
158 return __gpu_match_any_u64_impl(__lane_mask, __x);
159}
160
161// Returns the current lane mask if every lane contains __x.
162_DEFAULT_FN_ATTRS static __inline__ uint64_t
163__gpu_match_all_u32(uint64_t __lane_mask, uint32_t __x) {
164 return __gpu_match_all_u32_impl(__lane_mask, __x);
165}
166
167// Returns the current lane mask if every lane contains __x.
168_DEFAULT_FN_ATTRS static __inline__ uint64_t
169__gpu_match_all_u64(uint64_t __lane_mask, uint64_t __x) {
170 return __gpu_match_all_u64_impl(__lane_mask, __x);
171}
172
173146// SPIR-V does not expose this, always return false.
174_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_local(void *ptr) {
147_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_local(const void *ptr) {
175148 return 0;
176149}
177150
178151// SPIR-V does not expose this, always return false.
179_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_private(void *ptr) {
152_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_private(const void *ptr) {
180153 return 0;
181154}
182155
lib/include/stdint.h+5-14
......@@ -805,25 +805,16 @@ typedef __UINTMAX_TYPE__ uintmax_t;
805805#endif
806806
807807/* C99 7.18.3 Limits of other integer types. */
808#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
809#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
810#ifdef __WINT_UNSIGNED__
811# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
812# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
813#else
814# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
815# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
816#endif
808#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
809#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
810#define WINT_MIN __WINT_MIN__
811#define WINT_MAX __WINT_MAX__
817812
818813#ifndef WCHAR_MAX
819814# define WCHAR_MAX __WCHAR_MAX__
820815#endif
821816#ifndef WCHAR_MIN
822# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
823# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
824# else
825# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
826# endif
817#define WCHAR_MIN __WCHAR_MIN__
827818#endif
828819
829820/* 7.18.4.2 Macros for greatest-width integer constants. */
lib/include/vecintrin.h+1-1
......@@ -207,7 +207,7 @@ vec_insert(unsigned long long __scalar, __vector unsigned long long __vec,
207207#if __ARCH__ >= 12
208208static inline __ATTRS_o_ai __vector float
209209vec_insert(float __scalar, __vector float __vec, int __index) {
210 __vec[__index & 1] = __scalar;
210 __vec[__index & 3] = __scalar;
211211 return __vec;
212212}
213213#endif
lib/include/wasm_simd128.h+17
......@@ -45,6 +45,7 @@ typedef int __i32x2 __attribute__((__vector_size__(8), __aligned__(8)));
4545typedef unsigned int __u32x2
4646 __attribute__((__vector_size__(8), __aligned__(8)));
4747typedef float __f32x2 __attribute__((__vector_size__(8), __aligned__(8)));
48typedef __fp16 __f16x4 __attribute__((__vector_size__(8), __aligned__(8)));
4849
4950#define __DEFAULT_FN_ATTRS \
5051 __attribute__((__always_inline__, __nodebug__, __target__("simd128"), \
......@@ -2010,6 +2011,22 @@ static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_convert_u16x8(v128_t __a) {
20102011 return (v128_t) __builtin_convertvector((__u16x8)__a, __f16x8);
20112012}
20122013
2014static __inline__ v128_t __FP16_FN_ATTRS
2015wasm_f32x4_promote_low_f16x8(v128_t __a) {
2016 return (v128_t) __builtin_convertvector(
2017 (__f16x4){((__f16x8)__a)[0], ((__f16x8)__a)[1], ((__f16x8)__a)[2],
2018 ((__f16x8)__a)[3]},
2019 __f32x4);
2020}
2021
2022static __inline__ v128_t __FP16_FN_ATTRS
2023wasm_f16x8_demote_f32x4_zero(v128_t __a) {
2024 return (v128_t) __builtin_convertvector(
2025 __builtin_shufflevector((__f32x4)__a, (__f32x4){0, 0, 0, 0}, 0, 1, 2, 3,
2026 4, 5, 6, 7),
2027 __f16x8);
2028}
2029
20132030static __inline__ v128_t __FP16_FN_ATTRS wasm_f16x8_relaxed_madd(v128_t __a,
20142031 v128_t __b,
20152032 v128_t __c) {
lib/include/xmmintrin.h+8-7
......@@ -341,7 +341,8 @@ _mm_rsqrt_ps(__m128 __a)
341341/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
342342/// minimum value between both operands. The upper 96 bits are copied from
343343/// the upper 96 bits of the first source operand.
344static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_min_ss(__m128 __a, __m128 __b) {
344static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_ss(__m128 __a,
345 __m128 __b) {
345346 return __builtin_ia32_minss((__v4sf)__a, (__v4sf)__b);
346347}
347348
......@@ -384,7 +385,8 @@ static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_min_ps(__m128 __a,
384385/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the
385386/// maximum value between both operands. The upper 96 bits are copied from
386387/// the upper 96 bits of the first source operand.
387static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_max_ss(__m128 __a, __m128 __b) {
388static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_max_ss(__m128 __a,
389 __m128 __b) {
388390 return __builtin_ia32_maxss((__v4sf)__a, (__v4sf)__b);
389391}
390392
......@@ -2569,11 +2571,10 @@ _mm_avg_pu16(__m64 __a, __m64 __b) {
25692571/// \returns A 64-bit integer vector whose lower 16 bits contain the sums of the
25702572/// sets of absolute differences between both operands. The upper bits are
25712573/// cleared.
2572static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
2573_mm_sad_pu8(__m64 __a, __m64 __b)
2574{
2575 return __trunc64(__builtin_ia32_psadbw128((__v16qi)__zext128(__a),
2576 (__v16qi)__zext128(__b)));
2574static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
2575_mm_sad_pu8(__m64 __a, __m64 __b) {
2576 return __trunc64(__builtin_ia32_psadbw128((__v16qu)__zext128(__a),
2577 (__v16qu)__zext128(__b)));
25772578}
25782579
25792580#if defined(__cplusplus)
lib/libc/include/any-darwin-any/os/os_sync_wait_on_address.h created+378
......@@ -0,0 +1,378 @@
1/*
2 * Copyright (c) 2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20
21#ifndef __OS_SYNC_WAIT_ON_ADDRESS__
22#define __OS_SYNC_WAIT_ON_ADDRESS__
23
24#include <Availability.h>
25#include <stddef.h>
26#include <stdint.h>
27#include <os/base.h>
28#include <os/clock.h>
29
30OS_ASSUME_NONNULL_BEGIN
31
32/*! @header
33 * Low-level Darwin's futex style APIs.
34 */
35
36__BEGIN_DECLS
37
38#define OS_WAIT_ON_ADDR_AVAILABILITY \
39 __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
40
41/*!
42 * @typedef os_sync_wait_on_address_flags_t
43 *
44 * @const OS_SYNC_WAIT_ON_ADDRESS_NONE
45 * This flag should be used as a default flag when no other flags listed below
46 * are required.
47 *
48 * @const OS_SYNC_WAIT_ON_ADDRESS_SHARED
49 * This flag should be used when synchronizing among multiple processes by
50 * placing the @addr passed to os_sync_wait_on_address and its variants
51 * in a shared memory region.
52 *
53 * When using this flag, it is important to pass OS_SYNC_WAKE_BY_ADDRESS_SHARED
54 * flag along with the exact same @addr to os_sync_wake_by_address_any and
55 * its variants to correctly find and wake up blocked waiters on the @addr.
56 *
57 * This flag should not be used when synchronizing among multiple threads of
58 * a single process. It allows the kernel to perform performance optimizations
59 * as the @addr is local to the calling process.
60 */
61OS_OPTIONS(os_sync_wait_on_address_flags, uint32_t,
62 OS_SYNC_WAIT_ON_ADDRESS_NONE
63 OS_WAIT_ON_ADDR_AVAILABILITY = 0x00000000,
64 OS_SYNC_WAIT_ON_ADDRESS_SHARED
65 OS_WAIT_ON_ADDR_AVAILABILITY = 0x00000001,
66);
67
68/*!
69 * @function os_sync_wait_on_address
70 *
71 * This function provides an atomic compare-and-wait functionality that
72 * can be used to implement other higher level synchronization primitives.
73 *
74 * It reads a value from @addr, compares it to expected @value and blocks
75 * the calling thread if they are equal. This sequence of operations is
76 * done atomically with respect to other concurrent operations that can
77 * be performed on this @addr by other threads using this same function
78 * or os_sync_wake_by_addr variants. At this point, the blocked calling
79 * thread is considered to be a waiter on this @addr, waiting to be woken
80 * up by a call to os_sync_wake_by_addr variants. If the value at @addr
81 * turns out to be different than expected, the calling thread returns
82 * immediately without blocking.
83 *
84 * This function is expected to be used for implementing synchronization
85 * primitives that do not have a sense of ownership (e.g. condition
86 * variables, semaphores) as it does not provide priority inversion avoidance.
87 * For locking primitives, it is recommended that you use existing OS
88 * primitives such as os_unfair_lock API family / pthread mutex or
89 * std::mutex.
90 *
91 * @param addr
92 * The userspace address to be used for atomic compare-and-wait.
93 * This address must be aligned to @size.
94 *
95 * @param value
96 * The value expected at @addr.
97 *
98 * @param size
99 * The size of @value, in bytes. This can be either 4 or 8 today.
100 * For @value of @size 4 bytes, the upper 4 bytes of @value are ignored.
101 *
102 * @param flags
103 * Flags to alter behavior of os_sync_wait_on_address.
104 * See os_sync_wait_on_address_flags_t.
105 *
106 * @return
107 * If the calling thread is woken up by a call to os_sync_wake_by_addr
108 * variants or the value at @addr is different than expected, this function
109 * returns successfully and the return value indicates the number
110 * of outstanding waiters blocked on this address.
111 * In the event of an error, returns -1 with errno set to indicate the error.
112 *
113 * EINVAL : Invalid flags or size.
114 * EINVAL : The @addr passed is NULL or misaligned.
115 * EINVAL : The operation associated with existing kernel state
116 * at this @addr is inconsistent with what the caller
117 * has requested.
118 * It is important to make sure consistent values are
119 * passed across wait and wake APIs for @addr, @size
120 * and the shared memory specification
121 * (See os_sync_wait_on_address_flags_t).
122 *
123 * It is possible for the os_sync_wait_on_address and its variants to perform
124 * an early return in the event of following errors where user may want to
125 * re-try the wait operation. E.g. low memory conditions could cause such early
126 * return.
127 * It is important to read the current value at the @addr before re-trying
128 * to ensure that the new value still requires waiting on @addr.
129 *
130 * ENOMEM : Unable to allocate memory for kernel internal data
131 * structures.
132 * EINTR : The syscall was interrupted / spurious wake up.
133 * EFAULT : Unable to read value from the @addr. Kernel copyin failed.
134 * It is possible to receive EFAULT error in following cases:
135 * 1. The @addr is an invalid address. This is a programmer error.
136 * 2. The @addr is valid; but, this is a transient error such as
137 * due to low memory conditions. User may want to re-try the wait
138 * operation.
139 * Following code snippet illustrates a possible re-try loop.
140 * <code>
141 * retry:
142 * current = atomic_load_explicit(addr, memory_order_relaxed);
143 * if (current != expected) {
144 * int ret = os_sync_wait_on_address(addr, current, size, flags);
145 * if ((ret < 0) && ((errno == EINTR) || (errno == EFAULT))) {
146 * goto retry;
147 * }
148 * }
149 * </code>
150 */
151OS_WAIT_ON_ADDR_AVAILABILITY
152OS_EXPORT OS_NOTHROW OS_NONNULL_ALL
153int
154os_sync_wait_on_address(void *addr,
155 uint64_t value,
156 size_t size,
157 os_sync_wait_on_address_flags_t flags);
158
159/*!
160 * @function os_sync_wait_on_address_with_deadline
161 *
162 * This function is a variant of os_sync_wait_on_address that
163 * allows the calling thread to specify a deadline
164 * until which it is willing to block.
165 *
166 * @param addr
167 * The userspace address to be used for atomic compare-and-wait.
168 * This address must be aligned to @size.
169 *
170 * @param value
171 * The value expected at @addr.
172 *
173 * @param size
174 * The size of @value, in bytes. This can be either 4 or 8 today.
175 * For @value of @size 4 bytes, the upper 4 bytes of @value are ignored.
176 *
177 * @param flags
178 * Flags to alter behavior of os_sync_wait_on_address_with_deadline.
179 * See os_sync_wait_on_address_flags_t.
180 *
181 * @param clockid
182 * This value anchors @deadline argument to a specific clock id.
183 * See os_clockid_t.
184 *
185 * @param deadline
186 * This value is used to specify a deadline until which the calling
187 * thread is willing to block.
188 * Passing zero for the @deadline results in an error being returned.
189 * It is recommended to use os_sync_wait_on_address API to block
190 * indefinitely until woken up by a call to os_sync_wake_by_address_any
191 * or os_sync_wake_by_address_all APIs.
192 *
193 * @return
194 * If the calling thread is woken up by a call to os_sync_wake_by_addr
195 * variants or the value at @addr is different than expected, this function
196 * returns successfully and the return value indicates the number
197 * of outstanding waiters blocked on this address.
198 * In the event of an error, returns -1 with errno set to indicate the error.
199 *
200 * In addition to errors returned by os_sync_wait_on_address, this function
201 * can return the following additional error codes.
202 *
203 * EINVAL : Invalid clock id.
204 * EINVAL : The @deadline passed is 0.
205 * ETIMEDOUT : Deadline expired.
206 */
207OS_WAIT_ON_ADDR_AVAILABILITY
208OS_EXPORT OS_NOTHROW OS_NONNULL_ALL
209int
210os_sync_wait_on_address_with_deadline(void *addr,
211 uint64_t value,
212 size_t size,
213 os_sync_wait_on_address_flags_t flags,
214 os_clockid_t clockid,
215 uint64_t deadline);
216
217/*!
218 * @function os_sync_wait_on_address_with_timeout
219 *
220 * This function is a variant of os_sync_wait_on_address that
221 * allows the calling thread to specify a timeout
222 * until which it is willing to block.
223 *
224 * @param addr
225 * The userspace address to be used for atomic compare-and-wait.
226 * This address must be aligned to @size.
227 *
228 * @param value
229 * The value expected at @addr.
230 *
231 * @param size
232 * The size of @value, in bytes. This can be either 4 or 8 today.
233 * For @value of @size 4 bytes, the upper 4 bytes of @value are ignored.
234 *
235 * @param flags
236 * Flags to alter behavior of os_sync_wait_on_address_with_timeout.
237 * See os_sync_wait_on_address_flags_t.
238 *
239 * @param clockid
240 * This value anchors @timeout_ns argument to a specific clock id.
241 * See os_clockid_t.
242 *
243 * @param timeout_ns
244 * This value is used to specify a timeout in nanoseconds until which
245 * the calling thread is willing to block.
246 * Passing zero for the @timeout_ns results in an error being returned.
247 * It is recommended to use os_sync_wait_on_address API to block
248 * indefinitely until woken up by a call to os_sync_wake_by_address_any
249 * or os_sync_wake_by_address_all APIs.
250 *
251 * @return
252 * If the calling thread is woken up by a call to os_sync_wake_by_address
253 * variants or the value at @addr is different than expected, this function
254 * returns successfully and the return value indicates the number
255 * of outstanding waiters blocked on this address.
256 * In the event of an error, returns -1 with errno set to indicate the error.
257 *
258 * In addition to errors returned by os_sync_wait_on_address, this function
259 * can return the following additional error codes.
260 *
261 * EINVAL : Invalid clock id.
262 * EINVAL : The @timeout_ns passed is 0.
263 * ETIMEDOUT : Timeout expired.
264 */
265OS_WAIT_ON_ADDR_AVAILABILITY
266OS_EXPORT OS_NOTHROW OS_NONNULL_ALL
267int
268os_sync_wait_on_address_with_timeout(void *addr,
269 uint64_t value,
270 size_t size,
271 os_sync_wait_on_address_flags_t flags,
272 os_clockid_t clockid,
273 uint64_t timeout_ns);
274
275/*!
276 * @typedef os_sync_wake_by_address_flags_t
277 *
278 * @const OS_SYNC_WAKE_BY_ADDRESS_NONE
279 * This flag should be used as a default flag when no other flags listed below
280 * are required.
281 *
282 * @const OS_SYNC_WAKE_BY_ADDRESS_SHARED
283 * This flag should be used when synchronizing among multiple processes by
284 * placing the @addr passed to os_sync_wake_by_address_any and its variants
285 * in a shared memory region.
286 *
287 * When using this flag, it is important to pass OS_SYNC_WAIT_ON_ADDRESS_SHARED
288 * flag along with the exact same @addr to os_sync_wait_on_address and
289 * its variants to correctly find and wake up blocked waiters on the @addr.
290 *
291 * This flag should not be used when synchronizing among multiple threads of
292 * a single process. It allows the kernel to perform performance optimizations
293 * as the @addr is local the calling process.
294 */
295OS_OPTIONS(os_sync_wake_by_address_flags, uint32_t,
296 OS_SYNC_WAKE_BY_ADDRESS_NONE
297 OS_WAIT_ON_ADDR_AVAILABILITY = 0x00000000,
298 OS_SYNC_WAKE_BY_ADDRESS_SHARED
299 OS_WAIT_ON_ADDR_AVAILABILITY = 0x00000001,
300);
301
302/*!
303 * @function os_sync_wake_by_address_any
304 *
305 * This function wakes up one waiter out of all those blocked in os_sync_wait_on_address
306 * or its variants on the @addr. No guarantee is provided about which
307 * specific waiter is woken up.
308 *
309 * @param addr
310 * The userspace address to be used for waking up the blocked waiter.
311 * It should be same as what is passed to os_sync_wait_on_address or its variants.
312 *
313 * @param size
314 * The size of lock value, in bytes. This can be either 4 or 8 today.
315 * It should be same as what is passed to os_sync_wait_on_address or its variants.
316 *
317 * @param flags
318 * Flags to alter behavior of os_sync_wake_by_address_any.
319 * See os_sync_wake_by_address_flags_t.
320 *
321 * @return
322 * Returns 0 on success.
323 * In the event of an error, returns -1 with errno set to indicate the error.
324 *
325 * EINVAL : Invalid flags or size.
326 * EINVAL : The @addr passed is NULL.
327 * EINVAL : The operation associated with existing kernel state
328 * at this @addr is inconsistent with what caller
329 * has requested.
330 * It is important to make sure consistent values are
331 * passed across wait and wake APIs for @addr, @size
332 * and the shared memory specification
333 * (See os_sync_wake_by_address_flags_t).
334 * ENOENT : No waiter(s) found waiting on the @addr.
335 */
336OS_WAIT_ON_ADDR_AVAILABILITY
337OS_EXPORT OS_NOTHROW OS_NONNULL_ALL
338int
339os_sync_wake_by_address_any(void *addr,
340 size_t size,
341 os_sync_wake_by_address_flags_t flags);
342
343/*!
344 * @function os_sync_wake_by_address_all
345 *
346 * This function is a variant of os_sync_wake_by_address_any that wakes up all waiters
347 * blocked in os_sync_wait_on_address or its variants.
348 *
349 * @param addr
350 * The userspace address to be used for waking up the blocked waiters.
351 * It should be same as what is passed to os_sync_wait_on_address or its variants.
352 *
353 * @param size
354 * The size of lock value, in bytes. This can be either 4 or 8 today.
355 * It should be same as what is passed to os_sync_wait_on_address or its variants.
356 *
357 * @param flags
358 * Flags to alter behavior of os_sync_wake_by_address_all.
359 * See os_sync_wake_by_address_flags_t.
360 *
361 * @return
362 * Returns 0 on success.
363 * In the event of an error, returns -1 with errno set to indicate the error.
364 *
365 * This function returns same error codes as returned by os_sync_wait_on_address.
366 */
367OS_WAIT_ON_ADDR_AVAILABILITY
368OS_EXPORT OS_NOTHROW OS_NONNULL_ALL
369int
370os_sync_wake_by_address_all(void *addr,
371 size_t size,
372 os_sync_wake_by_address_flags_t flags);
373
374__END_DECLS
375
376OS_ASSUME_NONNULL_END
377
378#endif // __OS_SYNC_WAIT_ON_ADDRESS__
lib/libc/include/generic-netbsd/machine/signal.h+1-2
......@@ -33,8 +33,7 @@
3333#define _RISCV_SIGNAL_H_
3434
3535#ifndef _LOCORE
36// zig patch: Clang does not define __SIG_ATOMIC_TYPE__
37typedef int sig_atomic_t;
36typedef __SIG_ATOMIC_TYPE__ sig_atomic_t;
3837#endif
3938
4039#endif /* _RISCV_SIGNAL_H_ */
lib/libc/include/generic-netbsd/riscv/signal.h+1-2
......@@ -33,8 +33,7 @@
3333#define _RISCV_SIGNAL_H_
3434
3535#ifndef _LOCORE
36// zig patch: Clang does not define __SIG_ATOMIC_TYPE__
37typedef int sig_atomic_t;
36typedef __SIG_ATOMIC_TYPE__ sig_atomic_t;
3837#endif
3938
4039#endif /* _RISCV_SIGNAL_H_ */
lib/libc/include/generic-netbsd/riscv/wchar_limits.h+1-11
......@@ -1,13 +1,3 @@
11/* $NetBSD: wchar_limits.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
22
3// zig patch: https://github.com/llvm/llvm-project/issues/199678
4#ifndef _RISCV_WCHAR_LIMITS_H_
5#define _RISCV_WCHAR_LIMITS_H_
6
7#define WCHAR_MIN (-0x7fffffff-1) /* wchar_t */
8#define WCHAR_MAX 0x7fffffff /* wchar_t */
9
10#define WINT_MIN (-0x7fffffff-1) /* wint_t */
11#define WINT_MAX 0x7fffffff /* wint_t */
12
13#endif /* !_RISCV_WCHAR_LIMITS_H_ */
3#include <sys/common_wchar_limits.h>
lib/libc/include/riscv32-netbsd-none/machine/wchar_limits.h deleted-4
......@@ -1,4 +0,0 @@
1/* $NetBSD: wchar_limits.h,v 1.2 2005/12/11 12:17:12 christos Exp $ */
2
3// zig patch: https://github.com/llvm/llvm-project/issues/199678
4#include <riscv/wchar_limits.h>
lib/libc/include/riscv64-netbsd-none/machine/wchar_limits.h deleted-4
......@@ -1,4 +0,0 @@
1/* $NetBSD: wchar_limits.h,v 1.2 2005/12/11 12:17:12 christos Exp $ */
2
3// zig patch: https://github.com/llvm/llvm-project/issues/199678
4#include <riscv/wchar_limits.h>
lib/libcxx/include/__algorithm/clamp.h+4-2
......@@ -17,9 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20#if _LIBCPP_STD_VER >= 17
21
2022_LIBCPP_BEGIN_NAMESPACE_STD
2123
22#if _LIBCPP_STD_VER >= 17
2324template <class _Tp, class _Compare>
2425[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
2526clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
......@@ -37,8 +38,9 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
3738 _LIBCPP_LIFETIMEBOUND const _Tp& __hi) {
3839 return std::clamp(__v, __lo, __hi, __less<>());
3940}
40#endif
4141
4242_LIBCPP_END_NAMESPACE_STD
4343
44#endif // _LIBCPP_STD_VER >= 17
45
4446#endif // _LIBCPP___ALGORITHM_CLAMP_H
lib/libcxx/include/__algorithm/copy.h+16-15
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/copy_move_common.h>
1313#include <__algorithm/for_each_segment.h>
14#include <__algorithm/in_out_result.h>
1415#include <__algorithm/min.h>
1516#include <__algorithm/specialized_algorithms.h>
1617#include <__config>
......@@ -19,7 +20,6 @@
1920#include <__type_traits/common_type.h>
2021#include <__type_traits/enable_if.h>
2122#include <__utility/move.h>
22#include <__utility/pair.h>
2323
2424#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2525# pragma GCC system_header
......@@ -35,7 +35,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
3535copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result);
3636
3737template <class _InIter, class _Sent, class _OutIter>
38inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter);
38inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
39 __copy(_InIter, _Sent, _OutIter);
3940
4041struct __copy_impl {
4142 template <class _InIter,
......@@ -45,7 +46,7 @@ struct __copy_impl {
4546 __iterator_pair<_InIter, _Sent>,
4647 __single_iterator<_OutIter> >::__has_algorithm,
4748 int> = 0>
48 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
49 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
4950 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
5051 while (__first != __last) {
5152 *__result = *__first;
......@@ -53,7 +54,7 @@ struct __copy_impl {
5354 ++__result;
5455 }
5556
56 return std::make_pair(std::move(__first), std::move(__result));
57 return {std::move(__first), std::move(__result)};
5758 }
5859
5960 template <class _InIter,
......@@ -63,20 +64,20 @@ struct __copy_impl {
6364 __iterator_pair<_InIter, _Sent>,
6465 __single_iterator<_OutIter> >::__has_algorithm,
6566 int> = 0>
66 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static pair<_InIter, _OutIter>
67 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static __in_out_result<_InIter, _OutIter>
6768 operator()(_InIter __first, _Sent __last, _OutIter __result) {
6869 return __specialized_algorithm<_Algorithm::__copy, __iterator_pair<_InIter, _Sent>, __single_iterator<_OutIter> >()(
6970 std::move(__first), std::move(__last), std::move(__result));
7071 }
7172
7273 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
73 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
74 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
7475 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
7576 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
7677 std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) {
77 __result = std::__copy(std::move(__lfirst), std::move(__llast), std::move(__result)).second;
78 __result = std::__copy(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_;
7879 });
79 return std::make_pair(__last, std::move(__result));
80 return {__last, std::move(__result)};
8081 }
8182
8283 template <class _InIter,
......@@ -84,14 +85,14 @@ struct __copy_impl {
8485 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
8586 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
8687 int> = 0>
87 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
88 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
8889 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
8990 using _Traits = __segmented_iterator_traits<_OutIter>;
9091 using _DiffT =
9192 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
9293
9394 if (__first == __last)
94 return std::make_pair(std::move(__first), std::move(__result));
95 return {std::move(__first), std::move(__result)};
9596
9697 auto __local_first = _Traits::__local(__result);
9798 auto __segment_iterator = _Traits::__segment(__result);
......@@ -99,10 +100,10 @@ struct __copy_impl {
99100 auto __local_last = _Traits::__end(__segment_iterator);
100101 auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
101102 auto __iters = std::__copy(__first, __first + __size, __local_first);
102 __first = std::move(__iters.first);
103 __first = std::move(__iters.__in_);
103104
104105 if (__first == __last)
105 return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second)));
106 return {std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.__out_))};
106107
107108 __local_first = _Traits::__begin(++__segment_iterator);
108109 }
......@@ -110,14 +111,14 @@ struct __copy_impl {
110111
111112 // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
112113 template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
113 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
114 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
114115 operator()(_In* __first, _In* __last, _Out* __result) const {
115116 return std::__copy_trivial_impl(__first, __last, __result);
116117 }
117118};
118119
119120template <class _InIter, class _Sent, class _OutIter>
120pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
121__in_out_result<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
121122__copy(_InIter __first, _Sent __last, _OutIter __result) {
122123 return std::__copy_move_unwrap_iters<__copy_impl>(std::move(__first), std::move(__last), std::move(__result));
123124}
......@@ -125,7 +126,7 @@ __copy(_InIter __first, _Sent __last, _OutIter __result) {
125126template <class _InputIterator, class _OutputIterator>
126127_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
127128copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
128 return std::__copy(__first, __last, __result).second;
129 return std::__copy(__first, __last, __result).__out_;
129130}
130131
131132_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/copy_backward.h+18-17
......@@ -12,6 +12,7 @@
1212#include <__algorithm/copy_move_common.h>
1313#include <__algorithm/copy_n.h>
1414#include <__algorithm/for_each_segment.h>
15#include <__algorithm/in_out_result.h>
1516#include <__algorithm/iterator_operations.h>
1617#include <__algorithm/min.h>
1718#include <__config>
......@@ -23,7 +24,6 @@
2324#include <__type_traits/enable_if.h>
2425#include <__type_traits/is_constructible.h>
2526#include <__utility/move.h>
26#include <__utility/pair.h>
2727
2828#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2929# pragma GCC system_header
......@@ -35,7 +35,7 @@ _LIBCPP_PUSH_MACROS
3535_LIBCPP_BEGIN_NAMESPACE_STD
3636
3737template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter>
3939__copy_backward(_InIter __first, _Sent __last, _OutIter __result);
4040
4141template <class _Cp, bool _IsConst>
......@@ -159,7 +159,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __bit_iterator<_Cp, false> _
159159template <class _AlgPolicy>
160160struct __copy_backward_impl {
161161 template <class _InIter, class _Sent, class _OutIter>
162 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
162 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
163163 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
164164 auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
165165 auto __original_last_iter = __last_iter;
......@@ -168,17 +168,17 @@ struct __copy_backward_impl {
168168 *--__result = *--__last_iter;
169169 }
170170
171 return std::make_pair(std::move(__original_last_iter), std::move(__result));
171 return {std::move(__original_last_iter), std::move(__result)};
172172 }
173173
174174 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
175 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
175 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
176176 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
177177 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
178178 std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) {
179 __result = std::__copy_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).second;
179 __result = std::__copy_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_;
180180 });
181 return std::make_pair(__last, std::move(__result));
181 return {__last, std::move(__result)};
182182 }
183183
184184 template <class _InIter,
......@@ -186,7 +186,7 @@ struct __copy_backward_impl {
186186 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
187187 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
188188 int> = 0>
189 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
189 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
190190 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
191191 using _Traits = __segmented_iterator_traits<_OutIter>;
192192 auto __orig_last = __last;
......@@ -194,7 +194,7 @@ struct __copy_backward_impl {
194194
195195 // When the range contains no elements, __result might not be a valid iterator
196196 if (__first == __last)
197 return std::make_pair(__first, __result);
197 return {__first, __result};
198198
199199 auto __local_last = _Traits::__local(__result);
200200 while (true) {
......@@ -203,36 +203,37 @@ struct __copy_backward_impl {
203203
204204 auto __local_first = _Traits::__begin(__segment_iterator);
205205 auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
206 auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
206 auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).__out_;
207207 __last -= __size;
208208
209209 if (__first == __last)
210 return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter)));
210 return {std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))};
211211 --__segment_iterator;
212212 __local_last = _Traits::__end(__segment_iterator);
213213 }
214214 }
215215
216216 template <class _Cp, bool _IsConst>
217 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
217 _LIBCPP_HIDE_FROM_ABI
218 _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
218219 operator()(__bit_iterator<_Cp, _IsConst> __first,
219220 __bit_iterator<_Cp, _IsConst> __last,
220221 __bit_iterator<_Cp, false> __result) {
221222 if (__last.__ctz_ == __result.__ctz_)
222 return std::make_pair(__last, std::__copy_backward_aligned(__first, __last, __result));
223 return std::make_pair(__last, std::__copy_backward_unaligned(__first, __last, __result));
223 return {__last, std::__copy_backward_aligned(__first, __last, __result)};
224 return {__last, std::__copy_backward_unaligned(__first, __last, __result)};
224225 }
225226
226227 // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
227228 template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
228 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
229 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
229230 operator()(_In* __first, _In* __last, _Out* __result) const {
230231 return std::__copy_backward_trivial_impl(__first, __last, __result);
231232 }
232233};
233234
234235template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
235_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
236_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2>
236237__copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
237238 return std::__copy_move_unwrap_iters<__copy_backward_impl<_AlgPolicy> >(
238239 std::move(__first), std::move(__last), std::move(__result));
......@@ -245,7 +246,7 @@ copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _
245246 std::is_copy_constructible<_BidirectionalIterator1>::value,
246247 "Iterators must be copy constructible.");
247248
248 return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
249 return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_;
249250}
250251
251252_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/copy_if.h+4-3
......@@ -9,6 +9,7 @@
99#ifndef _LIBCPP___ALGORITHM_COPY_IF_H
1010#define _LIBCPP___ALGORITHM_COPY_IF_H
1111
12#include <__algorithm/in_out_result.h>
1213#include <__config>
1314#include <__functional/identity.h>
1415#include <__type_traits/invoke.h>
......@@ -25,7 +26,7 @@ _LIBCPP_PUSH_MACROS
2526_LIBCPP_BEGIN_NAMESPACE_STD
2627
2728template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred>
28_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
29_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
2930__copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) {
3031 for (; __first != __last; ++__first) {
3132 if (std::__invoke(__pred, std::__invoke(__proj, *__first))) {
......@@ -33,14 +34,14 @@ __copy_if(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj
3334 ++__result;
3435 }
3536 }
36 return std::make_pair(std::move(__first), std::move(__result));
37 return {std::move(__first), std::move(__result)};
3738}
3839
3940template <class _InputIterator, class _OutputIterator, class _Predicate>
4041inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
4142copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
4243 __identity __proj;
43 return std::__copy_if(__first, __last, __result, __pred, __proj).second;
44 return std::__copy_if(__first, __last, __result, __pred, __proj).__out_;
4445}
4546
4647_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/copy_move_common.h+9-12
......@@ -9,21 +9,18 @@
99#ifndef _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H
1010#define _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H
1111
12#include <__algorithm/in_out_result.h>
1213#include <__algorithm/unwrap_iter.h>
1314#include <__algorithm/unwrap_range.h>
1415#include <__config>
1516#include <__cstddef/size_t.h>
16#include <__iterator/iterator_traits.h>
17#include <__memory/pointer_traits.h>
1817#include <__string/constexpr_c_functions.h>
1918#include <__type_traits/enable_if.h>
2019#include <__type_traits/is_always_bitcastable.h>
21#include <__type_traits/is_constant_evaluated.h>
2220#include <__type_traits/is_constructible.h>
2321#include <__type_traits/is_trivially_assignable.h>
2422#include <__type_traits/is_volatile.h>
2523#include <__utility/move.h>
26#include <__utility/pair.h>
2724
2825#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2926# pragma GCC system_header
......@@ -57,24 +54,24 @@ struct __can_lower_move_assignment_to_memmove {
5754// `memmove` algorithms implementation.
5855
5956template <class _In, class _Out>
60_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
57_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
6158__copy_trivial_impl(_In* __first, _In* __last, _Out* __result) {
6259 const size_t __n = static_cast<size_t>(__last - __first);
6360
6461 std::__constexpr_memmove(__result, __first, __element_count(__n));
6562
66 return std::make_pair(__last, __result + __n);
63 return {__last, __result + __n};
6764}
6865
6966template <class _In, class _Out>
70_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
67_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
7168__copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
7269 const size_t __n = static_cast<size_t>(__last - __first);
7370 __result -= __n;
7471
7572 std::__constexpr_memmove(__result, __first, __element_count(__n));
7673
77 return std::make_pair(__last, __result);
74 return {__last, __result};
7875}
7976
8077// Iterator unwrapping and dispatching to the correct overload.
......@@ -88,12 +85,12 @@ template <class _Algorithm,
8885 class _Sent,
8986 class _OutIter,
9087 __enable_if_t<__can_rewrap<_InIter, _OutIter>::value, int> = 0>
91_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
88_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __in_out_result<_InIter, _OutIter>
9289__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
9390 auto __range = std::__unwrap_range(__first, std::move(__last));
9491 auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
95 return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
96 std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
92 return {std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.__in_)),
93 std::__rewrap_iter(std::move(__out_first), std::move(__result.__out_))};
9794}
9895
9996template <class _Algorithm,
......@@ -101,7 +98,7 @@ template <class _Algorithm,
10198 class _Sent,
10299 class _OutIter,
103100 __enable_if_t<!__can_rewrap<_InIter, _OutIter>::value, int> = 0>
104_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
101_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 __in_out_result<_InIter, _OutIter>
105102__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
106103 return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first));
107104}
lib/libcxx/include/__algorithm/copy_n.h+5-5
......@@ -10,13 +10,13 @@
1010#define _LIBCPP___ALGORITHM_COPY_N_H
1111
1212#include <__algorithm/copy.h>
13#include <__algorithm/in_out_result.h>
1314#include <__algorithm/iterator_operations.h>
1415#include <__config>
1516#include <__iterator/iterator_traits.h>
1617#include <__type_traits/enable_if.h>
1718#include <__utility/convert_to_integral.h>
1819#include <__utility/move.h>
19#include <__utility/pair.h>
2020
2121#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2222# pragma GCC system_header
......@@ -31,7 +31,7 @@ template <class _AlgPolicy,
3131 class _InIter,
3232 class _OutIter,
3333 __enable_if_t<__has_random_access_iterator_category<_InIter>::value, int> = 0>
34_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
34_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter>
3535__copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) {
3636 return std::__copy(__first, __first + __n, std::move(__result));
3737}
......@@ -40,7 +40,7 @@ template <class _AlgPolicy,
4040 class _InIter,
4141 class _OutIter,
4242 __enable_if_t<!__has_random_access_iterator_category<_InIter>::value, int> = 0>
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InIter, _OutIter>
4444__copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_type<_InIter> __n, _OutIter __result) {
4545 while (__n != 0) {
4646 *__result = *__first;
......@@ -48,7 +48,7 @@ __copy_n(_InIter __first, typename _IterOps<_AlgPolicy>::template __difference_t
4848 ++__result;
4949 --__n;
5050 }
51 return std::make_pair(std::move(__first), std::move(__result));
51 return {std::move(__first), std::move(__result)};
5252}
5353
5454// The InputIterator case is handled specially here because it's been written in a way to avoid incrementing __first
......@@ -84,7 +84,7 @@ copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) {
8484 using _IntegralSize = decltype(std::__convert_to_integral(__n));
8585 _IntegralSize __converted = __n;
8686 return std::__copy_n<_ClassicAlgPolicy>(__first, __iterator_difference_type<_InputIterator>(__converted), __result)
87 .second;
87 .__out_;
8888}
8989
9090_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/equal.h+58-13
......@@ -11,15 +11,16 @@
1111#define _LIBCPP___ALGORITHM_EQUAL_H
1212
1313#include <__algorithm/comp.h>
14#include <__algorithm/find_segment_if.h>
1415#include <__algorithm/min.h>
1516#include <__algorithm/unwrap_iter.h>
1617#include <__config>
1718#include <__functional/identity.h>
1819#include <__fwd/bit_reference.h>
19#include <__iterator/distance.h>
2020#include <__iterator/iterator_traits.h>
21#include <__memory/pointer_traits.h>
21#include <__iterator/segmented_iterator.h>
2222#include <__string/constexpr_c_functions.h>
23#include <__type_traits/common_type.h>
2324#include <__type_traits/desugars_to.h>
2425#include <__type_traits/enable_if.h>
2526#include <__type_traits/invoke.h>
......@@ -27,6 +28,7 @@
2728#include <__type_traits/is_same.h>
2829#include <__type_traits/is_volatile.h>
2930#include <__utility/move.h>
31#include <__utility/unreachable.h>
3032
3133#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3234# pragma GCC system_header
......@@ -177,15 +179,6 @@ template <class _Cp,
177179 return std::__equal_unaligned(__first1, __last1, __first2);
178180}
179181
180template <class _InIter1, class _Sent1, class _InIter2, class _Pred, class _Proj1, class _Proj2>
181[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(
182 _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
183 for (; __first1 != __last1; ++__first1, (void)++__first2)
184 if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
185 return false;
186 return true;
187}
188
189182template <class _Tp,
190183 class _Up,
191184 class _BinaryPredicate,
......@@ -200,6 +193,58 @@ __equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&,
200193 return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1));
201194}
202195
196template <class _InIter1, class _Sent1, class _InIter2, class _Pred, class _Proj1, class _Proj2>
197[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl(
198 _InIter1 __first1, _Sent1 __last1, _InIter2 __first2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
199#ifndef _LIBCPP_CXX03_LANG
200 if constexpr (__has_random_access_iterator_category<_InIter1>::value &&
201 __has_random_access_iterator_category<_InIter2>::value) {
202 if constexpr (is_same<_InIter1, _Sent1>::value && __is_segmented_iterator_v<_InIter1>) {
203 using __local_iterator_t = typename __segmented_iterator_traits<_InIter1>::__local_iterator;
204 bool __is_equal = true;
205 std::__find_segment_if(__first1, __last1, [&](__local_iterator_t __lfirst, __local_iterator_t __llast) {
206 if (std::__equal_iter_impl(
207 std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __first2, __pred, __proj1, __proj2)) {
208 __first2 += __llast - __lfirst;
209 return __llast;
210 }
211 __is_equal = false;
212 return __lfirst;
213 });
214 return __is_equal;
215 } else if constexpr (__is_segmented_iterator_v<_InIter2>) {
216 using _Traits = __segmented_iterator_traits<_InIter2>;
217 using _DiffT =
218 typename common_type<__iterator_difference_type<_InIter1>, __iterator_difference_type<_InIter2> >::type;
219
220 if (__first1 == __last1)
221 return true;
222
223 auto __local_first = _Traits::__local(__first2);
224 auto __segment_iterator = _Traits::__segment(__first2);
225
226 while (true) {
227 auto __local_last = _Traits::__end(__segment_iterator);
228 auto __size = std::min<_DiffT>(__local_last - __local_first, __last1 - __first1);
229 if (!std::__equal_iter_impl(
230 __first1, __first1 + __size, std::__unwrap_iter(__local_first), __pred, __proj1, __proj2))
231 return false;
232
233 __first1 += __size;
234 if (__first1 == __last1)
235 return true;
236
237 __local_first = _Traits::__begin(++__segment_iterator);
238 }
239 }
240 }
241#endif
242 for (; __first1 != __last1; ++__first1, (void)++__first2)
243 if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2)))
244 return false;
245 return true;
246}
247
203248template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
204249[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
205250equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
......@@ -247,11 +292,11 @@ equal(_InputIterator1 __first1,
247292 _InputIterator2 __first2,
248293 _InputIterator2 __last2,
249294 _BinaryPredicate __pred) {
250 static constexpr bool __both_random_access =
295 constexpr bool __both_random_access =
251296 __has_random_access_iterator_category<_InputIterator1>::value &&
252297 __has_random_access_iterator_category<_InputIterator2>::value;
253298 if constexpr (__both_random_access) {
254 if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
299 if (__last1 - __first1 != __last2 - __first2)
255300 return false;
256301 }
257302 __identity __proj;
lib/libcxx/include/__algorithm/find.h+13-14
......@@ -10,6 +10,7 @@
1010#ifndef _LIBCPP___ALGORITHM_FIND_H
1111#define _LIBCPP___ALGORITHM_FIND_H
1212
13#include <__algorithm/find_if.h>
1314#include <__algorithm/find_segment_if.h>
1415#include <__algorithm/min.h>
1516#include <__algorithm/simd_utils.h>
......@@ -47,17 +48,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4748// generic implementation
4849template <class _Iter, class _Sent, class _Tp, class _Proj>
4950_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
50__find_loop(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
51 for (; __first != __last; ++__first)
52 if (std::__invoke(__proj, *__first) == __value)
53 break;
54 return __first;
51__find_generic(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
52 return std::__find_if(
53 std::move(__first),
54 std::move(__last),
55 [&]<class _ValT>(_ValT&& __val) -> bool { return __val == __value; },
56 __proj);
5557}
5658
5759template <class _Iter, class _Sent, class _Tp, class _Proj>
5860_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter
5961__find(_Iter __first, _Sent __last, const _Tp& __value, _Proj& __proj) {
60 return std::__find_loop(std::move(__first), std::move(__last), __value, __proj);
62 return std::__find_generic(std::move(__first), std::move(__last), __value, __proj);
6163}
6264
6365#if _LIBCPP_VECTORIZE_ALGORITHMS
......@@ -108,7 +110,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find_vectorized(_Tp* __first, _Tp* __last,
108110 }
109111
110112 __identity __proj;
111 return std::__find_loop(__first, __last, __value, __proj);
113 return std::__find_generic(__first, __last, __value, __proj);
112114}
113115#endif
114116
......@@ -138,7 +140,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __find(_Tp* __first, _T
138140# endif
139141 else {
140142 __identity __proj;
141 return std::__find_loop(__first, __last, __value, __proj);
143 return std::__find_generic(__first, __last, __value, __proj);
142144 }
143145}
144146#endif
......@@ -216,13 +218,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator
216218__find(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value, _Proj& __proj) {
217219 using __local_iterator = typename __segmented_iterator_traits<_SegmentedIterator>::__local_iterator;
218220 return std::__find_segment_if(
219 std::move(__first),
220 std::move(__last),
221 [&__value](__local_iterator __lfirst, __local_iterator __llast, _Proj& __lproj) {
221 std::move(__first), std::move(__last), [&__value, &__proj](__local_iterator __lfirst, __local_iterator __llast) {
222222 return std::__rewrap_iter(
223 __lfirst, std::__find(std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __value, __lproj));
224 },
225 __proj);
223 __lfirst, std::__find(std::__unwrap_iter(__lfirst), std::__unwrap_iter(__llast), __value, __proj));
224 });
226225}
227226
228227// public API
lib/libcxx/include/__algorithm/find_if.h+22-4
......@@ -11,6 +11,9 @@
1111#define _LIBCPP___ALGORITHM_FIND_IF_H
1212
1313#include <__config>
14#include <__functional/identity.h>
15#include <__memory/valid_range.h>
16#include <__type_traits/invoke.h>
1417
1518#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1619# pragma GCC system_header
......@@ -18,13 +21,28 @@
1821
1922_LIBCPP_BEGIN_NAMESPACE_STD
2023
24template <class _Iter, class _Sent, class _Pred, class _Proj>
25_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter
26__find_if(_Iter __first, _Sent __last, _Pred&& __pred, _Proj&& __proj) {
27 // Don't make the valid range assumption for empty ranges since using unaligned sentinel
28 // values to implement iterators of empty ranges is a common occurence.
29 if (__first == __last)
30 return __first;
31
32 std::__assume_valid_range(__first, __last);
33
34 do {
35 if (std::__invoke(__pred, std::__invoke(__proj, *__first)))
36 break;
37 ++__first;
38 } while (__first != __last);
39 return __first;
40}
41
2142template <class _InputIterator, class _Predicate>
2243[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
2344find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
24 for (; __first != __last; ++__first)
25 if (__pred(*__first))
26 break;
27 return __first;
45 return std::__find_if(__first, __last, __pred, __identity());
2846}
2947
3048_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/find_if_not.h+20-4
......@@ -10,23 +10,39 @@
1010#ifndef _LIBCPP___ALGORITHM_FIND_IF_NOT_H
1111#define _LIBCPP___ALGORITHM_FIND_IF_NOT_H
1212
13#include <__algorithm/find_if.h>
1314#include <__config>
15#include <__functional/identity.h>
16#include <__type_traits/invoke.h>
17#include <__utility/move.h>
1418
1519#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1620# pragma GCC system_header
1721#endif
1822
23_LIBCPP_PUSH_MACROS
24#include <__undef_macros>
25
1926_LIBCPP_BEGIN_NAMESPACE_STD
2027
28template <class _Iter, class _Sent, class _Pred, class _Proj>
29_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
30__find_if_not(_Iter __first, _Sent __last, _Pred&& __pred, _Proj&& __proj) {
31 return std::__find_if(
32 std::move(__first),
33 std::move(__last),
34 [&]<class _ValT>(_ValT&& __val) -> bool { return !std::__invoke(__pred, __val); },
35 __proj);
36}
37
2138template <class _InputIterator, class _Predicate>
2239[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
2340find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
24 for (; __first != __last; ++__first)
25 if (!__pred(*__first))
26 break;
27 return __first;
41 return std::__find_if_not(__first, __last, __pred, __identity());
2842}
2943
3044_LIBCPP_END_NAMESPACE_STD
3145
46_LIBCPP_POP_MACROS
47
3248#endif // _LIBCPP___ALGORITHM_FIND_IF_NOT_H
lib/libcxx/include/__algorithm/find_segment_if.h+8-9
......@@ -19,14 +19,13 @@
1919_LIBCPP_BEGIN_NAMESPACE_STD
2020
2121// __find_segment_if is a utility function for optimizing iteration over segmented iterators linearly.
22// [__first, __last) has to be a segmented range. __pred is expected to take a range of local iterators and the __proj.
22// [__first, __last) has to be a segmented range. __pred is expected to take a range of local iterators.
2323// It returns an iterator to the first element that satisfies the predicate, or a one-past-the-end iterator if there was
24// no match. __proj may be anything that should be passed to __pred, but is expected to be a projection to support
25// ranges algorithms, or __identity for classic algorithms.
24// no match.
2625
27template <class _SegmentedIterator, class _Pred, class _Proj>
26template <class _SegmentedIterator, class _Pred>
2827_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _SegmentedIterator
29__find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred __pred, _Proj& __proj) {
28__find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred __pred) {
3029 using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
3130
3231 auto __sfirst = _Traits::__segment(__first);
......@@ -34,11 +33,11 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _
3433
3534 // We are in a single segment, so we might not be at the beginning or end
3635 if (__sfirst == __slast)
37 return _Traits::__compose(__sfirst, __pred(_Traits::__local(__first), _Traits::__local(__last), __proj));
36 return _Traits::__compose(__sfirst, __pred(_Traits::__local(__first), _Traits::__local(__last)));
3837
3938 { // We have more than one segment. Iterate over the first segment, since we might not start at the beginning
4039 auto __llast = _Traits::__end(__sfirst);
41 auto __liter = __pred(_Traits::__local(__first), __llast, __proj);
40 auto __liter = __pred(_Traits::__local(__first), __llast);
4241 if (__liter != __llast)
4342 return _Traits::__compose(__sfirst, __liter);
4443 }
......@@ -47,14 +46,14 @@ __find_segment_if(_SegmentedIterator __first, _SegmentedIterator __last, _Pred _
4746 // Iterate over the segments which are guaranteed to be completely in the range
4847 while (__sfirst != __slast) {
4948 auto __llast = _Traits::__end(__sfirst);
50 auto __liter = __pred(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __proj);
49 auto __liter = __pred(_Traits::__begin(__sfirst), _Traits::__end(__sfirst));
5150 if (__liter != __llast)
5251 return _Traits::__compose(__sfirst, __liter);
5352 ++__sfirst;
5453 }
5554
5655 // Iterate over the last segment
57 return _Traits::__compose(__sfirst, __pred(_Traits::__begin(__sfirst), _Traits::__local(__last), __proj));
56 return _Traits::__compose(__sfirst, __pred(_Traits::__begin(__sfirst), _Traits::__local(__last)));
5857}
5958
6059_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/for_each.h+1-1
......@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2626
2727template <class _InputIterator, class _Sent, class _Func, class _Proj>
2828_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
29__for_each(_InputIterator __first, _Sent __last, _Func& __func, _Proj& __proj) {
29__for_each(_InputIterator __first, _Sent __last, _Func&& __func, _Proj& __proj) {
3030#ifndef _LIBCPP_CXX03_LANG
3131 if constexpr (using _SpecialAlg =
3232 __specialized_algorithm<_Algorithm::__for_each, __iterator_pair<_InputIterator, _Sent>>;
lib/libcxx/include/__algorithm/for_each_n.h+3-2
......@@ -18,6 +18,7 @@
1818#include <__iterator/segmented_iterator.h>
1919#include <__type_traits/invoke.h>
2020#include <__utility/convert_to_integral.h>
21#include <__utility/forward.h>
2122#include <__utility/move.h>
2223
2324#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -31,7 +32,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3132
3233template <class _InputIterator, class _Size, class _Func, class _Proj>
3334_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
34__for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj) {
35__for_each_n(_InputIterator __first, _Size __orig_n, _Func&& __f, _Proj& __proj) {
3536 typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
3637 _IntegralSize __n = __orig_n;
3738
......@@ -43,7 +44,7 @@ __for_each_n(_InputIterator __first, _Size __orig_n, _Func& __f, _Proj& __proj)
4344 std::__for_each(__lfirst, __llast, __f, __proj);
4445 });
4546 } else {
46 return std::__for_each(__first, __first + __n, __f, __proj);
47 return std::__for_each(__first, __first + __n, std::forward<_Func>(__f), __proj);
4748 }
4849 } else
4950#endif
lib/libcxx/include/__algorithm/generate_n.h+5-2
......@@ -29,8 +29,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
2929__generate_n(_OutputIterator __first, _Size __orig_n, _Generator& __gen) {
3030 using __iter_ref = decltype(*__first);
3131 __identity __proj;
32 auto __f = [&](__iter_ref __element) { std::forward<__iter_ref>(__element) = __gen(); };
33 return std::__for_each_n(std::move(__first), __orig_n, __f, __proj);
32 return std::__for_each_n(
33 std::move(__first),
34 __orig_n,
35 [&](__iter_ref __element) { std::forward<__iter_ref>(__element) = __gen(); },
36 __proj);
3437}
3538
3639template <class _OutputIterator, class _Size, class _Generator>
lib/libcxx/include/__algorithm/in_out_result.h+14
......@@ -49,6 +49,20 @@ struct in_out_result {
4949
5050#endif // _LIBCPP_STD_VER >= 20
5151
52template <class _InIter, class _OutIter>
53struct __in_out_result {
54 _InIter __in_;
55 _OutIter __out_;
56
57#if _LIBCPP_STD_VER >= 20
58 template <class _InIter2, class _OutIter2>
59 requires convertible_to<_InIter, _InIter2> && convertible_to<_OutIter, _OutIter2>
60 constexpr operator ranges::in_out_result<_InIter2, _OutIter2>() && {
61 return {std::move(__in_), std::move(__out_)};
62 }
63#endif
64};
65
5266_LIBCPP_END_NAMESPACE_STD
5367
5468_LIBCPP_POP_MACROS
lib/libcxx/include/__algorithm/lexicographical_compare_three_way.h+4-4
......@@ -27,10 +27,10 @@
2727_LIBCPP_PUSH_MACROS
2828#include <__undef_macros>
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230#if _LIBCPP_STD_VER >= 20
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3434// Fast path for random access iterators which computes the number of loop iterations up-front and
3535// then skips the iterator comparisons inside the loop.
3636template <class _InputIterator1, class _InputIterator2, class _Cmp>
......@@ -116,10 +116,10 @@ template <class _InputIterator1, class _InputIterator2>
116116 std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way());
117117}
118118
119#endif // _LIBCPP_STD_VER >= 20
120
121119_LIBCPP_END_NAMESPACE_STD
122120
121#endif // _LIBCPP_STD_VER >= 20
122
123123_LIBCPP_POP_MACROS
124124
125125#endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
lib/libcxx/include/__algorithm/lower_bound.h+5-4
......@@ -56,11 +56,11 @@ template <class _AlgPolicy, class _Iter, class _Type, class _Proj, class _Comp>
5656// would yield \Omega(n*log(n)) comparisons and, for non-random-access iterators, \Omega(n^2) iterator increments,
5757// whereas the one-sided version will yield O(n) operations on both counts, with a \Omega(log(n)) bound on the number of
5858// comparisons.
59template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Proj, class _Comp>
59template <class _AlgPolicy, class _ForwardIterator, class _Sent, class _Type, class _Comp>
6060[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
61__lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
61__lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __value, _Comp& __comp) {
6262 // step = 0, ensuring we can always short-circuit when distance is 1 later on
63 if (__first == __last || !std::__invoke(__comp, std::__invoke(__proj, *__first), __value))
63 if (__first == __last || !std::__invoke(__comp, *__first, __value))
6464 return __first;
6565
6666 using _Distance = typename iterator_traits<_ForwardIterator>::difference_type;
......@@ -69,11 +69,12 @@ __lower_bound_onesided(_ForwardIterator __first, _Sent __last, const _Type& __va
6969 auto __dist = __step - _IterOps<_AlgPolicy>::__advance_to(__it, __step, __last);
7070 // once we reach the last range where needle can be we must start
7171 // looking inwards, bisecting that range
72 if (__it == __last || !std::__invoke(__comp, std::__invoke(__proj, *__it), __value)) {
72 if (__it == __last || !std::__invoke(__comp, *__it, __value)) {
7373 // we've already checked the previous value and it was less, we can save
7474 // one comparison by skipping bisection
7575 if (__dist == 1)
7676 return __it;
77 __identity __proj;
7778 return std::__lower_bound_bisecting<_AlgPolicy>(__first, __value, __dist, __comp, __proj);
7879 }
7980 // range not found, move forward!
lib/libcxx/include/__algorithm/move.h+16-15
......@@ -12,6 +12,7 @@
1212#include <__algorithm/copy.h>
1313#include <__algorithm/copy_move_common.h>
1414#include <__algorithm/for_each_segment.h>
15#include <__algorithm/in_out_result.h>
1516#include <__algorithm/iterator_operations.h>
1617#include <__algorithm/min.h>
1718#include <__config>
......@@ -22,7 +23,6 @@
2223#include <__type_traits/enable_if.h>
2324#include <__type_traits/is_constructible.h>
2425#include <__utility/move.h>
25#include <__utility/pair.h>
2626
2727#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2828# pragma GCC system_header
......@@ -34,30 +34,30 @@ _LIBCPP_PUSH_MACROS
3434_LIBCPP_BEGIN_NAMESPACE_STD
3535
3636template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
37inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
37inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
3838__move(_InIter __first, _Sent __last, _OutIter __result);
3939
4040template <class _AlgPolicy>
4141struct __move_impl {
4242 template <class _InIter, class _Sent, class _OutIter>
43 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
43 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
4444 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
4545 while (__first != __last) {
4646 *__result = _IterOps<_AlgPolicy>::__iter_move(__first);
4747 ++__first;
4848 ++__result;
4949 }
50 return std::make_pair(std::move(__first), std::move(__result));
50 return {std::move(__first), std::move(__result)};
5151 }
5252
5353 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
54 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
54 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
5555 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
5656 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
5757 std::__for_each_segment(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) {
58 __result = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result)).second;
58 __result = std::__move<_AlgPolicy>(__lfirst, __llast, std::move(__result)).__out_;
5959 });
60 return std::make_pair(__last, std::move(__result));
60 return {__last, std::move(__result)};
6161 }
6262
6363 template <class _InIter,
......@@ -65,14 +65,14 @@ struct __move_impl {
6565 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
6666 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
6767 int> = 0>
68 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
68 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
6969 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
7070 using _Traits = __segmented_iterator_traits<_OutIter>;
7171 using _DiffT =
7272 typename common_type<__iterator_difference_type<_InIter>, __iterator_difference_type<_OutIter> >::type;
7373
7474 if (__first == __last)
75 return std::make_pair(std::move(__first), std::move(__result));
75 return {std::move(__first), std::move(__result)};
7676
7777 auto __local_first = _Traits::__local(__result);
7878 auto __segment_iterator = _Traits::__segment(__result);
......@@ -80,17 +80,18 @@ struct __move_impl {
8080 auto __local_last = _Traits::__end(__segment_iterator);
8181 auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
8282 auto __iters = std::__move<_AlgPolicy>(__first, __first + __size, __local_first);
83 __first = std::move(__iters.first);
83 __first = std::move(__iters.__in_);
8484
8585 if (__first == __last)
86 return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second)));
86 return {std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.__out_))};
8787
8888 __local_first = _Traits::__begin(++__segment_iterator);
8989 }
9090 }
9191
9292 template <class _Cp, bool _IsConst>
93 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
93 _LIBCPP_HIDE_FROM_ABI
94 _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
9495 operator()(__bit_iterator<_Cp, _IsConst> __first,
9596 __bit_iterator<_Cp, _IsConst> __last,
9697 __bit_iterator<_Cp, false> __result) {
......@@ -99,14 +100,14 @@ struct __move_impl {
99100
100101 // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
101102 template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
102 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
103 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
103104 operator()(_In* __first, _In* __last, _Out* __result) const {
104105 return std::__copy_trivial_impl(__first, __last, __result);
105106 }
106107};
107108
108109template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
109inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
110inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
110111__move(_InIter __first, _Sent __last, _OutIter __result) {
111112 return std::__copy_move_unwrap_iters<__move_impl<_AlgPolicy> >(
112113 std::move(__first), std::move(__last), std::move(__result));
......@@ -118,7 +119,7 @@ move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
118119 static_assert(is_copy_constructible<_InputIterator>::value, "Iterators has to be copy constructible.");
119120 static_assert(is_copy_constructible<_OutputIterator>::value, "The output iterator has to be copy constructible.");
120121
121 return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
122 return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_;
122123}
123124
124125_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/move_backward.h+16-14
......@@ -12,6 +12,7 @@
1212#include <__algorithm/copy_backward.h>
1313#include <__algorithm/copy_move_common.h>
1414#include <__algorithm/for_each_segment.h>
15#include <__algorithm/in_out_result.h>
1516#include <__algorithm/iterator_operations.h>
1617#include <__algorithm/min.h>
1718#include <__config>
......@@ -34,13 +35,13 @@ _LIBCPP_PUSH_MACROS
3435_LIBCPP_BEGIN_NAMESPACE_STD
3536
3637template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
37_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2>
3839__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result);
3940
4041template <class _AlgPolicy>
4142struct __move_backward_impl {
4243 template <class _InIter, class _Sent, class _OutIter>
43 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
44 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
4445 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
4546 auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
4647 auto __original_last_iter = __last_iter;
......@@ -49,17 +50,17 @@ struct __move_backward_impl {
4950 *--__result = _IterOps<_AlgPolicy>::__iter_move(--__last_iter);
5051 }
5152
52 return std::make_pair(std::move(__original_last_iter), std::move(__result));
53 return {std::move(__original_last_iter), std::move(__result)};
5354 }
5455
5556 template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator_v<_InIter>, int> = 0>
56 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
57 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
5758 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
5859 using __local_iterator = typename __segmented_iterator_traits<_InIter>::__local_iterator;
5960 std::__for_each_segment_backward(__first, __last, [&__result](__local_iterator __lfirst, __local_iterator __llast) {
60 __result = std::__move_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).second;
61 __result = std::__move_backward<_AlgPolicy>(std::move(__lfirst), std::move(__llast), std::move(__result)).__out_;
6162 });
62 return std::make_pair(__last, std::move(__result));
63 return {__last, std::move(__result)};
6364 }
6465
6566 template <class _InIter,
......@@ -67,7 +68,7 @@ struct __move_backward_impl {
6768 __enable_if_t<__has_random_access_iterator_category<_InIter>::value &&
6869 !__is_segmented_iterator_v<_InIter> && __is_segmented_iterator_v<_OutIter>,
6970 int> = 0>
70 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
71 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_InIter, _OutIter>
7172 operator()(_InIter __first, _InIter __last, _OutIter __result) const {
7273 using _Traits = __segmented_iterator_traits<_OutIter>;
7374 using _DiffT =
......@@ -75,7 +76,7 @@ struct __move_backward_impl {
7576
7677 // When the range contains no elements, __result might not be a valid iterator
7778 if (__first == __last)
78 return std::make_pair(__first, __result);
79 return {__first, __result};
7980
8081 auto __orig_last = __last;
8182
......@@ -84,18 +85,19 @@ struct __move_backward_impl {
8485 while (true) {
8586 auto __local_first = _Traits::__begin(__segment_iterator);
8687 auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
87 auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
88 auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).__out_;
8889 __last -= __size;
8990
9091 if (__first == __last)
91 return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter)));
92 return {std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter))};
9293
9394 __local_last = _Traits::__end(--__segment_iterator);
9495 }
9596 }
9697
9798 template <class _Cp, bool _IsConst>
98 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
99 _LIBCPP_HIDE_FROM_ABI
100 _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
99101 operator()(__bit_iterator<_Cp, _IsConst> __first,
100102 __bit_iterator<_Cp, _IsConst> __last,
101103 __bit_iterator<_Cp, false> __result) {
......@@ -104,14 +106,14 @@ struct __move_backward_impl {
104106
105107 // At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
106108 template <class _In, class _Out, __enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
107 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
109 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __in_out_result<_In*, _Out*>
108110 operator()(_In* __first, _In* __last, _Out* __result) const {
109111 return std::__copy_backward_trivial_impl(__first, __last, __result);
110112 }
111113};
112114
113115template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
114_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
116_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_BidirectionalIterator1, _BidirectionalIterator2>
115117__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
116118 static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
117119 std::is_copy_constructible<_BidirectionalIterator1>::value,
......@@ -124,7 +126,7 @@ __move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona
124126template <class _BidirectionalIterator1, class _BidirectionalIterator2>
125127inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
126128move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
127 return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
129 return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).__out_;
128130}
129131
130132_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/out_value_result.h+4-4
......@@ -21,10 +21,10 @@
2121_LIBCPP_PUSH_MACROS
2222#include <__undef_macros>
2323
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2624#if _LIBCPP_STD_VER >= 23
2725
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2828namespace ranges {
2929
3030template <class _OutIter1, class _ValType1>
......@@ -47,10 +47,10 @@ struct out_value_result {
4747
4848} // namespace ranges
4949
50#endif // _LIBCPP_STD_VER >= 23
51
5250_LIBCPP_END_NAMESPACE_STD
5351
52#endif // _LIBCPP_STD_VER >= 23
53
5454_LIBCPP_POP_MACROS
5555
5656#endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H
lib/libcxx/include/__algorithm/partial_sort_copy.h+5-4
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/comp.h>
1313#include <__algorithm/comp_ref_type.h>
14#include <__algorithm/in_out_result.h>
1415#include <__algorithm/iterator_operations.h>
1516#include <__algorithm/make_heap.h>
1617#include <__algorithm/make_projected.h>
......@@ -41,7 +42,8 @@ template <class _AlgPolicy,
4142 class _Sentinel2,
4243 class _Proj1,
4344 class _Proj2>
44_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator> __partial_sort_copy(
45_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<_InputIterator, _RandomAccessIterator>
46__partial_sort_copy(
4547 _InputIterator __first,
4648 _Sentinel1 __last,
4749 _RandomAccessIterator __result_first,
......@@ -65,8 +67,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _Random
6567 std::__sort_heap<_AlgPolicy>(__result_first, __r, __projected_comp);
6668 }
6769
68 return pair<_InputIterator, _RandomAccessIterator>(
69 _IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r));
70 return {_IterOps<_AlgPolicy>::next(std::move(__first), std::move(__last)), std::move(__r)};
7071}
7172
7273template <class _InputIterator, class _RandomAccessIterator, class _Compare>
......@@ -87,7 +88,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
8788 static_cast<__comp_ref_type<_Compare> >(__comp),
8889 __identity(),
8990 __identity());
90 return __result.second;
91 return __result.__out_;
9192}
9293
9394template <class _InputIterator, class _RandomAccessIterator>
lib/libcxx/include/__algorithm/pstl.h+90
......@@ -293,6 +293,54 @@ find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __l
293293 std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
294294}
295295
296template <class _ExecutionPolicy,
297 class _ForwardIterator1,
298 class _ForwardIterator2,
299 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
300 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
301[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator1 find_first_of(
302 _ExecutionPolicy&& __policy,
303 _ForwardIterator1 __first1,
304 _ForwardIterator1 __last1,
305 _ForwardIterator2 __first2,
306 _ForwardIterator2 __last2) {
307 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "find_first_of requires ForwardIterators");
308 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "find_first_of requires ForwardIterators");
309 using _Implementation = __pstl::__dispatch<__pstl::__find_first_of, __pstl::__current_configuration, _RawPolicy>;
310 return __pstl::__handle_exception<_Implementation>(
311 std::forward<_ExecutionPolicy>(__policy),
312 std::move(__first1),
313 std::move(__last1),
314 std::move(__first2),
315 std::move(__last2),
316 std::equal_to<>{});
317}
318
319template <class _ExecutionPolicy,
320 class _ForwardIterator1,
321 class _ForwardIterator2,
322 class _BinaryPredicate,
323 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
324 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
325[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator1 find_first_of(
326 _ExecutionPolicy&& __policy,
327 _ForwardIterator1 __first1,
328 _ForwardIterator1 __last1,
329 _ForwardIterator2 __first2,
330 _ForwardIterator2 __last2,
331 _BinaryPredicate __pred) {
332 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "find_first_of requires ForwardIterators");
333 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "find_first_of requires ForwardIterators");
334 using _Implementation = __pstl::__dispatch<__pstl::__find_first_of, __pstl::__current_configuration, _RawPolicy>;
335 return __pstl::__handle_exception<_Implementation>(
336 std::forward<_ExecutionPolicy>(__policy),
337 std::move(__first1),
338 std::move(__last1),
339 std::move(__first2),
340 std::move(__last2),
341 std::move(__pred));
342}
343
296344template <class _ExecutionPolicy,
297345 class _ForwardIterator,
298346 class _Function,
......@@ -347,6 +395,23 @@ generate_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Ge
347395 std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__gen));
348396}
349397
398template <class _ExecutionPolicy,
399 class _BidirectionalIterator,
400 class _ForwardIterator,
401 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
402 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
403[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ForwardIterator reverse_copy(
404 _ExecutionPolicy&& __policy,
405 _BidirectionalIterator __first,
406 _BidirectionalIterator __last,
407 _ForwardIterator __result) {
408 _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(_BidirectionalIterator, "reverse_copy requires a BidirectionalIterator");
409 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reverse_copy requires a ForwardIterator");
410 using _Implementation = __pstl::__dispatch<__pstl::__reverse_copy, __pstl::__current_configuration, _RawPolicy>;
411 return __pstl::__handle_exception<_Implementation>(
412 std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result));
413}
414
350415template <class _ExecutionPolicy,
351416 class _ForwardIterator,
352417 class _Predicate,
......@@ -654,6 +719,31 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
654719 std::move(__op));
655720}
656721
722template <class _ExecutionPolicy,
723 class _ForwardIterator,
724 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
725 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
726[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
727is_sorted(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) {
728 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_sorted requires ForwardIterators");
729 using _Implementation = __pstl::__dispatch<__pstl::__is_sorted, __pstl::__current_configuration, _RawPolicy>;
730 return __pstl::__handle_exception<_Implementation>(
731 std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
732}
733
734template <class _ExecutionPolicy,
735 class _ForwardIterator,
736 class _Comp,
737 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
738 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
739[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
740is_sorted(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp __comp) {
741 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_sorted requires ForwardIterators");
742 using _Implementation = __pstl::__dispatch<__pstl::__is_sorted, __pstl::__current_configuration, _RawPolicy>;
743 return __pstl::__handle_exception<_Implementation>(
744 std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
745}
746
657747_LIBCPP_END_NAMESPACE_STD
658748
659749#endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
lib/libcxx/include/__algorithm/radix_sort.h+4-4
......@@ -67,10 +67,10 @@
6767_LIBCPP_PUSH_MACROS
6868#include <__undef_macros>
6969
70_LIBCPP_BEGIN_NAMESPACE_STD
71
7270#if _LIBCPP_STD_VER >= 14
7371
72_LIBCPP_BEGIN_NAMESPACE_STD
73
7474template <class _InputIterator, class _OutputIterator>
7575_LIBCPP_HIDE_FROM_ABI constexpr pair<_OutputIterator, __iterator_value_type<_InputIterator>>
7676__partial_sum_max(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
......@@ -422,10 +422,10 @@ __radix_sort(_RandomAccessIterator1 __first, _RandomAccessIterator1 __last, _Ran
422422 std::__radix_sort(__first, __last, __buffer, __identity{}, __low_byte_fn{});
423423}
424424
425#endif // _LIBCPP_STD_VER >= 14
426
427425_LIBCPP_END_NAMESPACE_STD
428426
427#endif // _LIBCPP_STD_VER >= 14
428
429429_LIBCPP_POP_MACROS
430430
431431#endif // _LIBCPP___ALGORITHM_RADIX_SORT_H
lib/libcxx/include/__algorithm/ranges_copy.h+2-4
......@@ -41,16 +41,14 @@ struct __copy {
4141 requires indirectly_copyable<_InIter, _OutIter>
4242 _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter>
4343 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
44 auto __ret = std::__copy(std::move(__first), std::move(__last), std::move(__result));
45 return {std::move(__ret.first), std::move(__ret.second)};
44 return std::__copy(std::move(__first), std::move(__last), std::move(__result));
4645 }
4746
4847 template <input_range _Range, weakly_incrementable _OutIter>
4948 requires indirectly_copyable<iterator_t<_Range>, _OutIter>
5049 _LIBCPP_HIDE_FROM_ABI constexpr copy_result<borrowed_iterator_t<_Range>, _OutIter>
5150 operator()(_Range&& __r, _OutIter __result) const {
52 auto __ret = std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result));
53 return {std::move(__ret.first), std::move(__ret.second)};
51 return std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result));
5452 }
5553};
5654
lib/libcxx/include/__algorithm/ranges_copy_backward.h+2-4
......@@ -40,16 +40,14 @@ struct __copy_backward {
4040 requires indirectly_copyable<_InIter1, _InIter2>
4141 _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2>
4242 operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const {
43 auto __ret = std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
44 return {std::move(__ret.first), std::move(__ret.second)};
43 return std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
4544 }
4645
4746 template <bidirectional_range _Range, bidirectional_iterator _Iter>
4847 requires indirectly_copyable<iterator_t<_Range>, _Iter>
4948 _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter>
5049 operator()(_Range&& __r, _Iter __result) const {
51 auto __ret = std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
52 return {std::move(__ret.first), std::move(__ret.second)};
50 return std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
5351 }
5452};
5553
lib/libcxx/include/__algorithm/ranges_copy_if.h+2-4
......@@ -46,8 +46,7 @@ struct __copy_if {
4646 requires indirectly_copyable<_Iter, _OutIter>
4747 _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<_Iter, _OutIter>
4848 operator()(_Iter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
49 auto __res = std::__copy_if(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
50 return {std::move(__res.first), std::move(__res.second)};
49 return std::__copy_if(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
5150 }
5251
5352 template <input_range _Range,
......@@ -57,8 +56,7 @@ struct __copy_if {
5756 requires indirectly_copyable<iterator_t<_Range>, _OutIter>
5857 _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
5958 operator()(_Range&& __r, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
60 auto __res = std::__copy_if(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj);
61 return {std::move(__res.first), std::move(__res.second)};
59 return std::__copy_if(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj);
6260 }
6361};
6462
lib/libcxx/include/__algorithm/ranges_copy_n.h+5-6
......@@ -24,10 +24,10 @@
2424_LIBCPP_PUSH_MACROS
2525#include <__undef_macros>
2626
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2927#if _LIBCPP_STD_VER >= 20
3028
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3131namespace ranges {
3232
3333template <class _Ip, class _Op>
......@@ -38,8 +38,7 @@ struct __copy_n {
3838 requires indirectly_copyable<_Ip, _Op>
3939 _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op>
4040 operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const {
41 auto __res = std::__copy_n<_RangeAlgPolicy>(std::move(__first), __n, std::move(__result));
42 return {std::move(__res.first), std::move(__res.second)};
41 return std::__copy_n<_RangeAlgPolicy>(std::move(__first), __n, std::move(__result));
4342 }
4443};
4544
......@@ -48,10 +47,10 @@ inline constexpr auto copy_n = __copy_n{};
4847} // namespace __cpo
4948} // namespace ranges
5049
51#endif // _LIBCPP_STD_VER >= 20
52
5350_LIBCPP_END_NAMESPACE_STD
5451
52#endif // _LIBCPP_STD_VER >= 20
53
5554_LIBCPP_POP_MACROS
5655
5756#endif // _LIBCPP___ALGORITHM_RANGES_COPY_N_H
lib/libcxx/include/__algorithm/ranges_equal.h+2-2
......@@ -50,7 +50,7 @@ struct __equal {
5050 _Pred __pred = {},
5151 _Proj1 __proj1 = {},
5252 _Proj2 __proj2 = {}) const {
53 static constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>;
53 constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>;
5454 if constexpr (__both_sized) {
5555 if (__last1 - __first1 != __last2 - __first2)
5656 return false;
......@@ -71,7 +71,7 @@ struct __equal {
7171 requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
7272 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
7373 _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
74 static constexpr bool __both_sized = sized_range<_Range1> && sized_range<_Range2>;
74 constexpr bool __both_sized = sized_range<_Range1> && sized_range<_Range2>;
7575 if constexpr (__both_sized) {
7676 if (ranges::size(__range1) != ranges::size(__range2))
7777 return false;
lib/libcxx/include/__algorithm/ranges_find_if.h+3-12
......@@ -9,10 +9,10 @@
99#ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_H
1010#define _LIBCPP___ALGORITHM_RANGES_FIND_IF_H
1111
12#include <__algorithm/find_if.h>
1213#include <__config>
1314#include <__functional/identity.h>
1415#include <__functional/invoke.h>
15#include <__functional/ranges_operations.h>
1616#include <__iterator/concepts.h>
1717#include <__iterator/projected.h>
1818#include <__ranges/access.h>
......@@ -33,15 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3333
3434namespace ranges {
3535
36template <class _Ip, class _Sp, class _Pred, class _Proj>
37_LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
38 for (; __first != __last; ++__first) {
39 if (std::invoke(__pred, std::invoke(__proj, *__first)))
40 break;
41 }
42 return __first;
43}
44
4536struct __find_if {
4637 template <input_iterator _Ip,
4738 sentinel_for<_Ip> _Sp,
......@@ -49,13 +40,13 @@ struct __find_if {
4940 indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
5041 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
5142 operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
52 return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
43 return std::__find_if(std::move(__first), std::move(__last), __pred, __proj);
5344 }
5445
5546 template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
5647 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
5748 operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
58 return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
49 return std::__find_if(ranges::begin(__r), ranges::end(__r), __pred, __proj);
5950 }
6051};
6152
lib/libcxx/include/__algorithm/ranges_find_if_not.h+3-8
......@@ -9,17 +9,14 @@
99#ifndef _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H
1010#define _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H
1111
12#include <__algorithm/ranges_find_if.h>
12#include <__algorithm/find_if_not.h>
1313#include <__config>
1414#include <__functional/identity.h>
15#include <__functional/invoke.h>
16#include <__functional/ranges_operations.h>
1715#include <__iterator/concepts.h>
1816#include <__iterator/projected.h>
1917#include <__ranges/access.h>
2018#include <__ranges/concepts.h>
2119#include <__ranges/dangling.h>
22#include <__utility/forward.h>
2320#include <__utility/move.h>
2421
2522#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -41,15 +38,13 @@ struct __find_if_not {
4138 indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
4239 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Ip
4340 operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
44 auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
45 return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj);
41 return std::__find_if_not(std::move(__first), std::move(__last), __pred, __proj);
4642 }
4743
4844 template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
4945 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
5046 operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
51 auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
52 return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj);
47 return std::__find_if_not(ranges::begin(__r), ranges::end(__r), __pred, __proj);
5348 }
5449};
5550
lib/libcxx/include/__algorithm/ranges_fold.h+145-4
......@@ -10,17 +10,21 @@
1010#ifndef _LIBCPP___ALGORITHM_RANGES_FOLD_H
1111#define _LIBCPP___ALGORITHM_RANGES_FOLD_H
1212
13#include <__algorithm/for_each.h>
1314#include <__concepts/assignable.h>
1415#include <__concepts/constructible.h>
1516#include <__concepts/convertible_to.h>
1617#include <__concepts/invocable.h>
1718#include <__concepts/movable.h>
1819#include <__config>
20#include <__functional/identity.h>
1921#include <__functional/invoke.h>
2022#include <__functional/reference_wrapper.h>
2123#include <__iterator/concepts.h>
2224#include <__iterator/iterator_traits.h>
2325#include <__iterator/next.h>
26#include <__iterator/prev.h>
27#include <__iterator/reverse_iterator.h>
2428#include <__ranges/access.h>
2529#include <__ranges/concepts.h>
2630#include <__ranges/dangling.h>
......@@ -28,6 +32,7 @@
2832#include <__type_traits/invoke.h>
2933#include <__utility/forward.h>
3034#include <__utility/move.h>
35#include <optional>
3136
3237#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3338# pragma GCC system_header
......@@ -62,6 +67,9 @@ struct in_value_result {
6267template <class _Ip, class _Tp>
6368using fold_left_with_iter_result = in_value_result<_Ip, _Tp>;
6469
70template <class _Ip, class _Tp>
71using fold_left_first_with_iter_result = in_value_result<_Ip, _Tp>;
72
6573template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>>
6674concept __indirectly_binary_left_foldable_impl =
6775 convertible_to<_Rp, _Up> && //
......@@ -77,6 +85,22 @@ concept __indirectly_binary_left_foldable =
7785 invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && //
7886 __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
7987
88template <class _Func>
89struct __flipped {
90 _Func __func;
91
92 template <class _Tp, class _Up>
93 requires invocable<_Func&, _Up, _Tp>
94 invoke_result_t<_Func&, _Up, _Tp> operator()(_Tp&&, _Up&&);
95};
96
97template <class _Func, class _Tp, class _Iter>
98concept __indirectly_binary_right_foldable =
99 __indirectly_binary_left_foldable_impl<__flipped<_Func>,
100 _Tp,
101 _Iter,
102 invoke_result_t<_Func&, _Tp, iter_reference_t<_Iter>>>;
103
80104struct __fold_left_with_iter {
81105 template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
82106 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
......@@ -87,11 +111,17 @@ struct __fold_left_with_iter {
87111 }
88112
89113 _Up __result = std::invoke(__f, std::move(__init), *__first);
90 for (++__first; __first != __last; ++__first) {
91 __result = std::invoke(__f, std::move(__result), *__first);
92 }
114 ++__first;
115 __identity __proj;
116 auto __end = std::__for_each(
117 std::move(__first),
118 std::move(__last),
119 [&](auto&& __element) {
120 __result = std::invoke(__f, std::move(__result), std::forward<decltype(__element)>(__element));
121 },
122 __proj);
93123
94 return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)};
124 return fold_left_with_iter_result<_Ip, _Up>{std::move(__end), std::move(__result)};
95125 }
96126
97127 template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
......@@ -118,6 +148,117 @@ struct __fold_left {
118148};
119149
120150inline constexpr auto fold_left = __fold_left();
151
152struct __fold_left_first_with_iter {
153 template <input_iterator _Iter,
154 sentinel_for<_Iter> _Sent,
155 __indirectly_binary_left_foldable<iter_value_t<_Iter>, _Iter> _Func>
156 requires constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>>
157 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sent __last, _Func __func) {
158 using _Up = decltype(fold_left(std::move(__first), __last, iter_value_t<_Iter>(*__first), __func));
159
160 if (__first == __last)
161 return fold_left_first_with_iter_result<_Iter, optional<_Up>>{std::move(__first), optional<_Up>()};
162
163 _Up __result(*__first);
164 ++__first;
165 __identity __proj;
166 auto __end = std::__for_each(
167 std::move(__first),
168 std::move(__last),
169 [&](auto&& __element) {
170 __result = std::invoke(__func, std::move(__result), std::forward<decltype(__element)>(__element));
171 },
172 __proj);
173
174 return fold_left_first_with_iter_result<_Iter, optional<_Up>>{std::move(__end), optional<_Up>(std::move(__result))};
175 }
176
177 template <input_range _Range, __indirectly_binary_left_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func>
178 requires constructible_from<range_value_t<_Range>, range_reference_t<_Range>>
179 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) {
180 auto __result = operator()(ranges::begin(__range), ranges::end(__range), std::ref(__func));
181
182 using _Up = decltype(fold_left(
183 ranges::begin(__range), ranges::end(__range), range_value_t<_Range>(*ranges::begin(__range)), __func));
184 return fold_left_first_with_iter_result<borrowed_iterator_t<_Range>, optional<_Up>>{
185 std::move(__result.in), std::move(__result.value)};
186 }
187};
188
189inline constexpr auto fold_left_first_with_iter = __fold_left_first_with_iter();
190
191struct __fold_left_first {
192 template <input_iterator _Iter,
193 sentinel_for<_Iter> _Sent,
194 __indirectly_binary_left_foldable<iter_value_t<_Iter>, _Iter> _Func>
195 requires constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>>
196 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sent __last, _Func __func) {
197 return fold_left_first_with_iter(std::move(__first), std::move(__last), std::ref(__func)).value;
198 }
199
200 template <input_range _Range, __indirectly_binary_left_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func>
201 requires constructible_from<range_value_t<_Range>, range_reference_t<_Range>>
202 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) {
203 return fold_left_first_with_iter(ranges::begin(__range), ranges::end(__range), std::ref(__func)).value;
204 }
205};
206
207inline constexpr auto fold_left_first = __fold_left_first();
208
209struct __fold_right {
210 template <bidirectional_iterator _Iter,
211 sentinel_for<_Iter> _Sp,
212 class _Tp,
213 __indirectly_binary_right_foldable<_Tp, _Iter> _Func>
214 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
215 operator()(_Iter __first, _Sp __last, _Tp __init, _Func __func) {
216 using _Up = decay_t<invoke_result_t<_Func&, iter_reference_t<_Iter>, _Tp>>;
217
218 if (__first == __last)
219 return _Up(std::move(__init));
220
221 _Iter __tail = ranges::next(__first, __last);
222 --__tail;
223 _Up __result = std::invoke(__func, *__tail, std::move(__init));
224 std::for_each(std::make_reverse_iterator(__tail), std::make_reverse_iterator(__first), [&](auto&& __element) {
225 __result = std::invoke(__func, std::forward<decltype(__element)>(__element), std::move(__result));
226 });
227
228 return __result;
229 }
230
231 template <bidirectional_range _Range, class _Tp, __indirectly_binary_right_foldable<_Tp, iterator_t<_Range>> _Func>
232 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Tp __init, _Func __func) {
233 return operator()(ranges::begin(__range), ranges::end(__range), std::move(__init), std::ref(__func));
234 }
235};
236
237inline constexpr auto fold_right = __fold_right();
238
239struct __fold_right_last {
240 template <bidirectional_iterator _Iter,
241 sentinel_for<_Iter> _Sp,
242 __indirectly_binary_right_foldable<iter_value_t<_Iter>, _Iter> _Func>
243 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Iter __first, _Sp __last, _Func __func) {
244 using _Up = decltype(fold_right(__first, __last, iter_value_t<_Iter>(*__first), __func));
245
246 if (__first == __last)
247 return optional<_Up>();
248
249 _Iter __tail = ranges::prev(ranges::next(__first, __last));
250 return optional<_Up>(
251 in_place, ranges::fold_right(std::move(__first), __tail, iter_value_t<_Iter>(*__tail), std::move(__func)));
252 }
253
254 template <bidirectional_range _Range,
255 __indirectly_binary_right_foldable<range_value_t<_Range>, iterator_t<_Range>> _Func>
256 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Func __func) {
257 return operator()(ranges::begin(__range), ranges::end(__range), std::ref(__func));
258 }
259};
260
261inline constexpr auto fold_right_last = __fold_right_last();
121262} // namespace ranges
122263
123264#endif // _LIBCPP_STD_VER >= 23
lib/libcxx/include/__algorithm/ranges_move.h+2-9
......@@ -36,25 +36,18 @@ template <class _InIter, class _OutIter>
3636using move_result = in_out_result<_InIter, _OutIter>;
3737
3838struct __move {
39 template <class _InIter, class _Sent, class _OutIter>
40 _LIBCPP_HIDE_FROM_ABI constexpr static move_result<_InIter, _OutIter>
41 __move_impl(_InIter __first, _Sent __last, _OutIter __result) {
42 auto __ret = std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
43 return {std::move(__ret.first), std::move(__ret.second)};
44 }
45
4639 template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
4740 requires indirectly_movable<_InIter, _OutIter>
4841 _LIBCPP_HIDE_FROM_ABI constexpr move_result<_InIter, _OutIter>
4942 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
50 return __move_impl(std::move(__first), std::move(__last), std::move(__result));
43 return std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
5144 }
5245
5346 template <input_range _Range, weakly_incrementable _OutIter>
5447 requires indirectly_movable<iterator_t<_Range>, _OutIter>
5548 _LIBCPP_HIDE_FROM_ABI constexpr move_result<borrowed_iterator_t<_Range>, _OutIter>
5649 operator()(_Range&& __range, _OutIter __result) const {
57 return __move_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
50 return std::__move<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__result));
5851 }
5952};
6053
lib/libcxx/include/__algorithm/ranges_move_backward.h+2-9
......@@ -38,25 +38,18 @@ template <class _InIter, class _OutIter>
3838using move_backward_result = in_out_result<_InIter, _OutIter>;
3939
4040struct __move_backward {
41 template <class _InIter, class _Sent, class _OutIter>
42 _LIBCPP_HIDE_FROM_ABI constexpr static move_backward_result<_InIter, _OutIter>
43 __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) {
44 auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
45 return {std::move(__ret.first), std::move(__ret.second)};
46 }
47
4841 template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter>
4942 requires indirectly_movable<_InIter, _OutIter>
5043 _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<_InIter, _OutIter>
5144 operator()(_InIter __first, _Sent __last, _OutIter __result) const {
52 return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result));
45 return std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
5346 }
5447
5548 template <bidirectional_range _Range, bidirectional_iterator _Iter>
5649 requires indirectly_movable<iterator_t<_Range>, _Iter>
5750 _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter>
5851 operator()(_Range&& __range, _Iter __result) const {
59 return __move_backward_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
52 return std::__move_backward<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__result));
6053 }
6154};
6255
lib/libcxx/include/__algorithm/ranges_partial_sort_copy.h+2-4
......@@ -60,7 +60,7 @@ struct __partial_sort_copy {
6060 _Comp __comp = {},
6161 _Proj1 __proj1 = {},
6262 _Proj2 __proj2 = {}) const {
63 auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
63 return std::__partial_sort_copy<_RangeAlgPolicy>(
6464 std::move(__first),
6565 std::move(__last),
6666 std::move(__result_first),
......@@ -68,7 +68,6 @@ struct __partial_sort_copy {
6868 __comp,
6969 __proj1,
7070 __proj2);
71 return {std::move(__result.first), std::move(__result.second)};
7271 }
7372
7473 template <input_range _Range1,
......@@ -84,7 +83,7 @@ struct __partial_sort_copy {
8483 _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>>
8584 operator()(
8685 _Range1&& __range, _Range2&& __result_range, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
87 auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
86 return std::__partial_sort_copy<_RangeAlgPolicy>(
8887 ranges::begin(__range),
8988 ranges::end(__range),
9089 ranges::begin(__result_range),
......@@ -92,7 +91,6 @@ struct __partial_sort_copy {
9291 __comp,
9392 __proj1,
9493 __proj2);
95 return {std::move(__result.first), std::move(__result.second)};
9694 }
9795};
9896
lib/libcxx/include/__algorithm/ranges_remove_if.h+2-3
......@@ -10,10 +10,9 @@
1010#define _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H
1111#include <__config>
1212
13#include <__algorithm/ranges_find_if.h>
13#include <__algorithm/find_if.h>
1414#include <__functional/identity.h>
1515#include <__functional/invoke.h>
16#include <__functional/ranges_operations.h>
1716#include <__iterator/concepts.h>
1817#include <__iterator/iter_move.h>
1918#include <__iterator/permutable.h>
......@@ -39,7 +38,7 @@ namespace ranges {
3938template <class _Iter, class _Sent, class _Proj, class _Pred>
4039_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
4140__remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
42 auto __new_end = ranges::__find_if_impl(__first, __last, __pred, __proj);
41 auto __new_end = std::__find_if(__first, __last, __pred, __proj);
4342 if (__new_end == __last)
4443 return {__new_end, __new_end};
4544
lib/libcxx/include/__algorithm/ranges_reverse_copy.h+2-1
......@@ -18,6 +18,7 @@
1818#include <__ranges/access.h>
1919#include <__ranges/concepts.h>
2020#include <__ranges/dangling.h>
21#include <__ranges/reverse_view.h>
2122#include <__ranges/subrange.h>
2223#include <__utility/move.h>
2324
......@@ -49,7 +50,7 @@ struct __reverse_copy {
4950 requires indirectly_copyable<iterator_t<_Range>, _OutIter>
5051 _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter>
5152 operator()(_Range&& __range, _OutIter __result) const {
52 auto __ret = ranges::copy(std::__reverse_range(__range), std::move(__result));
53 auto __ret = ranges::copy(__range | views::reverse, std::move(__result));
5354 return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)};
5455 }
5556};
lib/libcxx/include/__algorithm/ranges_set_difference.h+2-7
......@@ -14,16 +14,13 @@
1414#include <__algorithm/set_difference.h>
1515#include <__config>
1616#include <__functional/identity.h>
17#include <__functional/invoke.h>
1817#include <__functional/ranges_operations.h>
1918#include <__iterator/concepts.h>
2019#include <__iterator/mergeable.h>
2120#include <__ranges/access.h>
2221#include <__ranges/concepts.h>
2322#include <__ranges/dangling.h>
24#include <__type_traits/decay.h>
2523#include <__utility/move.h>
26#include <__utility/pair.h>
2724
2825#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2926# pragma GCC system_header
......@@ -60,9 +57,8 @@ struct __set_difference {
6057 _Comp __comp = {},
6158 _Proj1 __proj1 = {},
6259 _Proj2 __proj2 = {}) const {
63 auto __ret = std::__set_difference(
60 return std::__set_difference(
6461 __first1, __last1, __first2, __last2, __result, ranges::__make_projected_comp(__comp, __proj1, __proj2));
65 return {std::move(__ret.first), std::move(__ret.second)};
6662 }
6763
6864 template <input_range _Range1,
......@@ -79,14 +75,13 @@ struct __set_difference {
7975 _Comp __comp = {},
8076 _Proj1 __proj1 = {},
8177 _Proj2 __proj2 = {}) const {
82 auto __ret = std::__set_difference(
78 return std::__set_difference(
8379 ranges::begin(__range1),
8480 ranges::end(__range1),
8581 ranges::begin(__range2),
8682 ranges::end(__range2),
8783 __result,
8884 ranges::__make_projected_comp(__comp, __proj1, __proj2));
89 return {std::move(__ret.first), std::move(__ret.second)};
9085 }
9186};
9287
lib/libcxx/include/__algorithm/ranges_shift_left.h created+73
......@@ -0,0 +1,73 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H
10#define _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H
11
12#include <__algorithm/iterator_operations.h>
13#include <__algorithm/shift_left.h>
14#include <__config>
15#include <__iterator/concepts.h>
16#include <__iterator/distance.h>
17#include <__iterator/incrementable_traits.h>
18#include <__iterator/permutable.h>
19#include <__ranges/access.h>
20#include <__ranges/concepts.h>
21#include <__ranges/subrange.h>
22#include <__utility/move.h>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28_LIBCPP_PUSH_MACROS
29#include <__undef_macros>
30
31_LIBCPP_BEGIN_NAMESPACE_STD
32
33#if _LIBCPP_STD_VER >= 23
34
35namespace ranges {
36namespace __shift_left {
37
38struct __fn {
39 template <permutable _Iter, sentinel_for<_Iter> _Sent>
40 _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter>
41 operator()(_Iter __first, _Sent __last, iter_difference_t<_Iter> __n) {
42 auto __ret = std::__shift_left<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__n));
43 return {std::move(__ret.first), std::move(__ret.second)};
44 }
45
46 template <forward_range _Range>
47 requires permutable<iterator_t<_Range>>
48 _LIBCPP_HIDE_FROM_ABI static constexpr borrowed_subrange_t<_Range>
49 operator()(_Range&& __range, range_difference_t<_Range> __n) {
50 if constexpr (sized_range<_Range>) {
51 if (__n >= ranges::distance(__range)) {
52 return {ranges::begin(__range), ranges::begin(__range)};
53 }
54 }
55
56 auto __ret = std::__shift_left<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__n));
57 return {std::move(__ret.first), std::move(__ret.second)};
58 }
59};
60} // namespace __shift_left
61
62inline namespace __cpo {
63inline constexpr auto shift_left = __shift_left::__fn{};
64} // namespace __cpo
65} // namespace ranges
66
67#endif // _LIBCPP_STD_VER >= 23
68
69_LIBCPP_END_NAMESPACE_STD
70
71_LIBCPP_POP_MACROS
72
73#endif // _LIBCPP___ALGORITHM_RANGES_SHIFT_LEFT_H
lib/libcxx/include/__algorithm/ranges_shift_right.h created+76
......@@ -0,0 +1,76 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H
10#define _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H
11
12#include <__algorithm/iterator_operations.h>
13#include <__algorithm/shift_right.h>
14#include <__config>
15#include <__iterator/concepts.h>
16#include <__iterator/distance.h>
17#include <__iterator/incrementable_traits.h>
18#include <__iterator/permutable.h>
19#include <__ranges/access.h>
20#include <__ranges/concepts.h>
21#include <__ranges/subrange.h>
22#include <__utility/move.h>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28_LIBCPP_PUSH_MACROS
29#include <__undef_macros>
30
31_LIBCPP_BEGIN_NAMESPACE_STD
32
33#if _LIBCPP_STD_VER >= 23
34
35namespace ranges {
36namespace __shift_right {
37
38struct __fn {
39 template <permutable _Iter, sentinel_for<_Iter> _Sent>
40 _LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter>
41 operator()(_Iter __first, _Sent __last, iter_difference_t<_Iter> __n) {
42 auto __ret = std::__shift_right<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__n));
43 return {std::move(__ret.first), std::move(__ret.second)};
44 }
45
46 template <forward_range _Range>
47 requires permutable<iterator_t<_Range>>
48 _LIBCPP_HIDE_FROM_ABI static constexpr borrowed_subrange_t<_Range>
49 operator()(_Range&& __range, range_difference_t<_Range> __n) {
50 if constexpr (sized_range<_Range>) {
51 if (__n >= ranges::distance(__range)) {
52 auto __iter = ranges::begin(__range);
53 auto __end = ranges::end(__range);
54 ranges::advance(__iter, __end);
55 return {__iter, std::move(__iter)};
56 }
57 }
58
59 auto __ret = std::__shift_right<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), std::move(__n));
60 return {std::move(__ret.first), std::move(__ret.second)};
61 }
62};
63} // namespace __shift_right
64
65inline namespace __cpo {
66inline constexpr auto shift_right = __shift_right::__fn{};
67} // namespace __cpo
68} // namespace ranges
69
70#endif // _LIBCPP_STD_VER >= 23
71
72_LIBCPP_END_NAMESPACE_STD
73
74_LIBCPP_POP_MACROS
75
76#endif // _LIBCPP___ALGORITHM_RANGES_SHIFT_RIGHT_H
lib/libcxx/include/__algorithm/ranges_swap_ranges.h+30-3
......@@ -11,6 +11,7 @@
1111
1212#include <__algorithm/in_in_result.h>
1313#include <__algorithm/iterator_operations.h>
14#include <__algorithm/min.h>
1415#include <__algorithm/swap_ranges.h>
1516#include <__config>
1617#include <__iterator/concepts.h>
......@@ -18,7 +19,9 @@
1819#include <__ranges/access.h>
1920#include <__ranges/concepts.h>
2021#include <__ranges/dangling.h>
22#include <__type_traits/is_same.h>
2123#include <__utility/move.h>
24#include <__utility/pair.h>
2225
2326#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2427# pragma GCC system_header
......@@ -41,9 +44,33 @@ struct __swap_ranges {
4144 requires indirectly_swappable<_I1, _I2>
4245 _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2>
4346 operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const {
44 auto __ret = std::__swap_ranges<_RangeAlgPolicy>(
45 std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2));
46 return {std::move(__ret.first), std::move(__ret.second)};
47 if constexpr (sized_sentinel_for<_I1, _S1> && sized_sentinel_for<_I2, _S2> &&
48 (random_access_iterator<_I1> || random_access_iterator<_I2> ||
49 (is_same_v<_I1, _S1> && is_same_v<_I2, _S2>))) {
50 auto __offset = std::min(__last1 - __first1, __last2 - __first2);
51
52 auto __ret = [&] {
53 if constexpr (random_access_iterator<_I1>)
54 return std::__swap_ranges<_RangeAlgPolicy>(__first1, __first1 + __offset, std::move(__first2));
55 else if constexpr (random_access_iterator<_I2>)
56 return std::__swap_ranges<_RangeAlgPolicy>(__first2, __first2 + __offset, std::move(__first1));
57 else if (__last2 - __first2 < __last1 - __first1) {
58 auto __reversed =
59 std::__swap_ranges<_RangeAlgPolicy>(std::move(__first2), std::move(__last2), std::move(__first1));
60 return std::pair<_I1, _I2>(std::move(__reversed.second), std::move(__reversed.first));
61 } else
62 return std::__swap_ranges<_RangeAlgPolicy>(std::move(__first1), std::move(__last1), std::move(__first2));
63 }();
64 return {std::move(__ret.first), std::move(__ret.second)};
65 } else {
66 while (__first1 != __last1 && __first2 != __last2) {
67 ranges::iter_swap(__first1, __first2);
68 ++__first1;
69 ++__first2;
70 }
71
72 return {std::move(__first1), std::move(__first2)};
73 }
4774 }
4875
4976 template <input_range _R1, input_range _R2>
lib/libcxx/include/__algorithm/ranges_unique_copy.h+2-5
......@@ -26,7 +26,6 @@
2626#include <__ranges/dangling.h>
2727#include <__utility/forward.h>
2828#include <__utility/move.h>
29#include <__utility/pair.h>
3029
3130#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3231# pragma GCC system_header
......@@ -73,13 +72,12 @@ struct __unique_copy {
7372 indirectly_copyable_storable<_InIter, _OutIter>)
7473 _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<_InIter, _OutIter>
7574 operator()(_InIter __first, _Sent __last, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const {
76 auto __ret = std::__unique_copy<_RangeAlgPolicy>(
75 return std::__unique_copy<_RangeAlgPolicy>(
7776 std::move(__first),
7877 std::move(__last),
7978 std::move(__result),
8079 std::__make_projected(__comp, __proj),
8180 __algo_tag_t<_InIter, _OutIter>());
82 return {std::move(__ret.first), std::move(__ret.second)};
8381 }
8482
8583 template <input_range _Range,
......@@ -92,13 +90,12 @@ struct __unique_copy {
9290 indirectly_copyable_storable<iterator_t<_Range>, _OutIter>)
9391 _LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<borrowed_iterator_t<_Range>, _OutIter>
9492 operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const {
95 auto __ret = std::__unique_copy<_RangeAlgPolicy>(
93 return std::__unique_copy<_RangeAlgPolicy>(
9694 ranges::begin(__range),
9795 ranges::end(__range),
9896 std::move(__result),
9997 std::__make_projected(__comp, __proj),
10098 __algo_tag_t<iterator_t<_Range>, _OutIter>());
101 return {std::move(__ret.first), std::move(__ret.second)};
10299 }
103100};
104101
lib/libcxx/include/__algorithm/rotate.h+2-2
......@@ -39,7 +39,7 @@ __rotate_left(_ForwardIterator __first, _ForwardIterator __last) {
3939 using _Ops = _IterOps<_AlgPolicy>;
4040
4141 value_type __tmp = _Ops::__iter_move(__first);
42 _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).second;
42 _ForwardIterator __lm1 = std::__move<_AlgPolicy>(_Ops::next(__first), __last, __first).__out_;
4343 *__lm1 = std::move(__tmp);
4444 return __lm1;
4545}
......@@ -52,7 +52,7 @@ __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) {
5252
5353 _BidirectionalIterator __lm1 = _Ops::prev(__last);
5454 value_type __tmp = _Ops::__iter_move(__lm1);
55 _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).second;
55 _BidirectionalIterator __fp1 = std::__move_backward<_AlgPolicy>(__first, __lm1, std::move(__last)).__out_;
5656 *__first = std::move(__tmp);
5757 return __fp1;
5858}
lib/libcxx/include/__algorithm/set_difference.h+5-6
......@@ -12,12 +12,10 @@
1212#include <__algorithm/comp.h>
1313#include <__algorithm/comp_ref_type.h>
1414#include <__algorithm/copy.h>
15#include <__algorithm/in_out_result.h>
1516#include <__config>
16#include <__functional/identity.h>
17#include <__iterator/iterator_traits.h>
1817#include <__type_traits/remove_cvref.h>
1918#include <__utility/move.h>
20#include <__utility/pair.h>
2119
2220#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2321# pragma GCC system_header
......@@ -29,7 +27,8 @@ _LIBCPP_PUSH_MACROS
2927_LIBCPP_BEGIN_NAMESPACE_STD
3028
3129template <class _Comp, class _InIter1, class _Sent1, class _InIter2, class _Sent2, class _OutIter>
32_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__remove_cvref_t<_InIter1>, __remove_cvref_t<_OutIter> >
30_LIBCPP_HIDE_FROM_ABI
31_LIBCPP_CONSTEXPR_SINCE_CXX20 __in_out_result<__remove_cvref_t<_InIter1>, __remove_cvref_t<_OutIter> >
3332__set_difference(
3433 _InIter1&& __first1, _Sent1&& __last1, _InIter2&& __first2, _Sent2&& __last2, _OutIter&& __result, _Comp&& __comp) {
3534 while (__first1 != __last1 && __first2 != __last2) {
......@@ -56,7 +55,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
5655 _OutputIterator __result,
5756 _Compare __comp) {
5857 return std::__set_difference<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp)
59 .second;
58 .__out_;
6059}
6160
6261template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
......@@ -66,7 +65,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator set_d
6665 _InputIterator2 __first2,
6766 _InputIterator2 __last2,
6867 _OutputIterator __result) {
69 return std::__set_difference(__first1, __last1, __first2, __last2, __result, __less<>()).second;
68 return std::__set_difference(__first1, __last1, __first2, __last2, __result, __less<>()).__out_;
7069}
7170
7271_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/set_intersection.h+2-5
......@@ -96,12 +96,10 @@ __set_intersection(
9696 _Compare&& __comp,
9797 std::forward_iterator_tag,
9898 std::forward_iterator_tag) {
99 _LIBCPP_CONSTEXPR std::__identity __proj;
10099 bool __prev_may_be_equal = false;
101100
102101 while (__first2 != __last2) {
103 _InForwardIter1 __first1_next =
104 std::__lower_bound_onesided<_AlgPolicy>(__first1, __last1, *__first2, __comp, __proj);
102 _InForwardIter1 __first1_next = std::__lower_bound_onesided<_AlgPolicy>(__first1, __last1, *__first2, __comp);
105103 std::swap(__first1_next, __first1);
106104 // keeping in mind that a==b iff !(a<b) && !(b<a):
107105 // if we can't advance __first1, that means !(*__first1 < *_first2), therefore __may_be_equal==true
......@@ -110,8 +108,7 @@ __set_intersection(
110108 if (__first1 == __last1)
111109 break;
112110
113 _InForwardIter2 __first2_next =
114 std::__lower_bound_onesided<_AlgPolicy>(__first2, __last2, *__first1, __comp, __proj);
111 _InForwardIter2 __first2_next = std::__lower_bound_onesided<_AlgPolicy>(__first2, __last2, *__first1, __comp);
115112 std::swap(__first2_next, __first2);
116113 std::__set_intersection_add_output_if_equal(
117114 __first2 == __first2_next, __first1, __first2, __result, __prev_may_be_equal);
lib/libcxx/include/__algorithm/set_symmetric_difference.h+2-2
......@@ -46,7 +46,7 @@ __set_symmetric_difference(
4646 if (__first2 == __last2) {
4747 auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result));
4848 return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>(
49 std::move(__ret1.first), std::move(__first2), std::move((__ret1.second)));
49 std::move(__ret1.__in_), std::move(__first2), std::move((__ret1.__out_)));
5050 }
5151 if (__comp(*__first1, *__first2)) {
5252 *__result = *__first1;
......@@ -64,7 +64,7 @@ __set_symmetric_difference(
6464 }
6565 auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result));
6666 return __set_symmetric_difference_result<_InIter1, _InIter2, _OutIter>(
67 std::move(__first1), std::move(__ret2.first), std::move((__ret2.second)));
67 std::move(__first1), std::move(__ret2.__in_), std::move((__ret2.__out_)));
6868}
6969
7070template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
lib/libcxx/include/__algorithm/set_union.h+2-2
......@@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1,
4545 if (__first2 == __last2) {
4646 auto __ret1 = std::__copy(std::move(__first1), std::move(__last1), std::move(__result));
4747 return __set_union_result<_InIter1, _InIter2, _OutIter>(
48 std::move(__ret1.first), std::move(__first2), std::move((__ret1.second)));
48 std::move(__ret1.__in_), std::move(__first2), std::move((__ret1.__out_)));
4949 }
5050 if (__comp(*__first2, *__first1)) {
5151 *__result = *__first2;
......@@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __set_union_result<_InIter1,
6060 }
6161 auto __ret2 = std::__copy(std::move(__first2), std::move(__last2), std::move(__result));
6262 return __set_union_result<_InIter1, _InIter2, _OutIter>(
63 std::move(__first1), std::move(__ret2.first), std::move((__ret2.second)));
63 std::move(__first1), std::move(__ret2.__in_), std::move((__ret2.__out_)));
6464}
6565
6666template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
lib/libcxx/include/__algorithm/shift_left.h+30-13
......@@ -9,9 +9,14 @@
99#ifndef _LIBCPP___ALGORITHM_SHIFT_LEFT_H
1010#define _LIBCPP___ALGORITHM_SHIFT_LEFT_H
1111
12#include <__algorithm/iterator_operations.h>
1213#include <__algorithm/move.h>
14#include <__assert>
1315#include <__config>
16#include <__iterator/concepts.h>
1417#include <__iterator/iterator_traits.h>
18#include <__utility/move.h>
19#include <__utility/pair.h>
1520
1621#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1722# pragma GCC system_header
......@@ -24,30 +29,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2429
2530#if _LIBCPP_STD_VER >= 20
2631
27template <class _ForwardIterator>
28inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
29shift_left(_ForwardIterator __first,
30 _ForwardIterator __last,
31 typename iterator_traits<_ForwardIterator>::difference_type __n) {
32template <class _AlgPolicy, class _Iter, class _Sent>
33_LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter, _Iter>
34__shift_left(_Iter __first, _Sent __last, typename _IterOps<_AlgPolicy>::template __difference_type<_Iter> __n) {
35 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "n must be greater than or equal to 0");
36
3237 if (__n == 0) {
33 return __last;
38 _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last);
39 return {std::move(__first), std::move(__end)};
3440 }
3541
36 _ForwardIterator __m = __first;
37 if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
38 if (__n >= __last - __first) {
39 return __first;
42 _Iter __m = __first;
43 if constexpr (sized_sentinel_for<_Sent, _Iter>) {
44 auto __size = _IterOps<_AlgPolicy>::distance(__first, __last);
45 if (__n >= __size) {
46 return {__first, std::move(__first)};
4047 }
41 __m += __n;
48 _IterOps<_AlgPolicy>::advance(__m, __n);
4249 } else {
4350 for (; __n > 0; --__n) {
4451 if (__m == __last) {
45 return __first;
52 return {__first, std::move(__first)};
4653 }
4754 ++__m;
4855 }
4956 }
50 return std::move(__m, __last, __first);
57
58 _Iter __result = std::__move<_AlgPolicy>(__m, __last, __first).__out_;
59 return {std::move(__first), std::move(__result)};
60}
61
62template <class _ForwardIterator>
63_LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
64shift_left(_ForwardIterator __first,
65 _ForwardIterator __last,
66 typename iterator_traits<_ForwardIterator>::difference_type __n) {
67 return std::__shift_left<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __n).second;
5168}
5269
5370#endif // _LIBCPP_STD_VER >= 20
lib/libcxx/include/__algorithm/shift_right.h+53-27
......@@ -9,11 +9,17 @@
99#ifndef _LIBCPP___ALGORITHM_SHIFT_RIGHT_H
1010#define _LIBCPP___ALGORITHM_SHIFT_RIGHT_H
1111
12#include <__algorithm/iterator_operations.h>
1213#include <__algorithm/move.h>
1314#include <__algorithm/move_backward.h>
1415#include <__algorithm/swap_ranges.h>
16#include <__assert>
17#include <__concepts/derived_from.h>
1518#include <__config>
19#include <__iterator/concepts.h>
1620#include <__iterator/iterator_traits.h>
21#include <__utility/move.h>
22#include <__utility/pair.h>
1723#include <__utility/swap.h>
1824
1925#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -27,36 +33,48 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2733
2834#if _LIBCPP_STD_VER >= 20
2935
30template <class _ForwardIterator>
31inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
32shift_right(_ForwardIterator __first,
33 _ForwardIterator __last,
34 typename iterator_traits<_ForwardIterator>::difference_type __n) {
36template <class _AlgPolicy, class _Iter, class _Sent>
37_LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter, _Iter>
38__shift_right(_Iter __first, _Sent __last, typename _IterOps<_AlgPolicy>::template __difference_type<_Iter> __n) {
39 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n >= 0, "Providing a negative shift amount to shift_right is UB");
3540 if (__n == 0) {
36 return __first;
41 _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last);
42 return pair<_Iter, _Iter>(std::move(__first), std::move(__end));
3743 }
3844
39 if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
40 decltype(__n) __d = __last - __first;
41 if (__n >= __d) {
42 return __last;
45 using _IterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_Iter>;
46
47 if constexpr (derived_from<_IterCategory, random_access_iterator_tag>) {
48 _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last);
49 auto __size = __end - __first;
50 if (__n >= __size) {
51 return pair<_Iter, _Iter>(__end, std::move(__end));
52 }
53 _Iter __m = __first;
54 _IterOps<_AlgPolicy>::advance(__m, (__size - __n));
55 auto __ret = std::__move_backward<_AlgPolicy>(std::move(__first), std::move(__m), __end);
56 return pair<_Iter, _Iter>(std::move(__ret.__out_), std::move(__end));
57 } else if constexpr (derived_from<_IterCategory, bidirectional_iterator_tag>) {
58 _Iter __end = _IterOps<_AlgPolicy>::next(__first, __last);
59 if constexpr (sized_sentinel_for<_Sent, _Iter>) {
60 if (__n >= ranges::distance(__first, __last)) {
61 return pair<_Iter, _Iter>(__end, std::move(__end));
62 }
4363 }
44 _ForwardIterator __m = __first + (__d - __n);
45 return std::move_backward(__first, __m, __last);
46 } else if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
47 _ForwardIterator __m = __last;
64 _Iter __m = __end;
4865 for (; __n > 0; --__n) {
4966 if (__m == __first) {
50 return __last;
67 return pair<_Iter, _Iter>(__end, std::move(__end));
5168 }
5269 --__m;
5370 }
54 return std::move_backward(__first, __m, __last);
71 auto __ret = std::__move_backward<_AlgPolicy>(std::move(__first), std::move(__m), __end);
72 return pair<_Iter, _Iter>(std::move(__ret.__out_), std::move(__end));
5573 } else {
56 _ForwardIterator __ret = __first;
74 _Iter __ret = __first;
5775 for (; __n > 0; --__n) {
5876 if (__ret == __last) {
59 return __last;
77 return pair<_Iter, _Iter>(__ret, std::move(__ret));
6078 }
6179 ++__ret;
6280 }
......@@ -64,28 +82,28 @@ shift_right(_ForwardIterator __first,
6482 // We have an __n-element scratch space from __first to __ret.
6583 // Slide an __n-element window [__trail, __lead) from left to right.
6684 // We're essentially doing swap_ranges(__first, __ret, __trail, __lead)
67 // over and over; but once __lead reaches __last we needn't bother
68 // to save the values of elements [__trail, __last).
85 // over and over; but once __lead reaches __end we needn't bother
86 // to save the values of elements [__trail, __end).
6987
7088 auto __trail = __first;
7189 auto __lead = __ret;
7290 while (__trail != __ret) {
7391 if (__lead == __last) {
74 std::move(__first, __trail, __ret);
75 return __ret;
92 std::__move<_AlgPolicy>(std::move(__first), std::move(__trail), __ret);
93 return pair<_Iter, _Iter>(__ret, std::move(__lead));
7694 }
7795 ++__trail;
7896 ++__lead;
7997 }
8098
81 _ForwardIterator __mid = __first;
99 _Iter __mid = __first;
82100 while (true) {
83101 if (__lead == __last) {
84 __trail = std::move(__mid, __ret, __trail);
85 std::move(__first, __mid, __trail);
86 return __ret;
102 __trail = std::__move<_AlgPolicy>(__mid, __ret, __trail).__out_;
103 std::__move<_AlgPolicy>(std::move(__first), std::move(__mid), std::move(__trail));
104 return pair<_Iter, _Iter>(__ret, std::move(__lead));
87105 }
88 swap(*__mid, *__trail);
106 _IterOps<_AlgPolicy>::iter_swap(__mid, __trail);
89107 ++__mid;
90108 ++__trail;
91109 ++__lead;
......@@ -96,6 +114,14 @@ shift_right(_ForwardIterator __first,
96114 }
97115}
98116
117template <class _ForwardIterator>
118_LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
119shift_right(_ForwardIterator __first,
120 _ForwardIterator __last,
121 typename iterator_traits<_ForwardIterator>::difference_type __n) {
122 return std::__shift_right<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __n).first;
123}
124
99125#endif // _LIBCPP_STD_VER >= 20
100126
101127_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__algorithm/shuffle.h+2
......@@ -28,6 +28,7 @@ _LIBCPP_PUSH_MACROS
2828
2929_LIBCPP_BEGIN_NAMESPACE_STD
3030
31_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3132class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer {
3233public:
3334 _LIBCPP_HIDE_FROM_ABI __libcpp_debug_randomizer() {
......@@ -160,6 +161,7 @@ shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRan
160161 std::move(__first), std::move(__last), std::forward<_UniformRandomNumberGenerator>(__g));
161162}
162163
164_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
163165_LIBCPP_END_NAMESPACE_STD
164166
165167_LIBCPP_POP_MACROS
lib/libcxx/include/__algorithm/simd_utils.h+4-12
......@@ -90,6 +90,9 @@ inline constexpr size_t __native_vector_size = 1;
9090template <class _ArithmeticT, size_t _Np>
9191using __simd_vector __attribute__((__ext_vector_type__(_Np))) _LIBCPP_NODEBUG = _ArithmeticT;
9292
93_LIBCPP_DIAGNOSTIC_PUSH
94_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
95
9396template <class _VecT>
9497inline constexpr size_t __simd_vector_size_v = []<bool _False = false>() -> size_t {
9598 static_assert(_False, "Not a vector!");
......@@ -115,8 +118,6 @@ template <class _VecT, class _Iter>
115118}
116119
117120// Load the first _Np elements, zero the rest
118_LIBCPP_DIAGNOSTIC_PUSH
119_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
120121template <class _VecT, size_t _Np, class _Iter>
121122[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT __partial_load(_Iter __iter) noexcept {
122123 return [=]<size_t... _LoadIndices, size_t... _ZeroIndices>(
......@@ -125,16 +126,6 @@ template <class _VecT, size_t _Np, class _Iter>
125126 }(make_index_sequence<_Np>{}, make_index_sequence<__simd_vector_size_v<_VecT> - _Np>{});
126127}
127128
128// Create a vector where every elements is __val
129template <class _VecT>
130[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _VecT
131__broadcast(__simd_vector_underlying_type_t<_VecT> __val) {
132 return [&]<std::size_t... _Indices>(index_sequence<_Indices...>) {
133 return _VecT{((void)_Indices, __val)...};
134 }(make_index_sequence<__simd_vector_size_v<_VecT>>());
135}
136_LIBCPP_DIAGNOSTIC_POP
137
138129template <class _Tp, size_t _Np>
139130[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __any_of(__simd_vector<_Tp, _Np> __vec) noexcept {
140131 return __builtin_reduce_or(__builtin_convertvector(__vec, __simd_vector<bool, _Np>));
......@@ -183,6 +174,7 @@ template <class _Tp, size_t _Np>
183174[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t __find_first_not_set(__simd_vector<_Tp, _Np> __vec) noexcept {
184175 return std::__find_first_set(~__vec);
185176}
177_LIBCPP_DIAGNOSTIC_POP
186178
187179_LIBCPP_END_NAMESPACE_STD
188180
lib/libcxx/include/__algorithm/sort.h+2
......@@ -828,6 +828,7 @@ void __introsort(_RandomAccessIterator __first,
828828 }
829829}
830830
831_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
831832template <class _Comp, class _RandomAccessIterator>
832833void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp);
833834
......@@ -856,6 +857,7 @@ extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<float>&, float*>(fl
856857extern template _LIBCPP_EXPORTED_FROM_ABI void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
857858extern template _LIBCPP_EXPORTED_FROM_ABI void
858859__sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
860_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
859861
860862template <class _AlgPolicy, class _RandomAccessIterator, class _Comp>
861863_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
lib/libcxx/include/__algorithm/specialized_algorithms.h+1
......@@ -21,6 +21,7 @@ namespace _Algorithm {
2121struct __copy {};
2222struct __fill_n {};
2323struct __for_each {};
24struct __swap_ranges {};
2425} // namespace _Algorithm
2526
2627template <class>
lib/libcxx/include/__algorithm/swap_ranges.h+24-178
......@@ -10,12 +10,11 @@
1010#define _LIBCPP___ALGORITHM_SWAP_RANGES_H
1111
1212#include <__algorithm/iterator_operations.h>
13#include <__algorithm/min.h>
13#include <__algorithm/specialized_algorithms.h>
1414#include <__config>
15#include <__fwd/bit_reference.h>
15#include <__type_traits/enable_if.h>
1616#include <__utility/move.h>
1717#include <__utility/pair.h>
18#include <__utility/swap.h>
1918
2019#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2120# pragma GCC system_header
......@@ -26,189 +25,36 @@ _LIBCPP_PUSH_MACROS
2625
2726_LIBCPP_BEGIN_NAMESPACE_STD
2827
29template <class _Cl, class _Cr>
30_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __swap_ranges_aligned(
31 __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) {
32 using _I1 = __bit_iterator<_Cl, false>;
33 using difference_type = typename _I1::difference_type;
34 using __storage_type = typename _I1::__storage_type;
35
36 const int __bits_per_word = _I1::__bits_per_word;
37 difference_type __n = __last - __first;
38 if (__n > 0) {
39 // do first word
40 if (__first.__ctz_ != 0) {
41 unsigned __clz = __bits_per_word - __first.__ctz_;
42 difference_type __dn = std::min(static_cast<difference_type>(__clz), __n);
43 __n -= __dn;
44 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
45 __storage_type __b1 = *__first.__seg_ & __m;
46 *__first.__seg_ &= ~__m;
47 __storage_type __b2 = *__result.__seg_ & __m;
48 *__result.__seg_ &= ~__m;
49 *__result.__seg_ |= __b1;
50 *__first.__seg_ |= __b2;
51 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
52 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
53 ++__first.__seg_;
54 // __first.__ctz_ = 0;
55 }
56 // __first.__ctz_ == 0;
57 // do middle words
58 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_)
59 swap(*__first.__seg_, *__result.__seg_);
60 // do last word
61 if (__n > 0) {
62 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
63 __storage_type __b1 = *__first.__seg_ & __m;
64 *__first.__seg_ &= ~__m;
65 __storage_type __b2 = *__result.__seg_ & __m;
66 *__result.__seg_ &= ~__m;
67 *__result.__seg_ |= __b1;
68 *__first.__seg_ |= __b2;
69 __result.__ctz_ = static_cast<unsigned>(__n);
70 }
71 }
72 return __result;
73}
74
75template <class _Cl, class _Cr>
76_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __swap_ranges_unaligned(
77 __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) {
78 using _I1 = __bit_iterator<_Cl, false>;
79 using difference_type = typename _I1::difference_type;
80 using __storage_type = typename _I1::__storage_type;
81
82 const int __bits_per_word = _I1::__bits_per_word;
83 difference_type __n = __last - __first;
84 if (__n > 0) {
85 // do first word
86 if (__first.__ctz_ != 0) {
87 unsigned __clz_f = __bits_per_word - __first.__ctz_;
88 difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n);
89 __n -= __dn;
90 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
91 __storage_type __b1 = *__first.__seg_ & __m;
92 *__first.__seg_ &= ~__m;
93 unsigned __clz_r = __bits_per_word - __result.__ctz_;
94 __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r);
95 __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
96 __storage_type __b2 = *__result.__seg_ & __m;
97 *__result.__seg_ &= ~__m;
98 if (__result.__ctz_ > __first.__ctz_) {
99 unsigned __s = __result.__ctz_ - __first.__ctz_;
100 *__result.__seg_ |= __b1 << __s;
101 *__first.__seg_ |= __b2 >> __s;
102 } else {
103 unsigned __s = __first.__ctz_ - __result.__ctz_;
104 *__result.__seg_ |= __b1 >> __s;
105 *__first.__seg_ |= __b2 << __s;
106 }
107 __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
108 __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
109 __dn -= __ddn;
110 if (__dn > 0) {
111 __m = ~__storage_type(0) >> (__bits_per_word - __dn);
112 __b2 = *__result.__seg_ & __m;
113 *__result.__seg_ &= ~__m;
114 unsigned __s = __first.__ctz_ + __ddn;
115 *__result.__seg_ |= __b1 >> __s;
116 *__first.__seg_ |= __b2 << __s;
117 __result.__ctz_ = static_cast<unsigned>(__dn);
118 }
119 ++__first.__seg_;
120 // __first.__ctz_ = 0;
121 }
122 // __first.__ctz_ == 0;
123 // do middle words
124 __storage_type __m = ~__storage_type(0) << __result.__ctz_;
125 unsigned __clz_r = __bits_per_word - __result.__ctz_;
126 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) {
127 __storage_type __b1 = *__first.__seg_;
128 __storage_type __b2 = *__result.__seg_ & __m;
129 *__result.__seg_ &= ~__m;
130 *__result.__seg_ |= __b1 << __result.__ctz_;
131 *__first.__seg_ = __b2 >> __result.__ctz_;
132 ++__result.__seg_;
133 __b2 = *__result.__seg_ & ~__m;
134 *__result.__seg_ &= __m;
135 *__result.__seg_ |= __b1 >> __clz_r;
136 *__first.__seg_ |= __b2 << __clz_r;
137 }
138 // do last word
139 if (__n > 0) {
140 __m = ~__storage_type(0) >> (__bits_per_word - __n);
141 __storage_type __b1 = *__first.__seg_ & __m;
142 *__first.__seg_ &= ~__m;
143 __storage_type __dn = std::min<__storage_type>(__n, __clz_r);
144 __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
145 __storage_type __b2 = *__result.__seg_ & __m;
146 *__result.__seg_ &= ~__m;
147 *__result.__seg_ |= __b1 << __result.__ctz_;
148 *__first.__seg_ |= __b2 >> __result.__ctz_;
149 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
150 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
151 __n -= __dn;
152 if (__n > 0) {
153 __m = ~__storage_type(0) >> (__bits_per_word - __n);
154 __b2 = *__result.__seg_ & __m;
155 *__result.__seg_ &= ~__m;
156 *__result.__seg_ |= __b1 >> __dn;
157 *__first.__seg_ |= __b2 << __dn;
158 __result.__ctz_ = static_cast<unsigned>(__n);
159 }
160 }
161 }
162 return __result;
163}
164
165// 2+1 iterators: size2 >= size1; used by std::swap_ranges.
166template <class, class _Cl, class _Cr>
167_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> >
168__swap_ranges(__bit_iterator<_Cl, false> __first1,
169 __bit_iterator<_Cl, false> __last1,
170 __bit_iterator<_Cr, false> __first2) {
171 if (__first1.__ctz_ == __first2.__ctz_)
172 return std::make_pair(__last1, std::__swap_ranges_aligned(__first1, __last1, __first2));
173 return std::make_pair(__last1, std::__swap_ranges_unaligned(__first1, __last1, __first2));
174}
175
176// 2+2 iterators: used by std::ranges::swap_ranges.
177template <class _AlgPolicy, class _Cl, class _Cr>
178_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> >
179__swap_ranges(__bit_iterator<_Cl, false> __first1,
180 __bit_iterator<_Cl, false> __last1,
181 __bit_iterator<_Cr, false> __first2,
182 __bit_iterator<_Cr, false> __last2) {
183 if (__last1 - __first1 < __last2 - __first2)
184 return std::make_pair(__last1, std::__swap_ranges<_AlgPolicy>(__first1, __last1, __first2).second);
185 return std::make_pair(std::__swap_ranges<_AlgPolicy>(__first2, __last2, __first1).second, __last2);
186}
187
188// 2+2 iterators: the shorter size will be used.
189template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _Sentinel2>
190_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
191__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2, _Sentinel2 __last2) {
192 while (__first1 != __last1 && __first2 != __last2) {
193 _IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
194 ++__first1;
195 ++__first2;
196 }
197
198 return pair<_ForwardIterator1, _ForwardIterator2>(std::move(__first1), std::move(__first2));
28template <
29 class _AlgPolicy,
30 class _Iter1,
31 class _Sent1,
32 class _Iter2,
33 class _SpecialAlg =
34 __specialized_algorithm<_Algorithm::__swap_ranges, __iterator_pair<_Iter1, _Sent1>, __single_iterator<_Iter2> >,
35 __enable_if_t<_SpecialAlg::__has_algorithm, int> = 0>
36_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2>
37__swap_ranges(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
38 return _SpecialAlg()(std::move(__first1), std::move(__last1), std::move(__first2));
19939}
20040
201// 2+1 iterators: size2 >= size1.
202template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2>
203_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator1, _ForwardIterator2>
204__swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2) {
41template <
42 class _AlgPolicy,
43 class _Iter1,
44 class _Sent1,
45 class _Iter2,
46 class _SpecialAlg =
47 __specialized_algorithm<_Algorithm::__swap_ranges, __iterator_pair<_Iter1, _Sent1>, __single_iterator<_Iter2> >,
48 __enable_if_t<!_SpecialAlg::__has_algorithm, int> = 0>
49_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2>
50__swap_ranges(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2) {
20551 while (__first1 != __last1) {
20652 _IterOps<_AlgPolicy>::iter_swap(__first1, __first2);
20753 ++__first1;
20854 ++__first2;
20955 }
21056
211 return pair<_ForwardIterator1, _ForwardIterator2>(std::move(__first1), std::move(__first2));
57 return pair<_Iter1, _Iter2>(std::move(__first1), std::move(__first2));
21258}
21359
21460template <class _ForwardIterator1, class _ForwardIterator2>
lib/libcxx/include/__algorithm/three_way_comp_ref_type.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <class _Comp>
2727struct __debug_three_way_comp {
2828 _Comp& __comp_;
......@@ -67,8 +67,8 @@ template <class _Comp>
6767using __three_way_comp_ref_type _LIBCPP_NODEBUG = _Comp&;
6868# endif
6969
70#endif // _LIBCPP_STD_VER >= 20
71
7270_LIBCPP_END_NAMESPACE_STD
7371
72#endif // _LIBCPP_STD_VER >= 20
73
7474#endif // _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
lib/libcxx/include/__algorithm/unique_copy.h+8-8
......@@ -10,6 +10,7 @@
1010#define _LIBCPP___ALGORITHM_UNIQUE_COPY_H
1111
1212#include <__algorithm/comp.h>
13#include <__algorithm/in_out_result.h>
1314#include <__algorithm/iterator_operations.h>
1415#include <__config>
1516#include <__iterator/iterator_traits.h>
......@@ -17,7 +18,6 @@
1718#include <__type_traits/is_base_of.h>
1819#include <__type_traits/is_same.h>
1920#include <__utility/move.h>
20#include <__utility/pair.h>
2121
2222#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2323# pragma GCC system_header
......@@ -37,7 +37,7 @@ struct __read_from_tmp_value_tag {};
3737} // namespace __unique_copy_tags
3838
3939template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _OutputIterator>
40_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _OutputIterator>
40_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_InputIterator, _OutputIterator>
4141__unique_copy(_InputIterator __first,
4242 _Sent __last,
4343 _OutputIterator __result,
......@@ -55,11 +55,11 @@ __unique_copy(_InputIterator __first,
5555 }
5656 }
5757 }
58 return pair<_InputIterator, _OutputIterator>(std::move(__first), std::move(__result));
58 return {std::move(__first), std::move(__result)};
5959}
6060
6161template <class _AlgPolicy, class _BinaryPredicate, class _ForwardIterator, class _Sent, class _OutputIterator>
62_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_ForwardIterator, _OutputIterator>
62_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_ForwardIterator, _OutputIterator>
6363__unique_copy(_ForwardIterator __first,
6464 _Sent __last,
6565 _OutputIterator __result,
......@@ -77,11 +77,11 @@ __unique_copy(_ForwardIterator __first,
7777 }
7878 }
7979 }
80 return pair<_ForwardIterator, _OutputIterator>(std::move(__first), std::move(__result));
80 return {std::move(__first), std::move(__result)};
8181}
8282
8383template <class _AlgPolicy, class _BinaryPredicate, class _InputIterator, class _Sent, class _InputAndOutputIterator>
84_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _InputAndOutputIterator>
84_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __in_out_result<_InputIterator, _InputAndOutputIterator>
8585__unique_copy(_InputIterator __first,
8686 _Sent __last,
8787 _InputAndOutputIterator __result,
......@@ -94,7 +94,7 @@ __unique_copy(_InputIterator __first,
9494 *++__result = *__first;
9595 ++__result;
9696 }
97 return pair<_InputIterator, _InputAndOutputIterator>(std::move(__first), std::move(__result));
97 return {std::move(__first), std::move(__result)};
9898}
9999
100100template <class _InputIterator, class _OutputIterator, class _BinaryPredicate>
......@@ -111,7 +111,7 @@ unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __res
111111 __unique_copy_tags::__read_from_tmp_value_tag> >;
112112 return std::__unique_copy<_ClassicAlgPolicy>(
113113 std::move(__first), std::move(__last), std::move(__result), __pred, __algo_tag())
114 .second;
114 .__out_;
115115}
116116
117117template <class _InputIterator, class _OutputIterator>
lib/libcxx/include/__algorithm/unwrap_iter.h+8-10
......@@ -57,21 +57,19 @@ struct __unwrap_iter_impl<_Iter, true> {
5757 }
5858};
5959
60template <class _Iter,
61 class _Impl = __unwrap_iter_impl<_Iter>,
62 __enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
60template <class _Iter, class _Impl = __unwrap_iter_impl<_Iter> >
6361inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>()))
6462__unwrap_iter(_Iter __i) _NOEXCEPT {
65 return _Impl::__unwrap(__i);
66}
67
6863// Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter)
6964#if _LIBCPP_STD_VER >= 20
70template <class _Iter, __enable_if_t<!is_copy_constructible<_Iter>::value, int> = 0>
71inline _LIBCPP_HIDE_FROM_ABI constexpr _Iter __unwrap_iter(_Iter __i) noexcept {
72 return __i;
73}
65 if constexpr (!is_copy_constructible_v<_Iter>) {
66 return __i;
67 } else
7468#endif
69 {
70 return _Impl::__unwrap(__i);
71 }
72}
7573
7674template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter> >
7775_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT {
lib/libcxx/include/__algorithm/unwrap_range.h+13-42
......@@ -10,10 +10,9 @@
1010#define _LIBCPP___ALGORITHM_UNWRAP_RANGE_H
1111
1212#include <__algorithm/unwrap_iter.h>
13#include <__concepts/constructible.h>
1413#include <__config>
1514#include <__iterator/concepts.h>
16#include <__iterator/next.h>
15#include <__type_traits/is_same.h>
1716#include <__utility/declval.h>
1817#include <__utility/move.h>
1918#include <__utility/pair.h>
......@@ -33,52 +32,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3332
3433#if _LIBCPP_STD_VER >= 20
3534template <class _Iter, class _Sent>
36struct __unwrap_range_impl {
37 _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent)
38 requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>
39 {
40 auto __last = ranges::next(__first, __sent);
35_LIBCPP_HIDE_FROM_ABI constexpr auto __unwrap_range(_Iter __first, _Sent __last) {
36 if constexpr (is_same_v<_Iter, _Sent>)
4137 return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))};
42 }
43
44 _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __last) {
38 else if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
39 auto __iter_last = __first + (__last - __first);
40 return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__iter_last))};
41 } else
4542 return pair{std::move(__first), std::move(__last)};
46 }
47
48 _LIBCPP_HIDE_FROM_ABI static constexpr auto
49 __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(std::move(__orig_iter))) __iter)
50 requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>
51 {
52 return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
53 }
54
55 _LIBCPP_HIDE_FROM_ABI static constexpr auto __rewrap(const _Iter&, _Iter __iter)
56 requires(!(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>))
57 {
58 return __iter;
59 }
60};
61
62template <class _Iter>
63struct __unwrap_range_impl<_Iter, _Iter> {
64 _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Iter __last) {
65 return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))};
66 }
67
68 _LIBCPP_HIDE_FROM_ABI static constexpr auto
69 __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(__orig_iter)) __iter) {
70 return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
71 }
72};
73
74template <class _Iter, class _Sent>
75_LIBCPP_HIDE_FROM_ABI constexpr auto __unwrap_range(_Iter __first, _Sent __last) {
76 return __unwrap_range_impl<_Iter, _Sent>::__unwrap(std::move(__first), std::move(__last));
7743}
7844
7945template < class _Sent, class _Iter, class _Unwrapped>
8046_LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) {
81 return __unwrap_range_impl<_Iter, _Sent>::__rewrap(std::move(__orig_iter), std::move(__iter));
47 if constexpr (is_same_v<_Iter, _Sent>)
48 return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
49 else if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>)
50 return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter));
51 else
52 return __iter;
8253}
8354#else // _LIBCPP_STD_VER >= 20
8455template <class _Iter, class _Unwrapped = decltype(std::__unwrap_iter(std::declval<_Iter>()))>
lib/libcxx/include/__assert+1-1
......@@ -20,7 +20,7 @@
2020#define _LIBCPP_ASSERT(expression, message) \
2121 (__builtin_expect(static_cast<bool>(expression), 1) \
2222 ? (void)0 \
23 : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING( \
23 : _LIBCPP_ASSERTION_HANDLER(__FILE_NAME__ ":" _LIBCPP_TOSTRING( \
2424 __LINE__) ": libc++ Hardening assertion " _LIBCPP_TOSTRING(expression) " failed: " message "\n"))
2525
2626// WARNING: __builtin_assume can currently inhibit optimizations. Only add assumptions with a clear
lib/libcxx/include/__atomic/atomic.h+2-4
......@@ -26,9 +26,7 @@
2626#include <__type_traits/is_nothrow_constructible.h>
2727#include <__type_traits/is_same.h>
2828#include <__type_traits/is_trivially_copyable.h>
29#include <__type_traits/remove_const.h>
3029#include <__type_traits/remove_pointer.h>
31#include <__type_traits/remove_volatile.h>
3230#include <__utility/forward.h>
3331#include <cstring>
3432
......@@ -297,13 +295,13 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> {
297295 }
298296
299297 _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
300 // __atomic_fetch_add accepts function pointers, guard against them.
298 // __atomic_fetch_sub accepts function pointers, guard against them.
301299 static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
302300 return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
303301 }
304302
305303 _LIBCPP_HIDE_FROM_ABI _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT {
306 // __atomic_fetch_add accepts function pointers, guard against them.
304 // __atomic_fetch_sub accepts function pointers, guard against them.
307305 static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed");
308306 return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m);
309307 }
lib/libcxx/include/__atomic/atomic_flag.h+14-20
......@@ -11,14 +11,10 @@
1111
1212#include <__atomic/atomic_sync.h>
1313#include <__atomic/atomic_waitable_traits.h>
14#include <__atomic/contention_t.h>
1514#include <__atomic/memory_order.h>
1615#include <__atomic/support.h>
17#include <__chrono/duration.h>
1816#include <__config>
1917#include <__memory/addressof.h>
20#include <__thread/support.h>
21#include <cstdint>
2218
2319#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2420# pragma GCC system_header
......@@ -27,34 +23,34 @@
2723_LIBCPP_BEGIN_NAMESPACE_STD
2824
2925struct atomic_flag {
30 __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_;
26 __cxx_atomic_impl<bool> __a_;
3127
3228 _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
33 return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
29 return __cxx_atomic_load(&__a_, __m);
3430 }
3531 _LIBCPP_HIDE_FROM_ABI bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
36 return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);
32 return __cxx_atomic_load(&__a_, __m);
3733 }
3834
3935 _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
40 return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
36 return __cxx_atomic_exchange(&__a_, true, __m);
4137 }
4238 _LIBCPP_HIDE_FROM_ABI bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
43 return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);
39 return __cxx_atomic_exchange(&__a_, true, __m);
4440 }
4541 _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT {
46 __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
42 __cxx_atomic_store(&__a_, false, __m);
4743 }
4844 _LIBCPP_HIDE_FROM_ABI void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT {
49 __cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);
45 __cxx_atomic_store(&__a_, false, __m);
5046 }
5147
5248#if _LIBCPP_STD_VER >= 20
5349 _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT {
54 std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
50 std::__atomic_wait(*this, __v, __m);
5551 }
5652 _LIBCPP_HIDE_FROM_ABI void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT {
57 std::__atomic_wait(*this, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);
53 std::__atomic_wait(*this, __v, __m);
5854 }
5955 _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { std::__atomic_notify_one(*this); }
6056 _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { std::__atomic_notify_one(*this); }
......@@ -78,23 +74,21 @@ struct atomic_flag {
7874#if _LIBCPP_STD_VER >= 20
7975template <>
8076struct __atomic_waitable_traits<atomic_flag> {
81 using __value_type _LIBCPP_NODEBUG = _LIBCPP_ATOMIC_FLAG_TYPE;
77 using __value_type _LIBCPP_NODEBUG = bool;
8278
83 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE __atomic_load(const atomic_flag& __a, memory_order __order) {
79 static _LIBCPP_HIDE_FROM_ABI bool __atomic_load(const atomic_flag& __a, memory_order __order) {
8480 return std::__cxx_atomic_load(&__a.__a_, __order);
8581 }
8682
87 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATOMIC_FLAG_TYPE
88 __atomic_load(const volatile atomic_flag& __a, memory_order __order) {
83 static _LIBCPP_HIDE_FROM_ABI bool __atomic_load(const volatile atomic_flag& __a, memory_order __order) {
8984 return std::__cxx_atomic_load(&__a.__a_, __order);
9085 }
9186
92 static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>*
93 __atomic_contention_address(const atomic_flag& __a) {
87 static _LIBCPP_HIDE_FROM_ABI const __cxx_atomic_impl<bool>* __atomic_contention_address(const atomic_flag& __a) {
9488 return std::addressof(__a.__a_);
9589 }
9690
97 static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE>*
91 static _LIBCPP_HIDE_FROM_ABI const volatile __cxx_atomic_impl<bool>*
9892 __atomic_contention_address(const volatile atomic_flag& __a) {
9993 return std::addressof(__a.__a_);
10094 }
lib/libcxx/include/__atomic/atomic_ref.h+14-5
......@@ -30,9 +30,10 @@
3030#include <__cstddef/byte.h>
3131#include <__cstddef/ptrdiff_t.h>
3232#include <__memory/addressof.h>
33#include <__memory/is_sufficiently_aligned.h>
34#include <__type_traits/copy_cv.h>
3335#include <__type_traits/has_unique_object_representation.h>
3436#include <__type_traits/is_trivially_copyable.h>
35#include <cstdint>
3637#include <cstring>
3738
3839#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -224,7 +225,7 @@ public:
224225 _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); }
225226 _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); }
226227# if _LIBCPP_STD_VER >= 26
227 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* address() const noexcept { return __ptr_; }
228 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __copy_cv_t<_Tp, void>* address() const noexcept { return __ptr_; }
228229# endif
229230
230231protected:
......@@ -254,10 +255,12 @@ struct atomic_ref : public __atomic_ref_base<_Tp> {
254255
255256 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
256257 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
257 reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
258 std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)),
258259 "atomic_ref ctor: referenced object must be aligned to required_alignment");
259260 }
260261
262 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete;
263
261264 _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
262265
263266 _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
......@@ -274,10 +277,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
274277
275278 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
276279 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
277 reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
280 std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)),
278281 "atomic_ref ctor: referenced object must be aligned to required_alignment");
279282 }
280283
284 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete;
285
281286 _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
282287
283288 _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
......@@ -320,10 +325,12 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
320325
321326 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp& __obj) : __base(__obj) {
322327 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
323 reinterpret_cast<uintptr_t>(std::addressof(__obj)) % __base::required_alignment == 0,
328 std::__is_sufficiently_aligned<__base::required_alignment>(std::addressof(__obj)),
324329 "atomic_ref ctor: referenced object must be aligned to required_alignment");
325330 }
326331
332 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp&&) = delete;
333
327334 _LIBCPP_HIDE_FROM_ABI atomic_ref(const atomic_ref&) noexcept = default;
328335
329336 _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __desired) const noexcept { return __base::operator=(__desired); }
......@@ -367,6 +374,8 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
367374
368375 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*& __ptr) : __base(__ptr) {}
369376
377 _LIBCPP_HIDE_FROM_ABI explicit atomic_ref(_Tp*&&) = delete;
378
370379 _LIBCPP_HIDE_FROM_ABI _Tp* operator=(_Tp* __desired) const noexcept { return __base::operator=(__desired); }
371380
372381 atomic_ref& operator=(const atomic_ref&) = delete;
lib/libcxx/include/__atomic/atomic_sync.h+8-9
......@@ -12,28 +12,25 @@
1212#include <__atomic/atomic_waitable_traits.h>
1313#include <__atomic/contention_t.h>
1414#include <__atomic/memory_order.h>
15#include <__atomic/to_gcc_order.h>
1615#include <__chrono/duration.h>
1716#include <__config>
1817#include <__memory/addressof.h>
1918#include <__thread/poll_with_backoff.h>
20#include <__type_traits/conjunction.h>
2119#include <__type_traits/decay.h>
22#include <__type_traits/invoke.h>
23#include <__type_traits/is_same.h>
24#include <__type_traits/void_t.h>
25#include <__utility/declval.h>
2620#include <cstring>
2721
2822#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2923# pragma GCC system_header
3024#endif
3125
26#if _LIBCPP_STD_VER >= 20
27
3228_LIBCPP_BEGIN_NAMESPACE_STD
3329
34#if _LIBCPP_STD_VER >= 20
3530# if _LIBCPP_HAS_THREADS
3631
32_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
33
3734# if !_LIBCPP_AVAILABILITY_HAS_NEW_SYNC
3835
3936// old dylib interface kept for backwards compatibility
......@@ -79,6 +76,8 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one
7976template <std::size_t _Size>
8077_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(const void*) _NOEXCEPT;
8178
79_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
80
8281# if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
8382
8483template <class _AtomicWaitable, class _Poll>
......@@ -260,8 +259,8 @@ _LIBCPP_HIDE_FROM_ABI void __atomic_wait(_AtomicWaitable& __a, _Tp __val, memory
260259 });
261260}
262261
263#endif // C++20
264
265262_LIBCPP_END_NAMESPACE_STD
266263
264#endif // _LIBCPP_STD_VER >= 20
265
267266#endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_H
lib/libcxx/include/__atomic/atomic_sync_timed.h+9-14
......@@ -12,20 +12,12 @@
1212#include <__atomic/atomic_waitable_traits.h>
1313#include <__atomic/contention_t.h>
1414#include <__atomic/memory_order.h>
15#include <__atomic/to_gcc_order.h>
1615#include <__chrono/duration.h>
1716#include <__config>
1817#include <__memory/addressof.h>
1918#include <__thread/poll_with_backoff.h>
2019#include <__thread/timed_backoff_policy.h>
21#include <__type_traits/conjunction.h>
2220#include <__type_traits/decay.h>
23#include <__type_traits/has_unique_object_representation.h>
24#include <__type_traits/invoke.h>
25#include <__type_traits/is_same.h>
26#include <__type_traits/is_trivially_copyable.h>
27#include <__type_traits/void_t.h>
28#include <__utility/declval.h>
2921#include <cstdint>
3022#include <cstring>
3123
......@@ -33,11 +25,13 @@
3325# pragma GCC system_header
3426#endif
3527
28#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
29
3630_LIBCPP_BEGIN_NAMESPACE_STD
3731
38#if _LIBCPP_STD_VER >= 20
39# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
32# if _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
4033
34_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4135_LIBCPP_AVAILABILITY_NEW_SYNC
4236_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __address) _NOEXCEPT;
4337
......@@ -49,6 +43,7 @@ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_globa
4943template <std::size_t _Size>
5044_LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
5145__atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) _NOEXCEPT;
46_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5247
5348template <class _AtomicWaitable, class _Poll, class _Rep, class _Period>
5449struct __atomic_wait_timed_backoff_impl {
......@@ -116,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout(
116111 return __poll_result == __poll_with_backoff_results::__poll_success;
117112}
118113
119# elif _LIBCPP_HAS_THREADS // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
114# else // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
120115
121116template <class _AtomicWaitable, class _Poll, class _Rep, class _Period>
122117_LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout(
......@@ -135,10 +130,10 @@ _LIBCPP_HIDE_FROM_ABI bool __atomic_wait_unless_with_timeout(
135130 return __res == __poll_with_backoff_results::__poll_success;
136131}
137132
138# endif // _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
139
140#endif // C++20
133# endif // _LIBCPP_AVAILABILITY_HAS_NEW_SYNC
141134
142135_LIBCPP_END_NAMESPACE_STD
143136
137#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
138
144139#endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_TIMED_H
lib/libcxx/include/__atomic/atomic_waitable_traits.h+4-6
......@@ -16,18 +16,16 @@
1616#include <__type_traits/has_unique_object_representation.h>
1717#include <__type_traits/is_same.h>
1818#include <__type_traits/is_trivially_copyable.h>
19#include <__type_traits/void_t.h>
20#include <__utility/declval.h>
2119#include <cstring>
2220
2321#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2422# pragma GCC system_header
2523#endif
2624
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2925#if _LIBCPP_STD_VER >= 20
3026
27_LIBCPP_BEGIN_NAMESPACE_STD
28
3129// The customisation points to enable the following functions:
3230// - __atomic_wait
3331// - __atomic_wait_unless
......@@ -96,8 +94,8 @@ concept __has_native_atomic_wait = is_same_v<_Tp, __cxx_contention_t>;
9694
9795# endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
9896
99#endif // C++20
100
10197_LIBCPP_END_NAMESPACE_STD
10298
99#endif // _LIBCPP_STD_VER >= 20
100
103101#endif // _LIBCPP___ATOMIC_ATOMIC_WAITABLE_TRAITS_H
lib/libcxx/include/__atomic/contention_t.h+4-4
......@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2525// instead.
2626#if defined(_LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE)
2727
28# ifdef __linux__
28# if defined(__linux__) || defined(__Fuchsia__)
2929using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
3030# elif defined(__APPLE__)
3131using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
......@@ -37,15 +37,15 @@ using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
3737using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
3838# else
3939using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
40# endif // __linux__
40# endif // __linux__ || __Fuchsia__
4141
4242#else // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
4343
44# if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
44# if defined(__linux__) || defined(__Fuchsia__) || (defined(_AIX) && !defined(__64BIT__))
4545using __cxx_contention_t _LIBCPP_NODEBUG = int32_t;
4646# else
4747using __cxx_contention_t _LIBCPP_NODEBUG = int64_t;
48# endif // __linux__ || (_AIX && !__64BIT__)
48# endif // __linux__ || __Fuchsia__ || (_AIX && !__64BIT__)
4949
5050#endif // _LIBCPP_ABI_ATOMIC_WAIT_NATIVE_BY_SIZE
5151
lib/libcxx/include/__atomic/floating_point_helper.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Tp>
2525_LIBCPP_HIDE_FROM_ABI constexpr bool __is_fp80_long_double() {
2626 // Only x87-fp80 long double has 64-bit mantissa
......@@ -48,8 +48,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_rmw_builtin() {
4848# endif
4949}
5050
51#endif
52
5351_LIBCPP_END_NAMESPACE_STD
5452
53#endif // _LIBCPP_STD_VER >= 20
54
5555#endif // _LIBCPP___ATOMIC_FLOATING_POINT_HELPER_H
lib/libcxx/include/__atomic/support.h+2-2
......@@ -102,9 +102,9 @@
102102// clang-format on
103103//
104104
105#if _LIBCPP_HAS_GCC_ATOMIC_IMP
105#ifdef _LIBCPP_COMPILER_GCC
106106# include <__atomic/support/gcc.h>
107#elif _LIBCPP_HAS_C_ATOMIC_IMP
107#else
108108# include <__atomic/support/c11.h>
109109#endif
110110
lib/libcxx/include/__bit/bit_cast.h+6-6
......@@ -17,18 +17,16 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#ifndef _LIBCPP_CXX03_LANG
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _ToType, class _FromType>
2525[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr _ToType __bit_cast(const _FromType& __from) noexcept {
2626 return __builtin_bit_cast(_ToType, __from);
2727}
2828
29#endif // _LIBCPP_CXX03_LANG
30
31#if _LIBCPP_STD_VER >= 20
29# if _LIBCPP_STD_VER >= 20
3230
3331template <class _ToType, class _FromType>
3432 requires(sizeof(_ToType) == sizeof(_FromType) && is_trivially_copyable_v<_ToType> &&
......@@ -37,8 +35,10 @@ template <class _ToType, class _FromType>
3735 return __builtin_bit_cast(_ToType, __from);
3836}
3937
40#endif // _LIBCPP_STD_VER >= 20
38# endif // _LIBCPP_STD_VER >= 20
4139
4240_LIBCPP_END_NAMESPACE_STD
4341
42#endif // _LIBCPP_CXX03_LANG
43
4444#endif // _LIBCPP___BIT_BIT_CAST_H
lib/libcxx/include/__bit/bit_ceil.h+4-3
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 17
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <class _Tp>
2727[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) noexcept {
2828 if (__t < 2)
......@@ -47,8 +47,9 @@ template <__unsigned_integer _Tp>
4747}
4848
4949# endif // _LIBCPP_STD_VER >= 20
50#endif // _LIBCPP_STD_VER >= 17
5150
5251_LIBCPP_END_NAMESPACE_STD
5352
53#endif // _LIBCPP_STD_VER >= 17
54
5455#endif // _LIBCPP___BIT_BIT_CEIL_H
lib/libcxx/include/__bit/byteswap.h+25-6
......@@ -12,7 +12,11 @@
1212
1313#include <__concepts/arithmetic.h>
1414#include <__config>
15#include <__type_traits/is_same.h>
16#include <__type_traits/remove_cv.h>
17#include <climits>
1518#include <cstdint>
19#include <limits>
1620
1721#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1822# pragma GCC system_header
......@@ -24,26 +28,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2428
2529template <integral _Tp>
2630[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept {
31 // [bit.byteswap]/Mandates: T does not have padding bits.
32 // bool is grandfathered: every shipping implementation admits it and the
33 // size-1 identity path can't shuffle padding bits into value positions.
34 // LWG 4583 proposes relaxing this to allow byte-aligned padding (e.g.
35 // _BitInt(48) where 2 whole bytes are padding); revisit once it resolves.
36 static_assert(is_same_v<remove_cv_t<_Tp>, bool> ||
37 numeric_limits<_Tp>::digits + numeric_limits<_Tp>::is_signed == sizeof(_Tp) * CHAR_BIT,
38 "std::byteswap requires T to have no padding bits");
39
2740 if constexpr (sizeof(_Tp) == 1) {
2841 return __val;
42# if __has_builtin(__builtin_bswapg)
43 } else {
44 return __builtin_bswapg(__val);
45 }
46# else
2947 } else if constexpr (sizeof(_Tp) == 2) {
3048 return __builtin_bswap16(__val);
3149 } else if constexpr (sizeof(_Tp) == 4) {
3250 return __builtin_bswap32(__val);
3351 } else if constexpr (sizeof(_Tp) == 8) {
3452 return __builtin_bswap64(__val);
35# if _LIBCPP_HAS_INT128
53# if _LIBCPP_HAS_INT128
3654 } else if constexpr (sizeof(_Tp) == 16) {
37# if __has_builtin(__builtin_bswap128)
55# if __has_builtin(__builtin_bswap128)
3856 return __builtin_bswap128(__val);
39# else
40 return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
57# else
58 return (static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64) |
4159 static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
42# endif // __has_builtin(__builtin_bswap128)
43# endif // _LIBCPP_HAS_INT128
60# endif // __has_builtin(__builtin_bswap128)
61# endif // _LIBCPP_HAS_INT128
4462 } else {
4563 static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
4664 }
65# endif // __has_builtin(__builtin_bswapg)
4766}
4867
4968#endif // _LIBCPP_STD_VER >= 23
lib/libcxx/include/__bit_reference+164-23
......@@ -16,10 +16,10 @@
1616#include <__algorithm/copy_n.h>
1717#include <__algorithm/equal.h>
1818#include <__algorithm/fill_n.h>
19#include <__algorithm/in_out_result.h>
1920#include <__algorithm/min.h>
2021#include <__algorithm/rotate.h>
2122#include <__algorithm/specialized_algorithms.h>
22#include <__algorithm/swap_ranges.h>
2323#include <__assert>
2424#include <__bit/countr.h>
2525#include <__compare/ordering.h>
......@@ -35,7 +35,6 @@
3535#include <__type_traits/desugars_to.h>
3636#include <__type_traits/enable_if.h>
3737#include <__type_traits/is_constant_evaluated.h>
38#include <__type_traits/is_same.h>
3938#include <__type_traits/is_unsigned.h>
4039#include <__type_traits/void_t.h>
4140#include <__utility/pair.h>
......@@ -166,9 +165,6 @@ public:
166165 }
167166
168167 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void flip() _NOEXCEPT { *__seg_ ^= __mask_; }
169 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cp, false> operator&() const _NOEXCEPT {
170 return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(std::__countr_zero(__mask_)));
171 }
172168
173169private:
174170 _LIBCPP_HIDE_FROM_ABI
......@@ -340,7 +336,7 @@ public:
340336 }
341337#endif
342338
343 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT {
339 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator*() const _NOEXCEPT {
344340 _LIBCPP_ASSERT_INTERNAL(__ctz_ < __bits_per_word, "Dereferencing an invalid __bit_iterator.");
345341 return __conditional_t<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >(
346342 __seg_, __storage_type(1) << __ctz_);
......@@ -393,29 +389,32 @@ public:
393389 return *this += -__n;
394390 }
395391
396 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator+(difference_type __n) const {
392 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator
393 operator+(difference_type __n) const {
397394 __bit_iterator __t(*this);
398395 __t += __n;
399396 return __t;
400397 }
401398
402 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator operator-(difference_type __n) const {
399 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator
400 operator-(difference_type __n) const {
403401 __bit_iterator __t(*this);
404402 __t -= __n;
405403 return __t;
406404 }
407405
408 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator
406 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator
409407 operator+(difference_type __n, const __bit_iterator& __it) {
410408 return __it + __n;
411409 }
412410
413 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend difference_type
411 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend difference_type
414412 operator-(const __bit_iterator& __x, const __bit_iterator& __y) {
415413 return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;
416414 }
417415
418 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](difference_type __n) const {
416 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference
417 operator[](difference_type __n) const {
419418 return *(*this + __n);
420419 }
421420
......@@ -487,15 +486,6 @@ private:
487486 __bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result);
488487 template <class _AlgPolicy>
489488 friend struct __copy_backward_impl;
490 template <class _Cl, class _Cr>
491 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Cr, false>
492 __swap_ranges_aligned(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>);
493 template <class _Cl, class _Cr>
494 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Cr, false>
495 __swap_ranges_unaligned(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>);
496 template <class, class _Cl, class _Cr>
497 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> >
498 __swap_ranges(__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false>, __bit_iterator<_Cr, false>);
499489 template <class, class _Dp>
500490 _LIBCPP_CONSTEXPR_SINCE_CXX20 friend pair<__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false> >
501491 __rotate(__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>);
......@@ -718,13 +708,164 @@ struct __specialized_algorithm<_Algorithm::__copy,
718708 }
719709
720710 _LIBCPP_HIDE_FROM_ABI
721 _LIBCPP_CONSTEXPR_SINCE_CXX20 static pair<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
711 _LIBCPP_CONSTEXPR_SINCE_CXX20 static __in_out_result<__bit_iterator<_Cp, _IsConst>, __bit_iterator<_Cp, false> >
722712 operator()(__bit_iterator<_Cp, _IsConst> __first,
723713 __bit_iterator<_Cp, _IsConst> __last,
724714 __bit_iterator<_Cp, false> __result) {
725715 if (__first.__ctz_ == __result.__ctz_)
726 return std::make_pair(__last, __aligned_impl(__first, __last, __result));
727 return std::make_pair(__last, __unaligned_impl(__first, __last, __result));
716 return {__last, __aligned_impl(__first, __last, __result)};
717 return {__last, __unaligned_impl(__first, __last, __result)};
718 }
719};
720
721template <class _Cl, class _Cr>
722struct __specialized_algorithm<_Algorithm::__swap_ranges,
723 __iterator_pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cl, false> >,
724 __single_iterator<__bit_iterator<_Cr, false> > > {
725 static const bool __has_algorithm = true;
726
727 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __aligned_impl(
728 __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) {
729 using _I1 = __bit_iterator<_Cl, false>;
730 using difference_type = typename _I1::difference_type;
731 using __storage_type = typename _I1::__storage_type;
732
733 const int __bits_per_word = _I1::__bits_per_word;
734 difference_type __n = __last - __first;
735 if (__n > 0) {
736 // do first word
737 if (__first.__ctz_ != 0) {
738 unsigned __clz = __bits_per_word - __first.__ctz_;
739 difference_type __dn = std::min(static_cast<difference_type>(__clz), __n);
740 __n -= __dn;
741 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
742 __storage_type __b1 = *__first.__seg_ & __m;
743 *__first.__seg_ &= ~__m;
744 __storage_type __b2 = *__result.__seg_ & __m;
745 *__result.__seg_ &= ~__m;
746 *__result.__seg_ |= __b1;
747 *__first.__seg_ |= __b2;
748 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
749 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
750 ++__first.__seg_;
751 // __first.__ctz_ = 0;
752 }
753 // __first.__ctz_ == 0;
754 // do middle words
755 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_)
756 swap(*__first.__seg_, *__result.__seg_);
757 // do last word
758 if (__n > 0) {
759 __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
760 __storage_type __b1 = *__first.__seg_ & __m;
761 *__first.__seg_ &= ~__m;
762 __storage_type __b2 = *__result.__seg_ & __m;
763 *__result.__seg_ &= ~__m;
764 *__result.__seg_ |= __b1;
765 *__first.__seg_ |= __b2;
766 __result.__ctz_ = static_cast<unsigned>(__n);
767 }
768 }
769 return __result;
770 }
771
772 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator<_Cr, false> __unaligned_impl(
773 __bit_iterator<_Cl, false> __first, __bit_iterator<_Cl, false> __last, __bit_iterator<_Cr, false> __result) {
774 using _I1 = __bit_iterator<_Cl, false>;
775 using difference_type = typename _I1::difference_type;
776 using __storage_type = typename _I1::__storage_type;
777
778 const int __bits_per_word = _I1::__bits_per_word;
779 difference_type __n = __last - __first;
780 if (__n > 0) {
781 // do first word
782 if (__first.__ctz_ != 0) {
783 unsigned __clz_f = __bits_per_word - __first.__ctz_;
784 difference_type __dn = std::min(static_cast<difference_type>(__clz_f), __n);
785 __n -= __dn;
786 __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
787 __storage_type __b1 = *__first.__seg_ & __m;
788 *__first.__seg_ &= ~__m;
789 unsigned __clz_r = __bits_per_word - __result.__ctz_;
790 __storage_type __ddn = std::min<__storage_type>(__dn, __clz_r);
791 __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
792 __storage_type __b2 = *__result.__seg_ & __m;
793 *__result.__seg_ &= ~__m;
794 if (__result.__ctz_ > __first.__ctz_) {
795 unsigned __s = __result.__ctz_ - __first.__ctz_;
796 *__result.__seg_ |= __b1 << __s;
797 *__first.__seg_ |= __b2 >> __s;
798 } else {
799 unsigned __s = __first.__ctz_ - __result.__ctz_;
800 *__result.__seg_ |= __b1 >> __s;
801 *__first.__seg_ |= __b2 << __s;
802 }
803 __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word;
804 __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word);
805 __dn -= __ddn;
806 if (__dn > 0) {
807 __m = ~__storage_type(0) >> (__bits_per_word - __dn);
808 __b2 = *__result.__seg_ & __m;
809 *__result.__seg_ &= ~__m;
810 unsigned __s = __first.__ctz_ + __ddn;
811 *__result.__seg_ |= __b1 >> __s;
812 *__first.__seg_ |= __b2 << __s;
813 __result.__ctz_ = static_cast<unsigned>(__dn);
814 }
815 ++__first.__seg_;
816 // __first.__ctz_ = 0;
817 }
818 // __first.__ctz_ == 0;
819 // do middle words
820 __storage_type __m = ~__storage_type(0) << __result.__ctz_;
821 unsigned __clz_r = __bits_per_word - __result.__ctz_;
822 for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) {
823 __storage_type __b1 = *__first.__seg_;
824 __storage_type __b2 = *__result.__seg_ & __m;
825 *__result.__seg_ &= ~__m;
826 *__result.__seg_ |= __b1 << __result.__ctz_;
827 *__first.__seg_ = __b2 >> __result.__ctz_;
828 ++__result.__seg_;
829 __b2 = *__result.__seg_ & ~__m;
830 *__result.__seg_ &= __m;
831 *__result.__seg_ |= __b1 >> __clz_r;
832 *__first.__seg_ |= __b2 << __clz_r;
833 }
834 // do last word
835 if (__n > 0) {
836 __m = ~__storage_type(0) >> (__bits_per_word - __n);
837 __storage_type __b1 = *__first.__seg_ & __m;
838 *__first.__seg_ &= ~__m;
839 __storage_type __dn = std::min<__storage_type>(__n, __clz_r);
840 __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
841 __storage_type __b2 = *__result.__seg_ & __m;
842 *__result.__seg_ &= ~__m;
843 *__result.__seg_ |= __b1 << __result.__ctz_;
844 *__first.__seg_ |= __b2 >> __result.__ctz_;
845 __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word;
846 __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word);
847 __n -= __dn;
848 if (__n > 0) {
849 __m = ~__storage_type(0) >> (__bits_per_word - __n);
850 __b2 = *__result.__seg_ & __m;
851 *__result.__seg_ &= ~__m;
852 *__result.__seg_ |= __b1 >> __dn;
853 *__first.__seg_ |= __b2 << __dn;
854 __result.__ctz_ = static_cast<unsigned>(__n);
855 }
856 }
857 }
858 return __result;
859 }
860
861 _LIBCPP_HIDE_FROM_ABI static
862 _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<__bit_iterator<_Cl, false>, __bit_iterator<_Cr, false> >
863 operator()(__bit_iterator<_Cl, false> __first1,
864 __bit_iterator<_Cl, false> __last1,
865 __bit_iterator<_Cr, false> __first2) {
866 if (__first1.__ctz_ == __first2.__ctz_)
867 return std::make_pair(__last1, __aligned_impl(__first1, __last1, __first2));
868 return std::make_pair(__last1, __unaligned_impl(__first1, __last1, __first2));
728869 }
729870};
730871
lib/libcxx/include/__charconv/from_chars_floating_point.h+2
......@@ -35,6 +35,7 @@ struct __from_chars_result {
3535 errc __ec;
3636};
3737
38_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3839template <class _Fp>
3940_LIBCPP_EXPORTED_FROM_ABI __from_chars_result<_Fp> __from_chars_floating_point(
4041 _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt);
......@@ -44,6 +45,7 @@ extern template __from_chars_result<float> __from_chars_floating_point(
4445
4546extern template __from_chars_result<double> __from_chars_floating_point(
4647 _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt);
48_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4749
4850template <class _Fp>
4951_LIBCPP_HIDE_FROM_ABI from_chars_result
lib/libcxx/include/__charconv/from_chars_integral.h+1-4
......@@ -10,12 +10,10 @@
1010#ifndef _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H
1111#define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H
1212
13#include <__algorithm/copy_n.h>
1413#include <__assert>
1514#include <__charconv/from_chars_result.h>
1615#include <__charconv/traits.h>
1716#include <__config>
18#include <__memory/addressof.h>
1917#include <__system_error/errc.h>
2018#include <__type_traits/enable_if.h>
2119#include <__type_traits/is_integral.h>
......@@ -56,8 +54,7 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
5654
5755 if (__neg) {
5856 if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) {
59 __x = std::__complement(__x);
60 std::copy_n(std::addressof(__x), 1, std::addressof(__value));
57 __value = std::__complement(__x);
6158 return __r;
6259 }
6360 } else {
lib/libcxx/include/__charconv/to_chars.h-4
......@@ -18,8 +18,4 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23_LIBCPP_END_NAMESPACE_STD
24
2521#endif // _LIBCPP___CHARCONV_TO_CHARS
lib/libcxx/include/__charconv/to_chars_floating_point.h+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324#if _LIBCPP_STD_VER >= 17
2425
......@@ -50,6 +51,7 @@ _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_EXPORTED_FROM_ABI to_chars_
5051to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision);
5152#endif // _LIBCPP_STD_VER >= 17
5253
54_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5355_LIBCPP_END_NAMESPACE_STD
5456
5557#endif // _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H
lib/libcxx/include/__chrono/convert_to_tm.h+4-1
......@@ -127,7 +127,10 @@ _LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::tai_time<_Duration> __tp) {
127127
128128template <class _Tm, class _Duration>
129129_LIBCPP_HIDE_FROM_ABI _Tm __convert_to_tm(chrono::gps_time<_Duration> __tp) {
130 return std::__convert_to_tm<_Tm>(chrono::utc_clock::to_sys(chrono::gps_clock::to_utc(__tp)));
130 using _Rp = common_type_t<_Duration, chrono::seconds>;
131 // The time between the GPS epoch (1980-01-06) and UNIX epoch (1970-01-01).
132 constexpr chrono::seconds __offset{3657 * 24 * 60 * 60};
133 return std::__convert_to_tm<_Tm>(chrono::sys_time<_Rp>{__tp.time_since_epoch() + __offset});
131134}
132135
133136# endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/day.h+8-6
......@@ -55,7 +55,7 @@ public:
5555 _LIBCPP_HIDE_FROM_ABI constexpr day& operator+=(const days& __dd) noexcept;
5656 _LIBCPP_HIDE_FROM_ABI constexpr day& operator-=(const days& __dd) noexcept;
5757 _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __d_; }
58 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
58 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __d_ >= 1 && __d_ <= 31; }
5959};
6060
6161_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const day& __lhs, const day& __rhs) noexcept {
......@@ -66,19 +66,19 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const day& __
6666 return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
6767}
6868
69_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
69[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const day& __lhs, const days& __rhs) noexcept {
7070 return day(static_cast<unsigned>(__lhs) + __rhs.count());
7171}
7272
73_LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
73[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator+(const days& __lhs, const day& __rhs) noexcept {
7474 return __rhs + __lhs;
7575}
7676
77_LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
77[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr day operator-(const day& __lhs, const days& __rhs) noexcept {
7878 return __lhs + -__rhs;
7979}
8080
81_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
81[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const day& __lhs, const day& __rhs) noexcept {
8282 return days(static_cast<int>(static_cast<unsigned>(__lhs)) - static_cast<int>(static_cast<unsigned>(__rhs)));
8383}
8484
......@@ -98,7 +98,9 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr day& day::operator-=(const days& __dd) no
9898
9999template <>
100100struct hash<chrono::day> {
101 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept { return static_cast<unsigned>(__d); }
101 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::day& __d) noexcept {
102 return static_cast<unsigned>(__d);
103 }
102104};
103105
104106# endif // _LIBCPP_STD_VER >= 26
lib/libcxx/include/__chrono/duration.h+12-38
......@@ -19,6 +19,7 @@
1919#include <__type_traits/enable_if.h>
2020#include <__type_traits/is_convertible.h>
2121#include <__type_traits/is_floating_point.h>
22#include <__type_traits/is_unqualified.h>
2223#include <limits>
2324#include <ratio>
2425
......@@ -164,6 +165,7 @@ template <class _ToDuration, class _Rep, class _Period, enable_if_t<__is_duratio
164165
165166template <class _Rep, class _Period>
166167class duration {
168 static_assert(__is_unqualified_v<_Rep>, "A duration representation cannot be qualified");
167169 static_assert(!__is_duration_v<_Rep>, "A duration representation can not be a duration");
168170 static_assert(__is_ratio_v<_Period>, "Second template parameter of duration must be a std::ratio");
169171 static_assert(_Period::num > 0, "duration period must be positive");
......@@ -291,35 +293,21 @@ typedef duration<long long, nano> nanoseconds;
291293typedef duration<long long, micro> microseconds;
292294typedef duration<long long, milli> milliseconds;
293295typedef duration<long long > seconds;
294typedef duration< long, ratio< 60> > minutes;
295typedef duration< long, ratio<3600> > hours;
296typedef duration<long, ratio<60> > minutes;
297typedef duration<long, ratio<60 * 60> > hours;
296298#if _LIBCPP_STD_VER >= 20
297typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days;
298typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks;
299typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years;
300typedef duration< int, ratio_divide<years::period, ratio<12>>> months;
299typedef duration<int, ratio<60 * 60 * 24>> days;
300typedef duration<int, ratio<60 * 60 * 24 * 7>> weeks;
301typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24)>> years;
302typedef duration<int, ratio<static_cast<int>(365.2425 * 60 * 60 * 24) / 12>> months;
301303#endif
302304// Duration ==
303305
304template <class _LhsDuration, class _RhsDuration>
305struct __duration_eq {
306 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
307 typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
308 return _Ct(__lhs).count() == _Ct(__rhs).count();
309 }
310};
311
312template <class _LhsDuration>
313struct __duration_eq<_LhsDuration, _LhsDuration> {
314 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
315 return __lhs.count() == __rhs.count();
316 }
317};
318
319306template <class _Rep1, class _Period1, class _Rep2, class _Period2>
320307inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
321308operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
322 return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
309 using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type;
310 return _Ct(__lhs).count() == _Ct(__rhs).count();
323311}
324312
325313#if _LIBCPP_STD_VER <= 17
......@@ -336,25 +324,11 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
336324
337325// Duration <
338326
339template <class _LhsDuration, class _RhsDuration>
340struct __duration_lt {
341 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const {
342 typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
343 return _Ct(__lhs).count() < _Ct(__rhs).count();
344 }
345};
346
347template <class _LhsDuration>
348struct __duration_lt<_LhsDuration, _LhsDuration> {
349 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {
350 return __lhs.count() < __rhs.count();
351 }
352};
353
354327template <class _Rep1, class _Period1, class _Rep2, class _Period2>
355328inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
356329operator<(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
357 return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs);
330 using _Ct = typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type;
331 return _Ct(__lhs).count() < _Ct(__rhs).count();
358332}
359333
360334// Duration >
lib/libcxx/include/__chrono/exception.h+2
......@@ -31,6 +31,7 @@
3131# endif
3232
3333_LIBCPP_BEGIN_NAMESPACE_STD
34_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3435
3536# if _LIBCPP_STD_VER >= 20
3637
......@@ -128,6 +129,7 @@ template <class _Duration>
128129
129130# endif // _LIBCPP_STD_VER >= 20
130131
132_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
131133_LIBCPP_END_NAMESPACE_STD
132134
133135#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/file_clock.h+4
......@@ -46,6 +46,8 @@ _LIBCPP_END_NAMESPACE_STD
4646
4747#ifndef _LIBCPP_CXX03_LANG
4848_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
49_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
50
4951struct _FilesystemClock {
5052# if _LIBCPP_HAS_INT128
5153 typedef __int128_t rep;
......@@ -76,6 +78,8 @@ struct _FilesystemClock {
7678 }
7779# endif // _LIBCPP_STD_VER >= 20
7880};
81
82_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7983_LIBCPP_END_NAMESPACE_FILESYSTEM
8084#endif // !_LIBCPP_CXX03_LANG
8185
lib/libcxx/include/__chrono/gps_clock.h+4-4
......@@ -28,10 +28,10 @@
2828_LIBCPP_PUSH_MACROS
2929# include <__undef_macros>
3030
31_LIBCPP_BEGIN_NAMESPACE_STD
32
3331# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
3432
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3535namespace chrono {
3636
3737class gps_clock;
......@@ -78,11 +78,11 @@ public:
7878
7979} // namespace chrono
8080
81_LIBCPP_END_NAMESPACE_STD
82
8183# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
8284 // _LIBCPP_HAS_LOCALIZATION
8385
84_LIBCPP_END_NAMESPACE_STD
85
8686_LIBCPP_POP_MACROS
8787
8888#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/hh_mm_ss.h+10-10
......@@ -59,13 +59,13 @@ public:
5959 __s_(chrono::duration_cast<chrono::seconds>(chrono::abs(__d) - hours() - minutes())),
6060 __f_(chrono::duration_cast<precision>(chrono::abs(__d) - hours() - minutes() - seconds())) {}
6161
62 _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
63 _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
64 _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
65 _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
66 _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_negative() const noexcept { return __is_neg_; }
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::hours hours() const noexcept { return __h_; }
64 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes minutes() const noexcept { return __m_; }
65 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds seconds() const noexcept { return __s_; }
66 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision subseconds() const noexcept { return __f_; }
6767
68 _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr precision to_duration() const noexcept {
6969 auto __dur = __h_ + __m_ + __s_ + __f_;
7070 return __is_neg_ ? -__dur : __dur;
7171 }
......@@ -81,14 +81,14 @@ private:
8181};
8282_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss);
8383
84_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
84[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_am(const hours& __h) noexcept {
8585 return __h >= hours(0) && __h < hours(12);
8686}
87_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
87[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_pm(const hours& __h) noexcept {
8888 return __h >= hours(12) && __h < hours(24);
8989}
9090
91_LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
91[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
9292 if (__h == hours(0))
9393 return hours(12);
9494 else if (__h <= hours(12))
......@@ -97,7 +97,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr hours make12(const hours& __h) noexcept {
9797 return __h - hours(12);
9898}
9999
100_LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
100[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr hours make24(const hours& __h, bool __is_pm) noexcept {
101101 if (__is_pm)
102102 return __h == hours(12) ? __h : __h + hours(12);
103103 else
lib/libcxx/include/__chrono/literals.h+2-2
......@@ -24,11 +24,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424
2525inline namespace literals {
2626inline namespace chrono_literals {
27_LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
27[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day operator""d(unsigned long long __d) noexcept {
2828 return chrono::day(static_cast<unsigned>(__d));
2929}
3030
31_LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
31[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::year operator""y(unsigned long long __y) noexcept {
3232 return chrono::year(static_cast<int>(__y));
3333}
3434} // namespace chrono_literals
lib/libcxx/include/__chrono/month.h+6-6
......@@ -55,7 +55,7 @@ public:
5555 _LIBCPP_HIDE_FROM_ABI constexpr month& operator+=(const months& __m1) noexcept;
5656 _LIBCPP_HIDE_FROM_ABI constexpr month& operator-=(const months& __m1) noexcept;
5757 _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator unsigned() const noexcept { return __m_; }
58 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
58 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_ >= 1 && __m_ <= 12; }
5959};
6060
6161_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const month& __lhs, const month& __rhs) noexcept {
......@@ -66,21 +66,21 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const month&
6666 return static_cast<unsigned>(__lhs) <=> static_cast<unsigned>(__rhs);
6767}
6868
69_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
69[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const month& __lhs, const months& __rhs) noexcept {
7070 auto const __mu = static_cast<long long>(static_cast<unsigned>(__lhs)) + (__rhs.count() - 1);
7171 auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12;
7272 return month{static_cast<unsigned>(__mu - __yr * 12 + 1)};
7373}
7474
75_LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
75[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator+(const months& __lhs, const month& __rhs) noexcept {
7676 return __rhs + __lhs;
7777}
7878
79_LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
79[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month operator-(const month& __lhs, const months& __rhs) noexcept {
8080 return __lhs + -__rhs;
8181}
8282
83_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
83[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const month& __lhs, const month& __rhs) noexcept {
8484 auto const __dm = static_cast<unsigned>(__lhs) - static_cast<unsigned>(__rhs);
8585 return months(__dm <= 11 ? __dm : __dm + 12);
8686}
......@@ -114,7 +114,7 @@ inline constexpr month December{12};
114114
115115template <>
116116struct hash<chrono::month> {
117 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept {
117 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month& __m) noexcept {
118118 return static_cast<unsigned>(__m);
119119 }
120120};
lib/libcxx/include/__chrono/month_weekday.h+24-16
......@@ -35,9 +35,11 @@ public:
3535 _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
3636 const chrono::weekday_indexed& __wdival) noexcept
3737 : __m_{__mval}, __wdi_{__wdival} {}
38 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
39 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
40 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
38 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
39 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept {
40 return __wdi_;
41 }
42 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
4143};
4244
4345_LIBCPP_HIDE_FROM_ABI inline constexpr bool
......@@ -45,21 +47,23 @@ operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
4547 return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
4648}
4749
48_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
50[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
4951operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
5052 return month_weekday{__lhs, __rhs};
5153}
5254
53_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
55[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
56operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
5457 return month_weekday{month(__lhs), __rhs};
5558}
5659
57_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
60[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
5861operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
5962 return month_weekday{__rhs, __lhs};
6063}
6164
62_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
65[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
66operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
6367 return month_weekday{month(__rhs), __lhs};
6468}
6569
......@@ -71,9 +75,11 @@ public:
7175 _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
7276 const chrono::weekday_last& __wdlval) noexcept
7377 : __m_{__mval}, __wdl_{__wdlval} {}
74 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
75 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
76 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
78 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept {
80 return __wdl_;
81 }
82 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
7783};
7884
7985_LIBCPP_HIDE_FROM_ABI inline constexpr bool
......@@ -81,21 +87,23 @@ operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noe
8187 return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
8288}
8389
84_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
90[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
8591operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
8692 return month_weekday_last{__lhs, __rhs};
8793}
8894
89_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {
95[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
96operator/(int __lhs, const weekday_last& __rhs) noexcept {
9097 return month_weekday_last{month(__lhs), __rhs};
9198}
9299
93_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
100[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
94101operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
95102 return month_weekday_last{__rhs, __lhs};
96103}
97104
98_LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {
105[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
106operator/(const weekday_last& __lhs, int __rhs) noexcept {
99107 return month_weekday_last{month(__rhs), __lhs};
100108}
101109} // namespace chrono
......@@ -104,7 +112,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekda
104112
105113template <>
106114struct hash<chrono::month_weekday> {
107 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept {
115 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday& __mw) noexcept {
108116 return std::__hash_combine(
109117 hash<chrono::month>{}(__mw.month()), hash<chrono::weekday_indexed>{}(__mw.weekday_indexed()));
110118 }
......@@ -112,7 +120,7 @@ struct hash<chrono::month_weekday> {
112120
113121template <>
114122struct hash<chrono::month_weekday_last> {
115 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept {
123 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_weekday_last& __mwl) noexcept {
116124 return std::__hash_combine(
117125 hash<chrono::month>{}(__mwl.month()), hash<chrono::weekday_last>{}(__mwl.weekday_last()));
118126 }
lib/libcxx/include/__chrono/monthday.h+18-16
......@@ -37,9 +37,9 @@ public:
3737 month_day() = default;
3838 _LIBCPP_HIDE_FROM_ABI constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept
3939 : __m_{__mval}, __d_{__dval} {}
40 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
41 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
42 _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
40 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
41 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
42 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
4343};
4444
4545_LIBCPP_HIDE_FROM_ABI inline constexpr bool month_day::ok() const noexcept {
......@@ -70,23 +70,25 @@ operator<=>(const month_day& __lhs, const month_day& __rhs) noexcept {
7070 return __lhs.day() <=> __rhs.day();
7171}
7272
73_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, const day& __rhs) noexcept {
73[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day
74operator/(const month& __lhs, const day& __rhs) noexcept {
7475 return month_day{__lhs, __rhs};
7576}
7677
77_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, const month& __rhs) noexcept {
78[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day
79operator/(const day& __lhs, const month& __rhs) noexcept {
7880 return __rhs / __lhs;
7981}
8082
81_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
83[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const month& __lhs, int __rhs) noexcept {
8284 return __lhs / day(__rhs);
8385}
8486
85_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
87[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(int __lhs, const day& __rhs) noexcept {
8688 return month(__lhs) / __rhs;
8789}
8890
89_LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
91[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day operator/(const day& __lhs, int __rhs) noexcept {
9092 return month(__rhs) / __lhs;
9193}
9294
......@@ -96,8 +98,8 @@ private:
9698
9799public:
98100 _LIBCPP_HIDE_FROM_ABI explicit constexpr month_day_last(const chrono::month& __val) noexcept : __m_{__val} {}
99 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
100 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
101 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
102 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok(); }
101103};
102104
103105_LIBCPP_HIDE_FROM_ABI inline constexpr bool
......@@ -110,19 +112,19 @@ operator<=>(const month_day_last& __lhs, const month_day_last& __rhs) noexcept {
110112 return __lhs.month() <=> __rhs.month();
111113}
112114
113_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
115[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(const month& __lhs, last_spec) noexcept {
114116 return month_day_last{__lhs};
115117}
116118
117_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
119[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, const month& __rhs) noexcept {
118120 return month_day_last{__rhs};
119121}
120122
121_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
123[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(int __lhs, last_spec) noexcept {
122124 return month_day_last{month(__lhs)};
123125}
124126
125_LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
127[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int __rhs) noexcept {
126128 return month_day_last{month(__rhs)};
127129}
128130
......@@ -132,14 +134,14 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr month_day_last operator/(last_spec, int _
132134
133135template <>
134136struct hash<chrono::month_day> {
135 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept {
137 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day& __md) noexcept {
136138 return std::__hash_combine(hash<chrono::month>{}(__md.month()), hash<chrono::day>{}(__md.day()));
137139 }
138140};
139141
140142template <>
141143struct hash<chrono::month_day_last> {
142 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept {
144 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::month_day_last& __mdl) noexcept {
143145 return hash<chrono::month>{}(__mdl.month());
144146 }
145147};
lib/libcxx/include/__chrono/steady_clock.h+6-2
......@@ -18,11 +18,13 @@
1818# pragma GCC system_header
1919#endif
2020
21#if _LIBCPP_HAS_MONOTONIC_CLOCK
22
2123_LIBCPP_BEGIN_NAMESPACE_STD
24_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2225
2326namespace chrono {
2427
25#if _LIBCPP_HAS_MONOTONIC_CLOCK
2628class _LIBCPP_EXPORTED_FROM_ABI steady_clock {
2729public:
2830 typedef nanoseconds duration;
......@@ -33,10 +35,12 @@ public:
3335
3436 [[__nodiscard__]] static time_point now() _NOEXCEPT;
3537};
36#endif
3738
3839} // namespace chrono
3940
41_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4042_LIBCPP_END_NAMESPACE_STD
4143
44#endif
45
4246#endif // _LIBCPP___CHRONO_STEADY_CLOCK_H
lib/libcxx/include/__chrono/system_clock.h+2
......@@ -20,6 +20,7 @@
2020#endif
2121
2222_LIBCPP_BEGIN_NAMESPACE_STD
23_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2324
2425namespace chrono {
2526
......@@ -47,6 +48,7 @@ using sys_days = sys_time<days>;
4748
4849} // namespace chrono
4950
51_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5052_LIBCPP_END_NAMESPACE_STD
5153
5254#endif // _LIBCPP___CHRONO_SYSTEM_CLOCK_H
lib/libcxx/include/__chrono/tai_clock.h+4-4
......@@ -28,10 +28,10 @@
2828_LIBCPP_PUSH_MACROS
2929# include <__undef_macros>
3030
31_LIBCPP_BEGIN_NAMESPACE_STD
32
3331# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
3432
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3535namespace chrono {
3636
3737class tai_clock;
......@@ -96,11 +96,11 @@ public:
9696
9797} // namespace chrono
9898
99_LIBCPP_END_NAMESPACE_STD
100
99101# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
100102 // _LIBCPP_HAS_LOCALIZATION
101103
102_LIBCPP_END_NAMESPACE_STD
103
104104_LIBCPP_POP_MACROS
105105
106106#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/time_zone.h+6-4
......@@ -35,10 +35,11 @@
3535_LIBCPP_PUSH_MACROS
3636# include <__undef_macros>
3737
38_LIBCPP_BEGIN_NAMESPACE_STD
39
4038# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
4139
40_LIBCPP_BEGIN_NAMESPACE_STD
41_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
42
4243namespace chrono {
4344
4445enum class choose { earliest, latest };
......@@ -173,11 +174,12 @@ operator<=>(const time_zone& __x, const time_zone& __y) noexcept {
173174
174175} // namespace chrono
175176
177_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
178_LIBCPP_END_NAMESPACE_STD
179
176180# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
177181 // _LIBCPP_HAS_LOCALIZATION
178182
179_LIBCPP_END_NAMESPACE_STD
180
181183_LIBCPP_POP_MACROS
182184
183185#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/time_zone_link.h+4-4
......@@ -29,10 +29,10 @@
2929_LIBCPP_PUSH_MACROS
3030# include <__undef_macros>
3131
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3432# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
3533
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3636namespace chrono {
3737
3838class time_zone_link {
......@@ -67,11 +67,11 @@ operator<=>(const time_zone_link& __x, const time_zone_link& __y) noexcept {
6767
6868} // namespace chrono
6969
70_LIBCPP_END_NAMESPACE_STD
71
7072# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
7173 // _LIBCPP_HAS_LOCALIZATION
7274
73_LIBCPP_END_NAMESPACE_STD
74
7575_LIBCPP_POP_MACROS
7676
7777#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/tzdb.h+6-4
......@@ -34,10 +34,11 @@
3434_LIBCPP_PUSH_MACROS
3535# include <__undef_macros>
3636
37_LIBCPP_BEGIN_NAMESPACE_STD
38
3937# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
4038
39_LIBCPP_BEGIN_NAMESPACE_STD
40_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
41
4142namespace chrono {
4243
4344struct tzdb {
......@@ -84,11 +85,12 @@ private:
8485
8586} // namespace chrono
8687
88_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
89_LIBCPP_END_NAMESPACE_STD
90
8791# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
8892 // _LIBCPP_HAS_LOCALIZATION
8993
90_LIBCPP_END_NAMESPACE_STD
91
9294_LIBCPP_POP_MACROS
9395
9496#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__chrono/tzdb_list.h+6-4
......@@ -27,10 +27,11 @@
2727# pragma GCC system_header
2828# endif
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
34
3435namespace chrono {
3536
3637// TODO TZDB
......@@ -98,11 +99,12 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI const tzdb& reload_tzdb();
9899
99100} // namespace chrono
100101
102_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
103_LIBCPP_END_NAMESPACE_STD
104
101105# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
102106 // _LIBCPP_HAS_LOCALIZATION
103107
104_LIBCPP_END_NAMESPACE_STD
105
106108#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
107109
108110#endif // _LIBCPP___CHRONO_TZDB_LIST_H
lib/libcxx/include/__chrono/utc_clock.h+4-4
......@@ -27,10 +27,10 @@
2727# pragma GCC system_header
2828# endif
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3434namespace chrono {
3535
3636class utc_clock;
......@@ -153,11 +153,11 @@ utc_clock::to_sys(const utc_time<_Duration>& __time) {
153153
154154} // namespace chrono
155155
156_LIBCPP_END_NAMESPACE_STD
157
156158# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
157159 // _LIBCPP_HAS_LOCALIZATION
158160
159_LIBCPP_END_NAMESPACE_STD
160
161161#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
162162
163163#endif // _LIBCPP___CHRONO_UTC_CLOCK_H
lib/libcxx/include/__chrono/weekday.h+27-17
......@@ -65,11 +65,13 @@ public:
6565 }
6666 _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator+=(const days& __dd) noexcept;
6767 _LIBCPP_HIDE_FROM_ABI constexpr weekday& operator-=(const days& __dd) noexcept;
68 _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
69 _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept { return __wd_ == 0u ? 7 : __wd_; }
70 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
71 _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
72 _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned c_encoding() const noexcept { return __wd_; }
69 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned iso_encoding() const noexcept {
70 return __wd_ == 0u ? 7 : __wd_;
71 }
72 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_ <= 6; }
73 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_indexed operator[](unsigned __index) const noexcept;
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr weekday_last operator[](last_spec) const noexcept;
7375};
7476
7577// https://howardhinnant.github.io/date_algorithms.html#weekday_from_days
......@@ -81,21 +83,25 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, con
8183 return __lhs.c_encoding() == __rhs.c_encoding();
8284}
8385
84_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept {
86[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
87operator+(const weekday& __lhs, const days& __rhs) noexcept {
8588 auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
8689 auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
8790 return weekday{static_cast<unsigned>(__mu - __yr * 7)};
8891}
8992
90_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept {
93[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
94operator+(const days& __lhs, const weekday& __rhs) noexcept {
9195 return __rhs + __lhs;
9296}
9397
94_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept {
98[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr weekday
99operator-(const weekday& __lhs, const days& __rhs) noexcept {
95100 return __lhs + -__rhs;
96101}
97102
98_LIBCPP_HIDE_FROM_ABI inline constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
103[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr days
104operator-(const weekday& __lhs, const weekday& __rhs) noexcept {
99105 const int __wdu = __lhs.c_encoding() - __rhs.c_encoding();
100106 const int __wk = (__wdu >= 0 ? __wdu : __wdu - 6) / 7;
101107 return days{__wdu - __wk * 7};
......@@ -120,9 +126,11 @@ public:
120126 weekday_indexed() = default;
121127 _LIBCPP_HIDE_FROM_ABI inline constexpr weekday_indexed(const chrono::weekday& __wdval, unsigned __idxval) noexcept
122128 : __wd_{__wdval}, __idx_(__idxval) {}
123 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
124 _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
125 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5; }
129 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wd_; }
130 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __idx_; }
131 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
132 return __wd_.ok() && __idx_ >= 1 && __idx_ <= 5;
133 }
126134};
127135
128136_LIBCPP_HIDE_FROM_ABI inline constexpr bool
......@@ -136,8 +144,8 @@ private:
136144
137145public:
138146 _LIBCPP_HIDE_FROM_ABI explicit constexpr weekday_last(const chrono::weekday& __val) noexcept : __wd_{__val} {}
139 _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
140 _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
147 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::weekday weekday() const noexcept { return __wd_; }
148 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept { return __wd_.ok(); }
141149};
142150
143151_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept {
......@@ -166,19 +174,21 @@ inline constexpr weekday Saturday{6};
166174
167175template <>
168176struct hash<chrono::weekday> {
169 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept { return __w.c_encoding(); }
177 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday& __w) noexcept {
178 return __w.c_encoding();
179 }
170180};
171181
172182template <>
173183struct hash<chrono::weekday_indexed> {
174 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept {
184 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_indexed& __wi) noexcept {
175185 return std::__hash_combine(hash<chrono::weekday>{}(__wi.weekday()), __wi.index());
176186 }
177187};
178188
179189template <>
180190struct hash<chrono::weekday_last> {
181 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept {
191 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::weekday_last& __wl) noexcept {
182192 return hash<chrono::weekday>{}(__wl.weekday());
183193 }
184194};
lib/libcxx/include/__chrono/year.h+13-11
......@@ -58,16 +58,16 @@ public:
5858 }
5959 _LIBCPP_HIDE_FROM_ABI constexpr year& operator+=(const years& __dy) noexcept;
6060 _LIBCPP_HIDE_FROM_ABI constexpr year& operator-=(const years& __dy) noexcept;
61 _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
62 _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
61 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+() const noexcept { return *this; }
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-() const noexcept { return year{-__y_}; }
6363
64 _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
64 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_leap() const noexcept {
6565 return __y_ % 4 == 0 && (__y_ % 100 != 0 || __y_ % 400 == 0);
6666 }
6767 _LIBCPP_HIDE_FROM_ABI explicit inline constexpr operator int() const noexcept { return __y_; }
68 _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
69 _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
70 _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
69 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year min() noexcept { return year{-32767}; }
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static inline constexpr year max() noexcept { return year{32767}; }
7171};
7272
7373_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const year& __lhs, const year& __rhs) noexcept {
......@@ -78,19 +78,19 @@ _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const year& __lhs, c
7878 return static_cast<int>(__lhs) <=> static_cast<int>(__rhs);
7979}
8080
81_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
81[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const year& __lhs, const years& __rhs) noexcept {
8282 return year(static_cast<int>(__lhs) + __rhs.count());
8383}
8484
85_LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
85[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator+(const years& __lhs, const year& __rhs) noexcept {
8686 return __rhs + __lhs;
8787}
8888
89_LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
89[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year operator-(const year& __lhs, const years& __rhs) noexcept {
9090 return __lhs + -__rhs;
9191}
9292
93_LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
93[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr years operator-(const year& __lhs, const year& __rhs) noexcept {
9494 return years{static_cast<int>(__lhs) - static_cast<int>(__rhs)};
9595}
9696
......@@ -115,7 +115,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool year::ok() const noexcept {
115115
116116template <>
117117struct hash<chrono::year> {
118 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept { return static_cast<int>(__y); }
118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year& __y) noexcept {
119 return static_cast<int>(__y);
120 }
119121};
120122
121123# endif // _LIBCPP_STD_VER >= 26
lib/libcxx/include/__chrono/year_month.h+20-13
......@@ -36,20 +36,20 @@ public:
3636 year_month() = default;
3737 _LIBCPP_HIDE_FROM_ABI constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept
3838 : __y_{__yval}, __m_{__mval} {}
39 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
40 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
39 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
40 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
4141 _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const months& __dm) noexcept;
4242 _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const months& __dm) noexcept;
4343 _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator+=(const years& __dy) noexcept;
4444 _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& operator-=(const years& __dy) noexcept;
45 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
45 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok(); }
4646};
4747
48_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
48[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, const month& __m) noexcept {
4949 return year_month{__y, __m};
5050}
5151
52_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
52[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator/(const year& __y, int __m) noexcept {
5353 return year_month{__y, month(__m)};
5454}
5555
......@@ -64,35 +64,42 @@ operator<=>(const year_month& __lhs, const year_month& __rhs) noexcept {
6464 return __lhs.month() <=> __rhs.month();
6565}
6666
67_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept {
67[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
68operator+(const year_month& __lhs, const months& __rhs) noexcept {
6869 int __dmi = static_cast<int>(static_cast<unsigned>(__lhs.month())) - 1 + __rhs.count();
6970 const int __dy = (__dmi >= 0 ? __dmi : __dmi - 11) / 12;
7071 __dmi = __dmi - __dy * 12 + 1;
7172 return (__lhs.year() + years(__dy)) / month(static_cast<unsigned>(__dmi));
7273}
7374
74_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept {
75[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
76operator+(const months& __lhs, const year_month& __rhs) noexcept {
7577 return __rhs + __lhs;
7678}
7779
78_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept {
80[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
81operator+(const year_month& __lhs, const years& __rhs) noexcept {
7982 return (__lhs.year() + __rhs) / __lhs.month();
8083}
8184
82_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept {
85[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
86operator+(const years& __lhs, const year_month& __rhs) noexcept {
8387 return __rhs + __lhs;
8488}
8589
86_LIBCPP_HIDE_FROM_ABI inline constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
90[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr months
91operator-(const year_month& __lhs, const year_month& __rhs) noexcept {
8792 return (__lhs.year() - __rhs.year()) +
8893 months(static_cast<unsigned>(__lhs.month()) - static_cast<unsigned>(__rhs.month()));
8994}
9095
91_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept {
96[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
97operator-(const year_month& __lhs, const months& __rhs) noexcept {
9298 return __lhs + -__rhs;
9399}
94100
95_LIBCPP_HIDE_FROM_ABI inline constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept {
101[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month
102operator-(const year_month& __lhs, const years& __rhs) noexcept {
96103 return __lhs + -__rhs;
97104}
98105
......@@ -122,7 +129,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr year_month& year_month::operator-=(const
122129
123130template <>
124131struct hash<chrono::year_month> {
125 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept {
132 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month& __ym) noexcept {
126133 return std::__hash_combine(hash<chrono::year>{}(__ym.year()), hash<chrono::month>{}(__ym.month()));
127134 }
128135};
lib/libcxx/include/__chrono/year_month_day.h+45-34
......@@ -59,15 +59,15 @@ public:
5959 _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator+=(const years& __dy) noexcept;
6060 _LIBCPP_HIDE_FROM_ABI constexpr year_month_day& operator-=(const years& __dy) noexcept;
6161
62 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
63 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
64 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
64 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day day() const noexcept { return __d_; }
6565 _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
6666 _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
6767 return local_days{__to_days()};
6868 }
6969
70 _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool ok() const noexcept;
7171
7272 _LIBCPP_HIDE_FROM_ABI static constexpr year_month_day __from_days(days __d) noexcept;
7373 _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
......@@ -119,56 +119,62 @@ operator<=>(const year_month_day& __lhs, const year_month_day& __rhs) noexcept {
119119 return __lhs.day() <=> __rhs.day();
120120}
121121
122_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept {
122[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
123operator/(const year_month& __lhs, const day& __rhs) noexcept {
123124 return year_month_day{__lhs.year(), __lhs.month(), __rhs};
124125}
125126
126_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year_month& __lhs, int __rhs) noexcept {
127[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
128operator/(const year_month& __lhs, int __rhs) noexcept {
127129 return __lhs / day(__rhs);
128130}
129131
130_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept {
132[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
133operator/(const year& __lhs, const month_day& __rhs) noexcept {
131134 return __lhs / __rhs.month() / __rhs.day();
132135}
133136
134_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(int __lhs, const month_day& __rhs) noexcept {
137[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
138operator/(int __lhs, const month_day& __rhs) noexcept {
135139 return year(__lhs) / __rhs;
136140}
137141
138_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept {
142[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
143operator/(const month_day& __lhs, const year& __rhs) noexcept {
139144 return __rhs / __lhs;
140145}
141146
142_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day operator/(const month_day& __lhs, int __rhs) noexcept {
147[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
148operator/(const month_day& __lhs, int __rhs) noexcept {
143149 return year(__rhs) / __lhs;
144150}
145151
146_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
152[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
147153operator+(const year_month_day& __lhs, const months& __rhs) noexcept {
148154 return (__lhs.year() / __lhs.month() + __rhs) / __lhs.day();
149155}
150156
151_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
157[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
152158operator+(const months& __lhs, const year_month_day& __rhs) noexcept {
153159 return __rhs + __lhs;
154160}
155161
156_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
162[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
157163operator-(const year_month_day& __lhs, const months& __rhs) noexcept {
158164 return __lhs + -__rhs;
159165}
160166
161_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
167[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
162168operator+(const year_month_day& __lhs, const years& __rhs) noexcept {
163169 return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day();
164170}
165171
166_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
172[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
167173operator+(const years& __lhs, const year_month_day& __rhs) noexcept {
168174 return __rhs + __lhs;
169175}
170176
171_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
177[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day
172178operator-(const year_month_day& __lhs, const years& __rhs) noexcept {
173179 return __lhs + -__rhs;
174180}
......@@ -204,17 +210,19 @@ public:
204210 _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator+=(const years& __y) noexcept;
205211 _LIBCPP_HIDE_FROM_ABI constexpr year_month_day_last& operator-=(const years& __y) noexcept;
206212
207 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
208 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
209 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl_; }
210 _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
213 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
214 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __mdl_.month(); }
215 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month_day_last month_day_last() const noexcept {
216 return __mdl_;
217 }
218 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr chrono::day day() const noexcept;
211219 _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept {
212220 return sys_days{year() / month() / day()};
213221 }
214222 _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
215223 return local_days{year() / month() / day()};
216224 }
217 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
225 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __mdl_.ok(); }
218226};
219227
220228_LIBCPP_HIDE_FROM_ABI inline constexpr chrono::day year_month_day_last::day() const noexcept {
......@@ -248,54 +256,57 @@ operator<=>(const year_month_day_last& __lhs, const year_month_day_last& __rhs)
248256 return __lhs.month_day_last() <=> __rhs.month_day_last();
249257}
250258
251_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept {
259[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
260operator/(const year_month& __lhs, last_spec) noexcept {
252261 return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}};
253262}
254263
255_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
264[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
256265operator/(const year& __lhs, const month_day_last& __rhs) noexcept {
257266 return year_month_day_last{__lhs, __rhs};
258267}
259268
260_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept {
269[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
270operator/(int __lhs, const month_day_last& __rhs) noexcept {
261271 return year_month_day_last{year{__lhs}, __rhs};
262272}
263273
264_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
274[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
265275operator/(const month_day_last& __lhs, const year& __rhs) noexcept {
266276 return __rhs / __lhs;
267277}
268278
269_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept {
279[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
280operator/(const month_day_last& __lhs, int __rhs) noexcept {
270281 return year{__rhs} / __lhs;
271282}
272283
273_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
284[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
274285operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept {
275286 return (__lhs.year() / __lhs.month() + __rhs) / last;
276287}
277288
278_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
289[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
279290operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept {
280291 return __rhs + __lhs;
281292}
282293
283_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
294[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
284295operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept {
285296 return __lhs + (-__rhs);
286297}
287298
288_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
299[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
289300operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept {
290301 return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()};
291302}
292303
293_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
304[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
294305operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept {
295306 return __rhs + __lhs;
296307}
297308
298_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
309[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_day_last
299310operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept {
300311 return __lhs + (-__rhs);
301312}
......@@ -336,7 +347,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool year_month_day::ok() const noexcept
336347
337348template <>
338349struct hash<chrono::year_month_day> {
339 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept {
350 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day& __ymd) noexcept {
340351 return std::__hash_combine(
341352 hash<chrono::year>{}(__ymd.year()),
342353 std::__hash_combine(hash<chrono::month>{}(__ymd.month()), hash<chrono::day>{}(__ymd.day())));
......@@ -345,7 +356,7 @@ struct hash<chrono::year_month_day> {
345356
346357template <>
347358struct hash<chrono::year_month_day_last> {
348 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept {
359 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_day_last& __ymdl) noexcept {
349360 return std::__hash_combine(
350361 hash<chrono::year>{}(__ymdl.year()), hash<chrono::month_day_last>{}(__ymdl.month_day_last()));
351362 }
lib/libcxx/include/__chrono/year_month_weekday.h+47-35
......@@ -54,17 +54,21 @@ public:
5454 _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator+=(const years&) noexcept;
5555 _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday& operator-=(const years&) noexcept;
5656
57 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
58 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
59 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdi_.weekday(); }
60 _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
61 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
57 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
58 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept {
60 return __wdi_.weekday();
61 }
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr unsigned index() const noexcept { return __wdi_.index(); }
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept {
64 return __wdi_;
65 }
6266
6367 _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
6468 _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
6569 return local_days{__to_days()};
6670 }
67 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
71 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
6872 if (!__y_.ok() || !__m_.ok() || !__wdi_.ok())
6973 return false;
7074 if (__wdi_.index() <= 4)
......@@ -96,55 +100,57 @@ operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noe
96100 __lhs.weekday_indexed() == __rhs.weekday_indexed();
97101}
98102
99_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
103[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
100104operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept {
101105 return year_month_weekday{__lhs.year(), __lhs.month(), __rhs};
102106}
103107
104_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
108[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
105109operator/(const year& __lhs, const month_weekday& __rhs) noexcept {
106110 return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()};
107111}
108112
109_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept {
113[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
114operator/(int __lhs, const month_weekday& __rhs) noexcept {
110115 return year(__lhs) / __rhs;
111116}
112117
113_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
118[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
114119operator/(const month_weekday& __lhs, const year& __rhs) noexcept {
115120 return __rhs / __lhs;
116121}
117122
118_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept {
123[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
124operator/(const month_weekday& __lhs, int __rhs) noexcept {
119125 return year(__rhs) / __lhs;
120126}
121127
122_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
128[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
123129operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept {
124130 return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed();
125131}
126132
127_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
133[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
128134operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept {
129135 return __rhs + __lhs;
130136}
131137
132_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
138[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
133139operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept {
134140 return __lhs + (-__rhs);
135141}
136142
137_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
143[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
138144operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept {
139145 return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()};
140146}
141147
142_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
148[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
143149operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept {
144150 return __rhs + __lhs;
145151}
146152
147_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
153[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday
148154operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept {
149155 return __lhs + (-__rhs);
150156}
......@@ -181,15 +187,21 @@ public:
181187 _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept;
182188 _LIBCPP_HIDE_FROM_ABI constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept;
183189
184 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
185 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
186 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept { return __wdl_.weekday(); }
187 _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
190 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::year year() const noexcept { return __y_; }
191 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
192 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday weekday() const noexcept {
193 return __wdl_.weekday();
194 }
195 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept {
196 return __wdl_;
197 }
188198 _LIBCPP_HIDE_FROM_ABI inline constexpr operator sys_days() const noexcept { return sys_days{__to_days()}; }
189199 _LIBCPP_HIDE_FROM_ABI inline explicit constexpr operator local_days() const noexcept {
190200 return local_days{__to_days()};
191201 }
192 _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __y_.ok() && __m_.ok() && __wdl_.ok(); }
202 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept {
203 return __y_.ok() && __m_.ok() && __wdl_.ok();
204 }
193205
194206 _LIBCPP_HIDE_FROM_ABI constexpr days __to_days() const noexcept;
195207};
......@@ -204,57 +216,57 @@ operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last&
204216 return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
205217}
206218
207_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
219[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
208220operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept {
209221 return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs};
210222}
211223
212_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
224[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
213225operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept {
214226 return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()};
215227}
216228
217_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
229[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
218230operator/(int __lhs, const month_weekday_last& __rhs) noexcept {
219231 return year(__lhs) / __rhs;
220232}
221233
222_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
234[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
223235operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept {
224236 return __rhs / __lhs;
225237}
226238
227_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
239[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
228240operator/(const month_weekday_last& __lhs, int __rhs) noexcept {
229241 return year(__rhs) / __lhs;
230242}
231243
232_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
244[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
233245operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
234246 return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last();
235247}
236248
237_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
249[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
238250operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept {
239251 return __rhs + __lhs;
240252}
241253
242_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
254[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
243255operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept {
244256 return __lhs + (-__rhs);
245257}
246258
247_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
259[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
248260operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
249261 return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()};
250262}
251263
252_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
264[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
253265operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept {
254266 return __rhs + __lhs;
255267}
256268
257_LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
269[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr year_month_weekday_last
258270operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept {
259271 return __lhs + (-__rhs);
260272}
......@@ -286,7 +298,7 @@ year_month_weekday_last::operator-=(const years& __dy) noexcept {
286298
287299template <>
288300struct hash<chrono::year_month_weekday> {
289 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept {
301 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday& __ymw) noexcept {
290302 return std::__hash_combine(
291303 hash<chrono::year>{}(__ymw.year()),
292304 std::__hash_combine(
......@@ -296,7 +308,7 @@ struct hash<chrono::year_month_weekday> {
296308
297309template <>
298310struct hash<chrono::year_month_weekday_last> {
299 _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept {
311 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static size_t operator()(const chrono::year_month_weekday_last& __ymwl) noexcept {
300312 return std::__hash_combine(
301313 hash<chrono::year>{}(__ymwl.year()),
302314 std::__hash_combine(
lib/libcxx/include/__chrono/zoned_time.h+4-4
......@@ -40,10 +40,10 @@
4040_LIBCPP_PUSH_MACROS
4141# include <__undef_macros>
4242
43_LIBCPP_BEGIN_NAMESPACE_STD
44
4543# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
4644
45_LIBCPP_BEGIN_NAMESPACE_STD
46
4747namespace chrono {
4848
4949template <class>
......@@ -232,11 +232,11 @@ struct hash<chrono::zoned_time<_Duration, _TimeZonePtr>> {
232232
233233# endif // _LIBCPP_STD_VER >= 26
234234
235_LIBCPP_END_NAMESPACE_STD
236
235237# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_TIME_ZONE_DATABASE && _LIBCPP_HAS_FILESYSTEM &&
236238 // _LIBCPP_HAS_LOCALIZATION
237239
238_LIBCPP_END_NAMESPACE_STD
239
240240_LIBCPP_POP_MACROS
241241
242242#endif // _LIBCPP_HAS_EXPERIMENTAL_TZDB
lib/libcxx/include/__compare/common_comparison_category.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525namespace __comp_detail {
2626
2727enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size };
......@@ -79,8 +79,8 @@ struct common_comparison_category {
7979template <class... _Ts>
8080using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
8181
82#endif // _LIBCPP_STD_VER >= 20
83
8482_LIBCPP_END_NAMESPACE_STD
8583
84#endif // _LIBCPP_STD_VER >= 20
85
8686#endif // _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H
lib/libcxx/include/__compare/compare_three_way.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525struct compare_three_way {
2626 template <class _T1, class _T2>
2727 requires three_way_comparable_with<_T1, _T2>
......@@ -33,8 +33,8 @@ struct compare_three_way {
3333 using is_transparent = void;
3434};
3535
36#endif // _LIBCPP_STD_VER >= 20
37
3836_LIBCPP_END_NAMESPACE_STD
3937
38#endif // _LIBCPP_STD_VER >= 20
39
4040#endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_H
lib/libcxx/include/__compare/compare_three_way_result.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class, class, class>
2525struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {};
2626
......@@ -39,8 +39,8 @@ struct _LIBCPP_NO_SPECIALIZATIONS compare_three_way_result : __compare_three_way
3939template <class _Tp, class _Up = _Tp>
4040using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type;
4141
42#endif // _LIBCPP_STD_VER >= 20
43
4442_LIBCPP_END_NAMESPACE_STD
4543
44#endif // _LIBCPP_STD_VER >= 20
45
4646#endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H
lib/libcxx/include/__compare/ordering.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// exposition only
2525enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 };
2626
......@@ -275,8 +275,8 @@ template <class _Tp>
275275concept __comparison_category =
276276 is_same_v<_Tp, partial_ordering> || is_same_v<_Tp, weak_ordering> || is_same_v<_Tp, strong_ordering>;
277277
278#endif // _LIBCPP_STD_VER >= 20
279
280278_LIBCPP_END_NAMESPACE_STD
281279
280#endif // _LIBCPP_STD_VER >= 20
281
282282#endif // _LIBCPP___COMPARE_ORDERING_H
lib/libcxx/include/__compare/synth_three_way.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626// [expos.only.func]
2727
2828_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u)
......@@ -46,8 +46,8 @@ template <class _Tp, class _Up = _Tp>
4646using __synth_three_way_result _LIBCPP_NODEBUG =
4747 decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>()));
4848
49#endif // _LIBCPP_STD_VER >= 20
50
5149_LIBCPP_END_NAMESPACE_STD
5250
51#endif // _LIBCPP_STD_VER >= 20
52
5353#endif // _LIBCPP___COMPARE_SYNTH_THREE_WAY_H
lib/libcxx/include/__compare/three_way_comparable.h+4-4
......@@ -24,10 +24,10 @@
2424# pragma GCC system_header
2525#endif
2626
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2927#if _LIBCPP_STD_VER >= 20
3028
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3131template <class _Tp, class _Cat>
3232concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>;
3333
......@@ -48,8 +48,8 @@ concept three_way_comparable_with =
4848 { __u <=> __t } -> __compares_as<_Cat>;
4949 };
5050
51#endif // _LIBCPP_STD_VER >= 20
52
5351_LIBCPP_END_NAMESPACE_STD
5452
53#endif // _LIBCPP_STD_VER >= 20
54
5555#endif // _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H
lib/libcxx/include/__concepts/arithmetic.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// [concepts.arithmetic], arithmetic concepts
2626
2727template <class _Tp>
......@@ -36,8 +36,8 @@ concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
3636template <class _Tp>
3737concept floating_point = is_floating_point_v<_Tp>;
3838
39#endif // _LIBCPP_STD_VER >= 20
40
4139_LIBCPP_END_NAMESPACE_STD
4240
41#endif // _LIBCPP_STD_VER >= 20
42
4343#endif // _LIBCPP___CONCEPTS_ARITHMETIC_H
lib/libcxx/include/__concepts/assignable.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727// [concept.assignable]
2828
2929template <class _Lhs, class _Rhs>
......@@ -34,8 +34,8 @@ concept assignable_from =
3434 { __lhs = std::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
3535 };
3636
37#endif // _LIBCPP_STD_VER >= 20
38
3937_LIBCPP_END_NAMESPACE_STD
4038
39#endif // _LIBCPP_STD_VER >= 20
40
4141#endif // _LIBCPP___CONCEPTS_ASSIGNABLE_H
lib/libcxx/include/__concepts/boolean_testable.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concepts.booleantestable]
2525
2626template <class _Tp>
......@@ -31,8 +31,8 @@ concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t)
3131 { !std::forward<_Tp>(__t) } -> __boolean_testable_impl;
3232};
3333
34#endif // _LIBCPP_STD_VER >= 20
35
3634_LIBCPP_END_NAMESPACE_STD
3735
36#endif // _LIBCPP_STD_VER >= 20
37
3838#endif // _LIBCPP___CONCEPTS_BOOLEAN_TESTABLE_H
lib/libcxx/include/__concepts/class_or_enum.h+4-4
......@@ -18,17 +18,17 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// Whether a type is a class type or enumeration type according to the Core wording.
2626
2727template <class _Tp>
2828concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
2929
30#endif // _LIBCPP_STD_VER >= 20
31
3230_LIBCPP_END_NAMESPACE_STD
3331
32#endif // _LIBCPP_STD_VER >= 20
33
3434#endif // _LIBCPP___CONCEPTS_CLASS_OR_ENUM_H
lib/libcxx/include/__concepts/common_reference_with.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// [concept.commonref]
2626
2727template <class _Tp, class _Up>
......@@ -29,8 +29,8 @@ concept common_reference_with =
2929 same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> &&
3030 convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>;
3131
32#endif // _LIBCPP_STD_VER >= 20
33
3432_LIBCPP_END_NAMESPACE_STD
3533
34#endif // _LIBCPP_STD_VER >= 20
35
3636#endif // _LIBCPP___CONCEPTS_COMMON_REFERENCE_WITH_H
lib/libcxx/include/__concepts/comparison_common_type.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <class _Tp, class _Up, class _CommonRef = common_reference_t<const _Tp&, const _Up&>>
2727concept __comparison_common_type_with_impl =
2828 same_as<common_reference_t<const _Tp&, const _Up&>, common_reference_t<const _Up&, const _Tp&>> && requires {
......@@ -33,8 +33,8 @@ concept __comparison_common_type_with_impl =
3333template <class _Tp, class _Up>
3434concept __comparison_common_type_with = __comparison_common_type_with_impl<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
3535
36#endif // _LIBCPP_STD_VER >= 20
37
3836_LIBCPP_END_NAMESPACE_STD
3937
38#endif // _LIBCPP_STD_VER >= 20
39
4040#endif // _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H
lib/libcxx/include/__concepts/constructible.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// [concept.constructible]
2626template <class _Tp, class... _Args>
2727concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
......@@ -48,8 +48,8 @@ concept copy_constructible =
4848 constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
4949// clang-format on
5050
51#endif // _LIBCPP_STD_VER >= 20
52
5351_LIBCPP_END_NAMESPACE_STD
5452
53#endif // _LIBCPP_STD_VER >= 20
54
5555#endif // _LIBCPP___CONCEPTS_CONSTRUCTIBLE_H
lib/libcxx/include/__concepts/convertible_to.h+4-4
......@@ -17,17 +17,17 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concept.convertible]
2525
2626template <class _From, class _To>
2727concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); };
2828
29#endif // _LIBCPP_STD_VER >= 20
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 20
32
3333#endif // _LIBCPP___CONCEPTS_CONVERTIBLE_TO_H
lib/libcxx/include/__concepts/copyable.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// [concepts.object]
2626
2727// clang-format off
......@@ -34,8 +34,8 @@ concept copyable =
3434 assignable_from<_Tp&, const _Tp>;
3535// clang-format on
3636
37#endif // _LIBCPP_STD_VER >= 20
38
3937_LIBCPP_END_NAMESPACE_STD
4038
39#endif // _LIBCPP_STD_VER >= 20
40
4141#endif // _LIBCPP___CONCEPTS_COPYABLE_H
lib/libcxx/include/__concepts/derived_from.h+4-4
......@@ -17,17 +17,17 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concept.derived]
2525
2626template <class _Dp, class _Bp>
2727concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>;
2828
29#endif // _LIBCPP_STD_VER >= 20
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 20
32
3333#endif // _LIBCPP___CONCEPTS_DERIVED_FROM_H
lib/libcxx/include/__concepts/destructible.h+4-4
......@@ -16,17 +16,17 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 20
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323// [concept.destructible]
2424
2525template <class _Tp>
2626concept destructible = is_nothrow_destructible_v<_Tp>;
2727
28#endif // _LIBCPP_STD_VER >= 20
29
3028_LIBCPP_END_NAMESPACE_STD
3129
30#endif // _LIBCPP_STD_VER >= 20
31
3232#endif // _LIBCPP___CONCEPTS_DESTRUCTIBLE_H
lib/libcxx/include/__concepts/different_from.h+4-4
......@@ -17,15 +17,15 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Tp, class _Up>
2525concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
2626
27#endif // _LIBCPP_STD_VER >= 20
28
2927_LIBCPP_END_NAMESPACE_STD
3028
29#endif // _LIBCPP_STD_VER >= 20
30
3131#endif // _LIBCPP___CONCEPTS_DIFFERENT_FROM_H
lib/libcxx/include/__concepts/equality_comparable.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727// [concept.equalitycomparable]
2828
2929template <class _Tp, class _Up>
......@@ -50,8 +50,8 @@ concept equality_comparable_with =
5050 __weakly_equality_comparable_with<_Tp, _Up>;
5151// clang-format on
5252
53#endif // _LIBCPP_STD_VER >= 20
54
5553_LIBCPP_END_NAMESPACE_STD
5654
55#endif // _LIBCPP_STD_VER >= 20
56
5757#endif // _LIBCPP___CONCEPTS_EQUALITY_COMPARABLE_H
lib/libcxx/include/__concepts/invocable.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concept.invocable]
2525
2626template <class _Fn, class... _Args>
......@@ -33,8 +33,8 @@ concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
3333template <class _Fn, class... _Args>
3434concept regular_invocable = invocable<_Fn, _Args...>;
3535
36#endif // _LIBCPP_STD_VER >= 20
37
3836_LIBCPP_END_NAMESPACE_STD
3937
38#endif // _LIBCPP_STD_VER >= 20
39
4040#endif // _LIBCPP___CONCEPTS_INVOCABLE_H
lib/libcxx/include/__concepts/movable.h+4-4
......@@ -19,17 +19,17 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626// [concepts.object]
2727
2828template <class _Tp>
2929concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
3030
31#endif // _LIBCPP_STD_VER >= 20
32
3331_LIBCPP_END_NAMESPACE_STD
3432
33#endif // _LIBCPP_STD_VER >= 20
34
3535#endif // _LIBCPP___CONCEPTS_MOVABLE_H
lib/libcxx/include/__concepts/predicate.h+4-4
......@@ -18,17 +18,17 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525// [concept.predicate]
2626
2727template <class _Fn, class... _Args>
2828concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>;
2929
30#endif // _LIBCPP_STD_VER >= 20
31
3230_LIBCPP_END_NAMESPACE_STD
3331
32#endif // _LIBCPP_STD_VER >= 20
33
3434#endif // _LIBCPP___CONCEPTS_PREDICATE_H
lib/libcxx/include/__concepts/primary_template.h created+33
......@@ -0,0 +1,33 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
10#define _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
11
12#include <__config>
13#include <__type_traits/is_same.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19#if _LIBCPP_STD_VER >= 20
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23template <class _Tp>
24concept __primary_template = requires {
25 typename _Tp::__primary_template;
26 requires _IsSame<typename _Tp::__primary_template, _Tp>::value;
27};
28
29_LIBCPP_END_NAMESPACE_STD
30
31#endif // _LIBCPP_STD_VER >= 20
32
33#endif // _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
lib/libcxx/include/__concepts/referenceable.h created+30
......@@ -0,0 +1,30 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
10#define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
11
12#include <__config>
13#include <__type_traits/void_t.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19#if _LIBCPP_STD_VER >= 20
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23template <class _Tp>
24concept __referenceable = requires { typename __void_t<_Tp&>; };
25
26_LIBCPP_END_NAMESPACE_STD
27
28#endif
29
30#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
lib/libcxx/include/__concepts/regular.h+4-4
......@@ -17,17 +17,17 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concept.object]
2525
2626template <class _Tp>
2727concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
2828
29#endif // _LIBCPP_STD_VER >= 20
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 20
32
3333#endif // _LIBCPP___CONCEPTS_REGULAR_H
lib/libcxx/include/__concepts/relation.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 20
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323// [concept.relation]
2424
2525template <class _Rp, class _Tp, class _Up>
......@@ -36,8 +36,8 @@ concept equivalence_relation = relation<_Rp, _Tp, _Up>;
3636template <class _Rp, class _Tp, class _Up>
3737concept strict_weak_order = relation<_Rp, _Tp, _Up>;
3838
39#endif // _LIBCPP_STD_VER >= 20
40
4139_LIBCPP_END_NAMESPACE_STD
4240
41#endif // _LIBCPP_STD_VER >= 20
42
4343#endif // _LIBCPP___CONCEPTS_RELATION_H
lib/libcxx/include/__concepts/same_as.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 20
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323// [concept.same]
2424
2525template <class _Tp, class _Up>
......@@ -28,8 +28,8 @@ concept __same_as_impl = _IsSame<_Tp, _Up>::value;
2828template <class _Tp, class _Up>
2929concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
3030
31#endif // _LIBCPP_STD_VER >= 20
32
3331_LIBCPP_END_NAMESPACE_STD
3432
33#endif // _LIBCPP_STD_VER >= 20
34
3535#endif // _LIBCPP___CONCEPTS_SAME_AS_H
lib/libcxx/include/__concepts/semiregular.h+4-4
......@@ -17,17 +17,17 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424// [concept.object]
2525
2626template <class _Tp>
2727concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
2828
29#endif // _LIBCPP_STD_VER >= 20
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 20
32
3333#endif // _LIBCPP___CONCEPTS_SEMIREGULAR_H
lib/libcxx/include/__concepts/swappable.h+4-4
......@@ -30,10 +30,10 @@
3030_LIBCPP_PUSH_MACROS
3131#include <__undef_macros>
3232
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3533#if _LIBCPP_STD_VER >= 20
3634
35_LIBCPP_BEGIN_NAMESPACE_STD
36
3737// [concept.swappable]
3838
3939namespace ranges {
......@@ -113,10 +113,10 @@ concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t,
113113 ranges::swap(std::forward<_Up>(__u), std::forward<_Tp>(__t));
114114};
115115
116#endif // _LIBCPP_STD_VER >= 20
117
118116_LIBCPP_END_NAMESPACE_STD
119117
118#endif // _LIBCPP_STD_VER >= 20
119
120120_LIBCPP_POP_MACROS
121121
122122#endif // _LIBCPP___CONCEPTS_SWAPPABLE_H
lib/libcxx/include/__concepts/totally_ordered.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626// [concept.totallyordered]
2727
2828template <class _Tp, class _Up>
......@@ -52,8 +52,8 @@ concept totally_ordered_with =
5252 __partially_ordered_with<_Tp, _Up>;
5353// clang-format on
5454
55#endif // _LIBCPP_STD_VER >= 20
56
5755_LIBCPP_END_NAMESPACE_STD
5856
57#endif // _LIBCPP_STD_VER >= 20
58
5959#endif // _LIBCPP___CONCEPTS_TOTALLY_ORDERED_H
lib/libcxx/include/__condition_variable/condition_variable.h+6-4
......@@ -31,10 +31,11 @@
3131_LIBCPP_PUSH_MACROS
3232#include <__undef_macros>
3333
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3634#if _LIBCPP_HAS_THREADS
3735
36_LIBCPP_BEGIN_NAMESPACE_STD
37_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
38
3839// enum class cv_status
3940_LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout};
4041_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
......@@ -223,10 +224,11 @@ inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
223224 wait_for(__lk, __tp - _Clock::now());
224225}
225226
226#endif // _LIBCPP_HAS_THREADS
227
227_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
228228_LIBCPP_END_NAMESPACE_STD
229229
230#endif // _LIBCPP_HAS_THREADS
231
230232_LIBCPP_POP_MACROS
231233
232234#endif // _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H
lib/libcxx/include/__config+32-697
......@@ -25,61 +25,30 @@
2525
2626#ifdef __cplusplus
2727
28# include <__configuration/abi.h>
29# include <__configuration/attributes.h>
30# include <__configuration/availability.h>
31# include <__configuration/compiler.h>
32# include <__configuration/diagnostic_suppression.h>
33# include <__configuration/experimental.h>
34# include <__configuration/hardening.h>
35# include <__configuration/language.h>
36# include <__configuration/namespace.h>
37# include <__configuration/platform.h>
38# include <__configuration/pstl.h>
39# include <__configuration/utility.h>
40
2841// The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html
2942
3043// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
3144// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
3245// defined to XXYYZZ.
33# define _LIBCPP_VERSION 220108
34
35# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
36# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
37# define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))
38
39# if __STDC_HOSTED__ == 0
40# define _LIBCPP_FREESTANDING
41# endif
42
43# define _LIBCPP_TOSTRING2(x) #x
44# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
45
46# ifndef __has_constexpr_builtin
47# define __has_constexpr_builtin(x) 0
48# endif
49
50// This checks wheter a Clang module is built
51# ifndef __building_module
52# define __building_module(...) 0
53# endif
54
55// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
56// the compiler and '1' otherwise.
57# ifndef __is_identifier
58# define __is_identifier(__x) 1
59# endif
60
61# ifndef __has_declspec_attribute
62# define __has_declspec_attribute(__x) 0
63# endif
64
65# define __has_keyword(__x) !(__is_identifier(__x))
66
67# ifndef __has_warning
68# define __has_warning(...) 0
69# endif
70
71# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
72# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
73# endif
46# define _LIBCPP_VERSION 230100
7447
7548# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
7649# define _LIBCPP_ABI_VCRUNTIME
7750# endif
7851
79# if defined(__MVS__)
80# include <features.h> // for __NATIVE_ASCII_F
81# endif
82
8352# if defined(_WIN32)
8453# define _LIBCPP_WIN32API
8554# define _LIBCPP_SHORT_WCHAR 1
......@@ -90,15 +59,9 @@
9059# if defined(_MSC_VER) && !defined(__MINGW32__)
9160# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
9261# endif
93# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
94# define _LIBCPP_HAS_BITSCAN64 1
95# else
96# define _LIBCPP_HAS_BITSCAN64 0
97# endif
9862# define _LIBCPP_HAS_OPEN_WITH_WCHAR 1
9963# else
10064# define _LIBCPP_HAS_OPEN_WITH_WCHAR 0
101# define _LIBCPP_HAS_BITSCAN64 0
10265# endif // defined(_WIN32)
10366
10467# if defined(_AIX) && !defined(__64BIT__)
......@@ -184,259 +147,6 @@ typedef __char32_t char32_t;
184147# define _LIBCPP_HAS_BLOCKS_RUNTIME 0
185148# endif
186149
187# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
188
189# if defined(_LIBCPP_OBJECT_FORMAT_COFF)
190
191# ifdef _DLL
192# define _LIBCPP_CRT_FUNC __declspec(dllimport)
193# else
194# define _LIBCPP_CRT_FUNC
195# endif
196
197# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY))
198# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
199# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
200# define _LIBCPP_OVERRIDABLE_FUNC_VIS
201# define _LIBCPP_EXPORTED_FROM_ABI
202# elif defined(_LIBCPP_BUILDING_LIBRARY)
203# if defined(__MINGW32__)
204# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport)
205# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
206# else
207# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
208# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport)
209# endif
210# define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport)
211# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
212# else
213# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport)
214# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
215# define _LIBCPP_OVERRIDABLE_FUNC_VIS
216# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
217# endif
218
219# define _LIBCPP_HIDDEN
220# define _LIBCPP_TEMPLATE_DATA_VIS
221# define _LIBCPP_NAMESPACE_VISIBILITY
222
223# else
224
225# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
226# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))
227# else
228# define _LIBCPP_VISIBILITY(vis)
229# endif
230
231# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")
232# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
233# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
234# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
235# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
236
237// TODO: Make this a proper customization point or remove the option to override it.
238# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
239# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
240# endif
241
242# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
243# define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__type_visibility__("default")))
244# elif !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
245# define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__visibility__("default")))
246# else
247# define _LIBCPP_NAMESPACE_VISIBILITY
248# endif
249
250# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
251
252# if __has_attribute(exclude_from_explicit_instantiation)
253# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__))
254# else
255// Try to approximate the effect of exclude_from_explicit_instantiation
256// (which is that entities are not assumed to be provided by explicit
257// template instantiations in the dylib) by always inlining those entities.
258# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
259# endif
260
261# ifdef _LIBCPP_COMPILER_CLANG_BASED
262# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
263# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
264# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str))
265# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
266# elif defined(_LIBCPP_COMPILER_GCC)
267# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
268# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
269# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
270# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str))
271# else
272# define _LIBCPP_DIAGNOSTIC_PUSH
273# define _LIBCPP_DIAGNOSTIC_POP
274# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
275# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
276# endif
277
278// Macros to enter and leave a state where deprecation warnings are suppressed.
279# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
280 _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \
281 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
282# define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP
283
284# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
285# define _LIBCPP_HARDENING_SIG f
286# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
287# define _LIBCPP_HARDENING_SIG s
288# elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
289# define _LIBCPP_HARDENING_SIG d
290# else
291# define _LIBCPP_HARDENING_SIG n // "none"
292# endif
293
294# if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
295# define _LIBCPP_ASSERTION_SEMANTIC_SIG o
296# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
297# define _LIBCPP_ASSERTION_SEMANTIC_SIG q
298# elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
299# define _LIBCPP_ASSERTION_SEMANTIC_SIG e
300# else
301# define _LIBCPP_ASSERTION_SEMANTIC_SIG i // `ignore`
302# endif
303
304# if !_LIBCPP_HAS_EXCEPTIONS
305# define _LIBCPP_EXCEPTIONS_SIG n
306# else
307# define _LIBCPP_EXCEPTIONS_SIG e
308# endif
309
310# define _LIBCPP_ODR_SIGNATURE \
311 _LIBCPP_CONCAT( \
312 _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \
313 _LIBCPP_VERSION)
314
315// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
316// on two levels:
317// 1. The symbol is given hidden visibility, which ensures that users won't start exporting
318// symbols from their dynamic library by means of using the libc++ headers. This ensures
319// that those symbols stay private to the dynamic library in which it is defined.
320//
321// 2. The symbol is given an ABI tag that encodes the ODR-relevant properties of the library.
322// This ensures that no ODR violation can arise from mixing two TUs compiled with different
323// versions or configurations of libc++ (such as exceptions vs no-exceptions). Indeed, if the
324// program contains two definitions of a function, the ODR requires them to be token-by-token
325// equivalent, and the linker is allowed to pick either definition and discard the other one.
326//
327// For example, if a program contains a copy of `vector::at()` compiled with exceptions enabled
328// *and* a copy of `vector::at()` compiled with exceptions disabled (by means of having two TUs
329// compiled with different settings), the two definitions are both visible by the linker and they
330// have the same name, but they have a meaningfully different implementation (one throws an exception
331// and the other aborts the program). This violates the ODR and makes the program ill-formed, and in
332// practice what will happen is that the linker will pick one of the definitions at random and will
333// discard the other one. This can quite clearly lead to incorrect program behavior.
334//
335// A similar reasoning holds for many other properties that are ODR-affecting. Essentially any
336// property that causes the code of a function to differ from the code in another configuration
337// can be considered ODR-affecting. In practice, we don't encode all such properties in the ABI
338// tag, but we encode the ones that we think are most important: library version, exceptions, and
339// hardening mode.
340//
341// Note that historically, solving this problem has been achieved in various ways, including
342// force-inlining all functions or giving internal linkage to all functions. Both these previous
343// solutions suffer from drawbacks that lead notably to code bloat.
344//
345// Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend
346// on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library.
347//
348// Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions
349// instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled
350// name of a virtual function is part of its ABI, since some architectures like arm64e can sign
351// the virtual function pointer in the vtable based on the mangled name of the function. Since
352// we use an ABI tag that changes with each released version, the mangled name of the virtual
353// function would change, which is incorrect. Note that it doesn't make much sense to change
354// the implementation of a virtual function in an ABI-incompatible way in the first place,
355// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable.
356//
357// The macro can be applied to record and enum types. When the tagged type is nested in
358// a record this "parent" record needs to have the macro too. Another use case for applying
359// this macro to records and unions is to apply an ABI tag to inline constexpr variables.
360// This can be useful for inline variables that are implementation details which are expected
361// to change in the future.
362//
363// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
364// the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
365// use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
366# ifndef _LIBCPP_NO_ABI_TAG
367# define _LIBCPP_HIDE_FROM_ABI \
368 _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
369 __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
370# else
371# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
372# endif
373# define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
374
375// Clang modules take a significant compile time hit when pushing and popping diagnostics.
376// Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can
377// simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined.
378# ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
379# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
380 _LIBCPP_DIAGNOSTIC_PUSH \
381 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \
382 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
383 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
384 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
385 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \
386 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
387 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
388 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
389 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
390# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
391# else
392# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
393# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS
394# endif
395
396// clang-format off
397
398// The unversioned namespace is used when we want to be ABI compatible with other standard libraries in some way. There
399// are two main categories where that's the case:
400// - Historically, we have made exception types ABI compatible with libstdc++ to allow throwing them between libstdc++
401// and libc++. This is not used anymore for new exception types, since there is no use-case for it anymore.
402// - Types and functions which are used by the compiler are in the unversioned namespace, since the compiler has to know
403// their mangling without the appropriate declaration in some cases.
404// If it's not clear whether using the unversioned namespace is the correct thing to do, it's not. The versioned
405// namespace (_LIBCPP_BEGIN_NAMESPACE_STD) should almost always be used.
406# define _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD \
407 _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS namespace _LIBCPP_NAMESPACE_VISIBILITY std {
408
409# define _LIBCPP_END_UNVERSIONED_NAMESPACE_STD } _LIBCPP_POP_EXTENSION_DIAGNOSTICS
410
411# define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD inline namespace _LIBCPP_ABI_NAMESPACE {
412# define _LIBCPP_END_NAMESPACE_STD } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD
413
414// TODO: This should really be in the versioned namespace
415#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD namespace experimental {
416#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD
417
418#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
419#define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
420
421#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
422#define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
423
424#ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
425# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem {
426# define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD
427#else
428# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
429 inline namespace __fs { namespace filesystem {
430
431# define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD
432#endif
433
434// clang-format on
435
436# if __has_attribute(__enable_if__)
437# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))
438# endif
439
440150# if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)
441151# define _LIBCPP_HAS_INT128 0
442152# else
......@@ -488,34 +198,14 @@ typedef __char32_t char32_t;
488198# endif
489199# endif
490200
491# if defined(__APPLE__) || defined(__FreeBSD__)
492# define _LIBCPP_WCTYPE_IS_MASK
493# endif
494
495# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
496# define _LIBCPP_HAS_CHAR8_T 0
201# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
202# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
497203# else
498# define _LIBCPP_HAS_CHAR8_T 1
204# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
499205# endif
500206
501// Deprecation macros.
502//
503// Deprecations warnings are always enabled, except when users explicitly opt-out
504// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
505# if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
506# if __has_attribute(__deprecated__)
507# define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
508# define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
509# elif _LIBCPP_STD_VER >= 14
510# define _LIBCPP_DEPRECATED [[deprecated]]
511# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]]
512# else
513# define _LIBCPP_DEPRECATED
514# define _LIBCPP_DEPRECATED_(m)
515# endif
516# else
517# define _LIBCPP_DEPRECATED
518# define _LIBCPP_DEPRECATED_(m)
207# if defined(__APPLE__) || defined(__FreeBSD__)
208# define _LIBCPP_WCTYPE_IS_MASK
519209# endif
520210
521211// FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be
......@@ -527,102 +217,13 @@ typedef __char32_t char32_t;
527217# define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0
528218# endif
529219
530# if !defined(_LIBCPP_CXX03_LANG)
531# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
532# else
533# define _LIBCPP_DEPRECATED_IN_CXX11
534# endif
535
536# if _LIBCPP_STD_VER >= 14
537# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
538# else
539# define _LIBCPP_DEPRECATED_IN_CXX14
540# endif
541
542# if _LIBCPP_STD_VER >= 17
543# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
544# else
545# define _LIBCPP_DEPRECATED_IN_CXX17
546# endif
547
548# if _LIBCPP_STD_VER >= 20
549# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED
550# else
551# define _LIBCPP_DEPRECATED_IN_CXX20
552# endif
553
554# if _LIBCPP_STD_VER >= 23
555# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
556# else
557# define _LIBCPP_DEPRECATED_IN_CXX23
558# endif
559
560# if _LIBCPP_STD_VER >= 26
561# define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED
562# define _LIBCPP_DEPRECATED_IN_CXX26_(m) _LIBCPP_DEPRECATED_(m)
563# else
564# define _LIBCPP_DEPRECATED_IN_CXX26
565# define _LIBCPP_DEPRECATED_IN_CXX26_(m)
566# endif
567
568# if _LIBCPP_HAS_CHAR8_T
569# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
570# else
571# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
572# endif
573
574# if _LIBCPP_STD_VER <= 11
575# define _LIBCPP_EXPLICIT_SINCE_CXX14
576# else
577# define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit
578# endif
579
580# if _LIBCPP_STD_VER >= 23
581# define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit
582# else
583# define _LIBCPP_EXPLICIT_SINCE_CXX23
584# endif
585
586# if _LIBCPP_STD_VER >= 14
587# define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
588# else
589# define _LIBCPP_CONSTEXPR_SINCE_CXX14
590# endif
591
592# if _LIBCPP_STD_VER >= 17
593# define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr
594# else
595# define _LIBCPP_CONSTEXPR_SINCE_CXX17
596# endif
597
598# if _LIBCPP_STD_VER >= 20
599# define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr
600# else
601# define _LIBCPP_CONSTEXPR_SINCE_CXX20
602# endif
603
604# if _LIBCPP_STD_VER >= 23
605# define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr
606# else
607# define _LIBCPP_CONSTEXPR_SINCE_CXX23
608# endif
609
610# if _LIBCPP_STD_VER >= 26
611# define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr
612# else
613# define _LIBCPP_CONSTEXPR_SINCE_CXX26
614# endif
615
616# ifndef _LIBCPP_WEAK
617# define _LIBCPP_WEAK __attribute__((__weak__))
618# endif
619
620220// Thread API
621221// clang-format off
622222# if _LIBCPP_HAS_THREADS && \
623223 !_LIBCPP_HAS_THREAD_API_PTHREAD && \
624224 !_LIBCPP_HAS_THREAD_API_WIN32 && \
625 !_LIBCPP_HAS_THREAD_API_EXTERNAL
225 !_LIBCPP_HAS_THREAD_API_EXTERNAL && \
226 !_LIBCPP_HAS_THREAD_API_C11
626227
627228# if defined(__FreeBSD__) || \
628229 defined(__wasi__) || \
......@@ -634,7 +235,11 @@ typedef __char32_t char32_t;
634235 defined(__APPLE__) || \
635236 defined(__MVS__) || \
636237 defined(_AIX) || \
637 defined(__EMSCRIPTEN__)
238 defined(__EMSCRIPTEN__) || \
239 defined(__HAIKU__) || \
240 defined(__serenity__)
241// zig patch: haiku support
242// zig patch: serenity support
638243// clang-format on
639244# undef _LIBCPP_HAS_THREAD_API_PTHREAD
640245# define _LIBCPP_HAS_THREAD_API_PTHREAD 1
......@@ -666,6 +271,10 @@ typedef __char32_t char32_t;
666271# error _LIBCPP_HAS_THREAD_API_EXTERNAL may only be true when _LIBCPP_HAS_THREADS is true.
667272# endif
668273
274# if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_C11
275# error _LIBCPP_HAS_THREAD_API_C11 may only be true when _LIBCPP_HAS_THREADS is true.
276# endif
277
669278# if !_LIBCPP_HAS_MONOTONIC_CLOCK && _LIBCPP_HAS_THREADS
670279# error _LIBCPP_HAS_MONOTONIC_CLOCK may only be false when _LIBCPP_HAS_THREADS is false.
671280# endif
......@@ -708,61 +317,12 @@ typedef __char32_t char32_t;
708317# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 0
709318# endif
710319
320// zig patch: serenity support
711321# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \
712 _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || defined(__LLVM_LIBC__)
322 _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || _LIBCPP_LIBC_LLVM_LIBC || defined(__serenity__)
713323# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
714324# endif
715325
716# if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
717# define _LIBCPP_HAS_C_ATOMIC_IMP 1
718# define _LIBCPP_HAS_GCC_ATOMIC_IMP 0
719# define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0
720# elif defined(_LIBCPP_COMPILER_GCC)
721# define _LIBCPP_HAS_C_ATOMIC_IMP 0
722# define _LIBCPP_HAS_GCC_ATOMIC_IMP 1
723# define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0
724# endif
725
726# if !_LIBCPP_HAS_C_ATOMIC_IMP && !_LIBCPP_HAS_GCC_ATOMIC_IMP && !_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP
727# define _LIBCPP_HAS_ATOMIC_HEADER 0
728# else
729# define _LIBCPP_HAS_ATOMIC_HEADER 1
730# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
731# define _LIBCPP_ATOMIC_FLAG_TYPE bool
732# endif
733# endif
734
735# if __has_cpp_attribute(_Clang::__no_thread_safety_analysis__)
736# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[_Clang::__no_thread_safety_analysis__]]
737# else
738# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
739# endif
740
741# if _LIBCPP_STD_VER >= 20
742# define _LIBCPP_CONSTINIT constinit
743# elif __has_attribute(__require_constant_initialization__)
744# define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__))
745# else
746# define _LIBCPP_CONSTINIT
747# endif
748
749# if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
750// The CUDA SDK contains an unfortunate definition for the __noinline__ macro,
751// which breaks the regular __attribute__((__noinline__)) syntax. Therefore,
752// when compiling for CUDA we use the non-underscored version of the noinline
753// attribute.
754//
755// This is a temporary workaround and we still expect the CUDA SDK team to solve
756// this issue properly in the SDK headers.
757//
758// See https://github.com/llvm/llvm-project/pull/73838 for more details.
759# define _LIBCPP_NOINLINE __attribute__((noinline))
760# elif __has_attribute(__noinline__)
761# define _LIBCPP_NOINLINE __attribute__((__noinline__))
762# else
763# define _LIBCPP_NOINLINE
764# endif
765
766326// We often repeat things just for handling wide characters in the library.
767327// When wide characters are disabled, it can be useful to have a quick way of
768328// disabling it without having to resort to #if-#endif, which has a larger
......@@ -788,27 +348,6 @@ typedef __char32_t char32_t;
788348# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
789349# endif // _LIBCPP_NO_AUTO_LINK
790350
791// Configures the fopen close-on-exec mode character, if any. This string will
792// be appended to any mode string used by fstream for fopen/fdopen.
793//
794// Not all platforms support this, but it helps avoid fd-leaks on platforms that
795// do.
796# if defined(__BIONIC__)
797# define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
798# else
799# define _LIBCPP_FOPEN_CLOEXEC_MODE
800# endif
801
802# if __has_cpp_attribute(msvc::no_unique_address)
803// MSVC implements [[no_unique_address]] as a silent no-op currently.
804// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)
805// However, MSVC implements [[msvc::no_unique_address]] which does what
806// [[no_unique_address]] is supposed to do, in general.
807# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
808# else
809# define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]]
810# endif
811
812351// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these
813352// functions is gradually being added to existing C libraries. The conditions
814353// below check for known C library versions and conditions under which these
......@@ -844,210 +383,6 @@ typedef __char32_t char32_t;
844383# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
845384# endif
846385
847# if defined(__OBJC__) && defined(_LIBCPP_APPLE_CLANG_VER)
848# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
849# endif
850
851# define _PSTL_PRAGMA(x) _Pragma(#x)
852
853// Enable SIMD for compilers that support OpenMP 4.0
854# if (defined(_OPENMP) && _OPENMP >= 201307)
855
856# define _PSTL_UDR_PRESENT
857# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
858# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
859# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
860# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
861# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
862# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
863
864// Declaration of reduction functor, where
865// NAME - the name of the functor
866// OP - type of the callable object with the reduction operation
867// omp_in - refers to the local partial result
868// omp_out - refers to the final value of the combiner operator
869// omp_priv - refers to the private copy of the initial value
870// omp_orig - refers to the original variable to be reduced
871# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
872 _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
873
874# elif defined(_LIBCPP_COMPILER_CLANG_BASED)
875
876# define _PSTL_PRAGMA_SIMD _Pragma("clang loop vectorize(enable) interleave(enable)")
877# define _PSTL_PRAGMA_DECLARE_SIMD
878# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")
879# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")
880# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
881# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
882# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
883
884# else // (defined(_OPENMP) && _OPENMP >= 201307)
885
886# define _PSTL_PRAGMA_SIMD
887# define _PSTL_PRAGMA_DECLARE_SIMD
888# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
889# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
890# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
891# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
892# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
893
894# endif // (defined(_OPENMP) && _OPENMP >= 201307)
895
896# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
897
898// Optional attributes - these are useful for a better QoI, but not required to be available
899
900# define _LIBCPP_NOALIAS __attribute__((__malloc__))
901# define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]]
902# define _LIBCPP_NO_SANITIZE(...) __attribute__((__no_sanitize__(__VA_ARGS__)))
903# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))
904# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \
905 __attribute__((__format__(archetype, format_string_index, first_format_arg_index)))
906# define _LIBCPP_PACKED __attribute__((__packed__))
907
908# if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
909# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
910# else
911# define _LIBCPP_NO_CFI
912# endif
913
914# if __has_attribute(__using_if_exists__)
915# define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__))
916# else
917# define _LIBCPP_USING_IF_EXISTS
918# endif
919
920# if __has_cpp_attribute(_Clang::__no_destroy__)
921# define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]]
922# else
923# define _LIBCPP_NO_DESTROY
924# endif
925
926# if __has_attribute(__diagnose_if__)
927# define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))
928# else
929# define _LIBCPP_DIAGNOSE_WARNING(...)
930# endif
931
932# if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_APPLE_CLANG_VER) && \
933 (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2001)
934# define _LIBCPP_DIAGNOSE_IF(...) __attribute__((__diagnose_if__(__VA_ARGS__)))
935# else
936# define _LIBCPP_DIAGNOSE_IF(...)
937# endif
938
939# define _LIBCPP_DIAGNOSE_NULLPTR_IF(condition, condition_description) \
940 _LIBCPP_DIAGNOSE_IF( \
941 condition, \
942 "null passed to callee that requires a non-null argument" condition_description, \
943 "warning", \
944 "nonnull")
945
946# if __has_cpp_attribute(_Clang::__lifetimebound__)
947# define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
948# else
949# define _LIBCPP_LIFETIMEBOUND
950# endif
951
952// This is to work around https://llvm.org/PR156809
953# ifndef _LIBCPP_CXX03_LANG
954# define _LIBCPP_CTOR_LIFETIMEBOUND _LIBCPP_LIFETIMEBOUND
955# else
956# define _LIBCPP_CTOR_LIFETIMEBOUND
957# endif
958
959# if __has_cpp_attribute(_Clang::__noescape__)
960# define _LIBCPP_NOESCAPE [[_Clang::__noescape__]]
961# else
962# define _LIBCPP_NOESCAPE
963# endif
964
965# if __has_cpp_attribute(_Clang::__no_specializations__)
966# define _LIBCPP_NO_SPECIALIZATIONS \
967 [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]]
968# else
969# define _LIBCPP_NO_SPECIALIZATIONS
970# endif
971
972# if __has_cpp_attribute(_Clang::__preferred_name__)
973# define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]
974# else
975# define _LIBCPP_PREFERRED_NAME(x)
976# endif
977
978# if __has_cpp_attribute(_Clang::__scoped_lockable__)
979# define _LIBCPP_SCOPED_LOCKABLE [[_Clang::__scoped_lockable__]]
980# else
981# define _LIBCPP_SCOPED_LOCKABLE
982# endif
983
984# if __has_cpp_attribute(_Clang::__capability__)
985# define _LIBCPP_CAPABILITY(...) [[_Clang::__capability__(__VA_ARGS__)]]
986# else
987# define _LIBCPP_CAPABILITY(...)
988# endif
989
990# if __has_attribute(__acquire_capability__)
991# define _LIBCPP_ACQUIRE_CAPABILITY(...) __attribute__((__acquire_capability__(__VA_ARGS__)))
992# else
993# define _LIBCPP_ACQUIRE_CAPABILITY(...)
994# endif
995
996# if __has_cpp_attribute(_Clang::__try_acquire_capability__)
997# define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) [[_Clang::__try_acquire_capability__(__VA_ARGS__)]]
998# else
999# define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...)
1000# endif
1001
1002# if __has_cpp_attribute(_Clang::__acquire_shared_capability__)
1003# define _LIBCPP_ACQUIRE_SHARED_CAPABILITY [[_Clang::__acquire_shared_capability__]]
1004# else
1005# define _LIBCPP_ACQUIRE_SHARED_CAPABILITY
1006# endif
1007
1008# if __has_cpp_attribute(_Clang::__try_acquire_shared_capability__)
1009# define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) [[_Clang::__try_acquire_shared_capability__(__VA_ARGS__)]]
1010# else
1011# define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...)
1012# endif
1013
1014# if __has_cpp_attribute(_Clang::__release_capability__)
1015# define _LIBCPP_RELEASE_CAPABILITY [[_Clang::__release_capability__]]
1016# else
1017# define _LIBCPP_RELEASE_CAPABILITY
1018# endif
1019
1020# if __has_cpp_attribute(_Clang::__release_shared_capability__)
1021# define _LIBCPP_RELEASE_SHARED_CAPABILITY [[_Clang::__release_shared_capability__]]
1022# else
1023# define _LIBCPP_RELEASE_SHARED_CAPABILITY
1024# endif
1025
1026# if __has_attribute(__requires_capability__)
1027# define _LIBCPP_REQUIRES_CAPABILITY(...) __attribute__((__requires_capability__(__VA_ARGS__)))
1028# else
1029# define _LIBCPP_REQUIRES_CAPABILITY(...)
1030# endif
1031
1032# if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases)
1033# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
1034# else
1035# define _LIBCPP_DECLSPEC_EMPTY_BASES
1036# endif
1037
1038// Allow for build-time disabling of unsigned integer sanitization
1039# if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC)
1040# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
1041# else
1042# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1043# endif
1044
1045# if __has_feature(nullability)
1046# define _LIBCPP_DIAGNOSE_NULLPTR _Nonnull
1047# else
1048# define _LIBCPP_DIAGNOSE_NULLPTR
1049# endif
1050
1051386#endif // __cplusplus
1052387
1053388#endif // _LIBCPP___CONFIG
lib/libcxx/include/__configuration/abi.h+4-16
......@@ -52,12 +52,6 @@
5252#if _LIBCPP_ABI_VERSION >= 2
5353// TODO: Move the description of the remaining ABI flags to ABIGuarantees.rst or remove them.
5454
55// Override the default return value of exception::what() for bad_function_call::what()
56// with a string that is specific to bad_function_call (see http://wg21.link/LWG2233).
57// This is an ABI break on platforms that sign and authenticate vtable function pointers
58// because it changes the mangling of the virtual function located in the vtable, which
59// changes how it gets signed.
60# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
6155// According to the Standard, `bitset::operator[] const` returns bool
6256# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
6357
......@@ -77,11 +71,14 @@
7771# define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER
7872# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
7973# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
74# define _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED
8075# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
8176# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
8277# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
8378# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
8479# define _LIBCPP_ABI_TRIVIALLY_COPYABLE_BIT_ITERATOR
80# define _LIBCPP_ABI_USE_SMALL_DEQUE_BLOCK_SIZE
81# define _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE
8582
8683#elif _LIBCPP_ABI_VERSION == 1
8784// Feature macros for disabling pre ABI v1 features. All of these options
......@@ -91,15 +88,6 @@
9188# endif
9289#endif
9390
94// TODO(LLVM 22): Remove this check
95#if defined(_LIBCPP_ABI_NO_ITERATOR_BASES) && !defined(_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER)
96# ifndef _LIBCPP_ONLY_NO_ITERATOR_BASES
97# error "You probably want to define _LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER. This has been split out from" \
98 " _LIBCPP_ABI_NO_ITERATOR_BASES to allow only removing the second iterator member, since they aren't really related." \
99 "If you actually want this ABI configuration, please define _LIBCPP_ONLY_NO_ITERATOR_BASES instead."
100# endif
101#endif
102
10391// We had some bugs where we use [[no_unique_address]] together with construct_at,
10492// which causes UB as the call on construct_at could write to overlapping subobjects
10593//
......@@ -108,7 +96,7 @@
10896//
10997// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions.
11098// The macro below is used for all classes whose ABI have changed as part of fixing these bugs.
111#define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua")))
99#define _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG __attribute__((__abi_tag__("llvm18_nua")))
112100
113101// [[msvc::no_unique_address]] seems to mostly affect empty classes, so the padding scheme for Itanium doesn't work.
114102#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING)
lib/libcxx/include/__configuration/attributes.h created+476
......@@ -0,0 +1,476 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___CONFIGURATION_ATTRIBUTES_H
10#define _LIBCPP___CONFIGURATION_ATTRIBUTES_H
11
12/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
13#include <__configuration/hardening.h>
14#include <__configuration/language.h>
15#include <__configuration/utility.h>
16
17#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
18# pragma GCC system_header
19#endif
20
21#ifndef __has_declspec_attribute
22# define __has_declspec_attribute(__x) 0
23#endif
24
25// Attributes relevant for layout ABI
26// ----------------------------------
27
28#if __has_cpp_attribute(msvc::no_unique_address)
29// MSVC implements [[no_unique_address]] as a silent no-op currently.
30// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)
31// However, MSVC implements [[msvc::no_unique_address]] which does what
32// [[no_unique_address]] is supposed to do, in general.
33# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
34#else
35# define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]]
36#endif
37
38#define _LIBCPP_PACKED __attribute__((__packed__))
39
40// Attributes affecting overload resolution
41// ----------------------------------------
42
43#if __has_attribute(__enable_if__)
44# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))
45#endif
46
47// Visibility attributes
48// ---------------------
49
50#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
51
52# ifdef _DLL
53# define _LIBCPP_CRT_FUNC __declspec(dllimport)
54# else
55# define _LIBCPP_CRT_FUNC
56# endif
57
58# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY))
59# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
60# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
61# define _LIBCPP_OVERRIDABLE_FUNC_VIS
62# define _LIBCPP_EXPORTED_FROM_ABI
63# elif defined(_LIBCPP_BUILDING_LIBRARY)
64# if defined(__MINGW32__)
65# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport)
66# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
67# else
68# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
69# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport)
70# endif
71# define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport)
72# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
73# else
74# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport)
75# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
76# define _LIBCPP_OVERRIDABLE_FUNC_VIS
77# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
78# endif
79
80# define _LIBCPP_HIDDEN
81# define _LIBCPP_TEMPLATE_DATA_VIS
82# define _LIBCPP_NAMESPACE_VISIBILITY
83
84#else
85
86# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
87# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))
88# else
89# define _LIBCPP_VISIBILITY(vis)
90# endif
91
92# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")
93# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
94# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
95# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
96# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
97
98// TODO: Make this a proper customization point or remove the option to override it.
99# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
100# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
101# endif
102
103# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
104# define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__type_visibility__("default")))
105# elif !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
106# define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__visibility__("default")))
107# else
108# define _LIBCPP_NAMESPACE_VISIBILITY
109# endif
110
111#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
112
113// hide_from_abi
114// -------------
115
116#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
117
118#if __has_attribute(exclude_from_explicit_instantiation)
119# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__))
120#else
121// Try to approximate the effect of exclude_from_explicit_instantiation
122// (which is that entities are not assumed to be provided by explicit
123// template instantiations in the dylib) by always inlining those entities.
124# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
125#endif
126
127#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
128# define _LIBCPP_HARDENING_SIG f
129#elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
130# define _LIBCPP_HARDENING_SIG s
131#elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
132# define _LIBCPP_HARDENING_SIG d
133#else
134# define _LIBCPP_HARDENING_SIG n // "none"
135#endif
136
137#if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE
138# define _LIBCPP_ASSERTION_SEMANTIC_SIG o
139#elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE
140# define _LIBCPP_ASSERTION_SEMANTIC_SIG q
141#elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE
142# define _LIBCPP_ASSERTION_SEMANTIC_SIG e
143#else
144# define _LIBCPP_ASSERTION_SEMANTIC_SIG i // `ignore`
145#endif
146
147#if !_LIBCPP_HAS_EXCEPTIONS
148# define _LIBCPP_EXCEPTIONS_SIG n
149#else
150# define _LIBCPP_EXCEPTIONS_SIG e
151#endif
152
153#define _LIBCPP_ODR_SIGNATURE \
154 _LIBCPP_CONCAT( \
155 _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \
156 _LIBCPP_VERSION)
157
158// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
159// on two levels:
160// 1. The symbol is given hidden visibility, which ensures that users won't start exporting
161// symbols from their dynamic library by means of using the libc++ headers. This ensures
162// that those symbols stay private to the dynamic library in which it is defined.
163//
164// 2. The symbol is given an ABI tag that encodes the ODR-relevant properties of the library.
165// This ensures that no ODR violation can arise from mixing two TUs compiled with different
166// versions or configurations of libc++ (such as exceptions vs no-exceptions). Indeed, if the
167// program contains two definitions of a function, the ODR requires them to be token-by-token
168// equivalent, and the linker is allowed to pick either definition and discard the other one.
169//
170// For example, if a program contains a copy of `vector::at()` compiled with exceptions enabled
171// *and* a copy of `vector::at()` compiled with exceptions disabled (by means of having two TUs
172// compiled with different settings), the two definitions are both visible by the linker and they
173// have the same name, but they have a meaningfully different implementation (one throws an exception
174// and the other aborts the program). This violates the ODR and makes the program ill-formed, and in
175// practice what will happen is that the linker will pick one of the definitions at random and will
176// discard the other one. This can quite clearly lead to incorrect program behavior.
177//
178// A similar reasoning holds for many other properties that are ODR-affecting. Essentially any
179// property that causes the code of a function to differ from the code in another configuration
180// can be considered ODR-affecting. In practice, we don't encode all such properties in the ABI
181// tag, but we encode the ones that we think are most important: library version, exceptions, and
182// hardening mode.
183//
184// Note that historically, solving this problem has been achieved in various ways, including
185// force-inlining all functions or giving internal linkage to all functions. Both these previous
186// solutions suffer from drawbacks that lead notably to code bloat.
187//
188// Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend
189// on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library.
190//
191// Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions
192// instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled
193// name of a virtual function is part of its ABI, since some architectures like arm64e can sign
194// the virtual function pointer in the vtable based on the mangled name of the function. Since
195// we use an ABI tag that changes with each released version, the mangled name of the virtual
196// function would change, which is incorrect. Note that it doesn't make much sense to change
197// the implementation of a virtual function in an ABI-incompatible way in the first place,
198// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable.
199//
200// The macro can be applied to record and enum types. When the tagged type is nested in
201// a record this "parent" record needs to have the macro too. Another use case for applying
202// this macro to records and unions is to apply an ABI tag to inline constexpr variables.
203// This can be useful for inline variables that are implementation details which are expected
204// to change in the future.
205//
206// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
207// the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
208// use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
209#ifndef _LIBCPP_NO_ABI_TAG
210# define _LIBCPP_HIDE_FROM_ABI \
211 _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
212 __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
213#else
214# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
215#endif
216#define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
217
218// This macro makes sure that private classes which aren't necessarily part of the ABI change their name every release.
219// The intention is _not_ to put it on every private class, but only on classes where type name stability implies ABI
220// stability. This is essentially the case for classes that are only accessed through the vtable after instantiation,
221// for example the control blocks of `shared_ptr`. These classes can change in ABI breaking ways as long as their name
222// (and hence their vtable symbol) changes too. Note that the vtable and RTTI are not marked with
223// [[gnu::visibility("hidden")]], since the vtable and RTTI should still be deduplicated across dylibs with the same
224// instatiations.
225#define _LIBCPP_HIDE_STRUCT_FROM_ABI [[__gnu__::__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))]]
226
227// Optional attributes
228// -------------------
229
230// these are useful for a better QoI, but not required to be available
231
232#define _LIBCPP_NOALIAS __attribute__((__malloc__))
233#define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]]
234#define _LIBCPP_NO_SANITIZE(...) __attribute__((__no_sanitize__(__VA_ARGS__)))
235#define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))
236#define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \
237 __attribute__((__format__(archetype, format_string_index, first_format_arg_index)))
238
239#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
240# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
241#else
242# define _LIBCPP_NO_CFI
243#endif
244
245#if __has_attribute(__using_if_exists__)
246# define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__))
247#else
248# define _LIBCPP_USING_IF_EXISTS
249#endif
250
251#if __has_cpp_attribute(_Clang::__no_destroy__)
252# define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]]
253#else
254# define _LIBCPP_NO_DESTROY
255#endif
256
257#if __has_attribute(__diagnose_if__)
258# define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))
259#else
260# define _LIBCPP_DIAGNOSE_WARNING(...)
261#endif
262
263#if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_APPLE_CLANG_VER) && \
264 (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2001)
265# define _LIBCPP_DIAGNOSE_IF(...) __attribute__((__diagnose_if__(__VA_ARGS__)))
266#else
267# define _LIBCPP_DIAGNOSE_IF(...)
268#endif
269
270#define _LIBCPP_DIAGNOSE_NULLPTR_IF(condition, condition_description) \
271 _LIBCPP_DIAGNOSE_IF( \
272 condition, \
273 "null passed to callee that requires a non-null argument" condition_description, \
274 "warning", \
275 "nonnull")
276
277#if __has_cpp_attribute(_Clang::__lifetimebound__)
278# define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
279#else
280# define _LIBCPP_LIFETIMEBOUND
281#endif
282
283// This is to work around https://llvm.org/PR156809
284#ifndef _LIBCPP_CXX03_LANG
285# define _LIBCPP_CTOR_LIFETIMEBOUND _LIBCPP_LIFETIMEBOUND
286#else
287# define _LIBCPP_CTOR_LIFETIMEBOUND
288#endif
289
290#if __has_cpp_attribute(_Clang::__noescape__)
291# define _LIBCPP_NOESCAPE [[_Clang::__noescape__]]
292#else
293# define _LIBCPP_NOESCAPE
294#endif
295
296#if __has_cpp_attribute(_Clang::__no_specializations__)
297# define _LIBCPP_NO_SPECIALIZATIONS \
298 [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]]
299#else
300# define _LIBCPP_NO_SPECIALIZATIONS
301#endif
302
303#if __has_cpp_attribute(_Clang::__preferred_name__)
304# define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]
305#else
306# define _LIBCPP_PREFERRED_NAME(x)
307#endif
308
309#if __has_cpp_attribute(_Clang::__scoped_lockable__)
310# define _LIBCPP_SCOPED_LOCKABLE [[_Clang::__scoped_lockable__]]
311#else
312# define _LIBCPP_SCOPED_LOCKABLE
313#endif
314
315#if __has_cpp_attribute(_Clang::__capability__)
316# define _LIBCPP_CAPABILITY(...) [[_Clang::__capability__(__VA_ARGS__)]]
317#else
318# define _LIBCPP_CAPABILITY(...)
319#endif
320
321#if __has_attribute(__acquire_capability__)
322# define _LIBCPP_ACQUIRE_CAPABILITY(...) __attribute__((__acquire_capability__(__VA_ARGS__)))
323#else
324# define _LIBCPP_ACQUIRE_CAPABILITY(...)
325#endif
326
327#if __has_cpp_attribute(_Clang::__try_acquire_capability__)
328# define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) [[_Clang::__try_acquire_capability__(__VA_ARGS__)]]
329#else
330# define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...)
331#endif
332
333#if __has_cpp_attribute(_Clang::__acquire_shared_capability__)
334# define _LIBCPP_ACQUIRE_SHARED_CAPABILITY [[_Clang::__acquire_shared_capability__]]
335#else
336# define _LIBCPP_ACQUIRE_SHARED_CAPABILITY
337#endif
338
339#if __has_cpp_attribute(_Clang::__try_acquire_shared_capability__)
340# define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) [[_Clang::__try_acquire_shared_capability__(__VA_ARGS__)]]
341#else
342# define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...)
343#endif
344
345#if __has_attribute(__release_capability__)
346# define _LIBCPP_RELEASE_CAPABILITY(...) __attribute__((__release_capability__(__VA_ARGS__)))
347#else
348# define _LIBCPP_RELEASE_CAPABILITY(...)
349#endif
350
351#if __has_cpp_attribute(_Clang::__release_shared_capability__)
352# define _LIBCPP_RELEASE_SHARED_CAPABILITY [[_Clang::__release_shared_capability__]]
353#else
354# define _LIBCPP_RELEASE_SHARED_CAPABILITY
355#endif
356
357#if __has_attribute(__requires_capability__)
358# define _LIBCPP_REQUIRES_CAPABILITY(...) __attribute__((__requires_capability__(__VA_ARGS__)))
359#else
360# define _LIBCPP_REQUIRES_CAPABILITY(...)
361#endif
362
363#if __has_cpp_attribute(_Clang::__no_thread_safety_analysis__)
364# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[_Clang::__no_thread_safety_analysis__]]
365#else
366# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
367#endif
368
369#if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases)
370# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
371#else
372# define _LIBCPP_DECLSPEC_EMPTY_BASES
373#endif
374
375// Allow for build-time disabling of unsigned integer sanitization
376#if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC)
377# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
378#else
379# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
380#endif
381
382#if __has_feature(nullability)
383# define _LIBCPP_DIAGNOSE_NULLPTR _Nonnull
384#else
385# define _LIBCPP_DIAGNOSE_NULLPTR
386#endif
387
388#if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
389// The CUDA SDK contains an unfortunate definition for the __noinline__ macro,
390// which breaks the regular __attribute__((__noinline__)) syntax. Therefore,
391// when compiling for CUDA we use the non-underscored version of the noinline
392// attribute.
393//
394// This is a temporary workaround and we still expect the CUDA SDK team to solve
395// this issue properly in the SDK headers.
396//
397// See https://github.com/llvm/llvm-project/pull/73838 for more details.
398# define _LIBCPP_NOINLINE __attribute__((noinline))
399#elif __has_attribute(__noinline__)
400# define _LIBCPP_NOINLINE __attribute__((__noinline__))
401#else
402# define _LIBCPP_NOINLINE
403#endif
404
405// Deprecation macros
406// ------------------
407
408// Deprecations warnings are always enabled, except when users explicitly opt-out
409// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
410#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
411# if __has_attribute(__deprecated__)
412# define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
413# define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))
414# elif _LIBCPP_STD_VER >= 14
415# define _LIBCPP_DEPRECATED [[deprecated]]
416# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]]
417# else
418# define _LIBCPP_DEPRECATED
419# define _LIBCPP_DEPRECATED_(m)
420# endif
421#else
422# define _LIBCPP_DEPRECATED
423# define _LIBCPP_DEPRECATED_(m)
424#endif
425
426#if !defined(_LIBCPP_CXX03_LANG)
427# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
428#else
429# define _LIBCPP_DEPRECATED_IN_CXX11
430#endif
431
432#if _LIBCPP_STD_VER >= 14
433# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
434#else
435# define _LIBCPP_DEPRECATED_IN_CXX14
436#endif
437
438#if _LIBCPP_STD_VER >= 17
439# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
440#else
441# define _LIBCPP_DEPRECATED_IN_CXX17
442#endif
443
444#if _LIBCPP_STD_VER >= 20
445# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED
446#else
447# define _LIBCPP_DEPRECATED_IN_CXX20
448#endif
449
450#if _LIBCPP_STD_VER >= 23
451# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
452#else
453# define _LIBCPP_DEPRECATED_IN_CXX23
454#endif
455
456#if _LIBCPP_STD_VER >= 26
457# define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED
458# define _LIBCPP_DEPRECATED_IN_CXX26_(m) _LIBCPP_DEPRECATED_(m)
459#else
460# define _LIBCPP_DEPRECATED_IN_CXX26
461# define _LIBCPP_DEPRECATED_IN_CXX26_(m)
462#endif
463
464#if _LIBCPP_HAS_CHAR8_T
465# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
466#else
467# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
468#endif
469
470#if __has_cpp_attribute(_Clang::__no_field_protection__)
471# define _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION [[_Clang::__no_field_protection__]]
472#else
473# define _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION
474#endif
475
476#endif // _LIBCPP___CONFIGURATION_ATTRIBUTES_H
lib/libcxx/include/__configuration/availability.h+93-68
......@@ -38,6 +38,11 @@
3838// When availability annotations are disabled, we take for granted that features introduced
3939// in all versions of the library are available.
4040#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
41# define _LIBCPP_INTRODUCED_IN_LLVM_23 1
42# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */
43
44# define _LIBCPP_INTRODUCED_IN_LLVM_23 1
45# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */
4146
4247# define _LIBCPP_INTRODUCED_IN_LLVM_22 1
4348# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */
......@@ -70,15 +75,34 @@
7075
7176// clang-format off
7277
78// LLVM 23
79// TODO: Fill this in
80# define _LIBCPP_INTRODUCED_IN_LLVM_23 0
81# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE __attribute__((unavailable))
82
7383// LLVM 22
7484// TODO: Fill this in
7585# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
7686# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
7787
7888// LLVM 21
79// TODO: Fill this in
80# define _LIBCPP_INTRODUCED_IN_LLVM_21 0
81# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE __attribute__((unavailable))
89# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260400) || \
90 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260400) || \
91 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260400) || \
92 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260400) || \
93 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100400) || \
94 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250400)
95# define _LIBCPP_INTRODUCED_IN_LLVM_21 0
96# else
97# define _LIBCPP_INTRODUCED_IN_LLVM_21 1
98# endif
99# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE \
100 __attribute__((availability(macos, strict, introduced = 26.4))) \
101 __attribute__((availability(ios, strict, introduced = 26.4))) \
102 __attribute__((availability(tvos, strict, introduced = 26.4))) \
103 __attribute__((availability(watchos, strict, introduced = 26.4))) \
104 __attribute__((availability(bridgeos, strict, introduced = 10.4))) \
105 __attribute__((availability(driverkit, strict, introduced = 25.4)))
82106
83107// LLVM 20
84108//
......@@ -87,7 +111,8 @@
87111 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \
88112 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \
89113 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \
90 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000)
114 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
115 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250000)
91116# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
92117# else
93118# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
......@@ -97,14 +122,16 @@
97122 __attribute__((availability(ios, strict, introduced = 26.0))) \
98123 __attribute__((availability(tvos, strict, introduced = 26.0))) \
99124 __attribute__((availability(watchos, strict, introduced = 26.0))) \
100 __attribute__((availability(bridgeos, strict, introduced = 10.0)))
125 __attribute__((availability(bridgeos, strict, introduced = 10.0))) \
126 __attribute__((availability(driverkit, strict, introduced = 25.0)))
101127
102128// LLVM 19
103129# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \
104130 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \
105131 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \
106132 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \
107 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400)
133 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400) || \
134 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240400)
108135# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
109136# else
110137# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
......@@ -114,7 +141,8 @@
114141 __attribute__((availability(ios, strict, introduced = 18.4))) \
115142 __attribute__((availability(tvos, strict, introduced = 18.4))) \
116143 __attribute__((availability(watchos, strict, introduced = 11.4))) \
117 __attribute__((availability(bridgeos, strict, introduced = 9.4)))
144 __attribute__((availability(bridgeos, strict, introduced = 9.4))) \
145 __attribute__((availability(driverkit, strict, introduced = 24.4)))
118146
119147// LLVM 18
120148# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \
......@@ -220,51 +248,28 @@
220248#define _LIBCPP_AVAILABILITY_HAS_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22
221249#define _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
222250
223// Enable additional explicit instantiations of iostreams components. This
224// reduces the number of weak definitions generated in programs that use
225// iostreams by providing a single strong definition in the shared library.
226//
227// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
228// or once libc++ doesn't use the attribute anymore.
229// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
230#if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
231# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
232#else
233# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
234#endif
235
236// This controls the availability of floating-point std::to_chars functions.
237// These overloads were added later than the integer overloads.
238#define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
239#define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
240
241// This controls whether the library claims to provide a default verbose
242// termination function, and consequently whether the headers will try
243// to use it when the mechanism isn't overriden at compile-time.
244#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
245#define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
251// This controls whether `std::__hash_memory` is available in the dylib, which
252// is used for some `std::hash` specializations.
253#define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21
254// No attribute, since we've had hash in the headers before
246255
247// This controls the availability of the C++17 std::pmr library,
248// which is implemented in large part in the built library.
249//
250// TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed
251// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
252// it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we
253// use availability annotations until that bug has been fixed.
254#define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
255#define _LIBCPP_AVAILABILITY_PMR
256// This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`.
257// See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib.
258#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
259// No attribute, since we've had bad_function_call::what() in the headers before
256260
257// These macros controls the availability of __cxa_init_primary_exception
258// in the built library, which std::make_exception_ptr might use
259// (see libcxx/include/__exception/exception_ptr.h).
260#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
261#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
261// This determines whether we assume that the internal std::__bad_variant_access_with_msg class
262// (which carries a message describing the cause of the failure in bad_variant_access::what())
263// provides a key function in the dylib. This allows centralizing its vtable and typeinfo instead
264// of having all TUs provide a weak definition that then gets deduplicated. When it is not available
265// in the dylib, what() is defined inline instead, so the descriptive message is provided regardless.
266#define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_23
267// No attribute, since we've had bad_variant_access in the headers before
262268
263// This controls the availability of C++23 <print>, which
264// has a dependency on the built library (it needs access to
265// the underlying buffer types of std::cout, std::cerr, and std::clog.
266#define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18
267#define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
269// This controls the availability of floating-point std::from_chars functions.
270// These overloads were added later than the integer overloads.
271#define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
272#define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
268273
269274// This controls the availability of the C++20 time zone database.
270275// The parser code is built in the library.
......@@ -280,30 +285,50 @@
280285#define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
281286#define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
282287
283// This controls the availability of floating-point std::from_chars functions.
284// These overloads were added later than the integer overloads.
285#define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
286#define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
288// These macros controls the availability of __cxa_init_primary_exception
289// in the built library, which std::make_exception_ptr might use
290// (see libcxx/include/__exception/exception_ptr.h).
291#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
292#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
287293
288// This controls whether `std::__hash_memory` is available in the dylib, which
289// is used for some `std::hash` specializations.
290#define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21
291// No attribute, since we've had hash in the headers before
294// This controls the availability of the C++17 std::pmr library,
295// which is implemented in large part in the built library.
296//
297// TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed
298// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
299// it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we
300// use availability annotations until that bug has been fixed.
301#define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
302#define _LIBCPP_AVAILABILITY_PMR
292303
293// This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`.
294// See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib.
295#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
296// No attribute, since we've had bad_function_call::what() in the headers before
304// This controls whether the library claims to provide a default verbose
305// termination function, and consequently whether the headers will try
306// to use it when the mechanism isn't overriden at compile-time.
307#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
308#define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
309
310// This controls the availability of floating-point std::to_chars functions.
311// These overloads were added later than the integer overloads.
312#define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
313#define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
297314
298// Define availability attributes that depend on both
299// _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
300#if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
301# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
302# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
303# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
304# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
315// Enable additional explicit instantiations of iostreams components. This
316// reduces the number of weak definitions generated in programs that use
317// iostreams by providing a single strong definition in the shared library.
318//
319// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
320// or once libc++ doesn't use the attribute anymore.
321// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
322#if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
323# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
324#else
325# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
305326#endif
306327
328// Controls whether the implementation for text_encoding::environment() is available
329#define _LIBCPP_AVAILABILITY_HAS_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23
330#define _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE
331
307332// Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older
308333# if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8
309334# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8
lib/libcxx/include/__configuration/compiler.h+29-4
......@@ -33,12 +33,12 @@
3333// Warn if a compiler version is used that is not supported anymore
3434// LLVM RELEASE Update the minimum compiler versions
3535# if defined(_LIBCPP_CLANG_VER)
36# if _LIBCPP_CLANG_VER < 2001
37# warning "Libc++ only supports Clang 20 and later"
36# if _LIBCPP_CLANG_VER < 2101
37# warning "Libc++ only supports Clang 21 and later"
3838# endif
3939# elif defined(_LIBCPP_APPLE_CLANG_VER)
40# if _LIBCPP_APPLE_CLANG_VER < 1700
41# warning "Libc++ only supports AppleClang 26 and later"
40# if _LIBCPP_APPLE_CLANG_VER < 2100
41# warning "Libc++ only supports AppleClang 26.4 and later"
4242# endif
4343# elif defined(_LIBCPP_GCC_VER)
4444# if _LIBCPP_GCC_VER < 1500
......@@ -46,6 +46,31 @@
4646# endif
4747# endif
4848
49# ifndef __has_constexpr_builtin
50# define __has_constexpr_builtin(x) 0
51# endif
52
53// This checks wheter a Clang module is built
54# ifndef __building_module
55# define __building_module(...) 0
56# endif
57
58// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
59// the compiler and '1' otherwise.
60# ifndef __is_identifier
61# define __is_identifier(__x) 1
62# endif
63
64# define __has_keyword(__x) !(__is_identifier(__x))
65
66# ifndef __has_warning
67# define __has_warning(...) 0
68# endif
69
70# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
71# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
72# endif
73
4974#endif
5075
5176#endif // _LIBCPP___CONFIGURATION_COMPILER_H
lib/libcxx/include/__configuration/diagnostic_suppression.h created+44
......@@ -0,0 +1,44 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
11#define _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
12
13/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
14#include <__configuration/compiler.h>
15#include <__configuration/utility.h>
16
17#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
18# pragma GCC system_header
19#endif
20
21#ifdef _LIBCPP_COMPILER_CLANG_BASED
22# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
23# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
24# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str))
25# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
26#elif defined(_LIBCPP_COMPILER_GCC)
27# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
28# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
29# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
30# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str))
31#else
32# define _LIBCPP_DIAGNOSTIC_PUSH
33# define _LIBCPP_DIAGNOSTIC_POP
34# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
35# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
36#endif
37
38// Macros to enter and leave a state where deprecation warnings are suppressed.
39#define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
40 _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated") \
41 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
42#define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP
43
44#endif // _LIBCPP___CONFIGURATION_DIAGNOSTIC_SUPPRESSION_H
lib/libcxx/include/__configuration/hardening.h-17
......@@ -17,23 +17,6 @@
1717# pragma GCC system_header
1818#endif
1919
20// TODO(LLVM 23): Remove this. We're making these an error to catch folks who might not have migrated.
21// Since hardening went through several changes (many of which impacted user-facing macros),
22// we're keeping these checks around for a bit longer than usual. Failure to properly configure
23// hardening results in checks being dropped silently, which is a pretty big deal.
24#if defined(_LIBCPP_ENABLE_ASSERTIONS)
25# error "_LIBCPP_ENABLE_ASSERTIONS has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
26#endif
27#if defined(_LIBCPP_ENABLE_HARDENED_MODE)
28# error "_LIBCPP_ENABLE_HARDENED_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
29#endif
30#if defined(_LIBCPP_ENABLE_SAFE_MODE)
31# error "_LIBCPP_ENABLE_SAFE_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
32#endif
33#if defined(_LIBCPP_ENABLE_DEBUG_MODE)
34# error "_LIBCPP_ENABLE_DEBUG_MODE has been removed, please use _LIBCPP_HARDENING_MODE=<mode> instead (see docs)"
35#endif
36
3720// The library provides the macro `_LIBCPP_HARDENING_MODE` which can be set to one of the following values:
3821//
3922// - `_LIBCPP_HARDENING_MODE_NONE`;
lib/libcxx/include/__configuration/language.h+42
......@@ -50,4 +50,46 @@
5050# define _LIBCPP_HAS_EXCEPTIONS 0
5151#endif
5252
53#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
54# define _LIBCPP_HAS_CHAR8_T 0
55#else
56# define _LIBCPP_HAS_CHAR8_T 1
57#endif
58
59#if _LIBCPP_STD_VER <= 11
60# define _LIBCPP_EXPLICIT_SINCE_CXX14
61#else
62# define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit
63#endif
64
65#if _LIBCPP_STD_VER >= 14
66# define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
67#else
68# define _LIBCPP_CONSTEXPR_SINCE_CXX14
69#endif
70
71#if _LIBCPP_STD_VER >= 17
72# define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr
73#else
74# define _LIBCPP_CONSTEXPR_SINCE_CXX17
75#endif
76
77#if _LIBCPP_STD_VER >= 20
78# define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr
79#else
80# define _LIBCPP_CONSTEXPR_SINCE_CXX20
81#endif
82
83#if _LIBCPP_STD_VER >= 23
84# define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr
85#else
86# define _LIBCPP_CONSTEXPR_SINCE_CXX23
87#endif
88
89#if _LIBCPP_STD_VER >= 26
90# define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr
91#else
92# define _LIBCPP_CONSTEXPR_SINCE_CXX26
93#endif
94
5395#endif // _LIBCPP___CONFIGURATION_LANGUAGE_H
lib/libcxx/include/__configuration/namespace.h created+99
......@@ -0,0 +1,99 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_NAMESPACE_H
11#define _LIBCPP___CONFIGURATION_NAMESPACE_H
12
13/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
14#include <__configuration/attributes.h>
15#include <__configuration/diagnostic_suppression.h>
16#include <__configuration/utility.h>
17
18#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
19# pragma GCC system_header
20#endif
21
22// Clang modules take a significant compile time hit when pushing and popping diagnostics.
23// Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can
24// simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined.
25#ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
26# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS \
27 _LIBCPP_DIAGNOSTIC_PUSH \
28 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions") \
29 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
30 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
31 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
32 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \
33 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \
34 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \
35 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \
36 _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
37# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
38# define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS \
39 _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpragma-clang-attribute") \
40 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wignored-attributes")
41# define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP
42#else
43# define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS
44# define _LIBCPP_POP_EXTENSION_DIAGNOSTICS
45# define _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS
46# define _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
47#endif
48
49#define _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS \
50 _LIBCPP_PUSH_ABI_PRAGMA_DIAGNOSTICS \
51 _Pragma(_LIBCPP_TOSTRING(clang attribute _LibcxxExplicitABIAnnotations.push( \
52 __attribute__((__exclude_from_explicit_instantiation__, \
53 __visibility__("hidden"), \
54 __abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE)))), \
55 apply_to = function))) _LIBCPP_POP_ABI_PRAGMA_DIAGNOSTICS
56
57#define _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS _Pragma("clang attribute _LibcxxExplicitABIAnnotations.pop")
58
59// clang-format off
60
61// The unversioned namespace is used when we want to be ABI compatible with other standard libraries in some way. There
62// are two main categories where that's the case:
63// - Historically, we have made exception types ABI compatible with libstdc++ to allow throwing them between libstdc++
64// and libc++. This is not used anymore for new exception types, since there is no use-case for it anymore.
65// - Types and functions which are used by the compiler are in the unversioned namespace, since the compiler has to know
66// their mangling without the appropriate declaration in some cases.
67// If it's not clear whether using the unversioned namespace is the correct thing to do, it's not. The versioned
68// namespace (_LIBCPP_BEGIN_NAMESPACE_STD) should almost always be used.
69# define _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD \
70 _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS _LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS namespace _LIBCPP_NAMESPACE_VISIBILITY std {
71
72# define _LIBCPP_END_UNVERSIONED_NAMESPACE_STD } _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS _LIBCPP_POP_EXTENSION_DIAGNOSTICS
73
74# define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD inline namespace _LIBCPP_ABI_NAMESPACE {
75# define _LIBCPP_END_NAMESPACE_STD } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD
76
77// TODO: This should really be in the versioned namespace
78#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD namespace experimental {
79#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD
80
81#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
82#define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
83
84#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
85#define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
86
87#ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
88# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem {
89# define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD
90#else
91# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD \
92 inline namespace __fs { namespace filesystem {
93
94# define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD
95#endif
96
97// clang-format on
98
99#endif // _LIBCPP___CONFIGURATION_NAMESPACE_H
lib/libcxx/include/__configuration/platform.h+4
......@@ -30,6 +30,10 @@
3030// ... add new file formats here ...
3131#endif
3232
33#if defined(__MVS__)
34# include <features.h> // for __NATIVE_ASCII_F
35#endif
36
3337// Need to detect which libc we're using if we're on Linux.
3438#if (defined(__linux__) || defined(__AMDGPU__) || defined(__NVPTX__)) && __has_include(<features.h>)
3539# include <features.h>
lib/libcxx/include/__configuration/pstl.h created+66
......@@ -0,0 +1,66 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_PSTL_H
11#define _LIBCPP___CONFIGURATION_PSTL_H
12
13/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
14
15#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
16# pragma GCC system_header
17#endif
18
19#define _PSTL_PRAGMA(x) _Pragma(#x)
20
21// Enable SIMD for compilers that support OpenMP 4.0
22#if (defined(_OPENMP) && _OPENMP >= 201307)
23
24# define _PSTL_UDR_PRESENT
25# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)
26# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)
27# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))
28# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))
29# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))
30# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))
31
32// Declaration of reduction functor, where
33// NAME - the name of the functor
34// OP - type of the callable object with the reduction operation
35// omp_in - refers to the local partial result
36// omp_out - refers to the final value of the combiner operator
37// omp_priv - refers to the private copy of the initial value
38// omp_orig - refers to the original variable to be reduced
39# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \
40 _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))
41
42#elif defined(_LIBCPP_COMPILER_CLANG_BASED)
43
44# define _PSTL_PRAGMA_SIMD _Pragma("clang loop vectorize(enable) interleave(enable)")
45# define _PSTL_PRAGMA_DECLARE_SIMD
46# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")
47# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")
48# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
49# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
50# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
51
52#else // (defined(_OPENMP) && _OPENMP >= 201307)
53
54# define _PSTL_PRAGMA_SIMD
55# define _PSTL_PRAGMA_DECLARE_SIMD
56# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)
57# define _PSTL_PRAGMA_SIMD_SCAN(PRM)
58# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)
59# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)
60# define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)
61
62#endif // (defined(_OPENMP) && _OPENMP >= 201307)
63
64#define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
65
66#endif // _LIBCPP___CONFIGURATION_PSTL_H
lib/libcxx/include/__configuration/utility.h created+26
......@@ -0,0 +1,26 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_UTILITY_H
11#define _LIBCPP___CONFIGURATION_UTILITY_H
12
13/* zig patch: instead of including __config_site, zig adds -D flags when compiling */
14
15#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
16# pragma GCC system_header
17#endif
18
19#define _LIBCPP_TOSTRING2(x) #x
20#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
21
22#define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
23#define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
24#define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))
25
26#endif // _LIBCPP___CONFIGURATION_UTILITY_H
lib/libcxx/include/__cstddef/byte.h+6-6
......@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
2323
2424enum class byte : unsigned char {};
2525
26_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
26[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
2727 return static_cast<byte>(
2828 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
2929}
......@@ -32,7 +32,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator|=(byte& __lhs, byte __rhs)
3232 return __lhs = __lhs | __rhs;
3333}
3434
35_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
35[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
3636 return static_cast<byte>(
3737 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
3838}
......@@ -41,7 +41,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator&=(byte& __lhs, byte __rhs)
4141 return __lhs = __lhs & __rhs;
4242}
4343
44_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
44[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
4545 return static_cast<byte>(
4646 static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
4747}
......@@ -50,7 +50,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr byte& operator^=(byte& __lhs, byte __rhs)
5050 return __lhs = __lhs ^ __rhs;
5151}
5252
53_LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept {
53[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr byte operator~(byte __b) noexcept {
5454 return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
5555}
5656
......@@ -60,7 +60,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator<<=(byte& __lhs, _Integer __shift)
6060}
6161
6262template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
63_LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept {
63[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr byte operator<<(byte __lhs, _Integer __shift) noexcept {
6464 return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift));
6565}
6666
......@@ -70,7 +70,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr byte& operator>>=(byte& __lhs, _Integer __shift)
7070}
7171
7272template <class _Integer, __enable_if_t<is_integral<_Integer>::value, int> = 0>
73_LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept {
73[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr byte operator>>(byte __lhs, _Integer __shift) noexcept {
7474 return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift));
7575}
7676
lib/libcxx/include/__cstddef/max_align_t.h+4-2
......@@ -16,12 +16,14 @@
1616# pragma GCC system_header
1717#endif
1818
19#if !defined(_LIBCPP_CXX03_LANG)
20
1921_LIBCPP_BEGIN_NAMESPACE_STD
2022
21#if !defined(_LIBCPP_CXX03_LANG)
2223using ::max_align_t _LIBCPP_USING_IF_EXISTS;
23#endif
2424
2525_LIBCPP_END_NAMESPACE_STD
2626
27#endif
28
2729#endif // _LIBCPP___CSTDDEF_MAX_ALIGN_T_H
lib/libcxx/include/__debug_utils/sanitizers.h+30-5
......@@ -17,7 +17,32 @@
1717# pragma GCC system_header
1818#endif
1919
20#if __has_feature(address_sanitizer)
20// Within libc++, _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS determines whether the containers should
21// provide ASAN container overflow checks. That setting attempts to honour ASAN's documented option
22// __SANITIZER_DISABLE_CONTAINER_OVERFLOW__ which can be defined by users to disable container overflow
23// checks.
24//
25// However, since parts of some containers (e.g. std::string) are compiled separately into the built
26// library, there are caveats:
27// - __SANITIZER_DISABLE_CONTAINER_OVERFLOW__ can't always be honoured, i.e. if the built library
28// was compiled with ASAN container checks, it's impossible to turn them off afterwards. We diagnose
29// this with an error to avoid the proliferation of invalid configurations that appear to work.
30//
31// - The container overflow checks themselves are not always available even when the user is compiling
32// with -fsanitize=address. If a container is compiled separately like std::string, it can't provide
33// container checks unless the separately compiled code was built with container checks enabled. These
34// containers need to also conditionalize whether they provide overflow checks on `_LIBCPP_INSTRUMENTED_WITH_ASAN`.
35#if __has_feature(address_sanitizer) && !defined(__SANITIZER_DISABLE_CONTAINER_OVERFLOW__)
36# define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS 1
37#else
38# define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS 0
39#endif
40
41#if _LIBCPP_INSTRUMENTED_WITH_ASAN && !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
42# error "We can't disable ASAN container checks when libc++ has been built with ASAN container checks enabled"
43#endif
44
45#if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
2146
2247extern "C" {
2348_LIBCPP_EXPORTED_FROM_ABI void
......@@ -28,12 +53,12 @@ _LIBCPP_EXPORTED_FROM_ABI int
2853__sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*);
2954}
3055
31#endif // __has_feature(address_sanitizer)
56#endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
3257
3358_LIBCPP_BEGIN_NAMESPACE_STD
3459
3560// ASan choices
36#if __has_feature(address_sanitizer)
61#if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
3762# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
3863#endif
3964
......@@ -57,7 +82,7 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
5782 const void* __last_old_contained,
5883 const void* __first_new_contained,
5984 const void* __last_new_contained) {
60#if !__has_feature(address_sanitizer)
85#if !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
6186 (void)__first_storage;
6287 (void)__last_storage;
6388 (void)__first_old_contained;
......@@ -86,7 +111,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_c
86111 const void* __last_storage,
87112 const void* __old_last_contained,
88113 const void* __new_last_contained) {
89#if !__has_feature(address_sanitizer)
114#if !_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
90115 (void)__first_storage;
91116 (void)__last_storage;
92117 (void)__old_last_contained;
lib/libcxx/include/__exception/exception.h+2
......@@ -22,6 +22,7 @@
2222#endif
2323
2424_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
2627#if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0)
2728// The std::exception class was already included above, but we're explicit about this condition here for clarity.
......@@ -91,6 +92,7 @@ public:
9192};
9293#endif // !_LIBCPP_ABI_VCRUNTIME
9394
95_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
9496_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
9597
9698#endif // _LIBCPP___EXCEPTION_EXCEPTION_H
lib/libcxx/include/__exception/exception_ptr.h+15-37
......@@ -31,7 +31,7 @@ _LIBCPP_PUSH_MACROS
3131
3232#ifndef _LIBCPP_ABI_MICROSOFT
3333
34# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
34# if _LIBCPP_HAS_EXCEPTIONS && _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
3535
3636namespace __cxxabiv1 {
3737
......@@ -55,13 +55,12 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception(
5555
5656} // namespace __cxxabiv1
5757
58# endif
58# endif // _LIBCPP_HAS_EXCEPTIONS && _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
5959
60#endif
60#endif // !defined(_LIBCPP_ABI_MICROSOFT)
6161
6262_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
63
64#ifndef _LIBCPP_ABI_MICROSOFT
63_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
6564
6665inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _NOEXCEPT;
6766
......@@ -73,6 +72,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
7372 template <class _Ep>
7473 friend _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep&) _NOEXCEPT;
7574
75 friend _LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void*, const void*);
76
7677public:
7778 // exception_ptr is basically a COW string so it is trivially relocatable.
7879 using __trivially_relocatable _LIBCPP_NODEBUG = exception_ptr;
......@@ -112,8 +113,10 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(exception_ptr& __x, exception_ptr& __y) _
112113 std::swap(__x.__ptr_, __y.__ptr_);
113114}
114115
116#ifndef _LIBCPP_ABI_MICROSOFT
117
115118# if _LIBCPP_HAS_EXCEPTIONS
116# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
119# if _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
117120template <class _Ep>
118121_LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOEXCEPT {
119122 using _Ep2 = __decay_t<_Ep>;
......@@ -136,7 +139,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_explicit(_Ep& __e) _NOE
136139 return current_exception();
137140 }
138141}
139# endif
142# endif // _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
140143
141144template <class _Ep>
142145_LIBCPP_HIDE_FROM_ABI exception_ptr __make_exception_ptr_via_throw(_Ep& __e) _NOEXCEPT {
......@@ -164,7 +167,7 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
164167 return std::__make_exception_ptr_via_throw(__e);
165168 }
166169
167# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && !defined(_LIBCPP_CXX03_LANG)
170# if _LIBCPP_HAS_RTTI && _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && !defined(_LIBCPP_CXX03_LANG)
168171 return std::__make_exception_ptr_explicit(__e);
169172# else
170173 return std::__make_exception_ptr_via_throw(__e);
......@@ -177,36 +180,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT {
177180}
178181# endif // _LIBCPP_HAS_EXCEPTIONS
179182
180#else // _LIBCPP_ABI_MICROSOFT
181
182class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
183 _LIBCPP_DIAGNOSTIC_PUSH
184 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
185 void* __ptr1_;
186 void* __ptr2_;
187 _LIBCPP_DIAGNOSTIC_POP
188
189public:
190 exception_ptr() _NOEXCEPT;
191 exception_ptr(nullptr_t) _NOEXCEPT;
192 exception_ptr(const exception_ptr& __other) _NOEXCEPT;
193 exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT;
194 exception_ptr& operator=(nullptr_t) _NOEXCEPT;
195 ~exception_ptr() _NOEXCEPT;
196 explicit operator bool() const _NOEXCEPT;
197};
198
199_LIBCPP_EXPORTED_FROM_ABI bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT;
200
201inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {
202 return !(__x == __y);
203}
204
205_LIBCPP_EXPORTED_FROM_ABI void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
183#else // defined(_LIBCPP_ABI_MICROSOFT)
206184
207185_LIBCPP_EXPORTED_FROM_ABI exception_ptr __copy_exception_ptr(void* __except, const void* __ptr);
208_LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
209[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
210186
211187// This is a built-in template function which automagically extracts the required
212188// information.
......@@ -218,7 +194,9 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
218194 return __copy_exception_ptr(std::addressof(__e), __GetExceptionInfo(__e));
219195}
220196
221#endif // _LIBCPP_ABI_MICROSOFT
197#endif // defined(_LIBCPP_ABI_MICROSOFT)
198
199_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
222200_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
223201
224202_LIBCPP_POP_MACROS
lib/libcxx/include/__exception/nested_exception.h+6-6
......@@ -14,7 +14,6 @@
1414#include <__memory/addressof.h>
1515#include <__type_traits/decay.h>
1616#include <__type_traits/enable_if.h>
17#include <__type_traits/integral_constant.h>
1817#include <__type_traits/is_base_of.h>
1918#include <__type_traits/is_class.h>
2019#include <__type_traits/is_constructible.h>
......@@ -28,6 +27,7 @@
2827#endif
2928
3029_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
30_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3131
3232class _LIBCPP_EXPORTED_FROM_ABI nested_exception {
3333 exception_ptr __ptr_;
......@@ -81,20 +81,20 @@ template <class _Tp>
8181}
8282
8383template <class _From, class _To>
84struct __can_dynamic_cast
85 : _BoolConstant< is_polymorphic<_From>::value &&
86 (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value)> {};
84inline const bool __can_dynamic_cast_v =
85 is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value);
8786
88template <class _Ep, __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value, int> = 0>
87template <class _Ep, __enable_if_t<__can_dynamic_cast_v<_Ep, nested_exception>, int> = 0>
8988inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep& __e) {
9089 const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::addressof(__e));
9190 if (__nep)
9291 __nep->rethrow_nested();
9392}
9493
95template <class _Ep, __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value, int> = 0>
94template <class _Ep, __enable_if_t<!__can_dynamic_cast_v<_Ep, nested_exception>, int> = 0>
9695inline _LIBCPP_HIDE_FROM_ABI void rethrow_if_nested(const _Ep&) {}
9796
97_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
9898_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
9999
100100#endif // _LIBCPP___EXCEPTION_NESTED_EXCEPTION_H
lib/libcxx/include/__exception/operations.h+4
......@@ -16,6 +16,8 @@
1616#endif
1717
1818_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
19_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
20
1921#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \
2022 defined(_LIBCPP_BUILDING_LIBRARY)
2123using unexpected_handler = void (*)();
......@@ -37,6 +39,8 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr;
3739
3840[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI exception_ptr current_exception() _NOEXCEPT;
3941[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void rethrow_exception(exception_ptr);
42
43_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4044_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
4145
4246#endif // _LIBCPP___EXCEPTION_OPERATIONS_H
lib/libcxx/include/__exception/terminate.h+4
......@@ -16,7 +16,11 @@
1616#endif
1717
1818_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
19_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
20
1921[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void terminate() _NOEXCEPT;
22
23_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2024_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
2125
2226#endif // _LIBCPP___EXCEPTION_TERMINATE_H
lib/libcxx/include/__expected/bad_expected_access.h+2
......@@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS
2323#if _LIBCPP_STD_VER >= 23
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
26_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2627
2728template <class _Err>
2829class bad_expected_access;
......@@ -66,6 +67,7 @@ private:
6667 _Err __unex_;
6768};
6869
70_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
6971_LIBCPP_END_NAMESPACE_STD
7072
7173#endif // _LIBCPP_STD_VER >= 23
lib/libcxx/include/__expected/expected.h+19-13
......@@ -10,6 +10,7 @@
1010#define _LIBCPP___EXPECTED_EXPECTED_H
1111
1212#include <__assert>
13#include <__concepts/same_as.h>
1314#include <__config>
1415#include <__expected/bad_expected_access.h>
1516#include <__expected/unexpect.h>
......@@ -36,7 +37,6 @@
3637#include <__type_traits/is_trivially_destructible.h>
3738#include <__type_traits/is_trivially_relocatable.h>
3839#include <__type_traits/is_void.h>
39#include <__type_traits/lazy.h>
4040#include <__type_traits/negation.h>
4141#include <__type_traits/remove_cv.h>
4242#include <__type_traits/remove_cvref.h>
......@@ -446,6 +446,10 @@ private:
446446 _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_;
447447};
448448
449// Helper to handle comparisons that produce a value whose type is not bool,
450// but allows only implicit (and not explicit) conversions to bool.
451constexpr bool __into_bool(bool __b) noexcept { return __b; }
452
449453template <class _Tp, class _Err>
450454class expected : private __expected_base<_Tp, _Err> {
451455 static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
......@@ -684,12 +688,11 @@ public:
684688private:
685689 template <class _OtherErrQual>
686690 static constexpr bool __can_assign_from_unexpected =
687 _And< is_constructible<_Err, _OtherErrQual>,
688 is_assignable<_Err&, _OtherErrQual>,
689 _Lazy<_Or,
690 is_nothrow_constructible<_Err, _OtherErrQual>,
691 is_nothrow_move_constructible<_Tp>,
692 is_nothrow_move_constructible<_Err>> >::value;
691 _And<is_constructible<_Err, _OtherErrQual>,
692 is_assignable<_Err&, _OtherErrQual>,
693 _Or<is_nothrow_constructible<_Err, _OtherErrQual>,
694 is_nothrow_move_constructible<_Tp>,
695 is_nothrow_move_constructible<_Err>>>::value;
693696
694697public:
695698 template <class _OtherErr>
......@@ -1161,15 +1164,18 @@ public:
11611164 }
11621165 }
11631166
1164 template <class _T2>
1165 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v)
1167 // The unusual signature avoids constraint recursion via ADL through
1168 // std::expected, see https://llvm.org/PR160431. Note that this only
1169 // triggers with compilers that implement https://wg21.link/CWG2369.
1170 template <class _T2, same_as<_Tp> _Tp2>
1171 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected<_Tp2, _Err>& __x, const _T2& __v)
11661172# if _LIBCPP_STD_VER >= 26
11671173 requires(!__is_std_expected<_T2>::value) && requires {
11681174 { *__x == __v } -> __core_convertible_to<bool>;
11691175 }
11701176# endif
11711177 {
1172 return __x.__has_val() && static_cast<bool>(__x.__val() == __v);
1178 return __x.__has_val() && std::__into_bool(__x.__val() == __v);
11731179 }
11741180
11751181 template <class _E2>
......@@ -1180,7 +1186,7 @@ public:
11801186 }
11811187# endif
11821188 {
1183 return !__x.__has_val() && static_cast<bool>(__x.__unex() == __e.error());
1189 return !__x.__has_val() && std::__into_bool(__x.__unex() == __e.error());
11841190 }
11851191};
11861192
......@@ -1882,7 +1888,7 @@ public:
18821888 if (__x.__has_val() != __y.__has_val()) {
18831889 return false;
18841890 } else {
1885 return __x.__has_val() || static_cast<bool>(__x.__unex() == __y.__unex());
1891 return __x.__has_val() || std::__into_bool(__x.__unex() == __y.__unex());
18861892 }
18871893 }
18881894
......@@ -1894,7 +1900,7 @@ public:
18941900 }
18951901# endif
18961902 {
1897 return !__x.__has_val() && static_cast<bool>(__x.__unex() == __y.error());
1903 return !__x.__has_val() && std::__into_bool(__x.__unex() == __y.error());
18981904 }
18991905};
19001906
lib/libcxx/include/__filesystem/directory_entry.h+2
......@@ -39,6 +39,7 @@ _LIBCPP_PUSH_MACROS
3939#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
4040
4141_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
42_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4243
4344class directory_entry {
4445 typedef filesystem::path _Path;
......@@ -465,6 +466,7 @@ private:
465466 directory_entry __elem_;
466467};
467468
469_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
468470_LIBCPP_END_NAMESPACE_FILESYSTEM
469471
470472#endif // _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
lib/libcxx/include/__filesystem/directory_iterator.h+2
......@@ -33,6 +33,7 @@ _LIBCPP_PUSH_MACROS
3333#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
3434
3535_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
36_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3637
3738class _LIBCPP_HIDDEN __dir_stream;
3839class directory_iterator {
......@@ -129,6 +130,7 @@ operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noe
129130 return directory_iterator();
130131}
131132
133_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
132134_LIBCPP_END_NAMESPACE_FILESYSTEM
133135
134136# if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__filesystem/filesystem_error.h+2
......@@ -26,6 +26,7 @@
2626#if _LIBCPP_STD_VER >= 17
2727
2828_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
29_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2930
3031class _LIBCPP_EXPORTED_FROM_ABI filesystem_error : public system_error {
3132public:
......@@ -80,6 +81,7 @@ template <class... _Args>
8081}
8182# endif
8283
84_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
8385_LIBCPP_END_NAMESPACE_FILESYSTEM
8486
8587#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__filesystem/operations.h+2
......@@ -31,6 +31,7 @@
3131
3232_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
3333
34_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3435_LIBCPP_EXPORTED_FROM_ABI path __absolute(const path&, error_code* __ec = nullptr);
3536_LIBCPP_EXPORTED_FROM_ABI path __canonical(const path&, error_code* __ec = nullptr);
3637_LIBCPP_EXPORTED_FROM_ABI bool
......@@ -67,6 +68,7 @@ _LIBCPP_EXPORTED_FROM_ABI path __temp_directory_path(error_code* __ec = nullptr)
6768_LIBCPP_EXPORTED_FROM_ABI bool __fs_is_empty(const path& __p, error_code* __ec = nullptr);
6869_LIBCPP_EXPORTED_FROM_ABI void __permissions(const path&, perms, perm_options, error_code* = nullptr);
6970_LIBCPP_EXPORTED_FROM_ABI space_info __space(const path&, error_code* __ec = nullptr);
71_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7072
7173[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p) { return __absolute(__p); }
7274[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI path absolute(const path& __p, error_code& __ec) {
lib/libcxx/include/__filesystem/path.h+37-52
......@@ -23,6 +23,7 @@
2323#include <__type_traits/is_pointer.h>
2424#include <__type_traits/remove_const.h>
2525#include <__type_traits/remove_pointer.h>
26#include <__type_traits/void_t.h>
2627#include <__utility/move.h>
2728#include <string>
2829#include <string_view>
......@@ -41,6 +42,7 @@ _LIBCPP_PUSH_MACROS
4142#if _LIBCPP_STD_VER >= 17
4243
4344_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
45_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4446
4547template <class _Tp>
4648struct __can_convert_char {
......@@ -93,15 +95,12 @@ typedef string __u8_string;
9395
9496struct _NullSentinel {};
9597
96template <class _Tp>
97using _Void _LIBCPP_NODEBUG = void;
98
9998template <class _Tp, class = void>
10099struct __is_pathable_string : public false_type {};
101100
102101template <class _ECharT, class _Traits, class _Alloc>
103102struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>,
104 _Void<typename __can_convert_char<_ECharT>::__char_type> >
103 void_t<typename __can_convert_char<_ECharT>::__char_type> >
105104 : public __can_convert_char<_ECharT> {
106105 using _Str _LIBCPP_NODEBUG = basic_string<_ECharT, _Traits, _Alloc>;
107106
......@@ -114,7 +113,7 @@ struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>,
114113
115114template <class _ECharT, class _Traits>
116115struct __is_pathable_string< basic_string_view<_ECharT, _Traits>,
117 _Void<typename __can_convert_char<_ECharT>::__char_type> >
116 void_t<typename __can_convert_char<_ECharT>::__char_type> >
118117 : public __can_convert_char<_ECharT> {
119118 using _Str _LIBCPP_NODEBUG = basic_string_view<_ECharT, _Traits>;
120119
......@@ -154,7 +153,7 @@ template <class _Iter>
154153struct __is_pathable_iter<
155154 _Iter,
156155 true,
157 _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> >
156 void_t<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> >
158157 : __can_convert_char<typename iterator_traits<_Iter>::value_type> {
159158 using _ECharT _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::value_type;
160159
......@@ -261,15 +260,14 @@ struct _PathCVT {
261260
262261template <>
263262struct _PathCVT<__path_value> {
264 template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
265 _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
266 for (; __b != __e; ++__b)
267 __dest.push_back(*__b);
268 }
269
270 template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
263 template <class _Iter>
271264 _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
272 __dest.append(__b, __e);
265 if constexpr (__has_forward_iterator_category<_Iter>::value) {
266 __dest.append(__b, __e);
267 } else {
268 for (; __b != __e; ++__b)
269 __dest.push_back(*__b);
270 }
273271 }
274272
275273 template <class _Iter>
......@@ -296,13 +294,7 @@ struct _PathCVT<char> {
296294 __char_to_wide(__str, const_cast<__path_value*>(__dest.data()) + __pos, __size);
297295 }
298296
299 template <class _Iter, __enable_if_t<__has_exactly_input_iterator_category<_Iter>::value, int> = 0>
300 _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
301 basic_string<char> __tmp(__b, __e);
302 __append_string(__dest, __tmp);
303 }
304
305 template <class _Iter, __enable_if_t<__has_forward_iterator_category<_Iter>::value, int> = 0>
297 template <class _Iter>
306298 _LIBCPP_HIDE_FROM_ABI static void __append_range(__path_string& __dest, _Iter __b, _Iter __e) {
307299 basic_string<char> __tmp(__b, __e);
308300 __append_string(__dest, __tmp);
......@@ -449,7 +441,7 @@ public:
449441 return *this;
450442 }
451443
452 _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept {
444 _LIBCPP_HIDE_FROM_ABI path& assign(string_type&& __s) noexcept _LIBCPP_LIFETIMEBOUND {
453445 __pn_ = std::move(__s);
454446 return *this;
455447 }
......@@ -460,14 +452,14 @@ public:
460452 }
461453
462454 template <class _Source>
463 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) {
455 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> assign(const _Source& __src) _LIBCPP_LIFETIMEBOUND {
464456 __pn_.clear();
465457 _SourceCVT<_Source>::__append_source(__pn_, __src);
466458 return *this;
467459 }
468460
469461 template <class _InputIt>
470 _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) {
462 _LIBCPP_HIDE_FROM_ABI path& assign(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND {
471463 typedef typename iterator_traits<_InputIt>::value_type _ItVal;
472464 __pn_.clear();
473465 _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
......@@ -501,12 +493,12 @@ public:
501493 }
502494
503495 template <class _Source>
504 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
496 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) _LIBCPP_LIFETIMEBOUND {
505497 return operator/=(path(__src));
506498 }
507499
508500 template <class _InputIt>
509 _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
501 _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND {
510502 return operator/=(path(__first, __last));
511503 }
512504# else
......@@ -530,7 +522,7 @@ public:
530522 }
531523
532524 template <class _Source>
533 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) {
525 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> append(const _Source& __src) _LIBCPP_LIFETIMEBOUND {
534526 using _Traits = __is_pathable<_Source>;
535527 using _CVT = _PathCVT<_SourceChar<_Source> >;
536528 bool __source_is_absolute = filesystem::__is_separator(_Traits::__first_or_null(__src));
......@@ -543,7 +535,7 @@ public:
543535 }
544536
545537 template <class _InputIt>
546 _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) {
538 _LIBCPP_HIDE_FROM_ABI path& append(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND {
547539 typedef typename iterator_traits<_InputIt>::value_type _ItVal;
548540 static_assert(__can_convert_char<_ItVal>::value, "Must convertible");
549541 using _CVT = _PathCVT<_ItVal>;
......@@ -594,13 +586,13 @@ public:
594586 }
595587
596588 template <class _Source>
597 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) {
589 _LIBCPP_HIDE_FROM_ABI _EnableIfPathable<_Source> concat(const _Source& __x) _LIBCPP_LIFETIMEBOUND {
598590 _SourceCVT<_Source>::__append_source(__pn_, __x);
599591 return *this;
600592 }
601593
602594 template <class _InputIt>
603 _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) {
595 _LIBCPP_HIDE_FROM_ABI path& concat(_InputIt __first, _InputIt __last) _LIBCPP_LIFETIMEBOUND {
604596 typedef typename iterator_traits<_InputIt>::value_type _ItVal;
605597 _PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
606598 return *this;
......@@ -609,26 +601,26 @@ public:
609601 // modifiers
610602 _LIBCPP_HIDE_FROM_ABI void clear() noexcept { __pn_.clear(); }
611603
612 _LIBCPP_HIDE_FROM_ABI path& make_preferred() {
604 _LIBCPP_HIDE_FROM_ABI path& make_preferred() _LIBCPP_LIFETIMEBOUND {
613605# if defined(_LIBCPP_WIN32API)
614606 std::replace(__pn_.begin(), __pn_.end(), L'/', L'\\');
615607# endif
616608 return *this;
617609 }
618610
619 _LIBCPP_HIDE_FROM_ABI path& remove_filename() {
611 _LIBCPP_HIDE_FROM_ABI path& remove_filename() _LIBCPP_LIFETIMEBOUND {
620612 auto __fname = __filename();
621613 if (!__fname.empty())
622614 __pn_.erase(__fname.data() - __pn_.data());
623615 return *this;
624616 }
625617
626 _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) {
618 _LIBCPP_HIDE_FROM_ABI path& replace_filename(const path& __replacement) _LIBCPP_LIFETIMEBOUND {
627619 remove_filename();
628620 return (*this /= __replacement);
629621 }
630622
631 path& replace_extension(const path& __replacement = path());
623 path& replace_extension(const path& __replacement = path()) _LIBCPP_LIFETIMEBOUND;
632624
633625 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const path& __lhs, const path& __rhs) noexcept {
634626 return __lhs.__compare(__rhs.__pn_) == 0;
......@@ -667,9 +659,11 @@ public:
667659 _LIBCPP_HIDE_FROM_ABI void __reserve(size_t __s) { __pn_.reserve(__s); }
668660
669661 // native format observers
670 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept { return __pn_; }
662 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const string_type& native() const noexcept _LIBCPP_LIFETIMEBOUND { return __pn_; }
671663
672 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept { return __pn_.c_str(); }
664 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const value_type* c_str() const noexcept _LIBCPP_LIFETIMEBOUND {
665 return __pn_.c_str();
666 }
673667
674668 _LIBCPP_HIDE_FROM_ABI operator string_type() const { return __pn_; }
675669
......@@ -874,23 +868,13 @@ public:
874868 [[nodiscard]] iterator end() const;
875869
876870# if _LIBCPP_HAS_LOCALIZATION
877 template <
878 class _CharT,
879 class _Traits,
880 __enable_if_t<is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value, int> = 0>
881 _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
882 operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
883 __os << std::__quoted(__p.native());
884 return __os;
885 }
886
887 template <
888 class _CharT,
889 class _Traits,
890 __enable_if_t<!is_same<_CharT, value_type>::value || !is_same<_Traits, char_traits<value_type> >::value, int> = 0>
871 template <class _CharT, class _Traits>
891872 _LIBCPP_HIDE_FROM_ABI friend basic_ostream<_CharT, _Traits>&
892873 operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
893 __os << std::__quoted(__p.string<_CharT, _Traits>());
874 if constexpr (is_same<_CharT, value_type>::value && is_same<_Traits, char_traits<value_type> >::value)
875 __os << std::quoted(__p.native());
876 else
877 __os << std::quoted(__p.string<_CharT, _Traits>());
894878 return __os;
895879 }
896880
......@@ -898,7 +882,7 @@ public:
898882 _LIBCPP_HIDE_FROM_ABI friend basic_istream<_CharT, _Traits>&
899883 operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) {
900884 basic_string<_CharT, _Traits> __tmp;
901 __is >> std::__quoted(__tmp);
885 __is >> std::quoted(__tmp);
902886 __p = __tmp;
903887 return __is;
904888 }
......@@ -916,6 +900,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(path& __lhs, path& __rhs) noexcept { __lh
916900
917901[[nodiscard]] _LIBCPP_EXPORTED_FROM_ABI size_t hash_value(const path& __p) noexcept;
918902
903_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
919904_LIBCPP_END_NAMESPACE_FILESYSTEM
920905
921906_LIBCPP_BEGIN_NAMESPACE_STD
lib/libcxx/include/__filesystem/path_iterator.h+2
......@@ -22,6 +22,7 @@
2222#if _LIBCPP_STD_VER >= 17
2323
2424_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
2627class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
2728public:
......@@ -103,6 +104,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const path::iterator& __lhs, const
103104 return !(__lhs == __rhs);
104105}
105106
107_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
106108_LIBCPP_END_NAMESPACE_FILESYSTEM
107109
108110#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__filesystem/recursive_directory_iterator.h+2
......@@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS
3232#if _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_FILESYSTEM
3333
3434_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
35_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3536
3637class recursive_directory_iterator {
3738public:
......@@ -139,6 +140,7 @@ begin(recursive_directory_iterator __iter) noexcept {
139140 return recursive_directory_iterator();
140141}
141142
143_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
142144_LIBCPP_END_NAMESPACE_FILESYSTEM
143145
144146# if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__flat_map/flat_multimap.h-9
......@@ -934,15 +934,6 @@ private:
934934
935935 containers __containers_;
936936 _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_;
937
938 struct __key_equiv {
939 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __key_equiv(key_compare __c) : __comp_(__c) {}
940 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
941 operator()(const_reference __x, const_reference __y) const {
942 return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x));
943 }
944 key_compare __comp_;
945 };
946937};
947938
948939template <class _KeyContainer, class _MappedContainer, class _Compare = less<typename _KeyContainer::value_type>>
lib/libcxx/include/__flat_set/flat_multiset.h-9
......@@ -745,15 +745,6 @@ private:
745745
746746 _KeyContainer __keys_;
747747 _LIBCPP_NO_UNIQUE_ADDRESS key_compare __compare_;
748
749 struct __key_equiv {
750 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __key_equiv(key_compare __c) : __comp_(__c) {}
751 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
752 operator()(const_reference __x, const_reference __y) const {
753 return !__comp_(std::get<0>(__x), std::get<0>(__y)) && !__comp_(std::get<0>(__y), std::get<0>(__x));
754 }
755 key_compare __comp_;
756 };
757748};
758749
759750template <class _KeyContainer, class _Compare = less<typename _KeyContainer::value_type>>
lib/libcxx/include/__format/container_adaptor.h+4-4
......@@ -24,10 +24,10 @@
2424#include <__type_traits/is_const.h>
2525#include <__type_traits/maybe_const.h>
2626
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2927#if _LIBCPP_STD_VER >= 23
3028
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3131// [container.adaptors.format] only specifies the library should provide the
3232// formatter specializations, not which header should provide them.
3333// Since <format> includes a lot of headers, add these headers here instead of
......@@ -66,8 +66,8 @@ template <class _CharT, class _Tp, formattable<_CharT> _Container>
6666struct formatter<stack<_Tp, _Container>, _CharT>
6767 : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {};
6868
69#endif // _LIBCPP_STD_VER >= 23
70
7169_LIBCPP_END_NAMESPACE_STD
7270
71#endif // _LIBCPP_STD_VER >= 23
72
7373#endif // _LIBCPP___FORMAT_CONTAINER_ADAPTOR_H
lib/libcxx/include/__format/enable_insertable.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 20
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323namespace __format {
2424
2525/// Opt-in to enable \ref __insertable for a \a _Container.
......@@ -28,8 +28,8 @@ inline constexpr bool __enable_insertable = false;
2828
2929} // namespace __format
3030
31#endif // _LIBCPP_STD_VER >= 20
32
3331_LIBCPP_END_NAMESPACE_STD
3432
33#endif // _LIBCPP_STD_VER >= 20
34
3535#endif // _LIBCPP___FORMAT_ENABLE_INSERTABLE_H
lib/libcxx/include/__format/escaped_output_table.h+7-6
......@@ -61,19 +61,20 @@
6161#ifndef _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H
6262#define _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H
6363
64#include <__algorithm/ranges_upper_bound.h>
64#include <__algorithm/upper_bound.h>
6565#include <__config>
6666#include <__cstddef/ptrdiff_t.h>
67#include <__iterator/access.h>
6768#include <cstdint>
6869
6970#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
7071# pragma GCC system_header
7172#endif
7273
73_LIBCPP_BEGIN_NAMESPACE_STD
74
7574#if _LIBCPP_STD_VER >= 23
7675
76_LIBCPP_BEGIN_NAMESPACE_STD
77
7778namespace __escaped_output_table {
7879// clang-format off
7980
......@@ -868,7 +869,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = {
868869 if (__code_point >= 0x000323b0)
869870 return true;
870871
871 ptrdiff_t __i = std::ranges::upper_bound(__entries, (__code_point << 14) | 0x3fffu) - __entries;
872 ptrdiff_t __i = std::upper_bound(std::begin(__entries), std::end(__entries), (__code_point << 14) | 0x3fffu) - __entries;
872873 if (__i == 0)
873874 return false;
874875
......@@ -880,8 +881,8 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[735] = {
880881// clang-format on
881882} // namespace __escaped_output_table
882883
883#endif // _LIBCPP_STD_VER >= 23
884
885884_LIBCPP_END_NAMESPACE_STD
886885
886#endif // _LIBCPP_STD_VER >= 23
887
887888#endif // _LIBCPP___FORMAT_ESCAPED_OUTPUT_TABLE_H
lib/libcxx/include/__format/fmt_pair_like.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 23
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727// [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a
2828// different name for the concept.
2929//
......@@ -35,8 +35,8 @@ template <class _Tp>
3535concept __fmt_pair_like =
3636 __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2);
3737
38#endif // _LIBCPP_STD_VER >= 23
39
4038_LIBCPP_END_NAMESPACE_STD
4139
40#endif // _LIBCPP_STD_VER >= 23
41
4242#endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H
lib/libcxx/include/__format/format_context.h+4-7
......@@ -40,10 +40,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4040
4141#if _LIBCPP_STD_VER >= 20
4242
43template <class _OutIt, class _CharT>
44 requires output_iterator<_OutIt, const _CharT&>
45class basic_format_context;
46
4743# if _LIBCPP_HAS_LOCALIZATION
4844/**
4945 * Helper to create a basic_format_context.
......@@ -71,15 +67,16 @@ using wformat_context = basic_format_context< back_insert_iterator<__format::__o
7167# endif
7268
7369template <class _OutIt, class _CharT>
74 requires output_iterator<_OutIt, const _CharT&>
75class _LIBCPP_PREFERRED_NAME(format_context)
76 _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context)) basic_format_context {
70class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context))
71 basic_format_context {
7772public:
7873 using iterator = _OutIt;
7974 using char_type = _CharT;
8075 template <class _Tp>
8176 using formatter_type = formatter<_Tp, _CharT>;
8277
78 static_assert(output_iterator<_OutIt, const _CharT&>, "[format.context]/p3 requires OutIt to be an output_iterator");
79
8380 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
8481 return __args_.get(__id);
8582 }
lib/libcxx/include/__format/format_error.h+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324#if _LIBCPP_STD_VER >= 20
2425
......@@ -45,6 +46,7 @@ _LIBCPP_DIAGNOSTIC_POP
4546
4647#endif // _LIBCPP_STD_VER >= 20
4748
49_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4850_LIBCPP_END_NAMESPACE_STD
4951
5052#endif // _LIBCPP___FORMAT_FORMAT_ERROR_H
lib/libcxx/include/__format/format_functions.h+15-11
......@@ -11,7 +11,7 @@
1111#define _LIBCPP___FORMAT_FORMAT_FUNCTIONS
1212
1313#include <__algorithm/clamp.h>
14#include <__algorithm/ranges_find_first_of.h>
14#include <__algorithm/find_first_of.h>
1515#include <__chrono/statically_widen.h>
1616#include <__concepts/convertible_to.h>
1717#include <__concepts/same_as.h>
......@@ -26,7 +26,7 @@
2626#include <__format/format_string.h>
2727#include <__format/format_to_n_result.h>
2828#include <__format/formatter.h>
29#include <__format/formatter_bool.h>
29#include <__format/formatter_bool_impl.h>
3030#include <__format/formatter_char.h>
3131#include <__format/formatter_floating_point.h>
3232#include <__format/formatter_integer.h>
......@@ -342,7 +342,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&&
342342
343343# if _LIBCPP_STD_VER >= 26
344344template <class _CharT>
345struct __runtime_format_string {
345struct __dynamic_format_string {
346346private:
347347 basic_string_view<_CharT> __str_;
348348
......@@ -350,15 +350,15 @@ private:
350350 friend struct basic_format_string;
351351
352352public:
353 _LIBCPP_HIDE_FROM_ABI __runtime_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
353 _LIBCPP_HIDE_FROM_ABI __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
354354
355 __runtime_format_string(const __runtime_format_string&) = delete;
356 __runtime_format_string& operator=(const __runtime_format_string&) = delete;
355 __dynamic_format_string(const __dynamic_format_string&) = delete;
356 __dynamic_format_string& operator=(const __dynamic_format_string&) = delete;
357357};
358358
359_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<char> runtime_format(string_view __fmt) noexcept { return __fmt; }
359_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; }
360360# if _LIBCPP_HAS_WIDE_CHARACTERS
361_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wstring_view __fmt) noexcept {
361_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept {
362362 return __fmt;
363363}
364364# endif
......@@ -375,7 +375,7 @@ struct basic_format_string {
375375
376376 _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
377377# if _LIBCPP_STD_VER >= 26
378 _LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
378 _LIBCPP_HIDE_FROM_ABI basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
379379# endif
380380
381381private:
......@@ -459,8 +459,12 @@ template <class _CharT>
459459 basic_string_view<_CharT> __fmt,
460460 basic_format_args<basic_format_context<back_insert_iterator<__format::__output_buffer<_CharT>>, _CharT>> __args) {
461461 // Fold strings not containing '{' or '}' to just return the string
462 if (bool __is_identity = [&] [[__gnu__::__pure__]] // Make sure the compiler knows this call can be eliminated
463 { return std::ranges::find_first_of(__fmt, array{'{', '}'}) == __fmt.end(); }();
462 if (bool __is_identity =
463 [&] [[__gnu__::__pure__]] // Make sure the compiler knows this call can be eliminated
464 {
465 char __vals[] = {'{', '}'};
466 return std::find_first_of(__fmt.begin(), __fmt.end(), std::begin(__vals), std::end(__vals)) == __fmt.end();
467 }();
464468 __builtin_constant_p(__is_identity) && __is_identity)
465469 return basic_string<_CharT>{__fmt};
466470
lib/libcxx/include/__format/formatter_bool.h+5-30
......@@ -10,19 +10,10 @@
1010#ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_H
1111#define _LIBCPP___FORMAT_FORMATTER_BOOL_H
1212
13#include <__algorithm/copy.h>
14#include <__assert>
1513#include <__config>
1614#include <__format/concepts.h>
17#include <__format/format_parse_context.h>
1815#include <__format/formatter.h>
19#include <__format/formatter_integral.h>
2016#include <__format/parser_std_format_spec.h>
21#include <__utility/unreachable.h>
22
23#if _LIBCPP_HAS_LOCALIZATION
24# include <__locale>
25#endif
2617
2718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2819# pragma GCC system_header
......@@ -32,9 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3223
3324#if _LIBCPP_STD_VER >= 20
3425
26template <__fmt_char_type _CharT, class _FormatContext>
27_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
28__formatter_bool_format(bool __value, __format_spec::__parser<_CharT>, _FormatContext&);
29
3530template <__fmt_char_type _CharT>
3631struct formatter<bool, _CharT> {
37public:
3832 template <class _ParseContext>
3933 _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
4034 typename _ParseContext::iterator __result = __parser_.__parse(__ctx, __format_spec::__fields_integral);
......@@ -44,26 +38,7 @@ public:
4438
4539 template <class _FormatContext>
4640 _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const {
47 switch (__parser_.__type_) {
48 case __format_spec::__type::__default:
49 case __format_spec::__type::__string:
50 return __formatter::__format_bool(__value, __ctx, __parser_.__get_parsed_std_specifications(__ctx));
51
52 case __format_spec::__type::__binary_lower_case:
53 case __format_spec::__type::__binary_upper_case:
54 case __format_spec::__type::__octal:
55 case __format_spec::__type::__decimal:
56 case __format_spec::__type::__hexadecimal_lower_case:
57 case __format_spec::__type::__hexadecimal_upper_case:
58 // Promotes bool to an integral type. This reduces the number of
59 // instantiations of __format_integer reducing code size.
60 return __formatter::__format_integer(
61 static_cast<unsigned>(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx));
62
63 default:
64 _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type");
65 __libcpp_unreachable();
66 }
41 return std::__formatter_bool_format(__value, __parser_, __ctx);
6742 }
6843
6944 __format_spec::__parser<_CharT> __parser_;
lib/libcxx/include/__format/formatter_bool_impl.h created+60
......@@ -0,0 +1,60 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H
11#define _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H
12
13#include <__assert>
14#include <__config>
15#include <__format/concepts.h>
16#include <__format/formatter_bool.h>
17#include <__format/formatter_integral.h>
18#include <__format/parser_std_format_spec.h>
19#include <__utility/unreachable.h>
20
21#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22# pragma GCC system_header
23#endif
24
25#if _LIBCPP_STD_VER >= 20
26
27_LIBCPP_BEGIN_NAMESPACE_STD
28
29// This function is separated from formatter<bool> to avoid pulling in a bunch of code from <format> that we aren't
30// required to provide in other headers where we need formatter<bool> itself to be complete.
31template <__fmt_char_type _CharT, class _FormatContext>
32_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
33__formatter_bool_format(bool __value, __format_spec::__parser<_CharT> __parser, _FormatContext& __ctx) {
34 switch (__parser.__type_) {
35 case __format_spec::__type::__default:
36 case __format_spec::__type::__string:
37 return __formatter::__format_bool(__value, __ctx, __parser.__get_parsed_std_specifications(__ctx));
38
39 case __format_spec::__type::__binary_lower_case:
40 case __format_spec::__type::__binary_upper_case:
41 case __format_spec::__type::__octal:
42 case __format_spec::__type::__decimal:
43 case __format_spec::__type::__hexadecimal_lower_case:
44 case __format_spec::__type::__hexadecimal_upper_case:
45 // Promotes bool to an integral type. This reduces the number of
46 // instantiations of __format_integer reducing code size.
47 return __formatter::__format_integer(
48 static_cast<unsigned>(__value), __ctx, __parser.__get_parsed_std_specifications(__ctx));
49
50 default:
51 _LIBCPP_ASSERT_INTERNAL(false, "The parse function should have validated the type");
52 __libcpp_unreachable();
53 }
54}
55
56_LIBCPP_END_NAMESPACE_STD
57
58#endif // _LIBCPP_STD_VER >= 20
59
60#endif // _LIBCPP___FORMAT_FORMATTER_BOOL_IMPL_H
lib/libcxx/include/__format/formatter_floating_point.h+4-4
......@@ -32,12 +32,12 @@
3232#include <__format/formatter_output.h>
3333#include <__format/parser_std_format_spec.h>
3434#include <__iterator/concepts.h>
35#include <__math/traits.h>
3536#include <__memory/allocator.h>
3637#include <__system_error/errc.h>
3738#include <__type_traits/conditional.h>
3839#include <__utility/move.h>
3940#include <__utility/unreachable.h>
40#include <cmath>
4141
4242#if _LIBCPP_HAS_LOCALIZATION
4343# include <__locale>
......@@ -637,10 +637,10 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
637637template <floating_point _Tp, class _CharT, class _FormatContext>
638638_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
639639__format_floating_point(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
640 bool __negative = std::signbit(__value);
640 bool __negative = __math::signbit(__value);
641641
642 if (!std::isfinite(__value)) [[unlikely]]
643 return __formatter::__format_floating_point_non_finite(__ctx.out(), __specs, __negative, std::isnan(__value));
642 if (!__math::isfinite(__value)) [[unlikely]]
643 return __formatter::__format_floating_point_non_finite(__ctx.out(), __specs, __negative, __math::isnan(__value));
644644
645645 // Depending on the std-format-spec string the sign and the value
646646 // might not be outputted together:
lib/libcxx/include/__format/formatter_tuple.h+4-4
......@@ -31,10 +31,10 @@
3131# pragma GCC system_header
3232#endif
3333
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3634#if _LIBCPP_STD_VER >= 23
3735
36_LIBCPP_BEGIN_NAMESPACE_STD
37
3838template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args>
3939struct __formatter_tuple {
4040 _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept {
......@@ -141,8 +141,8 @@ struct formatter<pair<_Args...>, _CharT> : public __formatter_tuple<_CharT, pair
141141template <__fmt_char_type _CharT, formattable<_CharT>... _Args>
142142struct formatter<tuple<_Args...>, _CharT> : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {};
143143
144#endif // _LIBCPP_STD_VER >= 23
145
146144_LIBCPP_END_NAMESPACE_STD
147145
146#endif // _LIBCPP_STD_VER >= 23
147
148148#endif // _LIBCPP___FORMAT_FORMATTER_TUPLE_H
lib/libcxx/include/__format/range_default_formatter.h+5-4
......@@ -22,6 +22,7 @@
2222#include <__format/formatter.h>
2323#include <__format/range_format.h>
2424#include <__format/range_formatter.h>
25#include <__fwd/format.h>
2526#include <__iterator/back_insert_iterator.h>
2627#include <__ranges/concepts.h>
2728#include <__ranges/data.h>
......@@ -32,10 +33,10 @@
3233#include <__utility/pair.h>
3334#include <string_view>
3435
35_LIBCPP_BEGIN_NAMESPACE_STD
36
3736#if _LIBCPP_STD_VER >= 23
3837
38_LIBCPP_BEGIN_NAMESPACE_STD
39
3940template <class _Rp, class _CharT>
4041concept __const_formattable_range =
4142 ranges::input_range<const _Rp> && formattable<ranges::range_reference_t<const _Rp>, _CharT>;
......@@ -168,8 +169,8 @@ template <ranges::input_range _Rp, class _CharT>
168169 requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>)
169170struct formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {};
170171
171#endif // _LIBCPP_STD_VER >= 23
172
173172_LIBCPP_END_NAMESPACE_STD
174173
174#endif // _LIBCPP_STD_VER >= 23
175
175176#endif // _LIBCPP___FORMAT_RANGE_DEFAULT_FORMATTER_H
lib/libcxx/include/__format/range_format.h+4-18
......@@ -17,27 +17,13 @@
1717#include <__concepts/same_as.h>
1818#include <__config>
1919#include <__format/fmt_pair_like.h>
20#include <__fwd/format.h>
2021#include <__ranges/concepts.h>
2122#include <__type_traits/remove_cvref.h>
2223
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2524#if _LIBCPP_STD_VER >= 23
2625
27_LIBCPP_DIAGNOSTIC_PUSH
28_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow")
29_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow")
30// This shadows map, set, and string.
31enum class range_format { disabled, map, set, sequence, string, debug_string };
32_LIBCPP_DIAGNOSTIC_POP
33
34template <class _Rp>
35constexpr range_format format_kind = [] {
36 // [format.range.fmtkind]/1
37 // A program that instantiates the primary template of format_kind is ill-formed.
38 static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type");
39 return range_format::disabled;
40}();
26_LIBCPP_BEGIN_NAMESPACE_STD
4127
4228template <ranges::input_range _Rp>
4329 requires same_as<_Rp, remove_cvref_t<_Rp>>
......@@ -64,8 +50,8 @@ inline constexpr range_format format_kind<_Rp> = [] {
6450 return range_format::sequence;
6551}();
6652
67#endif // _LIBCPP_STD_VER >= 23
68
6953_LIBCPP_END_NAMESPACE_STD
7054
55#endif // _LIBCPP_STD_VER >= 23
56
7157#endif
lib/libcxx/include/__format/range_formatter.h+6-4
......@@ -34,10 +34,10 @@
3434#include <__type_traits/remove_cvref.h>
3535#include <string_view>
3636
37_LIBCPP_BEGIN_NAMESPACE_STD
38
3937#if _LIBCPP_STD_VER >= 23
4038
39_LIBCPP_BEGIN_NAMESPACE_STD
40
4141template <class _Tp, class _CharT = char>
4242 requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT>
4343struct range_formatter {
......@@ -215,6 +215,8 @@ private:
215215 switch (*__begin) {
216216 case _CharT('m'):
217217 if constexpr (__fmt_pair_like<_Tp>) {
218 __underlying_.set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": "));
219 __underlying_.set_brackets({}, {});
218220 set_brackets(_LIBCPP_STATICALLY_WIDEN(_CharT, "{"), _LIBCPP_STATICALLY_WIDEN(_CharT, "}"));
219221 set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", "));
220222 ++__begin;
......@@ -258,8 +260,8 @@ private:
258260 basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]");
259261};
260262
261#endif // _LIBCPP_STD_VER >= 23
262
263263_LIBCPP_END_NAMESPACE_STD
264264
265#endif // _LIBCPP_STD_VER >= 23
266
265267#endif // _LIBCPP___FORMAT_RANGE_FORMATTER_H
lib/libcxx/include/__format/unicode.h+1-1
......@@ -101,7 +101,7 @@ inline constexpr __consume_result __consume_result_error{__replacement_character
101101 return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value);
102102}
103103
104template <contiguous_iterator _Iterator>
104template <class _Iterator>
105105 requires same_as<iter_value_t<_Iterator>, char>
106106_LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(_Iterator __char, int __count) {
107107 do {
lib/libcxx/include/__functional/binary_negate.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Predicate>
2525class _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
2626 : public __binary_function<typename _Predicate::first_argument_type,
......@@ -44,8 +44,8 @@ not2(const _Predicate& __pred) {
4444 return binary_negate<_Predicate>(__pred);
4545}
4646
47#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
48
4947_LIBCPP_END_NAMESPACE_STD
5048
49#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
50
5151#endif // _LIBCPP___FUNCTIONAL_BINARY_NEGATE_H
lib/libcxx/include/__functional/bind_front.h+49
......@@ -17,6 +17,8 @@
1717#include <__type_traits/decay.h>
1818#include <__type_traits/enable_if.h>
1919#include <__type_traits/is_constructible.h>
20#include <__type_traits/is_member_pointer.h>
21#include <__type_traits/is_pointer.h>
2022#include <__utility/forward.h>
2123
2224#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -49,6 +51,53 @@ template <class _Fn, class... _Args>
4951
5052#endif // _LIBCPP_STD_VER >= 20
5153
54#if _LIBCPP_STD_VER >= 26
55
56template <auto _Fn, class _Indices, class... _BoundArgs>
57struct __nttp_bind_front_t;
58
59template <auto _Fn, size_t... _Indices, class... _BoundArgs>
60struct __nttp_bind_front_t<_Fn, index_sequence<_Indices...>, _BoundArgs...> {
61 tuple<_BoundArgs...> __bound_args_;
62
63 template <class _Self, class... _Args>
64 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(this _Self&& __self, _Args&&... __args) noexcept(noexcept(std::invoke(
65 _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...)))
66 -> decltype(std::invoke(
67 _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...)) {
68 return std::invoke(
69 _Fn, std::get<_Indices>(std::forward<_Self>(__self).__bound_args_)..., std::forward<_Args>(__args)...);
70 }
71};
72
73template <auto _Fn>
74struct __nttp_bind_without_bound_args_t {
75 template <class... _Args>
76 _LIBCPP_HIDE_FROM_ABI static constexpr auto
77 operator()(_Args&&... __args) noexcept(noexcept(std::invoke(_Fn, std::forward<_Args>(__args)...)))
78 -> decltype(std::invoke(_Fn, std::forward<_Args>(__args)...)) {
79 return std::invoke(_Fn, std::forward<_Args>(__args)...);
80 }
81};
82
83template <auto _Fn, class... _Args>
84[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto bind_front(_Args&&... __args) {
85 static_assert((is_constructible_v<decay_t<_Args>, _Args> && ...),
86 "bind_front requires all decay_t<Args> to be constructible from respective Args");
87 static_assert((is_move_constructible_v<decay_t<_Args>> && ...),
88 "bind_front requires all decay_t<Args> to be move constructible");
89 if constexpr (using _Ty = decltype(_Fn); is_pointer_v<_Ty> || is_member_pointer_v<_Ty>)
90 static_assert(_Fn != nullptr, "bind_front: f cannot be equal to nullptr");
91
92 if constexpr (sizeof...(_Args) == 0)
93 return __nttp_bind_without_bound_args_t<_Fn>{};
94 else
95 return __nttp_bind_front_t<_Fn, index_sequence_for<_Args...>, decay_t<_Args>...>{
96 .__bound_args_{std::forward<_Args>(__args)...}};
97}
98
99#endif // _LIBCPP_STD_VER >= 26
100
52101_LIBCPP_END_NAMESPACE_STD
53102
54103#endif // _LIBCPP___FUNCTIONAL_BIND_FRONT_H
lib/libcxx/include/__functional/binder1st.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Operation>
2525class _LIBCPP_DEPRECATED_IN_CXX11 binder1st
2626 : public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {
......@@ -47,8 +47,8 @@ bind1st(const _Operation& __op, const _Tp& __x) {
4747 return binder1st<_Operation>(__op, __x);
4848}
4949
50#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
51
5250_LIBCPP_END_NAMESPACE_STD
5351
52#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
53
5454#endif // _LIBCPP___FUNCTIONAL_BINDER1ST_H
lib/libcxx/include/__functional/binder2nd.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Operation>
2525class _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
2626 : public __unary_function<typename _Operation::first_argument_type, typename _Operation::result_type> {
......@@ -47,8 +47,8 @@ bind2nd(const _Operation& __op, const _Tp& __x) {
4747 return binder2nd<_Operation>(__op, __x);
4848}
4949
50#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
51
5250_LIBCPP_END_NAMESPACE_STD
5351
52#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
53
5454#endif // _LIBCPP___FUNCTIONAL_BINDER2ND_H
lib/libcxx/include/__functional/compose.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727struct __compose_op {
2828 template <class _Fn1, class _Fn2, class... _Args>
2929 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn1&& __f1, _Fn2&& __f2, _Args&&... __args) const noexcept(noexcept(
......@@ -46,8 +46,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __compose(_Fn1&& __f1, _Fn2&& __f2) noexcep
4646 return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(std::forward<_Fn1>(__f1), std::forward<_Fn2>(__f2));
4747}
4848
49#endif // _LIBCPP_STD_VER >= 20
50
5149_LIBCPP_END_NAMESPACE_STD
5250
51#endif // _LIBCPP_STD_VER >= 20
52
5353#endif // _LIBCPP___FUNCTIONAL_COMPOSE_H
lib/libcxx/include/__functional/function.h+12-3
......@@ -17,6 +17,7 @@
1717#include <__functional/binary_function.h>
1818#include <__functional/unary_function.h>
1919#include <__memory/addressof.h>
20#include <__new/placement_new_delete.h>
2021#include <__type_traits/aligned_storage.h>
2122#include <__type_traits/decay.h>
2223#include <__type_traits/invoke.h>
......@@ -44,6 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4445// bad_function_call
4546
4647_LIBCPP_DIAGNOSTIC_PUSH
48_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4749# if !_LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION
4850_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
4951# endif
......@@ -65,6 +67,7 @@ public:
6567 const char* what() const _NOEXCEPT override;
6668# endif
6769};
70_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
6871_LIBCPP_DIAGNOSTIC_POP
6972
7073[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
......@@ -128,6 +131,7 @@ namespace __function {
128131template <class _Fp>
129132class __base;
130133
134_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
131135template <class _Rp, class... _ArgTypes>
132136class __base<_Rp(_ArgTypes...)> {
133137public:
......@@ -146,6 +150,7 @@ public:
146150 virtual const std::type_info& target_type() const _NOEXCEPT = 0;
147151# endif // _LIBCPP_HAS_RTTI
148152};
153_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
149154
150155// __func implements __base for a given functor type.
151156
......@@ -527,9 +532,13 @@ public:
527532
528533# if _LIBCPP_HAS_BLOCKS_RUNTIME
529534
535_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
536
530537extern "C" void* _Block_copy(const void*);
531538extern "C" void _Block_release(const void*);
532539
540_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
541
533542template <class _Rp1, class... _ArgTypes1, class _Rp, class... _ArgTypes>
534543class __func<_Rp1 (^)(_ArgTypes1...), _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> {
535544 typedef _Rp1 (^__block_type)(_ArgTypes1...);
......@@ -540,7 +549,7 @@ public:
540549# if __has_feature(objc_arc)
541550 : __f_(__f)
542551# else
543 : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
552 : __f_(reinterpret_cast<__block_type>(__f ? __function::_Block_copy(__f) : nullptr))
544553# endif
545554 {
546555 }
......@@ -563,7 +572,7 @@ public:
563572 _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT {
564573# if !__has_feature(objc_arc)
565574 if (__f_)
566 _Block_release(__f_);
575 __function::_Block_release(__f_);
567576# endif
568577 __f_ = 0;
569578 }
......@@ -684,7 +693,7 @@ public:
684693template <class _Rp, class... _Ap>
685694function(_Rp (*)(_Ap...)) -> function<_Rp(_Ap...)>;
686695
687template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
696template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>>
688697function(_Fp) -> function<_Stripped>;
689698# endif // _LIBCPP_STD_VER >= 17
690699
lib/libcxx/include/__functional/hash.h+16-12
......@@ -23,7 +23,6 @@
2323#include <__type_traits/is_integral.h>
2424#include <__type_traits/is_unqualified.h>
2525#include <__type_traits/underlying_type.h>
26#include <__utility/pair.h>
2726#include <__utility/swap.h>
2827#include <cstdint>
2928#include <cstring>
......@@ -41,6 +40,11 @@ inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) {
4140 return __r;
4241}
4342
43struct _PairT {
44 size_t first;
45 size_t second;
46};
47
4448// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
4549// is 64 bits. This is because cityhash64 uses 64bit x 64bit
4650// multiplication, which can be very slow on 32-bit systems.
......@@ -104,9 +108,9 @@ struct __murmur2_or_cityhash<_Size, 64> {
104108 _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56);
105109 _Size __z =
106110 __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24));
107 pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
108 pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
109 __x = __x * __k1 + std::__loadword<_Size>(__s);
111 _PairT __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
112 _PairT __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
113 __x = __x * __k1 + std::__loadword<_Size>(__s);
110114
111115 // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
112116 __len = (__len - 1) & ~static_cast<_Size>(63);
......@@ -192,7 +196,7 @@ private:
192196
193197 // Return a 16-byte hash for 48 bytes. Quick and dirty.
194198 // Callers do best to use "random-looking" values for a and b.
195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
199 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _PairT
196200 __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
197201 __a += __w;
198202 __b = __rotate(__b + __a + __z, 21);
......@@ -200,11 +204,14 @@ private:
200204 __a += __x;
201205 __a += __y;
202206 __b += __rotate(__a, 44);
203 return pair<_Size, _Size>(__a + __z, __b + __c);
207 _PairT __ret;
208 __ret.first = __a + __z;
209 __ret.second = __b + __c;
210 return __ret;
204211 }
205212
206213 // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
207 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
214 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _PairT
208215 __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) {
209216 return __weak_hash_len_32_with_seeds(
210217 std::__loadword<_Size>(__s),
......@@ -242,7 +249,9 @@ private:
242249};
243250
244251#if _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY
252_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
245253[[__gnu__::__pure__]] _LIBCPP_EXPORTED_FROM_ABI size_t __hash_memory(_LIBCPP_NOESCAPE const void*, size_t) _NOEXCEPT;
254_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
246255#else
247256_LIBCPP_HIDE_FROM_ABI inline size_t __hash_memory(const void* __ptr, size_t __size) _NOEXCEPT {
248257 return __murmur2_or_cityhash<size_t>()(__ptr, __size);
......@@ -325,11 +334,6 @@ struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> {
325334 }
326335};
327336
328struct _PairT {
329 size_t first;
330 size_t second;
331};
332
333337_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
334338 typedef __scalar_hash<_PairT> _HashT;
335339 const _PairT __p = {__lhs, __rhs};
lib/libcxx/include/__functional/invoke.h+6-6
......@@ -19,19 +19,17 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 17
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <class _Fn, class... _Args>
2727_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 invoke_result_t<_Fn, _Args...>
2828invoke(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_v<_Fn, _Args...>) {
2929 return std::__invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
3030}
3131
32#endif // _LIBCPP_STD_VER >= 17
33
34#if _LIBCPP_STD_VER >= 23
32# if _LIBCPP_STD_VER >= 23
3533template <class _Result, class _Fn, class... _Args>
3634 requires is_invocable_r_v<_Result, _Fn, _Args...>
3735_LIBCPP_HIDE_FROM_ABI constexpr _Result
......@@ -48,8 +46,10 @@ invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result
4846 return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...);
4947 }
5048}
51#endif
49# endif
5250
5351_LIBCPP_END_NAMESPACE_STD
5452
53#endif // _LIBCPP_STD_VER >= 17
54
5555#endif // _LIBCPP___FUNCTIONAL_INVOKE_H
lib/libcxx/include/__functional/is_transparent.h+3-3
......@@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2121
2222#if _LIBCPP_STD_VER >= 14
2323
24template <class _Tp, class _Key = void, class = void>
24template <class _Comparator, class = void>
2525inline const bool __is_transparent_v = false;
2626
27template <class _Tp, class _Key>
28inline const bool __is_transparent_v<_Tp, _Key, __void_t<typename _Tp::is_transparent> > = true;
27template <class _Comparator>
28inline const bool __is_transparent_v<_Comparator, __void_t<typename _Comparator::is_transparent> > = true;
2929
3030#endif
3131
lib/libcxx/include/__functional/mem_fun_ref.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525template <class _Sp, class _Tp>
2626class _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> {
2727 _Sp (_Tp::*__p_)();
......@@ -138,8 +138,8 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {
138138 return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f);
139139}
140140
141#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
142
143141_LIBCPP_END_NAMESPACE_STD
144142
143#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
144
145145#endif // _LIBCPP___FUNCTIONAL_MEM_FUN_REF_H
lib/libcxx/include/__functional/operations.h+4-4
......@@ -379,8 +379,8 @@ struct less<void> {
379379 typedef void is_transparent;
380380};
381381
382template <class _Tp>
383struct __make_transparent<_Tp, less<_Tp> > {
382template <class _ArgumentType>
383struct __make_transparent<_ArgumentType, less<_ArgumentType> > {
384384 using type _LIBCPP_NODEBUG = less<>;
385385};
386386
......@@ -477,8 +477,8 @@ struct greater<void> {
477477template <class _Tp, class _Up>
478478inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true;
479479
480template <class _Tp>
481struct __make_transparent<_Tp, greater<_Tp>> {
480template <class _ArgumentType>
481struct __make_transparent<_ArgumentType, greater<_ArgumentType>> {
482482 using type _LIBCPP_NODEBUG = greater<>;
483483};
484484
lib/libcxx/include/__functional/perfect_forward.h+4-4
......@@ -28,10 +28,10 @@
2828_LIBCPP_PUSH_MACROS
2929#include <__undef_macros>
3030
31_LIBCPP_BEGIN_NAMESPACE_STD
32
3331#if _LIBCPP_STD_VER >= 17
3432
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3535template <class _Op, class _Indices, class... _BoundArgs>
3636struct __perfect_forward_impl;
3737
......@@ -96,10 +96,10 @@ public:
9696template <class _Op, class... _Args>
9797using __perfect_forward _LIBCPP_NODEBUG = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>;
9898
99#endif // _LIBCPP_STD_VER >= 17
100
10199_LIBCPP_END_NAMESPACE_STD
102100
101#endif // _LIBCPP_STD_VER >= 17
102
103103_LIBCPP_POP_MACROS
104104
105105#endif // _LIBCPP___FUNCTIONAL_PERFECT_FORWARD_H
lib/libcxx/include/__functional/pointer_to_binary_function.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Arg1, class _Arg2, class _Result>
2525class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> {
2626 _Result (*__f_)(_Arg1, _Arg2);
......@@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg1, _Arg2)) {
3636 return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f);
3737}
3838
39#endif
40
4139_LIBCPP_END_NAMESPACE_STD
4240
41#endif
42
4343#endif // _LIBCPP___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H
lib/libcxx/include/__functional/pointer_to_unary_function.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Arg, class _Result>
2525class _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> {
2626 _Result (*__f_)(_Arg);
......@@ -36,8 +36,8 @@ ptr_fun(_Result (*__f)(_Arg)) {
3636 return pointer_to_unary_function<_Arg, _Result>(__f);
3737}
3838
39#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
40
4139_LIBCPP_END_NAMESPACE_STD
4240
41#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
42
4343#endif // _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H
lib/libcxx/include/__functional/ranges_operations.h+4-4
......@@ -21,10 +21,10 @@
2121# pragma GCC system_header
2222#endif
2323
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2624#if _LIBCPP_STD_VER >= 20
2725
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2828namespace ranges {
2929
3030struct equal_to {
......@@ -115,8 +115,8 @@ inline const bool __is_generic_transparent_comparator_v<ranges::less> = true;
115115template <>
116116inline const bool __is_generic_transparent_comparator_v<ranges::greater> = true;
117117
118#endif // _LIBCPP_STD_VER >= 20
119
120118_LIBCPP_END_NAMESPACE_STD
121119
120#endif // _LIBCPP_STD_VER >= 20
121
122122#endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H
lib/libcxx/include/__functional/unary_negate.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Predicate>
2525class _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> {
2626 _Predicate __pred_;
......@@ -40,8 +40,8 @@ not1(const _Predicate& __pred) {
4040 return unary_negate<_Predicate>(__pred);
4141}
4242
43#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
44
4543_LIBCPP_END_NAMESPACE_STD
4644
45#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
46
4747#endif // _LIBCPP___FUNCTIONAL_UNARY_NEGATE_H
lib/libcxx/include/__fwd/format.h+22-5
......@@ -11,28 +11,45 @@
1111#define _LIBCPP___FWD_FORMAT_H
1212
1313#include <__config>
14#include <__iterator/concepts.h>
1514
1615#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1716# pragma GCC system_header
1817#endif
1918
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2219#if _LIBCPP_STD_VER >= 20
2320
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2423template <class _Context>
2524class basic_format_arg;
2625
2726template <class _OutIt, class _CharT>
28 requires output_iterator<_OutIt, const _CharT&>
2927class basic_format_context;
3028
3129template <class _Tp, class _CharT = char>
3230struct formatter;
3331
34#endif // _LIBCPP_STD_VER >= 20
32# if _LIBCPP_STD_VER >= 23
33
34_LIBCPP_DIAGNOSTIC_PUSH
35_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wshadow")
36_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wshadow")
37// This shadows map, set, and string.
38enum class range_format { disabled, map, set, sequence, string, debug_string };
39_LIBCPP_DIAGNOSTIC_POP
40
41template <class _Rp>
42constexpr range_format format_kind = [] {
43 // [format.range.fmtkind]/1
44 // A program that instantiates the primary template of format_kind is ill-formed.
45 static_assert(sizeof(_Rp) != sizeof(_Rp), "create a template specialization of format_kind for your type");
46 return range_format::disabled;
47}();
48
49# endif // _LIBCPP_STD_VER >= 23
3550
3651_LIBCPP_END_NAMESPACE_STD
3752
53#endif // _LIBCPP_STD_VER >= 20
54
3855#endif // _LIBCPP___FWD_FORMAT_H
lib/libcxx/include/__fwd/map.h deleted-31
......@@ -1,31 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___FWD_MAP_H
10#define _LIBCPP___FWD_MAP_H
11
12#include <__config>
13#include <__fwd/functional.h>
14#include <__fwd/memory.h>
15#include <__fwd/pair.h>
16
17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18# pragma GCC system_header
19#endif
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
24class map;
25
26template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
27class multimap;
28
29_LIBCPP_END_NAMESPACE_STD
30
31#endif // _LIBCPP___FWD_MAP_H
lib/libcxx/include/__fwd/set.h deleted-30
......@@ -1,30 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___FWD_SET_H
10#define _LIBCPP___FWD_SET_H
11
12#include <__config>
13#include <__fwd/functional.h>
14#include <__fwd/memory.h>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20_LIBCPP_BEGIN_NAMESPACE_STD
21
22template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
23class set;
24
25template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> >
26class multiset;
27
28_LIBCPP_END_NAMESPACE_STD
29
30#endif // _LIBCPP___FWD_SET_H
lib/libcxx/include/__fwd/span.h+4-4
......@@ -21,18 +21,18 @@
2121_LIBCPP_PUSH_MACROS
2222#include <__undef_macros>
2323
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2624#if _LIBCPP_STD_VER >= 20
2725
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2828inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
2929template <typename _Tp, size_t _Extent = dynamic_extent>
3030class span;
3131
32#endif
33
3432_LIBCPP_END_NAMESPACE_STD
3533
34#endif
35
3636_LIBCPP_POP_MACROS
3737
3838#endif // _LIBCPP___FWD_SPAN_H
lib/libcxx/include/__fwd/variant.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 17
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323template <class... _Types>
2424class variant;
2525
......@@ -61,8 +61,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const variant<_Types...>&);
6161template <class _Tp, class... _Types>
6262_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const variant<_Types...>&&);
6363
64#endif // _LIBCPP_STD_VER >= 17
65
6664_LIBCPP_END_NAMESPACE_STD
6765
66#endif // _LIBCPP_STD_VER >= 17
67
6868#endif // _LIBCPP___FWD_VARIANT_H
lib/libcxx/include/__hash_table+18-4
......@@ -41,6 +41,8 @@
4141#include <__type_traits/is_swappable.h>
4242#include <__type_traits/remove_const.h>
4343#include <__type_traits/remove_cvref.h>
44#include <__utility/exception_guard.h>
45#include <__utility/exchange.h>
4446#include <__utility/forward.h>
4547#include <__utility/move.h>
4648#include <__utility/pair.h>
......@@ -73,7 +75,9 @@ struct __is_hash_value_type : false_type {};
7375template <class _One>
7476struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__remove_cvref_t<_One> > {};
7577
78_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
7679_LIBCPP_EXPORTED_FROM_ABI size_t __next_prime(size_t __n);
80_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7781
7882template <class _NodePtr>
7983struct __hash_node_base {
......@@ -524,9 +528,7 @@ public:
524528
525529 _LIBCPP_HIDE_FROM_ABI __bucket_list_deallocator(__bucket_list_deallocator&& __x)
526530 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
527 : __size_(std::move(__x.__size_)), __alloc_(std::move(__x.__alloc_)) {
528 __x.size() = 0;
529 }
531 : __size_(std::__exchange(__x.__size_, 0)), __alloc_(std::move(__x.__alloc_)) {}
530532
531533 _LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; }
532534 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
......@@ -696,6 +698,17 @@ private:
696698
697699 _LIBCPP_HIDE_FROM_ABI void __copy_construct(__next_pointer __other_iter) {
698700 __next_pointer __own_iter = __first_node_.__ptr();
701 // If copying a node throws, the nodes that have already been constructed and linked into the
702 // list have to be deallocated. When this is called from the copy constructor the enclosing
703 // __hash_table is not fully constructed yet, so its destructor would not run to release them.
704 // This is also reached from operator= when assigning into an empty table; there the table
705 // stays alive, so we must leave it in a valid empty state: besides releasing the nodes we
706 // clear the bucket pointers, which were made to point into the now-deallocated node list.
707 auto __guard = std::__make_exception_guard([&] {
708 __deallocate_node_list(__first_node_.__next_);
709 __first_node_.__next_ = nullptr;
710 std::fill_n(__bucket_list_.get(), bucket_count(), nullptr);
711 });
699712 {
700713 __node_holder __new_node = __construct_node_hash(__other_iter->__hash(), __other_iter->__upcast()->__get_value());
701714 __own_iter->__next_ = static_cast<__next_pointer>(__new_node.release());
......@@ -706,6 +719,7 @@ private:
706719 __other_iter = __other_iter->__next_;
707720 __own_iter = __own_iter->__next_;
708721 __copy_construct(__other_iter, __own_iter, __current_chash);
722 __guard.__complete();
709723 }
710724
711725public:
......@@ -774,7 +788,7 @@ public:
774788
775789 template <class... _Args>
776790 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
777 return std::__try_key_extraction<key_type>(
791 return std::__try_key_extraction<key_type, value_type>(
778792 [this](const key_type& __key, _Args&&... __args2) {
779793 size_t __hash = hash_function()(__key);
780794 size_type __bc = bucket_count();
lib/libcxx/include/__iterator/access.h+15-13
......@@ -20,47 +20,49 @@
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
2222template <class _Tp, size_t _Np>
23_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* begin(_Tp (&__array)[_Np]) _NOEXCEPT {
23[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* begin(_Tp (&__array)[_Np]) _NOEXCEPT {
2424 return __array;
2525}
2626
2727template <class _Tp, size_t _Np>
28_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT {
28[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT {
2929 return __array + _Np;
3030}
3131
3232#if !defined(_LIBCPP_CXX03_LANG)
3333
3434template <class _Cp>
35_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) {
35[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) {
3636 return __c.begin();
3737}
3838
3939template <class _Cp>
40_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) -> decltype(__c.begin()) {
40[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c)
41 -> decltype(__c.begin()) {
4142 return __c.begin();
4243}
4344
4445template <class _Cp>
45_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) {
46[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) {
4647 return __c.end();
4748}
4849
4950template <class _Cp>
50_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) {
51[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) {
5152 return __c.end();
5253}
5354
5455# if _LIBCPP_STD_VER >= 14
5556
5657template <class _Cp>
57_LIBCPP_HIDE_FROM_ABI constexpr auto
58cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c))) -> decltype(std::begin(__c)) {
58[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr auto cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c)))
59 -> decltype(std::begin(__c)) {
5960 return std::begin(__c);
6061}
6162
6263template <class _Cp>
63_LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) -> decltype(std::end(__c)) {
64[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c)))
65 -> decltype(std::end(__c)) {
6466 return std::end(__c);
6567}
6668
......@@ -69,22 +71,22 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std:
6971#else // defined(_LIBCPP_CXX03_LANG)
7072
7173template <class _Cp>
72_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) {
74[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) {
7375 return __c.begin();
7476}
7577
7678template <class _Cp>
77_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) {
79[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) {
7880 return __c.begin();
7981}
8082
8183template <class _Cp>
82_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) {
84[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) {
8385 return __c.end();
8486}
8587
8688template <class _Cp>
87_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) {
89[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) {
8890 return __c.end();
8991}
9092
lib/libcxx/include/__iterator/back_insert_iterator.h+3-1
......@@ -58,7 +58,9 @@ public:
5858 return *this;
5959 }
6060#endif // _LIBCPP_CXX03_LANG
61 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { return *this; }
61 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() {
62 return *this;
63 }
6264 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; }
6365 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; }
6466
lib/libcxx/include/__iterator/bounded_iter.h+7-9
......@@ -53,9 +53,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5353// optimizations deleting non-redundant bounds checks.
5454template <class _Iterator>
5555struct __bounded_iter {
56 static_assert(__libcpp_is_contiguous_iterator<_Iterator>::value,
57 "Only contiguous iterators can be adapted by __bounded_iter.");
58
5956 using value_type = typename iterator_traits<_Iterator>::value_type;
6057 using difference_type = typename iterator_traits<_Iterator>::difference_type;
6158 using pointer = typename iterator_traits<_Iterator>::pointer;
......@@ -117,7 +114,7 @@ public:
117114 // that the iterator is always within `[begin, end]`, we only need to check it's not pointing to
118115 // `end`. This is easier for the optimizer because it aligns with the `iter != container.end()`
119116 // checks that typical callers already use (see https://llvm.org/PR78829).
120 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
117 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
121118 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
122119 __current_ != __end_, "__bounded_iter::operator*: Attempt to dereference an iterator at the end");
123120 return *__current_;
......@@ -129,7 +126,8 @@ public:
129126 return std::__to_address(__current_);
130127 }
131128
132 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT {
129 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference
130 operator[](difference_type __n) const _NOEXCEPT {
133131 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
134132 __n >= __begin_ - __current_, "__bounded_iter::operator[]: Attempt to index an iterator past the start");
135133 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
......@@ -172,13 +170,13 @@ public:
172170 __current_ += __n;
173171 return *this;
174172 }
175 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
173 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
176174 operator+(__bounded_iter const& __self, difference_type __n) _NOEXCEPT {
177175 __bounded_iter __tmp(__self);
178176 __tmp += __n;
179177 return __tmp;
180178 }
181 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
179 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
182180 operator+(difference_type __n, __bounded_iter const& __self) _NOEXCEPT {
183181 __bounded_iter __tmp(__self);
184182 __tmp += __n;
......@@ -193,13 +191,13 @@ public:
193191 __current_ -= __n;
194192 return *this;
195193 }
196 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
194 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __bounded_iter
197195 operator-(__bounded_iter const& __self, difference_type __n) _NOEXCEPT {
198196 __bounded_iter __tmp(__self);
199197 __tmp -= __n;
200198 return __tmp;
201199 }
202 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type
200 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type
203201 operator-(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT {
204202 return __x.__current_ - __y.__current_;
205203 }
lib/libcxx/include/__iterator/capacity_aware_iterator.h created+186
......@@ -0,0 +1,186 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CAPACITY_AWARE_ITERATOR_H
11#define _LIBCPP___CAPACITY_AWARE_ITERATOR_H
12
13#include <__assert>
14#include <__compare/ordering.h>
15#include <__compare/three_way_comparable.h>
16#include <__config>
17#include <__cstddef/size_t.h>
18#include <__iterator/concepts.h>
19#include <__iterator/incrementable_traits.h>
20#include <__iterator/iterator_traits.h>
21#include <__memory/pointer_traits.h>
22#include <__type_traits/is_constructible.h>
23#include <__type_traits/is_convertible.h>
24#include <__utility/move.h>
25
26#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27# pragma GCC system_header
28#endif
29
30_LIBCPP_PUSH_MACROS
31#include <__undef_macros>
32
33#if _LIBCPP_STD_VER >= 26
34
35_LIBCPP_BEGIN_NAMESPACE_STD
36
37// __capacity_aware_iterator is an iterator that wraps a contiguous iterator and encodes the maximum number of
38// elements that can appear in a range of such iterators. That maximum number of elements must be known at compile-time.
39// As of writing, the only standard library containers which fulfill these requirements are inplace_vector and optional.
40//
41// It also embeds a tag type to prevent mixing iterators from e.g. different containers. This also allows for some
42// algorithms to detect this iterator and perform optimizations based on the added semantic information.
43
44template <class _Iter, class _Tag, size_t _RangeMaxElements>
45class __capacity_aware_iterator {
46private:
47 _Iter __iter_;
48
49 template <class, class, size_t>
50 friend class __capacity_aware_iterator;
51
52public:
53 static_assert(contiguous_iterator<_Iter>, "__capacity_aware_iterator can only be used with contiguous iterators");
54
55 using iterator_category = iterator_traits<_Iter>::iterator_category;
56 using iterator_concept = contiguous_iterator_tag;
57 using difference_type = iter_difference_t<_Iter>;
58 using pointer = iterator_traits<_Iter>::pointer;
59 using reference = iter_reference_t<_Iter>;
60 using value_type = iter_value_t<_Iter>;
61
62 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator()
63 requires is_default_constructible_v<_Iter>
64 = default;
65
66 template <typename _Iter2>
67 requires is_convertible_v<_Iter2, _Iter>
68 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator(
69 const __capacity_aware_iterator<_Iter2, _Tag, _RangeMaxElements>& __y) noexcept
70 : __iter_(__y.__iter_) {}
71
72 template <class _It, class _Tag2, size_t _RangeMaxElems2>
73 _LIBCPP_HIDE_FROM_ABI friend constexpr auto __make_capacity_aware_iterator(_It __iter) noexcept;
74
75private:
76 _LIBCPP_HIDE_FROM_ABI constexpr explicit __capacity_aware_iterator(_Iter __iter) : __iter_(std::move(__iter)) {}
77
78public:
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const noexcept { return *__iter_; }
80 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator->() const noexcept { return std::__to_address(__iter_); }
81
82 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator++() noexcept {
83 ++__iter_;
84 return *this;
85 }
86
87 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator operator++(int) noexcept {
88 __capacity_aware_iterator __tmp(*this);
89 ++*this;
90 return __tmp;
91 }
92
93 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator--() noexcept {
94 --__iter_;
95 return *this;
96 }
97
98 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator operator--(int) noexcept {
99 __capacity_aware_iterator __tmp(*this);
100 --*this;
101 return __tmp;
102 }
103
104 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator+=(difference_type __n) noexcept {
105 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
106 static_cast<size_t>(__n >= 0 ? __n : -__n) <= _RangeMaxElements,
107 "__capacity_aware_iterator::operator+=: Attempting to move iterator past its container's possible range");
108
109 __iter_ += __n;
110 return *this;
111 }
112
113 _LIBCPP_HIDE_FROM_ABI constexpr __capacity_aware_iterator& operator-=(difference_type __n) noexcept {
114 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
115 static_cast<size_t>(__n >= 0 ? __n : -__n) <= _RangeMaxElements,
116 "__capacity_aware_iterator::operator-=: Attempting to move iterator past its container's possible range");
117
118 __iter_ -= __n;
119 return *this;
120 }
121
122 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const noexcept {
123 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
124 static_cast<size_t>(__n >= 0 ? __n : -__n) < _RangeMaxElements,
125 "__capacity_aware_iterator::operator[]: Attempting to index iterator past its container's possible range");
126 return *(*this + __n);
127 }
128
129 _LIBCPP_HIDE_FROM_ABI friend constexpr bool
130 operator==(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept {
131 return __x.__iter_ == __y.__iter_;
132 }
133
134 _LIBCPP_HIDE_FROM_ABI friend constexpr auto
135 operator<=>(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept {
136 if constexpr (three_way_comparable_with<_Iter, _Iter, strong_ordering>) {
137 return __x.__iter_ <=> __y.__iter_;
138 } else {
139 if (__x.__iter_ < __y.__iter_) {
140 return strong_ordering::less;
141 } else if (__x.__iter_ == __y.__iter_) {
142 return strong_ordering::equal;
143 }
144 return strong_ordering::greater;
145 }
146 }
147
148 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator
149 operator+(const __capacity_aware_iterator& __i, difference_type __n) noexcept {
150 auto __tmp = __i;
151 __tmp += __n;
152 return __tmp;
153 }
154
155 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator
156 operator+(difference_type __n, const __capacity_aware_iterator& __i) noexcept {
157 auto __tmp = __i;
158 __tmp += __n;
159 return __tmp;
160 }
161
162 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __capacity_aware_iterator
163 operator-(const __capacity_aware_iterator& __i, difference_type __n) noexcept {
164 auto __tmp = __i;
165 __tmp -= __n;
166 return __tmp;
167 }
168
169 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
170 operator-(const __capacity_aware_iterator& __x, const __capacity_aware_iterator& __y) noexcept {
171 return difference_type(__x.__iter_ - __y.__iter_);
172 }
173};
174
175template <class _It, class _Tag2, size_t _RangeMaxElems2>
176_LIBCPP_HIDE_FROM_ABI constexpr auto __make_capacity_aware_iterator(_It __iter) noexcept {
177 return __capacity_aware_iterator<_It, _Tag2, _RangeMaxElems2>(__iter);
178}
179
180_LIBCPP_END_NAMESPACE_STD
181
182#endif // _LIBCPP_STD_VER >= 26
183
184_LIBCPP_POP_MACROS
185
186#endif // _LIBCPP___CAPACITY_AWARE_ITERATOR_H
lib/libcxx/include/__iterator/common_iterator.h+3-3
......@@ -17,6 +17,7 @@
1717#include <__concepts/copyable.h>
1818#include <__concepts/derived_from.h>
1919#include <__concepts/equality_comparable.h>
20#include <__concepts/referenceable.h>
2021#include <__concepts/same_as.h>
2122#include <__config>
2223#include <__iterator/concepts.h>
......@@ -28,7 +29,6 @@
2829#include <__memory/addressof.h>
2930#include <__type_traits/conditional.h>
3031#include <__type_traits/is_pointer.h>
31#include <__type_traits/is_referenceable.h>
3232#include <__utility/declval.h>
3333#include <variant>
3434
......@@ -111,7 +111,7 @@ public:
111111 return *this;
112112 }
113113
114 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
115115 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
116116 std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator");
117117 return *std::__unchecked_get<_Iter>(__hold_);
......@@ -237,7 +237,7 @@ public:
237237 return std::__unchecked_get<_Sent>(__x.__hold_) - std::__unchecked_get<_I2>(__y.__hold_);
238238 }
239239
240 _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
240 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
241241 iter_move(const common_iterator& __i) noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
242242 requires input_iterator<_Iter>
243243 {
lib/libcxx/include/__iterator/concepts.h+8-9
......@@ -20,6 +20,8 @@
2020#include <__concepts/invocable.h>
2121#include <__concepts/movable.h>
2222#include <__concepts/predicate.h>
23#include <__concepts/primary_template.h>
24#include <__concepts/referenceable.h>
2325#include <__concepts/regular.h>
2426#include <__concepts/relation.h>
2527#include <__concepts/same_as.h>
......@@ -38,10 +40,7 @@
3840#include <__type_traits/integral_constant.h>
3941#include <__type_traits/invoke.h>
4042#include <__type_traits/is_pointer.h>
41#include <__type_traits/is_primary_template.h>
4243#include <__type_traits/is_reference.h>
43#include <__type_traits/is_referenceable.h>
44#include <__type_traits/is_valid_expansion.h>
4544#include <__type_traits/remove_cv.h>
4645#include <__type_traits/remove_cvref.h>
4746#include <__utility/forward.h>
......@@ -80,7 +79,7 @@ template <class _Tp>
8079concept __specialization_of_projected = requires {
8180 typename __projected_iterator_t<_Tp>;
8281 typename __projected_projection_t<_Tp>;
83} && __is_primary_template<_Tp>::value;
82} && __primary_template<_Tp>;
8483
8584template <class _Tp>
8685struct __indirect_value_t_impl {
......@@ -153,8 +152,7 @@ concept sized_sentinel_for =
153152
154153template <class _Iter>
155154struct __iter_traits_cache {
156 using type _LIBCPP_NODEBUG =
157 _If<__is_primary_template<iterator_traits<_Iter> >::value, _Iter, iterator_traits<_Iter> >;
155 using type _LIBCPP_NODEBUG = _If<__primary_template<iterator_traits<_Iter> >, _Iter, iterator_traits<_Iter> >;
158156};
159157template <class _Iter>
160158using _ITER_TRAITS _LIBCPP_NODEBUG = typename __iter_traits_cache<_Iter>::type;
......@@ -169,12 +167,13 @@ struct __iter_concept_category_test {
169167};
170168struct __iter_concept_random_fallback {
171169 template <class _Iter>
172 using _Apply _LIBCPP_NODEBUG =
173 __enable_if_t<__is_primary_template<iterator_traits<_Iter> >::value, random_access_iterator_tag>;
170 using _Apply _LIBCPP_NODEBUG = __enable_if_t<__primary_template<iterator_traits<_Iter> >, random_access_iterator_tag>;
174171};
175172
176173template <class _Iter, class _Tester>
177struct __test_iter_concept : _IsValidExpansion<_Tester::template _Apply, _Iter>, _Tester {};
174 struct __test_iter_concept : bool_constant < requires {
175 typename _Tester::template _Apply<_Iter>;
176} >, _Tester{};
178177
179178template <class _Iter>
180179struct __iter_concept_cache {
lib/libcxx/include/__iterator/counted_iterator.h+13-13
......@@ -98,18 +98,18 @@ public:
9898 return *this;
9999 }
100100
101 _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
101 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
102102
103 _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
104104
105 _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
105 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> count() const noexcept { return __count_; }
106106
107 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
107 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() {
108108 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
109109 return *__current_;
110110 }
111111
112 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
112 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
113113 requires __dereferenceable<const _Iter>
114114 {
115115 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__count_ > 0, "Iterator is equal to or past end.");
......@@ -169,13 +169,13 @@ public:
169169 return __tmp;
170170 }
171171
172 _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
172 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator+(iter_difference_t<_Iter> __n) const
173173 requires random_access_iterator<_Iter>
174174 {
175175 return counted_iterator(__current_ + __n, __count_ - __n);
176176 }
177177
178 _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator
178 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr counted_iterator
179179 operator+(iter_difference_t<_Iter> __n, const counted_iterator& __x)
180180 requires random_access_iterator<_Iter>
181181 {
......@@ -191,24 +191,24 @@ public:
191191 return *this;
192192 }
193193
194 _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
194 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator-(iter_difference_t<_Iter> __n) const
195195 requires random_access_iterator<_Iter>
196196 {
197197 return counted_iterator(__current_ - __n, __count_ + __n);
198198 }
199199
200200 template <common_with<_Iter> _I2>
201 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
201 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2>
202202 operator-(const counted_iterator& __lhs, const counted_iterator<_I2>& __rhs) {
203203 return __rhs.__count_ - __lhs.__count_;
204204 }
205205
206 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
206 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
207207 operator-(const counted_iterator& __lhs, default_sentinel_t) {
208208 return -__lhs.__count_;
209209 }
210210
211 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
211 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_Iter>
212212 operator-(default_sentinel_t, const counted_iterator& __rhs) {
213213 return __rhs.__count_;
214214 }
......@@ -226,7 +226,7 @@ public:
226226 return *this;
227227 }
228228
229 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
229 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const
230230 requires random_access_iterator<_Iter>
231231 {
232232 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < __count_, "Subscript argument must be less than size.");
......@@ -249,7 +249,7 @@ public:
249249 return __rhs.__count_ <=> __lhs.__count_;
250250 }
251251
252 _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
252 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
253253 iter_move(const counted_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_)))
254254 requires input_iterator<_Iter>
255255 {
lib/libcxx/include/__iterator/data.h+10-8
......@@ -17,32 +17,34 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 17
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Cont>
25constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
25[[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data()))
26 -> decltype(__c.data()) {
2627 return __c.data();
2728}
2829
2930template <class _Cont>
30constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
31[[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data()))
32 -> decltype(__c.data()) {
3133 return __c.data();
3234}
3335
3436template <class _Tp, size_t _Sz>
35_LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept {
37[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept {
3638 return __array;
3739}
3840
3941template <class _Ep>
40_LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept {
42[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept {
4143 return __il.begin();
4244}
4345
44#endif
45
4646_LIBCPP_END_NAMESPACE_STD
4747
48#endif // _LIBCPP_STD_VER >= 17
49
4850#endif // _LIBCPP___ITERATOR_DATA_H
lib/libcxx/include/__iterator/default_sentinel.h+4-4
......@@ -16,15 +16,15 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 20
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323struct default_sentinel_t {};
2424inline constexpr default_sentinel_t default_sentinel{};
2525
26#endif // _LIBCPP_STD_VER >= 20
27
2826_LIBCPP_END_NAMESPACE_STD
2927
28#endif // _LIBCPP_STD_VER >= 20
29
3030#endif // _LIBCPP___ITERATOR_DEFAULT_SENTINEL_H
lib/libcxx/include/__iterator/distance.h+5-4
......@@ -67,7 +67,8 @@ __distance(_InputIter __first, _Sent __last) {
6767}
6868
6969template <class _InputIter>
70inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 typename iterator_traits<_InputIter>::difference_type
70[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
71typename iterator_traits<_InputIter>::difference_type
7172distance(_InputIter __first, _InputIter __last) {
7273 return std::__distance(__first, __last);
7374}
......@@ -80,12 +81,12 @@ namespace ranges {
8081struct __distance {
8182 template <class _Ip, sentinel_for<_Ip> _Sp>
8283 requires(!sized_sentinel_for<_Sp, _Ip>)
83 _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const {
8485 return std::__distance(std::move(__first), std::move(__last));
8586 }
8687
8788 template <class _Ip, sized_sentinel_for<decay_t<_Ip>> _Sp>
88 _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
89 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const {
8990 if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) {
9091 return __last - __first;
9192 } else {
......@@ -94,7 +95,7 @@ struct __distance {
9495 }
9596
9697 template <range _Rp>
97 _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
98 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const {
9899 if constexpr (sized_range<_Rp>) {
99100 return static_cast<range_difference_t<_Rp>>(ranges::size(__r));
100101 } else {
lib/libcxx/include/__iterator/empty.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 17
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Cont>
2525[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
2626empty(const _Cont& __c) noexcept(noexcept(__c.empty())) -> decltype(__c.empty()) {
......@@ -37,8 +37,8 @@ template <class _Ep>
3737 return __il.size() == 0;
3838}
3939
40#endif // _LIBCPP_STD_VER >= 17
41
4240_LIBCPP_END_NAMESPACE_STD
4341
42#endif // _LIBCPP_STD_VER >= 17
43
4444#endif // _LIBCPP___ITERATOR_EMPTY_H
lib/libcxx/include/__iterator/erase_if_container.h+2-1
......@@ -22,7 +22,8 @@ _LIBCPP_PUSH_MACROS
2222_LIBCPP_BEGIN_NAMESPACE_STD
2323
2424template <class _Container, class _Predicate>
25_LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
25_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _Container::size_type
26__libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
2627 typename _Container::size_type __old_size = __c.size();
2728
2829 const typename _Container::iterator __last = __c.end();
lib/libcxx/include/__iterator/front_insert_iterator.h+4-2
......@@ -58,14 +58,16 @@ public:
5858 return *this;
5959 }
6060#endif // _LIBCPP_CXX03_LANG
61 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { return *this; }
61 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() {
62 return *this;
63 }
6264 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; }
6365 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; }
6466};
6567_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(front_insert_iterator);
6668
6769template <class _Container>
68inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container>
70[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator<_Container>
6971front_inserter(_Container& __x) {
7072 return front_insert_iterator<_Container>(__x);
7173}
lib/libcxx/include/__iterator/incrementable_traits.h+6-6
......@@ -11,11 +11,11 @@
1111#define _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H
1212
1313#include <__concepts/arithmetic.h>
14#include <__concepts/primary_template.h>
1415#include <__config>
1516#include <__cstddef/ptrdiff_t.h>
1617#include <__type_traits/conditional.h>
1718#include <__type_traits/is_object.h>
18#include <__type_traits/is_primary_template.h>
1919#include <__type_traits/make_signed.h>
2020#include <__type_traits/remove_cvref.h>
2121#include <__utility/declval.h>
......@@ -24,10 +24,10 @@
2424# pragma GCC system_header
2525#endif
2626
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2927#if _LIBCPP_STD_VER >= 20
3028
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3131// [incrementable.traits]
3232template <class>
3333struct incrementable_traits {};
......@@ -68,12 +68,12 @@ struct iterator_traits;
6868// generated from the primary template, and `iterator_traits<RI>::difference_type` otherwise.
6969template <class _Ip>
7070using iter_difference_t =
71 typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
71 typename conditional_t<__primary_template<iterator_traits<remove_cvref_t<_Ip> > >,
7272 incrementable_traits<remove_cvref_t<_Ip> >,
7373 iterator_traits<remove_cvref_t<_Ip> > >::difference_type;
7474
75#endif // _LIBCPP_STD_VER >= 20
76
7775_LIBCPP_END_NAMESPACE_STD
7876
77#endif // _LIBCPP_STD_VER >= 20
78
7979#endif // _LIBCPP___ITERATOR_INCREMENTABLE_TRAITS_H
lib/libcxx/include/__iterator/insert_iterator.h+2-2
......@@ -71,13 +71,13 @@ public:
7171 return *this;
7272 }
7373#endif // _LIBCPP_CXX03_LANG
74 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; }
74 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; }
7575 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; }
7676 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; }
7777};
7878
7979template <class _Container>
80inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container>
80[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator<_Container>
8181inserter(_Container& __x, __insert_iterator_iter_t<_Container> __i) {
8282 return insert_iterator<_Container>(__x, __i);
8383}
lib/libcxx/include/__iterator/istream_iterator.h+1-1
......@@ -60,7 +60,7 @@ public:
6060 // LWG3600 Changed the wording of the copy constructor. In libc++ this constructor
6161 // can still be trivial after this change.
6262
63 _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; }
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Tp& operator*() const { return __value_; }
6464 _LIBCPP_HIDE_FROM_ABI const _Tp* operator->() const { return std::addressof((operator*())); }
6565 _LIBCPP_HIDE_FROM_ABI istream_iterator& operator++() {
6666 if (!(*__in_stream_ >> __value_))
lib/libcxx/include/__iterator/istreambuf_iterator.h+4-2
......@@ -73,14 +73,16 @@ public:
7373 _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
7474 _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {}
7575
76 _LIBCPP_HIDE_FROM_ABI char_type operator*() const { return static_cast<char_type>(__sbuf_->sgetc()); }
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type operator*() const {
77 return static_cast<char_type>(__sbuf_->sgetc());
78 }
7779 _LIBCPP_HIDE_FROM_ABI istreambuf_iterator& operator++() {
7880 __sbuf_->sbumpc();
7981 return *this;
8082 }
8183 _LIBCPP_HIDE_FROM_ABI __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); }
8284
83 _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const {
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const {
8486 return __test_for_eof() == __b.__test_for_eof();
8587 }
8688
lib/libcxx/include/__iterator/iter_move.h+5-5
......@@ -11,10 +11,10 @@
1111#define _LIBCPP___ITERATOR_ITER_MOVE_H
1212
1313#include <__concepts/class_or_enum.h>
14#include <__concepts/referenceable.h>
1415#include <__config>
1516#include <__iterator/iterator_traits.h>
1617#include <__type_traits/is_reference.h>
17#include <__type_traits/is_referenceable.h>
1818#include <__type_traits/remove_cvref.h>
1919#include <__utility/declval.h>
2020#include <__utility/forward.h>
......@@ -27,10 +27,10 @@
2727_LIBCPP_PUSH_MACROS
2828#include <__undef_macros>
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230#if _LIBCPP_STD_VER >= 20
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3434// [iterator.cust.move]
3535
3636namespace ranges {
......@@ -95,10 +95,10 @@ template <__dereferenceable _Tp>
9595 }
9696using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>()));
9797
98#endif // _LIBCPP_STD_VER >= 20
99
10098_LIBCPP_END_NAMESPACE_STD
10199
100#endif // _LIBCPP_STD_VER >= 20
101
102102_LIBCPP_POP_MACROS
103103
104104#endif // _LIBCPP___ITERATOR_ITER_MOVE_H
lib/libcxx/include/__iterator/iter_swap.h+4-4
......@@ -29,10 +29,10 @@
2929_LIBCPP_PUSH_MACROS
3030#include <__undef_macros>
3131
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3432#if _LIBCPP_STD_VER >= 20
3533
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3636// [iter.cust.swap]
3737
3838namespace ranges {
......@@ -99,10 +99,10 @@ concept indirectly_swappable =
9999 ranges::iter_swap(__i2, __i1);
100100 };
101101
102#endif // _LIBCPP_STD_VER >= 20
103
104102_LIBCPP_END_NAMESPACE_STD
105103
104#endif // _LIBCPP_STD_VER >= 20
105
106106_LIBCPP_POP_MACROS
107107
108108#endif // _LIBCPP___ITERATOR_ITER_SWAP_H
lib/libcxx/include/__iterator/iterator_traits.h+3-3
......@@ -15,6 +15,8 @@
1515#include <__concepts/convertible_to.h>
1616#include <__concepts/copyable.h>
1717#include <__concepts/equality_comparable.h>
18#include <__concepts/primary_template.h>
19#include <__concepts/referenceable.h>
1820#include <__concepts/same_as.h>
1921#include <__concepts/totally_ordered.h>
2022#include <__config>
......@@ -30,9 +32,7 @@
3032#include <__type_traits/integral_constant.h>
3133#include <__type_traits/is_convertible.h>
3234#include <__type_traits/is_object.h>
33#include <__type_traits/is_primary_template.h>
3435#include <__type_traits/is_reference.h>
35#include <__type_traits/is_referenceable.h>
3636#include <__type_traits/nat.h>
3737#include <__type_traits/remove_const.h>
3838#include <__type_traits/remove_cv.h>
......@@ -468,7 +468,7 @@ using __iterator_reference _LIBCPP_NODEBUG = typename iterator_traits<_Iter>::re
468468// This has to be in this file and not readable_traits.h to break the include cycle between the two.
469469template <class _Ip>
470470using iter_value_t =
471 typename conditional_t<__is_primary_template<iterator_traits<remove_cvref_t<_Ip> > >::value,
471 typename conditional_t<__primary_template<iterator_traits<remove_cvref_t<_Ip> > >,
472472 indirectly_readable_traits<remove_cvref_t<_Ip> >,
473473 iterator_traits<remove_cvref_t<_Ip> > >::value_type;
474474
lib/libcxx/include/__iterator/move_iterator.h+25-20
......@@ -13,6 +13,7 @@
1313#include <__compare/compare_three_way_result.h>
1414#include <__compare/three_way_comparable.h>
1515#include <__concepts/assignable.h>
16#include <__concepts/constructible.h>
1617#include <__concepts/convertible_to.h>
1718#include <__concepts/derived_from.h>
1819#include <__concepts/same_as.h>
......@@ -27,7 +28,6 @@
2728#include <__type_traits/conditional.h>
2829#include <__type_traits/enable_if.h>
2930#include <__type_traits/is_assignable.h>
30#include <__type_traits/is_constructible.h>
3131#include <__type_traits/is_convertible.h>
3232#include <__type_traits/is_reference.h>
3333#include <__type_traits/is_same.h>
......@@ -122,7 +122,7 @@ public:
122122
123123#if _LIBCPP_STD_VER >= 20
124124 _LIBCPP_HIDE_FROM_ABI constexpr move_iterator()
125 requires is_constructible_v<_Iter>
125 requires default_initializable<_Iter>
126126 : __current_() {}
127127
128128 template <class _Up>
......@@ -136,11 +136,11 @@ public:
136136 return *this;
137137 }
138138
139 _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
140 _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
139 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; }
140 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); }
141141
142 _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); }
143 _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
142 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); }
143 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const {
144144 return ranges::iter_move(__current_ + __n);
145145 }
146146
......@@ -169,12 +169,13 @@ public:
169169 return *this;
170170 }
171171
172 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; }
172 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return __current_; }
173173
174 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
174 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
175175 return static_cast<reference>(*__current_);
176176 }
177 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
177 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference
178 operator[](difference_type __n) const {
178179 return static_cast<reference>(__current_[__n]);
179180 }
180181
......@@ -194,14 +195,16 @@ public:
194195 --__current_;
195196 return __tmp;
196197 }
197 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator+(difference_type __n) const {
198 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator
199 operator+(difference_type __n) const {
198200 return move_iterator(__current_ + __n);
199201 }
200202 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator+=(difference_type __n) {
201203 __current_ += __n;
202204 return *this;
203205 }
204 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator-(difference_type __n) const {
206 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator
207 operator-(difference_type __n) const {
205208 return move_iterator(__current_ - __n);
206209 }
207210 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) {
......@@ -218,18 +221,18 @@ public:
218221 }
219222
220223 template <sized_sentinel_for<_Iter> _Sent>
221 friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
224 [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
222225 operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) {
223226 return __x.base() - __y.base();
224227 }
225228
226229 template <sized_sentinel_for<_Iter> _Sent>
227 friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
230 [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter>
228231 operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) {
229232 return __x.base() - __y.base();
230233 }
231234
232 friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter>
235 [[nodiscard]] friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter>
233236 iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) {
234237 return ranges::iter_move(__i.__current_);
235238 }
......@@ -299,13 +302,14 @@ operator<=>(const move_iterator<_Iter1>& __x,
299302
300303#ifndef _LIBCPP_CXX03_LANG
301304template <class _Iter1, class _Iter2>
302inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
303operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) {
305[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
306_LIBCPP_CONSTEXPR_SINCE_CXX17 auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
307 -> decltype(__x.base() - __y.base()) {
304308 return __x.base() - __y.base();
305309}
306310#else
307311template <class _Iter1, class _Iter2>
308inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type
312[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type
309313operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
310314 return __x.base() - __y.base();
311315}
......@@ -313,7 +317,7 @@ operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
313317
314318#if _LIBCPP_STD_VER >= 20
315319template <class _Iter>
316inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter>
320[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter>
317321operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
318322 requires requires {
319323 { __x.base() + __n } -> same_as<_Iter>;
......@@ -323,7 +327,7 @@ operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x)
323327}
324328#else
325329template <class _Iter>
326inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter>
330[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter>
327331operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) {
328332 return move_iterator<_Iter>(__x.base() + __n);
329333}
......@@ -336,7 +340,8 @@ inline constexpr bool disable_sized_sentinel_for<move_iterator<_Iter1>, move_ite
336340#endif // _LIBCPP_STD_VER >= 20
337341
338342template <class _Iter>
339inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) {
343[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
344_LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) {
340345 return move_iterator<_Iter>(std::move(__i));
341346}
342347
lib/libcxx/include/__iterator/move_sentinel.h+5-5
......@@ -22,10 +22,10 @@
2222_LIBCPP_PUSH_MACROS
2323#include <__undef_macros>
2424
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2725#if _LIBCPP_STD_VER >= 20
2826
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2929template <semiregular _Sent>
3030class move_sentinel {
3131public:
......@@ -44,7 +44,7 @@ public:
4444 return *this;
4545 }
4646
47 _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
4848
4949private:
5050 _Sent __last_ = _Sent();
......@@ -52,10 +52,10 @@ private:
5252
5353_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);
5454
55#endif // _LIBCPP_STD_VER >= 20
56
5755_LIBCPP_END_NAMESPACE_STD
5856
57#endif // _LIBCPP_STD_VER >= 20
58
5959_LIBCPP_POP_MACROS
6060
6161#endif // _LIBCPP___ITERATOR_MOVE_SENTINEL_H
lib/libcxx/include/__iterator/ostream_iterator.h+1-1
......@@ -59,7 +59,7 @@ public:
5959 return *this;
6060 }
6161
62 _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; }
62 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator*() { return *this; }
6363 _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++() { return *this; }
6464 _LIBCPP_HIDE_FROM_ABI ostream_iterator& operator++(int) { return *this; }
6565};
lib/libcxx/include/__iterator/ostreambuf_iterator.h+25-2
......@@ -10,6 +10,8 @@
1010#ifndef _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H
1111#define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H
1212
13#include <__algorithm/in_out_result.h>
14#include <__algorithm/specialized_algorithms.h>
1315#include <__config>
1416#include <__cstddef/ptrdiff_t.h>
1517#include <__fwd/ios.h>
......@@ -17,6 +19,7 @@
1719#include <__fwd/streambuf.h>
1820#include <__iterator/iterator.h>
1921#include <__iterator/iterator_traits.h>
22#include <__type_traits/is_same.h>
2023#include <iosfwd> // for forward declaration of ostreambuf_iterator
2124
2225#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -54,16 +57,36 @@ public:
5457 __sbuf_ = nullptr;
5558 return *this;
5659 }
57 _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; }
60 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; }
5861 _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; }
5962 _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; }
60 _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
6164
6265#if _LIBCPP_HAS_LOCALIZATION
6366 template <class _Ch, class _Tr>
6467 friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output(
6568 ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl);
6669#endif // _LIBCPP_HAS_LOCALIZATION
70
71 template <class, class...>
72 friend struct __specialized_algorithm;
73};
74
75template <class _InCharT, class _CharT, class _Traits>
76struct __specialized_algorithm<_Algorithm::__copy,
77 __iterator_pair<_InCharT*, _InCharT*>,
78 __single_iterator<ostreambuf_iterator<_CharT, _Traits> > > {
79 static const bool __has_algorithm = is_same<const _CharT, const _InCharT>::value;
80
81 _LIBCPP_HIDE_FROM_ABI static __in_out_result<_InCharT*, ostreambuf_iterator<_CharT, _Traits> >
82 operator()(_InCharT* __first, _InCharT* __last, ostreambuf_iterator<_CharT, _Traits> __result) {
83 auto __size = __last - __first;
84 if (__result.__sbuf_ && __size > 0) {
85 if (__result.__sbuf_->sputn(__first, __last - __first) != __size)
86 __result.__sbuf_ = nullptr;
87 }
88 return {__last, __result};
89 }
6790};
6891
6992_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__iterator/ranges_iterator_traits.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 23
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <ranges::input_range _Range>
2727using __range_key_type _LIBCPP_NODEBUG = __remove_const_t<typename ranges::range_value_t<_Range>::first_type>;
2828
......@@ -33,8 +33,8 @@ template <ranges::input_range _Range>
3333using __range_to_alloc_type _LIBCPP_NODEBUG =
3434 pair<const typename ranges::range_value_t<_Range>::first_type, typename ranges::range_value_t<_Range>::second_type>;
3535
36#endif
37
3836_LIBCPP_END_NAMESPACE_STD
3937
38#endif
39
4040#endif // _LIBCPP___ITERATOR_RANGES_ITERATOR_TRAITS_H
lib/libcxx/include/__iterator/readable_traits.h+5-5
......@@ -10,12 +10,12 @@
1010#ifndef _LIBCPP___ITERATOR_READABLE_TRAITS_H
1111#define _LIBCPP___ITERATOR_READABLE_TRAITS_H
1212
13#include <__concepts/primary_template.h>
1314#include <__concepts/same_as.h>
1415#include <__config>
1516#include <__type_traits/conditional.h>
1617#include <__type_traits/is_array.h>
1718#include <__type_traits/is_object.h>
18#include <__type_traits/is_primary_template.h>
1919#include <__type_traits/remove_cv.h>
2020#include <__type_traits/remove_cvref.h>
2121#include <__type_traits/remove_extent.h>
......@@ -24,10 +24,10 @@
2424# pragma GCC system_header
2525#endif
2626
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2927#if _LIBCPP_STD_VER >= 20
3028
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3131// [readable.traits]
3232template <class>
3333struct __cond_value_type {};
......@@ -74,8 +74,8 @@ template <__has_member_value_type _Tp>
7474 same_as<remove_cv_t<typename _Tp::element_type>, remove_cv_t<typename _Tp::value_type>>
7575struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {};
7676
77#endif // _LIBCPP_STD_VER >= 20
78
7977_LIBCPP_END_NAMESPACE_STD
8078
79#endif // _LIBCPP_STD_VER >= 20
80
8181#endif // _LIBCPP___ITERATOR_READABLE_TRAITS_H
lib/libcxx/include/__iterator/reverse_access.h+21-14
......@@ -18,62 +18,69 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 14
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525template <class _Tp, size_t _Np>
26_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {
26[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
27_LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) {
2728 return reverse_iterator<_Tp*>(__array + _Np);
2829}
2930
3031template <class _Tp, size_t _Np>
31_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {
32[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) {
3233 return reverse_iterator<_Tp*>(__array);
3334}
3435
3536template <class _Ep>
36_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) {
37[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*>
38rbegin(initializer_list<_Ep> __il) {
3739 return reverse_iterator<const _Ep*>(__il.end());
3840}
3941
4042template <class _Ep>
41_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) {
43[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<const _Ep*>
44rend(initializer_list<_Ep> __il) {
4245 return reverse_iterator<const _Ep*>(__il.begin());
4346}
4447
4548template <class _Cp>
46_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {
49[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) {
4750 return __c.rbegin();
4851}
4952
5053template <class _Cp>
51_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) {
54[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rbegin(const _Cp& __c)
55 -> decltype(__c.rbegin()) {
5256 return __c.rbegin();
5357}
5458
5559template <class _Cp>
56_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {
60[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(_Cp& __c) -> decltype(__c.rend()) {
5761 return __c.rend();
5862}
5963
6064template <class _Cp>
61_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c) -> decltype(__c.rend()) {
65[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto rend(const _Cp& __c)
66 -> decltype(__c.rend()) {
6267 return __c.rend();
6368}
6469
6570template <class _Cp>
66_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c) -> decltype(std::rbegin(__c)) {
71[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crbegin(const _Cp& __c)
72 -> decltype(std::rbegin(__c)) {
6773 return std::rbegin(__c);
6874}
6975
7076template <class _Cp>
71_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c) -> decltype(std::rend(__c)) {
77[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto crend(const _Cp& __c)
78 -> decltype(std::rend(__c)) {
7279 return std::rend(__c);
7380}
7481
75#endif // _LIBCPP_STD_VER >= 14
76
7782_LIBCPP_END_NAMESPACE_STD
7883
84#endif // _LIBCPP_STD_VER >= 14
85
7986#endif // _LIBCPP___ITERATOR_REVERSE_ACCESS_H
lib/libcxx/include/__iterator/reverse_iterator.h+16-30
......@@ -15,21 +15,13 @@
1515#include <__compare/three_way_comparable.h>
1616#include <__concepts/convertible_to.h>
1717#include <__config>
18#include <__iterator/advance.h>
1918#include <__iterator/concepts.h>
2019#include <__iterator/incrementable_traits.h>
2120#include <__iterator/iter_move.h>
2221#include <__iterator/iter_swap.h>
2322#include <__iterator/iterator.h>
2423#include <__iterator/iterator_traits.h>
25#include <__iterator/next.h>
26#include <__iterator/prev.h>
27#include <__iterator/readable_traits.h>
28#include <__iterator/segmented_iterator.h>
2924#include <__memory/addressof.h>
30#include <__ranges/access.h>
31#include <__ranges/concepts.h>
32#include <__ranges/subrange.h>
3325#include <__type_traits/conditional.h>
3426#include <__type_traits/enable_if.h>
3527#include <__type_traits/is_assignable.h>
......@@ -38,7 +30,6 @@
3830#include <__type_traits/is_pointer.h>
3931#include <__type_traits/is_same.h>
4032#include <__utility/declval.h>
41#include <__utility/move.h>
4233
4334#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4435# pragma GCC system_header
......@@ -121,8 +112,8 @@ public:
121112 return *this;
122113 }
123114#endif
124 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; }
125 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
115 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _Iter base() const { return current; }
116 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {
126117 _Iter __tmp = current;
127118 return *--__tmp;
128119 }
......@@ -161,25 +152,29 @@ public:
161152 ++current;
162153 return __tmp;
163154 }
164 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator+(difference_type __n) const {
155 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator
156 operator+(difference_type __n) const {
165157 return reverse_iterator(current - __n);
166158 }
167159 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator+=(difference_type __n) {
168160 current -= __n;
169161 return *this;
170162 }
171 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator operator-(difference_type __n) const {
163 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator
164 operator-(difference_type __n) const {
172165 return reverse_iterator(current + __n);
173166 }
174167 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator-=(difference_type __n) {
175168 current += __n;
176169 return *this;
177170 }
178 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {
171 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference
172 operator[](difference_type __n) const {
179173 return *(*this + __n);
180174 }
181175
182176#if _LIBCPP_STD_VER >= 20
177 [[nodiscard]]
183178 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept(
184179 is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
185180 auto __tmp = __i.base();
......@@ -280,21 +275,21 @@ operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>&
280275
281276#ifndef _LIBCPP_CXX03_LANG
282277template <class _Iter1, class _Iter2>
283inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
284operator-(const reverse_iterator<_Iter1>& __x,
285 const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) {
278[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
279_LIBCPP_CONSTEXPR_SINCE_CXX17 auto operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
280 -> decltype(__y.base() - __x.base()) {
286281 return __y.base() - __x.base();
287282}
288283#else
289284template <class _Iter1, class _Iter2>
290inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type
285[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type
291286operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) {
292287 return __y.base() - __x.base();
293288}
294289#endif
295290
296291template <class _Iter>
297inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter>
292[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter>
298293operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) {
299294 return reverse_iterator<_Iter>(__x.base() - __n);
300295}
......@@ -307,21 +302,12 @@ inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, rever
307302
308303#if _LIBCPP_STD_VER >= 14
309304template <class _Iter>
310inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) {
305[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
306_LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) {
311307 return reverse_iterator<_Iter>(__i);
312308}
313309#endif
314310
315#if _LIBCPP_STD_VER >= 20
316template <ranges::bidirectional_range _Range>
317_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>,
318 reverse_iterator<ranges::iterator_t<_Range>>>
319__reverse_range(_Range&& __range) {
320 auto __first = ranges::begin(__range);
321 return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)};
322}
323#endif
324
325311template <class _Iter, bool __b>
326312struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b> {
327313 using _UnwrappedIter _LIBCPP_NODEBUG = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
lib/libcxx/include/__iterator/segmented_iterator.h-2
......@@ -42,8 +42,6 @@
4242
4343#include <__config>
4444#include <__cstddef/size_t.h>
45#include <__iterator/iterator_traits.h>
46#include <__type_traits/integral_constant.h>
4745
4846#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4947# pragma GCC system_header
lib/libcxx/include/__iterator/size.h+10-9
......@@ -20,25 +20,26 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 17
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727template <class _Cont>
28[[nodiscard]]
2829_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) noexcept(noexcept(__c.size())) -> decltype(__c.size()) {
2930 return __c.size();
3031}
3132
3233template <class _Tp, size_t _Sz>
33_LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
34[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
3435 return _Sz;
3536}
3637
3738# if _LIBCPP_STD_VER >= 20
3839template <class _Cont>
39_LIBCPP_HIDE_FROM_ABI constexpr auto
40ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(
41 __c.size()))) -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
40[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto ssize(const _Cont& __c) noexcept(
41 noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
42 -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
4243 return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size());
4344}
4445
......@@ -47,14 +48,14 @@ ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, m
4748_LIBCPP_DIAGNOSTIC_PUSH
4849_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wsign-conversion")
4950template <class _Tp, ptrdiff_t _Sz>
50_LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept {
51[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t ssize(const _Tp (&)[_Sz]) noexcept {
5152 return _Sz;
5253}
5354_LIBCPP_DIAGNOSTIC_POP
5455# endif
5556
56#endif // _LIBCPP_STD_VER >= 17
57
5857_LIBCPP_END_NAMESPACE_STD
5958
59#endif // _LIBCPP_STD_VER >= 17
60
6061#endif // _LIBCPP___ITERATOR_SIZE_H
lib/libcxx/include/__iterator/static_bounded_iter.h+7-6
......@@ -128,7 +128,7 @@ private:
128128
129129public:
130130 // Dereference and indexing operations.
131 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
131 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
132132 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
133133 __current() != __end(), "__static_bounded_iter::operator*: Attempt to dereference an iterator at the end");
134134 return *__current();
......@@ -140,7 +140,8 @@ public:
140140 return std::__to_address(__current());
141141 }
142142
143 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT {
143 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference
144 operator[](difference_type __n) const _NOEXCEPT {
144145 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
145146 __n >= __begin() - __current(),
146147 "__static_bounded_iter::operator[]: Attempt to index an iterator past the start");
......@@ -186,13 +187,13 @@ public:
186187 __current() += __n;
187188 return *this;
188189 }
189 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
190 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
190191 operator+(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT {
191192 __static_bounded_iter __tmp(__self);
192193 __tmp += __n;
193194 return __tmp;
194195 }
195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
196 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
196197 operator+(difference_type __n, __static_bounded_iter const& __self) _NOEXCEPT {
197198 __static_bounded_iter __tmp(__self);
198199 __tmp += __n;
......@@ -208,13 +209,13 @@ public:
208209 __current() -= __n;
209210 return *this;
210211 }
211 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
212 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend __static_bounded_iter
212213 operator-(__static_bounded_iter const& __self, difference_type __n) _NOEXCEPT {
213214 __static_bounded_iter __tmp(__self);
214215 __tmp -= __n;
215216 return __tmp;
216217 }
217 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type
218 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 friend difference_type
218219 operator-(__static_bounded_iter const& __x, __static_bounded_iter const& __y) _NOEXCEPT {
219220 return __x.__current() - __y.__current();
220221 }
lib/libcxx/include/__iterator/wrap_iter.h+116-127
......@@ -15,7 +15,6 @@
1515#include <__config>
1616#include <__cstddef/size_t.h>
1717#include <__iterator/iterator_traits.h>
18#include <__memory/addressof.h>
1918#include <__memory/pointer_traits.h>
2019#include <__type_traits/conjunction.h>
2120#include <__type_traits/disjunction.h>
......@@ -34,18 +33,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3433template <class _Iter>
3534class __wrap_iter {
3635public:
37 typedef _Iter iterator_type;
38 typedef typename iterator_traits<iterator_type>::value_type value_type;
39 typedef typename iterator_traits<iterator_type>::difference_type difference_type;
40 typedef typename iterator_traits<iterator_type>::pointer pointer;
41 typedef typename iterator_traits<iterator_type>::reference reference;
42 typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
36 typedef typename iterator_traits<_Iter>::value_type value_type;
37 typedef typename iterator_traits<_Iter>::difference_type difference_type;
38 typedef typename iterator_traits<_Iter>::pointer pointer;
39 typedef typename iterator_traits<_Iter>::reference reference;
40 typedef typename iterator_traits<_Iter>::iterator_category iterator_category;
4341#if _LIBCPP_STD_VER >= 20
4442 typedef contiguous_iterator_tag iterator_concept;
4543#endif
4644
4745private:
48 iterator_type __i_;
46 _Iter __i_;
4947
5048public:
5149 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT : __i_() {}
......@@ -57,7 +55,9 @@ public:
5755 int> = 0>
5856 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter(const __wrap_iter<_OtherIter>& __u) _NOEXCEPT
5957 : __i_(__u.__i_) {}
60 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; }
58 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT {
59 return *__i_;
60 }
6161 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT {
6262 return std::__to_address(__i_);
6363 }
......@@ -80,7 +80,8 @@ public:
8080 --(*this);
8181 return __tmp;
8282 }
83 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator+(difference_type __n) const _NOEXCEPT {
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
84 operator+(difference_type __n) const _NOEXCEPT {
8485 __wrap_iter __w(*this);
8586 __w += __n;
8687 return __w;
......@@ -89,21 +90,21 @@ public:
8990 __i_ += __n;
9091 return *this;
9192 }
92 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter operator-(difference_type __n) const _NOEXCEPT {
93 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
94 operator-(difference_type __n) const _NOEXCEPT {
9395 return *this + (-__n);
9496 }
9597 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator-=(difference_type __n) _NOEXCEPT {
9698 *this += -__n;
9799 return *this;
98100 }
99 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT {
101 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference
102 operator[](difference_type __n) const _NOEXCEPT {
100103 return __i_[__n];
101104 }
102105
103 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 iterator_type base() const _NOEXCEPT { return __i_; }
104
105106private:
106 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x) {}
107 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(_Iter __x) _NOEXCEPT : __i_(__x) {}
107108
108109 template <class _Up>
109110 friend class __wrap_iter;
......@@ -117,137 +118,125 @@ private:
117118 friend class span;
118119 template <class _Tp, size_t _Size>
119120 friend struct array;
120 template <class _Tp, class>
121 friend struct __optional_iterator;
122};
123
124template <class _Iter1>
125_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
126operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
127 return __x.base() == __y.base();
128}
129
130template <class _Iter1, class _Iter2>
131_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
132operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
133 return __x.base() == __y.base();
134}
135
136template <class _Iter1>
137_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
138operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
139 return __x.base() < __y.base();
140}
141
142template <class _Iter1, class _Iter2>
143_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
144operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
145 return __x.base() < __y.base();
146}
147121
148122#if _LIBCPP_STD_VER <= 17
149template <class _Iter1>
150_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
151operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
152 return !(__x == __y);
153}
154
155template <class _Iter1, class _Iter2>
156_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
157operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
158 return !(__x == __y);
159}
160template <class _Iter1>
161_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
162operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
163 return __y < __x;
164}
165
166template <class _Iter1, class _Iter2>
167_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
168operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
169 return __y < __x;
170}
171
172template <class _Iter1>
173_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
174operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
175 return !(__x < __y);
176}
177
178template <class _Iter1, class _Iter2>
179_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
180operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
181 return !(__x < __y);
182}
183
184template <class _Iter1>
185_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
186operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
187 return !(__y < __x);
188}
189
190template <class _Iter1, class _Iter2>
191_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
192operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
193 return !(__y < __x);
194}
123 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
124 operator==(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
125 return __x.__i_ == __y.__i_;
126 }
127
128 template <class _Iter2>
129 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
130 operator==(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
131 return __x.__i_ == __y.__i_;
132 }
133
134 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
135 operator<(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
136 return __x.__i_ < __y.__i_;
137 }
138
139 template <class _Iter2>
140 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
141 operator<(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
142 return __x.__i_ < __y.__i_;
143 }
144
145 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
146 operator!=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
147 return !(__x == __y);
148 }
149
150 template <class _Iter2>
151 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
152 operator!=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
153 return !(__x == __y);
154 }
155
156 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
157 operator>(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
158 return __y < __x;
159 }
160
161 template <class _Iter2>
162 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
163 operator>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
164 return __y < __x;
165 }
166
167 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
168 operator>=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
169 return !(__x < __y);
170 }
171
172 template <class _Iter2>
173 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
174 operator>=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
175 return !(__x < __y);
176 }
177
178 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
179 operator<=(const __wrap_iter& __x, const __wrap_iter& __y) _NOEXCEPT {
180 return !(__y < __x);
181 }
182
183 template <class _Iter2>
184 _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool
185 operator<=(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
186 return !(__y < __x);
187 }
195188
196189#else
197template <class _Iter1, class _Iter2>
198_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
199operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept {
200 if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) {
201 return __x.base() <=> __y.base();
202 } else {
203 if (__x.base() < __y.base())
204 return strong_ordering::less;
190 _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __wrap_iter&, const __wrap_iter&) = default;
191
192 template <class _Iter2>
193 _LIBCPP_HIDE_FROM_ABI friend constexpr bool
194 operator==(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) noexcept {
195 return __x.__i_ == __y.__i_;
196 }
205197
206 if (__x.base() == __y.base())
207 return strong_ordering::equal;
198 template <class _Iter2>
199 _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
200 operator<=>(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) noexcept {
201 if constexpr (three_way_comparable_with<_Iter, _Iter2, strong_ordering>) {
202 return __x.__i_ <=> __y.__i_;
203 } else {
204 if (__x.__i_ < __y.__i_)
205 return strong_ordering::less;
208206
209 return strong_ordering::greater;
207 if (__x.__i_ == __y.__i_)
208 return strong_ordering::equal;
209
210 return strong_ordering::greater;
211 }
210212 }
211}
212213#endif // _LIBCPP_STD_VER >= 20
213214
214template <class _Iter1, class _Iter2>
215_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
216215#ifndef _LIBCPP_CXX03_LANG
217 auto
218 operator-(const __wrap_iter<_Iter1>& __x,
219 const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base())
216 template <class _Iter2>
217 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 auto
218 operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.__i_ - __y.__i_)
220219#else
221typename __wrap_iter<_Iter1>::difference_type
222operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
220 template <class _Iter2>
221 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14
222 typename __wrap_iter::difference_type operator-(const __wrap_iter& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
223223#endif // C++03
224{
225 return __x.base() - __y.base();
226}
224 {
225 return __x.__i_ - __y.__i_;
226 }
227227
228template <class _Iter1>
229_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter<_Iter1>
230operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> __x) _NOEXCEPT {
231 __x += __n;
232 return __x;
233}
228 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter
229 operator+(typename __wrap_iter::difference_type __n, __wrap_iter __x) _NOEXCEPT {
230 __x += __n;
231 return __x;
232 }
233};
234234
235235#if _LIBCPP_STD_VER <= 17
236236template <class _It>
237237struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {};
238238#endif
239239
240template <class _It>
241struct pointer_traits<__wrap_iter<_It> > {
242 typedef __wrap_iter<_It> pointer;
243 typedef typename pointer_traits<_It>::element_type element_type;
244 typedef typename pointer_traits<_It>::difference_type difference_type;
245
246 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static element_type* to_address(pointer __w) _NOEXCEPT {
247 return std::__to_address(__w.base());
248 }
249};
250
251240_LIBCPP_END_NAMESPACE_STD
252241
253242#endif // _LIBCPP___ITERATOR_WRAP_ITER_H
lib/libcxx/include/__locale+118-72
......@@ -11,6 +11,7 @@
1111#define _LIBCPP___LOCALE
1212
1313#include <__config>
14#include <__configuration/availability.h>
1415
1516#if _LIBCPP_HAS_LOCALIZATION
1617
......@@ -26,6 +27,7 @@
2627# include <cstdint>
2728# include <cstdlib>
2829# include <string>
30# include <text_encoding>
2931
3032// Some platforms require more includes than others. Keep the includes on all plaforms for now.
3133# include <cstddef>
......@@ -42,6 +44,7 @@
4244# endif
4345
4446_LIBCPP_BEGIN_NAMESPACE_STD
47_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4548
4649class _LIBCPP_EXPORTED_FROM_ABI locale;
4750
......@@ -88,7 +91,7 @@ public:
8891 const locale& operator=(const locale&) _NOEXCEPT;
8992
9093 template <class _Facet>
91 _LIBCPP_HIDE_FROM_ABI locale combine(const locale& __other) const {
94 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI locale combine(const locale& __other) const {
9295 if (!std::has_facet<_Facet>(__other))
9396 __throw_runtime_error("locale::combine: locale missing facet");
9497
......@@ -96,21 +99,29 @@ public:
9699 }
97100
98101 // locale operations:
99 string name() const;
102 [[__nodiscard__]] string name() const;
100103 bool operator==(const locale&) const;
101104# if _LIBCPP_STD_VER <= 17
102105 _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); }
103106# endif
104107 template <class _CharT, class _Traits, class _Allocator>
108 [[__nodiscard__]]
105109 _LIBCPP_HIDE_FROM_ABI bool operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
106110 const basic_string<_CharT, _Traits, _Allocator>& __y) const {
107111 return std::use_facet<std::collate<_CharT> >(*this).compare(
108112 __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0;
109113 }
114# if _LIBCPP_STD_VER >= 26
115 [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT
116 _LIBCPP_HIDE_FROM_ABI std::text_encoding encoding() const {
117 std::string __name = name();
118 return std::__get_locale_encoding(__name.c_str());
119 }
120# endif
110121
111122 // global locale objects:
112123 static locale global(const locale&);
113 static const locale& classic();
124 [[__nodiscard__]] static const locale& classic();
114125
115126private:
116127 class __imp;
......@@ -118,6 +129,9 @@ private:
118129
119130 template <class>
120131 friend struct __no_destroy;
132
133 friend ios_base;
134
121135 _LIBCPP_HIDE_FROM_ABI explicit locale(__private_constructor_tag, __imp* __loc) : __locale_(__loc) {}
122136
123137 void __install_ctor(const locale&, facet*, long);
......@@ -168,12 +182,12 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f)
168182}
169183
170184template <class _Facet>
171inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT {
185[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool has_facet(const locale& __l) _NOEXCEPT {
172186 return __l.has_facet(_Facet::id);
173187}
174188
175189template <class _Facet>
176inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) {
190[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale& __l) {
177191 return static_cast<const _Facet&>(*__l.use_facet(_Facet::id));
178192}
179193
......@@ -187,19 +201,21 @@ public:
187201
188202 _LIBCPP_HIDE_FROM_ABI explicit collate(size_t __refs = 0) : locale::facet(__refs) {}
189203
190 _LIBCPP_HIDE_FROM_ABI int
204 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int
191205 compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const {
192206 return do_compare(__lo1, __hi1, __lo2, __hi2);
193207 }
194208
195209 // FIXME(EricWF): The _LIBCPP_ALWAYS_INLINE is needed on Windows to work
196210 // around a dllimport bug that expects an external instantiation.
197 _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type
211 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE string_type
198212 transform(const char_type* __lo, const char_type* __hi) const {
199213 return do_transform(__lo, __hi);
200214 }
201215
202 _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const { return do_hash(__lo, __hi); }
216 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long hash(const char_type* __lo, const char_type* __hi) const {
217 return do_hash(__lo, __hi);
218 }
203219
204220 static locale::id id;
205221
......@@ -318,6 +334,8 @@ public:
318334# endif // defined(__BIONIC__)
319335# elif defined(__GLIBC__)
320336 typedef unsigned short mask;
337 _LIBCPP_DIAGNOSTIC_PUSH
338 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmodules-ambiguous-internal-linkage")
321339 static const mask space = _ISspace;
322340 static const mask print = _ISprint;
323341 static const mask cntrl = _IScntrl;
......@@ -328,6 +346,7 @@ public:
328346 static const mask punct = _ISpunct;
329347 static const mask xdigit = _ISxdigit;
330348 static const mask blank = _ISblank;
349 _LIBCPP_DIAGNOSTIC_POP
331350# if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
332351 static const mask __regex_word = static_cast<mask>(_ISbit(15));
333352# else
......@@ -435,6 +454,20 @@ public:
435454 static const mask blank = __ISBLANK;
436455# endif
437456 static const mask __regex_word = 0x8000;
457// zig patch: haiku support
458# elif defined(__HAIKU__)
459 typedef unsigned short mask;
460 static const mask space = _ISspace;
461 static const mask print = _ISprint;
462 static const mask cntrl = _IScntrl;
463 static const mask upper = _ISupper;
464 static const mask lower = _ISlower;
465 static const mask alpha = _ISalpha;
466 static const mask digit = _ISdigit;
467 static const mask punct = _ISpunct;
468 static const mask xdigit = _ISxdigit;
469 static const mask blank = _ISblank;
470 static const mask __regex_word = 0x80;
438471# else
439472# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
440473# endif
......@@ -459,39 +492,43 @@ public:
459492
460493 _LIBCPP_HIDE_FROM_ABI explicit ctype(size_t __refs = 0) : locale::facet(__refs) {}
461494
462 _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); }
495 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const { return do_is(__m, __c); }
463496
464497 _LIBCPP_HIDE_FROM_ABI const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const {
465498 return do_is(__low, __high, __vec);
466499 }
467500
468 _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
501 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type*
502 scan_is(mask __m, const char_type* __low, const char_type* __high) const {
469503 return do_scan_is(__m, __low, __high);
470504 }
471505
472 _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
506 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type*
507 scan_not(mask __m, const char_type* __low, const char_type* __high) const {
473508 return do_scan_not(__m, __low, __high);
474509 }
475510
476 _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
511 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
477512
478513 _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
479514 return do_toupper(__low, __high);
480515 }
481516
482 _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
517 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
483518
484519 _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
485520 return do_tolower(__low, __high);
486521 }
487522
488 _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
523 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
489524
490525 _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
491526 return do_widen(__low, __high, __to);
492527 }
493528
494 _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
529 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const {
530 return do_narrow(__c, __dfault);
531 }
495532
496533 _LIBCPP_HIDE_FROM_ABI const char_type*
497534 narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
......@@ -530,7 +567,7 @@ public:
530567
531568 explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
532569
533 _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const {
570 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool is(mask __m, char_type __c) const {
534571 return std::__libcpp_isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) != 0 : false;
535572 }
536573
......@@ -540,39 +577,43 @@ public:
540577 return __low;
541578 }
542579
543 _LIBCPP_HIDE_FROM_ABI const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const {
580 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type*
581 scan_is(mask __m, const char_type* __low, const char_type* __high) const {
544582 for (; __low != __high; ++__low)
545583 if (std::__libcpp_isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
546584 break;
547585 return __low;
548586 }
549587
550 _LIBCPP_HIDE_FROM_ABI const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const {
588 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const char_type*
589 scan_not(mask __m, const char_type* __low, const char_type* __high) const {
551590 for (; __low != __high; ++__low)
552591 if (!std::__libcpp_isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
553592 break;
554593 return __low;
555594 }
556595
557 _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
596 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
558597
559598 _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
560599 return do_toupper(__low, __high);
561600 }
562601
563 _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
602 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type tolower(char_type __c) const { return do_tolower(__c); }
564603
565604 _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
566605 return do_tolower(__low, __high);
567606 }
568607
569 _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
608 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const { return do_widen(__c); }
570609
571610 _LIBCPP_HIDE_FROM_ABI const char* widen(const char* __low, const char* __high, char_type* __to) const {
572611 return do_widen(__low, __high, __to);
573612 }
574613
575 _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); }
614 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const {
615 return do_narrow(__c, __dfault);
616 }
576617
577618 _LIBCPP_HIDE_FROM_ABI const char*
578619 narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const {
......@@ -586,8 +627,8 @@ public:
586627# else
587628 static const size_t table_size = 256;
588629# endif
589 _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
590 static const mask* classic_table() _NOEXCEPT;
630 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mask* table() const _NOEXCEPT { return __tab_; }
631 [[__nodiscard__]] static const mask* classic_table() _NOEXCEPT;
591632
592633protected:
593634 ~ctype() override;
......@@ -650,72 +691,72 @@ protected:
650691# endif // _LIBCPP_HAS_WIDE_CHARACTERS
651692
652693template <class _CharT>
653inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
694[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isspace(_CharT __c, const locale& __loc) {
654695 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c);
655696}
656697
657698template <class _CharT>
658inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) {
699[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isprint(_CharT __c, const locale& __loc) {
659700 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c);
660701}
661702
662703template <class _CharT>
663inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) {
704[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool iscntrl(_CharT __c, const locale& __loc) {
664705 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c);
665706}
666707
667708template <class _CharT>
668inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) {
709[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isupper(_CharT __c, const locale& __loc) {
669710 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c);
670711}
671712
672713template <class _CharT>
673inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) {
714[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool islower(_CharT __c, const locale& __loc) {
674715 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c);
675716}
676717
677718template <class _CharT>
678inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) {
719[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isalpha(_CharT __c, const locale& __loc) {
679720 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c);
680721}
681722
682723template <class _CharT>
683inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) {
724[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isdigit(_CharT __c, const locale& __loc) {
684725 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c);
685726}
686727
687728template <class _CharT>
688inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) {
729[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool ispunct(_CharT __c, const locale& __loc) {
689730 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c);
690731}
691732
692733template <class _CharT>
693inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) {
734[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isxdigit(_CharT __c, const locale& __loc) {
694735 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c);
695736}
696737
697738template <class _CharT>
698inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) {
739[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isalnum(_CharT __c, const locale& __loc) {
699740 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c);
700741}
701742
702743template <class _CharT>
703inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) {
744[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI bool isgraph(_CharT __c, const locale& __loc) {
704745 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c);
705746}
706747
707748template <class _CharT>
708_LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) {
749[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) {
709750 return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c);
710751}
711752
712753template <class _CharT>
713inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) {
754[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _CharT toupper(_CharT __c, const locale& __loc) {
714755 return std::use_facet<ctype<_CharT> >(__loc).toupper(__c);
715756}
716757
717758template <class _CharT>
718inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) {
759[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _CharT tolower(_CharT __c, const locale& __loc) {
719760 return std::use_facet<ctype<_CharT> >(__loc).tolower(__c);
720761}
721762
......@@ -770,16 +811,16 @@ public:
770811 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
771812 }
772813
773 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
814 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
774815
775 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
816 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
776817
777818 _LIBCPP_HIDE_FROM_ABI int
778819 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
779820 return do_length(__st, __frm, __end, __mx);
780821 }
781822
782 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
823 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
783824
784825 static locale::id id;
785826
......@@ -852,16 +893,16 @@ public:
852893 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
853894 }
854895
855 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
896 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
856897
857 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
898 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
858899
859900 _LIBCPP_HIDE_FROM_ABI int
860901 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
861902 return do_length(__st, __frm, __end, __mx);
862903 }
863904
864 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
905 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
865906
866907 static locale::id id;
867908
......@@ -933,16 +974,16 @@ public:
933974 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
934975 }
935976
936 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
977 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
937978
938 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
979 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
939980
940981 _LIBCPP_HIDE_FROM_ABI int
941982 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
942983 return do_length(__st, __frm, __end, __mx);
943984 }
944985
945 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
986 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
946987
947988 static locale::id id;
948989
......@@ -976,10 +1017,11 @@ protected:
9761017
9771018# if _LIBCPP_HAS_CHAR8_T
9781019
979// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
1020// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20, deprecated in C++20
9801021
9811022template <>
982class _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
1023class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char16_t, char8_t, mbstate_t>
1024 : public locale::facet, public codecvt_base {
9831025public:
9841026 typedef char16_t intern_type;
9851027 typedef char8_t extern_type;
......@@ -1014,16 +1056,16 @@ public:
10141056 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
10151057 }
10161058
1017 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
1059 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
10181060
1019 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
1061 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
10201062
10211063 _LIBCPP_HIDE_FROM_ABI int
10221064 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
10231065 return do_length(__st, __frm, __end, __mx);
10241066 }
10251067
1026 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
1068 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
10271069
10281070 static locale::id id;
10291071
......@@ -1096,16 +1138,16 @@ public:
10961138 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
10971139 }
10981140
1099 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
1141 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
11001142
1101 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
1143 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
11021144
11031145 _LIBCPP_HIDE_FROM_ABI int
11041146 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
11051147 return do_length(__st, __frm, __end, __mx);
11061148 }
11071149
1108 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
1150 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
11091151
11101152 static locale::id id;
11111153
......@@ -1139,10 +1181,11 @@ protected:
11391181
11401182# if _LIBCPP_HAS_CHAR8_T
11411183
1142// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
1184// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20, deprecated in C++20
11431185
11441186template <>
1145class _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t> : public locale::facet, public codecvt_base {
1187class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXPORTED_FROM_ABI codecvt<char32_t, char8_t, mbstate_t>
1188 : public locale::facet, public codecvt_base {
11461189public:
11471190 typedef char32_t intern_type;
11481191 typedef char8_t extern_type;
......@@ -1177,16 +1220,16 @@ public:
11771220 return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
11781221 }
11791222
1180 _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
1223 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int encoding() const _NOEXCEPT { return do_encoding(); }
11811224
1182 _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
1225 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool always_noconv() const _NOEXCEPT { return do_always_noconv(); }
11831226
11841227 _LIBCPP_HIDE_FROM_ABI int
11851228 length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const {
11861229 return do_length(__st, __frm, __end, __mx);
11871230 }
11881231
1189 _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
1232 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI int max_length() const _NOEXCEPT { return do_max_length(); }
11901233
11911234 static locale::id id;
11921235
......@@ -1248,8 +1291,10 @@ _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // d
12481291extern template class _LIBCPP_DEPRECATED_IN_CXX20
12491292_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
12501293# if _LIBCPP_HAS_CHAR8_T
1251extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20
1252extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20
1294extern template class _LIBCPP_DEPRECATED_IN_CXX20
1295_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20, deprecated in C++20
1296extern template class _LIBCPP_DEPRECATED_IN_CXX20
1297_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20, deprecated in C++20
12531298# endif
12541299
12551300template <size_t _Np>
......@@ -1409,11 +1454,11 @@ public:
14091454
14101455 explicit numpunct(size_t __refs = 0);
14111456
1412 _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
1413 _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
1414 _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
1415 _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
1416 _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
1457 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
1458 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
1459 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
1460 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
1461 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
14171462
14181463 static locale::id id;
14191464
......@@ -1439,11 +1484,11 @@ public:
14391484
14401485 explicit numpunct(size_t __refs = 0);
14411486
1442 _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
1443 _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
1444 _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
1445 _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
1446 _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
1487 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
1488 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
1489 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
1490 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
1491 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
14471492
14481493 static locale::id id;
14491494
......@@ -1494,6 +1539,7 @@ protected:
14941539};
14951540# endif // _LIBCPP_HAS_WIDE_CHARACTERS
14961541
1542_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
14971543_LIBCPP_END_NAMESPACE_STD
14981544
14991545#endif // _LIBCPP_HAS_LOCALIZATION
lib/libcxx/include/__locale_dir/check_grouping.h+2
......@@ -20,10 +20,12 @@
2020# endif
2121
2222_LIBCPP_BEGIN_NAMESPACE_STD
23_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2324
2425_LIBCPP_EXPORTED_FROM_ABI void
2526__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err);
2627
28_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2729_LIBCPP_END_NAMESPACE_STD
2830
2931#endif // _LIBCPP_HAS_LOCALIZATION
lib/libcxx/include/__locale_dir/get_c_locale.h+2
......@@ -29,7 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2929# else
3030# define _LIBCPP_GET_C_LOCALE __cloc()
3131// Get the C locale object
32_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3233_LIBCPP_EXPORTED_FROM_ABI __locale::__locale_t __cloc();
34_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3335# define __cloc_defined
3436# endif
3537
lib/libcxx/include/__locale_dir/locale_base_api.h+22-8
......@@ -102,6 +102,8 @@
102102//
103103// int __snprintf(char*, size_t, __locale_t, const char*, ...); // required by the headers
104104// int __asprintf(char**, __locale_t, const char*, ...); // required by the headers
105//
106// const char* __get_locale_encoding(__locale_t);
105107// }
106108
107109#if _LIBCPP_HAS_LOCALIZATION
......@@ -112,33 +114,40 @@
112114# include <__locale_dir/support/freebsd.h>
113115# elif defined(__NetBSD__)
114116# include <__locale_dir/support/netbsd.h>
117# elif defined(__OpenBSD__)
118# include <__locale_dir/support/openbsd.h>
115119# elif defined(_LIBCPP_MSVCRT_LIKE)
116120# include <__locale_dir/support/windows.h>
117121# elif defined(__Fuchsia__)
118122# include <__locale_dir/support/fuchsia.h>
123# elif _LIBCPP_LIBC_LLVM_LIBC
124# include <__locale_dir/support/llvm_libc.h>
119125# elif defined(__linux__)
120126# include <__locale_dir/support/linux.h>
121127# elif _LIBCPP_LIBC_NEWLIB
122128# include <__locale_dir/support/newlib.h>
123129# elif defined(_AIX)
124130# include <__locale_dir/support/aix.h>
131// zig patch: haiku support
132# elif defined(__HAIKU__)
133# include <__locale_dir/support/haiku.h>
134// zig patch: serenity support
135# elif defined(__serenity__)
136# include <__locale_dir/support/serenity.h>
125137# else
126138
127139// TODO: This is a temporary definition to bridge between the old way we defined the locale base API
128140// (by providing global non-reserved names) and the new API. As we move individual platforms
129141// towards the new way of defining the locale base API, this should disappear since each platform
130142// will define those directly.
131# if defined(__MVS__)
132# include <__locale_dir/locale_base_api/ibm.h>
133# elif defined(__OpenBSD__)
134# include <__locale_dir/locale_base_api/openbsd.h>
135# endif
143# include <__locale_dir/locale_base_api/ibm.h>
136144
137145# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
138146
139147# include <__cstddef/size_t.h>
140148# include <__utility/forward.h>
141149# include <ctype.h>
150# include <langinfo.h>
142151# include <string.h>
143152# include <time.h>
144153# if _LIBCPP_HAS_WIDE_CHARACTERS
......@@ -228,8 +237,8 @@ inline _LIBCPP_HIDE_FROM_ABI wint_t __towupper(wint_t __ch, __locale_t __loc) {
228237inline _LIBCPP_HIDE_FROM_ABI wint_t __towlower(wint_t __ch, __locale_t __loc) { return towlower_l(__ch, __loc); }
229238# endif
230239
231inline _LIBCPP_HIDE_FROM_ABI size_t
232__strftime(char* __s, size_t __max, const char* __format, const tm* __tm, __locale_t __loc) {
240inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
241 __strftime(char* __s, size_t __max, const char* __format, const tm* __tm, __locale_t __loc) {
233242 return strftime_l(__s, __max, __format, __tm, __loc);
234243}
235244
......@@ -268,7 +277,12 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
268277 return __libcpp_mbsrtowcs_l(__dest, __src, __len, __ps, __loc);
269278}
270279# endif // _LIBCPP_HAS_WIDE_CHARACTERS
271# endif // _LIBCPP_BUILDING_LIBRARY
280
281inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
282 return ::nl_langinfo_l(CODESET, __loc);
283}
284
285# endif // _LIBCPP_BUILDING_LIBRARY
272286
273287_LIBCPP_DIAGNOSTIC_PUSH
274288_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
lib/libcxx/include/__locale_dir/locale_base_api/android.h deleted-45
......@@ -1,45 +0,0 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H
11#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H
12
13#include <stdlib.h>
14
15// FIXME: Is this actually required?
16extern "C" {
17#include <xlocale.h>
18}
19
20#include <android/api-level.h>
21
22// If we do not have this header, we are in a platform build rather than an NDK
23// build, which will always be at least as new as the ToT NDK, in which case we
24// don't need any of the inlines below since libc provides them.
25#if __has_include(<android/ndk-version.h>)
26# include <android/ndk-version.h>
27// In NDK versions later than 16, locale-aware functions are provided by
28// legacy_stdlib_inlines.h
29# if __NDK_MAJOR__ <= 16
30# if __ANDROID_API__ < 26
31
32inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
33 return ::strtof(__nptr, __endptr);
34}
35
36inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) {
37 return ::strtod(__nptr, __endptr);
38}
39
40# endif // __ANDROID_API__ < 26
41
42# endif // __NDK_MAJOR__ <= 16
43#endif // __has_include(<android/ndk-version.h>)
44
45#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H
lib/libcxx/include/__locale_dir/locale_base_api/ibm.h created+97
......@@ -0,0 +1,97 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H
11#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H
12
13#if defined(__MVS__)
14# include <__support/ibm/locale_mgmt_zos.h>
15#endif // defined(__MVS__)
16
17#include <locale.h>
18#include <stdarg.h>
19#include <stdio.h>
20
21#include "cstdlib"
22
23#if defined(__MVS__)
24# include <wctype.h>
25// POSIX routines
26# include <__support/xlocale/__posix_l_fallback.h>
27#endif // defined(__MVS__)
28
29namespace {
30
31struct __setAndRestore {
32 explicit __setAndRestore(locale_t locale) {
33 if (locale == (locale_t)0) {
34 __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
35 __stored = uselocale(__cloc);
36 } else {
37 __stored = uselocale(locale);
38 }
39 }
40
41 ~__setAndRestore() {
42 uselocale(__stored);
43 if (__cloc)
44 freelocale(__cloc);
45 }
46
47private:
48 locale_t __stored = (locale_t)0;
49 locale_t __cloc = (locale_t)0;
50};
51
52} // namespace
53
54// The following are not POSIX routines. These are quick-and-dirty hacks
55// to make things pretend to work
56inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t locale) {
57 __setAndRestore __newloc(locale);
58 return ::strtod(__nptr, __endptr);
59}
60
61inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t locale) {
62 __setAndRestore __newloc(locale);
63 return ::strtof(__nptr, __endptr);
64}
65
66inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t locale) {
67 __setAndRestore __newloc(locale);
68 return ::strtold(__nptr, __endptr);
69}
70
71inline _LIBCPP_HIDE_FROM_ABI
72_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char* fmt, va_list ap) {
73 const size_t buff_size = 256;
74 if ((*strp = (char*)malloc(buff_size)) == nullptr) {
75 return -1;
76 }
77
78 va_list ap_copy;
79 // va_copy may not be provided by the C library in C++03 mode.
80#if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy)
81 __builtin_va_copy(ap_copy, ap);
82#else
83 va_copy(ap_copy, ap);
84#endif
85 int str_size = vsnprintf(*strp, buff_size, fmt, ap_copy);
86 va_end(ap_copy);
87
88 if ((size_t)str_size >= buff_size) {
89 if ((*strp = (char*)realloc(*strp, str_size + 1)) == nullptr) {
90 return -1;
91 }
92 str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
93 }
94 return str_size;
95}
96
97#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_IBM_H
lib/libcxx/include/__locale_dir/locale_base_api/musl.h deleted-31
......@@ -1,31 +0,0 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9// This adds support for the extended locale functions that are currently
10// missing from the Musl C library.
11//
12// This only works when the specified locale is "C" or "POSIX", but that's
13// about as good as we can do without implementing full xlocale support
14// in Musl.
15//===----------------------------------------------------------------------===//
16
17#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H
18#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H
19
20#include <cstdlib>
21#include <cwchar>
22
23inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
24 return ::strtoll(__nptr, __endptr, __base);
25}
26
27inline _LIBCPP_HIDE_FROM_ABI unsigned long long strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
28 return ::strtoull(__nptr, __endptr, __base);
29}
30
31#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_MUSL_H
lib/libcxx/include/__locale_dir/locale_base_api/openbsd.h deleted-19
......@@ -1,19 +0,0 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
11#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
12
13#include <__support/xlocale/__strtonum_fallback.h>
14#include <clocale>
15#include <cstdlib>
16#include <ctype.h>
17#include <cwctype>
18
19#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
lib/libcxx/include/__locale_dir/messages.h+7-3
......@@ -22,7 +22,8 @@
2222
2323# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
2424// Most unix variants have catopen. These are the specific ones that don't.
25# if !defined(__BIONIC__) && !_LIBCPP_LIBC_NEWLIB && !defined(__EMSCRIPTEN__)
25// zig patch: serenity support
26# if !defined(__BIONIC__) && !_LIBCPP_LIBC_NEWLIB && !defined(__EMSCRIPTEN__) && !defined(__serenity__)
2627# define _LIBCPP_HAS_CATOPEN 1
2728# include <nl_types.h>
2829# else
......@@ -33,6 +34,7 @@
3334# endif
3435
3536_LIBCPP_BEGIN_NAMESPACE_STD
37_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3638
3739class _LIBCPP_EXPORTED_FROM_ABI messages_base {
3840public:
......@@ -49,11 +51,12 @@ public:
4951
5052 _LIBCPP_HIDE_FROM_ABI explicit messages(size_t __refs = 0) : locale::facet(__refs) {}
5153
52 _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const {
54 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI catalog open(const basic_string<char>& __nm, const locale& __loc) const {
5355 return do_open(__nm, __loc);
5456 }
5557
56 _LIBCPP_HIDE_FROM_ABI string_type get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
58 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type
59 get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
5760 return do_get(__c, __set, __msgid, __dflt);
5861 }
5962
......@@ -136,6 +139,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>;
136139extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>;
137140# endif
138141
142_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
139143_LIBCPP_END_NAMESPACE_STD
140144
141145#endif // _LIBCPP_HAS_LOCALIZATION
lib/libcxx/include/__locale_dir/money.h+11-9
......@@ -32,6 +32,7 @@ _LIBCPP_PUSH_MACROS
3232# include <__undef_macros>
3333
3434_LIBCPP_BEGIN_NAMESPACE_STD
35_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3536
3637// money_base
3738
......@@ -55,15 +56,15 @@ public:
5556
5657 _LIBCPP_HIDE_FROM_ABI explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {}
5758
58 _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
59 _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
60 _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
61 _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); }
62 _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); }
63 _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); }
64 _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); }
65 _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); }
66 _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); }
59 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
60 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
61 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
62 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type curr_symbol() const { return do_curr_symbol(); }
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type positive_sign() const { return do_positive_sign(); }
64 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type negative_sign() const { return do_negative_sign(); }
65 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI int frac_digits() const { return do_frac_digits(); }
66 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pattern pos_format() const { return do_pos_format(); }
67 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pattern neg_format() const { return do_neg_format(); }
6768
6869 static locale::id id;
6970 static const bool intl = _International;
......@@ -864,6 +865,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>;
864865extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>;
865866# endif
866867
868_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
867869_LIBCPP_END_NAMESPACE_STD
868870
869871_LIBCPP_POP_MACROS
lib/libcxx/include/__locale_dir/num.h+3-2
......@@ -42,6 +42,7 @@ _LIBCPP_PUSH_MACROS
4242# include <__undef_macros>
4343
4444_LIBCPP_BEGIN_NAMESPACE_STD
45_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4546
4647struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
4748 static const int __num_get_buf_sz = 40;
......@@ -95,9 +96,8 @@ struct __num_get : protected __num_get_base {
9596 _LIBCPP_DIAGNOSTIC_PUSH
9697 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wpsabi")
9798 using __vec = __simd_vector<char, 32>;
98 __vec __chars = std::__broadcast<__vec>(__val);
9999 __vec __cmp = std::__partial_load<__vec, __int_chr_cnt>(__atoms);
100 auto __res = __chars == __cmp;
100 auto __res = __vec(__val) == __cmp;
101101 if (std::__none_of(__res))
102102 return __int_chr_cnt;
103103 return std::min(__int_chr_cnt, std::__find_first_set(__res));
......@@ -1008,6 +1008,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>;
10081008extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>;
10091009# endif
10101010
1011_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
10111012_LIBCPP_END_NAMESPACE_STD
10121013
10131014_LIBCPP_POP_MACROS
lib/libcxx/include/__locale_dir/pad_and_output.h+2-14
......@@ -55,13 +55,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(
5555 __ns -= __sz;
5656 else
5757 __ns = 0;
58 streamsize __np = __op - __ob;
59 if (__np > 0) {
60 if (__s.__sbuf_->sputn(__ob, __np) != __np) {
61 __s.__sbuf_ = nullptr;
62 return __s;
63 }
64 }
58 __s = std::copy(__ob, __op, __s);
6559 if (__ns > 0) {
6660 basic_string<_CharT, _Traits> __sp(__ns, __fl);
6761 if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) {
......@@ -69,13 +63,7 @@ _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(
6963 return __s;
7064 }
7165 }
72 __np = __oe - __op;
73 if (__np > 0) {
74 if (__s.__sbuf_->sputn(__op, __np) != __np) {
75 __s.__sbuf_ = nullptr;
76 return __s;
77 }
78 }
66 __s = std::copy(__op, __oe, __s);
7967 __iob.width(0);
8068 return __s;
8169}
lib/libcxx/include/__locale_dir/support/bsd_like.h+8-3
......@@ -15,6 +15,7 @@
1515#include <__utility/forward.h>
1616#include <clocale> // std::lconv
1717#include <ctype.h>
18#include <langinfo.h>
1819#include <stdio.h>
1920#include <stdlib.h>
2021#include <string.h>
......@@ -133,8 +134,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __
133134}
134135# endif // _LIBCPP_HAS_WIDE_CHARACTERS
135136
136inline _LIBCPP_HIDE_FROM_ABI size_t
137__strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
137inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
138 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
138139 return ::strftime_l(__s, __max, __format, __tm, __loc);
139140}
140141
......@@ -180,7 +181,11 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
180181 return ::mbsrtowcs_l(__dest, __src, __len, __ps, __loc);
181182}
182183# endif // _LIBCPP_HAS_WIDE_CHARACTERS
183#endif // _LIBCPP_BUILDING_LIBRARY
184
185inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
186 return ::nl_langinfo_l(CODESET, __loc);
187}
188#endif // _LIBCPP_BUILDING_LIBRARY
184189
185190_LIBCPP_DIAGNOSTIC_PUSH
186191_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
lib/libcxx/include/__locale_dir/support/fuchsia.h+5
......@@ -15,6 +15,7 @@
1515#include <cstdio>
1616#include <cstdlib>
1717#include <cwchar>
18#include <langinfo.h>
1819
1920#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2021# pragma GCC system_header
......@@ -69,6 +70,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
6970 return std::localeconv();
7071}
7172
73inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
74 return ::nl_langinfo_l(CODESET, __loc);
75}
76
7277//
7378// Other functions
7479//
lib/libcxx/include/__locale_dir/support/haiku.h created+243
......@@ -0,0 +1,243 @@
1// zig patch: haiku support
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_HAIKU_H
11#define _LIBCPP___LOCALE_DIR_SUPPORT_HAIKU_H
12
13#include <__config>
14#include <cctype>
15#include <clocale>
16#include <cstdio>
17#include <cstdlib>
18#include <cstring>
19#if _LIBCPP_HAS_WIDE_CHARACTERS
20# include <cwchar>
21# include <cwctype>
22#endif
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28_LIBCPP_BEGIN_NAMESPACE_STD
29namespace __locale {
30
31struct __locale_guard {
32 _LIBCPP_HIDE_FROM_ABI __locale_guard(locale_t& __loc) : __old_loc_(::uselocale(__loc)) {}
33
34 _LIBCPP_HIDE_FROM_ABI ~__locale_guard() {
35 if (__old_loc_)
36 ::uselocale(__old_loc_);
37 }
38
39 locale_t __old_loc_;
40
41 __locale_guard(__locale_guard const&) = delete;
42 __locale_guard& operator=(__locale_guard const&) = delete;
43};
44
45//
46// Locale management
47//
48#define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
49#define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
50#define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
51#define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
52#define _LIBCPP_TIME_MASK LC_TIME_MASK
53#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
54#define _LIBCPP_ALL_MASK LC_ALL_MASK
55#define _LIBCPP_LC_ALL LC_ALL
56
57using __locale_t _LIBCPP_NODEBUG = ::locale_t;
58
59#if defined(_LIBCPP_BUILDING_LIBRARY)
60using __lconv_t _LIBCPP_NODEBUG = std::lconv;
61
62inline _LIBCPP_HIDE_FROM_ABI __locale_t __newlocale(int __category_mask, const char* __locale, __locale_t __base) {
63 return ::newlocale(__category_mask, __locale, __base);
64}
65
66inline _LIBCPP_HIDE_FROM_ABI void __freelocale(__locale_t __loc) { ::freelocale(__loc); }
67
68inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, char const* __locale) {
69 return ::setlocale(__category, __locale);
70}
71
72inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
73 __locale_guard __current(__loc);
74 return std::localeconv();
75}
76#endif // _LIBCPP_BUILDING_LIBRARY
77
78//
79// Strtonum functions
80//
81inline _LIBCPP_HIDE_FROM_ABI float __strtof(const char* __nptr, char** __endptr, __locale_t __loc) {
82 __locale_guard __current(__loc);
83 return std::strtof(__nptr, __endptr);
84}
85
86inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr, __locale_t __loc) {
87 __locale_guard __current(__loc);
88 return std::strtod(__nptr, __endptr);
89}
90
91inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __endptr, __locale_t __loc) {
92 __locale_guard __current(__loc);
93 return std::strtold(__nptr, __endptr);
94}
95
96//
97// Character manipulation functions
98//
99#if defined(_LIBCPP_BUILDING_LIBRARY)
100inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t __loc) { return ::toupper_l(__c, __loc); }
101
102inline _LIBCPP_HIDE_FROM_ABI int __tolower(int __c, __locale_t __loc) { return ::tolower_l(__c, __loc); }
103
104inline _LIBCPP_HIDE_FROM_ABI int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) {
105 return ::strcoll_l(__s1, __s2, __loc);
106}
107
108inline _LIBCPP_HIDE_FROM_ABI size_t __strxfrm(char* __dest, const char* __src, size_t __n, __locale_t __loc) {
109 return ::strxfrm_l(__dest, __src, __n, __loc);
110}
111
112# if _LIBCPP_HAS_WIDE_CHARACTERS
113inline _LIBCPP_HIDE_FROM_ABI int __iswctype(wint_t __c, wctype_t __type, __locale_t __loc) {
114 return ::iswctype_l(__c, __type, __loc);
115}
116
117inline _LIBCPP_HIDE_FROM_ABI int __iswspace(wint_t __c, __locale_t __loc) { return ::iswspace_l(__c, __loc); }
118
119inline _LIBCPP_HIDE_FROM_ABI int __iswprint(wint_t __c, __locale_t __loc) { return ::iswprint_l(__c, __loc); }
120
121inline _LIBCPP_HIDE_FROM_ABI int __iswcntrl(wint_t __c, __locale_t __loc) { return ::iswcntrl_l(__c, __loc); }
122
123inline _LIBCPP_HIDE_FROM_ABI int __iswupper(wint_t __c, __locale_t __loc) { return ::iswupper_l(__c, __loc); }
124
125inline _LIBCPP_HIDE_FROM_ABI int __iswlower(wint_t __c, __locale_t __loc) { return ::iswlower_l(__c, __loc); }
126
127inline _LIBCPP_HIDE_FROM_ABI int __iswalpha(wint_t __c, __locale_t __loc) { return ::iswalpha_l(__c, __loc); }
128
129inline _LIBCPP_HIDE_FROM_ABI int __iswblank(wint_t __c, __locale_t __loc) { return ::iswblank_l(__c, __loc); }
130
131inline _LIBCPP_HIDE_FROM_ABI int __iswdigit(wint_t __c, __locale_t __loc) { return ::iswdigit_l(__c, __loc); }
132
133inline _LIBCPP_HIDE_FROM_ABI int __iswpunct(wint_t __c, __locale_t __loc) { return ::iswpunct_l(__c, __loc); }
134
135inline _LIBCPP_HIDE_FROM_ABI int __iswxdigit(wint_t __c, __locale_t __loc) { return ::iswxdigit_l(__c, __loc); }
136
137inline _LIBCPP_HIDE_FROM_ABI wint_t __towupper(wint_t __c, __locale_t __loc) { return ::towupper_l(__c, __loc); }
138
139inline _LIBCPP_HIDE_FROM_ABI wint_t __towlower(wint_t __c, __locale_t __loc) { return ::towlower_l(__c, __loc); }
140
141inline _LIBCPP_HIDE_FROM_ABI int __wcscoll(const wchar_t* __ws1, const wchar_t* __ws2, __locale_t __loc) {
142 return ::wcscoll_l(__ws1, __ws2, __loc);
143}
144
145inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __src, size_t __n, __locale_t __loc) {
146 return ::wcsxfrm_l(__dest, __src, __n, __loc);
147}
148# endif // _LIBCPP_HAS_WIDE_CHARACTERS
149
150inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
151 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
152 return ::strftime_l(__s, __max, __format, __tm, __loc);
153}
154
155//
156// Other functions
157//
158inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __mb_len_max(__locale_t __loc) {
159 __locale_guard __current(__loc);
160 return MB_CUR_MAX;
161}
162
163# if _LIBCPP_HAS_WIDE_CHARACTERS
164inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t __loc) {
165 __locale_guard __current(__loc);
166 return std::btowc(__c);
167}
168
169inline _LIBCPP_HIDE_FROM_ABI int __wctob(wint_t __c, __locale_t __loc) {
170 __locale_guard __current(__loc);
171 return std::wctob(__c);
172}
173
174inline _LIBCPP_HIDE_FROM_ABI size_t
175__wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t __loc) {
176 __locale_guard __current(__loc);
177 return ::wcsnrtombs(__dest, __src, __nwc, __len, __ps); // non-standard
178}
179
180inline _LIBCPP_HIDE_FROM_ABI size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t __loc) {
181 __locale_guard __current(__loc);
182 return std::wcrtomb(__s, __wc, __ps);
183}
184
185inline _LIBCPP_HIDE_FROM_ABI size_t
186__mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t __loc) {
187 __locale_guard __current(__loc);
188 return ::mbsnrtowcs(__dest, __src, __nms, __len, __ps); // non-standard
189}
190
191inline _LIBCPP_HIDE_FROM_ABI size_t
192__mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
193 __locale_guard __current(__loc);
194 return std::mbrtowc(__pwc, __s, __n, __ps);
195}
196
197inline _LIBCPP_HIDE_FROM_ABI int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t __loc) {
198 __locale_guard __current(__loc);
199 return std::mbtowc(__pwc, __pmb, __max);
200}
201
202inline _LIBCPP_HIDE_FROM_ABI size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
203 __locale_guard __current(__loc);
204 return std::mbrlen(__s, __n, __ps);
205}
206
207inline _LIBCPP_HIDE_FROM_ABI size_t
208__mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t __loc) {
209 __locale_guard __current(__loc);
210 return std::mbsrtowcs(__dest, __src, __len, __ps);
211}
212# endif // _LIBCPP_HAS_WIDE_CHARACTERS
213#endif // _LIBCPP_BUILDING_LIBRARY
214
215#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
216_LIBCPP_HIDE_FROM_ABI
217#endif
218inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf(
219 char* __s, size_t __n, __locale_t __loc, const char* __format, ...) {
220 va_list __va;
221 va_start(__va, __format);
222 __locale_guard __current(__loc);
223 int __res = std::vsnprintf(__s, __n, __format, __va);
224 va_end(__va);
225 return __res;
226}
227
228#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
229_LIBCPP_HIDE_FROM_ABI
230#endif
231inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(
232 char** __s, __locale_t __loc, const char* __format, ...) {
233 va_list __va;
234 va_start(__va, __format);
235 __locale_guard __current(__loc);
236 int __res = ::vasprintf(__s, __format, __va); // non-standard
237 va_end(__va);
238 return __res;
239}
240} // namespace __locale
241_LIBCPP_END_NAMESPACE_STD
242
243#endif // _LIBCPP___LOCALE_DIR_SUPPORT_HAIKU_H
lib/libcxx/include/__locale_dir/support/linux.h+12-3
......@@ -17,6 +17,7 @@
1717#include <cstdio>
1818#include <cstdlib>
1919#include <ctype.h>
20#include <langinfo.h>
2021#include <stdarg.h>
2122#include <string.h>
2223#include <time.h>
......@@ -148,8 +149,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __
148149}
149150# endif // _LIBCPP_HAS_WIDE_CHARACTERS
150151
151inline _LIBCPP_HIDE_FROM_ABI size_t
152__strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
152inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
153 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
153154 return strftime_l(__s, __max, __format, __tm, __loc);
154155}
155156
......@@ -211,7 +212,15 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
211212 return std::mbsrtowcs(__dest, __src, __len, __ps);
212213}
213214# endif // _LIBCPP_HAS_WIDE_CHARACTERS
214#endif // _LIBCPP_BUILDING_LIBRARY
215
216inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding([[maybe_unused]] __locale_t __loc) {
217# if defined(__ANDROID__)
218 return "UTF-8";
219# else
220 return ::nl_langinfo_l(CODESET, __loc);
221# endif
222}
223#endif // _LIBCPP_BUILDING_LIBRARY
215224
216225#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
217226_LIBCPP_HIDE_FROM_ABI
lib/libcxx/include/__locale_dir/support/newlib.h+7-2
......@@ -16,6 +16,7 @@
1616#include <cstdio>
1717#include <cstdlib>
1818#include <ctype.h>
19#include <langinfo.h>
1920#include <stdarg.h>
2021#include <string.h>
2122#include <time.h>
......@@ -76,6 +77,10 @@ inline _LIBCPP_HIDE_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc) {
7677 __locale_guard __current(__loc);
7778 return std::localeconv();
7879}
80
81inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
82 return ::nl_langinfo_l(CODESET, __loc);
83}
7984#endif // _LIBCPP_BUILDING_LIBRARY
8085
8186//
......@@ -147,8 +152,8 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __
147152}
148153# endif // _LIBCPP_HAS_WIDE_CHARACTERS
149154
150inline _LIBCPP_HIDE_FROM_ABI
151size_t __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
155inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
156 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
152157 return strftime_l(__s, __max, __format, __tm, __loc);
153158}
154159
lib/libcxx/include/__locale_dir/support/no_locale/characters.h+6-4
......@@ -16,6 +16,7 @@
1616#include <cstring>
1717#include <ctime>
1818#if _LIBCPP_HAS_WIDE_CHARACTERS
19# include <cwchar>
1920# include <cwctype>
2021#endif
2122
......@@ -23,13 +24,14 @@
2324# pragma GCC system_header
2425#endif
2526
27#if defined(_LIBCPP_BUILDING_LIBRARY)
28
2629_LIBCPP_BEGIN_NAMESPACE_STD
2730namespace __locale {
2831
2932//
3033// Character manipulation functions
3134//
32#if defined(_LIBCPP_BUILDING_LIBRARY)
3335inline _LIBCPP_HIDE_FROM_ABI int __toupper(int __c, __locale_t) { return std::toupper(__c); }
3436
3537inline _LIBCPP_HIDE_FROM_ABI int __tolower(int __c, __locale_t) { return std::tolower(__c); }
......@@ -80,13 +82,13 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __
8082}
8183# endif // _LIBCPP_HAS_WIDE_CHARACTERS
8284
83inline _LIBCPP_HIDE_FROM_ABI size_t
84__strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t) {
85inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
86 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t) {
8587 return std::strftime(__s, __max, __format, __tm);
8688}
87#endif // _LIBCPP_BUILDING_LIBRARY
8889
8990} // namespace __locale
9091_LIBCPP_END_NAMESPACE_STD
9192
93#endif // _LIBCPP_BUILDING_LIBRARY
9294#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CHARACTERS_H
lib/libcxx/include/__locale_dir/support/no_locale/conversions.h created+73
......@@ -0,0 +1,73 @@
1//===-----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H
10#define _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__std_mbstate_t.h>
15#include <cstdlib>
16#if _LIBCPP_HAS_WIDE_CHARACTERS
17# include <cwchar>
18#endif
19
20#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21# pragma GCC system_header
22#endif
23
24#if defined(_LIBCPP_BUILDING_LIBRARY)
25
26_LIBCPP_BEGIN_NAMESPACE_STD
27namespace __locale {
28
29inline _LIBCPP_HIDE_FROM_ABI decltype(MB_CUR_MAX) __mb_len_max(__locale_t) { return MB_CUR_MAX; }
30
31# if _LIBCPP_HAS_WIDE_CHARACTERS
32inline _LIBCPP_HIDE_FROM_ABI wint_t __btowc(int __c, __locale_t) { return std::btowc(__c); }
33
34inline _LIBCPP_HIDE_FROM_ABI int __wctob(wint_t __c, __locale_t) { return std::wctob(__c); }
35
36inline _LIBCPP_HIDE_FROM_ABI size_t
37__wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t) {
38 return ::wcsnrtombs(__dest, __src, __nwc, __len, __ps); // Non-standard
39}
40
41inline _LIBCPP_HIDE_FROM_ABI size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t) {
42 return std::wcrtomb(__s, __wc, __ps);
43}
44
45inline _LIBCPP_HIDE_FROM_ABI size_t
46__mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t) {
47 return ::mbsnrtowcs(__dest, __src, __nms, __len, __ps); // Non-standard
48}
49
50inline _LIBCPP_HIDE_FROM_ABI size_t
51__mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t) {
52 return std::mbrtowc(__pwc, __s, __n, __ps);
53}
54
55inline _LIBCPP_HIDE_FROM_ABI int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t) {
56 return std::mbtowc(__pwc, __pmb, __max);
57}
58
59inline _LIBCPP_HIDE_FROM_ABI size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t) {
60 return std::mbrlen(__s, __n, __ps);
61}
62
63inline _LIBCPP_HIDE_FROM_ABI size_t
64__mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t) {
65 return std::mbsrtowcs(__dest, __src, __len, __ps);
66}
67# endif // _LIBCPP_HAS_WIDE_CHARACTERS
68
69} // namespace __locale
70_LIBCPP_END_NAMESPACE_STD
71
72#endif // _LIBCPP_BUILDING_LIBRARY
73#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_CONVERSIONS_H
lib/libcxx/include/__locale_dir/support/no_locale/formatting.h created+50
......@@ -0,0 +1,50 @@
1//===-----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H
10#define _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H
11
12#include <__config>
13#include <__utility/forward.h>
14#include <cstdio>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20_LIBCPP_BEGIN_NAMESPACE_STD
21namespace __locale {
22
23_LIBCPP_DIAGNOSTIC_PUSH
24_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
25_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates
26#ifdef _LIBCPP_COMPILER_CLANG_BASED
27# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__)
28#else
29# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */
30#endif
31
32template <class... _Args>
33_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf(
34 char* __s, size_t __n, __locale_t, const char* __format, _Args&&... __args) {
35 return std::snprintf(__s, __n, __format, std::forward<_Args>(__args)...);
36}
37
38template <class... _Args>
39_LIBCPP_HIDE_FROM_ABI _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(
40 char** __s, __locale_t, const char* __format, _Args&&... __args) {
41 return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard
42}
43
44_LIBCPP_DIAGNOSTIC_POP
45#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
46
47} // namespace __locale
48_LIBCPP_END_NAMESPACE_STD
49
50#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NO_LOCALE_FORMATTING_H
lib/libcxx/include/__locale_dir/support/openbsd.h created+236
......@@ -0,0 +1,236 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
11#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
12
13#include <__config>
14#include <__cstddef/size_t.h>
15#include <__std_mbstate_t.h>
16#include <__utility/forward.h>
17#include <clocale> // std::lconv
18#include <ctype.h>
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include <time.h>
23#if _LIBCPP_HAS_WIDE_CHARACTERS
24# include <wchar.h>
25# include <wctype.h>
26#endif
27#if defined(_LIBCPP_BUILDING_LIBRARY)
28# include <langinfo.h>
29#endif
30
31#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
32# pragma GCC system_header
33#endif
34
35_LIBCPP_BEGIN_NAMESPACE_STD
36namespace __locale {
37
38struct __locale_guard {
39 __locale_guard(locale_t& __loc) : __old_loc_(::uselocale(__loc)) {}
40
41 ~__locale_guard() {
42 if (__old_loc_)
43 ::uselocale(__old_loc_);
44 }
45
46 locale_t __old_loc_;
47
48 __locale_guard(__locale_guard const&) = delete;
49 __locale_guard& operator=(__locale_guard const&) = delete;
50};
51
52//
53// Locale management
54//
55#define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
56#define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
57#define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
58#define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
59#define _LIBCPP_TIME_MASK LC_TIME_MASK
60#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
61#define _LIBCPP_ALL_MASK LC_ALL_MASK
62#define _LIBCPP_LC_ALL LC_ALL
63
64using __locale_t _LIBCPP_NODEBUG = ::locale_t;
65#if defined(_LIBCPP_BUILDING_LIBRARY)
66using __lconv_t _LIBCPP_NODEBUG = std::lconv;
67
68inline __locale_t __newlocale(int __category_mask, const char* __locale, __locale_t __base) {
69 return ::newlocale(__category_mask, __locale, __base);
70}
71
72inline void __freelocale(__locale_t __loc) { ::freelocale(__loc); }
73
74inline char* __setlocale(int __category, char const* __locale) { return ::setlocale(__category, __locale); }
75
76inline __lconv_t* __localeconv(__locale_t& __loc) {
77 __locale_guard __current(__loc);
78 return ::localeconv();
79}
80
81inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
82 return ::nl_langinfo_l(CODESET, __loc);
83}
84#endif // _LIBCPP_BUILDING_LIBRARY
85
86//
87// Strtonum functions
88//
89inline float __strtof(const char* __nptr, char** __endptr, __locale_t) { return ::strtof(__nptr, __endptr); }
90
91inline double __strtod(const char* __nptr, char** __endptr, __locale_t) { return ::strtod(__nptr, __endptr); }
92
93inline long double __strtold(const char* __nptr, char** __endptr, __locale_t) { return ::strtold(__nptr, __endptr); }
94
95//
96// Character manipulation functions
97//
98#if defined(_LIBCPP_BUILDING_LIBRARY)
99inline int __toupper(int __c, __locale_t __loc) { return ::toupper_l(__c, __loc); }
100
101inline int __tolower(int __c, __locale_t __loc) { return ::tolower_l(__c, __loc); }
102
103inline int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) { return ::strcoll_l(__s1, __s2, __loc); }
104
105inline size_t __strxfrm(char* __dest, const char* __src, size_t __n, __locale_t __loc) {
106 return ::strxfrm_l(__dest, __src, __n, __loc);
107}
108
109# if _LIBCPP_HAS_WIDE_CHARACTERS
110inline int __iswctype(wint_t __c, wctype_t __type, __locale_t __loc) { return ::iswctype_l(__c, __type, __loc); }
111
112inline int __iswspace(wint_t __c, __locale_t __loc) { return ::iswspace_l(__c, __loc); }
113
114inline int __iswprint(wint_t __c, __locale_t __loc) { return ::iswprint_l(__c, __loc); }
115
116inline int __iswcntrl(wint_t __c, __locale_t __loc) { return ::iswcntrl_l(__c, __loc); }
117
118inline int __iswupper(wint_t __c, __locale_t __loc) { return ::iswupper_l(__c, __loc); }
119
120inline int __iswlower(wint_t __c, __locale_t __loc) { return ::iswlower_l(__c, __loc); }
121
122inline int __iswalpha(wint_t __c, __locale_t __loc) { return ::iswalpha_l(__c, __loc); }
123
124inline int __iswblank(wint_t __c, __locale_t __loc) { return ::iswblank_l(__c, __loc); }
125
126inline int __iswdigit(wint_t __c, __locale_t __loc) { return ::iswdigit_l(__c, __loc); }
127
128inline int __iswpunct(wint_t __c, __locale_t __loc) { return ::iswpunct_l(__c, __loc); }
129
130inline int __iswxdigit(wint_t __c, __locale_t __loc) { return ::iswxdigit_l(__c, __loc); }
131
132inline wint_t __towupper(wint_t __c, __locale_t __loc) { return ::towupper_l(__c, __loc); }
133
134inline wint_t __towlower(wint_t __c, __locale_t __loc) { return ::towlower_l(__c, __loc); }
135
136inline int __wcscoll(const wchar_t* __ws1, const wchar_t* __ws2, __locale_t __loc) {
137 return ::wcscoll_l(__ws1, __ws2, __loc);
138}
139
140inline size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __src, size_t __n, __locale_t __loc) {
141 return ::wcsxfrm_l(__dest, __src, __n, __loc);
142}
143# endif // _LIBCPP_HAS_WIDE_CHARACTERS
144
145inline _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
146 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
147 return ::strftime_l(__s, __max, __format, __tm, __loc);
148}
149
150//
151// Other functions
152//
153inline decltype(MB_CUR_MAX) __mb_len_max(__locale_t __loc) {
154 __locale_guard __current(__loc);
155 return MB_CUR_MAX;
156}
157
158# if _LIBCPP_HAS_WIDE_CHARACTERS
159inline wint_t __btowc(int __c, __locale_t __loc) {
160 __locale_guard __current(__loc);
161 return btowc(__c);
162}
163
164inline int __wctob(wint_t __c, __locale_t __loc) {
165 __locale_guard __current(__loc);
166 return wctob(__c);
167}
168
169inline size_t
170__wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t __loc) {
171 __locale_guard __current(__loc);
172 return wcsnrtombs(__dest, __src, __nwc, __len, __ps); // wcsnrtombs is a POSIX extension
173}
174
175inline size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t __loc) {
176 __locale_guard __current(__loc);
177 return wcrtomb(__s, __wc, __ps);
178}
179
180inline size_t
181__mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t __loc) {
182 __locale_guard __current(__loc);
183 return mbsnrtowcs(__dest, __src, __nms, __len, __ps); // mbsnrtowcs is a POSIX extension
184}
185
186inline size_t __mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
187 __locale_guard __current(__loc);
188 return mbrtowc(__pwc, __s, __n, __ps);
189}
190
191inline int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t __loc) {
192 __locale_guard __current(__loc);
193 return mbtowc(__pwc, __pmb, __max);
194}
195
196inline size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
197 __locale_guard __current(__loc);
198 return mbrlen(__s, __n, __ps);
199}
200
201inline size_t __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t __loc) {
202 __locale_guard __current(__loc);
203 return mbsrtowcs(__dest, __src, __len, __ps);
204}
205# endif // _LIBCPP_HAS_WIDE_CHARACTERS
206#endif // _LIBCPP_BUILDING_LIBRARY
207
208_LIBCPP_DIAGNOSTIC_PUSH
209_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
210_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates
211#ifdef _LIBCPP_COMPILER_CLANG_BASED
212# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__)
213#else
214# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */
215#endif
216
217template <class... _Args>
218_LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 4, 5)
219int __snprintf(char* __s, size_t __n, __locale_t __loc, const char* __format, _Args&&... __args) {
220 __locale_guard __current(__loc);
221 return ::snprintf(__s, __n, __format, std::forward<_Args>(__args)...);
222}
223
224template <class... _Args>
225_LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4)
226int __asprintf(char** __s, __locale_t __loc, const char* __format, _Args&&... __args) {
227 __locale_guard __current(__loc);
228 return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard
229}
230_LIBCPP_DIAGNOSTIC_POP
231#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
232
233} // namespace __locale
234_LIBCPP_END_NAMESPACE_STD
235
236#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_OPENBSD_H
lib/libcxx/include/__locale_dir/support/serenity.h created+274
......@@ -0,0 +1,274 @@
1// zig patch: serenity support
2// -*- C++ -*-
3//===-----------------------------------------------------------------------===//
4//
5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6// See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_SERENITY_H
12#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_SERENITY_H
13
14#include <__config>
15#include <__cstddef/size_t.h>
16#include <__std_mbstate_t.h>
17#include <__utility/forward.h>
18#include <clocale> // std::lconv
19#include <ctype.h>
20#include <langinfo.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24#include <time.h>
25#if _LIBCPP_HAS_WIDE_CHARACTERS
26# include <wchar.h>
27# include <wctype.h>
28#endif
29
30#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31# pragma GCC system_header
32#endif
33
34_LIBCPP_BEGIN_NAMESPACE_STD
35namespace __locale {
36
37struct __locale_guard {
38 __locale_guard(locale_t& __loc) : __old_loc_(::uselocale(__loc)) {}
39
40 ~__locale_guard() {
41 if (__old_loc_)
42 ::uselocale(__old_loc_);
43 }
44
45 locale_t __old_loc_;
46
47 __locale_guard(__locale_guard const&) = delete;
48 __locale_guard& operator=(__locale_guard const&) = delete;
49};
50
51//
52// Locale management
53//
54#define _LIBCPP_COLLATE_MASK LC_COLLATE_MASK
55#define _LIBCPP_CTYPE_MASK LC_CTYPE_MASK
56#define _LIBCPP_MONETARY_MASK LC_MONETARY_MASK
57#define _LIBCPP_NUMERIC_MASK LC_NUMERIC_MASK
58#define _LIBCPP_TIME_MASK LC_TIME_MASK
59#define _LIBCPP_MESSAGES_MASK LC_MESSAGES_MASK
60#define _LIBCPP_ALL_MASK LC_ALL_MASK
61#define _LIBCPP_LC_ALL LC_ALL
62
63using __locale_t _LIBCPP_NODEBUG = ::locale_t;
64#if defined(_LIBCPP_BUILDING_LIBRARY)
65using __lconv_t _LIBCPP_NODEBUG = std::lconv;
66
67inline __locale_t __newlocale(int __category_mask, const char* __locale, __locale_t __base) {
68 return ::newlocale(__category_mask, __locale, __base);
69}
70
71inline void __freelocale(__locale_t __loc) { ::freelocale(__loc); }
72
73inline char* __setlocale(int __category, char const* __locale) { return ::setlocale(__category, __locale); }
74
75inline __lconv_t* __localeconv(__locale_t& __loc) {
76 __locale_guard __current(__loc);
77 return ::localeconv();
78}
79#endif // _LIBCPP_BUILDING_LIBRARY
80
81//
82// Strtonum functions
83//
84inline float __strtof(const char* __nptr, char** __endptr, __locale_t) { return ::strtof(__nptr, __endptr); }
85
86inline double __strtod(const char* __nptr, char** __endptr, __locale_t) { return ::strtod(__nptr, __endptr); }
87
88inline long double __strtold(const char* __nptr, char** __endptr, __locale_t) { return ::strtold(__nptr, __endptr); }
89
90//
91// Character manipulation functions
92//
93#if defined(_LIBCPP_BUILDING_LIBRARY)
94inline int __toupper(int __c, __locale_t __loc) {
95 __locale_guard __current(__loc);
96 return ::toupper(__c);
97}
98
99inline int __tolower(int __c, __locale_t __loc) {
100 __locale_guard __current(__loc);
101 return ::tolower(__c);
102}
103
104inline int __strcoll(const char* __s1, const char* __s2, __locale_t __loc) {
105 __locale_guard __current(__loc);
106 return ::strcoll(__s1, __s2);
107}
108
109inline size_t __strxfrm(char* __dest, const char* __src, size_t __n, __locale_t __loc) {
110 __locale_guard __current(__loc);
111 return ::strxfrm(__dest, __src, __n);
112}
113
114# if _LIBCPP_HAS_WIDE_CHARACTERS
115inline int __iswctype(wint_t __c, wctype_t __type, __locale_t __loc) {
116 __locale_guard __current(__loc);
117 return ::iswctype(__c, __type); }
118
119inline int __iswspace(wint_t __c, __locale_t __loc) {
120 __locale_guard __current(__loc);
121 return ::iswspace(__c); }
122
123inline int __iswprint(wint_t __c, __locale_t __loc) {
124 __locale_guard __current(__loc);
125 return ::iswprint(__c); }
126
127inline int __iswcntrl(wint_t __c, __locale_t __loc) {
128 __locale_guard __current(__loc);
129 return ::iswcntrl(__c); }
130
131inline int __iswupper(wint_t __c, __locale_t __loc) {
132 __locale_guard __current(__loc);
133 return ::iswupper(__c); }
134
135inline int __iswlower(wint_t __c, __locale_t __loc) {
136 __locale_guard __current(__loc);
137 return ::iswlower(__c); }
138
139inline int __iswalpha(wint_t __c, __locale_t __loc) {
140 __locale_guard __current(__loc);
141 return ::iswalpha(__c); }
142
143inline int __iswblank(wint_t __c, __locale_t __loc) {
144 __locale_guard __current(__loc);
145 return ::iswblank(__c); }
146
147inline int __iswdigit(wint_t __c, __locale_t __loc) {
148 __locale_guard __current(__loc);
149 return ::iswdigit(__c); }
150
151inline int __iswpunct(wint_t __c, __locale_t __loc) {
152 __locale_guard __current(__loc);
153 return ::iswpunct(__c); }
154
155inline int __iswxdigit(wint_t __c, __locale_t __loc) {
156 __locale_guard __current(__loc);
157 return ::iswxdigit(__c); }
158
159inline wint_t __towupper(wint_t __c, __locale_t __loc) {
160 __locale_guard __current(__loc);
161 return ::towupper(__c); }
162
163inline wint_t __towlower(wint_t __c, __locale_t __loc) {
164 __locale_guard __current(__loc);
165 return ::towlower(__c); }
166
167inline int __wcscoll(const wchar_t* __ws1, const wchar_t* __ws2, __locale_t __loc) {
168 __locale_guard __current(__loc);
169 return ::wcscoll(__ws1, __ws2);
170}
171
172inline size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __src, size_t __n, __locale_t __loc) {
173 __locale_guard __current(__loc);
174 return ::wcsxfrm(__dest, __src, __n);
175}
176# endif // _LIBCPP_HAS_WIDE_CHARACTERS
177
178inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
179 return ::nl_langinfo_l(CODESET, __loc);
180}
181
182inline _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
183 __strftime(char* __s, size_t __max, const char* __format, const struct tm* __tm, __locale_t __loc) {
184 __locale_guard __current(__loc);
185 return ::strftime(__s, __max, __format, __tm);
186}
187
188//
189// Other functions
190//
191inline decltype(MB_CUR_MAX) __mb_len_max(__locale_t __loc) {
192 __locale_guard __current(__loc);
193 return MB_CUR_MAX;
194}
195
196# if _LIBCPP_HAS_WIDE_CHARACTERS
197inline wint_t __btowc(int __c, __locale_t __loc) {
198 __locale_guard __current(__loc);
199 return btowc(__c);
200}
201
202inline int __wctob(wint_t __c, __locale_t __loc) {
203 __locale_guard __current(__loc);
204 return wctob(__c);
205}
206
207inline size_t
208__wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t __loc) {
209 __locale_guard __current(__loc);
210 return wcsnrtombs(__dest, __src, __nwc, __len, __ps); // wcsnrtombs is a POSIX extension
211}
212
213inline size_t __wcrtomb(char* __s, wchar_t __wc, mbstate_t* __ps, __locale_t __loc) {
214 __locale_guard __current(__loc);
215 return wcrtomb(__s, __wc, __ps);
216}
217
218inline size_t
219__mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t __loc) {
220 __locale_guard __current(__loc);
221 return mbsnrtowcs(__dest, __src, __nms, __len, __ps); // mbsnrtowcs is a POSIX extension
222}
223
224inline size_t __mbrtowc(wchar_t* __pwc, const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
225 __locale_guard __current(__loc);
226 return mbrtowc(__pwc, __s, __n, __ps);
227}
228
229inline int __mbtowc(wchar_t* __pwc, const char* __pmb, size_t __max, __locale_t __loc) {
230 __locale_guard __current(__loc);
231 return mbtowc(__pwc, __pmb, __max);
232}
233
234inline size_t __mbrlen(const char* __s, size_t __n, mbstate_t* __ps, __locale_t __loc) {
235 __locale_guard __current(__loc);
236 return mbrlen(__s, __n, __ps);
237}
238
239inline size_t __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps, __locale_t __loc) {
240 __locale_guard __current(__loc);
241 return mbsrtowcs(__dest, __src, __len, __ps);
242}
243# endif // _LIBCPP_HAS_WIDE_CHARACTERS
244#endif // _LIBCPP_BUILDING_LIBRARY
245
246_LIBCPP_DIAGNOSTIC_PUSH
247_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
248_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") // GCC doesn't support [[gnu::format]] on variadic templates
249#ifdef _LIBCPP_COMPILER_CLANG_BASED
250# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) _LIBCPP_ATTRIBUTE_FORMAT(__VA_ARGS__)
251#else
252# define _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(...) /* nothing */
253#endif
254
255template <class... _Args>
256_LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 4, 5)
257int __snprintf(char* __s, size_t __n, __locale_t __loc, const char* __format, _Args&&... __args) {
258 __locale_guard __current(__loc);
259 return ::snprintf(__s, __n, __format, std::forward<_Args>(__args)...);
260}
261
262template <class... _Args>
263_LIBCPP_VARIADIC_ATTRIBUTE_FORMAT(__printf__, 3, 4)
264int __asprintf(char** __s, __locale_t __loc, const char* __format, _Args&&... __args) {
265 __locale_guard __current(__loc);
266 return ::asprintf(__s, __format, std::forward<_Args>(__args)...); // non-standard
267}
268_LIBCPP_DIAGNOSTIC_POP
269#undef _LIBCPP_VARIADIC_ATTRIBUTE_FORMAT
270
271} // namespace __locale
272_LIBCPP_END_NAMESPACE_STD
273
274#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_SERENITY_H
lib/libcxx/include/__locale_dir/support/windows.h+7-3
......@@ -27,6 +27,7 @@
2727#endif
2828
2929_LIBCPP_BEGIN_NAMESPACE_STD
30_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3031namespace __locale {
3132
3233using __lconv_t _LIBCPP_NODEBUG = std::lconv;
......@@ -163,6 +164,7 @@ inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, const char* __loc
163164 return __new_locale;
164165}
165166_LIBCPP_EXPORTED_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc);
167_LIBCPP_EXPORTED_FROM_ABI const char* __get_locale_encoding(__locale_t __loc);
166168#endif // _LIBCPP_BUILDING_LIBRARY
167169
168170//
......@@ -230,10 +232,11 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __wcsxfrm(wchar_t* __dest, const wchar_t* __
230232# endif // _LIBCPP_HAS_WIDE_CHARACTERS
231233
232234# if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
233_LIBCPP_EXPORTED_FROM_ABI size_t __strftime(char*, size_t, const char*, const struct tm*, __locale_t);
235_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
236 __strftime(char*, size_t, const char*, const struct tm*, __locale_t);
234237# else
235inline _LIBCPP_HIDE_FROM_ABI size_t
236__strftime(char* __ret, size_t __n, const char* __format, const struct tm* __tm, __locale_t __loc) {
238inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__strftime__, 3, 0) size_t
239 __strftime(char* __ret, size_t __n, const char* __format, const struct tm* __tm, __locale_t __loc) {
237240 return ::_strftime_l(__ret, __n, __format, __tm, __loc);
238241}
239242# endif
......@@ -303,6 +306,7 @@ struct __locale_guard {
303306#endif // _LIBCPP_BUILDING_LIBRARY
304307
305308} // namespace __locale
309_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
306310_LIBCPP_END_NAMESPACE_STD
307311
308312#endif // _LIBCPP___LOCALE_DIR_SUPPORT_WINDOWS_H
lib/libcxx/include/__locale_dir/time.h+2
......@@ -22,6 +22,7 @@
2222# endif
2323
2424_LIBCPP_BEGIN_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
2627template <class _CharT, class _InputIterator>
2728_LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits(
......@@ -755,6 +756,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>;
755756extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>;
756757# endif
757758
759_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
758760_LIBCPP_END_NAMESPACE_STD
759761
760762#endif // _LIBCPP_HAS_LOCALIZATION
lib/libcxx/include/__locale_dir/wbuffer_convert.h+4-2
......@@ -27,6 +27,7 @@ _LIBCPP_PUSH_MACROS
2727# include <__undef_macros>
2828
2929_LIBCPP_BEGIN_NAMESPACE_STD
30_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3031
3132template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
3233class _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> {
......@@ -67,7 +68,7 @@ public:
6768
6869 _LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
6970
70 _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; }
71 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf() const { return __bufptr_; }
7172 _LIBCPP_HIDE_FROM_ABI streambuf* rdbuf(streambuf* __bytebuf) {
7273 streambuf* __r = __bufptr_;
7374 __bufptr_ = __bytebuf;
......@@ -77,7 +78,7 @@ public:
7778 wbuffer_convert(const wbuffer_convert&) = delete;
7879 wbuffer_convert& operator=(const wbuffer_convert&) = delete;
7980
80 _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
8182
8283protected:
8384 _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual int_type underflow();
......@@ -419,6 +420,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__
419420
420421_LIBCPP_SUPPRESS_DEPRECATED_POP
421422
423_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
422424_LIBCPP_END_NAMESPACE_STD
423425
424426_LIBCPP_POP_MACROS
lib/libcxx/include/__locale_dir/wstring_convert.h+14-10
......@@ -64,28 +64,30 @@ public:
6464 wstring_convert(const wstring_convert& __wc) = delete;
6565 wstring_convert& operator=(const wstring_convert& __wc) = delete;
6666
67 _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
68 _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
67 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) {
68 return from_bytes(&__byte, &__byte + 1);
69 }
70 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
6971 return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
7072 }
71 _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) {
73 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const byte_string& __str) {
7274 return from_bytes(__str.data(), __str.data() + __str.size());
7375 }
74 _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __first, const char* __last);
7577
76 _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) {
78 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(_Elem __wchar) {
7779 return to_bytes(std::addressof(__wchar), std::addressof(__wchar) + 1);
7880 }
79 _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) {
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __wptr) {
8082 return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));
8183 }
82 _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) {
84 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const wide_string& __wstr) {
8385 return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());
8486 }
85 _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI byte_string to_bytes(const _Elem* __first, const _Elem* __last);
8688
87 _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; }
88 _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t converted() const _NOEXCEPT { return __cvtcount_; }
90 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI state_type state() const { return __cvtstate_; }
8991};
9092
9193_LIBCPP_SUPPRESS_DEPRECATED_PUSH
......@@ -174,9 +176,11 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char*
174176 return __wide_err_string_;
175177}
176178
179_LIBCPP_SUPPRESS_DEPRECATED_PUSH
177180template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
178181typename wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::byte_string
179182wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* __frm, const _Elem* __frm_end) {
183 _LIBCPP_SUPPRESS_DEPRECATED_POP
180184 __cvtcount_ = 0;
181185 if (__cvtptr_ != nullptr) {
182186 byte_string __bs(2 * (__frm_end - __frm), char());
lib/libcxx/include/__log_hardening_failure+2
......@@ -24,7 +24,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2424
2525// This function should never be called directly from the code -- it should only be called through the
2626// `_LIBCPP_LOG_HARDENING_FAILURE` macro.
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728[[__gnu__::__cold__]] _LIBCPP_EXPORTED_FROM_ABI void __log_hardening_failure(const char* __message) noexcept;
29_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2830
2931// _LIBCPP_LOG_HARDENING_FAILURE(message)
3032//
lib/libcxx/include/__math/abs.h+13
......@@ -63,6 +63,19 @@ template <class = int>
6363 return __builtin_llabs(__x);
6464}
6565
66#if _LIBCPP_HAS_INT128
67[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI inline __int128_t abs(__int128_t __x) _NOEXCEPT { return __x < 0 ? -__x : __x; }
68#endif
69
70#if defined(__BITINT_MAXWIDTH__)
71// _BitInt does not integer-promote, so without a same-type overload a narrow
72// signed _BitInt would be an ambiguous call against abs(int/long/long long).
73template <int _Np>
74[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _BitInt(_Np) abs(_BitInt(_Np) __x) _NOEXCEPT {
75 return __x < 0 ? -__x : __x;
76}
77#endif
78
6679} // namespace __math
6780
6881_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__math/gamma.h+28
......@@ -55,6 +55,34 @@ inline _LIBCPP_HIDE_FROM_ABI double tgamma(_A1 __x) _NOEXCEPT {
5555 return __builtin_tgamma((double)__x);
5656}
5757
58// __lgamma_r
59//
60// POSIX systems provide a function named lgamma_r which is a reentrant version of lgamma. Use that
61// whenever possible. However, we avoid re-declaring the actual function since different platforms
62// declare it differently in the first place: instead use `asm` to get the compiler to call the right
63// function.
64
65#if defined(_LIBCPP_MSVCRT_LIKE) // reentrant version is not available on Windows
66
67inline _LIBCPP_HIDE_FROM_ABI double __lgamma_r(double __d) _NOEXCEPT { return __builtin_lgamma(__d); }
68
69#else
70
71_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
72# if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
73double __lgamma_r_shim(double, int*) _NOEXCEPT __asm__("_lgamma_r");
74# else
75double __lgamma_r_shim(double, int*) _NOEXCEPT __asm__("lgamma_r");
76# endif
77_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
78
79inline _LIBCPP_HIDE_FROM_ABI double __lgamma_r(double __d) _NOEXCEPT {
80 int __sign;
81 return __math::__lgamma_r_shim(__d, &__sign);
82}
83
84#endif
85
5886} // namespace __math
5987
6088_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__math/special_functions.h+5-5
......@@ -21,10 +21,10 @@
2121# pragma GCC system_header
2222#endif
2323
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2624#if _LIBCPP_STD_VER >= 17
2725
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2828template <class _Real>
2929_LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) {
3030 // The Hermite polynomial H_n(x).
......@@ -49,7 +49,7 @@ _LIBCPP_HIDE_FROM_ABI _Real __hermite(unsigned __n, _Real __x) {
4949 }
5050
5151 if (!__math::isfinite(__H_n)) {
52 // Overflow occured. Two possible cases:
52 // Overflow occurred. Two possible cases:
5353 // n is odd: return infinity of the same sign as x.
5454 // n is even: return +Inf
5555 _Real __inf = std::numeric_limits<_Real>::infinity();
......@@ -77,8 +77,8 @@ _LIBCPP_HIDE_FROM_ABI double hermite(unsigned __n, _Integer __x) {
7777 return std::hermite(__n, static_cast<double>(__x));
7878}
7979
80#endif // _LIBCPP_STD_VER >= 17
81
8280_LIBCPP_END_NAMESPACE_STD
8381
82#endif // _LIBCPP_STD_VER >= 17
83
8484#endif // _LIBCPP___MATH_SPECIAL_FUNCTIONS_H
lib/libcxx/include/__mbstate_t.h+4
......@@ -39,10 +39,14 @@
3939# define __NEED_mbstate_t
4040# include <bits/alltypes.h>
4141# undef __NEED_mbstate_t
42#elif _LIBCPP_LIBC_LLVM_LIBC
43# include <llvm-libc-types/mbstate_t.h>
4244#elif __has_include(<bits/types/mbstate_t.h>)
4345# include <bits/types/mbstate_t.h> // works on most Unixes
4446#elif __has_include(<sys/_types/_mbstate_t.h>)
4547# include <sys/_types/_mbstate_t.h> // works on Darwin
48#elif __has_include(<bits/mbstate_t.h>)
49# include <bits/mbstate_t.h> // works for Android
4650#elif __has_include_next(<wchar.h>)
4751# include_next <wchar.h> // use the C standard provider of mbstate_t if present
4852#elif __has_include_next(<uchar.h>)
lib/libcxx/include/__mdspan/aligned_accessor.h+4-4
......@@ -33,10 +33,10 @@
3333_LIBCPP_PUSH_MACROS
3434#include <__undef_macros>
3535
36_LIBCPP_BEGIN_NAMESPACE_STD
37
3836#if _LIBCPP_STD_VER >= 26
3937
38_LIBCPP_BEGIN_NAMESPACE_STD
39
4040template <class _ElementType, size_t _ByteAlignment>
4141struct aligned_accessor {
4242 static_assert(_ByteAlignment != 0 && (_ByteAlignment & (_ByteAlignment - 1)) == 0,
......@@ -78,10 +78,10 @@ struct aligned_accessor {
7878 }
7979};
8080
81#endif // _LIBCPP_STD_VER >= 26
82
8381_LIBCPP_END_NAMESPACE_STD
8482
83#endif // _LIBCPP_STD_VER >= 26
84
8585_LIBCPP_POP_MACROS
8686
8787#endif // _LIBCPP___MDSPAN_ALIGNED_ACCESSOR_H
lib/libcxx/include/__mdspan/extents.h+76-81
......@@ -21,12 +21,16 @@
2121#include <__config>
2222
2323#include <__concepts/arithmetic.h>
24#include <__concepts/same_as.h>
2425#include <__type_traits/common_type.h>
2526#include <__type_traits/integer_traits.h>
2627#include <__type_traits/is_convertible.h>
2728#include <__type_traits/is_nothrow_constructible.h>
2829#include <__type_traits/is_signed.h>
2930#include <__type_traits/make_unsigned.h>
31#include <__type_traits/remove_cvref.h>
32#include <__utility/as_const.h>
33#include <__utility/forward.h>
3034#include <__utility/integer_sequence.h>
3135#include <__utility/unreachable.h>
3236#include <array>
......@@ -46,25 +50,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4650#if _LIBCPP_STD_VER >= 23
4751
4852namespace __mdspan_detail {
49
50// ------------------------------------------------------------------
51// ------------ __static_array --------------------------------------
52// ------------------------------------------------------------------
53// array like class which provides an array of static values with get
54template <class _Tp, _Tp... _Values>
55struct __static_array {
56 static constexpr array<_Tp, sizeof...(_Values)> __array = {_Values...};
57
58public:
59 _LIBCPP_HIDE_FROM_ABI static constexpr size_t __size() { return sizeof...(_Values); }
60 _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get(size_t __index) noexcept { return __array[__index]; }
61
62 template <size_t _Index>
63 _LIBCPP_HIDE_FROM_ABI static constexpr _Tp __get() {
64 return __get(_Index);
65 }
66};
67
6853// ------------------------------------------------------------------
6954// ------------ __possibly_empty_array -----------------------------
7055// ------------------------------------------------------------------
......@@ -117,35 +102,28 @@ struct __static_partial_sums {
117102// array like class which has a mix of static and runtime values but
118103// only stores the runtime values.
119104// The type of the static and the runtime values can be different.
120// The position of a dynamic value is indicated through a tag value.
121template <class _TDynamic, class _TStatic, _TStatic _DynTag, _TStatic... _Values>
105// The position of a dynamic value is indicated by dynamic_extent.
106template <class _TDynamic, class _TStatic, _TStatic... _Values>
122107struct __maybe_static_array {
123 static_assert(is_convertible<_TStatic, _TDynamic>::value,
108 static_assert(is_convertible_v<_TStatic, _TDynamic>,
124109 "__maybe_static_array: _TStatic must be convertible to _TDynamic");
125 static_assert(is_convertible<_TDynamic, _TStatic>::value,
110 static_assert(is_convertible_v<_TDynamic, _TStatic>,
126111 "__maybe_static_array: _TDynamic must be convertible to _TStatic");
127112
128113private:
129114 // Static values member
130115 static constexpr size_t __size_ = sizeof...(_Values);
131 static constexpr size_t __size_dynamic_ = ((_Values == _DynTag) + ... + 0);
132 using _StaticValues _LIBCPP_NODEBUG = __static_array<_TStatic, _Values...>;
116 static constexpr size_t __size_dynamic_ = ((_Values == dynamic_extent) + ... + 0);
133117 using _DynamicValues _LIBCPP_NODEBUG = __possibly_empty_array<_TDynamic, __size_dynamic_>;
134118
135 // Dynamic values member
119 static constexpr array<_TStatic, sizeof...(_Values)> __static_values_ = {_Values...};
136120 _LIBCPP_NO_UNIQUE_ADDRESS _DynamicValues __dyn_vals_;
137121
138122 // static mapping of indices to the position in the dynamic values array
139 using _DynamicIdxMap _LIBCPP_NODEBUG = __static_partial_sums<static_cast<size_t>(_Values == _DynTag)...>;
140
141 template <size_t... _Indices>
142 _LIBCPP_HIDE_FROM_ABI static constexpr _DynamicValues __zeros(index_sequence<_Indices...>) noexcept {
143 return _DynamicValues{((void)_Indices, 0)...};
144 }
123 using _DynamicIdxMap _LIBCPP_NODEBUG = __static_partial_sums<static_cast<size_t>(_Values == dynamic_extent)...>;
145124
146125public:
147 _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array() noexcept
148 : __dyn_vals_{__zeros(make_index_sequence<__size_dynamic_>())} {}
126 _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array() noexcept : __dyn_vals_{} {}
149127
150128 // constructors from dynamic values only -- this covers the case for rank() == 0
151129 template <class... _DynVals>
......@@ -169,8 +147,8 @@ public:
169147 static_assert(sizeof...(_DynVals) == __size_, "Invalid number of values.");
170148 _TDynamic __values[__size_] = {static_cast<_TDynamic>(__vals)...};
171149 for (size_t __i = 0; __i < __size_; __i++) {
172 _TStatic __static_val = _StaticValues::__get(__i);
173 if (__static_val == _DynTag) {
150 _TStatic __static_val = __static_values_[__i];
151 if (__static_val == dynamic_extent) {
174152 __dyn_vals_[_DynamicIdxMap::__get(__i)] = __values[__i];
175153 } else
176154 // Not catching this could lead to out of bounds errors later
......@@ -188,8 +166,8 @@ public:
188166 _LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(const span<_Tp, _Size>& __vals) {
189167 static_assert(_Size == __size_ || __size_ == dynamic_extent);
190168 for (size_t __i = 0; __i < __size_; __i++) {
191 _TStatic __static_val = _StaticValues::__get(__i);
192 if (__static_val == _DynTag) {
169 _TStatic __static_val = __static_values_[__i];
170 if (__static_val == dynamic_extent) {
193171 __dyn_vals_[_DynamicIdxMap::__get(__i)] = static_cast<_TDynamic>(__vals[__i]);
194172 } else
195173 // Not catching this could lead to out of bounds errors later
......@@ -205,13 +183,15 @@ public:
205183 // access functions
206184 _LIBCPP_HIDE_FROM_ABI static constexpr _TStatic __static_value(size_t __i) noexcept {
207185 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
208 return _StaticValues::__get(__i);
186 return __static_values_[__i];
209187 }
210188
211189 _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic __value(size_t __i) const {
212190 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
213 _TStatic __static_val = _StaticValues::__get(__i);
214 return __static_val == _DynTag ? __dyn_vals_[_DynamicIdxMap::__get(__i)] : static_cast<_TDynamic>(__static_val);
191 _TStatic __static_val = __static_values_[__i];
192 return __static_val == dynamic_extent
193 ? __dyn_vals_[_DynamicIdxMap::__get(__i)]
194 : static_cast<_TDynamic>(__static_val);
215195 }
216196 _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic operator[](size_t __i) const {
217197 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < __size_, "extents access: index must be less than rank");
......@@ -252,19 +232,6 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_representable_as(_From __value) {
252232 return true;
253233}
254234
255template <integral _To, class... _From>
256_LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(_From... __values) {
257 return (__mdspan_detail::__is_representable_as<_To>(__values) && ... && true);
258}
259
260template <integral _To, class _From, size_t _Size>
261_LIBCPP_HIDE_FROM_ABI constexpr bool __are_representable_as(span<_From, _Size> __values) {
262 for (size_t __i = 0; __i < _Size; __i++)
263 if (!__mdspan_detail::__is_representable_as<_To>(__values[__i]))
264 return false;
265 return true;
266}
267
268235} // namespace __mdspan_detail
269236
270237// ------------------------------------------------------------------
......@@ -293,10 +260,45 @@ private:
293260 static constexpr rank_type __rank_dynamic_ = ((_Extents == dynamic_extent) + ... + 0);
294261
295262 // internal storage type using __maybe_static_array
296 using _Values _LIBCPP_NODEBUG =
297 __mdspan_detail::__maybe_static_array<_IndexType, size_t, dynamic_extent, _Extents...>;
263 using _Values _LIBCPP_NODEBUG = __mdspan_detail::__maybe_static_array<_IndexType, size_t, _Extents...>;
298264 [[no_unique_address]] _Values __vals_;
299265
266 template <class _OtherIndexType>
267 _LIBCPP_HIDE_FROM_ABI static constexpr index_type __checked_index_cast(_OtherIndexType&& __value) noexcept {
268 using _OtherType = remove_cvref_t<_OtherIndexType>;
269 if constexpr (integral<_OtherType> && !same_as<_OtherType, bool>) {
270 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
271 __mdspan_detail::__is_representable_as<index_type>(__value),
272 "extents ctor: arguments must be representable as index_type and nonnegative");
273 return static_cast<index_type>(__value);
274 } else {
275 auto __converted_val = static_cast<index_type>(std::forward<_OtherIndexType>(__value));
276 if constexpr (is_signed_v<index_type>) {
277 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
278 __converted_val >= 0, "extents ctor: arguments must be representable as index_type and nonnegative");
279 }
280 return __converted_val;
281 }
282 }
283
284 template <class... _OtherIndexTypes>
285 _LIBCPP_HIDE_FROM_ABI static constexpr _Values
286 __representability_checked_cast(_OtherIndexTypes&&... __values) noexcept {
287 return _Values{__checked_index_cast(std::forward<_OtherIndexTypes>(__values))...};
288 }
289
290 template <class _OtherIndexType, size_t _Size, size_t... _Idxs>
291 _LIBCPP_HIDE_FROM_ABI static constexpr _Values
292 __representability_checked_cast(const array<_OtherIndexType, _Size>& __exts, index_sequence<_Idxs...>) noexcept {
293 return __representability_checked_cast(__exts[_Idxs]...);
294 }
295
296 template <class _OtherIndexType, size_t _Size, size_t... _Idxs>
297 _LIBCPP_HIDE_FROM_ABI static constexpr _Values
298 __representability_checked_cast(const span<_OtherIndexType, _Size>& __exts, index_sequence<_Idxs...>) noexcept {
299 return __representability_checked_cast(std::as_const(__exts[_Idxs])...);
300 }
301
300302public:
301303 // [mdspan.extents.obs], observers of multidimensional index space
302304 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return __rank_; }
......@@ -319,12 +321,9 @@ public:
319321 (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
320322 (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_))
321323 _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept
322 : __vals_(static_cast<index_type>(__dynvals)...) {
323 // Not catching this could lead to out of bounds errors later
324 // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m
325 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__dynvals...),
326 "extents ctor: arguments must be representable as index_type and nonnegative");
327 }
324 // Not catching this could lead to out of bounds errors later
325 // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m
326 : __vals_(__representability_checked_cast(std::move(__dynvals)...)) {}
328327
329328 template <class _OtherIndexType, size_t _Size>
330329 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
......@@ -332,12 +331,9 @@ public:
332331 (_Size == __rank_ || _Size == __rank_dynamic_))
333332 explicit(_Size != __rank_dynamic_)
334333 _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept
335 : __vals_(span(__exts)) {
336 // Not catching this could lead to out of bounds errors later
337 // e.g. mdspan m(ptr, dextents<char, 1>(array<unsigned,1>(200))); leads to an extent of -56 on m
338 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(span(__exts)),
339 "extents ctor: arguments must be representable as index_type and nonnegative");
340 }
334 // Not catching this could lead to out of bounds errors later
335 // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m
336 : __vals_(__representability_checked_cast(__exts, make_index_sequence<_Size>())) {}
341337
342338 template <class _OtherIndexType, size_t _Size>
343339 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
......@@ -345,13 +341,9 @@ public:
345341 (_Size == __rank_ || _Size == __rank_dynamic_))
346342 explicit(_Size != __rank_dynamic_)
347343 _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept
348 : __vals_(__exts) {
349 // Not catching this could lead to out of bounds errors later
350 // e.g. array a{200u}; mdspan<int, dextents<char,1>> m(ptr, extents(span<unsigned,1>(a))); leads to an extent of -56
351 // on m
352 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as<index_type>(__exts),
353 "extents ctor: arguments must be representable as index_type and nonnegative");
354 }
344 // Not catching this could lead to out of bounds errors later
345 // e.g. mdspan m(ptr, dextents<char, 1>(200u)); leads to an extent of -56 on m
346 : __vals_(__representability_checked_cast(__exts, make_index_sequence<_Size>())) {}
355347
356348private:
357349 // Function to construct extents storage from other extents.
......@@ -433,6 +425,15 @@ public:
433425 }
434426 return true;
435427 }
428
429 template <class _OtherIndexType>
430 _LIBCPP_HIDE_FROM_ABI static constexpr auto __index_cast(_OtherIndexType&& __i) noexcept {
431 using _OtherIndex = remove_cvref_t<_OtherIndexType>;
432 if constexpr (integral<_OtherIndex> && !same_as<_OtherIndex, bool>)
433 return __i;
434 else
435 return static_cast<index_type>(std::forward<_OtherIndexType>(__i));
436 }
436437};
437438
438439// Recursive helper classes to implement dextents alias for extents
......@@ -465,15 +466,9 @@ using dims = dextents<_IndexType, _Rank>;
465466# endif
466467
467468// Deduction guide for extents
468# if _LIBCPP_STD_VER >= 26
469469template <class... _IndexTypes>
470470 requires(is_convertible_v<_IndexTypes, size_t> && ...)
471471explicit extents(_IndexTypes...) -> extents<size_t, __maybe_static_ext<_IndexTypes>...>;
472# else
473template <class... _IndexTypes>
474 requires(is_convertible_v<_IndexTypes, size_t> && ...)
475explicit extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;
476# endif
477472
478473namespace __mdspan_detail {
479474
lib/libcxx/include/__mdspan/layout_left.h+3-3
......@@ -47,9 +47,9 @@ public:
4747 "layout_left::mapping template argument must be a specialization of extents.");
4848
4949 using extents_type = _Extents;
50 using index_type = typename extents_type::index_type;
51 using size_type = typename extents_type::size_type;
52 using rank_type = typename extents_type::rank_type;
50 using index_type = extents_type::index_type;
51 using size_type = extents_type::size_type;
52 using rank_type = extents_type::rank_type;
5353 using layout_type = layout_left;
5454
5555private:
lib/libcxx/include/__mdspan/layout_right.h+3-3
......@@ -47,9 +47,9 @@ public:
4747 "layout_right::mapping template argument must be a specialization of extents.");
4848
4949 using extents_type = _Extents;
50 using index_type = typename extents_type::index_type;
51 using size_type = typename extents_type::size_type;
52 using rank_type = typename extents_type::rank_type;
50 using index_type = extents_type::index_type;
51 using size_type = extents_type::size_type;
52 using rank_type = extents_type::rank_type;
5353 using layout_type = layout_right;
5454
5555private:
lib/libcxx/include/__mdspan/layout_stride.h+18-30
......@@ -72,9 +72,9 @@ public:
7272 "layout_stride::mapping template argument must be a specialization of extents.");
7373
7474 using extents_type = _Extents;
75 using index_type = typename extents_type::index_type;
76 using size_type = typename extents_type::size_type;
77 using rank_type = typename extents_type::rank_type;
75 using index_type = extents_type::index_type;
76 using size_type = extents_type::size_type;
77 using rank_type = extents_type::rank_type;
7878 using layout_type = layout_stride;
7979
8080private:
......@@ -296,38 +296,26 @@ public:
296296 }
297297
298298 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept { return true; }
299 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept { return false; }
299 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept {
300 if constexpr (__rank_ == 0)
301 return true;
302 for (size_t __r = 0; __r < __rank_; ++__r)
303 if (extents_type::static_extent(__r) == 0)
304 return true;
305 return false;
306 }
300307 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept { return true; }
301308
302309 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_unique() noexcept { return true; }
303 // The answer of this function is fairly complex in the case where one or more
304 // extents are zero.
305 // Technically it is meaningless to query is_exhaustive() in that case, but unfortunately
306 // the way the standard defines this function, we can't give a simple true or false then.
307310 _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const noexcept {
308 if constexpr (__rank_ == 0)
311 if constexpr (is_always_exhaustive())
309312 return true;
310 else {
311 index_type __span_size = required_span_size();
312 if (__span_size == static_cast<index_type>(0)) {
313 if constexpr (__rank_ == 1)
314 return __strides_[0] == 1;
315 else {
316 rank_type __r_largest = 0;
317 for (rank_type __r = 1; __r < __rank_; __r++)
318 if (__strides_[__r] > __strides_[__r_largest])
319 __r_largest = __r;
320 for (rank_type __r = 0; __r < __rank_; __r++)
321 if (__extents_.extent(__r) == 0 && __r != __r_largest)
322 return false;
323 return true;
324 }
325 } else {
326 return required_span_size() == [&]<size_t... _Pos>(index_sequence<_Pos...>) {
327 return (__extents_.extent(_Pos) * ... * static_cast<index_type>(1));
328 }(make_index_sequence<__rank_>());
329 }
330 }
313 index_type __span_size = required_span_size();
314 if (__span_size == static_cast<index_type>(0))
315 return true;
316 return __span_size == [&]<size_t... _Pos>(index_sequence<_Pos...>) {
317 return (__extents_.extent(_Pos) * ... * static_cast<index_type>(1));
318 }(make_index_sequence<__rank_>());
331319 }
332320 _LIBCPP_HIDE_FROM_ABI static constexpr bool is_strided() noexcept { return true; }
333321
lib/libcxx/include/__mdspan/mdspan.h+55-21
......@@ -30,6 +30,7 @@
3030#include <__type_traits/is_constructible.h>
3131#include <__type_traits/is_convertible.h>
3232#include <__type_traits/is_nothrow_constructible.h>
33#include <__type_traits/is_object.h>
3334#include <__type_traits/is_pointer.h>
3435#include <__type_traits/is_same.h>
3536#include <__type_traits/rank.h>
......@@ -37,9 +38,11 @@
3738#include <__type_traits/remove_cv.h>
3839#include <__type_traits/remove_pointer.h>
3940#include <__type_traits/remove_reference.h>
41#include <__utility/as_const.h>
4042#include <__utility/integer_sequence.h>
4143#include <array>
4244#include <span>
45#include <stdexcept>
4346
4447#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4548# pragma GCC system_header
......@@ -66,6 +69,9 @@ class mdspan {
6669private:
6770 static_assert(__mdspan_detail::__is_extents_v<_Extents>,
6871 "mdspan: Extents template parameter must be a specialization of extents.");
72 static_assert(
73 is_object_v<_ElementType> && requires { sizeof(_ElementType); },
74 "mdspan: ElementType template parameter must be a complete object type");
6975 static_assert(!is_array_v<_ElementType>, "mdspan: ElementType template parameter may not be an array type");
7076 static_assert(!is_abstract_v<_ElementType>, "mdspan: ElementType template parameter may not be an abstract class");
7177 static_assert(is_same_v<_ElementType, typename _AccessorPolicy::element_type>,
......@@ -78,14 +84,14 @@ public:
7884 using extents_type = _Extents;
7985 using layout_type = _LayoutPolicy;
8086 using accessor_type = _AccessorPolicy;
81 using mapping_type = typename layout_type::template mapping<extents_type>;
87 using mapping_type = layout_type::template mapping<extents_type>;
8288 using element_type = _ElementType;
8389 using value_type = remove_cv_t<element_type>;
84 using index_type = typename extents_type::index_type;
85 using size_type = typename extents_type::size_type;
86 using rank_type = typename extents_type::rank_type;
87 using data_handle_type = typename accessor_type::data_handle_type;
88 using reference = typename accessor_type::reference;
90 using index_type = extents_type::index_type;
91 using size_type = extents_type::size_type;
92 using rank_type = extents_type::rank_type;
93 using data_handle_type = accessor_type::data_handle_type;
94 using reference = accessor_type::reference;
8995
9096 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank() noexcept { return extents_type::rank(); }
9197 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr rank_type rank_dynamic() noexcept {
......@@ -187,11 +193,11 @@ public:
187193 (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
188194 (sizeof...(_OtherIndexTypes) == rank()))
189195 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const {
190 // Note the standard layouts would also check this, but user provided ones may not, so we
191 // check the precondition here
192 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...),
193 "mdspan: operator[] out of bounds access");
194 return __acc_.access(__ptr_, __map_(static_cast<index_type>(std::move(__indices))...));
196 return [&]<class... _IndexTypes>(_IndexTypes... __idxs) -> reference {
197 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __idxs...),
198 "mdspan: operator[] out of bounds access");
199 return __acc_.access(__ptr_, __map_(static_cast<index_type>(std::move(__idxs))...));
200 }(extents_type::__index_cast(std::move(__indices))...);
195201 }
196202
197203 template <class _OtherIndexType>
......@@ -200,7 +206,7 @@ public:
200206 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference
201207 operator[](const array< _OtherIndexType, rank()>& __indices) const {
202208 return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
203 return __map_(__indices[_Idxs]...);
209 return __map_(extents_type::__index_cast(__indices[_Idxs])...);
204210 }(make_index_sequence<rank()>()));
205211 }
206212
......@@ -209,10 +215,41 @@ public:
209215 is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
210216 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](span<_OtherIndexType, rank()> __indices) const {
211217 return __acc_.access(__ptr_, [&]<size_t... _Idxs>(index_sequence<_Idxs...>) {
212 return __map_(__indices[_Idxs]...);
218 return __map_(extents_type::__index_cast(__indices[_Idxs])...);
213219 }(make_index_sequence<rank()>()));
214220 }
215221
222# if _LIBCPP_STD_VER >= 26
223 template <class... _OtherIndexTypes>
224 requires((is_convertible_v<_OtherIndexTypes, index_type> && ...) &&
225 (is_nothrow_constructible_v<index_type, _OtherIndexTypes> && ...) &&
226 (sizeof...(_OtherIndexTypes) == rank()))
227 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(_OtherIndexTypes... __indices) const {
228 if (!__mdspan_detail::__is_multidimensional_index_in(__map_.extents(), __indices...)) {
229 __throw_out_of_range();
230 }
231 return (*this)[extents_type::__index_cast(std::move(__indices))...];
232 }
233
234 template <class _OtherIndexType>
235 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
236 is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
237 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(const array<_OtherIndexType, rank()>& __indices) const {
238 return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) -> reference {
239 return at(extents_type::__index_cast(__indices[_Idxs])...);
240 }(make_index_sequence<rank()>());
241 }
242
243 template <class _OtherIndexType>
244 requires(is_convertible_v<const _OtherIndexType&, index_type> &&
245 is_nothrow_constructible_v<index_type, const _OtherIndexType&>)
246 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reference at(span<_OtherIndexType, rank()> __indices) const {
247 return [&]<size_t... _Idxs>(index_sequence<_Idxs...>) -> reference {
248 return at(extents_type::__index_cast(std::as_const(__indices[_Idxs]))...);
249 }(make_index_sequence<rank()>());
250 }
251# endif
252
216253 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept {
217254 // Could leave this as only checked in debug mode: semantically size() is never
218255 // guaranteed to be related to any accessible range
......@@ -269,19 +306,16 @@ private:
269306
270307 template <class, class, class, class>
271308 friend class mdspan;
272};
273309
274310# if _LIBCPP_STD_VER >= 26
311 _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range() const { std::__throw_out_of_range("mdspan"); }
312# endif
313};
314
275315template <class _ElementType, class... _OtherIndexTypes>
276316 requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0))
277317explicit mdspan(_ElementType*, _OtherIndexTypes...)
278318 -> mdspan<_ElementType, extents<size_t, __maybe_static_ext<_OtherIndexTypes>...>>;
279# else
280template <class _ElementType, class... _OtherIndexTypes>
281 requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0))
282explicit mdspan(_ElementType*, _OtherIndexTypes...)
283 -> mdspan<_ElementType, dextents<size_t, sizeof...(_OtherIndexTypes)>>;
284# endif
285319
286320template <class _Pointer>
287321 requires(is_pointer_v<remove_reference_t<_Pointer>>)
......@@ -309,7 +343,7 @@ mdspan(_ElementType*, const _MappingType&)
309343 -> mdspan<_ElementType, typename _MappingType::extents_type, typename _MappingType::layout_type>;
310344
311345template <class _MappingType, class _AccessorType>
312mdspan(const typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&)
346mdspan(typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&)
313347 -> mdspan<typename _AccessorType::element_type,
314348 typename _MappingType::extents_type,
315349 typename _MappingType::layout_type,
lib/libcxx/include/__memory/aligned_alloc.h deleted-63
......@@ -1,63 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___MEMORY_ALIGNED_ALLOC_H
10#define _LIBCPP___MEMORY_ALIGNED_ALLOC_H
11
12#include <__config>
13#include <cstdlib>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
22
23// Low-level helpers to call the aligned allocation and deallocation functions
24// on the target platform. This is used to implement libc++'s own memory
25// allocation routines -- if you need to allocate memory inside the library,
26// chances are that you want to use `__libcpp_allocate` instead.
27//
28// Returns the allocated memory, or `nullptr` on failure.
29inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
30# if defined(_LIBCPP_MSVCRT_LIKE)
31 return ::_aligned_malloc(__size, __alignment);
32# elif _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_C11_ALIGNED_ALLOC
33 // aligned_alloc() requires that __size is a multiple of __alignment,
34 // but for C++ [new.delete.general], only states "if the value of an
35 // alignment argument passed to any of these functions is not a valid
36 // alignment value, the behavior is undefined".
37 // To handle calls such as ::operator new(1, std::align_val_t(128)), we
38 // round __size up to the next multiple of __alignment.
39 size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1);
40 // Rounding up could have wrapped around to zero, so we have to add another
41 // max() ternary to the actual call site to avoid succeeded in that case.
42 return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size);
43# else
44 void* __result = nullptr;
45 (void)::posix_memalign(&__result, __alignment, __size);
46 // If posix_memalign fails, __result is unmodified so we still return `nullptr`.
47 return __result;
48# endif
49}
50
51inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {
52# if defined(_LIBCPP_MSVCRT_LIKE)
53 ::_aligned_free(__ptr);
54# else
55 ::free(__ptr);
56# endif
57}
58
59#endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
60
61_LIBCPP_END_NAMESPACE_STD
62
63#endif // _LIBCPP___MEMORY_ALIGNED_ALLOC_H
lib/libcxx/include/__memory/allocator_traits.h+61-1
......@@ -11,6 +11,7 @@
1111#define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
1212
1313#include <__config>
14#include <__cstddef/ptrdiff_t.h>
1415#include <__cstddef/size_t.h>
1516#include <__fwd/memory.h>
1617#include <__memory/construct_at.h>
......@@ -223,8 +224,13 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result);
223224
224225#endif // _LIBCPP_STD_VER
225226
227template <class>
228struct allocator_traits;
229
230// We have a base class that can be specialized for different allocators, since the metaprogramming to get the aliases
231// is quite expensive and the definition of these aliases is usually quite trivial in the end.
226232template <class _Alloc>
227struct allocator_traits {
233struct __allocator_traits_base {
228234 using allocator_type = _Alloc;
229235 using value_type = typename allocator_type::value_type;
230236 using pointer = __pointer<value_type, allocator_type>;
......@@ -253,6 +259,60 @@ struct allocator_traits {
253259 using other = allocator_traits<typename rebind_alloc<_Tp>::other>;
254260 };
255261#endif // _LIBCPP_CXX03_LANG
262};
263
264template <class _Tp>
265struct __allocator_traits_base<allocator<_Tp> > {
266 using allocator_type = allocator<_Tp>;
267 using value_type = _Tp;
268 using pointer = _Tp*;
269 using const_pointer = const _Tp*;
270 using void_pointer = void*;
271 using const_void_pointer = const void*;
272 using difference_type = ptrdiff_t;
273 using size_type = size_t;
274 using propagate_on_container_copy_assignment = false_type;
275 using propagate_on_container_move_assignment = true_type;
276 using propagate_on_container_swap = false_type;
277 using is_always_equal = true_type;
278
279#ifndef _LIBCPP_CXX03_LANG
280 template <class _Up>
281 using rebind_alloc = allocator<_Up>;
282 template <class _Up>
283 using rebind_traits = allocator_traits<allocator<_Up> >;
284#else
285 template <class _Up>
286 struct rebind_alloc {
287 using other = allocator<_Up>;
288 };
289 template <class _Up>
290 struct rebind_traits {
291 using other = allocator_traits<allocator<_Up> >;
292 };
293#endif
294};
295
296template <class _Alloc>
297struct allocator_traits : __allocator_traits_base<_Alloc> {
298 using __base _LIBCPP_NODEBUG = __allocator_traits_base<_Alloc>;
299
300 using allocator_type = typename __base::allocator_type;
301 using value_type = typename __base::value_type;
302 using pointer = typename __base::pointer;
303 using const_pointer = typename __base::const_pointer;
304 using void_pointer = typename __base::void_pointer;
305 using const_void_pointer = typename __base::const_void_pointer;
306 using difference_type = typename __base::difference_type;
307 using size_type = typename __base::size_type;
308 using propagate_on_container_copy_assignment = typename __base::propagate_on_container_copy_assignment;
309 using propagate_on_container_move_assignment = typename __base::propagate_on_container_move_assignment;
310 using is_always_equal = typename __base::is_always_equal;
311
312 template <class _Tp>
313 using rebind_alloc = typename __base::template rebind_alloc<_Tp>;
314 template <class _Tp>
315 using rebind_traits = typename __base::template rebind_traits<_Tp>;
256316
257317 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer
258318 allocate(allocator_type& __a, size_type __n) {
lib/libcxx/include/__memory/compressed_pair.h+4-29
......@@ -20,8 +20,6 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523// ================================================================================================================== //
2624// The utilites here are for staying ABI compatible with the legacy `__compressed_pair`. They should not be used //
2725// for new data structures. Use `_LIBCPP_NO_UNIQUE_ADDRESS` for new data structures instead (but make sure you //
......@@ -59,6 +57,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5957
6058#ifndef _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
6159
60_LIBCPP_BEGIN_NAMESPACE_STD
61
6262template <class _Tp>
6363inline const size_t __compressed_pair_alignment = _LIBCPP_ALIGNOF(_Tp);
6464
......@@ -94,16 +94,6 @@ class __compressed_pair_padding<_ToPad, true> {};
9494 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \
9595 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
9696 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _)
97
98# define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \
99 _LIBCPP_NO_UNIQUE_ADDRESS \
100 __attribute__((__aligned__(::std::__compressed_pair_alignment<T2>), \
101 __aligned__(::std::__compressed_pair_alignment<T3>))) T1 Initializer1; \
102 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \
103 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
104 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \
105 _LIBCPP_NO_UNIQUE_ADDRESS T3 Initializer3; \
106 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T3> _LIBCPP_CONCAT3(__padding3_, __LINE__, _)
10797# else
10898# define _LIBCPP_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \
10999 struct { \
......@@ -112,31 +102,16 @@ class __compressed_pair_padding<_ToPad, true> {};
112102 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
113103 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \
114104 }
115
116# define _LIBCPP_COMPRESSED_TRIPLE(T1, Initializer1, T2, Initializer2, T3, Initializer3) \
117 struct { \
118 _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1; \
119 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T1> _LIBCPP_CONCAT3(__padding1_, __LINE__, _); \
120 _LIBCPP_NO_UNIQUE_ADDRESS T2 Initializer2; \
121 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T2> _LIBCPP_CONCAT3(__padding2_, __LINE__, _); \
122 _LIBCPP_NO_UNIQUE_ADDRESS T3 Initializer3; \
123 _LIBCPP_NO_UNIQUE_ADDRESS ::std::__compressed_pair_padding<T3> _LIBCPP_CONCAT3(__padding3_, __LINE__, _); \
124 }
125105# endif
126106
107_LIBCPP_END_NAMESPACE_STD
108
127109#else
128110# define _LIBCPP_COMPRESSED_ELEMENT(T1, Initializer1) _LIBCPP_NO_UNIQUE_ADDRESS T1 Initializer1
129111
130112# define _LIBCPP_COMPRESSED_PAIR(T1, Name1, T2, Name2) \
131113 _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \
132114 _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2
133
134# define _LIBCPP_COMPRESSED_TRIPLE(T1, Name1, T2, Name2, T3, Name3) \
135 _LIBCPP_NO_UNIQUE_ADDRESS T1 Name1; \
136 _LIBCPP_NO_UNIQUE_ADDRESS T2 Name2; \
137 _LIBCPP_NO_UNIQUE_ADDRESS T3 Name3
138115#endif // _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
139116
140_LIBCPP_END_NAMESPACE_STD
141
142117#endif // _LIBCPP___MEMORY_COMPRESSED_PAIR_H
lib/libcxx/include/__memory/inout_ptr.h+5-6
......@@ -11,10 +11,9 @@
1111#define _LIBCPP___INOUT_PTR_H
1212
1313#include <__config>
14#include <__fwd/memory.h>
1415#include <__memory/addressof.h>
1516#include <__memory/pointer_traits.h>
16#include <__memory/shared_ptr.h>
17#include <__memory/unique_ptr.h>
1817#include <__type_traits/is_pointer.h>
1918#include <__type_traits/is_same.h>
2019#include <__type_traits/is_specialization.h>
......@@ -30,10 +29,10 @@
3029_LIBCPP_PUSH_MACROS
3130#include <__undef_macros>
3231
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3532#if _LIBCPP_STD_VER >= 23
3633
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3736template <class _Smart, class _Pointer, class... _Args>
3837class inout_ptr_t {
3938 static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr.");
......@@ -101,10 +100,10 @@ template <class _Pointer = void, class _Smart, class... _Args>
101100 return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
102101}
103102
104#endif // _LIBCPP_STD_VER >= 23
105
106103_LIBCPP_END_NAMESPACE_STD
107104
105#endif // _LIBCPP_STD_VER >= 23
106
108107_LIBCPP_POP_MACROS
109108
110109#endif // _LIBCPP___INOUT_PTR_H
lib/libcxx/include/__memory/is_sufficiently_aligned.h+6-1
......@@ -20,11 +20,16 @@
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
2222
23template <size_t _Alignment, class _Tp>
24[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool __is_sufficiently_aligned(_Tp* __ptr) {
25 return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0;
26}
27
2328#if _LIBCPP_STD_VER >= 26
2429
2530template <size_t _Alignment, class _Tp>
2631[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool is_sufficiently_aligned(_Tp* __ptr) {
27 return reinterpret_cast<uintptr_t>(__ptr) % _Alignment == 0;
32 return std::__is_sufficiently_aligned<_Alignment>(__ptr);
2833}
2934
3035#endif // _LIBCPP_STD_VER >= 26
lib/libcxx/include/__memory/out_ptr.h+5-6
......@@ -11,10 +11,9 @@
1111#define _LIBCPP___OUT_PTR_H
1212
1313#include <__config>
14#include <__fwd/memory.h>
1415#include <__memory/addressof.h>
1516#include <__memory/pointer_traits.h>
16#include <__memory/shared_ptr.h>
17#include <__memory/unique_ptr.h>
1817#include <__type_traits/is_pointer.h>
1918#include <__type_traits/is_specialization.h>
2019#include <__type_traits/is_void.h>
......@@ -29,10 +28,10 @@
2928_LIBCPP_PUSH_MACROS
3029#include <__undef_macros>
3130
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3431#if _LIBCPP_STD_VER >= 23
3532
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3635template <class _Smart, class _Pointer, class... _Args>
3736class out_ptr_t {
3837 static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0,
......@@ -93,10 +92,10 @@ template <class _Pointer = void, class _Smart, class... _Args>
9392 return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
9493}
9594
96#endif // _LIBCPP_STD_VER >= 23
97
9895_LIBCPP_END_NAMESPACE_STD
9996
97#endif // _LIBCPP_STD_VER >= 23
98
10099_LIBCPP_POP_MACROS
101100
102101#endif // _LIBCPP___OUT_PTR_H
lib/libcxx/include/__memory/pointer_traits.h+20-35
......@@ -14,12 +14,10 @@
1414#include <__cstddef/ptrdiff_t.h>
1515#include <__memory/addressof.h>
1616#include <__type_traits/conditional.h>
17#include <__type_traits/conjunction.h>
1817#include <__type_traits/decay.h>
1918#include <__type_traits/detected_or.h>
2019#include <__type_traits/enable_if.h>
2120#include <__type_traits/integral_constant.h>
22#include <__type_traits/is_class.h>
2321#include <__type_traits/is_function.h>
2422#include <__type_traits/is_void.h>
2523#include <__type_traits/nat.h>
......@@ -139,9 +137,6 @@ using __rebind_pointer_t _LIBCPP_NODEBUG = typename pointer_traits<_From>::templ
139137
140138// to_address
141139
142template <class _Pointer, class = void>
143struct __to_address_helper;
144
145140template <class _Tp>
146141_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT {
147142 static_assert(!is_function<_Tp>::value, "_Tp is a function type");
......@@ -149,48 +144,38 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT {
149144}
150145
151146template <class _Pointer, class = void>
152struct _HasToAddress : false_type {};
147inline const bool __has_to_address_v = false;
153148
154149template <class _Pointer>
155struct _HasToAddress<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) >
156 : true_type {};
150inline const bool
151 __has_to_address_v<_Pointer,
152 decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> = true;
157153
158154template <class _Pointer, class = void>
159struct _HasArrow : false_type {};
160
161template <class _Pointer>
162struct _HasArrow<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > : true_type {};
155inline const bool __has_arrow_v = false;
163156
164157template <class _Pointer>
165struct _IsFancyPointer {
166 static const bool value = _HasArrow<_Pointer>::value || _HasToAddress<_Pointer>::value;
167};
158inline const bool __has_arrow_v<_Pointer, decltype((void)std::declval<const _Pointer&>().operator->()) > = true;
168159
169// enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers
170template <class _Pointer, __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value, int> = 0>
171_LIBCPP_HIDE_FROM_ABI
172_LIBCPP_CONSTEXPR __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
160template <class _Pointer, __enable_if_t<__has_to_address_v<_Pointer>, int> = 0>
161_LIBCPP_CONSTEXPR __decay_t<decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))>
173162__to_address(const _Pointer& __p) _NOEXCEPT {
174 return __to_address_helper<_Pointer>::__call(__p);
163 return pointer_traits<_Pointer>::to_address(__p);
175164}
176165
177template <class _Pointer, class>
178struct __to_address_helper {
179 _LIBCPP_HIDE_FROM_ABI
180 _LIBCPP_CONSTEXPR static decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))
181 __call(const _Pointer& __p) _NOEXCEPT {
182 return std::__to_address(__p.operator->());
183 }
184};
166template <class _Pointer>
167struct __to_address_arrow_result;
185168
169template <class _Pointer, __enable_if_t<!__has_to_address_v<_Pointer> && __has_arrow_v<_Pointer>, int> = 0>
170_LIBCPP_CONSTEXPR typename __to_address_arrow_result<_Pointer>::type __to_address(const _Pointer& __p) _NOEXCEPT {
171 return std::__to_address(__p.operator->());
172}
173
174// The return type needs to see all `__to_address` overloads, so this is delayed until after all the overloads have been
175// defined. This could also be moved to a trailing return type, but that's not available in C++03.
186176template <class _Pointer>
187struct __to_address_helper<_Pointer,
188 decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
189 _LIBCPP_HIDE_FROM_ABI
190 _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
191 __call(const _Pointer& __p) _NOEXCEPT {
192 return pointer_traits<_Pointer>::to_address(__p);
193 }
177struct __to_address_arrow_result {
178 using type _LIBCPP_NODEBUG = __decay_t<decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))>;
194179};
195180
196181#if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__memory/ranges_uninitialized_algorithms.h+29-26
......@@ -44,14 +44,16 @@ namespace ranges {
4444struct __uninitialized_default_construct {
4545 template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
4646 requires default_initializable<iter_value_t<_ForwardIterator>>
47 _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
47 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
48 operator()(_ForwardIterator __first, _Sentinel __last) const {
4849 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
4950 return std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
5051 }
5152
5253 template <__nothrow_forward_range _ForwardRange>
5354 requires default_initializable<range_value_t<_ForwardRange>>
54 _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const {
55 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange>
56 operator()(_ForwardRange&& __range) const {
5557 return (*this)(ranges::begin(__range), ranges::end(__range));
5658 }
5759};
......@@ -65,7 +67,7 @@ inline constexpr auto uninitialized_default_construct = __uninitialized_default_
6567struct __uninitialized_default_construct_n {
6668 template <__nothrow_forward_iterator _ForwardIterator>
6769 requires default_initializable<iter_value_t<_ForwardIterator>>
68 _LIBCPP_HIDE_FROM_ABI _ForwardIterator
70 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
6971 operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
7072 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
7173 return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
......@@ -81,14 +83,16 @@ inline constexpr auto uninitialized_default_construct_n = __uninitialized_defaul
8183struct __uninitialized_value_construct {
8284 template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel>
8385 requires default_initializable<iter_value_t<_ForwardIterator>>
84 _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const {
86 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
87 operator()(_ForwardIterator __first, _Sentinel __last) const {
8588 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
8689 return std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
8790 }
8891
8992 template <__nothrow_forward_range _ForwardRange>
9093 requires default_initializable<range_value_t<_ForwardRange>>
91 _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range) const {
94 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange>
95 operator()(_ForwardRange&& __range) const {
9296 return (*this)(ranges::begin(__range), ranges::end(__range));
9397 }
9498};
......@@ -102,7 +106,7 @@ inline constexpr auto uninitialized_value_construct = __uninitialized_value_cons
102106struct __uninitialized_value_construct_n {
103107 template <__nothrow_forward_iterator _ForwardIterator>
104108 requires default_initializable<iter_value_t<_ForwardIterator>>
105 _LIBCPP_HIDE_FROM_ABI _ForwardIterator
109 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
106110 operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const {
107111 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
108112 return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
......@@ -118,14 +122,16 @@ inline constexpr auto uninitialized_value_construct_n = __uninitialized_value_co
118122struct __uninitialized_fill {
119123 template <__nothrow_forward_iterator _ForwardIterator, __nothrow_sentinel_for<_ForwardIterator> _Sentinel, class _Tp>
120124 requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
121 _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const {
125 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
126 operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const {
122127 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
123128 return std::__uninitialized_fill<_ValueType>(std::move(__first), std::move(__last), __x);
124129 }
125130
126131 template <__nothrow_forward_range _ForwardRange, class _Tp>
127132 requires constructible_from<range_value_t<_ForwardRange>, const _Tp&>
128 _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_ForwardRange> operator()(_ForwardRange&& __range, const _Tp& __x) const {
133 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 borrowed_iterator_t<_ForwardRange>
134 operator()(_ForwardRange&& __range, const _Tp& __x) const {
129135 return (*this)(ranges::begin(__range), ranges::end(__range), __x);
130136 }
131137};
......@@ -139,7 +145,7 @@ inline constexpr auto uninitialized_fill = __uninitialized_fill{};
139145struct __uninitialized_fill_n {
140146 template <__nothrow_forward_iterator _ForwardIterator, class _Tp>
141147 requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&>
142 _LIBCPP_HIDE_FROM_ABI _ForwardIterator
148 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
143149 operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const {
144150 using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
145151 return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x);
......@@ -161,20 +167,20 @@ struct __uninitialized_copy {
161167 __nothrow_forward_iterator _OutputIterator,
162168 __nothrow_sentinel_for<_OutputIterator> _Sentinel2>
163169 requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
164 _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<_InputIterator, _OutputIterator>
170 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_copy_result<_InputIterator, _OutputIterator>
165171 operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
166172 using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
167173
168174 auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
169 auto __result = std::__uninitialized_copy<_ValueType>(
175 return std::__uninitialized_copy<_ValueType>(
170176 std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_copying);
171 return {std::move(__result.first), std::move(__result.second)};
172177 }
173178
174179 template <input_range _InputRange, __nothrow_forward_range _OutputRange>
175180 requires constructible_from<range_value_t<_OutputRange>, range_reference_t<_InputRange>>
176 _LIBCPP_HIDE_FROM_ABI uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
177 operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
181 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
182 uninitialized_copy_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
183 operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
178184 return (*this)(
179185 ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
180186 }
......@@ -194,16 +200,14 @@ struct __uninitialized_copy_n {
194200 __nothrow_forward_iterator _OutputIterator,
195201 __nothrow_sentinel_for<_OutputIterator> _Sentinel>
196202 requires constructible_from<iter_value_t<_OutputIterator>, iter_reference_t<_InputIterator>>
197 _LIBCPP_HIDE_FROM_ABI uninitialized_copy_n_result<_InputIterator, _OutputIterator>
203 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_copy_n_result<_InputIterator, _OutputIterator>
198204 operator()(_InputIterator __ifirst,
199205 iter_difference_t<_InputIterator> __n,
200206 _OutputIterator __ofirst,
201207 _Sentinel __olast) const {
202208 using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
203209 auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
204 auto __result =
205 std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying);
206 return {std::move(__result.first), std::move(__result.second)};
210 return std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying);
207211 }
208212};
209213
......@@ -222,20 +226,20 @@ struct __uninitialized_move {
222226 __nothrow_forward_iterator _OutputIterator,
223227 __nothrow_sentinel_for<_OutputIterator> _Sentinel2>
224228 requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
225 _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<_InputIterator, _OutputIterator>
229 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_move_result<_InputIterator, _OutputIterator>
226230 operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const {
227231 using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
228232 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
229233 auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
230 auto __result = std::__uninitialized_move<_ValueType>(
234 return std::__uninitialized_move<_ValueType>(
231235 std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move);
232 return {std::move(__result.first), std::move(__result.second)};
233236 }
234237
235238 template <input_range _InputRange, __nothrow_forward_range _OutputRange>
236239 requires constructible_from<range_value_t<_OutputRange>, range_rvalue_reference_t<_InputRange>>
237 _LIBCPP_HIDE_FROM_ABI uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
238 operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
240 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
241 uninitialized_move_result<borrowed_iterator_t<_InputRange>, borrowed_iterator_t<_OutputRange>>
242 operator()(_InputRange&& __in_range, _OutputRange&& __out_range) const {
239243 return (*this)(
240244 ranges::begin(__in_range), ranges::end(__in_range), ranges::begin(__out_range), ranges::end(__out_range));
241245 }
......@@ -255,7 +259,7 @@ struct __uninitialized_move_n {
255259 __nothrow_forward_iterator _OutputIterator,
256260 __nothrow_sentinel_for<_OutputIterator> _Sentinel>
257261 requires constructible_from<iter_value_t<_OutputIterator>, iter_rvalue_reference_t<_InputIterator>>
258 _LIBCPP_HIDE_FROM_ABI uninitialized_move_n_result<_InputIterator, _OutputIterator>
262 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 uninitialized_move_n_result<_InputIterator, _OutputIterator>
259263 operator()(_InputIterator __ifirst,
260264 iter_difference_t<_InputIterator> __n,
261265 _OutputIterator __ofirst,
......@@ -263,9 +267,8 @@ struct __uninitialized_move_n {
263267 using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>;
264268 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); };
265269 auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; };
266 auto __result = std::__uninitialized_move_n<_ValueType>(
270 return std::__uninitialized_move_n<_ValueType>(
267271 std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move);
268 return {std::move(__result.first), std::move(__result.second)};
269272 }
270273};
271274
lib/libcxx/include/__memory/raw_storage_iterator.h+4-4
......@@ -21,13 +21,13 @@
2121# pragma GCC system_header
2222#endif
2323
24#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
25
2426_LIBCPP_PUSH_MACROS
2527#include <__undef_macros>
2628
2729_LIBCPP_BEGIN_NAMESPACE_STD
2830
29#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
30
3131template <class _OutputIterator, class _Tp>
3232class _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator
3333 : public __iterator_base<raw_storage_iterator<_OutputIterator, _Tp>, output_iterator_tag, void, void, void, void> {
......@@ -71,10 +71,10 @@ public:
7171# endif
7272};
7373
74#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
75
7674_LIBCPP_END_NAMESPACE_STD
7775
7876_LIBCPP_POP_MACROS
7977
78#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR)
79
8080#endif // _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
lib/libcxx/include/__memory/shared_count.h+2
......@@ -18,6 +18,7 @@
1818#endif
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
21_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2122
2223// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
2324// should be sufficient for thread safety.
......@@ -111,6 +112,7 @@ private:
111112 virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
112113};
113114
115_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
114116_LIBCPP_END_NAMESPACE_STD
115117
116118#endif // _LIBCPP___MEMORY_SHARED_COUNT_H
lib/libcxx/include/__memory/shared_ptr.h+209-277
......@@ -10,6 +10,7 @@
1010#ifndef _LIBCPP___MEMORY_SHARED_PTR_H
1111#define _LIBCPP___MEMORY_SHARED_PTR_H
1212
13#include <__atomic/memory_order.h>
1314#include <__compare/compare_three_way.h>
1415#include <__compare/ordering.h>
1516#include <__config>
......@@ -27,19 +28,17 @@
2728#include <__memory/allocator_destructor.h>
2829#include <__memory/allocator_traits.h>
2930#include <__memory/auto_ptr.h>
30#include <__memory/compressed_pair.h>
3131#include <__memory/construct_at.h>
3232#include <__memory/destroy.h>
3333#include <__memory/pointer_traits.h>
3434#include <__memory/shared_count.h>
3535#include <__memory/uninitialized_algorithms.h>
36#include <__memory/uninitialized_multidimensional_algorithms.h>
3637#include <__memory/unique_ptr.h>
3738#include <__type_traits/add_reference.h>
3839#include <__type_traits/conditional.h>
3940#include <__type_traits/conjunction.h>
40#include <__type_traits/disjunction.h>
4141#include <__type_traits/enable_if.h>
42#include <__type_traits/integral_constant.h>
4342#include <__type_traits/is_array.h>
4443#include <__type_traits/is_constructible.h>
4544#include <__type_traits/is_convertible.h>
......@@ -47,10 +46,11 @@
4746#include <__type_traits/is_reference.h>
4847#include <__type_traits/is_same.h>
4948#include <__type_traits/nat.h>
50#include <__type_traits/negation.h>
5149#include <__type_traits/remove_cv.h>
5250#include <__type_traits/remove_extent.h>
51#include <__type_traits/remove_pointer.h>
5352#include <__type_traits/remove_reference.h>
53#include <__type_traits/void_t.h>
5454#include <__utility/declval.h>
5555#include <__utility/exception_guard.h>
5656#include <__utility/forward.h>
......@@ -58,9 +58,6 @@
5858#include <__utility/swap.h>
5959#include <__verbose_abort>
6060#include <typeinfo>
61#if _LIBCPP_HAS_ATOMIC_HEADER
62# include <__atomic/memory_order.h>
63#endif
6461
6562#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
6663# pragma GCC system_header
......@@ -70,6 +67,7 @@ _LIBCPP_PUSH_MACROS
7067#include <__undef_macros>
7168
7269_LIBCPP_BEGIN_NAMESPACE_STD
70_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
7371
7472class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr : public std::exception {
7573public:
......@@ -92,47 +90,36 @@ template <class _Tp>
9290class weak_ptr;
9391
9492template <class _Tp, class _Dp, class _Alloc>
95class __shared_ptr_pointer : public __shared_weak_count {
96 _LIBCPP_COMPRESSED_TRIPLE(_Tp, __ptr_, _Dp, __deleter_, _Alloc, __alloc_);
93class _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_pointer final : public __shared_weak_count {
94 _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
95 _LIBCPP_NO_UNIQUE_ADDRESS _Dp __deleter_;
96 _LIBCPP_NO_UNIQUE_ADDRESS _Tp __ptr_;
9797
9898public:
9999 _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
100 : __ptr_(__p), __deleter_(std::move(__d)), __alloc_(std::move(__a)) {}
100 : __alloc_(std::move(__a)), __deleter_(std::move(__d)), __ptr_(__p) {}
101101
102102#if _LIBCPP_HAS_RTTI
103 _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
103 _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info& __t) const _NOEXCEPT override {
104 return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr;
105 }
104106#endif
105107
106108private:
107 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override;
108 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
109};
110
111#if _LIBCPP_HAS_RTTI
112
113template <class _Tp, class _Dp, class _Alloc>
114const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT {
115 return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr;
116}
117
118#endif // _LIBCPP_HAS_RTTI
109 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
110 __deleter_(__ptr_);
111 __ptr_.~_Tp();
112 __deleter_.~_Dp();
113 }
119114
120template <class _Tp, class _Dp, class _Alloc>
121void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT {
122 __deleter_(__ptr_);
123 __deleter_.~_Dp();
124}
115 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
116 using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_pointer>;
125117
126template <class _Tp, class _Dp, class _Alloc>
127void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT {
128 typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
129 typedef allocator_traits<_Al> _ATraits;
130 typedef pointer_traits<typename _ATraits::pointer> _PTraits;
131
132 _Al __a(__alloc_);
133 __alloc_.~_Alloc();
134 __a.deallocate(_PTraits::pointer_to(*this), 1);
135}
118 __alloc_t __a(__alloc_);
119 __alloc_.~_Alloc();
120 __a.deallocate(pointer_traits<typename allocator_traits<__alloc_t>::pointer>::pointer_to(*this), 1);
121 }
122};
136123
137124// This tag is used to instantiate an allocator type. The various shared_ptr control blocks
138125// detect that the allocator has been instantiated for this type and perform alternative
......@@ -140,79 +127,54 @@ void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT {
140127struct __for_overwrite_tag {};
141128
142129template <class _Tp, class _Alloc>
143struct __shared_ptr_emplace : __shared_weak_count {
144 using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>;
130struct _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_emplace : __shared_weak_count {
131 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Alloc>;
132 using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>;
145133
146 template <class... _Args,
147 class _Allocator = _Alloc,
148 __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
149 _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&...) : __storage_(std::move(__a)) {
150 static_assert(
151 sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite");
152 ::new (static_cast<void*>(__get_elem())) __value_type;
134 template <class... _Args>
135 _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __alloc_(std::move(__a)) {
136 allocator_traits<_Alloc>::construct(__alloc_, __get_elem(), std::forward<_Args>(__args)...);
153137 }
154138
155 template <class... _Args,
156 class _Allocator = _Alloc,
157 __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
158 _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __storage_(std::move(__a)) {
159 using _TpAlloc = typename __allocator_traits_rebind<_Alloc, __value_type>::type;
160 _TpAlloc __tmp(*__get_alloc());
161 allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
162 }
163
164 _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); }
165
166 _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); }
139 _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return reinterpret_cast<__value_type*>(__buffer_); }
167140
168141private:
169 template <class _Allocator = _Alloc,
170 __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
171 _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
172 __get_elem()->~__value_type();
173 }
174
175 template <class _Allocator = _Alloc,
176 __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
177 _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
178 using _TpAlloc = typename __allocator_traits_rebind<_Allocator, __remove_cv_t<_Tp> >::type;
179 _TpAlloc __tmp(*__get_alloc());
180 allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
142 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override {
143 allocator_traits<_Alloc>::destroy(__alloc_, __get_elem());
181144 }
182145
183 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __on_zero_shared_impl(); }
184
185146 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
186 using _ControlBlockAlloc = typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type;
187 using _ControlBlockPointer = typename allocator_traits<_ControlBlockAlloc>::pointer;
188 _ControlBlockAlloc __tmp(*__get_alloc());
189 __storage_.~_Storage();
190 allocator_traits<_ControlBlockAlloc>::deallocate(__tmp, pointer_traits<_ControlBlockPointer>::pointer_to(*this), 1);
147 using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_emplace>;
148 __alloc_t __tmp(__alloc_);
149 __alloc_.~_Alloc();
150 allocator_traits<__alloc_t>::deallocate(
151 __tmp, pointer_traits<typename allocator_traits<__alloc_t>::pointer>::pointer_to(*this), 1);
191152 }
192153
193 // TODO: It should be possible to refactor this to remove `_Storage` entirely.
194 // This class implements the control block for non-array shared pointers created
195 // through `std::allocate_shared` and `std::make_shared`.
196 struct _Storage {
197 struct _Data {
198 _LIBCPP_COMPRESSED_PAIR(_Alloc, __alloc_, __value_type, __elem_);
199 };
154 _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
155 _ALIGNAS_TYPE(__value_type) char __buffer_[sizeof(__value_type)];
156};
200157
201 _ALIGNAS_TYPE(_Data) char __buffer_[sizeof(_Data)];
158template <class _Tp, class _Alloc>
159struct _LIBCPP_HIDE_STRUCT_FROM_ABI __shared_ptr_emplace_for_overwrite : __shared_weak_count {
160 using __value_type _LIBCPP_NODEBUG = __remove_cv_t<_Tp>;
202161
203 _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); }
204 _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); }
162 _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace_for_overwrite(_Alloc __a) : __alloc_(std::move(__a)) {}
205163
206 _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT {
207 return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__alloc_);
208 }
164 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { __value_.~__value_type(); }
165 _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override {
166 using __alloc_t = __allocator_traits_rebind_t<_Alloc, __shared_ptr_emplace_for_overwrite>;
167 using __alloc_traits = allocator_traits<__alloc_t>;
168 __alloc_t __tmp(__alloc_);
169 __alloc_.~_Alloc();
170 __alloc_traits::deallocate(__tmp, pointer_traits<typename __alloc_traits::pointer>::pointer_to(*this), 1);
171 }
209172
210 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI __value_type* __get_elem() _NOEXCEPT {
211 return std::addressof(reinterpret_cast<_Data*>(__buffer_)->__elem_);
212 }
213 };
173 _LIBCPP_HIDE_FROM_ABI __value_type* __get_elem() _NOEXCEPT { return std::addressof(__value_); }
214174
215 _Storage __storage_;
175private:
176 _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
177 _LIBCPP_NO_UNIQUE_ADDRESS __value_type __value_;
216178};
217179
218180struct __shared_ptr_dummy_rebind_allocator_type;
......@@ -233,16 +195,16 @@ class enable_shared_from_this;
233195// when either Y* is convertible to T* or Y is U[N] and T is cv U[].
234196#if _LIBCPP_STD_VER >= 17
235197template <class _Yp, class _Tp>
236struct __bounded_convertible_to_unbounded : false_type {};
198inline const bool __bounded_convertible_to_unbounded_v = false;
237199
238200template <class _Up, std::size_t _Np, class _Tp>
239struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp> : is_same<__remove_cv_t<_Tp>, _Up[]> {};
201inline const bool __bounded_convertible_to_unbounded_v<_Up[_Np], _Tp> = is_same_v<remove_cv_t<_Tp>, _Up[]>;
240202
241203template <class _Yp, class _Tp>
242struct __compatible_with : _Or< is_convertible<_Yp*, _Tp*>, __bounded_convertible_to_unbounded<_Yp, _Tp> > {};
204inline const bool __compatible_with_v = is_convertible_v<_Yp*, _Tp*> || __bounded_convertible_to_unbounded_v<_Yp, _Tp>;
243205#else
244206template <class _Yp, class _Tp>
245struct __compatible_with : is_convertible<_Yp*, _Tp*> {};
207inline const bool __compatible_with_v = is_convertible<_Yp*, _Tp*>::value;
246208#endif // _LIBCPP_STD_VER >= 17
247209
248210// Constructors that take raw pointers have a different set of "compatible" constraints
......@@ -252,49 +214,46 @@ struct __compatible_with : is_convertible<_Yp*, _Tp*> {};
252214// - If T is not an array type, then Y* is convertible to T*.
253215#if _LIBCPP_STD_VER >= 17
254216template <class _Yp, class _Tp, class = void>
255struct __raw_pointer_compatible_with : _And< _Not<is_array<_Tp>>, is_convertible<_Yp*, _Tp*> > {};
217inline const bool __raw_pointer_compatible_with_v = !is_array_v<_Tp> && is_convertible_v<_Yp*, _Tp*>;
256218
257219template <class _Yp, class _Up, std::size_t _Np>
258struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t< is_convertible<_Yp (*)[_Np], _Up (*)[_Np]>::value> >
259 : true_type {};
220inline const bool
221 __raw_pointer_compatible_with_v<_Yp, _Up[_Np], enable_if_t<is_convertible_v<_Yp (*)[_Np], _Up (*)[_Np]>>> = true;
260222
261223template <class _Yp, class _Up>
262struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t< is_convertible<_Yp (*)[], _Up (*)[]>::value> >
263 : true_type {};
224inline const bool __raw_pointer_compatible_with_v<_Yp, _Up[], enable_if_t<is_convertible_v<_Yp (*)[], _Up (*)[]>>> =
225 true;
264226
265227#else
266228template <class _Yp, class _Tp>
267struct __raw_pointer_compatible_with : is_convertible<_Yp*, _Tp*> {};
229inline const bool __raw_pointer_compatible_with_v = is_convertible<_Yp*, _Tp*>::value;
268230#endif // _LIBCPP_STD_VER >= 17
269231
270232template <class _Ptr, class = void>
271struct __is_deletable : false_type {};
233inline const bool __is_deletable_v = false;
272234template <class _Ptr>
273struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type {};
235inline const bool __is_deletable_v<_Ptr, decltype(delete std::declval<_Ptr>())> = true;
274236
275237template <class _Ptr, class = void>
276struct __is_array_deletable : false_type {};
238inline const bool __is_array_deletable_v = false;
277239template <class _Ptr>
278struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type {};
279
280template <class _Dp, class _Pt, class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
281true_type __well_formed_deleter_test(int);
240inline const bool __is_array_deletable_v<_Ptr, decltype(delete[] std::declval<_Ptr>())> = true;
282241
283template <class, class>
284false_type __well_formed_deleter_test(...);
242template <class _Dp, class _Pt, class = void>
243inline const bool __well_formed_deleter_v = false;
285244
286245template <class _Dp, class _Pt>
287struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {};
246inline const bool __well_formed_deleter_v<_Dp, _Pt, __void_t<decltype(std::declval<_Dp>()(std::declval<_Pt>()))> > =
247 true;
288248
289249template <class _Dp, class _Yp, class _Tp>
290struct __shared_ptr_deleter_ctor_reqs {
291 static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value && is_move_constructible<_Dp>::value &&
292 __well_formed_deleter<_Dp, _Yp*>::value;
293};
250inline const bool __shared_ptr_deleter_ctor_reqs_v =
251 __raw_pointer_compatible_with_v<_Yp, _Tp> && is_move_constructible<_Dp>::value &&
252 __well_formed_deleter_v<_Dp, _Yp*>;
294253
295254template <class _Dp>
296using __shared_ptr_nullptr_deleter_ctor_reqs _LIBCPP_NODEBUG =
297 _And<is_move_constructible<_Dp>, __well_formed_deleter<_Dp, nullptr_t> >;
255inline const bool __shared_ptr_nullptr_deleter_ctor_reqs_v =
256 is_move_constructible<_Dp>::value && __well_formed_deleter_v<_Dp, nullptr_t>;
298257
299258#if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI)
300259# define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__))
......@@ -328,16 +287,15 @@ public:
328287 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
329288
330289 template <class _Yp,
331 __enable_if_t< _And< __raw_pointer_compatible_with<_Yp, _Tp>
290 __enable_if_t<__raw_pointer_compatible_with_v<_Yp, _Tp>
332291 // In C++03 we get errors when trying to do SFINAE with the
333292 // delete operator, so we always pretend that it's deletable.
334293 // The same happens on GCC.
335#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_COMPILER_GCC)
336 ,
337 _If<is_array<_Tp>::value, __is_array_deletable<_Yp*>, __is_deletable<_Yp*> >
294#if !defined(_LIBCPP_CXX03_LANG)
295 && (is_array<_Tp>::value ? __is_array_deletable_v<_Yp*> : __is_deletable_v<_Yp*>)
338296#endif
339 >::value,
340 int> = 0>
297 ,
298 int> = 0>
341299 _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(_Yp* __p) : __ptr_(__p) {
342300 unique_ptr<_Yp> __hold(__p);
343301 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
......@@ -347,7 +305,7 @@ public:
347305 __enable_weak_this(__p, __p);
348306 }
349307
350 template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
308 template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0>
351309 _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) {
352310 auto __guard = std::__make_exception_guard([&] { __d(__p); });
353311 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
......@@ -361,10 +319,7 @@ public:
361319 __guard.__complete();
362320 }
363321
364 template <class _Yp,
365 class _Dp,
366 class _Alloc,
367 __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
322 template <class _Yp, class _Dp, class _Alloc, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0>
368323 _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
369324 auto __guard = std::__make_exception_guard([&] { __d(__p); });
370325 typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
......@@ -387,7 +342,7 @@ public:
387342 _LIBCPP_HIDE_FROM_ABI shared_ptr(
388343 nullptr_t __p,
389344 _Dp __d,
390 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
345 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs_v<_Dp>, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
391346 : __ptr_(nullptr) {
392347 auto __guard = std::__make_exception_guard([&] { __d(__p); });
393348 typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
......@@ -405,7 +360,7 @@ public:
405360 nullptr_t __p,
406361 _Dp __d,
407362 _Alloc __a,
408 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
363 __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs_v<_Dp>, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
409364 : __ptr_(nullptr) {
410365 auto __guard = std::__make_exception_guard([&] { __d(__p); });
411366 typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
......@@ -447,7 +402,7 @@ public:
447402 __cntrl_->__add_shared();
448403 }
449404
450 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
405 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
451406 _LIBCPP_HIDE_FROM_ABI shared_ptr(const shared_ptr<_Yp>& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
452407 if (__cntrl_)
453408 __cntrl_->__add_shared();
......@@ -458,13 +413,13 @@ public:
458413 __r.__cntrl_ = nullptr;
459414 }
460415
461 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
416 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
462417 _LIBCPP_HIDE_FROM_ABI shared_ptr(shared_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
463418 __r.__ptr_ = nullptr;
464419 __r.__cntrl_ = nullptr;
465420 }
466421
467 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
422 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
468423 _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r)
469424 : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) {
470425 if (__cntrl_ == nullptr)
......@@ -483,7 +438,7 @@ public:
483438
484439 template <class _Yp,
485440 class _Dp,
486 __enable_if_t<__compatible_with<_Yp, _Tp>::value &&
441 __enable_if_t<__compatible_with_v<_Yp, _Tp> &&
487442 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
488443 int> = 0>
489444 _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) {
......@@ -506,7 +461,7 @@ public:
506461 return *this;
507462 }
508463
509 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
464 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
510465 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT {
511466 shared_ptr(__r).swap(*this);
512467 return *this;
......@@ -517,7 +472,7 @@ public:
517472 return *this;
518473 }
519474
520 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
475 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
521476 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) {
522477 shared_ptr(std::move(__r)).swap(*this);
523478 return *this;
......@@ -535,8 +490,8 @@ public:
535490
536491 template <class _Yp,
537492 class _Dp,
538 __enable_if_t<_And< __compatible_with<_Yp, _Tp>,
539 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> >::value,
493 __enable_if_t<__compatible_with_v<_Yp, _Tp> &&
494 is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
540495 int> = 0>
541496 _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) {
542497 shared_ptr(std::move(__r)).swap(*this);
......@@ -550,20 +505,17 @@ public:
550505
551506 _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { shared_ptr().swap(*this); }
552507
553 template <class _Yp, __enable_if_t<__raw_pointer_compatible_with<_Yp, _Tp>::value, int> = 0>
508 template <class _Yp, __enable_if_t<__raw_pointer_compatible_with_v<_Yp, _Tp>, int> = 0>
554509 _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) {
555510 shared_ptr(__p).swap(*this);
556511 }
557512
558 template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
513 template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0>
559514 _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) {
560515 shared_ptr(__p, __d).swap(*this);
561516 }
562517
563 template <class _Yp,
564 class _Dp,
565 class _Alloc,
566 __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
518 template <class _Yp, class _Dp, class _Alloc, __enable_if_t<__shared_ptr_deleter_ctor_reqs_v<_Dp, _Yp, _Tp>, int> = 0>
567519 _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) {
568520 shared_ptr(__p, __d, __a).swap(*this);
569521 }
......@@ -647,7 +599,26 @@ private:
647599 }
648600 }
649601
650 _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(...) _NOEXCEPT {}
602 template <class _Vp>
603 static __type_identity<_Vp> __get_shared_from_this_impl(const enable_shared_from_this<_Vp>*);
604
605 template <class _Vp, class = void>
606 struct __get_shared_from_this {
607 using type _LIBCPP_NODEBUG = __nat;
608 };
609
610 template <class _Vp>
611 struct __get_shared_from_this<_Vp, __void_t<decltype(__get_shared_from_this_impl(static_cast<_Vp*>(nullptr)))> > {
612 using type _LIBCPP_NODEBUG = const enable_shared_from_this<typename decltype(__get_shared_from_this_impl(
613 static_cast<_Vp*>(nullptr)))::type>*;
614 };
615
616 template <
617 class _Yp,
618 class _OrigPtr,
619 __enable_if_t<!is_convertible<_OrigPtr, typename __get_shared_from_this<__remove_pointer_t<_Yp> >::type>::value,
620 int> = 0>
621 _LIBCPP_HIDE_FROM_ABI void __enable_weak_this(_Yp, _OrigPtr) {}
651622
652623 template <class, class _Yp>
653624 struct __shared_ptr_default_delete : default_delete<_Yp> {};
......@@ -674,15 +645,22 @@ shared_ptr(unique_ptr<_Tp, _Dp>) -> shared_ptr<_Tp>;
674645//
675646// std::allocate_shared and std::make_shared
676647//
677template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
678[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
679 using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
648
649template <class _ControlBlock, class _Tp, class _Alloc, class... _Args>
650_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> __allocate_shared_impl(const _Alloc& __alloc, _Args&&... __args) {
680651 using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
681 __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);
682 ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...);
652 __allocation_guard<_ControlBlockAllocator> __guard(__alloc, 1);
653 ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__alloc, std::forward<_Args>(__args)...);
683654 auto __control_block = __guard.__release_ptr();
684655 return shared_ptr<_Tp>::__create_with_control_block(
685 (*__control_block).__get_elem(), std::addressof(*__control_block));
656 __control_block->__get_elem(), std::__to_address(__control_block));
657}
658
659template <class _Tp, class _Alloc, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
660[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&... __args) {
661 using _CanonicalAlloc = __allocator_traits_rebind_t<_Alloc, __remove_cv_t<_Tp> >;
662 using _ControlBlock = __shared_ptr_emplace<_Tp, _CanonicalAlloc>;
663 return std::__allocate_shared_impl<_ControlBlock, _Tp>(_CanonicalAlloc(__a), std::forward<_Args>(__args)...);
686664}
687665
688666template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
......@@ -694,9 +672,9 @@ template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> =
694672
695673template <class _Tp, class _Alloc, __enable_if_t<!is_array<_Tp>::value, int> = 0>
696674[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
697 using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
698 _ForOverwriteAllocator __alloc(__a);
699 return std::allocate_shared<_Tp>(__alloc);
675 using _CanonicalAlloc = __allocator_traits_rebind_t<_Alloc, remove_cv_t<_Tp>>;
676 using _ControlBlock = __shared_ptr_emplace_for_overwrite<_Tp, _CanonicalAlloc>;
677 return std::__allocate_shared_impl<_ControlBlock, _Tp>(_CanonicalAlloc(__a));
700678}
701679
702680template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
......@@ -752,7 +730,7 @@ struct __unbounded_array_control_block<_Tp[], _Alloc> : __shared_weak_count {
752730 // [1]: https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding
753731 size_t __bytes = __elements == 0 ? sizeof(__unbounded_array_control_block)
754732 : (__elements - 1) * sizeof(_Tp) + sizeof(__unbounded_array_control_block);
755 constexpr size_t __align = alignof(_Tp);
733 constexpr size_t __align = alignof(__unbounded_array_control_block);
756734 return (__bytes + __align - 1) & ~(__align - 1);
757735 }
758736
......@@ -1171,44 +1149,93 @@ private:
11711149 __shared_weak_count* __cntrl_;
11721150
11731151public:
1174 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
1152 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
1153
1154 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1155 _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1156 if (__cntrl_)
1157 __cntrl_->__add_weak();
1158 }
1159
1160 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1161 if (__cntrl_)
1162 __cntrl_->__add_weak();
1163 }
1164
1165 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1166 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
1167 shared_ptr<_Yp> __s = __r.lock();
1168 *this = weak_ptr<_Tp>(__s);
1169 }
11751170
1176 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1177 _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT;
1171 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1172 __r.__ptr_ = nullptr;
1173 __r.__cntrl_ = nullptr;
1174 }
11781175
1179 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT;
1176 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1177 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
1178 shared_ptr<_Yp> __s = __r.lock();
1179 *this = weak_ptr<_Tp>(__s);
1180 __r.reset();
1181 }
11801182
1181 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1182 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT;
1183 _LIBCPP_HIDE_FROM_ABI ~weak_ptr() {
1184 if (__cntrl_)
1185 __cntrl_->__release_weak();
1186 }
11831187
1184 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT;
1188 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT {
1189 weak_ptr(__r).swap(*this);
1190 return *this;
1191 }
11851192
1186 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1187 _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT;
1193 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1194 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT {
1195 weak_ptr(__r).swap(*this);
1196 return *this;
1197 }
11881198
1189 _LIBCPP_HIDE_FROM_ABI ~weak_ptr();
1199 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT {
1200 weak_ptr(std::move(__r)).swap(*this);
1201 return *this;
1202 }
11901203
1191 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
1192 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1193 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
1204 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1205 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT {
1206 weak_ptr(std::move(__r)).swap(*this);
1207 return *this;
1208 }
11941209
1195 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
1196 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1197 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
1210 template <class _Yp, __enable_if_t<__compatible_with_v<_Yp, _Tp>, int> = 0>
1211 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT {
1212 weak_ptr(__r).swap(*this);
1213 return *this;
1214 }
11981215
1199 template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0>
1200 _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
1216 _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT {
1217 std::swap(__ptr_, __r.__ptr_);
1218 std::swap(__cntrl_, __r.__cntrl_);
1219 }
12011220
1202 _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT;
1203 _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT;
1221 _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT { weak_ptr().swap(*this); }
12041222
12051223 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {
12061224 return __cntrl_ ? __cntrl_->use_count() : 0;
12071225 }
1226
12081227 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT {
12091228 return __cntrl_ == nullptr || __cntrl_->use_count() == 0;
12101229 }
1211 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT;
1230
1231 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT {
1232 shared_ptr<_Tp> __r;
1233 __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
1234 if (__r.__cntrl_)
1235 __r.__ptr_ = __ptr_;
1236 return __r;
1237 }
1238
12121239 template <class _Up>
12131240 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {
12141241 return __cntrl_ < __r.__cntrl_;
......@@ -1229,107 +1256,11 @@ template <class _Tp>
12291256weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>;
12301257#endif
12311258
1232template <class _Tp>
1233inline _LIBCPP_CONSTEXPR weak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {}
1234
1235template <class _Tp>
1236inline weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1237 if (__cntrl_)
1238 __cntrl_->__add_weak();
1239}
1240
1241template <class _Tp>
1242template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1243inline weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1244 if (__cntrl_)
1245 __cntrl_->__add_weak();
1246}
1247
1248template <class _Tp>
1249template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1250inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
1251 shared_ptr<_Yp> __s = __r.lock();
1252 *this = weak_ptr<_Tp>(__s);
1253}
1254
1255template <class _Tp>
1256inline weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) {
1257 __r.__ptr_ = nullptr;
1258 __r.__cntrl_ = nullptr;
1259}
1260
1261template <class _Tp>
1262template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1263inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT : __ptr_(nullptr), __cntrl_(nullptr) {
1264 shared_ptr<_Yp> __s = __r.lock();
1265 *this = weak_ptr<_Tp>(__s);
1266 __r.reset();
1267}
1268
1269template <class _Tp>
1270weak_ptr<_Tp>::~weak_ptr() {
1271 if (__cntrl_)
1272 __cntrl_->__release_weak();
1273}
1274
1275template <class _Tp>
1276inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT {
1277 weak_ptr(__r).swap(*this);
1278 return *this;
1279}
1280
1281template <class _Tp>
1282template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1283inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT {
1284 weak_ptr(__r).swap(*this);
1285 return *this;
1286}
1287
1288template <class _Tp>
1289inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT {
1290 weak_ptr(std::move(__r)).swap(*this);
1291 return *this;
1292}
1293
1294template <class _Tp>
1295template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1296inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT {
1297 weak_ptr(std::move(__r)).swap(*this);
1298 return *this;
1299}
1300
1301template <class _Tp>
1302template <class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> >
1303inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT {
1304 weak_ptr(__r).swap(*this);
1305 return *this;
1306}
1307
1308template <class _Tp>
1309inline void weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT {
1310 std::swap(__ptr_, __r.__ptr_);
1311 std::swap(__cntrl_, __r.__cntrl_);
1312}
1313
13141259template <class _Tp>
13151260inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT {
13161261 __x.swap(__y);
13171262}
13181263
1319template <class _Tp>
1320inline void weak_ptr<_Tp>::reset() _NOEXCEPT {
1321 weak_ptr().swap(*this);
1322}
1323
1324template <class _Tp>
1325shared_ptr<_Tp> weak_ptr<_Tp>::lock() const _NOEXCEPT {
1326 shared_ptr<_Tp> __r;
1327 __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_;
1328 if (__r.__cntrl_)
1329 __r.__ptr_ = __ptr_;
1330 return __r;
1331}
1332
13331264#if _LIBCPP_STD_VER >= 17
13341265template <class _Tp = void>
13351266struct owner_less;
......@@ -1536,6 +1467,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(
15361467
15371468#endif // _LIBCPP_HAS_THREADS
15381469
1470_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
15391471_LIBCPP_END_NAMESPACE_STD
15401472
15411473_LIBCPP_POP_MACROS
lib/libcxx/include/__memory/temporary_buffer.h+3
......@@ -26,6 +26,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2626template <class _Tp>
2727[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _LIBCPP_DEPRECATED_IN_CXX17 pair<_Tp*, ptrdiff_t>
2828get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT {
29 if (__n <= 0)
30 return pair<_Tp*, ptrdiff_t>();
31
2932 __unique_temporary_buffer<_Tp> __unique_buf = std::__allocate_unique_temporary_buffer<_Tp>(__n);
3033 pair<_Tp*, ptrdiff_t> __result(__unique_buf.get(), __unique_buf.get_deleter().__count_);
3134 __unique_buf.release();
lib/libcxx/include/__memory/uninitialized_algorithms.h+53-192
......@@ -11,11 +11,10 @@
1111#define _LIBCPP___MEMORY_UNINITIALIZED_ALGORITHMS_H
1212
1313#include <__algorithm/copy.h>
14#include <__algorithm/move.h>
14#include <__algorithm/in_out_result.h>
1515#include <__algorithm/unwrap_iter.h>
1616#include <__algorithm/unwrap_range.h>
1717#include <__config>
18#include <__cstddef/size_t.h>
1918#include <__fwd/memory.h>
2019#include <__iterator/iterator_traits.h>
2120#include <__iterator/reverse_iterator.h>
......@@ -25,15 +24,13 @@
2524#include <__memory/destroy.h>
2625#include <__memory/pointer_traits.h>
2726#include <__type_traits/enable_if.h>
28#include <__type_traits/extent.h>
29#include <__type_traits/is_array.h>
3027#include <__type_traits/is_constant_evaluated.h>
28#include <__type_traits/is_reference.h>
3129#include <__type_traits/is_same.h>
3230#include <__type_traits/is_trivially_assignable.h>
3331#include <__type_traits/is_trivially_constructible.h>
3432#include <__type_traits/is_trivially_relocatable.h>
3533#include <__type_traits/remove_const.h>
36#include <__type_traits/remove_extent.h>
3734#include <__utility/exception_guard.h>
3835#include <__utility/move.h>
3936#include <__utility/pair.h>
......@@ -57,7 +54,8 @@ struct __always_false {
5754// uninitialized_copy
5855
5956template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _EndPredicate>
60inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy(
57inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator>
58__uninitialized_copy(
6159 _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
6260 _ForwardIterator __idx = __ofirst;
6361 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
......@@ -65,22 +63,22 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
6563 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
6664 __guard.__complete();
6765
68 return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx));
66 return {std::move(__ifirst), std::move(__idx)};
6967}
7068
7169template <class _InputIterator, class _ForwardIterator>
72_LIBCPP_HIDE_FROM_ABI _ForwardIterator
70_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
7371uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
7472 typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
7573 auto __result = std::__uninitialized_copy<_ValueType>(
7674 std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false());
77 return std::move(__result.second);
75 return std::move(__result.__out_);
7876}
7977
8078// uninitialized_copy_n
8179
8280template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate>
83inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
81inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator>
8482__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
8583 _ForwardIterator __idx = __ofirst;
8684 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
......@@ -88,22 +86,22 @@ __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __of
8886 ::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
8987 __guard.__complete();
9088
91 return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx));
89 return {std::move(__ifirst), std::move(__idx)};
9290}
9391
9492template <class _InputIterator, class _Size, class _ForwardIterator>
95inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
93inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
9694uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) {
9795 typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
9896 auto __result =
9997 std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false());
100 return std::move(__result.second);
98 return std::move(__result.__out_);
10199}
102100
103101// uninitialized_fill
104102
105103template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
106inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
104inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
107105__uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
108106 _ForwardIterator __idx = __first;
109107 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
......@@ -115,7 +113,7 @@ __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x)
115113}
116114
117115template <class _ForwardIterator, class _Tp>
118inline _LIBCPP_HIDE_FROM_ABI void
116inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
119117uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) {
120118 typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
121119 (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x);
......@@ -124,7 +122,7 @@ uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp&
124122// uninitialized_fill_n
125123
126124template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
127inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
125inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
128126__uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
129127 _ForwardIterator __idx = __first;
130128 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
......@@ -136,7 +134,7 @@ __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
136134}
137135
138136template <class _ForwardIterator, class _Size, class _Tp>
139inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
137inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
140138uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
141139 typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
142140 return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x);
......@@ -144,10 +142,18 @@ uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
144142
145143#if _LIBCPP_STD_VER >= 17
146144
145template <class _Iter>
146_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __deref_move(_Iter& __it) {
147 if constexpr (is_lvalue_reference_v<decltype(*__it)>)
148 return std::move(*__it);
149 else
150 return *__it;
151}
152
147153// uninitialized_default_construct
148154
149155template <class _ValueType, class _ForwardIterator, class _Sentinel>
150inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
156inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
151157__uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
152158 auto __idx = __first;
153159 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
......@@ -159,7 +165,8 @@ __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
159165}
160166
161167template <class _ForwardIterator>
162inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
168inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
169uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) {
163170 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
164171 (void)std::__uninitialized_default_construct<_ValueType>(std::move(__first), std::move(__last));
165172}
......@@ -167,7 +174,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterat
167174// uninitialized_default_construct_n
168175
169176template <class _ValueType, class _ForwardIterator, class _Size>
170inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
177inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
178__uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
171179 auto __idx = __first;
172180 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
173181 for (; __n > 0; ++__idx, (void)--__n)
......@@ -178,7 +186,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_
178186}
179187
180188template <class _ForwardIterator, class _Size>
181inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
189inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
190uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
182191 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
183192 return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n);
184193}
......@@ -186,7 +195,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(
186195// uninitialized_value_construct
187196
188197template <class _ValueType, class _ForwardIterator, class _Sentinel>
189inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
198inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
190199__uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
191200 auto __idx = __first;
192201 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
......@@ -198,7 +207,8 @@ __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
198207}
199208
200209template <class _ForwardIterator>
201inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
210inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
211uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) {
202212 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
203213 (void)std::__uninitialized_value_construct<_ValueType>(std::move(__first), std::move(__last));
204214}
......@@ -206,7 +216,8 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator
206216// uninitialized_value_construct_n
207217
208218template <class _ValueType, class _ForwardIterator, class _Size>
209inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
219inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
220__uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
210221 auto __idx = __first;
211222 auto __guard = std::__make_exception_guard([&] { std::__destroy(__first, __idx); });
212223 for (; __n > 0; ++__idx, (void)--__n)
......@@ -217,7 +228,8 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(
217228}
218229
219230template <class _ForwardIterator, class _Size>
220inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
231inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
232uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
221233 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
222234 return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n);
223235}
......@@ -230,12 +242,12 @@ template <class _ValueType,
230242 class _ForwardIterator,
231243 class _EndPredicate,
232244 class _IterMove>
233inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move(
234 _InputIterator __ifirst,
235 _Sentinel1 __ilast,
236 _ForwardIterator __ofirst,
237 _EndPredicate __stop_moving,
238 _IterMove __iter_move) {
245inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator>
246__uninitialized_move(_InputIterator __ifirst,
247 _Sentinel1 __ilast,
248 _ForwardIterator __ofirst,
249 _EndPredicate __stop_moving,
250 _IterMove __iter_move) {
239251 auto __idx = __ofirst;
240252 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
241253 for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
......@@ -247,14 +259,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
247259}
248260
249261template <class _InputIterator, class _ForwardIterator>
250inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
262inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _ForwardIterator
251263uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) {
252264 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
253 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); };
265 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::__deref_move(__iter); };
254266
255267 auto __result = std::__uninitialized_move<_ValueType>(
256268 std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false(), __iter_move);
257 return std::move(__result.second);
269 return std::move(__result.__out_);
258270}
259271
260272// uninitialized_move_n
......@@ -265,7 +277,8 @@ template <class _ValueType,
265277 class _ForwardIterator,
266278 class _EndPredicate,
267279 class _IterMove>
268inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n(
280inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __in_out_result<_InputIterator, _ForwardIterator>
281__uninitialized_move_n(
269282 _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) {
270283 auto __idx = __ofirst;
271284 auto __guard = std::__make_exception_guard([&] { std::__destroy(__ofirst, __idx); });
......@@ -277,166 +290,14 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
277290}
278291
279292template <class _InputIterator, class _Size, class _ForwardIterator>
280inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
293inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<_InputIterator, _ForwardIterator>
281294uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) {
282295 using _ValueType = typename iterator_traits<_ForwardIterator>::value_type;
283 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); };
296 auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::__deref_move(__iter); };
284297
285 return std::__uninitialized_move_n<_ValueType>(
298 auto __result = std::__uninitialized_move_n<_ValueType>(
286299 std::move(__ifirst), __n, std::move(__ofirst), __always_false(), __iter_move);
287}
288
289// TODO: Rewrite this to iterate left to right and use reverse_iterators when calling
290// Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator
291// destruction. If elements are themselves C-style arrays, they are recursively destroyed
292// in the same manner.
293//
294// This function assumes that destructors do not throw, and that the allocator is bound to
295// the correct type.
296template <class _Alloc,
297 class _BidirIter,
298 __enable_if_t<__has_bidirectional_iterator_category<_BidirIter>::value, int> = 0>
299_LIBCPP_HIDE_FROM_ABI constexpr void
300__allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
301 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
302 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
303 "The allocator should already be rebound to the correct type");
304
305 if (__first == __last)
306 return;
307
308 if constexpr (is_array_v<_ValueType>) {
309 static_assert(!__is_unbounded_array_v<_ValueType>,
310 "arrays of unbounded arrays don't exist, but if they did we would mess up here");
311
312 using _Element = remove_extent_t<_ValueType>;
313 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
314 do {
315 --__last;
316 decltype(auto) __array = *__last;
317 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
318 } while (__last != __first);
319 } else {
320 do {
321 --__last;
322 allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
323 } while (__last != __first);
324 }
325}
326
327// Constructs the object at the given location using the allocator's construct method.
328//
329// If the object being constructed is an array, each element of the array is allocator-constructed,
330// recursively. If an exception is thrown during the construction of an array, the initialized
331// elements are destroyed in reverse order of initialization using allocator destruction.
332//
333// This function assumes that the allocator is bound to the correct type.
334template <class _Alloc, class _Tp>
335_LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
336 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
337 "The allocator should already be rebound to the correct type");
338
339 if constexpr (is_array_v<_Tp>) {
340 using _Element = remove_extent_t<_Tp>;
341 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
342 size_t __i = 0;
343 _Tp& __array = *__loc;
344
345 // If an exception is thrown, destroy what we have constructed so far in reverse order.
346 auto __guard = std::__make_exception_guard([&]() {
347 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
348 });
349
350 for (; __i != extent_v<_Tp>; ++__i) {
351 std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
352 }
353 __guard.__complete();
354 } else {
355 allocator_traits<_Alloc>::construct(__alloc, __loc);
356 }
357}
358
359// Constructs the object at the given location using the allocator's construct method, passing along
360// the provided argument.
361//
362// If the object being constructed is an array, the argument is also assumed to be an array. Each
363// each element of the array being constructed is allocator-constructed from the corresponding
364// element of the argument array. If an exception is thrown during the construction of an array,
365// the initialized elements are destroyed in reverse order of initialization using allocator
366// destruction.
367//
368// This function assumes that the allocator is bound to the correct type.
369template <class _Alloc, class _Tp, class _Arg>
370_LIBCPP_HIDE_FROM_ABI constexpr void
371__allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
372 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
373 "The allocator should already be rebound to the correct type");
374
375 if constexpr (is_array_v<_Tp>) {
376 static_assert(is_array_v<_Arg>,
377 "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
378 "trying to construct an array.");
379
380 using _Element = remove_extent_t<_Tp>;
381 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
382 size_t __i = 0;
383 _Tp& __array = *__loc;
384
385 // If an exception is thrown, destroy what we have constructed so far in reverse order.
386 auto __guard = std::__make_exception_guard([&]() {
387 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
388 });
389 for (; __i != extent_v<_Tp>; ++__i) {
390 std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
391 }
392 __guard.__complete();
393 } else {
394 allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
395 }
396}
397
398// Given a range starting at it and containing n elements, initializes each element in the
399// range from left to right using the construct method of the allocator (rebound to the
400// correct type).
401//
402// If an exception is thrown, the initialized elements are destroyed in reverse order of
403// initialization using allocator_traits destruction. If the elements in the range are C-style
404// arrays, they are initialized element-wise using allocator construction, and recursively so.
405template <class _Alloc,
406 class _BidirIter,
407 class _Tp,
408 class _Size = typename iterator_traits<_BidirIter>::difference_type>
409_LIBCPP_HIDE_FROM_ABI constexpr void
410__uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) {
411 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
412 __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
413 _BidirIter __begin = __it;
414
415 // If an exception is thrown, destroy what we have constructed so far in reverse order.
416 auto __guard =
417 std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
418 for (; __n != 0; --__n, ++__it) {
419 std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
420 }
421 __guard.__complete();
422}
423
424// Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument
425// to the allocator's construct method, which results in value initialization.
426template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type>
427_LIBCPP_HIDE_FROM_ABI constexpr void
428__uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) {
429 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
430 __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
431 _BidirIter __begin = __it;
432
433 // If an exception is thrown, destroy what we have constructed so far in reverse order.
434 auto __guard =
435 std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
436 for (; __n != 0; --__n, ++__it) {
437 std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
438 }
439 __guard.__complete();
300 return {std::move(__result.__in_), std::move(__result.__out_)};
440301}
441302
442303#endif // _LIBCPP_STD_VER >= 17
......@@ -486,7 +347,7 @@ inline const bool __allocator_has_trivial_copy_construct_v<allocator<_Type>, _Ty
486347template <class _Alloc,
487348 class _In,
488349 class _Out,
489 __enable_if_t<is_trivially_copy_constructible<_In>::value && is_trivially_copy_assignable<_In>::value &&
350 __enable_if_t<is_trivially_copy_constructible<_In>::value && is_trivially_assignable<_Out&, _In&>::value &&
490351 is_same<__remove_const_t<_In>, __remove_const_t<_Out> >::value &&
491352 __allocator_has_trivial_copy_construct_v<_Alloc, _In>,
492353 int> = 0>
lib/libcxx/include/__memory/uninitialized_multidimensional_algorithms.h created+194
......@@ -0,0 +1,194 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H
10#define _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__iterator/iterator_traits.h>
15#include <__memory/addressof.h>
16#include <__memory/allocator_traits.h>
17#include <__type_traits/enable_if.h>
18#include <__type_traits/extent.h>
19#include <__type_traits/is_array.h>
20#include <__type_traits/is_same.h>
21#include <__type_traits/remove_extent.h>
22#include <__utility/exception_guard.h>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28_LIBCPP_PUSH_MACROS
29#include <__undef_macros>
30
31#if _LIBCPP_STD_VER >= 17
32
33_LIBCPP_BEGIN_NAMESPACE_STD
34
35// TODO: Rewrite this to iterate left to right and use reverse_iterators when calling
36// Destroys every element in the range [first, last) FROM RIGHT TO LEFT using allocator
37// destruction. If elements are themselves C-style arrays, they are recursively destroyed
38// in the same manner.
39//
40// This function assumes that destructors do not throw, and that the allocator is bound to
41// the correct type.
42template <class _Alloc,
43 class _BidirIter,
44 __enable_if_t<__has_bidirectional_iterator_category<_BidirIter>::value, int> = 0>
45_LIBCPP_HIDE_FROM_ABI constexpr void
46__allocator_destroy_multidimensional(_Alloc& __alloc, _BidirIter __first, _BidirIter __last) noexcept {
47 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
48 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _ValueType>,
49 "The allocator should already be rebound to the correct type");
50
51 if (__first == __last)
52 return;
53
54 if constexpr (is_array_v<_ValueType>) {
55 static_assert(!__is_unbounded_array_v<_ValueType>,
56 "arrays of unbounded arrays don't exist, but if they did we would mess up here");
57
58 using _Element = remove_extent_t<_ValueType>;
59 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
60 do {
61 --__last;
62 decltype(auto) __array = *__last;
63 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + extent_v<_ValueType>);
64 } while (__last != __first);
65 } else {
66 do {
67 --__last;
68 allocator_traits<_Alloc>::destroy(__alloc, std::addressof(*__last));
69 } while (__last != __first);
70 }
71}
72
73// Constructs the object at the given location using the allocator's construct method.
74//
75// If the object being constructed is an array, each element of the array is allocator-constructed,
76// recursively. If an exception is thrown during the construction of an array, the initialized
77// elements are destroyed in reverse order of initialization using allocator destruction.
78//
79// This function assumes that the allocator is bound to the correct type.
80template <class _Alloc, class _Tp>
81_LIBCPP_HIDE_FROM_ABI constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) {
82 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
83 "The allocator should already be rebound to the correct type");
84
85 if constexpr (is_array_v<_Tp>) {
86 using _Element = remove_extent_t<_Tp>;
87 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
88 size_t __i = 0;
89 _Tp& __array = *__loc;
90
91 // If an exception is thrown, destroy what we have constructed so far in reverse order.
92 auto __guard = std::__make_exception_guard([&]() {
93 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
94 });
95
96 for (; __i != extent_v<_Tp>; ++__i) {
97 std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]));
98 }
99 __guard.__complete();
100 } else {
101 allocator_traits<_Alloc>::construct(__alloc, __loc);
102 }
103}
104
105// Constructs the object at the given location using the allocator's construct method, passing along
106// the provided argument.
107//
108// If the object being constructed is an array, the argument is also assumed to be an array. Each
109// each element of the array being constructed is allocator-constructed from the corresponding
110// element of the argument array. If an exception is thrown during the construction of an array,
111// the initialized elements are destroyed in reverse order of initialization using allocator
112// destruction.
113//
114// This function assumes that the allocator is bound to the correct type.
115template <class _Alloc, class _Tp, class _Arg>
116_LIBCPP_HIDE_FROM_ABI constexpr void
117__allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) {
118 static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>,
119 "The allocator should already be rebound to the correct type");
120
121 if constexpr (is_array_v<_Tp>) {
122 static_assert(is_array_v<_Arg>,
123 "Provided non-array initialization argument to __allocator_construct_at_multidimensional when "
124 "trying to construct an array.");
125
126 using _Element = remove_extent_t<_Tp>;
127 __allocator_traits_rebind_t<_Alloc, _Element> __elem_alloc(__alloc);
128 size_t __i = 0;
129 _Tp& __array = *__loc;
130
131 // If an exception is thrown, destroy what we have constructed so far in reverse order.
132 auto __guard = std::__make_exception_guard([&]() {
133 std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i);
134 });
135 for (; __i != extent_v<_Tp>; ++__i) {
136 std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]);
137 }
138 __guard.__complete();
139 } else {
140 allocator_traits<_Alloc>::construct(__alloc, __loc, __arg);
141 }
142}
143
144// Given a range starting at it and containing n elements, initializes each element in the
145// range from left to right using the construct method of the allocator (rebound to the
146// correct type).
147//
148// If an exception is thrown, the initialized elements are destroyed in reverse order of
149// initialization using allocator_traits destruction. If the elements in the range are C-style
150// arrays, they are initialized element-wise using allocator construction, and recursively so.
151template <class _Alloc,
152 class _BidirIter,
153 class _Tp,
154 class _Size = typename iterator_traits<_BidirIter>::difference_type>
155_LIBCPP_HIDE_FROM_ABI constexpr void
156__uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) {
157 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
158 __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
159 _BidirIter __begin = __it;
160
161 // If an exception is thrown, destroy what we have constructed so far in reverse order.
162 auto __guard =
163 std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
164 for (; __n != 0; --__n, ++__it) {
165 std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value);
166 }
167 __guard.__complete();
168}
169
170// Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument
171// to the allocator's construct method, which results in value initialization.
172template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type>
173_LIBCPP_HIDE_FROM_ABI constexpr void
174__uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) {
175 using _ValueType = typename iterator_traits<_BidirIter>::value_type;
176 __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc);
177 _BidirIter __begin = __it;
178
179 // If an exception is thrown, destroy what we have constructed so far in reverse order.
180 auto __guard =
181 std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); });
182 for (; __n != 0; --__n, ++__it) {
183 std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it));
184 }
185 __guard.__complete();
186}
187
188_LIBCPP_END_NAMESPACE_STD
189
190#endif // _LIBCPP_STD_VER >= 17
191
192_LIBCPP_POP_MACROS
193
194#endif // _LIBCPP___MEMORY_UNINITIALIZED_MULTIDIMENSIONAL_ALGORITHMS_H
lib/libcxx/include/__memory/unique_ptr.h+62-110
......@@ -27,7 +27,6 @@
2727#include <__type_traits/add_reference.h>
2828#include <__type_traits/common_type.h>
2929#include <__type_traits/conditional.h>
30#include <__type_traits/dependent_type.h>
3130#include <__type_traits/enable_if.h>
3231#include <__type_traits/integral_constant.h>
3332#include <__type_traits/is_array.h>
......@@ -43,7 +42,8 @@
4342#include <__type_traits/is_trivially_relocatable.h>
4443#include <__type_traits/is_void.h>
4544#include <__type_traits/remove_extent.h>
46#include <__type_traits/type_identity.h>
45#include <__type_traits/remove_reference.h>
46#include <__type_traits/void_t.h>
4747#include <__utility/declval.h>
4848#include <__utility/forward.h>
4949#include <__utility/move.h>
......@@ -95,27 +95,17 @@ inline const bool __is_default_deleter_v = false;
9595template <class _Tp>
9696inline const bool __is_default_deleter_v<default_delete<_Tp> > = true;
9797
98template <class _Deleter>
99struct __unique_ptr_deleter_sfinae {
100 static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
101 typedef const _Deleter& __lval_ref_type;
102 typedef _Deleter&& __good_rval_ref_type;
103 typedef true_type __enable_rval_overload;
104};
98template <class, class = void>
99inline const bool __can_dereference = false;
105100
106template <class _Deleter>
107struct __unique_ptr_deleter_sfinae<_Deleter const&> {
108 typedef const _Deleter& __lval_ref_type;
109 typedef const _Deleter&& __bad_rval_ref_type;
110 typedef false_type __enable_rval_overload;
111};
101template <class _Tp>
102inline const bool __can_dereference<_Tp, decltype((void)*std::declval<_Tp>())> = true;
112103
113template <class _Deleter>
114struct __unique_ptr_deleter_sfinae<_Deleter&> {
115 typedef _Deleter& __lval_ref_type;
116 typedef _Deleter&& __bad_rval_ref_type;
117 typedef false_type __enable_rval_overload;
118};
104template <class _Tp, class = void>
105inline const bool __can_add_pointer = false;
106
107template <class _Tp>
108inline const bool __can_add_pointer<_Tp, __void_t<_Tp*> > = true;
119109
120110#if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI)
121111# define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__))
......@@ -125,13 +115,14 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {
125115
126116template <class _Tp, class _Dp = default_delete<_Tp> >
127117class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr {
118 static_assert(__can_add_pointer<_Tp>, "unique_ptr<T, D> requires T* to be a valid type");
119 static_assert(!is_rvalue_reference<_Dp>::value, "the specified deleter type cannot be an rvalue reference");
120
128121public:
129122 typedef _Tp element_type;
130123 typedef _Dp deleter_type;
131124 using pointer _LIBCPP_NODEBUG = __pointer<_Tp, deleter_type>;
132125
133 static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference");
134
135126 // A unique_ptr contains the following members which may be trivially relocatable:
136127 // - pointer : this may be trivially relocatable, so it's checked
137128 // - deleter_type: this may be trivially relocatable, so it's checked
......@@ -146,24 +137,6 @@ public:
146137private:
147138 _LIBCPP_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
148139
149 using _DeleterSFINAE _LIBCPP_NODEBUG = __unique_ptr_deleter_sfinae<_Dp>;
150
151 template <bool _Dummy>
152 using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
153
154 template <bool _Dummy>
155 using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
156
157 template <bool _Dummy>
158 using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
159
160 template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
161 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
162 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
163
164 template <class _ArgType>
165 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
166
167140 template <class _UPtr, class _Up>
168141 using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
169142 __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >;
......@@ -177,31 +150,33 @@ private:
177150 using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
178151
179152public:
180 template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
153 template <class _Deleter = deleter_type,
154 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0>
181155 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {}
182156
183 template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
157 template <class _Deleter = deleter_type,
158 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0>
184159 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {}
185160
186 template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
161 template <class _Deleter = deleter_type,
162 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0>
187163 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT
188164 : __ptr_(__p),
189165 __deleter_() {}
190166
191 template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
192 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
167 template <class _Deleter = deleter_type, __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0>
168 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, const deleter_type& __d) _NOEXCEPT
193169 : __ptr_(__p),
194170 __deleter_(__d) {}
195171
196 template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
197 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT
172 template <class _Deleter = deleter_type,
173 __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0>
174 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, deleter_type&& __d) _NOEXCEPT
198175 : __ptr_(__p),
199 __deleter_(std::move(__d)) {
200 static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
201 }
176 __deleter_(std::move(__d)) {}
202177
203 template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > >
204 _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
178 template <class _Deleter = deleter_type, __enable_if_t<is_reference<_Deleter>::value, int> = 0>
179 _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer, __libcpp_remove_reference_t<deleter_type>&&) = delete;
205180
206181 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
207182 : __ptr_(__u.release()),
......@@ -222,7 +197,7 @@ public:
222197#endif
223198
224199 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
225 reset(__u.release());
200 reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release)
226201 __deleter_ = std::forward<deleter_type>(__u.get_deleter());
227202 return *this;
228203 }
......@@ -258,6 +233,7 @@ public:
258233 return *this;
259234 }
260235
236 template <class _Ptr = pointer, __enable_if_t<__can_dereference<_Ptr>, int> = 0>
261237 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const
262238 _NOEXCEPT_(_NOEXCEPT_(*std::declval<pointer>())) {
263239 return *__ptr_;
......@@ -434,27 +410,6 @@ private:
434410 (is_same<pointer, element_type*>::value &&
435411 is_convertible<_FromElem (*)[], element_type (*)[]>::value) > {};
436412
437 typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
438
439 template <bool _Dummy>
440 using _LValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
441
442 template <bool _Dummy>
443 using _GoodRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
444
445 template <bool _Dummy>
446 using _BadRValRefType _LIBCPP_NODEBUG = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
447
448 template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type>
449 using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG =
450 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>;
451
452 template <class _ArgType>
453 using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = __enable_if_t<is_constructible<deleter_type, _ArgType>::value>;
454
455 template <class _Pp>
456 using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t< _CheckArrayPointerConversion<_Pp>::value >;
457
458413 template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type>
459414 using _EnableIfMoveConvertible _LIBCPP_NODEBUG =
460415 __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value &&
......@@ -470,17 +425,19 @@ private:
470425 using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value >;
471426
472427public:
473 template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
428 template <class _Deleter = deleter_type,
429 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0>
474430 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(), __deleter_() {}
475431
476 template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
432 template <class _Deleter = deleter_type,
433 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0>
477434 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(), __deleter_() {}
478435
479 template <class _Pp,
480 bool _Dummy = true,
481 class = _EnableIfDeleterDefaultConstructible<_Dummy>,
482 class = _EnableIfPointerConvertible<_Pp> >
483 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __ptr) _NOEXCEPT
436 template <class _Ptr,
437 class _Deleter = deleter_type,
438 __enable_if_t<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value, int> = 0,
439 __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0>
440 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Ptr __ptr) _NOEXCEPT
484441 : __ptr_(__ptr),
485442 __deleter_() {}
486443
......@@ -490,43 +447,38 @@ public:
490447 : __ptr_(__ptr),
491448 __checker_(__size) {}
492449
493 template <class _Pp,
494 bool _Dummy = true,
495 class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >,
496 class = _EnableIfPointerConvertible<_Pp> >
497 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __ptr, _LValRefType<_Dummy> __deleter) _NOEXCEPT
450 template <class _Ptr,
451 class _Deleter = deleter_type,
452 __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0,
453 __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0>
454 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Ptr __ptr, const deleter_type& __deleter) _NOEXCEPT
498455 : __ptr_(__ptr),
499456 __deleter_(__deleter) {}
500457
501 template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
502 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __deleter) _NOEXCEPT
458 template <class _Deleter = deleter_type, __enable_if_t<is_copy_constructible<_Deleter>::value, int> = 0>
459 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, const deleter_type& __deleter) _NOEXCEPT
503460 : __ptr_(nullptr),
504461 __deleter_(__deleter) {}
505462
506 template <class _Pp,
507 bool _Dummy = true,
508 class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >,
509 class = _EnableIfPointerConvertible<_Pp> >
510 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
511 unique_ptr(_Pp __ptr, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT
463 template <class _Ptr,
464 class _Deleter = deleter_type,
465 __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0,
466 __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0>
467 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Ptr __ptr, deleter_type&& __deleter) _NOEXCEPT
512468 : __ptr_(__ptr),
513 __deleter_(std::move(__deleter)) {
514 static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
515 }
469 __deleter_(std::move(__deleter)) {}
516470
517 template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > >
518 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23
519 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __deleter) _NOEXCEPT
471 template <class _Deleter = deleter_type,
472 __enable_if_t<!is_reference<_Deleter>::value && is_move_constructible<_Deleter>::value, int> = 0>
473 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, deleter_type&& __deleter) _NOEXCEPT
520474 : __ptr_(nullptr),
521 __deleter_(std::move(__deleter)) {
522 static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
523 }
475 __deleter_(std::move(__deleter)) {}
524476
525 template <class _Pp,
526 bool _Dummy = true,
527 class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >,
528 class = _EnableIfPointerConvertible<_Pp> >
529 _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __ptr, _BadRValRefType<_Dummy> __deleter) = delete;
477 template <class _Ptr,
478 class _Deleter = deleter_type,
479 __enable_if_t<is_reference<_Deleter>::value, int> = 0,
480 __enable_if_t<_CheckArrayPointerConversion<_Ptr>::value, int> = 0>
481 _LIBCPP_HIDE_FROM_ABI unique_ptr(_Ptr, __libcpp_remove_reference_t<deleter_type>&&) = delete;
530482
531483 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT
532484 : __ptr_(__u.release()),
......@@ -534,7 +486,7 @@ public:
534486 __checker_(std::move(__u.__checker_)) {}
535487
536488 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
537 reset(__u.release());
489 reset(__u.release()); // NOLINT(misc-uniqueptr-reset-release)
538490 __deleter_ = std::forward<deleter_type>(__u.get_deleter());
539491 __checker_ = std::move(__u.__checker_);
540492 return *this;
lib/libcxx/include/__memory/uses_allocator_construction.h+6-6
......@@ -27,10 +27,10 @@
2727_LIBCPP_PUSH_MACROS
2828#include <__undef_macros>
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230#if _LIBCPP_STD_VER >= 17
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3434template <class _Tp>
3535inline constexpr bool __is_cv_std_pair = __is_pair_v<remove_cv_t<_Tp>>;
3636
......@@ -202,9 +202,7 @@ __uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _
202202 __uses_allocator_construction_args<_Type>::__apply(__alloc, std::forward<_Args>(__args)...));
203203}
204204
205#endif // _LIBCPP_STD_VER >= 17
206
207#if _LIBCPP_STD_VER >= 20
205# if _LIBCPP_STD_VER >= 20
208206
209207template <class _Type, class _Alloc, class... _Args>
210208_LIBCPP_HIDE_FROM_ABI constexpr auto uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept
......@@ -225,10 +223,12 @@ uninitialized_construct_using_allocator(_Type* __ptr, const _Alloc& __alloc, _Ar
225223 return /*--*/ std::__uninitialized_construct_using_allocator(__ptr, __alloc, std::forward<_Args>(__args)...);
226224}
227225
228#endif // _LIBCPP_STD_VER >= 20
226# endif // _LIBCPP_STD_VER >= 20
229227
230228_LIBCPP_END_NAMESPACE_STD
231229
230#endif // _LIBCPP_STD_VER >= 17
231
232232_LIBCPP_POP_MACROS
233233
234234#endif // _LIBCPP___MEMORY_USES_ALLOCATOR_CONSTRUCTION_H
lib/libcxx/include/__memory/valid_range.h created+74
......@@ -0,0 +1,74 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___MEMORY_VALID_RANGE_H
10#define _LIBCPP___MEMORY_VALID_RANGE_H
11
12#include <__algorithm/comp.h>
13#include <__assert>
14#include <__config>
15#include <__iterator/iterator_traits.h>
16#include <__memory/assume_aligned.h>
17#include <__memory/pointer_traits.h>
18#include <__type_traits/is_constant_evaluated.h>
19#include <__type_traits/is_same.h>
20#include <__type_traits/remove_cvref.h>
21
22#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
23# pragma GCC system_header
24#endif
25
26_LIBCPP_BEGIN_NAMESPACE_STD
27
28// A valid range as defined by the C++ Standard has the following constraints:
29// - [__first, __last) is dereferenceable
30// - __last is reachable from __first
31// - if __first and __last are contiguous iterators, the pointers they "decay to" are correctly aligned according to the
32// language rules for pointers
33
34// This function attempts to detect invalid ranges as defined above. Specifically, it checks bullet (2). This also means
35// that it doesn't return whether a range is actually valid, but only whether a range is definitely not valid.
36// The checks may be extended in the future.
37template <class _Tp>
38_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
39__is_valid_range(const _Tp* __first, const _Tp* __last) {
40 if (__libcpp_is_constant_evaluated()) {
41 // If this is not a constant during constant evaluation, that is because __first and __last are not
42 // part of the same allocation. If they are part of the same allocation, we must still make sure they
43 // are ordered properly.
44 return __builtin_constant_p(__first <= __last) && __first <= __last;
45 }
46
47 return !__less<>()(__last, __first);
48}
49
50// This function allows the compiler to assume that [__first, __last) is a valid range as defined above.
51//
52// In practice, we only add explicit assumptions for bullets (1) and (3). These assumptions allow (currently only
53// clang-based compilers) to auto-vectorize algorithms that contain early returns.
54template <class _Iter, class _Sent>
55_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
56__assume_valid_range([[__maybe_unused__]] _Iter&& __first, [[__maybe_unused__]] _Sent&& __last) {
57#if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2300 && !defined(_LIBCPP_CXX03_LANG)
58 if constexpr (__libcpp_is_contiguous_iterator<__remove_cvref_t<_Iter>>::value &&
59 is_same<__remove_cvref_t<_Iter>, __remove_cvref_t<_Sent>>::value) {
60 _LIBCPP_ASSERT_INTERNAL(std::__is_valid_range(std::__to_address(__first), std::__to_address(__last)),
61 "Valid range assumption does not hold");
62 if (!__libcpp_is_constant_evaluated()) {
63 using __value_type = typename iterator_traits<__remove_cvref_t<_Iter>>::value_type;
64 __builtin_assume_dereferenceable(std::__to_address(__first), (__last - __first) * sizeof(__value_type));
65 (void)std::__assume_aligned<_LIBCPP_ALIGNOF(__value_type)>(std::__to_address(__first));
66 (void)std::__assume_aligned<_LIBCPP_ALIGNOF(__value_type)>(std::__to_address(__last));
67 }
68 }
69#endif
70}
71
72_LIBCPP_END_NAMESPACE_STD
73
74#endif // _LIBCPP___MEMORY_VALID_RANGE_H
lib/libcxx/include/__memory_resource/memory_resource.h+2
......@@ -21,6 +21,7 @@
2121#if _LIBCPP_STD_VER >= 17
2222
2323_LIBCPP_BEGIN_NAMESPACE_STD
24_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2425
2526namespace pmr {
2627
......@@ -84,6 +85,7 @@ null_memory_resource() noexcept;
8485
8586} // namespace pmr
8687
88_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
8789_LIBCPP_END_NAMESPACE_STD
8890
8991#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__memory_resource/monotonic_buffer_resource.h+2
......@@ -21,6 +21,7 @@
2121#if _LIBCPP_STD_VER >= 17
2222
2323_LIBCPP_BEGIN_NAMESPACE_STD
24_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2425
2526namespace pmr {
2627
......@@ -112,6 +113,7 @@ private:
112113
113114} // namespace pmr
114115
116_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
115117_LIBCPP_END_NAMESPACE_STD
116118
117119#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__memory_resource/synchronized_pool_resource.h+2
......@@ -24,6 +24,7 @@
2424#if _LIBCPP_STD_VER >= 17
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728
2829namespace pmr {
2930
......@@ -88,6 +89,7 @@ private:
8889
8990} // namespace pmr
9091
92_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
9193_LIBCPP_END_NAMESPACE_STD
9294
9395#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__memory_resource/unsynchronized_pool_resource.h+2
......@@ -22,6 +22,7 @@
2222#if _LIBCPP_STD_VER >= 17
2323
2424_LIBCPP_BEGIN_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
2627namespace pmr {
2728
......@@ -99,6 +100,7 @@ private:
99100
100101} // namespace pmr
101102
103_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
102104_LIBCPP_END_NAMESPACE_STD
103105
104106#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__mutex/lock_guard.h+1-1
......@@ -34,7 +34,7 @@ public:
3434
3535 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_REQUIRES_CAPABILITY(__m)
3636 : __m_(__m) {}
37 _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI ~lock_guard() { __m_.unlock(); }
37 _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~lock_guard() { __m_.unlock(); }
3838
3939 lock_guard(lock_guard const&) = delete;
4040 lock_guard& operator=(lock_guard const&) = delete;
lib/libcxx/include/__mutex/mutex.h+3-1
......@@ -20,6 +20,7 @@
2020#if _LIBCPP_HAS_THREADS
2121
2222_LIBCPP_BEGIN_NAMESPACE_STD
23_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2324
2425class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_CAPABILITY("mutex") mutex {
2526 __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
......@@ -38,7 +39,7 @@ public:
3839
3940 _LIBCPP_ACQUIRE_CAPABILITY() void lock();
4041 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock() _NOEXCEPT;
41 _LIBCPP_RELEASE_CAPABILITY void unlock() _NOEXCEPT;
42 _LIBCPP_RELEASE_CAPABILITY() void unlock() _NOEXCEPT;
4243
4344 typedef __libcpp_mutex_t* native_handle_type;
4445 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; }
......@@ -46,6 +47,7 @@ public:
4647
4748static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow");
4849
50_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4951_LIBCPP_END_NAMESPACE_STD
5052
5153#endif // _LIBCPP_HAS_THREADS
lib/libcxx/include/__mutex/once_flag.h+2
......@@ -113,7 +113,9 @@ void _LIBCPP_HIDE_FROM_ABI __call_once_proxy(void* __vp) {
113113 (*__p)();
114114}
115115
116_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
116117_LIBCPP_EXPORTED_FROM_ABI void __call_once(volatile once_flag::_State_type&, void*, void (*)(void*));
118_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
117119
118120template <class _ValueType>
119121inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) {
lib/libcxx/include/__mutex/unique_lock.h+5-5
......@@ -84,13 +84,13 @@ public:
8484 }
8585
8686 _LIBCPP_HIDE_FROM_ABI void lock();
87 _LIBCPP_HIDE_FROM_ABI bool try_lock();
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock();
8888
8989 template <class _Rep, class _Period>
90 _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
90 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
9191
9292 template <class _Clock, class _Duration>
93 _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
93 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
9494
9595 _LIBCPP_HIDE_FROM_ABI void unlock();
9696
......@@ -106,9 +106,9 @@ public:
106106 return __m;
107107 }
108108
109 _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; }
109 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; }
110110 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; }
111 _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; }
111 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; }
112112};
113113_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock);
114114
lib/libcxx/include/__new/exceptions.h+3
......@@ -24,6 +24,8 @@
2424#endif
2525
2626_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
28
2729#if !defined(_LIBCPP_ABI_VCRUNTIME)
2830
2931class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception {
......@@ -74,6 +76,7 @@ public:
7476 _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
7577#endif
7678}
79_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7780_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
7881
7982#endif // _LIBCPP___NEW_EXCEPTIONS_H
lib/libcxx/include/__new/new_handler.h+4
......@@ -19,9 +19,13 @@
1919# include <new.h>
2020#else
2121_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
23
2224typedef void (*new_handler)();
2325_LIBCPP_EXPORTED_FROM_ABI new_handler set_new_handler(new_handler) _NOEXCEPT;
2426_LIBCPP_EXPORTED_FROM_ABI new_handler get_new_handler() _NOEXCEPT;
27
28_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2529_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
2630#endif // _LIBCPP_ABI_VCRUNTIME
2731
lib/libcxx/include/__new/placement_new_delete.h+2-2
......@@ -27,8 +27,8 @@ operator new(std::size_t, void* __p) _NOEXCEPT {
2727operator new[](std::size_t, void* __p) _NOEXCEPT {
2828 return __p;
2929}
30inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {}
31inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
30inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete(void*, void*) _NOEXCEPT {}
31inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete[](void*, void*) _NOEXCEPT {}
3232#endif
3333
3434#endif // _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H
lib/libcxx/include/__node_handle+37-36
......@@ -31,29 +31,29 @@ private:
3131public:
3232 // [container.node.cons], constructors, copy, and assignment
3333 constexpr node-handle() noexcept : ptr_(), alloc_() {}
34 node-handle(node-handle&&) noexcept;
35 node-handle& operator=(node-handle&&);
34 constexpr node-handle(node-handle&&) noexcept; // constexpr since C++26
35 constexpr node-handle& operator=(node-handle&&); // constexpr since C++26
3636
3737 // [container.node.dtor], destructor
38 ~node-handle();
38 constexpr ~node-handle(); // constexpr since C++26
3939
4040 // [container.node.observers], observers
41 value_type& value() const; // not present for map containers
42 key_type& key() const; // not present for set containers
43 mapped_type& mapped() const; // not present for set containers
41 value_type& value() const; // not present for map containers
42 key_type& key() const; // not present for set containers
43 constexpr mapped_type& mapped() const; // not present for set containers, constexpr since C++26
4444
45 allocator_type get_allocator() const;
46 explicit operator bool() const noexcept;
47 [[nodiscard]] bool empty() const noexcept; // nodiscard since C++20
45 constexpr allocator_type get_allocator() const; // constexpr since C++26
46 constexpr explicit operator bool() const noexcept; // constexpr since C++26
47 [[nodiscard]] constexpr bool empty() const noexcept; // nodiscard since C++20, constexpr since C++26
4848
4949 // [container.node.modifiers], modifiers
50 void swap(node-handle&)
50 constexpr void swap(node-handle&)
5151 noexcept(ator_traits::propagate_on_container_swap::value ||
52 ator_traits::is_always_equal::value);
52 ator_traits::is_always_equal::value); // constexpr since C++26
5353
54 friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
54 constexpr friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
5555 x.swap(y);
56 }
56 } // constexpr since C++26
5757};
5858
5959*/
......@@ -63,6 +63,7 @@ public:
6363#include <__memory/allocator_traits.h>
6464#include <__memory/pointer_traits.h>
6565#include <__type_traits/is_specialization.h>
66#include <__utility/exchange.h>
6667#include <optional>
6768
6869#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -72,10 +73,10 @@ public:
7273_LIBCPP_PUSH_MACROS
7374#include <__undef_macros>
7475
75_LIBCPP_BEGIN_NAMESPACE_STD
76
7776#if _LIBCPP_STD_VER >= 17
7877
78_LIBCPP_BEGIN_NAMESPACE_STD
79
7980// Specialized in __tree & __hash_table for their _NodeType.
8081template <class _NodeType, class _Alloc>
8182struct __generic_container_node_destructor;
......@@ -99,12 +100,12 @@ private:
99100 __node_pointer_type __ptr_ = nullptr;
100101 optional<allocator_type> __alloc_;
101102
102 _LIBCPP_HIDE_FROM_ABI void __release_ptr() {
103 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __release_ptr() {
103104 __ptr_ = nullptr;
104105 __alloc_ = std::nullopt;
105106 }
106107
107 _LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
108 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __destroy_node_pointer() {
108109 if (__ptr_ != nullptr) {
109110 typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
110111 __node_alloc_type __alloc(*__alloc_);
......@@ -113,19 +114,17 @@ private:
113114 }
114115 }
115116
116 _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
117 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
118 __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
117119 : __ptr_(__ptr), __alloc_(__alloc) {}
118120
119121public:
120 _LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
122 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle() = default;
121123
122 _LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
123 : __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
124 __other.__ptr_ = nullptr;
125 __other.__alloc_ = std::nullopt;
126 }
124 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle(__basic_node_handle&& __other) noexcept
125 : __ptr_(std::exchange(__other.__ptr_, nullptr)), __alloc_(std::exchange(__other.__alloc_, std::nullopt)) {}
127126
128 _LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
127 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle& operator=(__basic_node_handle&& __other) {
129128 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
130129 __alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
131130 __alloc_ == __other.__alloc_,
......@@ -133,24 +132,23 @@ public:
133132 "node_type::operator=(node_type&&)");
134133
135134 __destroy_node_pointer();
136 __ptr_ = __other.__ptr_;
135 __ptr_ = std::exchange(__other.__ptr_, nullptr);
137136
138137 if (__alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == std::nullopt)
139138 __alloc_ = std::move(__other.__alloc_);
140139
141 __other.__ptr_ = nullptr;
142140 __other.__alloc_ = std::nullopt;
143141
144142 return *this;
145143 }
146144
147 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
145 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const { return *__alloc_; }
148146
149 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
147 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit operator bool() const { return __ptr_ != nullptr; }
150148
151 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
149 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const { return __ptr_ == nullptr; }
152150
153 _LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
151 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__basic_node_handle& __other) noexcept(
154152 __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
155153 using std::swap;
156154 swap(__ptr_, __other.__ptr_);
......@@ -159,19 +157,21 @@ public:
159157 swap(__alloc_, __other.__alloc_);
160158 }
161159
162 _LIBCPP_HIDE_FROM_ABI friend void
160 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void
163161 swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
164162 __a.swap(__b);
165163 }
166164
167 _LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
165 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__basic_node_handle() { __destroy_node_pointer(); }
168166};
169167
170168template <class _NodeType, class _Derived>
171169struct __set_node_handle_specifics {
172170 typedef typename _NodeType::__node_value_type value_type;
173171
174 _LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
172 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& value() const {
173 return static_cast<_Derived const*>(this)->__ptr_->__get_value();
174 }
175175};
176176
177177template <class _NodeType, class _Derived>
......@@ -179,6 +179,7 @@ struct __map_node_handle_specifics {
179179 using key_type = __remove_const_t<typename _NodeType::__node_value_type::first_type>;
180180 using mapped_type = typename _NodeType::__node_value_type::second_type;
181181
182 // This method is not constexpr as per the standard.
182183 _LIBCPP_HIDE_FROM_ABI key_type& key() const {
183184 return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first);
184185 }
......@@ -201,10 +202,10 @@ struct __insert_return_type {
201202 _NodeType node;
202203};
203204
204#endif // _LIBCPP_STD_VER >= 17
205
206205_LIBCPP_END_NAMESPACE_STD
207206
207#endif // _LIBCPP_STD_VER >= 17
208
208209_LIBCPP_POP_MACROS
209210
210211#endif // _LIBCPP___NODE_HANDLE
lib/libcxx/include/__numeric/accumulate.h+2-2
......@@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS
2323_LIBCPP_BEGIN_NAMESPACE_STD
2424
2525template <class _InputIterator, class _Tp>
26_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
26[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
2727accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) {
2828 for (; __first != __last; ++__first)
2929#if _LIBCPP_STD_VER >= 20
......@@ -35,7 +35,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) {
3535}
3636
3737template <class _InputIterator, class _Tp, class _BinaryOperation>
38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
38[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
3939accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) {
4040 for (; __first != __last; ++__first)
4141#if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__numeric/gcd_lcm.h+2-2
......@@ -47,7 +47,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI _Result __abs_in_type(_Source __t) noexcept {
4747}
4848
4949template <class _Tp, class _Up>
50constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
50[[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
5151 static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types");
5252 static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool");
5353 static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool");
......@@ -95,7 +95,7 @@ constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
9595}
9696
9797template <class _Tp, class _Up>
98constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
98[[nodiscard]] constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
9999 static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types");
100100 static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool");
101101 static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool");
lib/libcxx/include/__numeric/inner_product.h+2-2
......@@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS
2323_LIBCPP_BEGIN_NAMESPACE_STD
2424
2525template <class _InputIterator1, class _InputIterator2, class _Tp>
26_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
26[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
2727inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
2828 for (; __first1 != __last1; ++__first1, (void)++__first2)
2929#if _LIBCPP_STD_VER >= 20
......@@ -35,7 +35,7 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2
3535}
3636
3737template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
38_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product(
38[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp inner_product(
3939 _InputIterator1 __first1,
4040 _InputIterator1 __last1,
4141 _InputIterator2 __first2,
lib/libcxx/include/__numeric/pstl.h+6-6
......@@ -41,7 +41,7 @@ template <class _ExecutionPolicy,
4141 class _BinaryOperation,
4242 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
4343 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
44_LIBCPP_HIDE_FROM_ABI _Tp reduce(
44[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp reduce(
4545 _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) {
4646 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
4747 using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
......@@ -58,7 +58,7 @@ template <class _ExecutionPolicy,
5858 class _Tp,
5959 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
6060 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
61_LIBCPP_HIDE_FROM_ABI _Tp
61[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp
6262reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) {
6363 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
6464 using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
......@@ -70,7 +70,7 @@ template <class _ExecutionPolicy,
7070 class _ForwardIterator,
7171 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
7272 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
73_LIBCPP_HIDE_FROM_ABI __iterator_value_type<_ForwardIterator>
73[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __iterator_value_type<_ForwardIterator>
7474reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) {
7575 _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
7676 using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
......@@ -90,7 +90,7 @@ template <class _ExecutionPolicy,
9090 class _BinaryOperation2,
9191 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
9292 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
93_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
93[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
9494 _ExecutionPolicy&& __policy,
9595 _ForwardIterator1 __first1,
9696 _ForwardIterator1 __last1,
......@@ -120,7 +120,7 @@ template <class _ExecutionPolicy,
120120 class _Tp,
121121 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
122122 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
123_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
123[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
124124 _ExecutionPolicy&& __policy,
125125 _ForwardIterator1 __first1,
126126 _ForwardIterator1 __last1,
......@@ -147,7 +147,7 @@ template <class _ExecutionPolicy,
147147 class _UnaryOperation,
148148 class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
149149 enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
150_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
150[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
151151 _ExecutionPolicy&& __policy,
152152 _ForwardIterator __first,
153153 _ForwardIterator __last,
lib/libcxx/include/__numeric/ranges_iota.h+4-3
......@@ -26,9 +26,10 @@
2626_LIBCPP_PUSH_MACROS
2727#include <__undef_macros>
2828
29#if _LIBCPP_STD_VER >= 23
30
2931_LIBCPP_BEGIN_NAMESPACE_STD
3032
31#if _LIBCPP_STD_VER >= 23
3233namespace ranges {
3334template <typename _Out, typename _Tp>
3435using iota_result = ranges::out_value_result<_Out, _Tp>;
......@@ -56,10 +57,10 @@ public:
5657inline constexpr auto iota = __iota_fn{};
5758} // namespace ranges
5859
59#endif // _LIBCPP_STD_VER >= 23
60
6160_LIBCPP_END_NAMESPACE_STD
6261
62#endif // _LIBCPP_STD_VER >= 23
63
6364_LIBCPP_POP_MACROS
6465
6566#endif // _LIBCPP___NUMERIC_RANGES_IOTA_H
lib/libcxx/include/__numeric/reduce.h+8-6
......@@ -22,32 +22,34 @@
2222_LIBCPP_PUSH_MACROS
2323#include <__undef_macros>
2424
25#if _LIBCPP_STD_VER >= 17
26
2527_LIBCPP_BEGIN_NAMESPACE_STD
2628
27#if _LIBCPP_STD_VER >= 17
2829template <class _InputIterator, class _Tp, class _BinaryOp>
29_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
30reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
30[[nodiscard]] _LIBCPP_HIDE_FROM_ABI
31_LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
3132 for (; __first != __last; ++__first)
3233 __init = __b(std::move(__init), *__first);
3334 return __init;
3435}
3536
3637template <class _InputIterator, class _Tp>
37_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
38[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
3839reduce(_InputIterator __first, _InputIterator __last, _Tp __init) {
3940 return std::reduce(__first, __last, __init, std::plus<>());
4041}
4142
4243template <class _InputIterator>
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type
44[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename iterator_traits<_InputIterator>::value_type
4445reduce(_InputIterator __first, _InputIterator __last) {
4546 return std::reduce(__first, __last, typename iterator_traits<_InputIterator>::value_type{});
4647}
47#endif
4848
4949_LIBCPP_END_NAMESPACE_STD
5050
51#endif // _LIBCPP_STD_VER >= 17
52
5153_LIBCPP_POP_MACROS
5254
5355#endif // _LIBCPP___NUMERIC_REDUCE_H
lib/libcxx/include/__numeric/saturation_arithmetic.h+15-15
......@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2929#if _LIBCPP_STD_VER >= 20
3030
3131template <__signed_or_unsigned_integer _Tp>
32_LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept {
32_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_add(_Tp __x, _Tp __y) noexcept {
3333# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101
3434 return __builtin_elementwise_add_sat(__x, __y);
3535# else
......@@ -51,7 +51,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __add_sat(_Tp __x, _Tp __y) noexcept {
5151}
5252
5353template <__signed_or_unsigned_integer _Tp>
54_LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept {
54_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_sub(_Tp __x, _Tp __y) noexcept {
5555# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2101
5656 return __builtin_elementwise_sub_sat(__x, __y);
5757# else
......@@ -74,7 +74,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __sub_sat(_Tp __x, _Tp __y) noexcept {
7474}
7575
7676template <__signed_or_unsigned_integer _Tp>
77_LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept {
77_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_mul(_Tp __x, _Tp __y) noexcept {
7878 if (_Tp __mul; !__builtin_mul_overflow(__x, __y, std::addressof(__mul)))
7979 return __mul;
8080 // Handle overflow
......@@ -90,7 +90,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __mul_sat(_Tp __x, _Tp __y) noexcept {
9090}
9191
9292template <__signed_or_unsigned_integer _Tp>
93_LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept {
93_LIBCPP_HIDE_FROM_ABI constexpr _Tp __saturating_div(_Tp __x, _Tp __y) noexcept {
9494 _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined");
9595 if constexpr (__unsigned_integer<_Tp>) {
9696 return __x / __y;
......@@ -103,7 +103,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Tp __div_sat(_Tp __x, _Tp __y) noexcept {
103103}
104104
105105template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp>
106_LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept {
106_LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturating_cast(_Tp __x) noexcept {
107107 // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be
108108 // optimized out by the compiler.
109109
......@@ -121,28 +121,28 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Rp __saturate_cast(_Tp __x) noexcept {
121121#if _LIBCPP_STD_VER >= 26
122122
123123template <__signed_or_unsigned_integer _Tp>
124[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
125 return std::__add_sat(__x, __y);
124[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_add(_Tp __x, _Tp __y) noexcept {
125 return std::__saturating_add(__x, __y);
126126}
127127
128128template <__signed_or_unsigned_integer _Tp>
129[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
130 return std::__sub_sat(__x, __y);
129[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_sub(_Tp __x, _Tp __y) noexcept {
130 return std::__saturating_sub(__x, __y);
131131}
132132
133133template <__signed_or_unsigned_integer _Tp>
134[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
135 return std::__mul_sat(__x, __y);
134[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_mul(_Tp __x, _Tp __y) noexcept {
135 return std::__saturating_mul(__x, __y);
136136}
137137
138138template <__signed_or_unsigned_integer _Tp>
139[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
140 return std::__div_sat(__x, __y);
139[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp saturating_div(_Tp __x, _Tp __y) noexcept {
140 return std::__saturating_div(__x, __y);
141141}
142142
143143template <__signed_or_unsigned_integer _Rp, __signed_or_unsigned_integer _Tp>
144[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {
145 return std::__saturate_cast<_Rp>(__x);
144[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Rp saturating_cast(_Tp __x) noexcept {
145 return std::__saturating_cast<_Rp>(__x);
146146}
147147
148148#endif // _LIBCPP_STD_VER >= 26
lib/libcxx/include/__numeric/transform_reduce.h+8-6
......@@ -21,19 +21,20 @@
2121_LIBCPP_PUSH_MACROS
2222#include <__undef_macros>
2323
24#if _LIBCPP_STD_VER >= 17
25
2426_LIBCPP_BEGIN_NAMESPACE_STD
2527
26#if _LIBCPP_STD_VER >= 17
2728template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
28_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
29transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
29[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
30_Tp transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b, _UnaryOp __u) {
3031 for (; __first != __last; ++__first)
3132 __init = __b(std::move(__init), __u(*__first));
3233 return __init;
3334}
3435
3536template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOp1, class _BinaryOp2>
36_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
37[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
3738 _InputIterator1 __first1,
3839 _InputIterator1 __last1,
3940 _InputIterator2 __first2,
......@@ -46,14 +47,15 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(
4647}
4748
4849template <class _InputIterator1, class _InputIterator2, class _Tp>
49_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
50[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp
5051transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) {
5152 return std::transform_reduce(__first1, __last1, __first2, std::move(__init), std::plus<>(), std::multiplies<>());
5253}
53#endif
5454
5555_LIBCPP_END_NAMESPACE_STD
5656
57#endif // _LIBCPP_STD_VER >= 17
58
5759_LIBCPP_POP_MACROS
5860
5961#endif // _LIBCPP___NUMERIC_TRANSFORM_REDUCE_H
lib/libcxx/include/__ostream/basic_ostream.h+2
......@@ -41,6 +41,7 @@ _LIBCPP_PUSH_MACROS
4141# include <__undef_macros>
4242
4343_LIBCPP_BEGIN_NAMESPACE_STD
44_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4445
4546template <class _CharT, class _Traits>
4647class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
......@@ -672,6 +673,7 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
672673extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
673674# endif
674675
676_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
675677_LIBCPP_END_NAMESPACE_STD
676678
677679_LIBCPP_POP_MACROS
lib/libcxx/include/__ostream/print.h+8-9
......@@ -82,12 +82,14 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _
8282// native Unicode API;
8383// Whether the returned FILE* is "a terminal capable of displaying Unicode"
8484// is determined in the same way as the print(FILE*, ...) overloads.
85_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
8586_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
87_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
8688
8789# if _LIBCPP_HAS_UNICODE
8890template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
8991_LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
90# if _LIBCPP_AVAILABILITY_HAS_PRINT == 0
92# ifndef _LIBCPP_WIN32API
9193 return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
9294# else
9395 FILE* __file = std::__get_ostream_file(__os);
......@@ -110,13 +112,10 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo
110112# endif // _LIBCPP_HAS_EXCEPTIONS
111113 ostream::sentry __s(__os);
112114 if (__s) {
113# ifndef _LIBCPP_WIN32API
114 __print::__vprint_unicode_posix(__file, __fmt, __args, __write_nl, true);
115# elif _LIBCPP_HAS_WIDE_CHARACTERS
116 __print::__vprint_unicode_windows(__file, __fmt, __args, __write_nl, true);
117# else
118# error "Windows builds with wchar_t disabled are not supported."
119# endif
115 auto __result = std::vformat(__fmt, __args);
116 if (__write_nl)
117 __result.push_back('\n');
118 __print::__output_unicode_windows(__file, __result);
120119 }
121120
122121# if _LIBCPP_HAS_EXCEPTIONS
......@@ -124,7 +123,7 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo
124123 __os.__set_badbit_and_consider_rethrow();
125124 }
126125# endif // _LIBCPP_HAS_EXCEPTIONS
127# endif // _LIBCPP_AVAILABILITY_HAS_PRINT
126# endif // _LIBCPP_WIN32API
128127}
129128
130129template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
lib/libcxx/include/__pstl/backend_fwd.h+20
......@@ -109,6 +109,13 @@ struct __is_partitioned;
109109// optional<bool>
110110// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
111111
112template <class _Backend, class _ExecutionPolicy>
113struct __find_first_of;
114// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
115// optional<_ForwardIterator1>
116// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
117// _ForwardIterator2 __first2, _ForwardIterator2 __last2, _Predicate __pred) const noexcept;
118
112119template <class _Backend, class _ExecutionPolicy>
113120struct __for_each;
114121// template <class _Policy, class _ForwardIterator, class _Function>
......@@ -159,6 +166,13 @@ struct __generate_n;
159166// optional<__empty>
160167// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept;
161168
169template <class _Backend, class _ExecutionPolicy>
170struct __reverse_copy;
171// template <class _Policy, class _BidirectionalIterator, class _ForwardIterator>
172// optional<_ForwardIterator>
173// operator()(_Policy&&, _BidirectionalIterator __first, _BidirectionalIterator __last,
174// _ForwardIterator __result) const noexcept;
175
162176template <class _Backend, class _ExecutionPolicy>
163177struct __merge;
164178// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
......@@ -297,6 +311,12 @@ struct __reduce;
297311// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
298312// _Tp __init, _BinaryOperation __op) const noexcept;
299313
314template <class _Backend, class _ExecutionPolicy>
315struct __is_sorted;
316// template <class _Policy, class _ForwardIterator, class _Comp>
317// optional<bool>
318// operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp&& __comp) const noexcept;
319
300320} // namespace __pstl
301321_LIBCPP_END_NAMESPACE_STD
302322
lib/libcxx/include/__pstl/backends/default.h+78
......@@ -12,15 +12,21 @@
1212#include <__algorithm/copy_n.h>
1313#include <__algorithm/equal.h>
1414#include <__algorithm/fill_n.h>
15#include <__algorithm/find.h>
16#include <__algorithm/find_if.h>
1517#include <__algorithm/for_each_n.h>
18#include <__algorithm/is_sorted.h>
1619#include <__config>
1720#include <__functional/identity.h>
1821#include <__functional/not_fn.h>
1922#include <__functional/operations.h>
2023#include <__iterator/concepts.h>
2124#include <__iterator/iterator_traits.h>
25#include <__iterator/next.h>
26#include <__iterator/reverse_iterator.h>
2227#include <__pstl/backend_fwd.h>
2328#include <__pstl/dispatch.h>
29#include <__type_traits/desugars_to.h>
2430#include <__utility/empty.h>
2531#include <__utility/forward.h>
2632#include <__utility/move.h>
......@@ -55,6 +61,7 @@ namespace __pstl {
5561// - all_of
5662// - none_of
5763// - is_partitioned
64// - find_first_of
5865//
5966// for_each family
6067// ---------------
......@@ -80,6 +87,7 @@ namespace __pstl {
8087// - count
8188// - equal(3 legs)
8289// - equal
90// - is_sorted
8391// - reduce
8492//
8593// transform and transform_binary family
......@@ -89,6 +97,7 @@ namespace __pstl {
8997// - move
9098// - copy
9199// - copy_n
100// - reverse_copy
92101// - rotate_copy
93102//
94103
......@@ -178,6 +187,30 @@ struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> {
178187 }
179188};
180189
190template <class _ExecutionPolicy>
191struct __find_first_of<__default_backend_tag, _ExecutionPolicy> {
192 template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
193 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator1>
194 operator()(_Policy&& __policy,
195 _ForwardIterator1 __first1,
196 _ForwardIterator1 __last1,
197 _ForwardIterator2 __first2,
198 _ForwardIterator2 __last2,
199 _Predicate&& __pred) const noexcept {
200 using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
201 using _Ref1 = __iterator_reference<_ForwardIterator1>;
202 using _Ref2 = __iterator_reference<_ForwardIterator2>;
203 return _FindIf()(__policy, std::move(__first1), std::move(__last1), [&](_Ref1 __element) {
204 if constexpr (__desugars_to_v<__equal_tag, _Predicate, _Ref1, _Ref2>) {
205 // bypass an equality predicate and call directly to std::find() to allow more vectorization
206 return std::find(__first2, __last2, __element) != __last2;
207 } else {
208 return std::find_if(__first2, __last2, [&](_Ref2 __value) { return __pred(__element, __value); }) != __last2;
209 }
210 });
211 }
212};
213
181214//////////////////////////////////////////////////////////////
182215// for_each family
183216//////////////////////////////////////////////////////////////
......@@ -388,6 +421,35 @@ struct __reduce<__default_backend_tag, _ExecutionPolicy> {
388421 }
389422};
390423
424template <class _ExecutionPolicy>
425struct __is_sorted<__default_backend_tag, _ExecutionPolicy> {
426 template <class _Policy, class _ForwardIterator, class _Comp>
427 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
428 operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Comp&& __comp) const noexcept {
429 if constexpr (__has_bidirectional_iterator_category<_ForwardIterator>::value) {
430 if (__first == __last)
431 return true; // Empty, sorted by definition
432 _ForwardIterator __first2 = std::next(__first);
433 if (__first2 == __last)
434 return true; // Only one element, sorted by definition
435 --__last; // Make two iterator ranges: [__first, __first + n - 1) and [__first + 1, __first + n)
436 using _TransformReduce = __dispatch<__transform_reduce_binary, __current_configuration, _ExecutionPolicy>;
437 using _Ref = __iterator_reference<_ForwardIterator>;
438 return _TransformReduce()(
439 __policy,
440 std::move(__first),
441 std::move(__last),
442 std::move(__first2),
443 true,
444 std::logical_and{},
445 [&](_Ref __left, _Ref __right) -> bool { return !__comp(__right, __left); });
446 } else {
447 // Currently anything outside bidirectional iterators has to be processed serially
448 return std::is_sorted(std::move(__first), std::move(__last), std::forward<_Comp>(__comp));
449 }
450 }
451};
452
391453//////////////////////////////////////////////////////////////
392454// transform family
393455//////////////////////////////////////////////////////////////
......@@ -497,6 +559,22 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
497559 }
498560};
499561
562template <class _ExecutionPolicy>
563struct __reverse_copy<__default_backend_tag, _ExecutionPolicy> {
564 template <class _Policy, class _BidirectionalIterator, class _ForwardIterator>
565 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
566 operator()(_Policy&& __policy,
567 _BidirectionalIterator __first,
568 _BidirectionalIterator __last,
569 _ForwardIterator __result) const noexcept {
570 using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>;
571 return _Copy()(__policy,
572 std::reverse_iterator<_BidirectionalIterator>(std::move(__last)),
573 std::reverse_iterator<_BidirectionalIterator>(std::move(__first)),
574 std::move(__result));
575 }
576};
577
500578} // namespace __pstl
501579_LIBCPP_END_NAMESPACE_STD
502580
lib/libcxx/include/__pstl/backends/libdispatch.h+2
......@@ -48,6 +48,7 @@ _LIBCPP_PUSH_MACROS
4848#if _LIBCPP_STD_VER >= 17
4949
5050_LIBCPP_BEGIN_NAMESPACE_STD
51_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
5152namespace __pstl {
5253
5354namespace __libdispatch {
......@@ -393,6 +394,7 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
393394 : __cpu_parallel_fill<__libdispatch_backend_tag, _ExecutionPolicy> {};
394395
395396} // namespace __pstl
397_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
396398_LIBCPP_END_NAMESPACE_STD
397399
398400#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__random/bernoulli_distribution.h+7-7
......@@ -36,7 +36,7 @@ public:
3636
3737 _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
3838
39 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
39 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
4040
4141 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4242 return __x.__p_ == __y.__p_;
......@@ -60,20 +60,20 @@ public:
6060
6161 // generating functions
6262 template <class _URNG>
63 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
6464 return (*this)(__g, __p_);
6565 }
6666 template <class _URNG>
67 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
67 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
6868
6969 // property functions
70 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
70 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
7171
72 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
72 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
7373 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
7474
75 _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; }
76 _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; }
75 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return false; }
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return true; }
7777
7878 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const bernoulli_distribution& __x, const bernoulli_distribution& __y) {
7979 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/binomial_distribution.h+13-32
......@@ -10,6 +10,7 @@
1010#define _LIBCPP___RANDOM_BINOMIAL_DISTRIBUTION_H
1111
1212#include <__config>
13#include <__math/gamma.h>
1314#include <__random/is_valid.h>
1415#include <__random/uniform_real_distribution.h>
1516#include <cmath>
......@@ -44,8 +45,8 @@ public:
4445
4546 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __t = 1, double __p = 0.5);
4647
47 _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; }
48 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
48 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type t() const { return __t_; }
49 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
4950
5051 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5152 return __x.__t_ == __y.__t_ && __x.__p_ == __y.__p_;
......@@ -73,21 +74,21 @@ public:
7374
7475 // generating functions
7576 template <class _URNG>
76 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7778 return (*this)(__g, __p_);
7879 }
7980 template <class _URNG>
80 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
8182
8283 // property functions
83 _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); }
84 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
84 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type t() const { return __p_.t(); }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
8586
86 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8788 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8889
89 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
90 _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); }
90 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
91 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return t(); }
9192
9293 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const binomial_distribution& __x, const binomial_distribution& __y) {
9394 return __x.__p_ == __y.__p_;
......@@ -97,33 +98,13 @@ public:
9798 }
9899};
99100
100// Some libc declares the math functions to be `noexcept`.
101#if _LIBCPP_GLIBC_PREREQ(2, 8) || defined(__LLVM_LIBC__)
102# define _LIBCPP_LGAMMA_R_NOEXCEPT _NOEXCEPT
103#else
104# define _LIBCPP_LGAMMA_R_NOEXCEPT
105#endif
106
107#if !defined(_LIBCPP_MSVCRT_LIKE)
108extern "C" double lgamma_r(double, int*) _LIBCPP_LGAMMA_R_NOEXCEPT;
109#endif
110
111inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
112#if defined(_LIBCPP_MSVCRT_LIKE)
113 return lgamma(__d);
114#else
115 int __sign;
116 return lgamma_r(__d, &__sign);
117#endif
118}
119
120101template <class _IntType>
121102binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) {
122103 if (0 < __p_ && __p_ < 1) {
123104 __r0_ = static_cast<result_type>((__t_ + 1) * __p_);
124 __pr_ = std::exp(
125 std::__libcpp_lgamma(__t_ + 1.) - std::__libcpp_lgamma(__r0_ + 1.) - std::__libcpp_lgamma(__t_ - __r0_ + 1.) +
126 __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_));
105 __pr_ =
106 std::exp(__math::__lgamma_r(__t_ + 1.) - __math::__lgamma_r(__r0_ + 1.) -
107 __math::__lgamma_r(__t_ - __r0_ + 1.) + __r0_ * std::log(__p_) + (__t_ - __r0_) * std::log(1 - __p_));
127108 __odds_ratio_ = __p_ / (1 - __p_);
128109 }
129110}
lib/libcxx/include/__random/cauchy_distribution.h+9-9
......@@ -43,8 +43,8 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
4848
4949 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5050 return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
......@@ -70,21 +70,21 @@ public:
7070
7171 // generating functions
7272 template <class _URNG>
73 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
73 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7474 return (*this)(__g, __p_);
7575 }
7676 template <class _URNG>
77 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7878
7979 // property functions
80 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
81 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
8282
83 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8484 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8585
86 _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
87 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8888
8989 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const cauchy_distribution& __x, const cauchy_distribution& __y) {
9090 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/chi_squared_distribution.h+7-7
......@@ -41,7 +41,7 @@ public:
4141
4242 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
4343
44 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
44 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
4545
4646 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4747 return __x.__n_ == __y.__n_;
......@@ -65,22 +65,22 @@ public:
6565
6666 // generating functions
6767 template <class _URNG>
68 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
68 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
6969 return (*this)(__g, __p_);
7070 }
7171 template <class _URNG>
72 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
72 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
7373 return gamma_distribution<result_type>(__p.n() / 2, 2)(__g);
7474 }
7575
7676 // property functions
77 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
7878
79 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8080 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8181
82 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
83 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8484
8585 friend _LIBCPP_HIDE_FROM_ABI bool
8686 operator==(const chi_squared_distribution& __x, const chi_squared_distribution& __y) {
lib/libcxx/include/__random/discard_block_engine.h+9-10
......@@ -54,8 +54,8 @@ public:
5454 static constexpr result_type _Max = _Engine::max();
5555#endif
5656
57 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
58 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
57 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
58 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Engine::max(); }
5959
6060 // constructors and seeding functions
6161 _LIBCPP_HIDE_FROM_ABI discard_block_engine() : __n_(0) {}
......@@ -64,10 +64,9 @@ public:
6464 _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Engine&& __e) : __e_(std::move(__e)), __n_(0) {}
6565#endif // _LIBCPP_CXX03_LANG
6666 _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
67 template <
68 class _Sseq,
69 __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value && !is_convertible<_Sseq, _Engine>::value,
70 int> = 0>
67 template <class _Sseq,
68 __enable_if_t<__is_seed_sequence_v<_Sseq, discard_block_engine> && !is_convertible<_Sseq, _Engine>::value,
69 int> = 0>
7170 _LIBCPP_HIDE_FROM_ABI explicit discard_block_engine(_Sseq& __q) : __e_(__q), __n_(0) {}
7271 _LIBCPP_HIDE_FROM_ABI void seed() {
7372 __e_.seed();
......@@ -77,21 +76,21 @@ public:
7776 __e_.seed(__sd);
7877 __n_ = 0;
7978 }
80 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, discard_block_engine>::value, int> = 0>
79 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, discard_block_engine>, int> = 0>
8180 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
8281 __e_.seed(__q);
8382 __n_ = 0;
8483 }
8584
8685 // generating functions
87 _LIBCPP_HIDE_FROM_ABI result_type operator()();
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()();
8887 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
8988 for (; __z; --__z)
90 operator()();
89 (void)operator()();
9190 }
9291
9392 // property functions
94 _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
93 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
9594
9695 template <class _Eng, size_t _Pp, size_t _Rp>
9796 friend bool
lib/libcxx/include/__random/discrete_distribution.h+7-7
......@@ -52,7 +52,7 @@ public:
5252 template <class _UnaryOperation>
5353 _LIBCPP_HIDE_FROM_ABI param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw);
5454
55 _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
55 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const;
5656
5757 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5858 return __x.__p_ == __y.__p_;
......@@ -92,20 +92,20 @@ public:
9292
9393 // generating functions
9494 template <class _URNG>
95 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
95 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
9696 return (*this)(__g, __p_);
9797 }
9898 template <class _URNG>
99 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
99 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
100100
101101 // property functions
102 _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); }
102 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<double> probabilities() const { return __p_.probabilities(); }
103103
104 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
104 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
105105 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
106106
107 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
108 _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); }
107 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
108 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__p_.size(); }
109109
110110 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const discrete_distribution& __x, const discrete_distribution& __y) {
111111 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/exponential_distribution.h+7-7
......@@ -43,7 +43,7 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __lambda = 1) : __lambda_(__lambda) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __lambda_; }
4747
4848 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4949 return __x.__lambda_ == __y.__lambda_;
......@@ -67,20 +67,20 @@ public:
6767
6868 // generating functions
6969 template <class _URNG>
70 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
70 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7171 return (*this)(__g, __p_);
7272 }
7373 template <class _URNG>
74 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
74 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7575
7676 // property functions
77 _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); }
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type lambda() const { return __p_.lambda(); }
7878
79 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8080 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8181
82 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
83 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8484
8585 friend _LIBCPP_HIDE_FROM_ABI bool
8686 operator==(const exponential_distribution& __x, const exponential_distribution& __y) {
lib/libcxx/include/__random/extreme_value_distribution.h+9-9
......@@ -43,8 +43,8 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
4848
4949 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5050 return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
......@@ -70,21 +70,21 @@ public:
7070
7171 // generating functions
7272 template <class _URNG>
73 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
73 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7474 return (*this)(__g, __p_);
7575 }
7676 template <class _URNG>
77 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7878
7979 // property functions
80 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
81 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
8282
83 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8484 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8585
86 _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
87 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8888
8989 friend _LIBCPP_HIDE_FROM_ABI bool
9090 operator==(const extreme_value_distribution& __x, const extreme_value_distribution& __y) {
lib/libcxx/include/__random/fisher_f_distribution.h+9-9
......@@ -42,8 +42,8 @@ public:
4242
4343 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 1, result_type __n = 1) : __m_(__m), __n_(__n) {}
4444
45 _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
46 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
45 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
4747
4848 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4949 return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;
......@@ -69,21 +69,21 @@ public:
6969
7070 // generating functions
7171 template <class _URNG>
72 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
72 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7373 return (*this)(__g, __p_);
7474 }
7575 template <class _URNG>
76 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7777
7878 // property functions
79 _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); }
80 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __p_.m(); }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
8181
82 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8383 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8484
85 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
86 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8787
8888 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const fisher_f_distribution& __x, const fisher_f_distribution& __y) {
8989 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/gamma_distribution.h+9-9
......@@ -45,8 +45,8 @@ public:
4545 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __alpha = 1, result_type __beta = 1)
4646 : __alpha_(__alpha), __beta_(__beta) {}
4747
48 _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; }
49 _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; }
48 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __alpha_; }
49 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __beta_; }
5050
5151 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5252 return __x.__alpha_ == __y.__alpha_ && __x.__beta_ == __y.__beta_;
......@@ -72,21 +72,21 @@ public:
7272
7373 // generating functions
7474 template <class _URNG>
75 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
75 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7676 return (*this)(__g, __p_);
7777 }
7878 template <class _URNG>
79 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
8080
8181 // property functions
82 _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); }
83 _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type alpha() const { return __p_.alpha(); }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type beta() const { return __p_.beta(); }
8484
85 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8686 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8787
88 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
89 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
88 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
9090
9191 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const gamma_distribution& __x, const gamma_distribution& __y) {
9292 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/generate_canonical.h+1-1
......@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2727// generate_canonical
2828
2929template <class _RealType, size_t __bits, class _URNG>
30_LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) {
30[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) {
3131 const size_t __dt = numeric_limits<_RealType>::digits;
3232 const size_t __b = __dt < __bits ? __dt : __bits;
3333#ifdef _LIBCPP_CXX03_LANG
lib/libcxx/include/__random/geometric_distribution.h+7-7
......@@ -40,7 +40,7 @@ public:
4040
4141 _LIBCPP_HIDE_FROM_ABI explicit param_type(double __p = 0.5) : __p_(__p) {}
4242
43 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
43 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
4444
4545 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4646 return __x.__p_ == __y.__p_;
......@@ -64,22 +64,22 @@ public:
6464
6565 // generating functions
6666 template <class _URNG>
67 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
67 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
6868 return (*this)(__g, __p_);
6969 }
7070 template <class _URNG>
71 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
71 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
7272 return negative_binomial_distribution<result_type>(1, __p.p())(__g);
7373 }
7474
7575 // property functions
76 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
7777
78 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
78 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
7979 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8080
81 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
82 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
8383
8484 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const geometric_distribution& __x, const geometric_distribution& __y) {
8585 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/independent_bits_engine.h+29-35
......@@ -82,8 +82,8 @@ public:
8282 static_assert(_Min < _Max, "independent_bits_engine invalid parameters");
8383
8484 // engine characteristics
85 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
86 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
8787
8888 // constructors and seeding functions
8989 _LIBCPP_HIDE_FROM_ABI independent_bits_engine() {}
......@@ -94,25 +94,47 @@ public:
9494 _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
9595 template <
9696 class _Sseq,
97 __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value && !is_convertible<_Sseq, _Engine>::value,
97 __enable_if_t<__is_seed_sequence_v<_Sseq, independent_bits_engine> && !is_convertible<_Sseq, _Engine>::value,
9898 int> = 0>
9999 _LIBCPP_HIDE_FROM_ABI explicit independent_bits_engine(_Sseq& __q) : __e_(__q) {}
100100 _LIBCPP_HIDE_FROM_ABI void seed() { __e_.seed(); }
101101 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd) { __e_.seed(__sd); }
102 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, independent_bits_engine>::value, int> = 0>
102 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, independent_bits_engine>, int> = 0>
103103 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
104104 __e_.seed(__q);
105105 }
106106
107107 // generating functions
108 _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
108 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() {
109 if _LIBCPP_CONSTEXPR (_Rp != 0) {
110 result_type __sp = 0;
111 for (size_t __k = 0; __k < __n0; ++__k) {
112 _Engine_result_type __u;
113 do {
114 __u = __e_() - _Engine::min();
115 } while (__u >= __y0);
116 __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
117 }
118 for (size_t __k = __n0; __k < __n; ++__k) {
119 _Engine_result_type __u;
120 do {
121 __u = __e_() - _Engine::min();
122 } while (__u >= __y1);
123 __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1));
124 }
125 return __sp;
126 } else {
127 return static_cast<result_type>(__e_() & __mask0);
128 }
129 }
130
109131 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
110132 for (; __z; --__z)
111 operator()();
133 (void)operator()();
112134 }
113135
114136 // property functions
115 _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
137 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
116138
117139 template <class _Eng, size_t _Wp, class _UInt>
118140 friend bool operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
......@@ -131,9 +153,6 @@ public:
131153 operator>>(basic_istream<_CharT, _Traits>& __is, independent_bits_engine<_Eng, _Wp, _UInt>& __x);
132154
133155private:
134 _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type);
135 _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type);
136
137156 template <size_t __count,
138157 __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
139158 return __x << __count;
......@@ -145,31 +164,6 @@ private:
145164 }
146165};
147166
148template <class _Engine, size_t __w, class _UIntType>
149inline _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type) {
150 return static_cast<result_type>(__e_() & __mask0);
151}
152
153template <class _Engine, size_t __w, class _UIntType>
154_UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) {
155 result_type __sp = 0;
156 for (size_t __k = 0; __k < __n0; ++__k) {
157 _Engine_result_type __u;
158 do {
159 __u = __e_() - _Engine::min();
160 } while (__u >= __y0);
161 __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0));
162 }
163 for (size_t __k = __n0; __k < __n; ++__k) {
164 _Engine_result_type __u;
165 do {
166 __u = __e_() - _Engine::min();
167 } while (__u >= __y1);
168 __sp = static_cast<result_type>(__lshift<__w0 + 1>(__sp) + (__u & __mask1));
169 }
170 return __sp;
171}
172
173167template <class _Eng, size_t _Wp, class _UInt>
174168inline _LIBCPP_HIDE_FROM_ABI bool
175169operator==(const independent_bits_engine<_Eng, _Wp, _UInt>& __x, const independent_bits_engine<_Eng, _Wp, _UInt>& __y) {
lib/libcxx/include/__random/is_seed_sequence.h+2-4
......@@ -21,10 +21,8 @@
2121_LIBCPP_BEGIN_NAMESPACE_STD
2222
2323template <class _Sseq, class _Engine>
24struct __is_seed_sequence {
25 static _LIBCPP_CONSTEXPR const bool value =
26 !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
27};
24inline const bool __is_seed_sequence_v =
25 !is_convertible<_Sseq, typename _Engine::result_type>::value && !is_same<__remove_cv_t<_Sseq>, _Engine>::value;
2826
2927_LIBCPP_END_NAMESPACE_STD
3028
lib/libcxx/include/__random/linear_congruential_engine.h+26-41
......@@ -254,8 +254,8 @@ public:
254254 static inline _LIBCPP_CONSTEXPR const result_type multiplier = __a;
255255 static inline _LIBCPP_CONSTEXPR const result_type increment = __c;
256256 static inline _LIBCPP_CONSTEXPR const result_type modulus = __m;
257 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
258 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
257 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
258 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
259259 static inline _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
260260
261261 // constructors and seeding functions
......@@ -265,28 +265,43 @@ public:
265265#else
266266 _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(result_type __s = default_seed) { seed(__s); }
267267#endif
268 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
268 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, linear_congruential_engine>, int> = 0>
269269 _LIBCPP_HIDE_FROM_ABI explicit linear_congruential_engine(_Sseq& __q) {
270270 seed(__q);
271271 }
272
272273 _LIBCPP_HIDE_FROM_ABI void seed(result_type __s = default_seed) {
273 seed(integral_constant<bool, __m == 0>(), integral_constant<bool, __c == 0>(), __s);
274 if _LIBCPP_CONSTEXPR (__m == 0) {
275 if _LIBCPP_CONSTEXPR (__c == 0)
276 __x_ = __s == 0 ? 1 : __s;
277 else
278 __x_ = __s;
279 } else {
280 if _LIBCPP_CONSTEXPR (__c == 0)
281 __x_ = __s % __m == 0 ? 1 : __s % __m;
282 else
283 __x_ = __s % __m;
284 }
274285 }
275 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, linear_congruential_engine>::value, int> = 0>
286
287 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, linear_congruential_engine>, int> = 0>
276288 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
277 __seed(
278 __q,
279 integral_constant<unsigned,
280 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull))>());
289 const _LIBCPP_CONSTEXPR unsigned __k =
290 1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1) / 32 : (__m > 0x100000000ull));
291 static_assert(__k <= 2);
292 uint32_t __ar[__k + 3];
293 __q.generate(__ar, __ar + __k + 3);
294 result_type __s = static_cast<result_type>((__ar[3] + (__k == 1 ? 0 : (uint64_t)__ar[4] << 32)) % __m);
295 __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
281296 }
282297
283298 // generating functions
284 _LIBCPP_HIDE_FROM_ABI result_type operator()() {
299 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() {
285300 return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));
286301 }
287302 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
288303 for (; __z; --__z)
289 operator()();
304 (void)operator()();
290305 }
291306
292307 friend _LIBCPP_HIDE_FROM_ABI bool
......@@ -299,16 +314,6 @@ public:
299314 }
300315
301316private:
302 _LIBCPP_HIDE_FROM_ABI void seed(true_type, true_type, result_type __s) { __x_ = __s == 0 ? 1 : __s; }
303 _LIBCPP_HIDE_FROM_ABI void seed(true_type, false_type, result_type __s) { __x_ = __s; }
304 _LIBCPP_HIDE_FROM_ABI void seed(false_type, true_type, result_type __s) { __x_ = __s % __m == 0 ? 1 : __s % __m; }
305 _LIBCPP_HIDE_FROM_ABI void seed(false_type, false_type, result_type __s) { __x_ = __s % __m; }
306
307 template <class _Sseq>
308 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
309 template <class _Sseq>
310 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
311
312317 template <class _CharT, class _Traits, class _Up, _Up _Ap, _Up _Cp, _Up _Np>
313318 friend basic_ostream<_CharT, _Traits>&
314319 operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
......@@ -318,26 +323,6 @@ private:
318323 operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
319324};
320325
321template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
322template <class _Sseq>
323void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
324 const unsigned __k = 1;
325 uint32_t __ar[__k + 3];
326 __q.generate(__ar, __ar + __k + 3);
327 result_type __s = static_cast<result_type>(__ar[3] % __m);
328 __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
329}
330
331template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
332template <class _Sseq>
333void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
334 const unsigned __k = 2;
335 uint32_t __ar[__k + 3];
336 __q.generate(__ar, __ar + __k + 3);
337 result_type __s = static_cast<result_type>((__ar[3] + ((uint64_t)__ar[4] << 32)) % __m);
338 __x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
339}
340
341326template <class _CharT, class _Traits, class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
342327inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
343328operator<<(basic_ostream<_CharT, _Traits>& __os, const linear_congruential_engine<_UIntType, __a, __c, __m>& __x) {
lib/libcxx/include/__random/lognormal_distribution.h+9-9
......@@ -43,8 +43,8 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __m = 0, result_type __s = 1) : __m_(__m), __s_(__s) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
47 _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __m_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type s() const { return __s_; }
4848
4949 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5050 return __x.__m_ == __y.__m_ && __x.__s_ == __y.__s_;
......@@ -68,28 +68,28 @@ public:
6868
6969 // generating functions
7070 template <class _URNG>
71 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
71 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7272 return std::exp(__nd_(__g));
7373 }
7474
7575 template <class _URNG>
76 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
7777 typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
7878 return std::exp(__nd_(__g, __pn));
7979 }
8080
8181 // property functions
82 _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); }
83 _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type m() const { return __nd_.mean(); }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type s() const { return __nd_.stddev(); }
8484
85 _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return param_type(__nd_.mean(), __nd_.stddev()); }
8686 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) {
8787 typename normal_distribution<result_type>::param_type __pn(__p.m(), __p.s());
8888 __nd_.param(__pn);
8989 }
9090
91 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
92 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
91 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
92 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
9393
9494 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const lognormal_distribution& __x, const lognormal_distribution& __y) {
9595 return __x.__nd_ == __y.__nd_;
lib/libcxx/include/__random/mersenne_twister_engine.h+73-62
......@@ -161,8 +161,8 @@ public:
161161 static inline _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
162162 static inline _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
163163 static inline _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
164 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
165 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
164 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
165 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
166166 static inline _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
167167
168168 // constructors and seeding functions
......@@ -172,7 +172,7 @@ public:
172172#else
173173 _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(result_type __sd = default_seed) { seed(__sd); }
174174#endif
175 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
175 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, mersenne_twister_engine>, int> = 0>
176176 _LIBCPP_HIDE_FROM_ABI explicit mersenne_twister_engine(_Sseq& __q) {
177177 seed(__q);
178178 }
......@@ -181,21 +181,68 @@ public:
181181 for (size_t __i = 1; __i < __n; ++__i)
182182 __x_[__i] = (__f * (__x_[__i - 1] ^ __rshift<__w - 2>(__x_[__i - 1])) + __i) & _Max;
183183 __i_ = 0;
184#ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE
185 __update_all_states();
186#endif
184187 }
185 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value, int> = 0>
188 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, mersenne_twister_engine>, int> = 0>
186189 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
187 __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
190 const unsigned __k = 1 + (__w - 1) / 32;
191 static_assert(__k <= 2);
192 uint32_t __ar[__n * __k];
193 __q.generate(__ar, __ar + __n * __k);
194 for (size_t __i = 0; __i < __n; ++__i) {
195 if _LIBCPP_CONSTEXPR (__k == 1) {
196 __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
197 } else {
198 __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
199 }
200 }
201 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
202 __i_ = 0;
203 if ((__x_[0] & ~__mask) == 0) {
204 for (size_t __i = 1; __i < __n; ++__i)
205 if (__x_[__i] != 0)
206 return;
207 __x_[0] = result_type(1) << (__w - 1);
208 }
209#ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE
210 __update_all_states();
211#endif
188212 }
189213
190 // generating functions
191 _LIBCPP_HIDE_FROM_ABI result_type operator()() {
192 const size_t __j = (__i_ + 1) % __n;
214 void __update_state(size_t __i, size_t __k) {
215 const size_t __j = (__i + 1) % __n;
193216 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
194 const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
195 const size_t __k = (__i_ + __m) % __n;
196 __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
197 result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
198 __i_ = __j;
217 const result_type __yp = (__x_[__i] & ~__mask) | (__x_[__j] & __mask);
218 __x_[__i] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1));
219 }
220
221 void __update_state(size_t __i) { __update_state(__i, (__i + __m) % __n); }
222
223 void __update_all_states() {
224 size_t __i = 0;
225 // This is split into two loops to help the compiler vectorize the code
226 for (; __i != (__n - __m); ++__i)
227 __update_state(__i);
228 for (size_t __j = 0; __i != __n; ++__i, ++__j)
229 __update_state(__i, __j);
230 }
231
232 // generating functions
233 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() {
234#ifdef _LIBCPP_ABI_VECTORIZED_MERSENNE_TWISTER_ENGINE
235 result_type __val = __x_[__i_];
236 if (++__i_ == __n) [[__unlikely__]] {
237 __update_all_states();
238 __i_ = 0;
239 }
240#else
241 __update_state(__i_);
242 result_type __val = __x_[__i_];
243 __i_ = (__i_ + 1) % __n;
244#endif
245 result_type __z = __val ^ (__rshift<__u>(__val) & __d);
199246 __z ^= __lshift<__s>(__z) & __b;
200247 __z ^= __lshift<__t>(__z) & __c;
201248 return __z ^ __rshift<__l>(__z);
......@@ -203,7 +250,7 @@ public:
203250
204251 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
205252 for (; __z; --__z)
206 operator()();
253 (void)operator()();
207254 }
208255
209256 template <class _UInt,
......@@ -265,59 +312,23 @@ public:
265312 mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
266313
267314private:
268 template <class _Sseq>
269 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>) {
270 const unsigned __k = 1;
271 uint32_t __ar[__n * __k];
272 __q.generate(__ar, __ar + __n * __k);
273 for (size_t __i = 0; __i < __n; ++__i)
274 __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
275 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
276 __i_ = 0;
277 if ((__x_[0] & ~__mask) == 0) {
278 for (size_t __i = 1; __i < __n; ++__i)
279 if (__x_[__i] != 0)
280 return;
281 __x_[0] = result_type(1) << (__w - 1);
315 template <size_t __count>
316 _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
317 if _LIBCPP_CONSTEXPR (__count < __w) {
318 return (__x << __count) & _Max;
319 } else {
320 return result_type(0);
282321 }
283322 }
284323
285 template <class _Sseq>
286 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>) {
287 const unsigned __k = 2;
288 uint32_t __ar[__n * __k];
289 __q.generate(__ar, __ar + __n * __k);
290 for (size_t __i = 0; __i < __n; ++__i)
291 __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
292 const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1);
293 __i_ = 0;
294 if ((__x_[0] & ~__mask) == 0) {
295 for (size_t __i = 1; __i < __n; ++__i)
296 if (__x_[__i] != 0)
297 return;
298 __x_[0] = result_type(1) << (__w - 1);
324 template <size_t __count>
325 _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) {
326 if _LIBCPP_CONSTEXPR (__count < _Dt) {
327 return __x >> __count;
328 } else {
329 return result_type(0);
299330 }
300331 }
301
302 template <size_t __count,
303 __enable_if_t<__count< __w, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type __x) {
304 return (__x << __count) & _Max;
305 }
306
307 template <size_t __count, __enable_if_t<(__count >= __w), int> = 0>
308 _LIBCPP_HIDE_FROM_ABI static result_type __lshift(result_type) {
309 return result_type(0);
310 }
311
312 template <size_t __count,
313 __enable_if_t<__count< _Dt, int> = 0> _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type __x) {
314 return __x >> __count;
315 }
316
317 template <size_t __count, __enable_if_t<(__count >= _Dt), int> = 0>
318 _LIBCPP_HIDE_FROM_ABI static result_type __rshift(result_type) {
319 return result_type(0);
320 }
321332};
322333
323334template <class _UInt,
lib/libcxx/include/__random/negative_binomial_distribution.h+9-9
......@@ -44,8 +44,8 @@ public:
4444
4545 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __k = 1, double __p = 0.5) : __k_(__k), __p_(__p) {}
4646
47 _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; }
48 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type k() const { return __k_; }
48 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_; }
4949
5050 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5151 return __x.__k_ == __y.__k_ && __x.__p_ == __y.__p_;
......@@ -70,21 +70,21 @@ public:
7070
7171 // generating functions
7272 template <class _URNG>
73 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
73 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7474 return (*this)(__g, __p_);
7575 }
7676 template <class _URNG>
77 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7878
7979 // property functions
80 _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); }
81 _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type k() const { return __p_.k(); }
81 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double p() const { return __p_.p(); }
8282
83 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8484 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8585
86 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
87 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
87 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
8888
8989 friend _LIBCPP_HIDE_FROM_ABI bool
9090 operator==(const negative_binomial_distribution& __x, const negative_binomial_distribution& __y) {
lib/libcxx/include/__random/normal_distribution.h+9-9
......@@ -44,8 +44,8 @@ public:
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __mean = 0, result_type __stddev = 1)
4545 : __mean_(__mean), __stddev_(__stddev) {}
4646
47 _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; }
48 _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __mean_; }
48 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __stddev_; }
4949
5050 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5151 return __x.__mean_ == __y.__mean_ && __x.__stddev_ == __y.__stddev_;
......@@ -73,21 +73,21 @@ public:
7373
7474 // generating functions
7575 template <class _URNG>
76 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7777 return (*this)(__g, __p_);
7878 }
7979 template <class _URNG>
80 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
8181
8282 // property functions
83 _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); }
84 _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type mean() const { return __p_.mean(); }
84 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type stddev() const { return __p_.stddev(); }
8585
86 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8787 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8888
89 _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
90 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
90 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
9191
9292 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const normal_distribution& __x, const normal_distribution& __y) {
9393 return __x.__p_ == __y.__p_ && __x.__v_hot_ == __y.__v_hot_ && (!__x.__v_hot_ || __x.__v_ == __y.__v_);
lib/libcxx/include/__random/piecewise_constant_distribution.h+9-9
......@@ -59,8 +59,8 @@ public:
5959 _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
6060 _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
6161
62 _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
63 _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
62 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
6464
6565 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
6666 return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
......@@ -109,21 +109,21 @@ public:
109109
110110 // generating functions
111111 template <class _URNG>
112 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
112 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
113113 return (*this)(__g, __p_);
114114 }
115115 template <class _URNG>
116 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
116 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
117117
118118 // property functions
119 _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
120 _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
119 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
120 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
121121
122 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
122 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
123123 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
124124
125 _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
126 _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
125 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
126 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
127127
128128 friend _LIBCPP_HIDE_FROM_ABI bool
129129 operator==(const piecewise_constant_distribution& __x, const piecewise_constant_distribution& __y) {
lib/libcxx/include/__random/piecewise_linear_distribution.h+9-9
......@@ -60,8 +60,8 @@ public:
6060 _LIBCPP_HIDE_FROM_ABI param_type(param_type const&) = default;
6161 _LIBCPP_HIDE_FROM_ABI param_type& operator=(const param_type& __rhs);
6262
63 _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
64 _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
63 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __b_; }
64 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __densities_; }
6565
6666 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
6767 return __x.__densities_ == __y.__densities_ && __x.__b_ == __y.__b_;
......@@ -110,21 +110,21 @@ public:
110110
111111 // generating functions
112112 template <class _URNG>
113 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
113 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
114114 return (*this)(__g, __p_);
115115 }
116116 template <class _URNG>
117 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
117 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
118118
119119 // property functions
120 _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
121 _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
120 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> intervals() const { return __p_.intervals(); }
121 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI vector<result_type> densities() const { return __p_.densities(); }
122122
123 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
123 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
124124 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
125125
126 _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
127 _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
126 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return __p_.__b_.front(); }
127 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return __p_.__b_.back(); }
128128
129129 friend _LIBCPP_HIDE_FROM_ABI bool
130130 operator==(const piecewise_linear_distribution& __x, const piecewise_linear_distribution& __y) {
lib/libcxx/include/__random/poisson_distribution.h+7-7
......@@ -53,7 +53,7 @@ public:
5353
5454 _LIBCPP_HIDE_FROM_ABI explicit param_type(double __mean = 1.0);
5555
56 _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; }
56 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double mean() const { return __mean_; }
5757
5858 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5959 return __x.__mean_ == __y.__mean_;
......@@ -79,20 +79,20 @@ public:
7979
8080 // generating functions
8181 template <class _URNG>
82 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
8383 return (*this)(__g, __p_);
8484 }
8585 template <class _URNG>
86 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
8787
8888 // property functions
89 _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double mean() const { return __p_.mean(); }
9090
91 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
91 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
9292 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
9393
94 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
95 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
94 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
95 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::max(); }
9696
9797 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const poisson_distribution& __x, const poisson_distribution& __y) {
9898 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/random_device.h+11-13
......@@ -19,27 +19,24 @@
1919_LIBCPP_PUSH_MACROS
2020#include <__undef_macros>
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_HAS_RANDOM_DEVICE
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
26
2627class _LIBCPP_EXPORTED_FROM_ABI random_device {
2728# ifdef _LIBCPP_USING_DEV_RANDOM
2829 int __f_;
2930# elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
30 _LIBCPP_DIAGNOSTIC_PUSH
31 _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
32
3331 // Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
3432 // use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
3533 // retain the same layout as before.
3634# if defined(__APPLE__)
37 int __padding_; // padding to fake the `__f_` field above
35 [[__maybe_unused__]] int __padding_; // padding to fake the `__f_` field above
3836# endif
3937
4038 // ... vendors can add workarounds here if they switch to a different representation ...
4139
42 _LIBCPP_DIAGNOSTIC_POP
4340# endif
4441
4542public:
......@@ -50,8 +47,8 @@ public:
5047 static _LIBCPP_CONSTEXPR const result_type _Min = 0;
5148 static _LIBCPP_CONSTEXPR const result_type _Max = 0xFFFFFFFFu;
5249
53 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
54 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
50 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
51 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
5552
5653 // constructors
5754# ifndef _LIBCPP_CXX03_LANG
......@@ -63,19 +60,20 @@ public:
6360 ~random_device();
6461
6562 // generating functions
66 result_type operator()();
63 [[__nodiscard__]] result_type operator()();
6764
6865 // property functions
69 double entropy() const _NOEXCEPT;
66 [[__nodiscard__]] double entropy() const _NOEXCEPT;
7067
7168 random_device(const random_device&) = delete;
7269 void operator=(const random_device&) = delete;
7370};
7471
75#endif // _LIBCPP_HAS_RANDOM_DEVICE
76
72_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7773_LIBCPP_END_NAMESPACE_STD
7874
75#endif // _LIBCPP_HAS_RANDOM_DEVICE
76
7977_LIBCPP_POP_MACROS
8078
8179#endif // _LIBCPP___RANDOM_RANDOM_DEVICE_H
lib/libcxx/include/__random/seed_seq.h+2-2
......@@ -56,7 +56,7 @@ public:
5656 _LIBCPP_HIDE_FROM_ABI void generate(_RandomAccessIterator __first, _RandomAccessIterator __last);
5757
5858 // property functions
59 _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); }
59 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t size() const _NOEXCEPT { return __v_.size(); }
6060 template <class _OutputIterator>
6161 _LIBCPP_HIDE_FROM_ABI void param(_OutputIterator __dest) const {
6262 std::copy(__v_.begin(), __v_.end(), __dest);
......@@ -65,7 +65,7 @@ public:
6565 seed_seq(const seed_seq&) = delete;
6666 void operator=(const seed_seq&) = delete;
6767
68 _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); }
68 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static result_type _Tp(result_type __x) { return __x ^ (__x >> 27); }
6969
7070private:
7171 template <class _InputIterator>
lib/libcxx/include/__random/shuffle_order_engine.h+23-33
......@@ -76,8 +76,8 @@ public:
7676 static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
7777#endif
7878 static_assert(_Min < _Max, "shuffle_order_engine invalid parameters");
79 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
80 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
8181
8282 static _LIBCPP_CONSTEXPR const unsigned long long _Rp = _Max - _Min + 1ull;
8383
......@@ -88,10 +88,9 @@ public:
8888 _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Engine&& __e) : __e_(std::move(__e)) { __init(); }
8989#endif // _LIBCPP_CXX03_LANG
9090 _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(result_type __sd) : __e_(__sd) { __init(); }
91 template <
92 class _Sseq,
93 __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && !is_convertible<_Sseq, _Engine>::value,
94 int> = 0>
91 template <class _Sseq,
92 __enable_if_t<__is_seed_sequence_v<_Sseq, shuffle_order_engine> && !is_convertible<_Sseq, _Engine>::value,
93 int> = 0>
9594 _LIBCPP_HIDE_FROM_ABI explicit shuffle_order_engine(_Sseq& __q) : __e_(__q) {
9695 __init();
9796 }
......@@ -103,21 +102,35 @@ public:
103102 __e_.seed(__sd);
104103 __init();
105104 }
106 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, shuffle_order_engine>::value, int> = 0>
105 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, shuffle_order_engine>, int> = 0>
107106 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
108107 __e_.seed(__q);
109108 __init();
110109 }
111110
112111 // generating functions
113 _LIBCPP_HIDE_FROM_ABI result_type operator()() { return __eval(integral_constant<bool, _Rp != 0>()); }
112 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()() {
113 if _LIBCPP_CONSTEXPR (_Rp != 0 || !(__k & 1)) {
114 using _Ratio = __uratio<__k, _Rp != 0 ? _Rp : 0x8000000000000000ull>;
115 if _LIBCPP_CONSTEXPR (_Ratio::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)) {
116 return __evalf<_Ratio::num, _Ratio::den>();
117 } else {
118 const size_t __j = static_cast<size_t>(_Ratio::num * (__y_ - _Min) / _Ratio::den);
119 __y_ = __v_[__j];
120 __v_[__j] = __e_();
121 return __y_;
122 }
123 } else
124 return __evalf<__k, 0>();
125 }
126
114127 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
115128 for (; __z; --__z)
116 operator()();
129 (void)operator()();
117130 }
118131
119132 // property functions
120 _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
133 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Engine& base() const _NOEXCEPT { return __e_; }
121134
122135private:
123136 template <class _Eng, size_t _Kp>
......@@ -140,29 +153,6 @@ private:
140153 __y_ = __e_();
141154 }
142155
143 _LIBCPP_HIDE_FROM_ABI result_type __eval(false_type) { return __eval2(integral_constant<bool, __k & 1>()); }
144 _LIBCPP_HIDE_FROM_ABI result_type __eval(true_type) { return __eval(__uratio<__k, _Rp>()); }
145
146 _LIBCPP_HIDE_FROM_ABI result_type __eval2(false_type) { return __eval(__uratio<__k / 2, 0x8000000000000000ull>()); }
147 _LIBCPP_HIDE_FROM_ABI result_type __eval2(true_type) { return __evalf<__k, 0>(); }
148
149 template <uint64_t _Np,
150 uint64_t _Dp,
151 __enable_if_t<(__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)), int> = 0>
152 _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
153 return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();
154 }
155
156 template <uint64_t _Np,
157 uint64_t _Dp,
158 __enable_if_t<__uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min), int> = 0>
159 _LIBCPP_HIDE_FROM_ABI result_type __eval(__uratio<_Np, _Dp>) {
160 const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (__y_ - _Min) / __uratio<_Np, _Dp>::den);
161 __y_ = __v_[__j];
162 __v_[__j] = __e_();
163 return __y_;
164 }
165
166156 template <uint64_t __n, uint64_t __d>
167157 _LIBCPP_HIDE_FROM_ABI result_type __evalf() {
168158 const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d;
lib/libcxx/include/__random/student_t_distribution.h+7-7
......@@ -43,7 +43,7 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __n = 1) : __n_(__n) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __n_; }
4747
4848 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4949 return __x.__n_ == __y.__n_;
......@@ -68,20 +68,20 @@ public:
6868
6969 // generating functions
7070 template <class _URNG>
71 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
71 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7272 return (*this)(__g, __p_);
7373 }
7474 template <class _URNG>
75 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
75 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7676
7777 // property functions
78 _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
78 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type n() const { return __p_.n(); }
7979
80 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8181 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8282
83 _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
84 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return -numeric_limits<result_type>::infinity(); }
84 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
8585
8686 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const student_t_distribution& __x, const student_t_distribution& __y) {
8787 return __x.__p_ == __y.__p_;
lib/libcxx/include/__random/subtract_with_carry_engine.h+31-60
......@@ -75,8 +75,8 @@ public:
7575 static inline _LIBCPP_CONSTEXPR const size_t word_size = __w;
7676 static inline _LIBCPP_CONSTEXPR const size_t short_lag = __s;
7777 static inline _LIBCPP_CONSTEXPR const size_t long_lag = __r;
78 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
79 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
78 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
8080 static inline _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
8181
8282 // constructors and seeding functions
......@@ -86,23 +86,46 @@ public:
8686#else
8787 _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(result_type __sd = default_seed) { seed(__sd); }
8888#endif
89 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
89 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, subtract_with_carry_engine>, int> = 0>
9090 _LIBCPP_HIDE_FROM_ABI explicit subtract_with_carry_engine(_Sseq& __q) {
9191 seed(__q);
9292 }
93
9394 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd = default_seed) {
94 seed(__sd, integral_constant<unsigned, 1 + (__w - 1) / 32>());
95 linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
96 for (size_t __i = 0; __i < __r; ++__i) {
97 if _LIBCPP_CONSTEXPR ((1 + (__w - 1) / 32) == 1) {
98 __x_[__i] = static_cast<result_type>(__e() & _Max);
99 } else {
100 result_type __e0 = __e();
101 __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max);
102 }
103 }
104 __c_ = __x_[__r - 1] == 0;
105 __i_ = 0;
95106 }
96 template <class _Sseq, __enable_if_t<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value, int> = 0>
107
108 template <class _Sseq, __enable_if_t<__is_seed_sequence_v<_Sseq, subtract_with_carry_engine>, int> = 0>
97109 _LIBCPP_HIDE_FROM_ABI void seed(_Sseq& __q) {
98 __seed(__q, integral_constant<unsigned, 1 + (__w - 1) / 32>());
110 const unsigned __k = 1 + (__w - 1) / 32;
111 static_assert(__k <= 2);
112 uint32_t __ar[__r * __k];
113 __q.generate(__ar, __ar + __r * __k);
114 for (size_t __i = 0; __i < __r; ++__i) {
115 if _LIBCPP_CONSTEXPR (__k == 1)
116 __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
117 else
118 __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
119 }
120 __c_ = __x_[__r - 1] == 0;
121 __i_ = 0;
99122 }
100123
101124 // generating functions
102 _LIBCPP_HIDE_FROM_ABI result_type operator()();
125 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()();
103126 _LIBCPP_HIDE_FROM_ABI void discard(unsigned long long __z) {
104127 for (; __z; --__z)
105 operator()();
128 (void)operator()();
106129 }
107130
108131 template <class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
......@@ -120,60 +143,8 @@ public:
120143 template <class _CharT, class _Traits, class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
121144 friend basic_istream<_CharT, _Traits>&
122145 operator>>(basic_istream<_CharT, _Traits>& __is, subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
123
124private:
125 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 1>);
126 _LIBCPP_HIDE_FROM_ABI void seed(result_type __sd, integral_constant<unsigned, 2>);
127 template <class _Sseq>
128 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 1>);
129 template <class _Sseq>
130 _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
131146};
132147
133template <class _UIntType, size_t __w, size_t __s, size_t __r>
134void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) {
135 linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
136 for (size_t __i = 0; __i < __r; ++__i)
137 __x_[__i] = static_cast<result_type>(__e() & _Max);
138 __c_ = __x_[__r - 1] == 0;
139 __i_ = 0;
140}
141
142template <class _UIntType, size_t __w, size_t __s, size_t __r>
143void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 2>) {
144 linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);
145 for (size_t __i = 0; __i < __r; ++__i) {
146 result_type __e0 = __e();
147 __x_[__i] = static_cast<result_type>((__e0 + ((uint64_t)__e() << 32)) & _Max);
148 }
149 __c_ = __x_[__r - 1] == 0;
150 __i_ = 0;
151}
152
153template <class _UIntType, size_t __w, size_t __s, size_t __r>
154template <class _Sseq>
155void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {
156 const unsigned __k = 1;
157 uint32_t __ar[__r * __k];
158 __q.generate(__ar, __ar + __r * __k);
159 for (size_t __i = 0; __i < __r; ++__i)
160 __x_[__i] = static_cast<result_type>(__ar[__i] & _Max);
161 __c_ = __x_[__r - 1] == 0;
162 __i_ = 0;
163}
164
165template <class _UIntType, size_t __w, size_t __s, size_t __r>
166template <class _Sseq>
167void subtract_with_carry_engine<_UIntType, __w, __s, __r>::__seed(_Sseq& __q, integral_constant<unsigned, 2>) {
168 const unsigned __k = 2;
169 uint32_t __ar[__r * __k];
170 __q.generate(__ar, __ar + __r * __k);
171 for (size_t __i = 0; __i < __r; ++__i)
172 __x_[__i] = static_cast<result_type>((__ar[2 * __i] + ((uint64_t)__ar[2 * __i + 1] << 32)) & _Max);
173 __c_ = __x_[__r - 1] == 0;
174 __i_ = 0;
175}
176
177148template <class _UIntType, size_t __w, size_t __s, size_t __r>
178149_UIntType subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() {
179150 const result_type& __xs = __x_[(__i_ + (__r - __s)) % __r];
lib/libcxx/include/__random/uniform_int_distribution.h+9-9
......@@ -151,8 +151,8 @@ public:
151151 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max())
152152 : __a_(__a), __b_(__b) {}
153153
154 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
155 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
154 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
155 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
156156
157157 _LIBCPP_HIDE_FROM_ABI friend bool operator==(const param_type& __x, const param_type& __y) {
158158 return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
......@@ -179,21 +179,21 @@ public:
179179
180180 // generating functions
181181 template <class _URNG>
182 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
182 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
183183 return (*this)(__g, __p_);
184184 }
185185 template <class _URNG>
186 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
186 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
187187
188188 // property functions
189 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
190 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
189 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
190 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
191191
192 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
192 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
193193 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
194194
195 _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
196 _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
195 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
196 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
197197
198198 _LIBCPP_HIDE_FROM_ABI friend bool
199199 operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {
lib/libcxx/include/__random/uniform_random_bit_generator.h+4-4
......@@ -23,10 +23,10 @@
2323_LIBCPP_PUSH_MACROS
2424#include <__undef_macros>
2525
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2826#if _LIBCPP_STD_VER >= 20
2927
28_LIBCPP_BEGIN_NAMESPACE_STD
29
3030// [rand.req.urng]
3131template <class _Gen>
3232concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<invoke_result_t<_Gen&>> && requires {
......@@ -35,10 +35,10 @@ concept uniform_random_bit_generator = invocable<_Gen&> && unsigned_integral<inv
3535 requires bool_constant<(_Gen::min() < _Gen::max())>::value;
3636};
3737
38#endif // _LIBCPP_STD_VER >= 20
39
4038_LIBCPP_END_NAMESPACE_STD
4139
40#endif // _LIBCPP_STD_VER >= 20
41
4242_LIBCPP_POP_MACROS
4343
4444#endif // _LIBCPP___RANDOM_UNIFORM_RANDOM_BIT_GENERATOR_H
lib/libcxx/include/__random/uniform_real_distribution.h+9-9
......@@ -42,8 +42,8 @@ public:
4242
4343 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 0, result_type __b = 1) : __a_(__a), __b_(__b) {}
4444
45 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
46 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
45 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
4747
4848 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
4949 return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
......@@ -69,21 +69,21 @@ public:
6969
7070 // generating functions
7171 template <class _URNG>
72 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
72 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7373 return (*this)(__g, __p_);
7474 }
7575 template <class _URNG>
76 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
76 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p);
7777
7878 // property functions
79 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
80 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
79 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
80 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
8181
82 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8383 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8484
85 _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
86 _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return a(); }
86 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return b(); }
8787
8888 friend _LIBCPP_HIDE_FROM_ABI bool
8989 operator==(const uniform_real_distribution& __x, const uniform_real_distribution& __y) {
lib/libcxx/include/__random/weibull_distribution.h+9-9
......@@ -43,8 +43,8 @@ public:
4343
4444 _LIBCPP_HIDE_FROM_ABI explicit param_type(result_type __a = 1, result_type __b = 1) : __a_(__a), __b_(__b) {}
4545
46 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
46 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __a_; }
47 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __b_; }
4848
4949 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const param_type& __x, const param_type& __y) {
5050 return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;
......@@ -70,23 +70,23 @@ public:
7070
7171 // generating functions
7272 template <class _URNG>
73 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
73 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g) {
7474 return (*this)(__g, __p_);
7575 }
7676 template <class _URNG>
77 _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
77 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type operator()(_URNG& __g, const param_type& __p) {
7878 return __p.b() * std::pow(exponential_distribution<result_type>()(__g), 1 / __p.a());
7979 }
8080
8181 // property functions
82 _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
83 _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
82 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type a() const { return __p_.a(); }
83 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type b() const { return __p_.b(); }
8484
85 _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
85 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI param_type param() const { return __p_; }
8686 _LIBCPP_HIDE_FROM_ABI void param(const param_type& __p) { __p_ = __p; }
8787
88 _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
89 _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
88 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type min() const { return 0; }
89 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI result_type max() const { return numeric_limits<result_type>::infinity(); }
9090
9191 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const weibull_distribution& __x, const weibull_distribution& __y) {
9292 return __x.__p_ == __y.__p_;
lib/libcxx/include/__ranges/access.h+4-4
......@@ -27,10 +27,10 @@
2727# pragma GCC system_header
2828#endif
2929
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3230#if _LIBCPP_STD_VER >= 20
3331
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3434namespace ranges {
3535template <class _Tp>
3636concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>;
......@@ -203,8 +203,8 @@ inline constexpr auto cend = __cend::__fn{};
203203} // namespace __cpo
204204} // namespace ranges
205205
206#endif // _LIBCPP_STD_VER >= 20
207
208206_LIBCPP_END_NAMESPACE_STD
209207
208#endif // _LIBCPP_STD_VER >= 20
209
210210#endif // _LIBCPP___RANGES_ACCESS_H
lib/libcxx/include/__ranges/adjacent_transform_view.h+20-19
......@@ -19,6 +19,7 @@
1919#include <__concepts/derived_from.h>
2020#include <__concepts/equality_comparable.h>
2121#include <__concepts/invocable.h>
22#include <__concepts/referenceable.h>
2223#include <__cstddef/size_t.h>
2324#include <__functional/bind_back.h>
2425#include <__functional/invoke.h>
......@@ -45,7 +46,6 @@
4546#include <__type_traits/decay.h>
4647#include <__type_traits/is_nothrow_constructible.h>
4748#include <__type_traits/is_object.h>
48#include <__type_traits/is_referenceable.h>
4949#include <__type_traits/make_unsigned.h>
5050#include <__type_traits/maybe_const.h>
5151#include <__utility/declval.h>
......@@ -105,22 +105,22 @@ public:
105105 _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_transform_view(_View __base, _Fn __fun)
106106 : __inner_(std::move(__base)), __fun_(std::in_place, std::move(__fun)) {}
107107
108 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
108 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
109109 requires copy_constructible<_View>
110110 {
111111 return __inner_.base();
112112 }
113 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__inner_).base(); }
113 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__inner_).base(); }
114114
115 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __inner_.begin()); }
115 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __inner_.begin()); }
116116
117 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
117 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
118118 requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>>
119119 {
120120 return __iterator<true>(*this, __inner_.begin());
121121 }
122122
123 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
123 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
124124 if constexpr (common_range<_InnerView>) {
125125 return __iterator<false>(*this, __inner_.end());
126126 } else {
......@@ -128,7 +128,7 @@ public:
128128 }
129129 }
130130
131 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
131 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
132132 requires range<const _InnerView> && regular_invocable<__apply_n<const _Fn&, _Np>, range_reference_t<const _View>>
133133 {
134134 if constexpr (common_range<const _InnerView>) {
......@@ -138,13 +138,13 @@ public:
138138 }
139139 }
140140
141 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
141 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
142142 requires sized_range<_InnerView>
143143 {
144144 return __inner_.size();
145145 }
146146
147 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
147 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
148148 requires sized_range<const _InnerView>
149149 {
150150 return __inner_.size();
......@@ -202,7 +202,7 @@ public:
202202 requires _Const && convertible_to<__inner_iterator<false>, __inner_iterator<true>>
203203 : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {}
204204
205 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
205 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
206206 noexcept(__noexcept_dereference(make_index_sequence<_Np>{})) {
207207 return std::apply(
208208 [&](const auto&... __iters) -> decltype(auto) { return std::invoke(*__parent_->__fun_, *__iters...); },
......@@ -249,7 +249,7 @@ public:
249249 return *this;
250250 }
251251
252 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
252 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
253253 requires random_access_range<_Base>
254254 {
255255 return std::apply(
......@@ -291,25 +291,26 @@ public:
291291 return __x.__inner_ <=> __y.__inner_;
292292 }
293293
294 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
294 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
295295 requires random_access_range<_Base>
296296 {
297297 return __iterator(*__i.__parent_, __i.__inner_ + __n);
298298 }
299299
300 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
300 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
301301 requires random_access_range<_Base>
302302 {
303303 return __iterator(*__i.__parent_, __i.__inner_ + __n);
304304 }
305305
306 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
306 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
307307 requires random_access_range<_Base>
308308 {
309309 return __iterator(*__i.__parent_, __i.__inner_ - __n);
310310 }
311311
312 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
312 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
313 operator-(const __iterator& __x, const __iterator& __y)
313314 requires sized_sentinel_for<__inner_iterator<_Const>, __inner_iterator<_Const>>
314315 {
315316 return __x.__inner_ - __y.__inner_;
......@@ -344,14 +345,14 @@ public:
344345
345346 template <bool _OtherConst>
346347 requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>>
347 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
348 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
348349 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
349350 return __x.__inner_ - __y.__inner_;
350351 }
351352
352353 template <bool _OtherConst>
353354 requires sized_sentinel_for<__inner_sentinel<_Const>, __inner_iterator<_OtherConst>>
354 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
355 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
355356 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
356357 return __x.__inner_ - __y.__inner_;
357358 }
......@@ -364,14 +365,14 @@ template <size_t _Np>
364365struct __fn : __range_adaptor_closure<__fn<_Np>> {
365366 template <class _Range, class _Fn>
366367 requires(_Np == 0 && forward_range<_Range &&>)
367 _LIBCPP_HIDE_FROM_ABI static constexpr auto
368 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
368369 operator()(_Range&&, _Fn&& __fn) noexcept(noexcept(views::zip_transform(std::forward<_Fn>(__fn))))
369370 -> decltype(views::zip_transform(std::forward<_Fn>(__fn))) {
370371 return views::zip_transform(std::forward<_Fn>(__fn));
371372 }
372373
373374 template <class _Range, class _Fn>
374 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Fn&& __fn) noexcept(
375 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&& __range, _Fn&& __fn) noexcept(
375376 noexcept(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>(
376377 std::forward<_Range>(__range), std::forward<_Fn>(__fn))))
377378 -> decltype(adjacent_transform_view<views::all_t<_Range&&>, decay_t<_Fn>, _Np>(
lib/libcxx/include/__ranges/adjacent_view.h+19-18
......@@ -81,26 +81,26 @@ public:
8181
8282 _LIBCPP_HIDE_FROM_ABI constexpr explicit adjacent_view(_View __base) : __base_(std::move(__base)) {}
8383
84 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
8585 requires copy_constructible<_View>
8686 {
8787 return __base_;
8888 }
89 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
9089
91 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
91 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
9292 requires(!__simple_view<_View>)
9393 {
9494 return __iterator<false>(ranges::begin(__base_), ranges::end(__base_));
9595 }
9696
97 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
9898 requires range<const _View> // LWG4482 This is under-constrained.
9999 {
100100 return __iterator<true>(ranges::begin(__base_), ranges::end(__base_));
101101 }
102102
103 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
104104 requires(!__simple_view<_View>)
105105 {
106106 if constexpr (common_range<_View>) {
......@@ -110,7 +110,7 @@ public:
110110 }
111111 }
112112
113 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
113 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
114114 requires range<const _View> // LWG4482 This is under-constrained.
115115 {
116116 if constexpr (common_range<const _View>) {
......@@ -120,7 +120,7 @@ public:
120120 }
121121 }
122122
123 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
123 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
124124 requires sized_range<_View>
125125 {
126126 using _ST = decltype(ranges::size(__base_));
......@@ -130,7 +130,7 @@ public:
130130 return static_cast<_ST>(__sz);
131131 }
132132
133 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
133 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
134134 requires sized_range<const _View>
135135 {
136136 using _ST = decltype(ranges::size(__base_));
......@@ -205,7 +205,7 @@ public:
205205 requires _Const && convertible_to<iterator_t<_View>, iterator_t<const _View>>
206206 : __iterator(std::move(__i), make_index_sequence<_Np>{}) {}
207207
208 _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
208 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
209209 return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
210210 }
211211
......@@ -257,7 +257,7 @@ public:
257257 return *this;
258258 }
259259
260 _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
260 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
261261 requires random_access_range<_Base>
262262 {
263263 return std::__tuple_transform([&](auto& __i) -> decltype(auto) { return __i[__n]; }, __current_);
......@@ -297,7 +297,7 @@ public:
297297 return __x.__current_.back() <=> __y.__current_.back();
298298 }
299299
300 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
300 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
301301 requires random_access_range<_Base>
302302 {
303303 auto __r = __i;
......@@ -305,13 +305,13 @@ public:
305305 return __r;
306306 }
307307
308 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
308 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
309309 requires random_access_range<_Base>
310310 {
311311 return __i + __n;
312312 }
313313
314 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
314 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
315315 requires random_access_range<_Base>
316316 {
317317 auto __r = __i;
......@@ -319,7 +319,8 @@ public:
319319 return __r;
320320 }
321321
322 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
322 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
323 operator-(const __iterator& __x, const __iterator& __y)
323324 requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
324325 {
325326 return __x.__current_.back() - __y.__current_.back();
......@@ -366,14 +367,14 @@ public:
366367
367368 template <bool _OtherConst>
368369 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
369 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
370 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
370371 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
371372 return __x.__current_.back() - __y.__end_;
372373 }
373374
374375 template <bool _OtherConst>
375376 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
376 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
377 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
377378 operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) {
378379 return __y.__end_ - __x.__current_.back();
379380 }
......@@ -389,12 +390,12 @@ template <size_t _Np>
389390struct __fn : __range_adaptor_closure<__fn<_Np>> {
390391 template <class _Range>
391392 requires(_Np == 0 && forward_range<_Range &&>)
392 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&&) noexcept {
393 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Range&&) noexcept {
393394 return empty_view<tuple<>>{};
394395 }
395396
396397 template <class _Ranges>
397 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ranges&& __range) noexcept(
398 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Ranges&& __range) noexcept(
398399 noexcept(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))))
399400 -> decltype(adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range))) {
400401 return adjacent_view<views::all_t<_Ranges&&>, _Np>(std::forward<_Ranges>(__range));
lib/libcxx/include/__ranges/all.h+4-4
......@@ -29,10 +29,10 @@
2929# pragma GCC system_header
3030#endif
3131
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3432#if _LIBCPP_STD_VER >= 20
3533
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3636namespace ranges::views {
3737
3838namespace __all {
......@@ -71,8 +71,8 @@ using all_t = decltype(views::all(std::declval<_Range>()));
7171
7272} // namespace ranges::views
7373
74#endif // _LIBCPP_STD_VER >= 20
75
7674_LIBCPP_END_NAMESPACE_STD
7775
76#endif // _LIBCPP_STD_VER >= 20
77
7878#endif // _LIBCPP___RANGES_ALL_H
lib/libcxx/include/__ranges/chunk_by_view.h+1-1
......@@ -54,7 +54,7 @@ namespace ranges {
5454
5555template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred>
5656 requires view<_View> && is_object_v<_Pred>
57class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> {
57class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> {
5858 _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
5959 _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
6060
lib/libcxx/include/__ranges/concat_view.h created+651
......@@ -0,0 +1,651 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___RANGES_CONCAT_VIEW_H
11#define _LIBCPP___RANGES_CONCAT_VIEW_H
12
13#include <__assert>
14#include <__concepts/common_reference_with.h>
15#include <__concepts/constructible.h>
16#include <__concepts/convertible_to.h>
17#include <__concepts/copyable.h>
18#include <__concepts/derived_from.h>
19#include <__concepts/equality_comparable.h>
20#include <__concepts/swappable.h>
21#include <__config>
22#include <__iterator/concepts.h>
23#include <__iterator/default_sentinel.h>
24#include <__iterator/distance.h>
25#include <__iterator/incrementable_traits.h>
26#include <__iterator/iter_move.h>
27#include <__iterator/iter_swap.h>
28#include <__iterator/iterator_traits.h>
29#include <__iterator/next.h>
30#include <__ranges/access.h>
31#include <__ranges/all.h>
32#include <__ranges/concepts.h>
33#include <__ranges/movable_box.h>
34#include <__ranges/range_adaptor.h>
35#include <__ranges/size.h>
36#include <__ranges/view_interface.h>
37#include <__tuple/tuple_transform.h>
38#include <__type_traits/conditional.h>
39#include <__type_traits/decay.h>
40#include <__type_traits/is_nothrow_constructible.h>
41#include <__type_traits/make_unsigned.h>
42#include <__type_traits/maybe_const.h>
43#include <__utility/forward.h>
44#include <__utility/in_place.h>
45#include <__utility/move.h>
46#include <tuple>
47#include <variant>
48
49#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
50# pragma GCC system_header
51#endif
52
53_LIBCPP_PUSH_MACROS
54#include <__undef_macros>
55
56_LIBCPP_BEGIN_NAMESPACE_STD
57
58#if _LIBCPP_STD_VER >= 26
59
60namespace ranges {
61
62# ifdef __cpp_pack_indexing
63template <class... _Tp>
64using __extract_last _LIBCPP_NODEBUG = _Tp...[sizeof...(_Tp) - 1];
65# else
66template <class _Tp, class... _Tail>
67struct __extract_last_impl : __extract_last_impl<_Tail...> {};
68template <class _Tp>
69struct __extract_last_impl<_Tp> {
70 using type _LIBCPP_NODEBUG = _Tp;
71};
72
73template <class... _Tp>
74using __extract_last _LIBCPP_NODEBUG = __extract_last_impl<_Tp...>::type;
75# endif
76
77template <bool _Const, class... _Tp>
78struct __all_but_first_model_sized_range;
79
80template <bool _Const, class _Head, class... _Tail>
81struct __all_but_first_model_sized_range<_Const, _Head, _Tail...> {
82 static constexpr bool value = (sized_range<__maybe_const<_Const, _Tail>> && ...);
83};
84
85template <bool _Const, class... _Views>
86concept __all_random_access = (random_access_range<__maybe_const<_Const, _Views>> && ...);
87
88template <bool _Const, class... _Views>
89concept __all_bidirectional = (bidirectional_range<__maybe_const<_Const, _Views>> && ...);
90
91template <bool _Const, class... _Views>
92concept __all_forward = (forward_range<__maybe_const<_Const, _Views>> && ...);
93
94template <bool _Const, class _First, class... _Tail>
95struct __all_common_ignore_last {
96 static constexpr bool value =
97 common_range<__maybe_const<_Const, _First>> && __all_common_ignore_last<_Const, _Tail...>::value;
98};
99
100template <bool _Const, class _Tail>
101struct __all_common_ignore_last<_Const, _Tail> {
102 static constexpr bool value = true;
103};
104
105template <bool _Const, class... _Rs>
106concept __concat_is_random_access =
107 (__all_random_access<_Const, _Rs...>) && (__all_common_ignore_last<_Const, _Rs...>::value);
108
109template <bool _Const, class... _Rs>
110concept __concat_is_bidirectional =
111 (__all_bidirectional<_Const, _Rs...>) && (__all_common_ignore_last<_Const, _Rs...>::value);
112
113template <input_range... _Views>
114 requires((view<_Views> && ...) && (sizeof...(_Views) > 0) && __concatable<_Views...>)
115class concat_view : public view_interface<concat_view<_Views...>> {
116 tuple<_Views...> __views_;
117
118 template <bool _Const>
119 class __iterator;
120
121public:
122 _LIBCPP_HIDE_FROM_ABI constexpr concat_view() = default;
123
124 _LIBCPP_HIDE_FROM_ABI constexpr explicit concat_view(_Views... __views) : __views_(std::move(__views)...) {}
125
126 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin()
127 requires(!(__simple_view<_Views> && ...))
128 {
129 __iterator<false> __it(this, in_place_index<0>, ranges::begin(std::get<0>(__views_)));
130 __it.template __satisfy<0>();
131 return __it;
132 }
133
134 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
135 requires((range<const _Views> && ...) && __concatable<const _Views...>)
136 {
137 __iterator<true> __it(this, in_place_index<0>, ranges::begin(std::get<0>(__views_)));
138 __it.template __satisfy<0>();
139 return __it;
140 }
141
142 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
143 requires(!(__simple_view<_Views> && ...))
144 {
145 if constexpr (__all_forward<false, _Views...> && common_range<__maybe_const<false, __extract_last<_Views...>>>) {
146 constexpr auto __n = sizeof...(_Views);
147 return __iterator<false>(this, in_place_index<__n - 1>, ranges::end(std::get<__n - 1>(__views_)));
148 } else {
149 return default_sentinel;
150 }
151 }
152
153 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
154 requires((range<const _Views> && ...) && __concatable<const _Views...>)
155 {
156 if constexpr (__all_forward<true, _Views...> && common_range<__maybe_const<true, __extract_last<_Views...>>>) {
157 constexpr auto __n = sizeof...(_Views);
158 return __iterator<true>(this, in_place_index<__n - 1>, ranges::end(std::get<__n - 1>(__views_)));
159 } else {
160 return default_sentinel;
161 }
162 }
163
164 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
165 requires(sized_range<_Views> && ...)
166 {
167 return std::apply(
168 [](auto... __sizes) { return (make_unsigned_t<common_type_t<decltype(__sizes)...>>(__sizes) + ...); },
169 std::__tuple_transform(ranges::size, __views_));
170 }
171
172 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
173 requires(sized_range<const _Views> && ...)
174 {
175 return std::apply(
176 [](auto... __sizes) { return (make_unsigned_t<common_type_t<decltype(__sizes)...>>(__sizes) + ...); },
177 std::__tuple_transform(ranges::size, __views_));
178 }
179};
180
181template <class... _Views>
182concat_view(_Views&&...) -> concat_view<views::all_t<_Views>...>;
183
184template <bool _Const, typename... _Views>
185struct __concat_view_iterator_category {};
186
187template <bool _Const, typename... _Views>
188 requires __all_forward<_Const, _Views...>
189struct __concat_view_iterator_category<_Const, _Views...> {
190private:
191 constexpr static bool __derive_pack_random_iterator =
192 (derived_from<typename iterator_traits<iterator_t<__maybe_const<_Const, _Views>>>::iterator_category,
193 random_access_iterator_tag> &&
194 ...);
195 constexpr static bool __derive_pack_bidirectional_iterator =
196 (derived_from<typename iterator_traits<iterator_t<__maybe_const<_Const, _Views>>>::iterator_category,
197 bidirectional_iterator_tag> &&
198 ...);
199 constexpr static bool __derive_pack_forward_iterator =
200 (derived_from<typename iterator_traits< iterator_t<__maybe_const<_Const, _Views>>>::iterator_category,
201 forward_iterator_tag> &&
202 ...);
203
204public:
205 using iterator_category =
206 _If<!is_reference_v<__concat_reference_t<__maybe_const<_Const, _Views>...>>,
207 input_iterator_tag,
208 _If<__derive_pack_random_iterator,
209 random_access_iterator_tag,
210 _If<__derive_pack_bidirectional_iterator,
211 bidirectional_iterator_tag,
212 _If<__derive_pack_forward_iterator, forward_iterator_tag, input_iterator_tag > > > >;
213};
214
215template <input_range... _Views>
216 requires((view<_Views> && ...) && (sizeof...(_Views) > 0) && __concatable<_Views...>)
217template <bool _Const>
218class concat_view<_Views...>::__iterator : public __concat_view_iterator_category<_Const, _Views...> {
219public:
220 using iterator_concept =
221 _If<__concat_is_random_access<_Const, _Views...>,
222 random_access_iterator_tag,
223 _If<__concat_is_bidirectional<_Const, _Views...>,
224 bidirectional_iterator_tag,
225 _If< __all_forward<_Const, _Views...>, forward_iterator_tag, input_iterator_tag > > >;
226 using value_type = __concat_value_t<__maybe_const<_Const, _Views>...>;
227 using difference_type = common_type_t<range_difference_t<__maybe_const<_Const, _Views>>...>;
228
229private:
230 using __base_iter _LIBCPP_NODEBUG = variant<iterator_t<__maybe_const<_Const, _Views>>...>;
231 __base_iter __it_;
232 __maybe_const<_Const, concat_view>* __parent_ = nullptr;
233
234 template <size_t _Idx>
235 _LIBCPP_HIDE_FROM_ABI constexpr void __satisfy() {
236 if constexpr (_Idx < (sizeof...(_Views) - 1)) {
237 if (std::get<_Idx>(__it_) == ranges::end(std::get<_Idx>(__parent_->__views_))) {
238 __it_.template emplace<_Idx + 1>(ranges::begin(std::get<_Idx + 1>(__parent_->__views_)));
239 __satisfy<_Idx + 1>();
240 }
241 }
242 }
243
244 template <size_t _Idx>
245 _LIBCPP_HIDE_FROM_ABI constexpr void __prev() {
246 if constexpr (_Idx == 0) {
247 --std::get<0>(__it_);
248 } else {
249 if (std::get<_Idx>(__it_) == ranges::begin(std::get<_Idx>(__parent_->__views_))) {
250 __it_.template emplace<_Idx - 1>(ranges::end(std::get<_Idx - 1>(__parent_->__views_)));
251 __prev<_Idx - 1>();
252 } else {
253 --std::get<_Idx>(__it_);
254 }
255 }
256 }
257
258 template <size_t _Idx>
259 _LIBCPP_HIDE_FROM_ABI constexpr void __advance_fwd(difference_type __offset, difference_type __steps) {
260 using __underlying_diff_type = iter_difference_t<variant_alternative_t<_Idx, __base_iter>>;
261 if constexpr (_Idx == sizeof...(_Views) - 1) {
262 std::get<_Idx>(__it_) += static_cast<__underlying_diff_type>(__steps);
263 } else {
264 auto __n_size = ranges::distance(std::get<_Idx>(__parent_->__views_));
265 if (__offset + __steps < __n_size) {
266 std::get<_Idx>(__it_) += static_cast<__underlying_diff_type>(__steps);
267 } else {
268 __it_.template emplace<_Idx + 1>(ranges::begin(std::get<_Idx + 1>(__parent_->__views_)));
269 __advance_fwd<_Idx + 1>(0, __offset + __steps - __n_size);
270 }
271 }
272 }
273
274 template <size_t _Idx>
275 _LIBCPP_HIDE_FROM_ABI constexpr void __advance_bwd(difference_type __offset, difference_type __steps) {
276 using __underlying_diff_type = iter_difference_t<variant_alternative_t<_Idx, __base_iter>>;
277 if constexpr (_Idx == 0) {
278 std::get<_Idx>(__it_) -= static_cast<__underlying_diff_type>(__steps);
279 } else {
280 if (__offset >= __steps) {
281 std::get<_Idx>(__it_) -= static_cast<__underlying_diff_type>(__steps);
282 } else {
283 auto __prev_size = ranges::distance(std::get<_Idx - 1>(__parent_->__views_));
284 __it_.template emplace<_Idx - 1>(ranges::end(std::get<_Idx - 1>(__parent_->__views_)));
285 __advance_bwd<_Idx - 1>(__prev_size, __steps - __offset);
286 }
287 }
288 }
289
290 template <typename _Func>
291 _LIBCPP_HIDE_FROM_ABI constexpr auto __invoke_at_index(_Func&& __func) const {
292 // TODO(GCC 16): Just capture `this` when GCC PR113563 and PR121008 are fixed.
293 return [&__func, &__view_iter = *this]<std::size_t _Is>(this auto&& __self) {
294 if (_Is == __view_iter.__it_.index()) {
295 return __func.template operator()<_Is>();
296 }
297 if constexpr (_Is + 1 < sizeof...(_Views)) {
298 return __self.template operator()<_Is + 1>();
299 }
300 __builtin_unreachable();
301 }.template operator()<0>();
302 }
303
304 template <size_t... _Is, typename _Func>
305 _LIBCPP_HIDE_FROM_ABI constexpr void __apply_at_index(size_t __index, _Func&& __func, index_sequence<_Is...>) const {
306 ((__index == _Is ? (static_cast<void>(__func(integral_constant<size_t, _Is>{})), 0) : 0), ...);
307 }
308
309 template <size_t _Idx, typename _Func>
310 _LIBCPP_HIDE_FROM_ABI constexpr void __apply_at_index(size_t __index, _Func&& __func) const {
311 __apply_at_index(__index, std::forward<_Func>(__func), make_index_sequence<_Idx>{});
312 }
313
314 template <class... _Args>
315 _LIBCPP_HIDE_FROM_ABI explicit constexpr __iterator(__maybe_const<_Const, concat_view>* __parent, _Args&&... __args)
316 requires constructible_from<__base_iter, _Args&&...>
317 : __it_(std::forward<_Args>(__args)...), __parent_(__parent) {}
318
319 friend class concat_view;
320 friend class __iterator<!_Const>;
321
322public:
323 _LIBCPP_HIDE_FROM_ABI __iterator() = default;
324
325 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
326 requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<const _Views>> && ...)
327 : __it_([&__src = __i.__it_]<size_t... _Indices>(size_t __idx, index_sequence<_Indices...>) -> __base_iter {
328 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
329 !__src.valueless_by_exception(), "Trying to convert from a valueless iterator of concat_view.");
330 using __src_lref = decltype((__src));
331 using __construction_fptr = __base_iter (*)(__src_lref);
332 static constexpr __construction_fptr __vtable[]{[](__src_lref __src_var) -> __base_iter {
333 return __base_iter(in_place_index<_Indices>, std::__unchecked_get<_Indices>(std::move(__src_var)));
334 }...};
335 return __vtable[__idx](__src);
336 }(__i.__it_.index(), make_index_sequence<variant_size_v<__base_iter>>{})),
337 __parent_(__i.__parent_) {}
338
339 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const {
340 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
341 !__it_.valueless_by_exception(), "Trying to dereference a valueless iterator of concat_view.");
342 return __variant_detail::__visitation::__variant::__visit_value(
343 [](auto&& __it) -> __concat_reference_t<__maybe_const<_Const, _Views>...> { return *__it; }, __it_);
344 }
345
346 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
347 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
348 !__it_.valueless_by_exception(), "Trying to increment a valueless iterator of concat_view.");
349 size_t __active_index = __it_.index();
350 __apply_at_index<variant_size_v<decltype(__it_)>>(__active_index, [&](auto __index_constant) {
351 constexpr size_t __i = __index_constant.value;
352 ++std::__unchecked_get<__i>(__it_);
353 __satisfy<__i>();
354 });
355 return *this;
356 }
357
358 _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
359
360 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
361 requires(__all_forward<_Const, _Views...>)
362 {
363 auto __tmp = *this;
364 ++*this;
365 return __tmp;
366 }
367
368 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
369 requires __concat_is_bidirectional<_Const, _Views...>
370 {
371 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
372 !__it_.valueless_by_exception(), "Trying to decrement a valueless iterator of concat_view.");
373 size_t __active_index = __it_.index();
374 __apply_at_index<variant_size_v<decltype(__it_)>>(__active_index, [&](auto __index_constant) {
375 constexpr size_t __i = __index_constant.value;
376 __prev<__i>();
377 });
378 return *this;
379 }
380
381 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
382 requires __concat_is_bidirectional<_Const, _Views...>
383 {
384 auto __tmp = *this;
385 --*this;
386 return __tmp;
387 }
388
389 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
390 requires(equality_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...)
391 {
392 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
393 "Trying to compare a valueless iterator of concat_view.");
394 return __x.__it_ == __y.__it_;
395 }
396
397 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
398 requires __concat_is_random_access<_Const, _Views...>
399 {
400 return *((*this) + __n);
401 }
402
403 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __it, difference_type __n)
404 requires __concat_is_random_access<_Const, _Views...>
405 {
406 auto __temp = __it;
407 __temp += __n;
408 return __temp;
409 }
410
411 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __it)
412 requires __concat_is_random_access<_Const, _Views...>
413 {
414 return __it + __n;
415 }
416
417 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
418 requires __concat_is_random_access<_Const, _Views...>
419 {
420 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
421 !__it_.valueless_by_exception(), "Trying to increment a valueless iterator of concat_view.");
422 size_t __active_index = __it_.index();
423 if (__n > 0) {
424 __apply_at_index<tuple_size_v<decltype(__parent_->__views_)>>(__active_index, [&](auto __index_constant) {
425 constexpr size_t __i = __index_constant.value;
426 auto& __active_view = std::get<__i>(__parent_->__views_);
427 difference_type __idx = std::get<__i>(__it_) - ranges::begin(__active_view);
428 __advance_fwd<__i>(__idx, __n);
429 });
430
431 }
432
433 else if (__n < 0) {
434 __apply_at_index<tuple_size_v<decltype(__parent_->__views_)>>(__active_index, [&](auto __index_constant) {
435 constexpr size_t __i = __index_constant.value;
436 auto& __active_view = std::get<__i>(__parent_->__views_);
437 difference_type __idx = std::get<__i>(__it_) - ranges::begin(__active_view);
438 __advance_bwd<__i>(__idx, -__n);
439 });
440 }
441
442 return *this;
443 }
444
445 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
446 requires __concat_is_random_access<_Const, _Views...>
447 {
448 *this += -__n;
449 return *this;
450 }
451
452 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __it, default_sentinel_t) {
453 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
454 !__it.__it_.valueless_by_exception(),
455 "Trying to compare a valueless iterator of concat_view with the default sentinel.");
456 constexpr auto __last_idx = sizeof...(_Views) - 1;
457 return __it.__it_.index() == __last_idx &&
458 std::__unchecked_get<__last_idx>(__it.__it_) == ranges::end(std::get<__last_idx>(__it.__parent_->__views_));
459 }
460
461 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y)
462 requires(__all_random_access<_Const, _Views> && ...)
463 {
464 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
465 "Trying to compare a valueless iterator of concat_view.");
466 return __x.__it_ < __y.__it_;
467 }
468
469 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y)
470 requires(__all_random_access<_Const, _Views> && ...)
471 {
472 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
473 "Trying to compare a valueless iterator of concat_view.");
474 return __x.__it_ > __y.__it_;
475 }
476
477 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y)
478 requires(__all_random_access<_Const, _Views> && ...)
479 {
480 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
481 "Trying to compare a valueless iterator of concat_view.");
482 return __x.__it_ <= __y.__it_;
483 }
484
485 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y)
486 requires(__all_random_access<_Const, _Views> && ...)
487 {
488 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
489 "Trying to compare a valueless iterator of concat_view.");
490 return __x.__it_ >= __y.__it_;
491 }
492
493 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
494 requires((__all_random_access<_Const, _Views> && ...) &&
495 (three_way_comparable<iterator_t<__maybe_const<_Const, _Views>>> && ...))
496 {
497 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
498 "Trying to compare a valueless iterator of concat_view.");
499 return __x.__it_ <=> __y.__it_;
500 }
501
502 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto) iter_move(const __iterator& __it) noexcept(
503
504 ((is_nothrow_invocable_v< decltype(ranges::iter_move), const iterator_t<__maybe_const<_Const, _Views>>& > &&
505 is_nothrow_convertible_v< range_rvalue_reference_t<__maybe_const<_Const, _Views>>,
506 __concat_rvalue_reference_t<__maybe_const<_Const, _Views>...> >) &&
507 ...))
508
509 {
510 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
511 !__it.__it_.valueless_by_exception(), "Trying to apply iter_move to a valueless iterator of concat_view.");
512 return __variant_detail::__visitation::__variant::__visit_value(
513 [](const auto& __i) -> __concat_rvalue_reference_t<__maybe_const<_Const, _Views>...> {
514 return ranges::iter_move(__i);
515 },
516 __it.__it_);
517 }
518
519 _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y)
520
521 noexcept((noexcept(ranges::swap(*__x, *__y))) &&
522 (noexcept(ranges::iter_swap(std::declval<const iterator_t<__maybe_const<_Const, _Views>>>(),
523 std::declval<const iterator_t<__maybe_const<_Const, _Views>>>())) &&
524 ...))
525
526 requires swappable_with<iter_reference_t<__iterator>, iter_reference_t<__iterator>> &&
527 (... && indirectly_swappable<iterator_t<__maybe_const<_Const, _Views>>>)
528 {
529 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
530 !__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
531 "Trying to swap iterators of concat_view where at least one iterator is valueless.");
532 __variant_detail::__visitation::__variant::__visit_value(
533 [&](const auto& __it1, const auto& __it2) {
534 if constexpr (is_same_v<decltype(__it1), decltype(__it2)>) {
535 ranges::iter_swap(__it1, __it2);
536 } else {
537 ranges::swap(*__x, *__y);
538 }
539 },
540 __x.__it_,
541 __y.__it_);
542 }
543
544 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
545 operator-(const __iterator& __x, const __iterator& __y)
546 requires __concat_is_random_access<_Const, _Views...>
547 {
548 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
549 !__x.__it_.valueless_by_exception() && !__y.__it_.valueless_by_exception(),
550 "Trying to subtract two iterators of concat_view where at least one iterator is valueless.");
551 return __x.__invoke_at_index([&]<std::size_t __index_x>() -> difference_type {
552 return __y.__invoke_at_index([&]<std::size_t __index_y>() -> difference_type {
553 if constexpr (__index_x > __index_y) {
554 auto __dx = ranges::distance(
555 ranges::begin(std::get<__index_x>(__x.__parent_->__views_)), std::get<__index_x>(__x.__it_));
556 auto __dy = ranges::distance(
557 std::get<__index_y>(__y.__it_), ranges::end(std::get<__index_y>(__y.__parent_->__views_)));
558 difference_type __s = [&]<std::size_t __start, std::size_t __end>(this auto&& __self) -> difference_type {
559 if constexpr (__start < __end) {
560 return ranges::size(std::get<__start>(__x.__parent_->__views_)) +
561 __self.template operator()<__start + 1, __end>();
562 }
563 return 0;
564 }.template operator()<__index_y + 1, __index_x>();
565 return __dy + __s + __dx;
566 } else if constexpr (__index_x < __index_y) {
567 return -(__y - __x);
568 } else {
569 return std::get<__index_x>(__x.__it_) - std::get<__index_y>(__y.__it_);
570 }
571 });
572 });
573 }
574
575 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __it, difference_type __n)
576 requires __concat_is_random_access<_Const, _Views...>
577 {
578 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
579 !__it.__it_.valueless_by_exception(), "Trying to subtract a valuess iterators of concat_view.");
580 auto __temp = __it;
581 __temp -= __n;
582 return __temp;
583 }
584
585 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
586 operator-(const __iterator& __x, default_sentinel_t)
587 requires(sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
588 ...) &&
589 (__all_but_first_model_sized_range<_Const, _Views...>::value)
590 {
591 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
592 !__x.__it_.valueless_by_exception(),
593 "Trying to subtract a valuess iterators of concat_view from the default sentinel.");
594 return __x.__invoke_at_index([&]<std::size_t __index_x>() -> difference_type {
595 auto __dx =
596 ranges::distance(std::get<__index_x>(__x.__it_), ranges::end(std::get<__index_x>(__x.__parent_->__views_)));
597 difference_type __s = [&]<std::size_t __start, std::size_t __end>(this auto&& __self) -> difference_type {
598 if constexpr (__start < __end) {
599 return ranges::size(std::get<__start>(__x.__parent_->__views_)) +
600 __self.template operator()<__start + 1, __end>();
601 }
602 return 0;
603 }.template operator()<__index_x + 1, sizeof...(_Views)>();
604 return -(__dx + __s);
605 });
606 }
607
608 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
609 operator-(default_sentinel_t, const __iterator& __x)
610 requires(sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
611 ...) &&
612 (__all_but_first_model_sized_range<_Const, _Views...>::value)
613 {
614 return -(__x - default_sentinel);
615 }
616};
617
618namespace views {
619namespace __concat {
620struct __fn {
621 template <input_range _Range>
622 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
623 operator()(_Range&& __range) noexcept(noexcept(views::all((std::forward<_Range>(__range)))))
624 -> decltype(views::all((std::forward<_Range>(__range)))) {
625 return views::all(std::forward<_Range>(__range));
626 }
627
628 template <class _FirstRange, class... _TailRanges>
629 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
630 operator()(_FirstRange&& __first, _TailRanges&&... __tail) noexcept(
631 noexcept(concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...)))
632 -> decltype(concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...)) {
633 return concat_view(std::forward<_FirstRange>(__first), std::forward<_TailRanges>(__tail)...);
634 }
635};
636} // namespace __concat
637
638inline namespace __cpo {
639inline constexpr auto concat = __concat::__fn{};
640} // namespace __cpo
641} // namespace views
642
643} // namespace ranges
644
645#endif // _LIBCPP_STD_VER >= 26
646
647_LIBCPP_END_NAMESPACE_STD
648
649_LIBCPP_POP_MACROS
650
651#endif // _LIBCPP___RANGES_CONCAT_VIEW_H
lib/libcxx/include/__ranges/concepts.h+4-4
......@@ -39,10 +39,10 @@
3939# pragma GCC system_header
4040#endif
4141
42_LIBCPP_BEGIN_NAMESPACE_STD
43
4442#if _LIBCPP_STD_VER >= 20
4543
44_LIBCPP_BEGIN_NAMESPACE_STD
45
4646namespace ranges {
4747
4848// [range.range]
......@@ -175,8 +175,8 @@ concept __concatable = requires {
175175
176176} // namespace ranges
177177
178#endif // _LIBCPP_STD_VER >= 20
179
180178_LIBCPP_END_NAMESPACE_STD
181179
180#endif // _LIBCPP_STD_VER >= 20
181
182182#endif // _LIBCPP___RANGES_CONCEPTS_H
lib/libcxx/include/__ranges/container_compatible_range.h+4-4
......@@ -18,16 +18,16 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 23
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525template <class _Range, class _Tp>
2626concept _ContainerCompatibleRange =
2727 ranges::input_range<_Range> && convertible_to<ranges::range_reference_t<_Range>, _Tp>;
2828
29#endif // _LIBCPP_STD_VER >= 23
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 23
32
3333#endif // _LIBCPP___RANGES_CONTAINER_COMPATIBLE_RANGE_H
lib/libcxx/include/__ranges/dangling.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626namespace ranges {
2727struct dangling {
2828 dangling() = default;
......@@ -35,8 +35,8 @@ using borrowed_iterator_t = _If<borrowed_range<_Rp>, iterator_t<_Rp>, dangling>;
3535// borrowed_subrange_t defined in <__ranges/subrange.h>
3636} // namespace ranges
3737
38#endif // _LIBCPP_STD_VER >= 20
39
4038_LIBCPP_END_NAMESPACE_STD
4139
40#endif // _LIBCPP_STD_VER >= 20
41
4242#endif // _LIBCPP___RANGES_DANGLING_H
lib/libcxx/include/__ranges/data.h+6-6
......@@ -28,10 +28,10 @@
2828# pragma GCC system_header
2929#endif
3030
31_LIBCPP_BEGIN_NAMESPACE_STD
32
3331#if _LIBCPP_STD_VER >= 20
3432
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3535// [range.prim.data]
3636
3737namespace ranges {
......@@ -51,12 +51,12 @@ concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && r
5151
5252struct __fn {
5353 template <__member_data _Tp>
54 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
54 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
5555 return __t.data();
5656 }
5757
5858 template <__ranges_begin_invocable _Tp>
59 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
6060 noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
6161 return std::to_address(ranges::begin(__t));
6262 }
......@@ -95,8 +95,8 @@ inline constexpr auto cdata = __cdata::__fn{};
9595} // namespace __cpo
9696} // namespace ranges
9797
98#endif // _LIBCPP_STD_VER >= 20
99
10098_LIBCPP_END_NAMESPACE_STD
10199
100#endif // _LIBCPP_STD_VER >= 20
101
102102#endif // _LIBCPP___RANGES_DATA_H
lib/libcxx/include/__ranges/drop_view.h+1-2
......@@ -74,8 +74,7 @@ public:
7474 requires default_initializable<_View>
7575 = default;
7676
77 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
78 drop_view(_View __base, range_difference_t<_View> __count)
77 _LIBCPP_HIDE_FROM_ABI constexpr explicit drop_view(_View __base, range_difference_t<_View> __count)
7978 : __count_(__count), __base_(std::move(__base)) {
8079 _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
8180 }
lib/libcxx/include/__ranges/drop_while_view.h+2-2
......@@ -48,13 +48,13 @@ namespace ranges {
4848
4949template <view _View, class _Pred>
5050 requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
51class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface<drop_while_view<_View, _Pred>> {
51class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG drop_while_view : public view_interface<drop_while_view<_View, _Pred>> {
5252public:
5353 _LIBCPP_HIDE_FROM_ABI drop_while_view()
5454 requires default_initializable<_View> && default_initializable<_Pred>
5555 = default;
5656
57 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred)
57 _LIBCPP_HIDE_FROM_ABI constexpr explicit drop_while_view(_View __base, _Pred __pred)
5858 : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
5959
6060 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
lib/libcxx/include/__ranges/elements_of.h+4-4
......@@ -23,10 +23,10 @@
2323_LIBCPP_PUSH_MACROS
2424#include <__undef_macros>
2525
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2826#if _LIBCPP_STD_VER >= 23
2927
28_LIBCPP_BEGIN_NAMESPACE_STD
29
3030namespace ranges {
3131
3232template <range _Range, class _Allocator = allocator<byte>>
......@@ -40,10 +40,10 @@ elements_of(_Range&&, _Allocator = _Allocator()) -> elements_of<_Range&&, _Alloc
4040
4141} // namespace ranges
4242
43#endif // _LIBCPP_STD_VER >= 23
44
4543_LIBCPP_END_NAMESPACE_STD
4644
45#endif // _LIBCPP_STD_VER >= 23
46
4747_LIBCPP_POP_MACROS
4848
4949#endif // _LIBCPP___RANGES_ELEMENTS_OF_H
lib/libcxx/include/__ranges/elements_view.h+21-20
......@@ -77,57 +77,57 @@ public:
7777
7878 _LIBCPP_HIDE_FROM_ABI constexpr explicit elements_view(_View __base) : __base_(std::move(__base)) {}
7979
80 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
80 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
8181 requires copy_constructible<_View>
8282 {
8383 return __base_;
8484 }
8585
86 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
8787
88 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
88 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
8989 requires(!__simple_view<_View>)
9090 {
9191 return __iterator</*_Const=*/false>(ranges::begin(__base_));
9292 }
9393
94 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
94 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
9595 requires range<const _View>
9696 {
9797 return __iterator</*_Const=*/true>(ranges::begin(__base_));
9898 }
9999
100 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
100 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
101101 requires(!__simple_view<_View> && !common_range<_View>)
102102 {
103103 return __sentinel</*_Const=*/false>{ranges::end(__base_)};
104104 }
105105
106 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
106 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
107107 requires(!__simple_view<_View> && common_range<_View>)
108108 {
109109 return __iterator</*_Const=*/false>{ranges::end(__base_)};
110110 }
111111
112 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
112 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
113113 requires range<const _View>
114114 {
115115 return __sentinel</*_Const=*/true>{ranges::end(__base_)};
116116 }
117117
118 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
118 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
119119 requires common_range<const _View>
120120 {
121121 return __iterator</*_Const=*/true>{ranges::end(__base_)};
122122 }
123123
124 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
124 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
125125 requires sized_range<_View>
126126 {
127127 return ranges::size(__base_);
128128 }
129129
130 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
130 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
131131 requires sized_range<const _View>
132132 {
133133 return ranges::size(__base_);
......@@ -211,11 +211,11 @@ public:
211211 requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
212212 : __current_(std::move(__i.__current_)) {}
213213
214 _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
214 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
215215
216 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
216 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
217217
218 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); }
218 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); }
219219
220220 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
221221 ++__current_;
......@@ -261,7 +261,7 @@ public:
261261 return *this;
262262 }
263263
264 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
264 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
265265 requires random_access_range<_Base>
266266 {
267267 return __get_element(__current_ + __n);
......@@ -303,25 +303,26 @@ public:
303303 return __x.__current_ <=> __y.__current_;
304304 }
305305
306 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y)
306 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y)
307307 requires random_access_range<_Base>
308308 {
309309 return __iterator{__x} += __y;
310310 }
311311
312 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y)
312 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y)
313313 requires random_access_range<_Base>
314314 {
315315 return __y + __x;
316316 }
317317
318 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y)
318 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y)
319319 requires random_access_range<_Base>
320320 {
321321 return __iterator{__x} -= __y;
322322 }
323323
324 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
324 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
325 operator-(const __iterator& __x, const __iterator& __y)
325326 requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
326327 {
327328 return __x.__current_ - __y.__current_;
......@@ -365,14 +366,14 @@ public:
365366
366367 template <bool _OtherConst>
367368 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
368 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
369 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
369370 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
370371 return __get_current(__x) - __y.__end_;
371372 }
372373
373374 template <bool _OtherConst>
374375 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
375 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
376 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
376377 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
377378 return __x.__end_ - __get_current(__y);
378379 }
lib/libcxx/include/__ranges/empty.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727// [range.prim.empty]
2828
2929namespace ranges {
......@@ -64,8 +64,8 @@ inline constexpr auto empty = __empty::__fn{};
6464} // namespace __cpo
6565} // namespace ranges
6666
67#endif // _LIBCPP_STD_VER >= 20
68
6967_LIBCPP_END_NAMESPACE_STD
7068
69#endif // _LIBCPP_STD_VER >= 20
70
7171#endif // _LIBCPP___RANGES_EMPTY_H
lib/libcxx/include/__ranges/enable_borrowed_range.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727namespace ranges {
2828
2929// [range.range], ranges
......@@ -33,8 +33,8 @@ inline constexpr bool enable_borrowed_range = false;
3333
3434} // namespace ranges
3535
36#endif // _LIBCPP_STD_VER >= 20
37
3836_LIBCPP_END_NAMESPACE_STD
3937
38#endif // _LIBCPP_STD_VER >= 20
39
4040#endif // _LIBCPP___RANGES_ENABLE_BORROWED_RANGE_H
lib/libcxx/include/__ranges/enable_view.h+4-4
......@@ -20,10 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2523#if _LIBCPP_STD_VER >= 20
2624
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2727namespace ranges {
2828
2929struct view_base {};
......@@ -43,8 +43,8 @@ inline constexpr bool enable_view = derived_from<_Tp, view_base> || requires {
4343
4444} // namespace ranges
4545
46#endif // _LIBCPP_STD_VER >= 20
47
4846_LIBCPP_END_NAMESPACE_STD
4947
48#endif // _LIBCPP_STD_VER >= 20
49
5050#endif // _LIBCPP___RANGES_ENABLE_VIEW_H
lib/libcxx/include/__ranges/enumerate_view.h created+350
......@@ -0,0 +1,350 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___RANGES_ENUMERATE_VIEW_H
11#define _LIBCPP___RANGES_ENUMERATE_VIEW_H
12
13#include <__concepts/constructible.h>
14#include <__concepts/convertible_to.h>
15#include <__config>
16#include <__iterator/concepts.h>
17#include <__iterator/distance.h>
18#include <__iterator/iter_move.h>
19#include <__iterator/iterator_traits.h>
20#include <__ranges/access.h>
21#include <__ranges/all.h>
22#include <__ranges/concepts.h>
23#include <__ranges/enable_borrowed_range.h>
24#include <__ranges/range_adaptor.h>
25#include <__ranges/size.h>
26#include <__ranges/view_interface.h>
27#include <__type_traits/maybe_const.h>
28#include <__utility/forward.h>
29#include <__utility/move.h>
30#include <tuple>
31
32#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
33# pragma GCC system_header
34#endif
35
36_LIBCPP_PUSH_MACROS
37#include <__undef_macros>
38
39_LIBCPP_BEGIN_NAMESPACE_STD
40
41#if _LIBCPP_STD_VER >= 23
42
43namespace ranges {
44
45// [concept.object]
46
47template <class _Rp>
48concept __range_with_movable_references =
49 input_range<_Rp> && std::move_constructible<range_reference_t<_Rp>> &&
50 std::move_constructible<range_rvalue_reference_t<_Rp>>;
51
52// [range.enumerate.view]
53
54template <view _View>
55 requires __range_with_movable_references<_View>
56class enumerate_view : public view_interface<enumerate_view<_View>> {
57 _View __base_ = _View();
58
59 // [range.enumerate.iterator]
60 template <bool _Const>
61 class __iterator;
62
63 // [range.enumerate.sentinel]
64 template <bool _Const>
65 class __sentinel;
66
67public:
68 _LIBCPP_HIDE_FROM_ABI constexpr enumerate_view()
69 requires default_initializable<_View>
70 = default;
71 _LIBCPP_HIDE_FROM_ABI constexpr explicit enumerate_view(_View __base) : __base_(std::move(__base)) {}
72
73 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
74 requires(!__simple_view<_View>)
75 {
76 return __iterator<false>(ranges::begin(__base_), 0);
77 }
78 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
79 requires __range_with_movable_references<const _View>
80 {
81 return __iterator<true>(ranges::begin(__base_), 0);
82 }
83
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
85 requires(!__simple_view<_View>)
86 {
87 if constexpr (forward_range<_View> && common_range<_View> && sized_range<_View>)
88 return __iterator<false>(ranges::end(__base_), ranges::distance(__base_));
89 else
90 return __sentinel<false>(ranges::end(__base_));
91 }
92 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
93 requires __range_with_movable_references<const _View>
94 {
95 if constexpr (forward_range<_View> && common_range<const _View> && sized_range<const _View>)
96 return __iterator<true>(ranges::end(__base_), ranges::distance(__base_));
97 else
98 return __sentinel<true>(ranges::end(__base_));
99 }
100
101 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
102 requires sized_range<_View>
103 {
104 return ranges::size(__base_);
105 }
106 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
107 requires sized_range<const _View>
108 {
109 return ranges::size(__base_);
110 }
111
112 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
113 requires copy_constructible<_View>
114 {
115 return __base_;
116 }
117 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
118};
119
120template <class _Range>
121enumerate_view(_Range&&) -> enumerate_view<views::all_t<_Range>>;
122
123// [range.enumerate.iterator]
124
125template <view _View>
126 requires __range_with_movable_references<_View>
127template <bool _Const>
128class enumerate_view<_View>::__iterator {
129 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
130
131 static consteval auto __get_iterator_concept() {
132 if constexpr (random_access_range<_Base>) {
133 return random_access_iterator_tag{};
134 } else if constexpr (bidirectional_range<_Base>) {
135 return bidirectional_iterator_tag{};
136 } else if constexpr (forward_range<_Base>) {
137 return forward_iterator_tag{};
138 } else {
139 return input_iterator_tag{};
140 }
141 }
142
143 friend class enumerate_view<_View>;
144
145public:
146 using iterator_category = input_iterator_tag;
147 using iterator_concept = decltype(__get_iterator_concept());
148 using difference_type = range_difference_t<_Base>;
149 using value_type = tuple<difference_type, range_value_t<_Base>>;
150
151private:
152 using __reference_type _LIBCPP_NODEBUG = tuple<difference_type, range_reference_t<_Base>>;
153
154 iterator_t<_Base> __current_ = iterator_t<_Base>();
155 difference_type __pos_ = 0;
156
157 _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> __current, difference_type __pos)
158 : __current_(std::move(__current)), __pos_(__pos) {}
159
160public:
161 _LIBCPP_HIDE_FROM_ABI __iterator()
162 requires default_initializable<iterator_t<_Base>>
163 = default;
164
165 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
166 requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
167 : __current_(std::move(__i.__current_)), __pos_(__i.__pos_) {}
168
169 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
170
171 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
172
173 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr difference_type index() const noexcept { return __pos_; }
174
175 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const { return __reference_type(__pos_, *__current_); }
176
177 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
178 ++__current_;
179 ++__pos_;
180 return *this;
181 }
182
183 _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { return ++*this; }
184
185 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
186 requires forward_range<_Base>
187 {
188 auto __temp = *this;
189 ++*this;
190 return __temp;
191 }
192
193 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
194 requires bidirectional_range<_Base>
195 {
196 --__current_;
197 --__pos_;
198 return *this;
199 }
200
201 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
202 requires bidirectional_range<_Base>
203 {
204 auto __temp = *this;
205 --*this;
206 return *__temp;
207 }
208
209 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
210 requires random_access_range<_Base>
211 {
212 __current_ += __n;
213 __pos_ += __n;
214 return *this;
215 }
216
217 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
218 requires random_access_range<_Base>
219 {
220 __current_ -= __n;
221 __pos_ -= __n;
222 return *this;
223 }
224
225 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
226 requires random_access_range<_Base>
227 {
228 return __reference_type(__pos_ + __n, __current_[__n]);
229 }
230
231 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) noexcept {
232 return __x.__pos_ == __y.__pos_;
233 }
234
235 _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering
236 operator<=>(const __iterator& __x, const __iterator& __y) noexcept {
237 return __x.__pos_ <=> __y.__pos_;
238 }
239
240 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
241 requires random_access_range<_Base>
242 {
243 auto __temp = __i;
244 __temp += __n;
245 return __temp;
246 }
247
248 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
249 requires random_access_range<_Base>
250 {
251 return __i + __n;
252 }
253
254 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
255 requires random_access_range<_Base>
256 {
257 auto __temp = __i;
258 __temp -= __n;
259 return __temp;
260 }
261
262 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
263 operator-(const __iterator& __x, const __iterator& __y) noexcept {
264 return __x.__pos_ - __y.__pos_;
265 }
266
267 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
268 noexcept(ranges::iter_move(__i.__current_)) && is_nothrow_move_constructible_v<range_rvalue_reference_t<_Base>>) {
269 return tuple<difference_type, range_rvalue_reference_t<_Base>>(__i.__pos_, ranges::iter_move(__i.__current_));
270 }
271};
272
273// [range.enumerate.sentinel]
274
275template <view _View>
276 requires __range_with_movable_references<_View>
277template <bool _Const>
278class enumerate_view<_View>::__sentinel {
279 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
280
281 sentinel_t<_Base> __end_ = sentinel_t<_Base>();
282
283 _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {}
284
285 friend class enumerate_view<_View>;
286
287public:
288 _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
289
290 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __other)
291 requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
292 : __end_(std::move(__other.__end_)) {}
293
294 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
295
296 template <bool _OtherConst>
297 requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
298 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
299 return __x.__current_ == __y.__end_;
300 }
301
302 template <bool _OtherConst>
303 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
304 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
305 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
306 return __x.__current_ - __y.__end_;
307 }
308
309 template <bool _OtherConst>
310 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
311 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
312 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
313 return __x.__end_ - __y.__current_;
314 }
315};
316
317template <class _View>
318constexpr bool enable_borrowed_range<enumerate_view<_View>> = enable_borrowed_range<_View>;
319
320namespace views {
321namespace __enumerate {
322
323// [range.enumerate.overview]
324
325struct __fn : __range_adaptor_closure<__fn> {
326 template <class _Range>
327 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
328 operator()(_Range&& __range) noexcept(noexcept(enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range))))
329 -> decltype(/*--------------------------*/ enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range))) {
330 return /*---------------------------------*/ enumerate_view<views::all_t<_Range>>(std::forward<_Range>(__range));
331 }
332};
333
334} // namespace __enumerate
335
336inline namespace __cpo {
337
338inline constexpr auto enumerate = __enumerate::__fn{};
339
340} // namespace __cpo
341} // namespace views
342} // namespace ranges
343
344#endif // _LIBCPP_STD_VER >= 23
345
346_LIBCPP_END_NAMESPACE_STD
347
348_LIBCPP_POP_MACROS
349
350#endif // _LIBCPP___RANGES_ENUMERATE_VIEW_H
lib/libcxx/include/__ranges/filter_view.h+2-2
......@@ -54,7 +54,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5454namespace ranges {
5555template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
5656 requires view<_View> && is_object_v<_Pred>
57class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<filter_view<_View, _Pred>> {
57class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG filter_view : public view_interface<filter_view<_View, _Pred>> {
5858 _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
5959 _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
6060
......@@ -72,7 +72,7 @@ public:
7272 requires default_initializable<_View> && default_initializable<_Pred>
7373 = default;
7474
75 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
75 _LIBCPP_HIDE_FROM_ABI constexpr explicit filter_view(_View __base, _Pred __pred)
7676 : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
7777
7878 template <class _Vp = _View>
lib/libcxx/include/__ranges/from_range.h+4-4
......@@ -16,18 +16,18 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 23
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323struct from_range_t {
2424 explicit from_range_t() = default;
2525};
2626
2727inline constexpr from_range_t from_range{};
2828
29#endif // _LIBCPP_STD_VER >= 23
30
3129_LIBCPP_END_NAMESPACE_STD
3230
31#endif // _LIBCPP_STD_VER >= 23
32
3333#endif // _LIBCPP___RANGES_FROM_RANGE_H
lib/libcxx/include/__ranges/iota_view.h+6-6
......@@ -316,8 +316,8 @@ public:
316316
317317 _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {}
318318
319 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
320 iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
319 _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(type_identity_t<_Start> __value,
320 type_identity_t<_BoundSentinel> __bound_sentinel)
321321 : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
322322 // Validate the precondition if possible.
323323 if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
......@@ -326,15 +326,15 @@ public:
326326 }
327327 }
328328
329 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
329 _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __iterator __last)
330330 requires same_as<_Start, _BoundSentinel>
331331 : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
332332
333 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
333 _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, _BoundSentinel __last)
334334 requires same_as<_BoundSentinel, unreachable_sentinel_t>
335335 : iota_view(std::move(__first.__value_), std::move(__last)) {}
336336
337 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
337 _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __sentinel __last)
338338 requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
339339 : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
340340
......@@ -357,7 +357,7 @@ public:
357357
358358 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
359359 requires(same_as<_Start, _BoundSentinel> && __advanceable<_Start>) ||
360 (integral<_Start> && integral<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
360 (__integer_like<_Start> && __integer_like<_BoundSentinel>) || sized_sentinel_for<_BoundSentinel, _Start>
361361 {
362362 if constexpr (__integer_like<_Start> && __integer_like<_BoundSentinel>) {
363363 return (__value_ < 0)
lib/libcxx/include/__ranges/istream_view.h+4-4
......@@ -46,12 +46,12 @@ public:
4646 _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream)
4747 : __stream_(std::addressof(__stream)) {}
4848
49 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
49 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
5050 *__stream_ >> __value_;
5151 return __iterator{*this};
5252 }
5353
54 _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
54 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
5555
5656private:
5757 basic_istream<_CharT, _Traits>* __stream_;
......@@ -82,7 +82,7 @@ public:
8282
8383 _LIBCPP_HIDE_FROM_ABI void operator++(int) { ++*this; }
8484
85 _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; }
85 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; }
8686
8787 _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) {
8888 return !*__x.__get_parent_stream();
......@@ -113,7 +113,7 @@ struct __fn {
113113 template <class _Up, class _UnCVRef = remove_cvref_t<_Up>>
114114 requires derived_from<_UnCVRef, basic_istream<typename _UnCVRef::char_type,
115115 typename _UnCVRef::traits_type>>
116 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const
116 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Up&& __u) const
117117 noexcept(noexcept(basic_istream_view<_Tp, typename _UnCVRef::char_type,
118118 typename _UnCVRef::traits_type>(std::forward<_Up>(__u))))
119119 -> decltype( basic_istream_view<_Tp, typename _UnCVRef::char_type,
lib/libcxx/include/__ranges/join_view.h+8-8
......@@ -100,15 +100,15 @@ public:
100100
101101 _LIBCPP_HIDE_FROM_ABI constexpr explicit join_view(_View __base) : __base_(std::move(__base)) {}
102102
103 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
104104 requires copy_constructible<_View>
105105 {
106106 return __base_;
107107 }
108108
109 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
109 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
110110
111 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
111 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
112112 if constexpr (forward_range<_View>) {
113113 constexpr bool __use_const = __simple_view<_View> && is_reference_v<range_reference_t<_View>>;
114114 return __iterator<__use_const>{*this, ranges::begin(__base_)};
......@@ -119,14 +119,14 @@ public:
119119 }
120120
121121 template <class _V2 = _View>
122 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
122 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
123123 requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
124124 input_range<range_reference_t<const _V2>>
125125 {
126126 return __iterator<true>{*this, ranges::begin(__base_)};
127127 }
128128
129 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
129 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
130130 if constexpr (forward_range<_View> && is_reference_v<_InnerRange> && forward_range<_InnerRange> &&
131131 common_range<_View> && common_range<_InnerRange>)
132132 return __iterator<__simple_view<_View>>{*this, ranges::end(__base_)};
......@@ -135,7 +135,7 @@ public:
135135 }
136136
137137 template <class _V2 = _View>
138 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
138 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
139139 requires forward_range<const _V2> && is_reference_v<range_reference_t<const _V2>> &&
140140 input_range<range_reference_t<const _V2>>
141141 {
......@@ -276,7 +276,7 @@ public:
276276 requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner>
277277 : __outer_(std::move(__i.__outer_)), __inner_(std::move(__i.__inner_)), __parent_(__i.__parent_) {}
278278
279 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; }
279 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return **__inner_; }
280280
281281 _LIBCPP_HIDE_FROM_ABI constexpr _Inner operator->() const
282282 requires __has_arrow<_Inner> && copyable<_Inner>
......@@ -339,7 +339,7 @@ public:
339339 return __x.__outer_ == __y.__outer_ && __x.__inner_ == __y.__inner_;
340340 }
341341
342 _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
342 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
343343 iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) {
344344 return ranges::iter_move(*__i.__inner_);
345345 }
lib/libcxx/include/__ranges/join_with_view.h+2-3
......@@ -372,7 +372,7 @@ public:
372372 return __tmp;
373373 }
374374
375 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
375 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
376376 requires __ref_is_glvalue && forward_range<_Base> && equality_comparable<_InnerIter>
377377 {
378378 return __x.__outer_it_ == __y.__outer_it_ && __x.__inner_it_ == __y.__inner_it_;
......@@ -420,8 +420,7 @@ public:
420420
421421 template <bool _OtherConst>
422422 requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
423 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr bool
424 operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
423 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
425424 return __get_outer_of(__x) == __y.__end_;
426425 }
427426};
lib/libcxx/include/__ranges/lazy_split_view.h+19-15
......@@ -86,23 +86,23 @@ public:
8686 requires default_initializable<_View> && default_initializable<_Pattern>
8787 = default;
8888
89 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
89 _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_View __base, _Pattern __pattern)
9090 : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
9191
9292 template <input_range _Range>
9393 requires constructible_from<_View, views::all_t<_Range>> &&
9494 constructible_from<_Pattern, single_view<range_value_t<_Range>>>
95 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
95 _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
9696 : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {}
9797
98 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
98 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
9999 requires copy_constructible<_View>
100100 {
101101 return __base_;
102102 }
103 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
104104
105 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
105 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
106106 if constexpr (forward_range<_View>) {
107107 return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::begin(__base_)};
108108 } else {
......@@ -111,19 +111,19 @@ public:
111111 }
112112 }
113113
114 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
115115 requires forward_range<_View> && forward_range<const _View>
116116 {
117117 return __outer_iterator<true>{*this, ranges::begin(__base_)};
118118 }
119119
120 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
120 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
121121 requires forward_range<_View> && common_range<_View>
122122 {
123123 return __outer_iterator < __simple_view<_View> && __simple_view < _Pattern >> {*this, ranges::end(__base_)};
124124 }
125125
126 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
126 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const {
127127 if constexpr (forward_range<_View> && forward_range<const _View> && common_range<const _View>) {
128128 return __outer_iterator<true>{*this, ranges::end(__base_)};
129129 } else {
......@@ -188,8 +188,10 @@ private:
188188 _LIBCPP_HIDE_FROM_ABI value_type() = default;
189189 _LIBCPP_HIDE_FROM_ABI constexpr explicit value_type(__outer_iterator __i) : __i_(std::move(__i)) {}
190190
191 _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const { return __inner_iterator<_Const>{__i_}; }
192 _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
191 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator<_Const> begin() const {
192 return __inner_iterator<_Const>{__i_};
193 }
194 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr default_sentinel_t end() const noexcept { return default_sentinel; }
193195 };
194196
195197 _LIBCPP_HIDE_FROM_ABI __outer_iterator() = default;
......@@ -206,7 +208,7 @@ private:
206208 requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
207209 : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
208210
209 _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; }
211 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return value_type{*this}; }
210212
211213 _LIBCPP_HIDE_FROM_ABI constexpr __outer_iterator& operator++() {
212214 const auto __end = ranges::end(__parent_->__base_);
......@@ -342,14 +344,16 @@ private:
342344
343345 _LIBCPP_HIDE_FROM_ABI constexpr explicit __inner_iterator(__outer_iterator<_Const> __i) : __i_(std::move(__i)) {}
344346
345 _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __i_.__current(); }
346 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() &&
347 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept {
348 return __i_.__current();
349 }
350 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() &&
347351 requires forward_range<_View>
348352 {
349353 return std::move(__i_.__current());
350354 }
351355
352 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); }
356 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return *__i_.__current(); }
353357
354358 _LIBCPP_HIDE_FROM_ABI constexpr __inner_iterator& operator++() {
355359 __incremented_ = true;
......@@ -385,7 +389,7 @@ private:
385389 return __x.__is_done();
386390 }
387391
388 _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
392 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr decltype(auto)
389393 iter_move(const __inner_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__outer_current()))) {
390394 return ranges::iter_move(__i.__outer_current());
391395 }
lib/libcxx/include/__ranges/owning_view.h+4-4
......@@ -30,10 +30,10 @@
3030_LIBCPP_PUSH_MACROS
3131#include <__undef_macros>
3232
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3533#if _LIBCPP_STD_VER >= 20
3634
35_LIBCPP_BEGIN_NAMESPACE_STD
36
3737namespace ranges {
3838template <range _Rp>
3939 requires movable<_Rp> && (!__is_std_initializer_list<remove_cvref_t<_Rp>>)
......@@ -107,10 +107,10 @@ inline constexpr bool enable_borrowed_range<owning_view<_Tp>> = enable_borrowed_
107107
108108} // namespace ranges
109109
110#endif // _LIBCPP_STD_VER >= 20
111
112110_LIBCPP_END_NAMESPACE_STD
113111
112#endif // _LIBCPP_STD_VER >= 20
113
114114_LIBCPP_POP_MACROS
115115
116116#endif // _LIBCPP___RANGES_OWNING_VIEW_H
lib/libcxx/include/__ranges/range_adaptor.h+4-4
......@@ -34,10 +34,10 @@
3434_LIBCPP_PUSH_MACROS
3535#include <__undef_macros>
3636
37_LIBCPP_BEGIN_NAMESPACE_STD
38
3937#if _LIBCPP_STD_VER >= 20
4038
39_LIBCPP_BEGIN_NAMESPACE_STD
40
4141namespace ranges {
4242
4343// CRTP base that one can derive from in order to be considered a range adaptor closure
......@@ -90,10 +90,10 @@ class _LIBCPP_NO_SPECIALIZATIONS range_adaptor_closure : public __range_adaptor_
9090
9191} // namespace ranges
9292
93#endif // _LIBCPP_STD_VER >= 20
94
9593_LIBCPP_END_NAMESPACE_STD
9694
95#endif // _LIBCPP_STD_VER >= 20
96
9797_LIBCPP_POP_MACROS
9898
9999#endif // _LIBCPP___RANGES_RANGE_ADAPTOR_H
lib/libcxx/include/__ranges/ref_view.h+4-4
......@@ -32,10 +32,10 @@
3232# pragma GCC system_header
3333#endif
3434
35_LIBCPP_BEGIN_NAMESPACE_STD
36
3735#if _LIBCPP_STD_VER >= 20
3836
37_LIBCPP_BEGIN_NAMESPACE_STD
38
3939namespace ranges {
4040template <range _Range>
4141 requires is_object_v<_Range>
......@@ -82,8 +82,8 @@ template <class _Tp>
8282inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
8383} // namespace ranges
8484
85#endif // _LIBCPP_STD_VER >= 20
86
8785_LIBCPP_END_NAMESPACE_STD
8886
87#endif // _LIBCPP_STD_VER >= 20
88
8989#endif // _LIBCPP___RANGES_REF_VIEW_H
lib/libcxx/include/__ranges/repeat_view.h+5-5
......@@ -40,10 +40,10 @@
4040_LIBCPP_PUSH_MACROS
4141#include <__undef_macros>
4242
43_LIBCPP_BEGIN_NAMESPACE_STD
44
4543#if _LIBCPP_STD_VER >= 23
4644
45_LIBCPP_BEGIN_NAMESPACE_STD
46
4747namespace ranges {
4848
4949template <class _Tp>
......@@ -74,7 +74,7 @@ struct __fn;
7474template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t>
7575 requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> &&
7676 (__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>))
77class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface<repeat_view<_Tp, _Bound>> {
77class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG repeat_view : public view_interface<repeat_view<_Tp, _Bound>> {
7878 friend struct views::__take::__fn;
7979 friend struct views::__drop::__fn;
8080 class __iterator;
......@@ -265,10 +265,10 @@ inline constexpr bool __is_repeat_specialization<repeat_view<_Tp, _Bound>> = tru
265265
266266} // namespace ranges
267267
268#endif // _LIBCPP_STD_VER >= 23
269
270268_LIBCPP_END_NAMESPACE_STD
271269
270#endif // _LIBCPP_STD_VER >= 23
271
272272_LIBCPP_POP_MACROS
273273
274274#endif // _LIBCPP___RANGES_REPEAT_VIEW_H
lib/libcxx/include/__ranges/reverse_view.h+8-8
......@@ -59,13 +59,13 @@ public:
5959
6060 _LIBCPP_HIDE_FROM_ABI constexpr explicit reverse_view(_View __view) : __base_(std::move(__view)) {}
6161
62 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
62 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
6363 requires copy_constructible<_View>
6464 {
6565 return __base_;
6666 }
6767
68 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
68 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
6969
7070 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin() {
7171 if constexpr (_UseCache)
......@@ -78,35 +78,35 @@ public:
7878 return __tmp;
7979 }
8080
81 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin()
81 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> begin()
8282 requires common_range<_View>
8383 {
8484 return std::make_reverse_iterator(ranges::end(__base_));
8585 }
8686
87 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
87 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
8888 requires common_range<const _View>
8989 {
9090 return std::make_reverse_iterator(ranges::end(__base_));
9191 }
9292
93 _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() {
93 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr reverse_iterator<iterator_t<_View>> end() {
9494 return std::make_reverse_iterator(ranges::begin(__base_));
9595 }
9696
97 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
9898 requires common_range<const _View>
9999 {
100100 return std::make_reverse_iterator(ranges::begin(__base_));
101101 }
102102
103 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
104104 requires sized_range<_View>
105105 {
106106 return ranges::size(__base_);
107107 }
108108
109 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
109 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
110110 requires sized_range<const _View>
111111 {
112112 return ranges::size(__base_);
lib/libcxx/include/__ranges/single_view.h+1-1
......@@ -41,7 +41,7 @@ template <move_constructible _Tp>
4141template <copy_constructible _Tp>
4242# endif
4343 requires is_object_v<_Tp>
44class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface<single_view<_Tp>> {
44class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG single_view : public view_interface<single_view<_Tp>> {
4545 _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_;
4646
4747public:
lib/libcxx/include/__ranges/size.h+4-4
......@@ -29,10 +29,10 @@
2929# pragma GCC system_header
3030#endif
3131
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3432#if _LIBCPP_STD_VER >= 20
3533
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3636namespace ranges {
3737template <class>
3838inline constexpr bool disable_sized_range = false;
......@@ -131,8 +131,8 @@ inline constexpr auto ssize = __ssize::__fn{};
131131} // namespace __cpo
132132} // namespace ranges
133133
134#endif // _LIBCPP_STD_VER >= 20
135
136134_LIBCPP_END_NAMESPACE_STD
137135
136#endif // _LIBCPP_STD_VER >= 20
137
138138#endif // _LIBCPP___RANGES_SIZE_H
lib/libcxx/include/__ranges/split_view.h+8-9
......@@ -78,32 +78,31 @@ public:
7878 requires default_initializable<_View> && default_initializable<_Pattern>
7979 = default;
8080
81 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern)
81 _LIBCPP_HIDE_FROM_ABI constexpr explicit split_view(_View __base, _Pattern __pattern)
8282 : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {}
8383
8484 template <forward_range _Range>
8585 requires constructible_from<_View, views::all_t<_Range>> &&
8686 constructible_from<_Pattern, single_view<range_value_t<_Range>>>
87 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
88 split_view(_Range&& __range, range_value_t<_Range> __elem)
87 _LIBCPP_HIDE_FROM_ABI constexpr explicit split_view(_Range&& __range, range_value_t<_Range> __elem)
8988 : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {}
9089
91 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
9291 requires copy_constructible<_View>
9392 {
9493 return __base_;
9594 }
9695
97 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
96 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
9897
99 _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
98 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() {
10099 if (!__cached_begin_.__has_value()) {
101100 __cached_begin_.__emplace(__find_next(ranges::begin(__base_)));
102101 }
103102 return {*this, ranges::begin(__base_), *__cached_begin_};
104103 }
105104
106 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
105 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
107106 if constexpr (common_range<_View>) {
108107 return __iterator{*this, ranges::end(__base_), {}};
109108 } else {
......@@ -142,9 +141,9 @@ public:
142141 split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next)
143142 : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {}
144143
145 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; }
144 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_View> base() const { return __cur_; }
146145
147 _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; }
146 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; }
148147
149148 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
150149 __cur_ = __next_.begin();
lib/libcxx/include/__ranges/stride_view.h created+410
......@@ -0,0 +1,410 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___RANGES_STRIDE_VIEW_H
11#define _LIBCPP___RANGES_STRIDE_VIEW_H
12
13#include <__assert>
14#include <__compare/three_way_comparable.h>
15#include <__concepts/constructible.h>
16#include <__concepts/convertible_to.h>
17#include <__concepts/derived_from.h>
18#include <__concepts/equality_comparable.h>
19#include <__config>
20#include <__functional/bind_back.h>
21#include <__iterator/advance.h>
22#include <__iterator/concepts.h>
23#include <__iterator/default_sentinel.h>
24#include <__iterator/distance.h>
25#include <__iterator/iter_move.h>
26#include <__iterator/iter_swap.h>
27#include <__iterator/iterator_traits.h>
28#include <__ranges/access.h>
29#include <__ranges/all.h>
30#include <__ranges/concepts.h>
31#include <__ranges/enable_borrowed_range.h>
32#include <__ranges/range_adaptor.h>
33#include <__ranges/view_interface.h>
34#include <__type_traits/make_unsigned.h>
35
36#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
37# pragma GCC system_header
38#endif
39
40_LIBCPP_PUSH_MACROS
41#include <__undef_macros>
42
43_LIBCPP_BEGIN_NAMESPACE_STD
44
45#if _LIBCPP_STD_VER >= 23
46
47namespace ranges {
48
49template <class _Value>
50_LIBCPP_HIDE_FROM_ABI constexpr _Value __div_ceil(_Value __left, _Value __right) {
51 _Value __r = __left / __right;
52 if (__left % __right) {
53 ++__r;
54 }
55 return __r;
56}
57
58template <input_range _View>
59 requires view<_View>
60class stride_view : public view_interface<stride_view<_View>> {
61 _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
62 range_difference_t<_View> __stride_ = 0;
63
64 template <bool _Const>
65 class __iterator;
66
67public:
68 _LIBCPP_HIDE_FROM_ABI constexpr explicit stride_view(_View __base, range_difference_t<_View> __stride)
69 : __base_(std::move(__base)), __stride_(__stride) {
70 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__stride > 0, "The value of stride must be greater than 0");
71 }
72
73 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
74 requires copy_constructible<_View>
75 {
76 return __base_;
77 }
78
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
80
81 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_View> stride() const noexcept { return __stride_; }
82
83 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
84 requires(!__simple_view<_View>)
85 {
86 return __iterator</*_Const=*/false>(this, ranges::begin(__base_), 0);
87 }
88
89 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
90 requires range<const _View>
91 {
92 return __iterator</*_Const=*/true>(this, ranges::begin(__base_), 0);
93 }
94
95 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
96 requires(!__simple_view<_View>)
97 {
98 if constexpr (common_range<_View> && sized_range<_View> && forward_range<_View>) {
99 auto __missing = (__stride_ - ranges::distance(__base_) % __stride_) % __stride_;
100 return __iterator</*_Const=*/false>(this, ranges::end(__base_), __missing);
101 } else if constexpr (common_range<_View> && !bidirectional_range<_View>) {
102 return __iterator</*_Const=*/false>(this, ranges::end(__base_), 0);
103 } else {
104 return default_sentinel;
105 }
106 }
107
108 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
109 requires(range<const _View>)
110 {
111 if constexpr (common_range<const _View> && sized_range<const _View> && forward_range<const _View>) {
112 auto __missing = (__stride_ - ranges::distance(__base_) % __stride_) % __stride_;
113 return __iterator</*_Const=*/true>(this, ranges::end(__base_), __missing);
114 } else if constexpr (common_range<const _View> && !bidirectional_range<const _View>) {
115 return __iterator</*_Const=*/true>(this, ranges::end(__base_), 0);
116 } else {
117 return default_sentinel;
118 }
119 }
120
121 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
122 requires sized_range<_View>
123 {
124 return std::__to_unsigned_like(ranges::__div_ceil(ranges::distance(__base_), __stride_));
125 }
126
127 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
128 requires sized_range<const _View>
129 {
130 return std::__to_unsigned_like(ranges::__div_ceil(ranges::distance(__base_), __stride_));
131 }
132}; // class stride_view
133
134template <class _Range>
135stride_view(_Range&&, range_difference_t<_Range>) -> stride_view<views::all_t<_Range>>;
136
137template <class _View>
138struct __stride_iterator_category {};
139
140template <forward_range _View>
141struct __stride_iterator_category<_View> {
142 using _Cat _LIBCPP_NODEBUG = typename iterator_traits<iterator_t<_View>>::iterator_category;
143 using iterator_category =
144 _If<derived_from<_Cat, random_access_iterator_tag>,
145 /* then */ random_access_iterator_tag,
146 /* else */ _Cat >;
147};
148
149template <input_range _View>
150 requires view<_View>
151template <bool _Const>
152class stride_view<_View>::__iterator : public __stride_iterator_category<__maybe_const<_Const, _View>> {
153 using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, stride_view<_View>>;
154 using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _View>;
155
156 _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_Base> __current_ = iterator_t<_Base>();
157 _LIBCPP_NO_UNIQUE_ADDRESS ranges::sentinel_t<_Base> __end_ = ranges::sentinel_t<_Base>();
158 range_difference_t<_Base> __stride_ = 0;
159 range_difference_t<_Base> __missing_ = 0;
160
161 friend stride_view;
162
163 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(
164 _Parent* __parent, ranges::iterator_t<_Base> __current, range_difference_t<_Base> __missing)
165 : __current_(std::move(__current)),
166 __end_(ranges::end(__parent->__base_)),
167 __stride_(__parent->__stride_),
168 __missing_(__missing) {}
169
170 static consteval auto __get_stride_view_iterator_concept() {
171 if constexpr (random_access_range<_Base>) {
172 return random_access_iterator_tag{};
173 } else if constexpr (bidirectional_range<_Base>) {
174 return bidirectional_iterator_tag{};
175 } else if constexpr (forward_range<_Base>) {
176 return forward_iterator_tag{};
177 } else {
178 return input_iterator_tag{};
179 }
180 }
181
182public:
183 using difference_type = range_difference_t<_Base>;
184 using value_type = range_value_t<_Base>;
185 using iterator_concept = decltype(__get_stride_view_iterator_concept());
186 // using iterator_category = inherited;
187
188 _LIBCPP_HIDE_FROM_ABI __iterator()
189 requires default_initializable<iterator_t<_Base>>
190 = default;
191
192 _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
193 requires _Const && convertible_to<ranges::iterator_t<_View>, iterator_t<_Base>> &&
194 convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
195 : __current_(std::move(__i.__current_)),
196 __end_(std::move(__i.__end_)),
197 __stride_(__i.__stride_),
198 __missing_(__i.__missing_) {}
199
200 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> const& base() const& noexcept { return __current_; }
201 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
202
203 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const {
204 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot dereference an iterator at the end.");
205 return *__current_;
206 }
207
208 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
209 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end.");
210 __missing_ = ranges::advance(__current_, __stride_, __end_);
211 return *this;
212 }
213
214 _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) {
215 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end.");
216 ++*this;
217 }
218 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
219 requires forward_range<_Base>
220 {
221 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__current_ != __end_, "Cannot increment an iterator already at the end.");
222 auto __tmp = *this;
223 ++*this;
224 return __tmp;
225 }
226
227 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
228 requires bidirectional_range<_Base>
229 {
230 ranges::advance(__current_, __missing_ - __stride_);
231 __missing_ = 0;
232 return *this;
233 }
234 _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
235 requires bidirectional_range<_Base>
236 {
237 auto __tmp = *this;
238 --*this;
239 return __tmp;
240 }
241
242 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n)
243 requires random_access_range<_Base>
244 {
245 if (__n > 0) {
246 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(ranges::distance(__current_, __end_) > __stride_ * (__n - 1),
247 "Advancing the iterator beyond the end is not allowed.");
248 ranges::advance(__current_, __stride_ * (__n - 1));
249 __missing_ = ranges::advance(__current_, __stride_, __end_);
250
251 } else if (__n < 0) {
252 ranges::advance(__current_, __stride_ * __n + __missing_);
253 __missing_ = 0;
254 }
255 return *this;
256 }
257
258 _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n)
259 requires random_access_range<_Base>
260 {
261 return *this += -__n;
262 }
263
264 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
265 requires random_access_range<_Base>
266 {
267 return *(*this + __n);
268 }
269
270 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, default_sentinel_t) {
271 return __x.__current_ == __x.__end_;
272 }
273
274 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(__iterator const& __x, __iterator const& __y)
275 requires equality_comparable<iterator_t<_Base>>
276 {
277 return __x.__current_ == __y.__current_;
278 }
279
280 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(__iterator const& __x, __iterator const& __y)
281 requires random_access_range<_Base>
282 {
283 return __x.__current_ < __y.__current_;
284 }
285
286 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(__iterator const& __x, __iterator const& __y)
287 requires random_access_range<_Base>
288 {
289 return __y < __x;
290 }
291
292 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(__iterator const& __x, __iterator const& __y)
293 requires random_access_range<_Base>
294 {
295 return !(__y < __x);
296 }
297
298 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(__iterator const& __x, __iterator const& __y)
299 requires random_access_range<_Base>
300 {
301 return !(__x < __y);
302 }
303
304 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(__iterator const& __x, __iterator const& __y)
305 requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>>
306 {
307 return __x.__current_ <=> __y.__current_;
308 }
309
310 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator const& __i, difference_type __s)
311 requires random_access_range<_Base>
312 {
313 auto __r = __i;
314 __r += __s;
315 return __r;
316 }
317 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __s, __iterator const& __i)
318 requires random_access_range<_Base>
319 {
320 auto __r = __i;
321 __r += __s;
322 return __r;
323 }
324
325 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator const& __i, difference_type __s)
326 requires random_access_range<_Base>
327 {
328 auto __r = __i;
329 __r -= __s;
330 return __r;
331 }
332
333 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
334 operator-(__iterator const& __x, __iterator const& __y)
335 requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
336 {
337 if constexpr (forward_range<_Base>) {
338 auto __n = __x.__current_ - __y.__current_;
339 return (__n + __x.__missing_ - __y.__missing_) / __x.__stride_;
340 }
341 auto __n = __x.__current_ - __y.__current_;
342 if (__n < 0) {
343 return -ranges::__div_ceil(-__n, __x.__stride_);
344 }
345 return ranges::__div_ceil(__n, __x.__stride_);
346 }
347
348 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
349 operator-(default_sentinel_t, __iterator const& __x)
350 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>>
351 {
352 return ranges::__div_ceil(__x.__end_ - __x.__current_, __x.__stride_);
353 }
354 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
355 operator-(__iterator const& __x, default_sentinel_t __y)
356 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>>
357 {
358 return -(__y - __x);
359 }
360
361 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_rvalue_reference_t<_Base>
362 iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) {
363 return ranges::iter_move(__it.__current_);
364 }
365
366 _LIBCPP_HIDE_FROM_ABI friend constexpr void
367 iter_swap(__iterator const& __x,
368 __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_)))
369 requires indirectly_swappable<iterator_t<_Base>>
370 {
371 return ranges::iter_swap(__x.__current_, __y.__current_);
372 }
373}; // class stride_view::__iterator
374
375template <class _Tp>
376inline constexpr bool enable_borrowed_range<stride_view<_Tp>> = enable_borrowed_range<_Tp>;
377
378namespace views {
379namespace __stride_view {
380struct __fn {
381 // clang-format off
382 template <viewable_range _Range>
383 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
384 constexpr auto operator()(_Range&& __range, range_difference_t<_Range> __n) const
385 noexcept(noexcept(stride_view{std::forward<_Range>(__range), __n}))
386 -> decltype( stride_view{std::forward<_Range>(__range), __n})
387 { return stride_view(std::forward<_Range>(__range), __n); }
388 // clang-format on
389
390 template <class _Np>
391 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Np&& __n) const {
392 return __pipeable(std::__bind_back(*this, std::forward<_Np>(__n)));
393 }
394};
395} // namespace __stride_view
396
397inline namespace __cpo {
398inline constexpr auto stride = __stride_view::__fn{};
399} // namespace __cpo
400} // namespace views
401
402} // namespace ranges
403
404#endif // _LIBCPP_STD_VER >= 23
405
406_LIBCPP_END_NAMESPACE_STD
407
408_LIBCPP_POP_MACROS
409
410#endif // _LIBCPP___RANGES_STRIDE_VIEW_H
lib/libcxx/include/__ranges/subrange.h+15-14
......@@ -49,10 +49,10 @@
4949_LIBCPP_PUSH_MACROS
5050#include <__undef_macros>
5151
52_LIBCPP_BEGIN_NAMESPACE_STD
53
5452#if _LIBCPP_STD_VER >= 20
5553
54_LIBCPP_BEGIN_NAMESPACE_STD
55
5656namespace ranges {
5757template <class _From, class _To>
5858concept __uses_nonqualification_pointer_conversion =
......@@ -131,7 +131,7 @@ public:
131131 return _Pair(__begin_, __end_);
132132 }
133133
134 _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const
134 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter begin() const
135135 requires copyable<_Iter>
136136 {
137137 return __begin_;
......@@ -143,11 +143,11 @@ public:
143143 return std::move(__begin_);
144144 }
145145
146 _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; }
146 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Sent end() const { return __end_; }
147147
148148 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool empty() const { return __begin_ == __end_; }
149149
150 _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
150 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr make_unsigned_t<iter_difference_t<_Iter>> size() const
151151 requires(_Kind == subrange_kind::sized)
152152 {
153153 if constexpr (_StoreSize)
......@@ -201,11 +201,12 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
201201subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>;
202202
203203template <borrowed_range _Range>
204subrange(_Range&&) -> subrange<iterator_t<_Range>,
205 sentinel_t<_Range>,
206 (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
207 ? subrange_kind::sized
208 : subrange_kind::unsized>;
204subrange(_Range&&)
205 -> subrange<iterator_t<_Range>,
206 sentinel_t<_Range>,
207 (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
208 ? subrange_kind::sized
209 : subrange_kind::unsized>;
209210
210211template <borrowed_range _Range>
211212subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
......@@ -213,7 +214,7 @@ subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
213214
214215template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
215216 requires((_Index == 0 && copyable<_Iter>) || _Index == 1)
216_LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
217[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __subrange) {
217218 if constexpr (_Index == 0)
218219 return __subrange.begin();
219220 else
......@@ -222,7 +223,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto get(const subrange<_Iter, _Sent, _Kind>& __
222223
223224template <size_t _Index, class _Iter, class _Sent, subrange_kind _Kind>
224225 requires(_Index < 2)
225_LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
226[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto get(subrange<_Iter, _Sent, _Kind>&& __subrange) {
226227 if constexpr (_Index == 0)
227228 return __subrange.begin();
228229 else
......@@ -265,10 +266,10 @@ struct tuple_element<1, const ranges::subrange<_Ip, _Sp, _Kp>> {
265266 using type _LIBCPP_NODEBUG = _Sp;
266267};
267268
268#endif // _LIBCPP_STD_VER >= 20
269
270269_LIBCPP_END_NAMESPACE_STD
271270
271#endif // _LIBCPP_STD_VER >= 20
272
272273_LIBCPP_POP_MACROS
273274
274275#endif // _LIBCPP___RANGES_SUBRANGE_H
lib/libcxx/include/__ranges/take_view.h+1-2
......@@ -69,8 +69,7 @@ public:
6969 requires default_initializable<_View>
7070 = default;
7171
72 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
73 take_view(_View __base, range_difference_t<_View> __count)
72 _LIBCPP_HIDE_FROM_ABI constexpr explicit take_view(_View __base, range_difference_t<_View> __count)
7473 : __base_(std::move(__base)), __count_(__count) {
7574 _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
7675 }
lib/libcxx/include/__ranges/take_while_view.h+10-10
......@@ -46,7 +46,7 @@ namespace ranges {
4646
4747template <view _View, class _Pred>
4848 requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
49class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interface<take_while_view<_View, _Pred>> {
49class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG take_while_view : public view_interface<take_while_view<_View, _Pred>> {
5050 template <bool>
5151 class __sentinel;
5252
......@@ -58,38 +58,38 @@ public:
5858 requires default_initializable<_View> && default_initializable<_Pred>
5959 = default;
6060
61 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred)
61 _LIBCPP_HIDE_FROM_ABI constexpr explicit take_while_view(_View __base, _Pred __pred)
6262 : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
6363
64 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
64 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
6565 requires copy_constructible<_View>
6666 {
6767 return __base_;
6868 }
6969
70 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
70 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
7171
72 _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
72 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; }
7373
74 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
7575 requires(!__simple_view<_View>)
7676 {
7777 return ranges::begin(__base_);
7878 }
7979
80 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
80 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
8181 requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>
8282 {
8383 return ranges::begin(__base_);
8484 }
8585
86 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
86 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
8787 requires(!__simple_view<_View>)
8888 {
8989 return __sentinel</*_Const=*/false>(ranges::end(__base_), std::addressof(*__pred_));
9090 }
9191
92 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
92 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
9393 requires range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>
9494 {
9595 return __sentinel</*_Const=*/true>(ranges::end(__base_), std::addressof(*__pred_));
......@@ -120,7 +120,7 @@ public:
120120 requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
121121 : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {}
122122
123 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
123 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
124124
125125 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) {
126126 return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x);
lib/libcxx/include/__ranges/transform_view.h+35-24
......@@ -16,6 +16,7 @@
1616#include <__concepts/derived_from.h>
1717#include <__concepts/equality_comparable.h>
1818#include <__concepts/invocable.h>
19#include <__concepts/referenceable.h>
1920#include <__config>
2021#include <__functional/bind_back.h>
2122#include <__functional/invoke.h>
......@@ -37,7 +38,6 @@
3738#include <__type_traits/is_nothrow_constructible.h>
3839#include <__type_traits/is_object.h>
3940#include <__type_traits/is_reference.h>
40#include <__type_traits/is_referenceable.h>
4141#include <__type_traits/maybe_const.h>
4242#include <__type_traits/remove_cvref.h>
4343#include <__utility/forward.h>
......@@ -71,7 +71,7 @@ template <input_range _View, move_constructible _Fn>
7171template <input_range _View, copy_constructible _Fn>
7272# endif
7373 requires __transform_view_constraints<_View, _Fn>
74class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interface<transform_view<_View, _Fn>> {
74class _LIBCPP_LLVM18_NO_UNIQUE_ADDRESS_ABI_TAG transform_view : public view_interface<transform_view<_View, _Fn>> {
7575 template <bool>
7676 class __iterator;
7777 template <bool>
......@@ -85,46 +85,56 @@ public:
8585 requires default_initializable<_View> && default_initializable<_Fn>
8686 = default;
8787
88 _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
88 _LIBCPP_HIDE_FROM_ABI constexpr explicit transform_view(_View __base, _Fn __func)
8989 : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
9090
91 _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
91 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
9292 requires copy_constructible<_View>
9393 {
9494 return __base_;
9595 }
96 _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
9796
98 _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() { return __iterator<false>{*this, ranges::begin(__base_)}; }
99 _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
97 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
98
99 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> begin() {
100 return __iterator<false>{*this, ranges::begin(__base_)};
101 }
102
103 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> begin() const
100104 requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
101105 {
102106 return __iterator<true>(*this, ranges::begin(__base_));
103107 }
104108
105 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() { return __sentinel<false>(ranges::end(__base_)); }
106 _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end()
109 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<false> end() {
110 return __sentinel<false>(ranges::end(__base_));
111 }
112
113 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<false> end()
107114 requires common_range<_View>
108115 {
109116 return __iterator<false>(*this, ranges::end(__base_));
110117 }
111 _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const
118
119 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __sentinel<true> end() const
112120 requires range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
113121 {
114122 return __sentinel<true>(ranges::end(__base_));
115123 }
116 _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const
124
125 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __iterator<true> end() const
117126 requires common_range<const _View> && __regular_invocable_with_range_ref<const _Fn&, const _View>
118127 {
119128 return __iterator<true>(*this, ranges::end(__base_));
120129 }
121130
122 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
131 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
123132 requires sized_range<_View>
124133 {
125134 return ranges::size(__base_);
126135 }
127 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
136
137 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
128138 requires sized_range<const _View>
129139 {
130140 return ranges::size(__base_);
......@@ -209,11 +219,11 @@ public:
209219 requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>>
210220 : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {}
211221
212 _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
222 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const iterator_t<_Base>& base() const& noexcept { return __current_; }
213223
214 _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
224 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator_t<_Base> base() && { return std::move(__current_); }
215225
216 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
226 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
217227 noexcept(noexcept(std::invoke(*__parent_->__func_, *__current_))) {
218228 return std::invoke(*__parent_->__func_, *__current_);
219229 }
......@@ -262,7 +272,7 @@ public:
262272 return *this;
263273 }
264274
265 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
275 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
266276 noexcept(noexcept(std::invoke(*__parent_->__func_, __current_[__n])))
267277 requires random_access_range<_Base>
268278 {
......@@ -305,25 +315,26 @@ public:
305315 return __x.__current_ <=> __y.__current_;
306316 }
307317
308 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
318 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(__iterator __i, difference_type __n)
309319 requires random_access_range<_Base>
310320 {
311321 return __iterator{*__i.__parent_, __i.__current_ + __n};
312322 }
313323
314 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
324 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, __iterator __i)
315325 requires random_access_range<_Base>
316326 {
317327 return __iterator{*__i.__parent_, __i.__current_ + __n};
318328 }
319329
320 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
330 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(__iterator __i, difference_type __n)
321331 requires random_access_range<_Base>
322332 {
323333 return __iterator{*__i.__parent_, __i.__current_ - __n};
324334 }
325335
326 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
336 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
337 operator-(const __iterator& __x, const __iterator& __y)
327338 requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>>
328339 {
329340 return __x.__current_ - __y.__current_;
......@@ -361,7 +372,7 @@ public:
361372 requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>>
362373 : __end_(std::move(__i.__end_)) {}
363374
364 _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
375 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; }
365376
366377 template <bool _OtherConst>
367378 requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
......@@ -371,14 +382,14 @@ public:
371382
372383 template <bool _OtherConst>
373384 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
374 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
385 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
375386 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
376387 return __x.__current_ - __y.__end_;
377388 }
378389
379390 template <bool _OtherConst>
380391 requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>>
381 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
392 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>>
382393 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
383394 return __x.__end_ - __y.__current_;
384395 }
lib/libcxx/include/__ranges/view_interface.h+4-4
......@@ -30,10 +30,10 @@
3030# pragma GCC system_header
3131#endif
3232
33_LIBCPP_BEGIN_NAMESPACE_STD
34
3533#if _LIBCPP_STD_VER >= 20
3634
35_LIBCPP_BEGIN_NAMESPACE_STD
36
3737namespace ranges {
3838
3939template <class _Derived>
......@@ -163,8 +163,8 @@ public:
163163
164164} // namespace ranges
165165
166#endif // _LIBCPP_STD_VER >= 20
167
168166_LIBCPP_END_NAMESPACE_STD
169167
168#endif // _LIBCPP_STD_VER >= 20
169
170170#endif // _LIBCPP___RANGES_VIEW_INTERFACE_H
lib/libcxx/include/__ranges/views.h+2-1
......@@ -22,7 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
2323namespace ranges {
2424
25namespace views {}
25namespace views { // NOLINT(libcpp-avoid-empty-namespaces) // This is needed to declare the alias below.
26} // namespace views
2627
2728} // namespace ranges
2829
lib/libcxx/include/__ranges/zip_transform_view.h+18-17
......@@ -17,6 +17,7 @@
1717#include <__concepts/derived_from.h>
1818#include <__concepts/equality_comparable.h>
1919#include <__concepts/invocable.h>
20#include <__concepts/referenceable.h>
2021#include <__functional/invoke.h>
2122#include <__iterator/concepts.h>
2223#include <__iterator/incrementable_traits.h>
......@@ -33,7 +34,6 @@
3334#include <__type_traits/invoke.h>
3435#include <__type_traits/is_object.h>
3536#include <__type_traits/is_reference.h>
36#include <__type_traits/is_referenceable.h>
3737#include <__type_traits/maybe_const.h>
3838#include <__type_traits/remove_cvref.h>
3939#include <__utility/forward.h>
......@@ -79,15 +79,15 @@ public:
7979 _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_transform_view(_Fn __fun, _Views... __views)
8080 : __zip_(std::move(__views)...), __fun_(in_place, std::move(__fun)) {}
8181
82 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); }
82 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); }
8383
84 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
8585 requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
8686 {
8787 return __iterator<true>(*this, __zip_.begin());
8888 }
8989
90 _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
90 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
9191 if constexpr (common_range<_InnerView>) {
9292 return __iterator<false>(*this, __zip_.end());
9393 } else {
......@@ -95,7 +95,7 @@ public:
9595 }
9696 }
9797
98 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
98 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
9999 requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
100100 {
101101 if constexpr (common_range<const _InnerView>) {
......@@ -105,13 +105,13 @@ public:
105105 }
106106 }
107107
108 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
108 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
109109 requires sized_range<_InnerView>
110110 {
111111 return __zip_.size();
112112 }
113113
114 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
115115 requires sized_range<const _InnerView>
116116 {
117117 return __zip_.size();
......@@ -184,7 +184,7 @@ public:
184184 requires _Const && convertible_to<__ziperator<false>, __ziperator<_Const>>
185185 : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {}
186186
187 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
187 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
188188 noexcept(noexcept(std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)))) {
189189 return std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_));
190190 }
......@@ -233,7 +233,7 @@ public:
233233 return *this;
234234 }
235235
236 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
236 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
237237 requires random_access_range<_Base>
238238 {
239239 return std::apply(
......@@ -255,25 +255,26 @@ public:
255255 return __x.__inner_ <=> __y.__inner_;
256256 }
257257
258 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
258 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
259259 requires random_access_range<_Base>
260260 {
261261 return __iterator(*__i.__parent_, __i.__inner_ + __n);
262262 }
263263
264 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
264 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
265265 requires random_access_range<_Base>
266266 {
267267 return __iterator(*__i.__parent_, __i.__inner_ + __n);
268268 }
269269
270 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
270 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
271271 requires random_access_range<_Base>
272272 {
273273 return __iterator(*__i.__parent_, __i.__inner_ - __n);
274274 }
275275
276 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
276 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
277 operator-(const __iterator& __x, const __iterator& __y)
277278 requires sized_sentinel_for<__ziperator<_Const>, __ziperator<_Const>>
278279 {
279280 return __x.__inner_ - __y.__inner_;
......@@ -307,14 +308,14 @@ public:
307308
308309 template <bool _OtherConst>
309310 requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
310 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
311 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
311312 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
312313 return __x.__inner_ - __y.__inner_;
313314 }
314315
315316 template <bool _OtherConst>
316317 requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
317 _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
318 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
318319 operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
319320 return __x.__inner_ - __y.__inner_;
320321 }
......@@ -327,14 +328,14 @@ struct __fn {
327328 template <class _Fn>
328329 requires(move_constructible<decay_t<_Fn>> && regular_invocable<decay_t<_Fn>&> &&
329330 is_object_v<invoke_result_t<decay_t<_Fn>&>>)
330 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const
331 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const
331332 noexcept(noexcept(auto(views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>))) {
332333 return views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>;
333334 }
334335
335336 template <class _Fn, class... _Ranges>
336337 requires(sizeof...(_Ranges) > 0)
337 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const
338 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const
338339 noexcept(noexcept(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)))
339340 -> decltype(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)) {
340341 return zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...);
lib/libcxx/include/__ranges/zip_view.h+18-15
......@@ -134,19 +134,19 @@ public:
134134
135135 _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_view(_Views... __views) : __views_(std::move(__views)...) {}
136136
137 _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
137 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin()
138138 requires(!(__simple_view<_Views> && ...))
139139 {
140140 return __iterator<false>(std::__tuple_transform(ranges::begin, __views_));
141141 }
142142
143 _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
143 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
144144 requires(range<const _Views> && ...)
145145 {
146146 return __iterator<true>(std::__tuple_transform(ranges::begin, __views_));
147147 }
148148
149 _LIBCPP_HIDE_FROM_ABI constexpr auto end()
149 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end()
150150 requires(!(__simple_view<_Views> && ...))
151151 {
152152 if constexpr (!__zip_is_common<_Views...>) {
......@@ -158,7 +158,7 @@ public:
158158 }
159159 }
160160
161 _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
161 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
162162 requires(range<const _Views> && ...)
163163 {
164164 if constexpr (!__zip_is_common<const _Views...>) {
......@@ -170,7 +170,7 @@ public:
170170 }
171171 }
172172
173 _LIBCPP_HIDE_FROM_ABI constexpr auto size()
173 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size()
174174 requires(sized_range<_Views> && ...)
175175 {
176176 return std::apply(
......@@ -181,7 +181,7 @@ public:
181181 std::__tuple_transform(ranges::size, __views_));
182182 }
183183
184 _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
184 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
185185 requires(sized_range<const _Views> && ...)
186186 {
187187 return std::apply(
......@@ -267,7 +267,7 @@ public:
267267 requires _Const && (convertible_to<iterator_t<_Views>, iterator_t<__maybe_const<_Const, _Views>>> && ...)
268268 : __current_(std::move(__i.__current_)) {}
269269
270 _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
270 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*() const {
271271 return std::__tuple_transform([](auto& __i) -> decltype(auto) { return *__i; }, __current_);
272272 }
273273
......@@ -315,7 +315,7 @@ public:
315315 return *this;
316316 }
317317
318 _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
318 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](difference_type __n) const
319319 requires __zip_all_random_access<_Const, _Views...>
320320 {
321321 return std::__tuple_transform(
......@@ -338,7 +338,7 @@ public:
338338 return __x.__current_ <=> __y.__current_;
339339 }
340340
341 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
341 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
342342 requires __zip_all_random_access<_Const, _Views...>
343343 {
344344 auto __r = __i;
......@@ -346,13 +346,13 @@ public:
346346 return __r;
347347 }
348348
349 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
349 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
350350 requires __zip_all_random_access<_Const, _Views...>
351351 {
352352 return __i + __n;
353353 }
354354
355 _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
355 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
356356 requires __zip_all_random_access<_Const, _Views...>
357357 {
358358 auto __r = __i;
......@@ -360,7 +360,8 @@ public:
360360 return __r;
361361 }
362362
363 _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
363 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type
364 operator-(const __iterator& __x, const __iterator& __y)
364365 requires(sized_sentinel_for<iterator_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_Const, _Views>>> &&
365366 ...)
366367 {
......@@ -374,7 +375,7 @@ public:
374375 __diffs);
375376 }
376377
377 _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
378 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto iter_move(const __iterator& __i) noexcept(
378379 (noexcept(ranges::iter_move(std::declval<const iterator_t<__maybe_const<_Const, _Views>>&>())) && ...) &&
379380 (is_nothrow_move_constructible_v<range_rvalue_reference_t<__maybe_const<_Const, _Views>>> && ...)) {
380381 return std::__tuple_transform(ranges::iter_move, __i.__current_);
......@@ -426,6 +427,7 @@ public:
426427 requires(
427428 sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
428429 ...)
430 [[nodiscard]]
429431 _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>
430432 operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
431433 const auto __diffs = ranges::__tuple_zip_transform(minus<>(), __iter_current(__x), __y.__end_);
......@@ -443,6 +445,7 @@ public:
443445 requires(
444446 sized_sentinel_for<sentinel_t<__maybe_const<_Const, _Views>>, iterator_t<__maybe_const<_OtherConst, _Views>>> &&
445447 ...)
448 [[nodiscard]]
446449 _LIBCPP_HIDE_FROM_ABI friend constexpr common_type_t<range_difference_t<__maybe_const<_OtherConst, _Views>>...>
447450 operator-(const __sentinel& __y, const __iterator<_OtherConst>& __x) {
448451 return -(__x - __y);
......@@ -456,10 +459,10 @@ namespace views {
456459namespace __zip {
457460
458461struct __fn {
459 _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()() noexcept { return empty_view<tuple<>>{}; }
462 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()() noexcept { return empty_view<tuple<>>{}; }
460463
461464 template <class... _Ranges>
462 _LIBCPP_HIDE_FROM_ABI static constexpr auto
465 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr auto
463466 operator()(_Ranges&&... __rs) noexcept(noexcept(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)))
464467 -> decltype(zip_view<all_t<_Ranges&&>...>(std::forward<_Ranges>(__rs)...)) {
465468 return zip_view<all_t<_Ranges>...>(std::forward<_Ranges>(__rs)...);
lib/libcxx/include/__split_buffer+131-16
......@@ -25,6 +25,7 @@
2525#include <__memory/compressed_pair.h>
2626#include <__memory/pointer_traits.h>
2727#include <__memory/swap_allocator.h>
28#include <__memory/uninitialized_algorithms.h>
2829#include <__type_traits/conditional.h>
2930#include <__type_traits/enable_if.h>
3031#include <__type_traits/integral_constant.h>
......@@ -156,10 +157,8 @@ public:
156157
157158 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { return *(__end_ - 1); }
158159
159 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_without_allocator(
160 __split_buffer_pointer_layout<__split_buffer<value_type, allocator_type, __split_buffer_pointer_layout>,
161 value_type,
162 allocator_type>& __other) _NOEXCEPT {
160 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
161 __swap_without_allocator(__split_buffer_pointer_layout& __other) _NOEXCEPT {
163162 std::swap(__front_cap_, __other.__front_cap_);
164163 std::swap(__begin_, __other.__begin_);
165164 std::swap(__back_cap_, __other.__back_cap_);
......@@ -190,6 +189,65 @@ public:
190189 __back_cap_ = __other.__back_cap_;
191190 }
192191
192 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
193 __swap_layouts(pointer& __begin, pointer& __end, pointer& __back_capacity) {
194 using std::swap;
195 swap(__begin_, __begin);
196 swap(__end_, __end);
197 swap(__back_cap_, __back_capacity);
198 }
199
200 /// Relocates the objects in the range `[__first, __last)` to the front of the buffer, then swaps
201 /// `__first`, `__last`, and `__capacity` with `__begin_`, `__end_`, and `__back_cap_`,
202 /// respectively.
203 ///
204 /// Precondition: `__front_spare() == __last - __first`.
205 /// Exceptions: This function has a strong exception guarantee.
206 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
207 __relocate(pointer& __first, pointer& __last, pointer& __capacity) {
208 auto __size = __last - __first;
209 auto __new_begin = __begin_ - __size;
210 std::__uninitialized_allocator_relocate(
211 __alloc_, std::__to_address(__first), std::__to_address(__last), std::__to_address(__new_begin));
212 __begin_ = __new_begin;
213 __last = __first;
214
215 __swap_layouts(__first, __last, __capacity);
216 __front_cap_ = __begin_;
217 }
218
219 /// Relocates the objects in the range `[__first, __pivot)` to the front of the buffer, the
220 /// objects in `[__pivot, __last)` into the back of the buffer, then swaps `__first`, `__last`,
221 /// and `__capacity` with `__begin_`, `__end_`, and `__back_cap_`, respectively.
222 ///
223 /// Preconditions:
224 /// * `__front_spare() == __pivot - __first`
225 /// * `__back_spare() == __last - __pivot`
226 /// Exceptions: This function has a strong exception guarantee if `__first == __pivot` or
227 /// `__last == __pivot`.
228 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
229 __relocate_with_pivot(pointer __pivot, pointer& __first, pointer& __last, pointer& __capacity) {
230 pointer __result = __begin_;
231
232 // Relocate [__p, __last) first to avoid having a hole in [__first, __last)
233 // in case something in [__first, __p) throws.
234 std::__uninitialized_allocator_relocate(
235 __alloc_, std::__to_address(__pivot), std::__to_address(__last), std::__to_address(__end_));
236 auto __relocated_so_far = __last - __pivot;
237 __end_ += __relocated_so_far;
238 __last = __pivot; // The objects in [__p, __last) have been destroyed by relocating them.
239
240 auto __new_begin = __begin_ - (__pivot - __first);
241 std::__uninitialized_allocator_relocate(
242 __alloc_, std::__to_address(__first), std::__to_address(__pivot), std::__to_address(__new_begin));
243 __begin_ = __new_begin;
244
245 __last = __first; // All the objects have been destroyed by relocating them.
246 __swap_layouts(__first, __last, __capacity);
247 __front_cap_ = __begin_;
248 return __result;
249 }
250
193251private:
194252 pointer __front_cap_ = nullptr;
195253 pointer __begin_ = nullptr;
......@@ -263,25 +321,19 @@ public:
263321
264322 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
265323 __set_valid_range(pointer __new_begin, pointer __new_end) _NOEXCEPT {
266 // Size-based __split_buffers track their size directly: we need to explicitly update the size
267 // when the front is adjusted.
268 __size_ -= __new_begin - __begin_;
269324 __begin_ = __new_begin;
270325 __set_sentinel(__new_end);
271326 }
272327
273328 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
274329 __set_valid_range(pointer __new_begin, size_type __new_size) _NOEXCEPT {
275 // Size-based __split_buffers track their size directly: we need to explicitly update the size
276 // when the front is adjusted.
277 __size_ -= __new_begin - __begin_;
278330 __begin_ = __new_begin;
279331 __set_sentinel(__new_size);
280332 }
281333
282334 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(pointer __new_end) _NOEXCEPT {
283335 _LIBCPP_ASSERT_INTERNAL(__front_cap_ <= __new_end, "__new_end cannot precede __front_cap_");
284 __size_ += __new_end - end();
336 __size_ = __new_end - __begin_;
285337 }
286338
287339 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_sentinel(size_type __new_size) _NOEXCEPT {
......@@ -312,10 +364,8 @@ public:
312364 return __begin_[__size_ - 1];
313365 }
314366
315 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_without_allocator(
316 __split_buffer_pointer_layout<__split_buffer<value_type, allocator_type, __split_buffer_pointer_layout>,
317 value_type,
318 allocator_type>& __other) _NOEXCEPT {
367 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
368 __swap_without_allocator(__split_buffer_size_layout& __other) _NOEXCEPT {
319369 std::swap(__front_cap_, __other.__front_cap_);
320370 std::swap(__begin_, __other.__begin_);
321371 std::swap(__cap_, __other.__cap_);
......@@ -346,6 +396,68 @@ public:
346396 __size_ = __other.__size_;
347397 }
348398
399 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
400 __swap_layouts(pointer& __begin, size_type& __size, size_type& __capacity) {
401 using std::swap;
402 swap(__begin_, __begin);
403 swap(__size_, __size);
404 swap(__cap_, __capacity);
405 }
406
407 /// Relocates the objects in the range `[__first, __first + __n)` to the front of the buffer, then
408 /// swaps `__first`, `__n`, and `__capacity` with `__begin_`, `__size_`, and `__capacity_`,
409 /// respectively.
410 ///
411 /// Precondition: `__front_spare() == __n`.
412 /// Exceptions: This function has a strong exception guarantee.
413 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
414 __relocate(pointer& __first, size_type& __n, size_type& __capacity) {
415 auto __new_begin = __begin_ - __n;
416 auto __last = __first + __n;
417 std::__uninitialized_allocator_relocate(
418 __alloc_, std::__to_address(__first), std::__to_address(__last), std::__to_address(__new_begin));
419 __set_valid_range(__new_begin, end());
420 __n = 0;
421
422 __swap_layouts(__first, __n, __capacity);
423 __front_cap_ = __begin_;
424 }
425
426 /// Relocates the objects in the range `[__first, __pivot)` to the front of the buffer, the
427 /// objects in `[__pivot, __first + __n)` to the back of the buffer, then swaps `__first`, `__n`,
428 /// and `__capacity` with `__begin_`, `__size_`, and `__capacity_`, respectively.
429 ///
430 /// Preconditions:
431 /// * `__front_spare() == __pivot - __first`
432 /// * `__back_spare() == __last - __pivot`
433 /// Exceptions: This function has a strong exception guarantee if `__first == __pivot` or
434 /// `__first + __n == __pivot`.
435 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
436 __relocate_with_pivot(pointer __pivot, pointer& __first, size_type& __n, size_type& __capacity) {
437 pointer __result = __begin_;
438 pointer __last = __first + __n;
439
440 // We relocate elements in reverse order to ensure that a throwing relocation operation leaves the
441 // buffer in a valid state.
442 std::__uninitialized_allocator_relocate(
443 __alloc_, std::__to_address(__pivot), std::__to_address(__last), std::__to_address(end()));
444
445 auto const __relocated_so_far = __last - __pivot;
446 __size_ += __relocated_so_far;
447 __n -= __relocated_so_far; // The objects in [__pivot, __last) have been destroyed by relocating them.
448
449 auto __new_begin = __begin_ - __n;
450 std::__uninitialized_allocator_relocate(
451 __alloc_, std::__to_address(__first), std::__to_address(__pivot), std::__to_address(__new_begin));
452 __begin_ = __new_begin;
453 __size_ += __n;
454 __n = 0; // All the objects have been destroyed by relocating them.
455
456 __swap_layouts(__first, __n, __capacity);
457 __front_cap_ = __begin_;
458 return __result;
459 }
460
349461private:
350462 pointer __front_cap_ = nullptr;
351463 pointer __begin_ = nullptr;
......@@ -452,11 +564,14 @@ public:
452564 using __base_type::__get_allocator;
453565 using __base_type::__raw_capacity;
454566 using __base_type::__raw_sentinel;
567 using __base_type::__relocate;
568 using __base_type::__relocate_with_pivot;
455569 using __base_type::__reset;
456570 using __base_type::__set_capacity;
457571 using __base_type::__set_data;
458572 using __base_type::__set_sentinel;
459573 using __base_type::__set_valid_range;
574 using __base_type::__swap_layouts;
460575
461576 using typename __base_type::__alloc_traits;
462577 using typename __base_type::allocator_type;
......@@ -585,7 +700,7 @@ public:
585700
586701 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
587702 __swap_without_allocator(__split_buffer<value_type, allocator_type, _Layout>& __other) _NOEXCEPT {
588 __base_type::__swap_without_allocator(__other);
703 __base_type::__swap_without_allocator(static_cast<__base_type&>(__other));
589704 }
590705
591706private:
lib/libcxx/include/__stop_token/atomic_unique_lock.h+8-7
......@@ -10,25 +10,26 @@
1010#ifndef _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H
1111#define _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H
1212
13#include <__bit/popcount.h>
13#include <__atomic/atomic.h>
14#include <__atomic/memory_order.h>
15#include <__bit/has_single_bit.h>
1416#include <__config>
15#include <atomic>
1617
1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1819# pragma GCC system_header
1920#endif
2021
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2322#if _LIBCPP_STD_VER >= 20
2423
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2526// This class implements an RAII unique_lock without a mutex.
2627// It uses std::atomic<State>,
2728// where State contains a lock bit and might contain other data,
2829// and LockedBit is the value of State when the lock bit is set, e.g 1 << 2
2930template <class _State, _State _LockedBit>
3031class __atomic_unique_lock {
31 static_assert(std::__popcount(static_cast<unsigned long long>(_LockedBit)) == 1,
32 static_assert(std::has_single_bit(static_cast<unsigned long long>(_LockedBit)),
3233 "LockedBit must be an integer where only one bit is set");
3334
3435 std::atomic<_State>& __state_;
......@@ -133,8 +134,8 @@ private:
133134 _LIBCPP_HIDE_FROM_ABI static constexpr auto __set_locked_bit = [](_State __state) { return __state | _LockedBit; };
134135};
135136
136#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
137
138137_LIBCPP_END_NAMESPACE_STD
139138
139#endif // _LIBCPP_STD_VER >= 20
140
140141#endif // _LIBCPP___STOP_TOKEN_ATOMIC_UNIQUE_LOCK_H
lib/libcxx/include/__stop_token/intrusive_list_view.h+4-4
......@@ -17,10 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2220#if _LIBCPP_STD_VER >= 20
2321
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2424template <class _Derived>
2525struct __intrusive_node_base {
2626 _Derived* __next_ = nullptr;
......@@ -78,8 +78,8 @@ private:
7878 _Node* __head_ = nullptr;
7979};
8080
81#endif // _LIBCPP_STD_VER >= 20
82
8381_LIBCPP_END_NAMESPACE_STD
8482
83#endif // _LIBCPP_STD_VER >= 20
84
8585#endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_LIST_VIEW_H
lib/libcxx/include/__stop_token/intrusive_shared_ptr.h+4-5
......@@ -10,7 +10,6 @@
1010#ifndef _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
1111#define _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
1212
13#include <__atomic/atomic.h>
1413#include <__atomic/memory_order.h>
1514#include <__config>
1615#include <__cstddef/nullptr_t.h>
......@@ -26,10 +25,10 @@
2625_LIBCPP_PUSH_MACROS
2726#include <__undef_macros>
2827
29_LIBCPP_BEGIN_NAMESPACE_STD
30
3128#if _LIBCPP_STD_VER >= 20
3229
30_LIBCPP_BEGIN_NAMESPACE_STD
31
3332// For intrusive_shared_ptr to work with a type T, specialize __intrusive_shared_ptr_traits<T> and implement
3433// the following function:
3534//
......@@ -126,10 +125,10 @@ private:
126125 }
127126};
128127
129#endif // _LIBCPP_STD_VER >= 20
130
131128_LIBCPP_END_NAMESPACE_STD
132129
130#endif // _LIBCPP_STD_VER >= 20
131
133132_LIBCPP_POP_MACROS
134133
135134#endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H
lib/libcxx/include/__stop_token/stop_callback.h+4-4
......@@ -29,10 +29,10 @@
2929_LIBCPP_PUSH_MACROS
3030#include <__undef_macros>
3131
32_LIBCPP_BEGIN_NAMESPACE_STD
33
3432#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
3533
34_LIBCPP_BEGIN_NAMESPACE_STD
35
3636template <class _Callback>
3737class stop_callback : private __stop_callback_base {
3838 static_assert(invocable<_Callback>,
......@@ -93,10 +93,10 @@ private:
9393template <class _Callback>
9494stop_callback(stop_token, _Callback) -> stop_callback<_Callback>;
9595
96#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
97
9896_LIBCPP_END_NAMESPACE_STD
9997
98#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
99
100100_LIBCPP_POP_MACROS
101101
102102#endif // _LIBCPP___STOP_TOKEN_STOP_CALLBACK_H
lib/libcxx/include/__stop_token/stop_state.h+6-5
......@@ -11,21 +11,22 @@
1111#define _LIBCPP___STOP_TOKEN_STOP_STATE_H
1212
1313#include <__assert>
14#include <__atomic/atomic.h>
15#include <__atomic/memory_order.h>
1416#include <__config>
1517#include <__stop_token/atomic_unique_lock.h>
1618#include <__stop_token/intrusive_list_view.h>
1719#include <__thread/id.h>
18#include <atomic>
1920#include <cstdint>
2021
2122#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2223# pragma GCC system_header
2324#endif
2425
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2726#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
2827
28_LIBCPP_BEGIN_NAMESPACE_STD
29
2930struct __stop_callback_base : __intrusive_node_base<__stop_callback_base> {
3031 using __callback_fn_t _LIBCPP_NODEBUG = void(__stop_callback_base*) noexcept;
3132 _LIBCPP_HIDE_FROM_ABI explicit __stop_callback_base(__callback_fn_t* __callback_fn) : __callback_fn_(__callback_fn) {}
......@@ -229,8 +230,8 @@ struct __intrusive_shared_ptr_traits<__stop_state> {
229230 }
230231};
231232
232#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
233
234233_LIBCPP_END_NAMESPACE_STD
235234
235#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
236
236237#endif // _LIBCPP___STOP_TOKEN_STOP_STATE_H
lib/libcxx/include/__stop_token/stop_token.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525class stop_token {
2626public:
2727 _LIBCPP_HIDE_FROM_ABI stop_token() noexcept = default;
......@@ -56,8 +56,8 @@ private:
5656 _LIBCPP_HIDE_FROM_ABI explicit stop_token(const __intrusive_shared_ptr<__stop_state>& __state) : __state_(__state) {}
5757};
5858
59#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
60
6159_LIBCPP_END_NAMESPACE_STD
6260
61#endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_THREADS
62
6363#endif // _LIBCPP___STOP_TOKEN_STOP_TOKEN_H
lib/libcxx/include/__support/xlocale/__nop_locale_mgmt.h deleted-33
......@@ -1,33 +0,0 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
11#define _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
12
13#include <__config>
14
15// Patch over lack of extended locale support
16typedef void* locale_t;
17
18inline _LIBCPP_HIDE_FROM_ABI locale_t duplocale(locale_t) { return nullptr; }
19
20inline _LIBCPP_HIDE_FROM_ABI void freelocale(locale_t) {}
21
22inline _LIBCPP_HIDE_FROM_ABI locale_t newlocale(int, const char*, locale_t) { return nullptr; }
23
24#define LC_COLLATE_MASK (1 << LC_COLLATE)
25#define LC_CTYPE_MASK (1 << LC_CTYPE)
26#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
27#define LC_MONETARY_MASK (1 << LC_MONETARY)
28#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
29#define LC_TIME_MASK (1 << LC_TIME)
30#define LC_ALL_MASK \
31 (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_MESSAGES_MASK)
32
33#endif // _LIBCPP___SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
lib/libcxx/include/__support/xlocale/__strtonum_fallback.h deleted-37
......@@ -1,37 +0,0 @@
1// -*- C++ -*-
2//===-----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9// These are reimplementations of some extended locale functions ( *_l ) that
10// aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe
11// others). The unifying aspect in this case is that all of these functions
12// convert strings to some numeric type.
13//===----------------------------------------------------------------------===//
14
15#ifndef _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
16#define _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
17
18#include <__config>
19#include <stdlib.h>
20
21#if _LIBCPP_HAS_WIDE_CHARACTERS
22# include <wchar.h>
23#endif
24
25inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
26 return ::strtof(__nptr, __endptr);
27}
28
29inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) {
30 return ::strtod(__nptr, __endptr);
31}
32
33inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t) {
34 return ::strtold(__nptr, __endptr);
35}
36
37#endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
lib/libcxx/include/__system_error/error_category.h+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324class error_condition;
2425class _LIBCPP_EXPORTED_FROM_ABI error_code;
......@@ -70,6 +71,7 @@ public:
7071[[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& generic_category() _NOEXCEPT;
7172[[__gnu__::__const__]] [[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI const error_category& system_category() _NOEXCEPT;
7273
74_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7375_LIBCPP_END_NAMESPACE_STD
7476
7577#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H
lib/libcxx/include/__system_error/error_code.h+2
......@@ -24,6 +24,7 @@
2424#endif
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728
2829template <class _Tp>
2930struct is_error_code_enum : public false_type {};
......@@ -137,6 +138,7 @@ struct hash<error_code> : public __unary_function<error_code, size_t> {
137138 }
138139};
139140
141_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
140142_LIBCPP_END_NAMESPACE_STD
141143
142144#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H
lib/libcxx/include/__system_error/error_condition.h+2
......@@ -23,6 +23,7 @@
2323#endif
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
26_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2627
2728template <class _Tp>
2829struct is_error_condition_enum : public false_type {};
......@@ -124,6 +125,7 @@ struct hash<error_condition> : public __unary_function<error_condition, size_t>
124125 }
125126};
126127
128_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
127129_LIBCPP_END_NAMESPACE_STD
128130
129131#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H
lib/libcxx/include/__system_error/system_error.h+2
......@@ -22,6 +22,7 @@
2222#endif
2323
2424_LIBCPP_BEGIN_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
2627class _LIBCPP_EXPORTED_FROM_ABI system_error : public runtime_error {
2728 error_code __ec_;
......@@ -52,6 +53,7 @@ public:
5253#endif
5354}
5455
56_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5557_LIBCPP_END_NAMESPACE_STD
5658
5759#endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
lib/libcxx/include/__system_error/throw_system_error.h+2
......@@ -17,9 +17,11 @@
1717#endif
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
20_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2021
2122[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
2223
24_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2325_LIBCPP_END_NAMESPACE_STD
2426
2527#endif // _LIBCPP___SYSTEM_ERROR_THROW_SYSTEM_ERROR_H
lib/libcxx/include/__thread/formatter.h+1-8
......@@ -51,20 +51,13 @@ public:
5151 // On Linux systems pthread_t is an unsigned long long.
5252 // On Apple systems pthread_t is a pointer type.
5353 //
54 // Note the output should match what the stream operator does. Since
55 // the ostream operator has been shipped years before this formatter
56 // was added to the Standard, this formatter does what the stream
57 // operator does. This may require platform specific changes.
54 // Note the output should match what the stream operator does.
5855
5956 using _Tp = decltype(__get_underlying_id(__id));
6057 using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>;
6158 static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report");
6259
6360 __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
64 if constexpr (is_pointer_v<_Tp>) {
65 __specs.__std_.__alternate_form_ = true;
66 __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case;
67 }
6861 return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs);
6962 }
7063
lib/libcxx/include/__thread/id.h+4-3
......@@ -20,9 +20,10 @@
2020# pragma GCC system_header
2121#endif
2222
23#if _LIBCPP_HAS_THREADS
24
2325_LIBCPP_BEGIN_NAMESPACE_STD
2426
25#if _LIBCPP_HAS_THREADS
2627class __thread_id;
2728
2829namespace this_thread {
......@@ -114,8 +115,8 @@ inline _LIBCPP_HIDE_FROM_ABI __thread_id get_id() _NOEXCEPT { return __libcpp_th
114115
115116} // namespace this_thread
116117
117#endif // _LIBCPP_HAS_THREADS
118
119118_LIBCPP_END_NAMESPACE_STD
120119
120#endif // _LIBCPP_HAS_THREADS
121
121122#endif // _LIBCPP___THREAD_ID_H
lib/libcxx/include/__thread/support/pthread.h+16-3
......@@ -144,7 +144,9 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_execute_once(__libcpp_exec_once_flag*
144144//
145145// Thread id
146146//
147#if defined(__MVS__)
147#if _LIBCPP_LIBC_LLVM_LIBC
148typedef pthread_id_np_t __libcpp_thread_id;
149#elif defined(__MVS__)
148150typedef unsigned long long __libcpp_thread_id;
149151#else
150152typedef pthread_t __libcpp_thread_id;
......@@ -163,11 +165,18 @@ inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_thread_id_less(__libcpp_thread_id __t
163165//
164166// Thread
165167//
166#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
168#if defined(PTHREAD_NULL)
169# define _LIBCPP_NULL_THREAD PTHREAD_NULL
170#else
171# define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
172#endif
167173typedef pthread_t __libcpp_thread_t;
168174
169175inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t* __t) {
170#if defined(__MVS__)
176#if _LIBCPP_LIBC_LLVM_LIBC
177 __libcpp_thread_id __id;
178 return pthread_getunique_np(__t, &__id) ? 0 : __id;
179#elif defined(__MVS__)
171180 return __t->__;
172181#else
173182 return *__t;
......@@ -183,8 +192,12 @@ inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_create(__libcpp_thread_t* __t,
183192}
184193
185194inline _LIBCPP_HIDE_FROM_ABI __libcpp_thread_id __libcpp_thread_get_current_id() {
195#if _LIBCPP_LIBC_LLVM_LIBC
196 return pthread_getthreadid_np();
197#else
186198 const __libcpp_thread_t __current_thread = pthread_self();
187199 return __libcpp_thread_get_id(&__current_thread);
200#endif
188201}
189202
190203inline _LIBCPP_HIDE_FROM_ABI int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, nullptr); }
lib/libcxx/include/__thread/support/windows.h+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324using __libcpp_timespec_t = ::timespec;
2425
......@@ -126,6 +127,7 @@ _LIBCPP_EXPORTED_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key);
126127
127128_LIBCPP_EXPORTED_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p);
128129
130_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
129131_LIBCPP_END_NAMESPACE_STD
130132
131133#endif // _LIBCPP___THREAD_SUPPORT_WINDOWS_H
lib/libcxx/include/__thread/this_thread.h+2
......@@ -32,7 +32,9 @@ namespace this_thread {
3232
3333#if _LIBCPP_HAS_THREADS
3434
35_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3536_LIBCPP_EXPORTED_FROM_ABI void sleep_for(const chrono::nanoseconds& __ns);
37_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3638
3739template <class _Rep, class _Period>
3840_LIBCPP_HIDE_FROM_ABI void sleep_for(const chrono::duration<_Rep, _Period>& __d) {
lib/libcxx/include/__thread/thread.h+23-14
......@@ -11,12 +11,13 @@
1111#define _LIBCPP___THREAD_THREAD_H
1212
1313#include <__assert>
14#include <__charconv/to_chars_integral.h>
1415#include <__condition_variable/condition_variable.h>
1516#include <__config>
1617#include <__exception/terminate.h>
1718#include <__functional/hash.h>
1819#include <__functional/unary_function.h>
19#include <__locale>
20#include <__fwd/ostream.h>
2021#include <__memory/addressof.h>
2122#include <__memory/unique_ptr.h>
2223#include <__mutex/mutex.h>
......@@ -27,15 +28,16 @@
2728#include <__type_traits/enable_if.h>
2829#include <__type_traits/invoke.h>
2930#include <__type_traits/is_constructible.h>
31#include <__type_traits/is_integral.h>
32#include <__type_traits/is_pointer.h>
3033#include <__type_traits/is_same.h>
3134#include <__type_traits/remove_cvref.h>
35#include <__utility/exchange.h>
3236#include <__utility/forward.h>
37#include <cstdint>
38#include <limits>
3339#include <tuple>
3440
35#if _LIBCPP_HAS_LOCALIZATION
36# include <sstream>
37#endif
38
3941#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4042# pragma GCC system_header
4143#endif
......@@ -44,6 +46,7 @@ _LIBCPP_PUSH_MACROS
4446#include <__undef_macros>
4547
4648_LIBCPP_BEGIN_NAMESPACE_STD
49_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4750
4851#if _LIBCPP_HAS_THREADS
4952
......@@ -144,13 +147,19 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
144147 //
145148 // Since various flags in the output stream can affect how the
146149 // thread id is represented (e.g. numpunct or showbase), we
147 // use a temporary stream instead and just output the thread
148 // id representation as a string.
150 // use `to_chars` directly and output the id as a string.
151
152 static_assert(is_pointer<__libcpp_thread_id>::value || is_integral<__libcpp_thread_id>::value);
153
154 using __int_type = __conditional_t<is_pointer<__libcpp_thread_id>::value, uintptr_t, __libcpp_thread_id>;
149155
150 basic_ostringstream<_CharT, _Traits> __sstr;
151 __sstr.imbue(locale::classic());
152 __sstr << __id.__id_;
153 return __os << __sstr.str();
156 static const size_t __buffer_size = numeric_limits<__int_type>::digits10 + 2;
157 char __buffer[__buffer_size];
158 auto __ret =
159 std::__to_chars_integral(__buffer, __buffer + __buffer_size - 1, reinterpret_cast<__int_type>(__id.__id_), 10);
160 _LIBCPP_ASSERT_INTERNAL(__ret.__ec == std::errc(), "to_chars failed!");
161 *__ret.__ptr = '\0';
162 return __os << __buffer;
154163}
155164# endif // _LIBCPP_HAS_LOCALIZATION
156165
......@@ -236,13 +245,12 @@ public:
236245# endif
237246 ~thread();
238247
239 _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) { __t.__t_ = _LIBCPP_NULL_THREAD; }
248 _LIBCPP_HIDE_FROM_ABI thread(thread&& __t) _NOEXCEPT : __t_(std::__exchange(__t.__t_, __libcpp_thread_t())) {}
240249
241250 _LIBCPP_HIDE_FROM_ABI thread& operator=(thread&& __t) _NOEXCEPT {
242251 if (!__libcpp_thread_isnull(&__t_))
243252 terminate();
244 __t_ = __t.__t_;
245 __t.__t_ = _LIBCPP_NULL_THREAD;
253 __t_ = std::__exchange(__t.__t_, __libcpp_thread_t());
246254 return *this;
247255 }
248256
......@@ -261,6 +269,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(thread& __x, thread& __y) _NOEXCEPT { __x
261269
262270#endif // _LIBCPP_HAS_THREADS
263271
272_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
264273_LIBCPP_END_NAMESPACE_STD
265274
266275_LIBCPP_POP_MACROS
lib/libcxx/include/__tree+472-361
......@@ -113,7 +113,7 @@ __root, have a non-null __parent_ field.
113113// Returns: true if __x is a left child of its parent, else false
114114// Precondition: __x != nullptr.
115115template <class _NodePtr>
116inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
116inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
117117 return __x == __x->__parent_->__left_;
118118}
119119
......@@ -121,7 +121,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
121121// __x is a proper subtree, returns the black height (null counts as 1). If
122122// __x is an improper subtree, returns 0.
123123template <class _NodePtr>
124unsigned __tree_sub_invariant(_NodePtr __x) {
124_LIBCPP_CONSTEXPR_SINCE_CXX26 unsigned __tree_sub_invariant(_NodePtr __x) {
125125 if (__x == nullptr)
126126 return 1;
127127 // parent consistency checked by caller
......@@ -153,7 +153,7 @@ unsigned __tree_sub_invariant(_NodePtr __x) {
153153// __root == nullptr is a proper tree. Returns true if __root is a proper
154154// red black tree, else returns false.
155155template <class _NodePtr>
156_LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
156_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_invariant(_NodePtr __root) {
157157 if (__root == nullptr)
158158 return true;
159159 // check __x->__parent_ consistency
......@@ -170,7 +170,7 @@ _LIBCPP_HIDE_FROM_ABI bool __tree_invariant(_NodePtr __root) {
170170
171171// Returns: pointer to the left-most node under __x.
172172template <class _NodePtr>
173inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
173inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
174174 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
175175 while (__x->__left_ != nullptr)
176176 __x = __x->__left_;
......@@ -179,7 +179,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
179179
180180// Returns: pointer to the right-most node under __x.
181181template <class _NodePtr>
182inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
182inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
183183 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
184184 while (__x->__right_ != nullptr)
185185 __x = __x->__right_;
......@@ -188,7 +188,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
188188
189189// Returns: pointer to the next in-order node after __x.
190190template <class _NodePtr>
191_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
191_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
192192 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
193193 if (__x->__right_ != nullptr)
194194 return std::__tree_min(__x->__right_);
......@@ -203,23 +203,23 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT {
203203// to the actual root of the tree through a __left_ pointer. Incrementing the end() pointer is UB, so we can assume that
204204// never happens.
205205template <class _EndNodePtr, class _NodePtr>
206inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
206inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT {
207207 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
208208 if (__x->__right_ != nullptr)
209 return static_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
209 return std::__static_fancy_pointer_cast<_EndNodePtr>(std::__tree_min(__x->__right_));
210210 while (!std::__tree_is_left_child(__x))
211211 __x = __x->__parent_unsafe();
212 return static_cast<_EndNodePtr>(__x->__parent_);
212 return std::__static_fancy_pointer_cast<_EndNodePtr>(__x->__parent_);
213213}
214214
215215// Returns: pointer to the previous in-order node before __x.
216216// Note: __x may be the end node.
217217template <class _NodePtr, class _EndNodePtr>
218inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
218inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
219219 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
220220 if (__x->__left_ != nullptr)
221221 return std::__tree_max(__x->__left_);
222 _NodePtr __xx = static_cast<_NodePtr>(__x);
222 _NodePtr __xx = std::__static_fancy_pointer_cast<_NodePtr>(__x);
223223 while (std::__tree_is_left_child(__xx))
224224 __xx = __xx->__parent_unsafe();
225225 return __xx->__parent_unsafe();
......@@ -227,7 +227,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEP
227227
228228// Returns: pointer to a node which has no children
229229template <class _NodePtr>
230_LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
230_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
231231 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
232232 while (true) {
233233 if (__x->__left_ != nullptr) {
......@@ -246,7 +246,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
246246// Effects: Makes __x->__right_ the subtree root with __x as its left child
247247// while preserving in-order order.
248248template <class _NodePtr>
249_LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
249_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
250250 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
251251 _LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
252252 _NodePtr __y = __x->__right_;
......@@ -265,7 +265,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
265265// Effects: Makes __x->__left_ the subtree root with __x as its right child
266266// while preserving in-order order.
267267template <class _NodePtr>
268_LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
268_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
269269 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
270270 _LIBCPP_ASSERT_INTERNAL(__x->__left_ != nullptr, "node should have a left child");
271271 _NodePtr __y = __x->__left_;
......@@ -289,7 +289,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
289289// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_
290290// may be different than the value passed in as __root.
291291template <class _NodePtr>
292_LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
292_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
293__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
293294 _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
294295 _LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
295296 __x->__is_black_ = __x == __root;
......@@ -345,7 +346,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr
345346// nor any of its children refer to __z. end_node->__left_
346347// may be different than the value passed in as __root.
347348template <class _NodePtr>
348_LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
349_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT {
349350 _LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root node should not be null");
350351 _LIBCPP_ASSERT_INTERNAL(__z != nullptr, "The node to remove should not be null");
351352 _LIBCPP_ASSERT_INTERNAL(std::__tree_invariant(__root), "The tree invariants should hold");
......@@ -560,7 +561,7 @@ public:
560561 using pointer = _Pointer;
561562 pointer __left_;
562563
563 _LIBCPP_HIDE_FROM_ABI __tree_end_node() _NOEXCEPT : __left_() {}
564 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_end_node() _NOEXCEPT : __left_() {}
564565};
565566
566567template <class _VoidPtr>
......@@ -573,9 +574,13 @@ public:
573574 __end_node_pointer __parent_;
574575 bool __is_black_;
575576
576 _LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
577 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer __parent_unsafe() const {
578 return std::__static_fancy_pointer_cast<pointer>(__parent_);
579 }
577580
578 _LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__end_node_pointer>(__p); }
581 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __set_parent(pointer __p) {
582 __parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__p);
583 }
579584
580585 _LIBCPP_HIDE_FROM_ABI __tree_node_base() = default;
581586 __tree_node_base(__tree_node_base const&) = delete;
......@@ -598,7 +603,7 @@ private:
598603 };
599604
600605public:
601 _LIBCPP_HIDE_FROM_ABI __node_value_type& __get_value() { return __value_; }
606 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_value_type& __get_value() { return __value_; }
602607#else
603608
604609private:
......@@ -609,9 +614,10 @@ public:
609614#endif
610615
611616 template <class _Alloc, class... _Args>
612 _LIBCPP_HIDE_FROM_ABI explicit __tree_node(_Alloc& __na, _Args&&... __args) {
617 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node(_Alloc& __na, _Args&&... __args) {
613618 allocator_traits<_Alloc>::construct(__na, std::addressof(__get_value()), std::forward<_Args>(__args)...);
614619 }
620
615621 ~__tree_node() = delete;
616622 __tree_node(__tree_node const&) = delete;
617623 __tree_node& operator=(__tree_node const&) = delete;
......@@ -631,14 +637,15 @@ private:
631637public:
632638 bool __value_constructed;
633639
634 _LIBCPP_HIDE_FROM_ABI __tree_node_destructor(const __tree_node_destructor&) = default;
640 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node_destructor(const __tree_node_destructor&) = default;
635641 __tree_node_destructor& operator=(const __tree_node_destructor&) = delete;
636642
637 _LIBCPP_HIDE_FROM_ABI explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
643 _LIBCPP_HIDE_FROM_ABI
644 _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
638645 : __na_(__na),
639646 __value_constructed(__val) {}
640647
641 _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
648 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(pointer __p) _NOEXCEPT {
642649 if (__value_constructed)
643650 __alloc_traits::destroy(__na_, std::addressof(__p->__get_value()));
644651 if (__p)
......@@ -663,7 +670,8 @@ template <class _Reference, class _Break, class _NodePtr, class _Func, class _Pr
663670#ifndef _LIBCPP_COMPILER_GCC // This function is recursive, so GCC complains about always_inline.
664671_LIBCPP_HIDE_FROM_ABI
665672#endif
666bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _Proj& __proj) {
673_LIBCPP_CONSTEXPR_SINCE_CXX26 bool
674__tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _Proj& __proj) {
667675 if (__root->__left_) {
668676 if (std::__tree_iterate_from_root<_Reference>(__break, static_cast<_NodePtr>(__root->__left_), __func, __proj))
669677 return true;
......@@ -678,7 +686,7 @@ bool __tree_iterate_from_root(_Break __break, _NodePtr __root, _Func& __func, _P
678686
679687// Do an in-order traversal of the tree from __first to __last.
680688template <class _NodeIter, class _Func, class _Proj>
681_LIBCPP_HIDE_FROM_ABI void
689_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
682690__tree_iterate_subrange(_NodeIter __first_it, _NodeIter __last_it, _Func& __func, _Proj& __proj) {
683691 using _NodePtr = typename _NodeIter::__node_pointer;
684692 using _Reference = typename _NodeIter::reference;
......@@ -722,51 +730,57 @@ public:
722730 using reference = value_type&;
723731 using pointer = __rebind_pointer_t<_NodePtr, value_type>;
724732
725 _LIBCPP_HIDE_FROM_ABI __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {}
733 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator() _NOEXCEPT : __ptr_(nullptr) {}
726734
727 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
728 _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
735 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); }
736 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
729737 return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
730738 }
731739
732 _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator++() {
733 __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
740 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator++() {
741 __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_));
734742 return *this;
735743 }
736 _LIBCPP_HIDE_FROM_ABI __tree_iterator operator++(int) {
744 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator++(int) {
737745 __tree_iterator __t(*this);
738746 ++(*this);
739747 return __t;
740748 }
741749
742 _LIBCPP_HIDE_FROM_ABI __tree_iterator& operator--() {
743 __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
750 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator& operator--() {
751 __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
744752 return *this;
745753 }
746 _LIBCPP_HIDE_FROM_ABI __tree_iterator operator--(int) {
754 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_iterator operator--(int) {
747755 __tree_iterator __t(*this);
748756 --(*this);
749757 return __t;
750758 }
751759
752 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
760 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
761 operator==(const __tree_iterator& __x, const __tree_iterator& __y) {
753762 return __x.__ptr_ == __y.__ptr_;
754763 }
755 friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
764 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
765 operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {
756766 return !(__x == __y);
757767 }
758768
759769private:
760 _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
761 _LIBCPP_HIDE_FROM_ABI explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
762 _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
770 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__node_pointer __p) _NOEXCEPT
771 : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
772 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_iterator(__end_node_pointer __p) _NOEXCEPT
773 : __ptr_(__p) {}
774 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const {
775 return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_);
776 }
763777 template <class, class, class>
764778 friend class __tree;
765779 template <class, class, class>
766780 friend class __tree_const_iterator;
767781
768782 template <class _NodeIter, class _Func, class _Proj>
769 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
783 _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
770784};
771785
772786#ifndef _LIBCPP_CXX03_LANG
......@@ -780,7 +794,8 @@ struct __specialized_algorithm<
780794 using __iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, _NodePtr, _DiffType>;
781795
782796 template <class _Func, class _Proj>
783 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
797 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void
798 operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
784799 std::__tree_iterate_subrange(__first, __last, __func, __proj);
785800 }
786801};
......@@ -804,54 +819,61 @@ public:
804819 using pointer = __rebind_pointer_t<_NodePtr, const value_type>;
805820 using __non_const_iterator _LIBCPP_NODEBUG = __tree_iterator<_Tp, __node_pointer, difference_type>;
806821
807 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
822 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
808823
809 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT : __ptr_(__p.__ptr_) {}
824 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
825 : __ptr_(__p.__ptr_) {}
810826
811 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __get_np()->__get_value(); }
812 _LIBCPP_HIDE_FROM_ABI pointer operator->() const {
827 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return __get_np()->__get_value(); }
828 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
813829 return pointer_traits<pointer>::pointer_to(__get_np()->__get_value());
814830 }
815831
816 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator++() {
817 __ptr_ = std::__tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_));
832 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator++() {
833 __ptr_ = std::__tree_next_iter<__end_node_pointer>(std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr_));
818834 return *this;
819835 }
820836
821 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator++(int) {
837 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator++(int) {
822838 __tree_const_iterator __t(*this);
823839 ++(*this);
824840 return __t;
825841 }
826842
827 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator& operator--() {
828 __ptr_ = static_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
843 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator& operator--() {
844 __ptr_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_prev_iter<__node_base_pointer>(__ptr_));
829845 return *this;
830846 }
831847
832 _LIBCPP_HIDE_FROM_ABI __tree_const_iterator operator--(int) {
848 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_const_iterator operator--(int) {
833849 __tree_const_iterator __t(*this);
834850 --(*this);
835851 return __t;
836852 }
837853
838 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
854 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
855 operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
839856 return __x.__ptr_ == __y.__ptr_;
840857 }
841 friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
858 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
859 operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {
842860 return !(__x == __y);
843861 }
844862
845863private:
846 _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
847 _LIBCPP_HIDE_FROM_ABI explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
848 _LIBCPP_HIDE_FROM_ABI __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); }
864 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
865 : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
866 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree_const_iterator(__end_node_pointer __p) _NOEXCEPT
867 : __ptr_(std::__static_fancy_pointer_cast<__end_node_pointer>(__p)) {}
868 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __get_np() const {
869 return std::__static_fancy_pointer_cast<__node_pointer>(__ptr_);
870 }
849871
850872 template <class, class, class>
851873 friend class __tree;
852874
853875 template <class _NodeIter, class _Func, class _Proj>
854 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
876 _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void __tree_iterate_subrange(_NodeIter, _NodeIter, _Func&, _Proj&);
855877};
856878
857879#ifndef _LIBCPP_CXX03_LANG
......@@ -865,7 +887,8 @@ struct __specialized_algorithm<
865887 using __iterator _LIBCPP_NODEBUG = __tree_const_iterator<_Tp, _NodePtr, _DiffType>;
866888
867889 template <class _Func, class _Proj>
868 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
890 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void
891 operator()(__iterator __first, __iterator __last, _Func& __func, _Proj& __proj) {
869892 std::__tree_iterate_subrange(__first, __last, __func, __proj);
870893 }
871894};
......@@ -927,98 +950,114 @@ private:
927950 _LIBCPP_COMPRESSED_PAIR(size_type, __size_, value_compare, __value_comp_);
928951
929952public:
930 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() _NOEXCEPT {
953 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() _NOEXCEPT {
931954 return pointer_traits<__end_node_pointer>::pointer_to(__end_node_);
932955 }
933 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __end_node() const _NOEXCEPT {
956 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer __end_node() const _NOEXCEPT {
934957 return pointer_traits<__end_node_pointer>::pointer_to(const_cast<__end_node_t&>(__end_node_));
935958 }
936 _LIBCPP_HIDE_FROM_ABI __node_allocator& __node_alloc() _NOEXCEPT { return __node_alloc_; }
959 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_allocator& __node_alloc() _NOEXCEPT {
960 return __node_alloc_;
961 }
937962
938963private:
939 _LIBCPP_HIDE_FROM_ABI const __node_allocator& __node_alloc() const _NOEXCEPT { return __node_alloc_; }
964 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const __node_allocator& __node_alloc() const _NOEXCEPT {
965 return __node_alloc_;
966 }
940967
941968public:
942 _LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
969 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type __alloc() const _NOEXCEPT {
970 return allocator_type(__node_alloc());
971 }
943972
944 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; }
945 _LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
946 _LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
973 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT { return __size_; }
974 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
975 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT {
976 return __value_comp_;
977 }
947978
948979public:
949 _LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
950 return static_cast<__node_pointer>(__end_node()->__left_);
980 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT {
981 return std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_);
951982 }
952983
953 _LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
984 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer* __root_ptr() const _NOEXCEPT {
954985 return std::addressof(__end_node()->__left_);
955986 }
956987
957988 using iterator = __tree_iterator<_Tp, __node_pointer, difference_type>;
958989 using const_iterator = __tree_const_iterator<_Tp, __node_pointer, difference_type>;
959990
960 _LIBCPP_HIDE_FROM_ABI explicit __tree(const value_compare& __comp) _NOEXCEPT_(
991 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const value_compare& __comp) _NOEXCEPT_(
961992 is_nothrow_default_constructible<__node_allocator>::value&& is_nothrow_copy_constructible<value_compare>::value)
962993 : __size_(0), __value_comp_(__comp) {
963994 __begin_node_ = __end_node();
964995 }
965996
966 _LIBCPP_HIDE_FROM_ABI explicit __tree(const allocator_type& __a)
997 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __tree(const allocator_type& __a)
967998 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0) {
968999 __begin_node_ = __end_node();
9691000 }
9701001
971 _LIBCPP_HIDE_FROM_ABI __tree(const value_compare& __comp, const allocator_type& __a)
1002 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const value_compare& __comp, const allocator_type& __a)
9721003 : __begin_node_(), __node_alloc_(__node_allocator(__a)), __size_(0), __value_comp_(__comp) {
9731004 __begin_node_ = __end_node();
9741005 }
9751006
976 _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __t);
1007 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const __tree& __t);
9771008
978 _LIBCPP_HIDE_FROM_ABI __tree(const __tree& __other, const allocator_type& __alloc)
1009 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(const __tree& __other, const allocator_type& __alloc)
9791010 : __begin_node_(__end_node()), __node_alloc_(__alloc), __size_(0), __value_comp_(__other.value_comp()) {
9801011 if (__other.size() == 0)
9811012 return;
9821013
983 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__other.__root()));
1014 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__other.__root()));
9841015 __root()->__parent_ = __end_node();
985 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
1016 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
9861017 __size_ = __other.size();
9871018 }
9881019
989 _LIBCPP_HIDE_FROM_ABI __tree& operator=(const __tree& __t);
1020 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(const __tree& __t);
9901021 template <class _ForwardIterator>
991 _LIBCPP_HIDE_FROM_ABI void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
992 _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t) _NOEXCEPT_(
1022 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1023 __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
1024 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t) _NOEXCEPT_(
9931025 is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value);
994 _LIBCPP_HIDE_FROM_ABI __tree(__tree&& __t, const allocator_type& __a);
1026 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree(__tree&& __t, const allocator_type& __a);
9951027
996 _LIBCPP_HIDE_FROM_ABI __tree& operator=(__tree&& __t)
1028 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree& operator=(__tree&& __t)
9971029 _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
9981030 ((__node_traits::propagate_on_container_move_assignment::value &&
9991031 is_nothrow_move_assignable<__node_allocator>::value) ||
10001032 allocator_traits<__node_allocator>::is_always_equal::value)) {
1001 __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
1033 __move_assign(__t,
1034 integral_constant<bool,
1035 __node_traits::propagate_on_container_move_assignment::value ||
1036 __node_traits::is_always_equal::value>());
10021037 return *this;
10031038 }
10041039
1005 _LIBCPP_HIDE_FROM_ABI ~__tree() {
1040 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__tree() {
10061041 static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible.");
10071042 destroy(__root());
10081043 }
10091044
1010 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return iterator(__begin_node_); }
1011 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return const_iterator(__begin_node_); }
1012 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return iterator(__end_node()); }
1013 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return const_iterator(__end_node()); }
1045 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT { return iterator(__begin_node_); }
1046 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
1047 return const_iterator(__begin_node_);
1048 }
1049 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT { return iterator(__end_node()); }
1050 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
1051 return const_iterator(__end_node());
1052 }
10141053
1015 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
1054 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
10161055 return std::min<size_type>(__node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());
10171056 }
10181057
1019 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
1058 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT;
10201059
1021 _LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
1060 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__tree& __t)
10221061#if _LIBCPP_STD_VER <= 11
10231062 _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
10241063 (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>));
......@@ -1027,21 +1066,22 @@ public:
10271066#endif
10281067
10291068 template <class... _Args>
1030 _LIBCPP_HIDE_FROM_ABI iterator __emplace_multi(_Args&&... __args);
1069 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __emplace_multi(_Args&&... __args);
10311070
10321071 template <class... _Args>
1033 _LIBCPP_HIDE_FROM_ABI iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
1072 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1073 __emplace_hint_multi(const_iterator __p, _Args&&... __args);
10341074
10351075 template <class... _Args>
1036 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_unique(_Args&&... __args) {
1037 return std::__try_key_extraction<key_type>(
1076 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> __emplace_unique(_Args&&... __args) {
1077 return std::__try_key_extraction<key_type, value_type>(
10381078 [this](const key_type& __key, _Args&&... __args2) {
10391079 auto [__parent, __child] = __find_equal(__key);
1040 __node_pointer __r = static_cast<__node_pointer>(__child);
1080 __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
10411081 bool __inserted = false;
10421082 if (__child == nullptr) {
10431083 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1044 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1084 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
10451085 __r = __h.release();
10461086 __inserted = true;
10471087 }
......@@ -1050,10 +1090,10 @@ public:
10501090 [this](_Args&&... __args2) {
10511091 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
10521092 auto [__parent, __child] = __find_equal(__h->__get_value());
1053 __node_pointer __r = static_cast<__node_pointer>(__child);
1093 __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
10541094 bool __inserted = false;
10551095 if (__child == nullptr) {
1056 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1096 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
10571097 __r = __h.release();
10581098 __inserted = true;
10591099 }
......@@ -1063,16 +1103,17 @@ public:
10631103 }
10641104
10651105 template <class... _Args>
1066 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
1067 return std::__try_key_extraction<key_type>(
1106 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
1107 __emplace_hint_unique(const_iterator __p, _Args&&... __args) {
1108 return std::__try_key_extraction<key_type, value_type>(
10681109 [this, __p](const key_type& __key, _Args&&... __args2) {
10691110 __node_base_pointer __dummy;
10701111 auto [__parent, __child] = __find_equal(__p, __dummy, __key);
1071 __node_pointer __r = static_cast<__node_pointer>(__child);
1112 __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
10721113 bool __inserted = false;
10731114 if (__child == nullptr) {
10741115 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
1075 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1116 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
10761117 __r = __h.release();
10771118 __inserted = true;
10781119 }
......@@ -1082,9 +1123,9 @@ public:
10821123 __node_holder __h = __construct_node(std::forward<_Args>(__args2)...);
10831124 __node_base_pointer __dummy;
10841125 auto [__parent, __child] = __find_equal(__p, __dummy, __h->__get_value());
1085 __node_pointer __r = static_cast<__node_pointer>(__child);
1126 __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
10861127 if (__child == nullptr) {
1087 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1128 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
10881129 __r = __h.release();
10891130 }
10901131 return pair<iterator, bool>(iterator(__r), __child == nullptr);
......@@ -1093,77 +1134,83 @@ public:
10931134 }
10941135
10951136 template <class _InIter, class _Sent>
1096 _LIBCPP_HIDE_FROM_ABI void __insert_range_multi(_InIter __first, _Sent __last) {
1137 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_multi(_InIter __first, _Sent __last) {
10971138 if (__first == __last)
10981139 return;
10991140
11001141 if (__root() == nullptr) { // Make sure we always have a root node
1101 __insert_node_at(
1102 __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
1142 __insert_node_at(__end_node(),
1143 __end_node()->__left_,
1144 std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release()));
11031145 ++__first;
11041146 }
11051147
1106 auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
1148 auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>(
1149 std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root())));
11071150
11081151 for (; __first != __last; ++__first) {
11091152 __node_holder __nd = __construct_node(*__first);
11101153 // Always check the max node first. This optimizes for sorted ranges inserted at the end.
11111154 if (!value_comp()(__nd->__get_value(), __max_node->__get_value())) { // __node >= __max_val
1112 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1155 __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
11131156 __max_node->__right_,
1114 static_cast<__node_base_pointer>(__nd.get()));
1157 std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
11151158 __max_node = __nd.release();
11161159 } else {
11171160 __end_node_pointer __parent;
11181161 __node_base_pointer& __child = __find_leaf_high(__parent, __nd->__get_value());
1119 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1162 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
11201163 }
11211164 }
11221165 }
11231166
11241167 template <class _InIter, class _Sent>
1125 _LIBCPP_HIDE_FROM_ABI void __insert_range_unique(_InIter __first, _Sent __last) {
1168 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __insert_range_unique(_InIter __first, _Sent __last) {
11261169 if (__first == __last)
11271170 return;
11281171
11291172 if (__root() == nullptr) {
1130 __insert_node_at(
1131 __end_node(), __end_node()->__left_, static_cast<__node_base_pointer>(__construct_node(*__first).release()));
1173 __insert_node_at(__end_node(),
1174 __end_node()->__left_,
1175 std::__static_fancy_pointer_cast<__node_base_pointer>(__construct_node(*__first).release()));
11321176 ++__first;
11331177 }
11341178
1135 auto __max_node = static_cast<__node_pointer>(std::__tree_max(static_cast<__node_base_pointer>(__root())));
1179 auto __max_node = std::__static_fancy_pointer_cast<__node_pointer>(
1180 std::__tree_max(std::__static_fancy_pointer_cast<__node_base_pointer>(__root())));
11361181
11371182 using __reference = decltype(*__first);
11381183
11391184 for (; __first != __last; ++__first) {
1140 std::__try_key_extraction<key_type>(
1185 std::__try_key_extraction<key_type, value_type>(
11411186 [this, &__max_node](const key_type& __key, __reference&& __val) {
11421187 if (value_comp()(__max_node->__get_value(), __key)) { // __key > __max_node
11431188 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
1144 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1189 __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
11451190 __max_node->__right_,
1146 static_cast<__node_base_pointer>(__nd.get()));
1191 std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
11471192 __max_node = __nd.release();
11481193 } else {
11491194 auto [__parent, __child] = __find_equal(__key);
11501195 if (__child == nullptr) {
11511196 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
1152 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1197 __insert_node_at(
1198 __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
11531199 }
11541200 }
11551201 },
11561202 [this, &__max_node](__reference&& __val) {
11571203 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
11581204 if (value_comp()(__max_node->__get_value(), __nd->__get_value())) { // __node > __max_node
1159 __insert_node_at(static_cast<__end_node_pointer>(__max_node),
1205 __insert_node_at(std::__static_fancy_pointer_cast<__end_node_pointer>(__max_node),
11601206 __max_node->__right_,
1161 static_cast<__node_base_pointer>(__nd.get()));
1207 std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.get()));
11621208 __max_node = __nd.release();
11631209 } else {
11641210 auto [__parent, __child] = __find_equal(__nd->__get_value());
11651211 if (__child == nullptr) {
1166 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
1212 __insert_node_at(
1213 __parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__nd.release()));
11671214 }
11681215 }
11691216 },
......@@ -1171,62 +1218,67 @@ public:
11711218 }
11721219 }
11731220
1174 _LIBCPP_HIDE_FROM_ABI iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
1221 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __remove_node_pointer(__node_pointer) _NOEXCEPT;
11751222
11761223#if _LIBCPP_STD_VER >= 17
11771224 template <class _NodeHandle, class _InsertReturnType>
1178 _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
1225 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType __node_handle_insert_unique(_NodeHandle&&);
11791226 template <class _NodeHandle>
1180 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator, _NodeHandle&&);
1227 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1228 __node_handle_insert_unique(const_iterator, _NodeHandle&&);
11811229 template <class _Comp2>
1182 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source);
1230 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1231 __node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source);
11831232
11841233 template <class _NodeHandle>
1185 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&&);
1234 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __node_handle_insert_multi(_NodeHandle&&);
11861235 template <class _NodeHandle>
1187 _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator, _NodeHandle&&);
1236 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1237 __node_handle_insert_multi(const_iterator, _NodeHandle&&);
11881238 template <class _Comp2>
1189 _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source);
1239 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1240 __node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source);
11901241
11911242 template <class _NodeHandle>
1192 _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const&);
1243 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(key_type const&);
11931244 template <class _NodeHandle>
1194 _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator);
1245 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle __node_handle_extract(const_iterator);
11951246#endif
11961247
1197 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
1198 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
1248 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p);
1249 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l);
11991250 template <class _Key>
1200 _LIBCPP_HIDE_FROM_ABI size_type __erase_unique(const _Key& __k);
1251 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_unique(const _Key& __k);
12011252 template <class _Key>
1202 _LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
1253 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __erase_multi(const _Key& __k);
12031254
1204 _LIBCPP_HIDE_FROM_ABI void
1255 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
12051256 __insert_node_at(__end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
12061257
12071258 template <class _Key>
1208 _LIBCPP_HIDE_FROM_ABI iterator find(const _Key& __key) {
1209 auto [__, __match] = __find_equal(__key);
1259 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _Key& __key) {
1260 auto [__dummy, __match] = __find_equal(__key);
12101261 if (__match == nullptr)
12111262 return end();
1212 return iterator(static_cast<__node_pointer>(__match));
1263 return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
12131264 }
12141265
12151266 template <class _Key>
1216 _LIBCPP_HIDE_FROM_ABI const_iterator find(const _Key& __key) const {
1217 auto [__, __match] = __find_equal(__key);
1267 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _Key& __key) const {
1268 auto [__dummy, __match] = __find_equal(__key);
12181269 if (__match == nullptr)
12191270 return end();
1220 return const_iterator(static_cast<__node_pointer>(__match));
1271 return const_iterator(std::__static_fancy_pointer_cast<__node_pointer>(__match));
12211272 }
12221273
12231274 template <class _Key>
1224 _LIBCPP_HIDE_FROM_ABI size_type __count_unique(const _Key& __k) const;
1275 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_unique(const _Key& __k) const;
12251276 template <class _Key>
1226 _LIBCPP_HIDE_FROM_ABI size_type __count_multi(const _Key& __k) const;
1277 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type __count_multi(const _Key& __k) const;
12271278
12281279 template <bool _LowerBound, class _Key>
1229 _LIBCPP_HIDE_FROM_ABI __end_node_pointer __lower_upper_bound_unique_impl(const _Key& __v) const {
1280 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __end_node_pointer
1281 __lower_upper_bound_unique_impl(const _Key& __v) const {
12301282 auto __rt = __root();
12311283 auto __result = __end_node();
12321284 auto __comp = __lazy_synth_three_way_comparator<_Compare, _Key, value_type>(value_comp());
......@@ -1234,14 +1286,15 @@ public:
12341286 auto __comp_res = __comp(__v, __rt->__get_value());
12351287
12361288 if (__comp_res.__less()) {
1237 __result = static_cast<__end_node_pointer>(__rt);
1238 __rt = static_cast<__node_pointer>(__rt->__left_);
1289 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
1290 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
12391291 } else if (__comp_res.__greater()) {
1240 __rt = static_cast<__node_pointer>(__rt->__right_);
1292 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
12411293 } else if _LIBCPP_CONSTEXPR (_LowerBound) {
1242 return static_cast<__end_node_pointer>(__rt);
1294 return std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
12431295 } else {
1244 return __rt->__right_ ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result;
1296 return __rt->__right_ ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
1297 : __result;
12451298 }
12461299 }
12471300 return __result;
......@@ -1282,7 +1335,7 @@ public:
12821335#endif // _LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND
12831336
12841337 template <class _Key>
1285 _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_unique(const _Key& __v) {
1338 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_unique(const _Key& __v) {
12861339#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
12871340 return iterator(__lower_bound_unique_compat_impl(__v));
12881341#else
......@@ -1291,7 +1344,7 @@ public:
12911344 }
12921345
12931346 template <class _Key>
1294 _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_unique(const _Key& __v) const {
1347 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_unique(const _Key& __v) const {
12951348#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
12961349 return const_iterator(__lower_bound_unique_compat_impl(__v));
12971350#else
......@@ -1300,7 +1353,7 @@ public:
13001353 }
13011354
13021355 template <class _Key>
1303 _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_unique(const _Key& __v) {
1356 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_unique(const _Key& __v) {
13041357#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
13051358 return iterator(__upper_bound_unique_compat_impl(__v));
13061359#else
......@@ -1309,7 +1362,7 @@ public:
13091362 }
13101363
13111364 template <class _Key>
1312 _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_unique(const _Key& __v) const {
1365 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_unique(const _Key& __v) const {
13131366#if defined(_LIBCPP_ENABLE_LEGACY_TREE_LOWER_UPPER_BOUND)
13141367 return iterator(__upper_bound_unique_compat_impl(__v));
13151368#else
......@@ -1319,117 +1372,138 @@ public:
13191372
13201373private:
13211374 template <class _Key>
1322 _LIBCPP_HIDE_FROM_ABI iterator
1375 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
13231376 __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
13241377
13251378 template <class _Key>
1326 _LIBCPP_HIDE_FROM_ABI const_iterator
1379 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
13271380 __lower_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
13281381
13291382public:
13301383 template <class _Key>
1331 _LIBCPP_HIDE_FROM_ABI iterator __lower_bound_multi(const _Key& __v) {
1384 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __lower_bound_multi(const _Key& __v) {
13321385 return __lower_bound_multi(__v, __root(), __end_node());
13331386 }
13341387 template <class _Key>
1335 _LIBCPP_HIDE_FROM_ABI const_iterator __lower_bound_multi(const _Key& __v) const {
1388 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __lower_bound_multi(const _Key& __v) const {
13361389 return __lower_bound_multi(__v, __root(), __end_node());
13371390 }
13381391
13391392 template <class _Key>
1340 _LIBCPP_HIDE_FROM_ABI iterator __upper_bound_multi(const _Key& __v) {
1393 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator __upper_bound_multi(const _Key& __v) {
13411394 return __upper_bound_multi(__v, __root(), __end_node());
13421395 }
13431396
13441397 template <class _Key>
1345 _LIBCPP_HIDE_FROM_ABI const_iterator __upper_bound_multi(const _Key& __v) const {
1398 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator __upper_bound_multi(const _Key& __v) const {
13461399 return __upper_bound_multi(__v, __root(), __end_node());
13471400 }
13481401
13491402private:
13501403 template <class _Key>
1351 _LIBCPP_HIDE_FROM_ABI iterator
1404 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
13521405 __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result);
13531406
13541407 template <class _Key>
1355 _LIBCPP_HIDE_FROM_ABI const_iterator
1408 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
13561409 __upper_bound_multi(const _Key& __v, __node_pointer __root, __end_node_pointer __result) const;
13571410
13581411public:
13591412 template <class _Key>
1360 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_unique(const _Key& __k);
1413 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_unique(const _Key& __k);
13611414 template <class _Key>
1362 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const;
1415 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1416 __equal_range_unique(const _Key& __k) const;
13631417
13641418 template <class _Key>
1365 _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> __equal_range_multi(const _Key& __k);
1419 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> __equal_range_multi(const _Key& __k);
13661420 template <class _Key>
1367 _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const;
1421 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1422 __equal_range_multi(const _Key& __k) const;
13681423
13691424 using _Dp _LIBCPP_NODEBUG = __tree_node_destructor<__node_allocator>;
13701425 using __node_holder _LIBCPP_NODEBUG = unique_ptr<__node, _Dp>;
13711426
1372 _LIBCPP_HIDE_FROM_ABI __node_holder remove(const_iterator __p) _NOEXCEPT;
1427 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder remove(const_iterator __p) _NOEXCEPT;
13731428
13741429 // FIXME: Make this function const qualified. Unfortunately doing so
13751430 // breaks existing code which uses non-const callable comparators.
13761431 template <class _Key>
1377 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v);
1432 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
1433 __find_equal(const _Key& __v);
13781434
13791435 template <class _Key>
1380 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&> __find_equal(const _Key& __v) const {
1436 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
1437 __find_equal(const _Key& __v) const {
13811438 return const_cast<__tree*>(this)->__find_equal(__v);
13821439 }
13831440
13841441 template <class _Key>
1385 _LIBCPP_HIDE_FROM_ABI pair<__end_node_pointer, __node_base_pointer&>
1442 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<__end_node_pointer, __node_base_pointer&>
13861443 __find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v);
13871444
1388 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t) {
1445 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t) {
13891446 __copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());
13901447 }
13911448
1392 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree& __t, true_type) {
1449 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree& __t, true_type) {
13931450 if (__node_alloc() != __t.__node_alloc())
13941451 clear();
13951452 __node_alloc() = __t.__node_alloc();
13961453 }
1397 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __tree&, false_type) {}
1454 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __copy_assign_alloc(const __tree&, false_type) {}
13981455
13991456private:
1400 _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_low(__end_node_pointer& __parent, const value_type& __v);
1457 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
1458 __find_leaf_low(__end_node_pointer& __parent, const value_type& __v);
14011459
1402 _LIBCPP_HIDE_FROM_ABI __node_base_pointer& __find_leaf_high(__end_node_pointer& __parent, const value_type& __v);
1460 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
1461 __find_leaf_high(__end_node_pointer& __parent, const value_type& __v);
14031462
1404 _LIBCPP_HIDE_FROM_ABI __node_base_pointer&
1463 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer&
14051464 __find_leaf(const_iterator __hint, __end_node_pointer& __parent, const value_type& __v);
14061465
14071466 template <class... _Args>
1408 _LIBCPP_HIDE_FROM_ABI __node_holder __construct_node(_Args&&... __args);
1467 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_holder __construct_node(_Args&&... __args);
14091468
14101469 // TODO: Make this _LIBCPP_HIDE_FROM_ABI
1411 _LIBCPP_HIDDEN void destroy(__node_pointer __nd) _NOEXCEPT { (__tree_deleter(__node_alloc_))(__nd); }
1470 _LIBCPP_HIDDEN _LIBCPP_CONSTEXPR_SINCE_CXX26 void destroy(__node_pointer __nd) _NOEXCEPT {
1471 (__tree_deleter(__node_alloc_))(__nd);
1472 }
14121473
1413 _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, false_type);
1414 _LIBCPP_HIDE_FROM_ABI void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
1474 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, false_type);
1475 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign(__tree& __t, true_type) _NOEXCEPT_(
14151476 is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value);
14161477
1417 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t)
1478 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t)
14181479 _NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
14191480 is_nothrow_move_assignable<__node_allocator>::value) {
14201481 __move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
14211482 }
14221483
1423 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree& __t, true_type)
1484 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree& __t, true_type)
14241485 _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
14251486 __node_alloc() = std::move(__t.__node_alloc());
14261487 }
1427 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
1488 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc(__tree&, false_type) _NOEXCEPT {}
14281489
14291490 template <class _From, class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
1430 _LIBCPP_HIDE_FROM_ABI static void __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
1491 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void
1492 __assign_value(__get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
14311493 using __key_type = __remove_const_t<typename value_type::first_type>;
14321494
1495#if _LIBCPP_STD_VER >= 26
1496 if constexpr (std::is_copy_constructible_v<decltype(__rhs.first)>) {
1497 // We need to replace the `const key_type` subobject by reconstruction during constant evaluation to avoid
1498 // undefined behavior. Currently, there is no constexpr-friend way to replacing a move-only key subobject.
1499 if consteval {
1500 std::destroy_at(std::addressof(__lhs));
1501 std::construct_at(std::addressof(__lhs), __rhs.first, std::forward<_From>(__rhs).second);
1502 return;
1503 }
1504 }
1505#endif
1506
14331507 // This is technically UB, since the object was constructed as `const`.
14341508 // Clang doesn't optimize on this currently though.
14351509 const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first);
......@@ -1437,7 +1511,7 @@ private:
14371511 }
14381512
14391513 template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
1440 _LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) {
1514 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void __assign_value(_To& __lhs, _From&& __rhs) {
14411515 __lhs = std::forward<_From>(__rhs);
14421516 }
14431517
......@@ -1447,24 +1521,23 @@ private:
14471521 public:
14481522 using pointer = __node_pointer;
14491523
1450 _LIBCPP_HIDE_FROM_ABI __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {}
1524 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_deleter(__node_allocator& __alloc) : __alloc_(__alloc) {}
14511525
14521526#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
14531527 _LIBCPP_HIDE_FROM_ABI
14541528#endif
1455 void
1456 operator()(__node_pointer __ptr) {
1529 _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator()(__node_pointer __ptr) {
14571530 if (!__ptr)
14581531 return;
14591532
1460 (*this)(static_cast<__node_pointer>(__ptr->__left_));
1533 (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__ptr->__left_));
14611534
14621535 auto __right = __ptr->__right_;
14631536
14641537 __node_traits::destroy(__alloc_, std::addressof(__ptr->__get_value()));
14651538 __node_traits::deallocate(__alloc_, __ptr, 1);
14661539
1467 (*this)(static_cast<__node_pointer>(__right));
1540 (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__right));
14681541 }
14691542 };
14701543
......@@ -1476,41 +1549,54 @@ private:
14761549#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
14771550 _LIBCPP_HIDE_FROM_ABI
14781551#endif
1479 __node_pointer __construct_from_tree(__node_pointer __src, _NodeConstructor __construct) {
1552 _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1553 __construct_from_tree(__node_pointer __src, _NodeConstructor __construct) {
14801554 if (!__src)
14811555 return nullptr;
14821556
14831557 __node_holder __new_node = __construct(__src->__get_value());
14841558
14851559 unique_ptr<__node, __tree_deleter> __left(
1486 __construct_from_tree(static_cast<__node_pointer>(__src->__left_), __construct), __node_alloc_);
1487 __node_pointer __right = __construct_from_tree(static_cast<__node_pointer>(__src->__right_), __construct);
1560 __construct_from_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_), __construct),
1561 __node_alloc_);
1562 __node_pointer __right =
1563 __construct_from_tree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_), __construct);
14881564
14891565 __node_pointer __new_node_ptr = __new_node.release();
14901566
14911567 __new_node_ptr->__is_black_ = __src->__is_black_;
1492 __new_node_ptr->__left_ = static_cast<__node_base_pointer>(__left.release());
1493 __new_node_ptr->__right_ = static_cast<__node_base_pointer>(__right);
1568 __new_node_ptr->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__left.release());
1569 __new_node_ptr->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__right);
14941570 if (__new_node_ptr->__left_)
1495 __new_node_ptr->__left_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
1571 __new_node_ptr->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr);
14961572 if (__new_node_ptr->__right_)
1497 __new_node_ptr->__right_->__parent_ = static_cast<__end_node_pointer>(__new_node_ptr);
1573 __new_node_ptr->__right_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__new_node_ptr);
14981574 return __new_node_ptr;
14991575 }
15001576
1501 _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_construct_tree(__node_pointer __src) {
1577 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __copy_construct_tree(__node_pointer __src) {
15021578 return __construct_from_tree(__src, [this](const value_type& __val) { return __construct_node(__val); });
15031579 }
15041580
15051581 template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type_v<_ValueT>, int> = 0>
1506 _LIBCPP_HIDE_FROM_ABI __node_pointer __move_construct_tree(__node_pointer __src) {
1582 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __move_construct_tree(__node_pointer __src) {
15071583 return __construct_from_tree(__src, [this](value_type& __val) {
1584
1585#if _LIBCPP_STD_VER >= 26
1586 // We need to replace the `const key_type` subobject by reconstruction during constant evaluation to avoid
1587 // undefined behavior. Currently, there is no constexpr-friend way to replacing a move-only key subobject.
1588 if constexpr (std::is_copy_constructible_v<decltype(__val.first)>) {
1589 if consteval {
1590 return __construct_node(__val.first, std::move(__val.second));
1591 }
1592 }
1593#endif
15081594 return __construct_node(const_cast<key_type&&>(__val.first), std::move(__val.second));
15091595 });
15101596 }
15111597
15121598 template <class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
1513 _LIBCPP_HIDE_FROM_ABI __node_pointer __move_construct_tree(__node_pointer __src) {
1599 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __move_construct_tree(__node_pointer __src) {
15141600 return __construct_from_tree(__src, [this](value_type& __val) { return __construct_node(std::move(__val)); });
15151601 }
15161602
......@@ -1521,7 +1607,7 @@ private:
15211607#ifdef _LIBCPP_COMPILER_CLANG_BASED // FIXME: GCC complains about not being able to always_inline a recursive function
15221608 _LIBCPP_HIDE_FROM_ABI
15231609#endif
1524 __node_pointer __assign_from_tree(
1610 _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __assign_from_tree(
15251611 __node_pointer __dest, __node_pointer __src, _Assignment __assign, _ConstructionAlg __construct_subtree) {
15261612 if (!__src) {
15271613 destroy(__dest);
......@@ -1533,36 +1619,37 @@ private:
15331619
15341620 // If we already have a left node in the destination tree, reuse it and copy-assign recursively
15351621 if (__dest->__left_) {
1536 __dest->__left_ = static_cast<__node_base_pointer>(__assign_from_tree(
1537 static_cast<__node_pointer>(__dest->__left_),
1538 static_cast<__node_pointer>(__src->__left_),
1622 __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__assign_from_tree(
1623 std::__static_fancy_pointer_cast<__node_pointer>(__dest->__left_),
1624 std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_),
15391625 __assign,
15401626 __construct_subtree));
15411627
15421628 // Otherwise, we must create new nodes; copy-construct from here on
15431629 } else if (__src->__left_) {
1544 auto __new_left = __construct_subtree(static_cast<__node_pointer>(__src->__left_));
1545 __dest->__left_ = static_cast<__node_base_pointer>(__new_left);
1546 __new_left->__parent_ = static_cast<__end_node_pointer>(__dest);
1630 auto __new_left = __construct_subtree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__left_));
1631 __dest->__left_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_left);
1632 __new_left->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest);
15471633 }
15481634
15491635 // Identical to the left case above, just for the right nodes
15501636 if (__dest->__right_) {
1551 __dest->__right_ = static_cast<__node_base_pointer>(__assign_from_tree(
1552 static_cast<__node_pointer>(__dest->__right_),
1553 static_cast<__node_pointer>(__src->__right_),
1637 __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__assign_from_tree(
1638 std::__static_fancy_pointer_cast<__node_pointer>(__dest->__right_),
1639 std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_),
15541640 __assign,
15551641 __construct_subtree));
15561642 } else if (__src->__right_) {
1557 auto __new_right = __construct_subtree(static_cast<__node_pointer>(__src->__right_));
1558 __dest->__right_ = static_cast<__node_base_pointer>(__new_right);
1559 __new_right->__parent_ = static_cast<__end_node_pointer>(__dest);
1643 auto __new_right = __construct_subtree(std::__static_fancy_pointer_cast<__node_pointer>(__src->__right_));
1644 __dest->__right_ = std::__static_fancy_pointer_cast<__node_base_pointer>(__new_right);
1645 __new_right->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__dest);
15601646 }
15611647
15621648 return __dest;
15631649 }
15641650
1565 _LIBCPP_HIDE_FROM_ABI __node_pointer __copy_assign_tree(__node_pointer __dest, __node_pointer __src) {
1651 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1652 __copy_assign_tree(__node_pointer __dest, __node_pointer __src) {
15661653 return __assign_from_tree(
15671654 __dest,
15681655 __src,
......@@ -1570,7 +1657,8 @@ private:
15701657 [this](__node_pointer __nd) { return __copy_construct_tree(__nd); });
15711658 }
15721659
1573 _LIBCPP_HIDE_FROM_ABI __node_pointer __move_assign_tree(__node_pointer __dest, __node_pointer __src) {
1660 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer
1661 __move_assign_tree(__node_pointer __dest, __node_pointer __src) {
15741662 return __assign_from_tree(
15751663 __dest,
15761664 __src,
......@@ -1589,7 +1677,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp
15891677 using __node_pointer _LIBCPP_NODEBUG = typename __tree<_Tp, _Compare, _Allocator>::__node_pointer;
15901678
15911679 template <class _Tree, class _Func, class _Proj>
1592 _LIBCPP_HIDE_FROM_ABI static auto operator()(_Tree&& __range, _Func __func, _Proj __proj) {
1680 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto
1681 operator()(_Tree&& __range, _Func __func, _Proj __proj) {
15931682 if (__range.size() != 0)
15941683 std::__tree_iterate_from_root<__copy_cvref_t<_Tree, typename __remove_cvref_t<_Tree>::value_type>>(
15951684 [](__node_pointer) { return false; }, __range.__root(), __func, __proj);
......@@ -1599,7 +1688,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<__tree<_Tp
15991688#endif
16001689
16011690template <class _Tp, class _Compare, class _Allocator>
1602__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
1691_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>&
1692__tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) {
16031693 if (this == std::addressof(__t))
16041694 return *this;
16051695
......@@ -1607,21 +1697,22 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(
16071697 __copy_assign_alloc(__t);
16081698
16091699 if (__size_ != 0) {
1610 *__root_ptr() = static_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root()));
1700 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_assign_tree(__root(), __t.__root()));
16111701 } else {
1612 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
1702 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
16131703 if (__root())
16141704 __root()->__parent_ = __end_node();
16151705 }
1616 __begin_node_ =
1617 __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
1706 __begin_node_ = __end_node()->__left_
1707 ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_))
1708 : __end_node();
16181709 __size_ = __t.size();
16191710
16201711 return *this;
16211712}
16221713
16231714template <class _Tp, class _Compare, class _Allocator>
1624__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
1715_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
16251716 : __begin_node_(__end_node()),
16261717 __node_alloc_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
16271718 __size_(0),
......@@ -1629,14 +1720,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
16291720 if (__t.size() == 0)
16301721 return;
16311722
1632 *__root_ptr() = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
1723 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
16331724 __root()->__parent_ = __end_node();
1634 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
1725 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
16351726 __size_ = __t.size();
16361727}
16371728
16381729template <class _Tp, class _Compare, class _Allocator>
1639__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
1730_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
16401731 is_nothrow_move_constructible<__node_allocator>::value&& is_nothrow_move_constructible<value_compare>::value)
16411732 : __begin_node_(std::move(__t.__begin_node_)),
16421733 __end_node_(std::move(__t.__end_node_)),
......@@ -1646,7 +1737,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
16461737 if (__size_ == 0)
16471738 __begin_node_ = __end_node();
16481739 else {
1649 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1740 __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node());
16501741 __t.__begin_node_ = __t.__end_node();
16511742 __t.__end_node()->__left_ = nullptr;
16521743 __t.__size_ = 0;
......@@ -1654,7 +1745,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) _NOEXCEPT_(
16541745}
16551746
16561747template <class _Tp, class _Compare, class _Allocator>
1657__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
1748_LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
16581749 : __begin_node_(__end_node()),
16591750 __node_alloc_(__node_allocator(__a)),
16601751 __size_(0),
......@@ -1664,24 +1755,24 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
16641755 if (__a == __t.__alloc()) {
16651756 __begin_node_ = __t.__begin_node_;
16661757 __end_node()->__left_ = __t.__end_node()->__left_;
1667 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1758 __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node());
16681759 __size_ = __t.__size_;
16691760 __t.__begin_node_ = __t.__end_node();
16701761 __t.__end_node()->__left_ = nullptr;
16711762 __t.__size_ = 0;
16721763 } else {
1673 *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
1764 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
16741765 __root()->__parent_ = __end_node();
1675 __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
1766 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
16761767 __size_ = __t.size();
16771768 __t.clear(); // Ensure that __t is in a valid state after moving out the keys
16781769 }
16791770}
16801771
16811772template <class _Tp, class _Compare, class _Allocator>
1682void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
1773_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
16831774 _NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value&& is_nothrow_move_assignable<__node_allocator>::value) {
1684 destroy(static_cast<__node_pointer>(__end_node()->__left_));
1775 destroy(std::__static_fancy_pointer_cast<__node_pointer>(__end_node()->__left_));
16851776 __begin_node_ = __t.__begin_node_;
16861777 __end_node_ = __t.__end_node_;
16871778 __move_assign_alloc(__t);
......@@ -1690,7 +1781,7 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
16901781 if (__size_ == 0)
16911782 __begin_node_ = __end_node();
16921783 else {
1693 __end_node()->__left_->__parent_ = static_cast<__end_node_pointer>(__end_node());
1784 __end_node()->__left_->__parent_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__end_node());
16941785 __t.__begin_node_ = __t.__end_node();
16951786 __t.__end_node()->__left_ = nullptr;
16961787 __t.__size_ = 0;
......@@ -1698,27 +1789,28 @@ void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
16981789}
16991790
17001791template <class _Tp, class _Compare, class _Allocator>
1701void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
1792_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) {
17021793 if (__node_alloc() == __t.__node_alloc()) {
17031794 __move_assign(__t, true_type());
17041795 } else {
17051796 value_comp() = std::move(__t.value_comp());
17061797 if (__size_ != 0) {
1707 *__root_ptr() = static_cast<__node_base_pointer>(__move_assign_tree(__root(), __t.__root()));
1798 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_assign_tree(__root(), __t.__root()));
17081799 } else {
1709 *__root_ptr() = static_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
1800 *__root_ptr() = std::__static_fancy_pointer_cast<__node_base_pointer>(__move_construct_tree(__t.__root()));
17101801 if (__root())
17111802 __root()->__parent_ = __end_node();
17121803 }
1713 __begin_node_ =
1714 __end_node()->__left_ ? static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_)) : __end_node();
1804 __begin_node_ = __end_node()->__left_
1805 ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_))
1806 : __end_node();
17151807 __size_ = __t.size();
17161808 __t.clear(); // Ensure that __t is in a valid state after moving out the keys
17171809 }
17181810}
17191811
17201812template <class _Tp, class _Compare, class _Allocator>
1721void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
1813_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
17221814#if _LIBCPP_STD_VER <= 11
17231815 _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
17241816 (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>))
......@@ -1743,7 +1835,7 @@ void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
17431835}
17441836
17451837template <class _Tp, class _Compare, class _Allocator>
1746void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
1838_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
17471839 destroy(__root());
17481840 __size_ = 0;
17491841 __begin_node_ = __end_node();
......@@ -1754,23 +1846,23 @@ void __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT {
17541846// Set __parent to parent of null leaf
17551847// Return reference to null leaf
17561848template <class _Tp, class _Compare, class _Allocator>
1757typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
1849_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
17581850__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent, const value_type& __v) {
17591851 __node_pointer __nd = __root();
17601852 if (__nd != nullptr) {
17611853 while (true) {
17621854 if (value_comp()(__nd->__get_value(), __v)) {
17631855 if (__nd->__right_ != nullptr)
1764 __nd = static_cast<__node_pointer>(__nd->__right_);
1856 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
17651857 else {
1766 __parent = static_cast<__end_node_pointer>(__nd);
1858 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
17671859 return __nd->__right_;
17681860 }
17691861 } else {
17701862 if (__nd->__left_ != nullptr)
1771 __nd = static_cast<__node_pointer>(__nd->__left_);
1863 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_);
17721864 else {
1773 __parent = static_cast<__end_node_pointer>(__nd);
1865 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
17741866 return __parent->__left_;
17751867 }
17761868 }
......@@ -1784,23 +1876,23 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__end_node_pointer& __parent,
17841876// Set __parent to parent of null leaf
17851877// Return reference to null leaf
17861878template <class _Tp, class _Compare, class _Allocator>
1787typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
1879_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
17881880__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent, const value_type& __v) {
17891881 __node_pointer __nd = __root();
17901882 if (__nd != nullptr) {
17911883 while (true) {
17921884 if (value_comp()(__v, __nd->__get_value())) {
17931885 if (__nd->__left_ != nullptr)
1794 __nd = static_cast<__node_pointer>(__nd->__left_);
1886 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_);
17951887 else {
1796 __parent = static_cast<__end_node_pointer>(__nd);
1888 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
17971889 return __parent->__left_;
17981890 }
17991891 } else {
18001892 if (__nd->__right_ != nullptr)
1801 __nd = static_cast<__node_pointer>(__nd->__right_);
1893 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
18021894 else {
1803 __parent = static_cast<__end_node_pointer>(__nd);
1895 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__nd);
18041896 return __nd->__right_;
18051897 }
18061898 }
......@@ -1817,7 +1909,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__end_node_pointer& __parent
18171909// Set __parent to parent of null leaf
18181910// Return reference to null leaf
18191911template <class _Tp, class _Compare, class _Allocator>
1820typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf(
1912_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&
1913__tree<_Tp, _Compare, _Allocator>::__find_leaf(
18211914 const_iterator __hint, __end_node_pointer& __parent, const value_type& __v) {
18221915 if (__hint == end() || !value_comp()(*__hint, __v)) // check before
18231916 {
......@@ -1826,11 +1919,11 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
18261919 if (__prior == begin() || !value_comp()(__v, *--__prior)) {
18271920 // *prev(__hint) <= __v <= *__hint
18281921 if (__hint.__ptr_->__left_ == nullptr) {
1829 __parent = static_cast<__end_node_pointer>(__hint.__ptr_);
1922 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__hint.__ptr_);
18301923 return __parent->__left_;
18311924 } else {
1832 __parent = static_cast<__end_node_pointer>(__prior.__ptr_);
1833 return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
1925 __parent = std::__static_fancy_pointer_cast<__end_node_pointer>(__prior.__ptr_);
1926 return std::__static_fancy_pointer_cast<__node_base_pointer>(__prior.__ptr_)->__right_;
18341927 }
18351928 }
18361929 // __v < *prev(__hint)
......@@ -1845,8 +1938,9 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
18451938// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
18461939template <class _Tp, class _Compare, class _Allocator>
18471940template <class _Key>
1848_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1849 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
1941_LIBCPP_HIDE_FROM_ABI
1942_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1943 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
18501944__tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
18511945 using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
18521946
......@@ -1858,27 +1952,27 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
18581952 }
18591953
18601954 __node_base_pointer* __node_ptr = __root_ptr();
1861 auto&& __transparent = std::__as_transparent<_Key>(value_comp());
1955 auto&& __transparent = std::__as_transparent<key_type>(value_comp());
18621956 auto __comp =
1863 __lazy_synth_three_way_comparator<__make_transparent_t<_Key, _Compare>, _Key, value_type>(__transparent);
1957 __lazy_synth_three_way_comparator<__make_transparent_t<key_type, _Compare>, _Key, value_type>(__transparent);
18641958
18651959 while (true) {
18661960 auto __comp_res = __comp(__v, __nd->__get_value());
18671961
18681962 if (__comp_res.__less()) {
18691963 if (__nd->__left_ == nullptr)
1870 return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__left_);
1964 return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__left_);
18711965
18721966 __node_ptr = std::addressof(__nd->__left_);
1873 __nd = static_cast<__node_pointer>(__nd->__left_);
1967 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__left_);
18741968 } else if (__comp_res.__greater()) {
18751969 if (__nd->__right_ == nullptr)
1876 return _Pair(static_cast<__end_node_pointer>(__nd), __nd->__right_);
1970 return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), __nd->__right_);
18771971
18781972 __node_ptr = std::addressof(__nd->__right_);
1879 __nd = static_cast<__node_pointer>(__nd->__right_);
1973 __nd = std::__static_fancy_pointer_cast<__node_pointer>(__nd->__right_);
18801974 } else {
1881 return _Pair(static_cast<__end_node_pointer>(__nd), *__node_ptr);
1975 return _Pair(std::__static_fancy_pointer_cast<__end_node_pointer>(__nd), *__node_ptr);
18821976 }
18831977 }
18841978}
......@@ -1891,8 +1985,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const _Key& __v) {
18911985// If __v doesn't exist, return the parent of the null leaf and a reference to the pointer to the null leaf.
18921986template <class _Tp, class _Compare, class _Allocator>
18931987template <class _Key>
1894_LIBCPP_HIDE_FROM_ABI pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1895 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
1988_LIBCPP_HIDE_FROM_ABI
1989_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::__end_node_pointer,
1990 typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer&>
18961991__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_base_pointer& __dummy, const _Key& __v) {
18971992 using _Pair = pair<__end_node_pointer, __node_base_pointer&>;
18981993
......@@ -1903,7 +1998,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba
19031998 // *prev(__hint) < __v < *__hint
19041999 if (__hint.__ptr_->__left_ == nullptr)
19052000 return _Pair(__hint.__ptr_, __hint.__ptr_->__left_);
1906 return _Pair(__prior.__ptr_, static_cast<__node_pointer>(__prior.__ptr_)->__right_);
2001 return _Pair(__prior.__ptr_, std::__static_fancy_pointer_cast<__node_pointer>(__prior.__ptr_)->__right_);
19072002 }
19082003 // __v <= *prev(__hint)
19092004 return __find_equal(__v);
......@@ -1915,7 +2010,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba
19152010 if (__next == end() || value_comp()(__v, *__next)) {
19162011 // *__hint < __v < *std::next(__hint)
19172012 if (__hint.__get_np()->__right_ == nullptr)
1918 return _Pair(__hint.__ptr_, static_cast<__node_pointer>(__hint.__ptr_)->__right_);
2013 return _Pair(__hint.__ptr_, std::__static_fancy_pointer_cast<__node_pointer>(__hint.__ptr_)->__right_);
19192014 return _Pair(__next.__ptr_, __next.__ptr_->__left_);
19202015 }
19212016 // *next(__hint) <= __v
......@@ -1923,12 +2018,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __node_ba
19232018 }
19242019
19252020 // else __v == *__hint
1926 __dummy = static_cast<__node_base_pointer>(__hint.__ptr_);
2021 __dummy = std::__static_fancy_pointer_cast<__node_base_pointer>(__hint.__ptr_);
19272022 return _Pair(__hint.__ptr_, __dummy);
19282023}
19292024
19302025template <class _Tp, class _Compare, class _Allocator>
1931void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
2026_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
19322027 __end_node_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT {
19332028 __new_node->__left_ = nullptr;
19342029 __new_node->__right_ = nullptr;
......@@ -1936,14 +2031,14 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
19362031 // __new_node->__is_black_ is initialized in __tree_balance_after_insert
19372032 __child = __new_node;
19382033 if (__begin_node_->__left_ != nullptr)
1939 __begin_node_ = static_cast<__end_node_pointer>(__begin_node_->__left_);
2034 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__begin_node_->__left_);
19402035 std::__tree_balance_after_insert(__end_node()->__left_, __child);
19412036 ++__size_;
19422037}
19432038
19442039template <class _Tp, class _Compare, class _Allocator>
19452040template <class... _Args>
1946typename __tree<_Tp, _Compare, _Allocator>::__node_holder
2041_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder
19472042__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
19482043 __node_allocator& __na = __node_alloc();
19492044 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
......@@ -1954,42 +2049,42 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
19542049
19552050template <class _Tp, class _Compare, class _Allocator>
19562051template <class... _Args>
1957typename __tree<_Tp, _Compare, _Allocator>::iterator
2052typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
19582053__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) {
19592054 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
19602055 __end_node_pointer __parent;
19612056 __node_base_pointer& __child = __find_leaf_high(__parent, __h->__get_value());
1962 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1963 return iterator(static_cast<__node_pointer>(__h.release()));
2057 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
2058 return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release()));
19642059}
19652060
19662061template <class _Tp, class _Compare, class _Allocator>
19672062template <class... _Args>
1968typename __tree<_Tp, _Compare, _Allocator>::iterator
2063typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
19692064__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) {
19702065 __node_holder __h = __construct_node(std::forward<_Args>(__args)...);
19712066 __end_node_pointer __parent;
19722067 __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__get_value());
1973 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1974 return iterator(static_cast<__node_pointer>(__h.release()));
2068 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__h.get()));
2069 return iterator(std::__static_fancy_pointer_cast<__node_pointer>(__h.release()));
19752070}
19762071
19772072template <class _Tp, class _Compare, class _Allocator>
1978typename __tree<_Tp, _Compare, _Allocator>::iterator
2073typename __tree<_Tp, _Compare, _Allocator>::iterator _LIBCPP_CONSTEXPR_SINCE_CXX26
19792074__tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) _NOEXCEPT {
19802075 iterator __r(__ptr);
19812076 ++__r;
19822077 if (__begin_node_ == __ptr)
19832078 __begin_node_ = __r.__ptr_;
19842079 --__size_;
1985 std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr));
2080 std::__tree_remove(__end_node()->__left_, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
19862081 return __r;
19872082}
19882083
19892084#if _LIBCPP_STD_VER >= 17
19902085template <class _Tp, class _Compare, class _Allocator>
19912086template <class _NodeHandle, class _InsertReturnType>
1992_LIBCPP_HIDE_FROM_ABI _InsertReturnType
2087_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _InsertReturnType
19932088__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __nh) {
19942089 if (__nh.empty())
19952090 return _InsertReturnType{end(), false, _NodeHandle()};
......@@ -1997,16 +2092,17 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(_NodeHandle&& __n
19972092 __node_pointer __ptr = __nh.__ptr_;
19982093 auto [__parent, __child] = __find_equal(__ptr->__get_value());
19992094 if (__child != nullptr)
2000 return _InsertReturnType{iterator(static_cast<__node_pointer>(__child)), false, std::move(__nh)};
2095 return _InsertReturnType{
2096 iterator(std::__static_fancy_pointer_cast<__node_pointer>(__child)), false, std::move(__nh)};
20012097
2002 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2098 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
20032099 __nh.__release_ptr();
20042100 return _InsertReturnType{iterator(__ptr), true, _NodeHandle()};
20052101}
20062102
20072103template <class _Tp, class _Compare, class _Allocator>
20082104template <class _NodeHandle>
2009_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
2105_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
20102106__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh) {
20112107 if (__nh.empty())
20122108 return end();
......@@ -2014,9 +2110,9 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __
20142110 __node_pointer __ptr = __nh.__ptr_;
20152111 __node_base_pointer __dummy;
20162112 auto [__parent, __child] = __find_equal(__hint, __dummy, __ptr->__get_value());
2017 __node_pointer __r = static_cast<__node_pointer>(__child);
2113 __node_pointer __r = std::__static_fancy_pointer_cast<__node_pointer>(__child);
20182114 if (__child == nullptr) {
2019 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2115 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
20202116 __r = __ptr;
20212117 __nh.__release_ptr();
20222118 }
......@@ -2025,7 +2121,8 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_unique(const_iterator __
20252121
20262122template <class _Tp, class _Compare, class _Allocator>
20272123template <class _NodeHandle>
2028_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
2124_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle
2125__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(key_type const& __key) {
20292126 iterator __it = __lower_bound_multi(__key);
20302127 if (__it == end() || __value_comp_(__key, *__it))
20312128 return _NodeHandle();
......@@ -2034,7 +2131,8 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand
20342131
20352132template <class _Tp, class _Compare, class _Allocator>
20362133template <class _NodeHandle>
2037_LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
2134_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodeHandle
2135__tree<_Tp, _Compare, _Allocator>::__node_handle_extract(const_iterator __p) {
20382136 __node_pointer __np = __p.__get_np();
20392137 __remove_node_pointer(__np);
20402138 return _NodeHandle(__np, __alloc());
......@@ -2042,7 +2140,7 @@ _LIBCPP_HIDE_FROM_ABI _NodeHandle __tree<_Tp, _Compare, _Allocator>::__node_hand
20422140
20432141template <class _Tp, class _Compare, class _Allocator>
20442142template <class _Comp2>
2045_LIBCPP_HIDE_FROM_ABI void
2143_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
20462144__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2, _Allocator>& __source) {
20472145 for (iterator __i = __source.begin(); __i != __source.end();) {
20482146 __node_pointer __src_ptr = __i.__get_np();
......@@ -2051,27 +2149,27 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_unique(__tree<_Tp, _Comp2
20512149 if (__child != nullptr)
20522150 continue;
20532151 __source.__remove_node_pointer(__src_ptr);
2054 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
2152 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__src_ptr));
20552153 }
20562154}
20572155
20582156template <class _Tp, class _Compare, class _Allocator>
20592157template <class _NodeHandle>
2060_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
2158_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
20612159__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(_NodeHandle&& __nh) {
20622160 if (__nh.empty())
20632161 return end();
20642162 __node_pointer __ptr = __nh.__ptr_;
20652163 __end_node_pointer __parent;
20662164 __node_base_pointer& __child = __find_leaf_high(__parent, __ptr->__get_value());
2067 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2165 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
20682166 __nh.__release_ptr();
20692167 return iterator(__ptr);
20702168}
20712169
20722170template <class _Tp, class _Compare, class _Allocator>
20732171template <class _NodeHandle>
2074_LIBCPP_HIDE_FROM_ABI typename __tree<_Tp, _Compare, _Allocator>::iterator
2172_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
20752173__tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) {
20762174 if (__nh.empty())
20772175 return end();
......@@ -2079,14 +2177,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_insert_multi(const_iterator __h
20792177 __node_pointer __ptr = __nh.__ptr_;
20802178 __end_node_pointer __parent;
20812179 __node_base_pointer& __child = __find_leaf(__hint, __parent, __ptr->__get_value());
2082 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__ptr));
2180 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__ptr));
20832181 __nh.__release_ptr();
20842182 return iterator(__ptr);
20852183}
20862184
20872185template <class _Tp, class _Compare, class _Allocator>
20882186template <class _Comp2>
2089_LIBCPP_HIDE_FROM_ABI void
2187_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
20902188__tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2, _Allocator>& __source) {
20912189 for (iterator __i = __source.begin(); __i != __source.end();) {
20922190 __node_pointer __src_ptr = __i.__get_np();
......@@ -2094,14 +2192,14 @@ __tree<_Tp, _Compare, _Allocator>::__node_handle_merge_multi(__tree<_Tp, _Comp2,
20942192 __node_base_pointer& __child = __find_leaf_high(__parent, __src_ptr->__get_value());
20952193 ++__i;
20962194 __source.__remove_node_pointer(__src_ptr);
2097 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__src_ptr));
2195 __insert_node_at(__parent, __child, std::__static_fancy_pointer_cast<__node_base_pointer>(__src_ptr));
20982196 }
20992197}
2100
21012198#endif // _LIBCPP_STD_VER >= 17
21022199
21032200template <class _Tp, class _Compare, class _Allocator>
2104typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
2201_LIBCPP_CONSTEXPR_SINCE_CXX26
2202 typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) {
21052203 __node_pointer __np = __p.__get_np();
21062204 iterator __r = __remove_node_pointer(__np);
21072205 __node_allocator& __na = __node_alloc();
......@@ -2111,7 +2209,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allo
21112209}
21122210
21132211template <class _Tp, class _Compare, class _Allocator>
2114typename __tree<_Tp, _Compare, _Allocator>::iterator
2212_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
21152213__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) {
21162214 while (__f != __l)
21172215 __f = erase(__f);
......@@ -2120,7 +2218,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
21202218
21212219template <class _Tp, class _Compare, class _Allocator>
21222220template <class _Key>
2123typename __tree<_Tp, _Compare, _Allocator>::size_type
2221_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
21242222__tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
21252223 iterator __i = find(__k);
21262224 if (__i == end())
......@@ -2131,7 +2229,7 @@ __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) {
21312229
21322230template <class _Tp, class _Compare, class _Allocator>
21332231template <class _Key>
2134typename __tree<_Tp, _Compare, _Allocator>::size_type
2232_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
21352233__tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
21362234 pair<iterator, iterator> __p = __equal_range_multi(__k);
21372235 size_type __r = 0;
......@@ -2142,16 +2240,16 @@ __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) {
21422240
21432241template <class _Tp, class _Compare, class _Allocator>
21442242template <class _Key>
2145typename __tree<_Tp, _Compare, _Allocator>::size_type
2243_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
21462244__tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
21472245 __node_pointer __rt = __root();
21482246 auto __comp = __lazy_synth_three_way_comparator<value_compare, _Key, value_type>(value_comp());
21492247 while (__rt != nullptr) {
21502248 auto __comp_res = __comp(__k, __rt->__get_value());
21512249 if (__comp_res.__less()) {
2152 __rt = static_cast<__node_pointer>(__rt->__left_);
2250 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
21532251 } else if (__comp_res.__greater())
2154 __rt = static_cast<__node_pointer>(__rt->__right_);
2252 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
21552253 else
21562254 return 1;
21572255 }
......@@ -2160,7 +2258,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const {
21602258
21612259template <class _Tp, class _Compare, class _Allocator>
21622260template <class _Key>
2163typename __tree<_Tp, _Compare, _Allocator>::size_type
2261_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::size_type
21642262__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
21652263 __end_node_pointer __result = __end_node();
21662264 __node_pointer __rt = __root();
......@@ -2168,78 +2266,85 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const {
21682266 while (__rt != nullptr) {
21692267 auto __comp_res = __comp(__k, __rt->__get_value());
21702268 if (__comp_res.__less()) {
2171 __result = static_cast<__end_node_pointer>(__rt);
2172 __rt = static_cast<__node_pointer>(__rt->__left_);
2269 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
2270 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
21732271 } else if (__comp_res.__greater())
2174 __rt = static_cast<__node_pointer>(__rt->__right_);
2272 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
21752273 else
21762274 return std::distance(
2177 __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2178 __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
2275 __lower_bound_multi(__k,
2276 std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
2277 std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
2278 __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
21792279 }
21802280 return 0;
21812281}
21822282
21832283template <class _Tp, class _Compare, class _Allocator>
21842284template <class _Key>
2185typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
2285_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
2286__tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
21862287 const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
21872288 while (__root != nullptr) {
21882289 if (!value_comp()(__root->__get_value(), __v)) {
2189 __result = static_cast<__end_node_pointer>(__root);
2190 __root = static_cast<__node_pointer>(__root->__left_);
2290 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
2291 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
21912292 } else
2192 __root = static_cast<__node_pointer>(__root->__right_);
2293 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
21932294 }
21942295 return iterator(__result);
21952296}
21962297
21972298template <class _Tp, class _Compare, class _Allocator>
21982299template <class _Key>
2199typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
2300_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
2301__tree<_Tp, _Compare, _Allocator>::__lower_bound_multi(
22002302 const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
22012303 while (__root != nullptr) {
22022304 if (!value_comp()(__root->__get_value(), __v)) {
2203 __result = static_cast<__end_node_pointer>(__root);
2204 __root = static_cast<__node_pointer>(__root->__left_);
2305 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
2306 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
22052307 } else
2206 __root = static_cast<__node_pointer>(__root->__right_);
2308 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
22072309 }
22082310 return const_iterator(__result);
22092311}
22102312
22112313template <class _Tp, class _Compare, class _Allocator>
22122314template <class _Key>
2213typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
2315_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::iterator
2316__tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
22142317 const _Key& __v, __node_pointer __root, __end_node_pointer __result) {
22152318 while (__root != nullptr) {
22162319 if (value_comp()(__v, __root->__get_value())) {
2217 __result = static_cast<__end_node_pointer>(__root);
2218 __root = static_cast<__node_pointer>(__root->__left_);
2320 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
2321 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
22192322 } else
2220 __root = static_cast<__node_pointer>(__root->__right_);
2323 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
22212324 }
22222325 return iterator(__result);
22232326}
22242327
22252328template <class _Tp, class _Compare, class _Allocator>
22262329template <class _Key>
2227typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
2330_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::const_iterator
2331__tree<_Tp, _Compare, _Allocator>::__upper_bound_multi(
22282332 const _Key& __v, __node_pointer __root, __end_node_pointer __result) const {
22292333 while (__root != nullptr) {
22302334 if (value_comp()(__v, __root->__get_value())) {
2231 __result = static_cast<__end_node_pointer>(__root);
2232 __root = static_cast<__node_pointer>(__root->__left_);
2335 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__root);
2336 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__left_);
22332337 } else
2234 __root = static_cast<__node_pointer>(__root->__right_);
2338 __root = std::__static_fancy_pointer_cast<__node_pointer>(__root->__right_);
22352339 }
22362340 return const_iterator(__result);
22372341}
22382342
22392343template <class _Tp, class _Compare, class _Allocator>
22402344template <class _Key>
2241pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
2242__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
2345_LIBCPP_CONSTEXPR_SINCE_CXX26
2346 pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
2347 __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
22432348 using _Pp = pair<iterator, iterator>;
22442349 __end_node_pointer __result = __end_node();
22452350 __node_pointer __rt = __root();
......@@ -2247,22 +2352,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) {
22472352 while (__rt != nullptr) {
22482353 auto __comp_res = __comp(__k, __rt->__get_value());
22492354 if (__comp_res.__less()) {
2250 __result = static_cast<__end_node_pointer>(__rt);
2251 __rt = static_cast<__node_pointer>(__rt->__left_);
2355 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
2356 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
22522357 } else if (__comp_res.__greater())
2253 __rt = static_cast<__node_pointer>(__rt->__right_);
2358 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
22542359 else
22552360 return _Pp(iterator(__rt),
2256 iterator(__rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2257 : __result));
2361 iterator(__rt->__right_ != nullptr
2362 ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2363 : __result));
22582364 }
22592365 return _Pp(iterator(__result), iterator(__result));
22602366}
22612367
22622368template <class _Tp, class _Compare, class _Allocator>
22632369template <class _Key>
2264pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
2265 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
2370_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
2371 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
22662372__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
22672373 using _Pp = pair<const_iterator, const_iterator>;
22682374 __end_node_pointer __result = __end_node();
......@@ -2271,23 +2377,25 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const {
22712377 while (__rt != nullptr) {
22722378 auto __comp_res = __comp(__k, __rt->__get_value());
22732379 if (__comp_res.__less()) {
2274 __result = static_cast<__end_node_pointer>(__rt);
2275 __rt = static_cast<__node_pointer>(__rt->__left_);
2380 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
2381 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
22762382 } else if (__comp_res.__greater())
2277 __rt = static_cast<__node_pointer>(__rt->__right_);
2383 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
22782384 else
22792385 return _Pp(
22802386 const_iterator(__rt),
2281 const_iterator(
2282 __rt->__right_ != nullptr ? static_cast<__end_node_pointer>(std::__tree_min(__rt->__right_)) : __result));
2387 const_iterator(__rt->__right_ != nullptr
2388 ? std::__static_fancy_pointer_cast<__end_node_pointer>(std::__tree_min(__rt->__right_))
2389 : __result));
22832390 }
22842391 return _Pp(const_iterator(__result), const_iterator(__result));
22852392}
22862393
22872394template <class _Tp, class _Compare, class _Allocator>
22882395template <class _Key>
2289pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
2290__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
2396_LIBCPP_CONSTEXPR_SINCE_CXX26
2397 pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator>
2398 __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
22912399 using _Pp = pair<iterator, iterator>;
22922400 __end_node_pointer __result = __end_node();
22932401 __node_pointer __rt = __root();
......@@ -2295,22 +2403,23 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) {
22952403 while (__rt != nullptr) {
22962404 auto __comp_res = __comp(__k, __rt->__get_value());
22972405 if (__comp_res.__less()) {
2298 __result = static_cast<__end_node_pointer>(__rt);
2299 __rt = static_cast<__node_pointer>(__rt->__left_);
2406 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
2407 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
23002408 } else if (__comp_res.__greater())
2301 __rt = static_cast<__node_pointer>(__rt->__right_);
2409 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
23022410 else
2303 return _Pp(
2304 __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2305 __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
2411 return _Pp(__lower_bound_multi(__k,
2412 std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
2413 std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
2414 __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
23062415 }
23072416 return _Pp(iterator(__result), iterator(__result));
23082417}
23092418
23102419template <class _Tp, class _Compare, class _Allocator>
23112420template <class _Key>
2312pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
2313 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
2421_LIBCPP_CONSTEXPR_SINCE_CXX26 pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
2422 typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
23142423__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
23152424 using _Pp = pair<const_iterator, const_iterator>;
23162425 __end_node_pointer __result = __end_node();
......@@ -2319,35 +2428,37 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const {
23192428 while (__rt != nullptr) {
23202429 auto __comp_res = __comp(__k, __rt->__get_value());
23212430 if (__comp_res.__less()) {
2322 __result = static_cast<__end_node_pointer>(__rt);
2323 __rt = static_cast<__node_pointer>(__rt->__left_);
2431 __result = std::__static_fancy_pointer_cast<__end_node_pointer>(__rt);
2432 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_);
23242433 } else if (__comp_res.__greater())
2325 __rt = static_cast<__node_pointer>(__rt->__right_);
2434 __rt = std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_);
23262435 else
2327 return _Pp(
2328 __lower_bound_multi(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__end_node_pointer>(__rt)),
2329 __upper_bound_multi(__k, static_cast<__node_pointer>(__rt->__right_), __result));
2436 return _Pp(__lower_bound_multi(__k,
2437 std::__static_fancy_pointer_cast<__node_pointer>(__rt->__left_),
2438 std::__static_fancy_pointer_cast<__end_node_pointer>(__rt)),
2439 __upper_bound_multi(__k, std::__static_fancy_pointer_cast<__node_pointer>(__rt->__right_), __result));
23302440 }
23312441 return _Pp(const_iterator(__result), const_iterator(__result));
23322442}
23332443
23342444template <class _Tp, class _Compare, class _Allocator>
2335typename __tree<_Tp, _Compare, _Allocator>::__node_holder
2445_LIBCPP_CONSTEXPR_SINCE_CXX26 typename __tree<_Tp, _Compare, _Allocator>::__node_holder
23362446__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT {
23372447 __node_pointer __np = __p.__get_np();
23382448 if (__begin_node_ == __p.__ptr_) {
23392449 if (__np->__right_ != nullptr)
2340 __begin_node_ = static_cast<__end_node_pointer>(__np->__right_);
2450 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__np->__right_);
23412451 else
2342 __begin_node_ = static_cast<__end_node_pointer>(__np->__parent_);
2452 __begin_node_ = std::__static_fancy_pointer_cast<__end_node_pointer>(__np->__parent_);
23432453 }
23442454 --__size_;
2345 std::__tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np));
2455 std::__tree_remove(__end_node()->__left_, std::__static_fancy_pointer_cast<__node_base_pointer>(__np));
23462456 return __node_holder(__np, _Dp(__node_alloc(), true));
23472457}
23482458
23492459template <class _Tp, class _Compare, class _Allocator>
2350inline _LIBCPP_HIDE_FROM_ABI void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
2460inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
2461swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y)
23512462 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
23522463 __x.swap(__y);
23532464}
lib/libcxx/include/__tuple/make_tuple_types.h deleted-80
......@@ -1,80 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H
10#define _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__fwd/array.h>
15#include <__fwd/tuple.h>
16#include <__tuple/tuple_element.h>
17#include <__tuple/tuple_indices.h>
18#include <__tuple/tuple_size.h>
19#include <__tuple/tuple_types.h>
20#include <__type_traits/copy_cvref.h>
21#include <__type_traits/remove_cvref.h>
22#include <__type_traits/remove_reference.h>
23
24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25# pragma GCC system_header
26#endif
27
28#ifndef _LIBCPP_CXX03_LANG
29
30_LIBCPP_BEGIN_NAMESPACE_STD
31
32// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
33// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
34// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
35// lvalue_reference type, then __tuple_types<_Types&...> is the result.
36
37template <class _TupleTypes, class _TupleIndices>
38struct __make_tuple_types_flat;
39
40template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
41struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
42 // Specialization for pair, tuple, and __tuple_types
43 template <class _Tp>
44 using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
45};
46
47template <class _Vt, size_t _Np, size_t... _Idx>
48struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
49 template <size_t>
50 using __value_type _LIBCPP_NODEBUG = _Vt;
51 template <class _Tp>
52 using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __value_type<_Idx>>...>;
53};
54
55template <class _Tp,
56 size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
57 size_t _Sp = 0,
58 bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)>
59struct __make_tuple_types {
60 static_assert(_Sp <= _Ep, "__make_tuple_types input error");
61 using _RawTp _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
62 using _Maker _LIBCPP_NODEBUG = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
63 using type _LIBCPP_NODEBUG = typename _Maker::template __apply_quals<_Tp>;
64};
65
66template <class... _Types, size_t _Ep>
67struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
68 using type _LIBCPP_NODEBUG = __tuple_types<_Types...>;
69};
70
71template <class... _Types, size_t _Ep>
72struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
73 using type _LIBCPP_NODEBUG = __tuple_types<_Types...>;
74};
75
76_LIBCPP_END_NAMESPACE_STD
77
78#endif // _LIBCPP_CXX03_LANG
79
80#endif // _LIBCPP___TUPLE_MAKE_TUPLE_TYPES_H
lib/libcxx/include/__tuple/sfinae_helpers.h+6-5
......@@ -15,10 +15,10 @@
1515# pragma GCC system_header
1616#endif
1717
18_LIBCPP_BEGIN_NAMESPACE_STD
19
2018#ifndef _LIBCPP_CXX03_LANG
2119
20_LIBCPP_BEGIN_NAMESPACE_STD
21
2222struct __check_tuple_constructor_fail {
2323 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_explicit_default() { return false; }
2424 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() { return false; }
......@@ -35,9 +35,8 @@ struct __check_tuple_constructor_fail {
3535 return false;
3636 }
3737};
38#endif // !defined(_LIBCPP_CXX03_LANG)
3938
40#if _LIBCPP_STD_VER >= 17
39# if _LIBCPP_STD_VER >= 17
4140
4241template <bool _CanCopy, bool _CanMove>
4342struct __sfinae_ctor_base {};
......@@ -92,8 +91,10 @@ struct __sfinae_assign_base<false, true> {
9291 __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete;
9392 __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default;
9493};
95#endif // _LIBCPP_STD_VER >= 17
94# endif // _LIBCPP_STD_VER >= 17
9695
9796_LIBCPP_END_NAMESPACE_STD
9897
98#endif // !defined(_LIBCPP_CXX03_LANG)
99
99100#endif // _LIBCPP___TUPLE_SFINAE_HELPERS_H
lib/libcxx/include/__tuple/tuple_indices.h deleted-37
......@@ -1,37 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
10#define _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__utility/integer_sequence.h>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20#ifndef _LIBCPP_CXX03_LANG
21
22_LIBCPP_BEGIN_NAMESPACE_STD
23
24template <size_t...>
25struct __tuple_indices {};
26
27template <size_t _Ep, size_t _Sp = 0>
28struct __make_tuple_indices {
29 static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
30 typedef __make_indices_imp<_Ep, _Sp> type;
31};
32
33_LIBCPP_END_NAMESPACE_STD
34
35#endif // _LIBCPP_CXX03_LANG
36
37#endif // _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
lib/libcxx/include/__tuple/tuple_like.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 20
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626template <class _Tp>
2727inline constexpr bool __is_ranges_subrange_v = false;
2828
......@@ -35,8 +35,8 @@ concept __tuple_like = __tuple_like_no_subrange<_Tp> || __is_ranges_subrange_v<r
3535// As of writing this comment every use of `pair-like` in the standard excludes `ranges::subrange`, so
3636// you most likely want to use `__pair_like_no_subrange` if you're looking for `pair-like`.
3737
38#endif // _LIBCPP_STD_VER >= 20
39
4038_LIBCPP_END_NAMESPACE_STD
4139
40#endif // _LIBCPP_STD_VER >= 20
41
4242#endif // _LIBCPP___TUPLE_TUPLE_LIKE_H
lib/libcxx/include/__tuple/tuple_like_ext.h deleted-52
......@@ -1,52 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
10#define _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__fwd/array.h>
15#include <__fwd/pair.h>
16#include <__fwd/tuple.h>
17#include <__tuple/tuple_types.h>
18#include <__type_traits/integral_constant.h>
19
20#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21# pragma GCC system_header
22#endif
23
24_LIBCPP_BEGIN_NAMESPACE_STD
25
26template <class _Tp>
27struct __tuple_like_ext : false_type {};
28
29template <class _Tp>
30struct __tuple_like_ext<const _Tp> : public __tuple_like_ext<_Tp> {};
31template <class _Tp>
32struct __tuple_like_ext<volatile _Tp> : public __tuple_like_ext<_Tp> {};
33template <class _Tp>
34struct __tuple_like_ext<const volatile _Tp> : public __tuple_like_ext<_Tp> {};
35
36#ifndef _LIBCPP_CXX03_LANG
37template <class... _Tp>
38struct __tuple_like_ext<tuple<_Tp...> > : true_type {};
39#endif
40
41template <class _T1, class _T2>
42struct __tuple_like_ext<pair<_T1, _T2> > : true_type {};
43
44template <class _Tp, size_t _Size>
45struct __tuple_like_ext<array<_Tp, _Size> > : true_type {};
46
47template <class... _Tp>
48struct __tuple_like_ext<__tuple_types<_Tp...> > : true_type {};
49
50_LIBCPP_END_NAMESPACE_STD
51
52#endif // _LIBCPP___TUPLE_TUPLE_LIKE_EXT_H
lib/libcxx/include/__tuple/tuple_like_no_subrange.h+4-4
......@@ -22,10 +22,10 @@
2222# pragma GCC system_header
2323#endif
2424
25_LIBCPP_BEGIN_NAMESPACE_STD
26
2725#if _LIBCPP_STD_VER >= 20
2826
27_LIBCPP_BEGIN_NAMESPACE_STD
28
2929template <class _Tp>
3030inline constexpr bool __tuple_like_no_subrange_impl = false;
3131
......@@ -54,8 +54,8 @@ concept __tuple_like_no_subrange = __tuple_like_no_subrange_impl<remove_cvref_t<
5454template <class _Tp>
5555concept __pair_like_no_subrange = __tuple_like_no_subrange<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2;
5656
57#endif // _LIBCPP_STD_VER >= 20
58
5957_LIBCPP_END_NAMESPACE_STD
6058
59#endif // _LIBCPP_STD_VER >= 20
60
6161#endif // _LIBCPP___TUPLE_TUPLE_LIKE_NO_SUBRANGE_H
lib/libcxx/include/__tuple/tuple_types.h deleted-25
......@@ -1,25 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TUPLE_TUPLE_TYPES_H
10#define _LIBCPP___TUPLE_TUPLE_TYPES_H
11
12#include <__config>
13
14#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15# pragma GCC system_header
16#endif
17
18_LIBCPP_BEGIN_NAMESPACE_STD
19
20template <class... _Tp>
21struct __tuple_types {};
22
23_LIBCPP_END_NAMESPACE_STD
24
25#endif // _LIBCPP___TUPLE_TUPLE_TYPES_H
lib/libcxx/include/__type_traits/add_pointer.h+3-28
......@@ -10,9 +10,6 @@
1010#define _LIBCPP___TYPE_TRAITS_ADD_POINTER_H
1111
1212#include <__config>
13#include <__type_traits/is_referenceable.h>
14#include <__type_traits/is_void.h>
15#include <__type_traits/remove_reference.h>
1613
1714#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1815# pragma GCC system_header
......@@ -20,40 +17,18 @@
2017
2118_LIBCPP_BEGIN_NAMESPACE_STD
2219
23#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS)
24
2520template <class _Tp>
2621struct _LIBCPP_NO_SPECIALIZATIONS add_pointer {
2722 using type _LIBCPP_NODEBUG = __add_pointer(_Tp);
2823};
2924
30# ifdef _LIBCPP_COMPILER_GCC
25#ifdef _LIBCPP_COMPILER_GCC
3126template <class _Tp>
3227using __add_pointer_t _LIBCPP_NODEBUG = typename add_pointer<_Tp>::type;
33# else
34template <class _Tp>
35using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp);
36# endif
37
3828#else
39template <class _Tp, bool = __is_referenceable_v<_Tp> || is_void<_Tp>::value>
40struct __add_pointer_impl {
41 using type _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tp>*;
42};
43template <class _Tp>
44struct __add_pointer_impl<_Tp, false> {
45 using type _LIBCPP_NODEBUG = _Tp;
46};
47
4829template <class _Tp>
49using __add_pointer_t = typename __add_pointer_impl<_Tp>::type;
50
51template <class _Tp>
52struct _LIBCPP_NO_SPECIALIZATIONS add_pointer {
53 using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>;
54};
55
56#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS)
30using __add_pointer_t _LIBCPP_NODEBUG = __add_pointer(_Tp);
31#endif
5732
5833#if _LIBCPP_STD_VER >= 14
5934template <class _Tp>
lib/libcxx/include/__type_traits/aligned_union.h+10-13
......@@ -19,25 +19,22 @@
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
22template <size_t _I0, size_t... _In>
23struct __static_max;
24
25template <size_t _I0>
26struct __static_max<_I0> {
27 static const size_t value = _I0;
22template <class _Arg0, class... _Args>
23union __union {
24 _ALIGNAS(_LIBCPP_PREFERRED_ALIGNOF(_Arg0)) _Arg0 __arg;
25 __union<_Args...> __u;
2826};
2927
30template <size_t _I0, size_t _I1, size_t... _In>
31struct __static_max<_I0, _I1, _In...> {
32 static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value;
28template <class _Arg>
29union __union<_Arg> {
30 _ALIGNAS(_LIBCPP_PREFERRED_ALIGNOF(_Arg)) _Arg __arg;
3331};
3432
3533template <size_t _Len, class _Type0, class... _Types>
3634struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_union {
37 static const size_t alignment_value =
38 __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0), _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value;
39 static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value;
40 typedef typename aligned_storage<__len, alignment_value>::type type;
35 using _Union _LIBCPP_NODEBUG = __union<char[_Len], _Type0, _Types...>;
36 static const size_t alignment_value = _LIBCPP_ALIGNOF(_Union);
37 using type _LIBCPP_NODEBUG = typename aligned_storage<sizeof(_Union), alignment_value>::type;
4138};
4239
4340#if _LIBCPP_STD_VER >= 14
lib/libcxx/include/__type_traits/can_extract_key.h deleted-53
......@@ -1,53 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H
10#define _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H
11
12#include <__config>
13#include <__fwd/pair.h>
14#include <__type_traits/conditional.h>
15#include <__type_traits/integral_constant.h>
16#include <__type_traits/is_same.h>
17#include <__type_traits/remove_const.h>
18#include <__type_traits/remove_const_ref.h>
19
20#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21# pragma GCC system_header
22#endif
23
24_LIBCPP_BEGIN_NAMESPACE_STD
25
26// These traits are used in __tree and __hash_table
27struct __extract_key_fail_tag {};
28struct __extract_key_self_tag {};
29struct __extract_key_first_tag {};
30
31template <class _ValTy, class _Key, class _RawValTy = __remove_const_ref_t<_ValTy> >
32struct __can_extract_key
33 : __conditional_t<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag> {};
34
35template <class _Pair, class _Key, class _First, class _Second>
36struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
37 : __conditional_t<_IsSame<__remove_const_t<_First>, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag> {
38};
39
40// __can_extract_map_key uses true_type/false_type instead of the tags.
41// It returns true if _Key != _ContainerValueTy (the container is a map not a set)
42// and _ValTy == _Key.
43template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = __remove_const_ref_t<_ValTy> >
44struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
45
46// This specialization returns __extract_key_fail_tag for non-map containers
47// because _Key == _ContainerValueTy
48template <class _ValTy, class _Key, class _RawValTy>
49struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {};
50
51_LIBCPP_END_NAMESPACE_STD
52
53#endif // _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H
lib/libcxx/include/__type_traits/common_reference.h+5-3
......@@ -24,10 +24,12 @@
2424# pragma GCC system_header
2525#endif
2626
27#if _LIBCPP_STD_VER >= 20
28
2729_LIBCPP_BEGIN_NAMESPACE_STD
2830
2931// common_reference
30#if _LIBCPP_STD_VER >= 20
32
3133// Let COND_RES(X, Y) be:
3234template <class _Xp, class _Yp>
3335using __cond_res _LIBCPP_NODEBUG = decltype(false ? std::declval<_Xp (&)()>()() : std::declval<_Yp (&)()>()());
......@@ -195,8 +197,8 @@ _LIBCPP_DIAGNOSTIC_POP
195197template <class...>
196198struct _LIBCPP_NO_SPECIALIZATIONS common_reference {};
197199
198#endif // _LIBCPP_STD_VER >= 20
199
200200_LIBCPP_END_NAMESPACE_STD
201201
202#endif // _LIBCPP_STD_VER >= 20
203
202204#endif // _LIBCPP___TYPE_TRAITS_COMMON_REFERENCE_H
lib/libcxx/include/__type_traits/conditional.h+2-12
......@@ -35,20 +35,10 @@ struct _IfImpl<false> {
3535template <bool _Cond, class _IfRes, class _ElseRes>
3636using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>;
3737
38template <bool _Bp, class _If, class _Then>
38template <bool _Bp, class _IfRes, class _ElseRes>
3939struct _LIBCPP_NO_SPECIALIZATIONS conditional {
40 using type _LIBCPP_NODEBUG = _If;
41};
42
43_LIBCPP_DIAGNOSTIC_PUSH
44#if __has_warning("-Winvalid-specialization")
45_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
46#endif
47template <class _If, class _Then>
48struct conditional<false, _If, _Then> {
49 using type _LIBCPP_NODEBUG = _Then;
40 using type _LIBCPP_NODEBUG = _If<_Bp, _IfRes, _ElseRes>;
5041};
51_LIBCPP_DIAGNOSTIC_POP
5242
5343#if _LIBCPP_STD_VER >= 14
5444template <bool _Bp, class _IfRes, class _ElseRes>
lib/libcxx/include/__type_traits/conjunction.h+1-1
......@@ -34,7 +34,7 @@ false_type __and_helper(...);
3434//
3535// However, `_And<_Pred...>` itself will evaluate its result immediately (without having to
3636// be instantiated) since it is an alias, unlike `conjunction<_Pred...>`, which is a struct.
37// If you want to defer the evaluation of `_And<_Pred...>` itself, use `_Lazy<_And, _Pred...>`.
37// If you want to defer the evaluation, use `conjunction{,_v}<_Pred...>`.
3838template <class... _Pred>
3939using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0));
4040
lib/libcxx/include/__type_traits/dependent_type.h deleted-25
......@@ -1,25 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H
10#define _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H
11
12#include <__config>
13
14#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15# pragma GCC system_header
16#endif
17
18_LIBCPP_BEGIN_NAMESPACE_STD
19
20template <class _Tp, bool>
21struct __dependent_type : public _Tp {};
22
23_LIBCPP_END_NAMESPACE_STD
24
25#endif // _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H
lib/libcxx/include/__type_traits/disjunction.h+1-2
......@@ -38,8 +38,7 @@ struct _OrImpl<false> {
3838//
3939// However, `_Or<_Pred...>` itself will evaluate its result immediately (without having to
4040// be instantiated) since it is an alias, unlike `disjunction<_Pred...>`, which is a struct.
41// If you want to defer the evaluation of `_Or<_Pred...>` itself, use `_Lazy<_Or, _Pred...>`
42// or `disjunction<_Pred...>` directly.
41// If you want to defer the evaluation , use `disjunction{,_v}<_Pred...>`.
4342template <class... _Args>
4443using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>;
4544
lib/libcxx/include/__type_traits/has_unique_object_representation.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 17
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323template <class _Tp>
2424struct _LIBCPP_NO_SPECIALIZATIONS has_unique_object_representations
2525 : integral_constant<bool, __has_unique_object_representations(_Tp)> {};
......@@ -28,8 +28,8 @@ template <class _Tp>
2828_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool has_unique_object_representations_v =
2929 __has_unique_object_representations(_Tp);
3030
31#endif
32
3331_LIBCPP_END_NAMESPACE_STD
3432
33#endif // _LIBCPP_STD_VER >= 17
34
3535#endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H
lib/libcxx/include/__type_traits/integer_traits.h+26-29
......@@ -10,6 +10,11 @@
1010#define _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
1111
1212#include <__config>
13#include <__type_traits/is_integral.h>
14#include <__type_traits/is_same.h>
15#include <__type_traits/is_signed.h>
16#include <__type_traits/is_unqualified.h>
17#include <__type_traits/is_unsigned.h>
1318
1419#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1520# pragma GCC system_header
......@@ -17,43 +22,35 @@
1722
1823_LIBCPP_BEGIN_NAMESPACE_STD
1924
20// This trait is to determine whether a type is a /signed integer type/
21// See [basic.fundamental]/p1
25// /signed integer type/ and /unsigned integer type/ per [basic.fundamental]
26// /p1-2: specific unqualified types plus extended integer types. bool and
27// character types are integral but excluded. cv-qualified versions are
28// distinct types ([basic.type.qualifier]) and so excluded.
29
2230template <class _Tp>
23inline const bool __is_signed_integer_v = false;
24template <>
25inline const bool __is_signed_integer_v<signed char> = true;
31inline const bool __is_character_v = false;
2632template <>
27inline const bool __is_signed_integer_v<signed short> = true;
33inline const bool __is_character_v<char> = true;
2834template <>
29inline const bool __is_signed_integer_v<signed int> = true;
35inline const bool __is_character_v<wchar_t> = true;
36#if _LIBCPP_HAS_CHAR8_T
3037template <>
31inline const bool __is_signed_integer_v<signed long> = true;
38inline const bool __is_character_v<char8_t> = true;
39#endif
3240template <>
33inline const bool __is_signed_integer_v<signed long long> = true;
34#if _LIBCPP_HAS_INT128
41inline const bool __is_character_v<char16_t> = true;
3542template <>
36inline const bool __is_signed_integer_v<__int128_t> = true;
37#endif
43inline const bool __is_character_v<char32_t> = true;
3844
39// This trait is to determine whether a type is an /unsigned integer type/
40// See [basic.fundamental]/p2
4145template <class _Tp>
42inline const bool __is_unsigned_integer_v = false;
43template <>
44inline const bool __is_unsigned_integer_v<unsigned char> = true;
45template <>
46inline const bool __is_unsigned_integer_v<unsigned short> = true;
47template <>
48inline const bool __is_unsigned_integer_v<unsigned int> = true;
49template <>
50inline const bool __is_unsigned_integer_v<unsigned long> = true;
51template <>
52inline const bool __is_unsigned_integer_v<unsigned long long> = true;
53#if _LIBCPP_HAS_INT128
54template <>
55inline const bool __is_unsigned_integer_v<__uint128_t> = true;
56#endif
46inline const bool __is_signed_integer_v =
47 is_integral<_Tp>::value && is_signed<_Tp>::value && !__is_character_v<_Tp> && !is_same<_Tp, bool>::value &&
48 __is_unqualified_v<_Tp>;
49
50template <class _Tp>
51inline const bool __is_unsigned_integer_v =
52 is_integral<_Tp>::value && is_unsigned<_Tp>::value && !__is_character_v<_Tp> && !is_same<_Tp, bool>::value &&
53 __is_unqualified_v<_Tp>;
5754
5855#if _LIBCPP_STD_VER >= 20
5956template <class _Tp>
lib/libcxx/include/__type_traits/integral_constant.h+1-1
......@@ -24,7 +24,7 @@ struct _LIBCPP_NO_SPECIALIZATIONS integral_constant {
2424 typedef integral_constant type;
2525 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; }
2626#if _LIBCPP_STD_VER >= 14
27 _LIBCPP_HIDE_FROM_ABI constexpr value_type operator()() const _NOEXCEPT { return value; }
27 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI constexpr value_type operator()() const _NOEXCEPT { return value; }
2828#endif
2929};
3030
lib/libcxx/include/__type_traits/is_bounded_array.h deleted-36
......@@ -1,36 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H
10#define _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H
11
12#include <__config>
13#include <__type_traits/integral_constant.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21template <class _Tp>
22inline const bool __is_bounded_array_v = __is_bounded_array(_Tp);
23
24#if _LIBCPP_STD_VER >= 20
25
26template <class _Tp>
27struct _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : bool_constant<__is_bounded_array(_Tp)> {};
28
29template <class _Tp>
30_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp);
31
32#endif
33
34_LIBCPP_END_NAMESPACE_STD
35
36#endif // _LIBCPP___TYPE_TRAITS_IS_BOUNDED_ARRAY_H
lib/libcxx/include/__type_traits/is_constant_evaluated.h+1-1
......@@ -18,7 +18,7 @@
1818_LIBCPP_BEGIN_NAMESPACE_STD
1919
2020#if _LIBCPP_STD_VER >= 20
21_LIBCPP_HIDE_FROM_ABI inline constexpr bool is_constant_evaluated() noexcept {
21[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_constant_evaluated() noexcept {
2222 return __builtin_is_constant_evaluated();
2323}
2424#endif
lib/libcxx/include/__type_traits/is_implicit_lifetime.h+4-2
......@@ -16,9 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19#if _LIBCPP_STD_VER >= 23
20
1921_LIBCPP_BEGIN_NAMESPACE_STD
2022
21#if _LIBCPP_STD_VER >= 23
2223# if __has_builtin(__builtin_is_implicit_lifetime)
2324
2425template <class _Tp>
......@@ -28,8 +29,9 @@ template <class _Tp>
2829_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Tp);
2930
3031# endif
31#endif
3232
3333_LIBCPP_END_NAMESPACE_STD
3434
35#endif // _LIBCPP_STD_VER >= 23
36
3537#endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICIT_LIFETIME_H
lib/libcxx/include/__type_traits/is_implicitly_default_constructible.h+4-2
......@@ -17,9 +17,10 @@
1717# pragma GCC system_header
1818#endif
1919
20#ifndef _LIBCPP_CXX03_LANG
21
2022_LIBCPP_BEGIN_NAMESPACE_STD
2123
22#ifndef _LIBCPP_CXX03_LANG
2324// First of all, we can't implement this check in C++03 mode because the {}
2425// default initialization syntax isn't valid.
2526// Second, we implement the trait in a funny manner with two defaulted template
......@@ -39,8 +40,9 @@ template <class _Tp>
3940struct __is_implicitly_default_constructible<_Tp,
4041 decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
4142 false_type> : false_type {};
42#endif // !C++03
4343
4444_LIBCPP_END_NAMESPACE_STD
4545
46#endif // _LIBCPP_CXX03_LANG
47
4648#endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
lib/libcxx/include/__type_traits/is_literal_type.h+4-2
......@@ -16,9 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
20
1921_LIBCPP_BEGIN_NAMESPACE_STD
2022
21#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
2223template <class _Tp>
2324struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type
2425 : integral_constant<bool, __is_literal_type(_Tp)> {};
......@@ -27,8 +28,9 @@ struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type
2728template <class _Tp>
2829_LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_literal_type_v = __is_literal_type(_Tp);
2930# endif // _LIBCPP_STD_VER >= 17
30#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
3131
3232_LIBCPP_END_NAMESPACE_STD
3333
34#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
35
3436#endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE
lib/libcxx/include/__type_traits/is_primary_template.h deleted-32
......@@ -1,32 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
10#define _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
11
12#include <__config>
13#include <__type_traits/enable_if.h>
14#include <__type_traits/is_same.h>
15#include <__type_traits/is_valid_expansion.h>
16
17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18# pragma GCC system_header
19#endif
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23template <class _Tp>
24using __test_for_primary_template _LIBCPP_NODEBUG =
25 __enable_if_t<_IsSame<_Tp, typename _Tp::__primary_template>::value>;
26
27template <class _Tp>
28using __is_primary_template _LIBCPP_NODEBUG = _IsValidExpansion<__test_for_primary_template, _Tp>;
29
30_LIBCPP_END_NAMESPACE_STD
31
32#endif // _LIBCPP___TYPE_TRAITS_IS_PRIMARY_TEMPLATE_H
lib/libcxx/include/__type_traits/is_referenceable.h deleted-34
......@@ -1,34 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
10#define _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
11
12#include <__config>
13#include <__type_traits/void_t.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21template <class _Tp, class = void>
22inline const bool __is_referenceable_v = false;
23
24template <class _Tp>
25inline const bool __is_referenceable_v<_Tp, __void_t<_Tp&> > = true;
26
27#if _LIBCPP_STD_VER >= 20
28template <class _Tp>
29concept __referenceable = __is_referenceable_v<_Tp>;
30#endif
31
32_LIBCPP_END_NAMESPACE_STD
33
34#endif // _LIBCPP___TYPE_TRAITS_IS_REFERENCEABLE_H
lib/libcxx/include/__type_traits/is_replaceable.h deleted-61
......@@ -1,61 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H
10#define _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H
11
12#include <__config>
13#include <__type_traits/enable_if.h>
14#include <__type_traits/integral_constant.h>
15#include <__type_traits/is_same.h>
16#include <__type_traits/is_trivially_copyable.h>
17
18#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19# pragma GCC system_header
20#endif
21
22_LIBCPP_BEGIN_NAMESPACE_STD
23
24// A type is replaceable if, with `x` and `y` being different objects, `x = std::move(y)` is equivalent to:
25//
26// std::destroy_at(&x)
27// std::construct_at(&x, std::move(y))
28//
29// This allows turning a move-assignment into a sequence of destroy + move-construct, which
30// is often more efficient. This is especially relevant when the move-construct is in fact
31// part of a trivial relocation from somewhere else, in which case there is a huge win.
32//
33// Note that this requires language support in order to be really effective, but we
34// currently emulate the base template with something very conservative.
35template <class _Tp, class = void>
36struct __is_replaceable : is_trivially_copyable<_Tp> {};
37
38template <class _Tp>
39struct __is_replaceable<_Tp, __enable_if_t<is_same<_Tp, typename _Tp::__replaceable>::value> > : true_type {};
40
41template <class _Tp>
42inline const bool __is_replaceable_v = __is_replaceable<_Tp>::value;
43
44// Determines whether an allocator member of a container is replaceable.
45//
46// First, we require the allocator type to be considered replaceable. If not, then something fishy might be
47// happening. Assuming the allocator type is replaceable, we conclude replaceability of the allocator as a
48// member of the container if the allocator always compares equal (in which case propagation doesn't matter),
49// or if the allocator always propagates on assignment, which is required in order for move construction and
50// assignment to be equivalent.
51template <class _AllocatorTraits>
52struct __container_allocator_is_replaceable
53 : integral_constant<bool,
54 __is_replaceable_v<typename _AllocatorTraits::allocator_type> &&
55 (_AllocatorTraits::is_always_equal::value ||
56 (_AllocatorTraits::propagate_on_container_move_assignment::value &&
57 _AllocatorTraits::propagate_on_container_copy_assignment::value))> {};
58
59_LIBCPP_END_NAMESPACE_STD
60
61#endif // _LIBCPP___TYPE_TRAITS_IS_REPLACEABLE_H
lib/libcxx/include/__type_traits/is_trivially_relocatable.h+4
......@@ -34,10 +34,14 @@ template <class _Tp, class = void>
3434struct __libcpp_is_trivially_relocatable : is_trivially_copyable<_Tp> {};
3535#endif
3636
37// __trivially_relocatable on libc++'s builtin types does not currently return the right answer with PFP
38// in tagged mode, in which the address of the pointer is used as part of the pointer encoding.
39#if !defined(__POINTER_FIELD_PROTECTION_TAGGED__)
3740template <class _Tp>
3841struct __libcpp_is_trivially_relocatable<_Tp,
3942 __enable_if_t<is_same<_Tp, typename _Tp::__trivially_relocatable>::value> >
4043 : true_type {};
44#endif
4145
4246_LIBCPP_END_NAMESPACE_STD
4347
lib/libcxx/include/__type_traits/is_unbounded_array.h deleted-38
......@@ -1,38 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H
10#define _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H
11
12#include <__config>
13#include <__type_traits/integral_constant.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21template <class>
22inline const bool __is_unbounded_array_v = false;
23template <class _Tp>
24inline const bool __is_unbounded_array_v<_Tp[]> = true;
25
26#if _LIBCPP_STD_VER >= 20
27
28template <class _Tp>
29struct _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : bool_constant<__is_unbounded_array_v<_Tp>> {};
30
31template <class _Tp>
32_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = __is_unbounded_array_v<_Tp>;
33
34#endif
35
36_LIBCPP_END_NAMESPACE_STD
37
38#endif // _LIBCPP___TYPE_TRAITS_IS_UNBOUNDED_ARRAY_H
lib/libcxx/include/__type_traits/is_valid_expansion.h deleted-31
......@@ -1,31 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H
10#define _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H
11
12#include <__config>
13#include <__type_traits/integral_constant.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21template <template <class...> class _Templ, class... _Args, class = _Templ<_Args...> >
22true_type __sfinae_test_impl(int);
23template <template <class...> class, class...>
24false_type __sfinae_test_impl(...);
25
26template <template <class...> class _Templ, class... _Args>
27using _IsValidExpansion _LIBCPP_NODEBUG = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
28
29_LIBCPP_END_NAMESPACE_STD
30
31#endif // _LIBCPP___TYPE_TRAITS_IS_VALID_EXPANSION_H
lib/libcxx/include/__type_traits/is_within_lifetime.h+1-1
......@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
1919
2020#if _LIBCPP_STD_VER >= 26 && __has_builtin(__builtin_is_within_lifetime)
2121template <class _Tp>
22_LIBCPP_HIDE_FROM_ABI consteval bool is_within_lifetime(const _Tp* __p) noexcept {
22[[nodiscard]] _LIBCPP_HIDE_FROM_ABI consteval bool is_within_lifetime(const _Tp* __p) noexcept {
2323 return __builtin_is_within_lifetime(__p);
2424}
2525#endif
lib/libcxx/include/__type_traits/lazy.h deleted-25
......@@ -1,25 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___TYPE_TRAITS_LAZY_H
10#define _LIBCPP___TYPE_TRAITS_LAZY_H
11
12#include <__config>
13
14#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15# pragma GCC system_header
16#endif
17
18_LIBCPP_BEGIN_NAMESPACE_STD
19
20template <template <class...> class _Func, class... _Args>
21struct _Lazy : _Func<_Args...> {};
22
23_LIBCPP_END_NAMESPACE_STD
24
25#endif // _LIBCPP___TYPE_TRAITS_LAZY_H
lib/libcxx/include/__type_traits/make_transparent.h+13-11
......@@ -22,29 +22,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2222
2323// __make_transparent tries to create a transparent comparator from its non-transparent counterpart, e.g. obtain
2424// `less<>` from `less<T>`. This is useful in cases where conversions can be avoided (e.g. a string literal to a
25// std::string).
25// std::string). This depends on the argument type provided to the comparator, because a comparator might be
26// transparent for some argument types but not for others.
2627
27template <class _Tp, class _Comparator>
28template <class _ArgumentType, class _Comparator>
2829struct __make_transparent {
2930 using type _LIBCPP_NODEBUG = _Comparator;
3031};
3132
32template <class _Tp, class _Comparator>
33using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_Tp, _Comparator>::type;
33template <class _ArgumentType, class _Comparator>
34using __make_transparent_t _LIBCPP_NODEBUG = typename __make_transparent<_ArgumentType, _Comparator>::type;
3435
35template <class _Tp,
36template <class _ArgumentType,
3637 class _Comparator,
37 __enable_if_t<is_same<_Comparator, __make_transparent_t<_Tp, _Comparator> >::value, int> = 0>
38_LIBCPP_HIDE_FROM_ABI _Comparator& __as_transparent(_Comparator& __comp) {
38 __enable_if_t<is_same<_Comparator, __make_transparent_t<_ArgumentType, _Comparator> >::value, int> = 0>
39_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Comparator& __as_transparent(_Comparator& __comp) {
3940 return __comp;
4041}
4142
42template <class _Tp,
43template <class _ArgumentType,
4344 class _Comparator,
44 __enable_if_t<!is_same<_Comparator, __make_transparent_t<_Tp, _Comparator> >::value, int> = 0>
45_LIBCPP_HIDE_FROM_ABI __make_transparent_t<_Tp, _Comparator> __as_transparent(_Comparator&) {
45 __enable_if_t<!is_same<_Comparator, __make_transparent_t<_ArgumentType, _Comparator> >::value, int> = 0>
46_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __make_transparent_t<_ArgumentType, _Comparator>
47__as_transparent(_Comparator&) {
4648 static_assert(is_empty<_Comparator>::value);
47 return __make_transparent_t<_Tp, _Comparator>();
49 return __make_transparent_t<_ArgumentType, _Comparator>();
4850}
4951
5052_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__type_traits/rank.h+1-21
......@@ -19,32 +19,12 @@
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
2121
22#if __has_builtin(__array_rank) && !defined(_LIBCPP_COMPILER_CLANG_BASED) || \
23 (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2001)
24
2522template <class _Tp>
2623struct _LIBCPP_NO_SPECIALIZATIONS rank : integral_constant<size_t, __array_rank(_Tp)> {};
2724
28#else
29
30template <class _Tp>
31struct _LIBCPP_NO_SPECIALIZATIONS rank : public integral_constant<size_t, 0> {};
32
33_LIBCPP_DIAGNOSTIC_PUSH
34# if __has_warning("-Winvalid-specialization")
35_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
36# endif
37template <class _Tp>
38struct rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
39template <class _Tp, size_t _Np>
40struct rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
41_LIBCPP_DIAGNOSTIC_POP
42
43#endif // __has_builtin(__array_rank)
44
4525#if _LIBCPP_STD_VER >= 17
4626template <class _Tp>
47_LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t rank_v = rank<_Tp>::value;
27_LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t rank_v = __array_rank(_Tp);
4828#endif
4929
5030_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__type_traits/reference_converts_from_temporary.h+4-4
......@@ -16,10 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if _LIBCPP_STD_VER >= 23
2220
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2323template <class _Tp, class _Up>
2424struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary
2525 : public bool_constant<__reference_converts_from_temporary(_Tp, _Up)> {};
......@@ -28,8 +28,8 @@ template <class _Tp, class _Up>
2828_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool reference_converts_from_temporary_v =
2929 __reference_converts_from_temporary(_Tp, _Up);
3030
31#endif
32
3331_LIBCPP_END_NAMESPACE_STD
3432
33#endif // _LIBCPP_STD_VER >= 23
34
3535#endif // _LIBCPP___TYPE_TRAITS_REFERENCE_CONVERTS_FROM_TEMPORARY_H
lib/libcxx/include/__type_traits/remove_pointer.h+3-16
......@@ -17,31 +17,18 @@
1717
1818_LIBCPP_BEGIN_NAMESPACE_STD
1919
20#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
2120template <class _Tp>
2221struct _LIBCPP_NO_SPECIALIZATIONS remove_pointer {
2322 using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
2423};
2524
26# ifdef _LIBCPP_COMPILER_GCC
25#ifdef _LIBCPP_COMPILER_GCC
2726template <class _Tp>
2827using __remove_pointer_t _LIBCPP_NODEBUG = typename remove_pointer<_Tp>::type;
29# else
30template <class _Tp>
31using __remove_pointer_t _LIBCPP_NODEBUG = __remove_pointer(_Tp);
32# endif
3328#else
34// clang-format off
35template <class _Tp> struct remove_pointer {using type _LIBCPP_NODEBUG = _Tp;};
36template <class _Tp> struct remove_pointer<_Tp*> {using type _LIBCPP_NODEBUG = _Tp;};
37template <class _Tp> struct remove_pointer<_Tp* const> {using type _LIBCPP_NODEBUG = _Tp;};
38template <class _Tp> struct remove_pointer<_Tp* volatile> {using type _LIBCPP_NODEBUG = _Tp;};
39template <class _Tp> struct remove_pointer<_Tp* const volatile> {using type _LIBCPP_NODEBUG = _Tp;};
40// clang-format on
41
4229template <class _Tp>
43using __remove_pointer_t = typename remove_pointer<_Tp>::type;
44#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
30using __remove_pointer_t _LIBCPP_NODEBUG = __remove_pointer(_Tp);
31#endif
4532
4633#if _LIBCPP_STD_VER >= 14
4734template <class _Tp>
lib/libcxx/include/__type_traits/result_of.h+6-4
......@@ -16,18 +16,19 @@
1616# pragma GCC system_header
1717#endif
1818
19#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
20
1921_LIBCPP_BEGIN_NAMESPACE_STD
2022
2123// result_of
2224
23#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
2425template <class _Callable>
2526struct _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS result_of;
2627
2728_LIBCPP_DIAGNOSTIC_PUSH
28#if __has_warning("-Winvalid-specialization")
29# if __has_warning("-Winvalid-specialization")
2930_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
30#endif
31# endif
3132template <class _Fp, class... _Args>
3233struct result_of<_Fp(_Args...)> : __invoke_result<_Fp, _Args...> {};
3334_LIBCPP_DIAGNOSTIC_POP
......@@ -36,8 +37,9 @@ _LIBCPP_DIAGNOSTIC_POP
3637template <class _Tp>
3738using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
3839# endif // _LIBCPP_STD_VER >= 14
39#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
4040
4141_LIBCPP_END_NAMESPACE_STD
4242
43#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
44
4345#endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H
lib/libcxx/include/__type_traits/strip_signature.h+3
......@@ -74,6 +74,9 @@ template<class _Rp, class _Gp, class ..._Ap>
7474struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type _LIBCPP_NODEBUG = _Rp(_Ap...); };
7575// clang-format on
7676
77template <class _Fp>
78using __strip_signature_t _LIBCPP_NODEBUG = typename __strip_signature<_Fp>::type;
79
7780_LIBCPP_END_NAMESPACE_STD
7881
7982#endif // _LIBCPP_STD_VER >= 17
lib/libcxx/include/__utility/as_const.h+4-2
......@@ -15,9 +15,10 @@
1515# pragma GCC system_header
1616#endif
1717
18#if _LIBCPP_STD_VER >= 17
19
1820_LIBCPP_BEGIN_NAMESPACE_STD
1921
20#if _LIBCPP_STD_VER >= 17
2122template <class _Tp>
2223[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& as_const(_Tp& __t) noexcept {
2324 return __t;
......@@ -25,8 +26,9 @@ template <class _Tp>
2526
2627template <class _Tp>
2728void as_const(const _Tp&&) = delete;
28#endif
2929
3030_LIBCPP_END_NAMESPACE_STD
3131
32#endif // _LIBCPP_STD_VER >= 17
33
3234#endif // _LIBCPP___UTILITY_AS_CONST_H
lib/libcxx/include/__utility/constant_wrapper.h created+326
......@@ -0,0 +1,326 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___UTILITY_CONSTANT_WRAPPER_H
10#define _LIBCPP___UTILITY_CONSTANT_WRAPPER_H
11
12#include <__config>
13#include <__cstddef/size_t.h>
14#include <__functional/invoke.h>
15#include <__type_traits/invoke.h>
16#include <__type_traits/is_constructible.h>
17#include <__type_traits/is_same.h>
18#include <__type_traits/remove_cvref.h>
19#include <__utility/declval.h>
20#include <__utility/forward.h>
21#include <__utility/integer_sequence.h>
22
23#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24# pragma GCC system_header
25#endif
26
27_LIBCPP_BEGIN_NAMESPACE_STD
28
29#if _LIBCPP_STD_VER >= 26
30
31template <auto _Xp, class = remove_cvref_t<decltype(_Xp)>>
32struct constant_wrapper;
33
34template <class _Tp>
35concept __constexpr_param = requires { typename constant_wrapper<_Tp::value>; };
36
37template <auto _Xp>
38constexpr auto cw = constant_wrapper<_Xp>{};
39
40struct __cw_operators {
41 // unary operators
42 template <__constexpr_param _Tp>
43 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator+(_Tp) noexcept -> constant_wrapper<(+_Tp::value)> {
44 return {};
45 }
46 template <__constexpr_param _Tp>
47 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator-(_Tp) noexcept -> constant_wrapper<(-_Tp::value)> {
48 return {};
49 }
50 template <__constexpr_param _Tp>
51 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator~(_Tp) noexcept -> constant_wrapper<(~_Tp::value)> {
52 return {};
53 }
54 template <__constexpr_param _Tp>
55 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator!(_Tp) noexcept -> constant_wrapper<(!_Tp::value)> {
56 return {};
57 }
58 template <__constexpr_param _Tp>
59 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&(_Tp) noexcept -> constant_wrapper<(&_Tp::value)> {
60 return {};
61 }
62 template <__constexpr_param _Tp>
63 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator*(_Tp) noexcept -> constant_wrapper<(*_Tp::value)> {
64 return {};
65 }
66
67 // binary operators
68 template <__constexpr_param _Lp, __constexpr_param _Rp>
69 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator+(_Lp, _Rp) noexcept
70 -> constant_wrapper<(_Lp::value + _Rp::value)> {
71 return {};
72 }
73 template <__constexpr_param _Lp, __constexpr_param _Rp>
74 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator-(_Lp, _Rp) noexcept
75 -> constant_wrapper<(_Lp::value - _Rp::value)> {
76 return {};
77 }
78 template <__constexpr_param _Lp, __constexpr_param _Rp>
79 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator*(_Lp, _Rp) noexcept
80 -> constant_wrapper<(_Lp::value * _Rp::value)> {
81 return {};
82 }
83 template <__constexpr_param _Lp, __constexpr_param _Rp>
84 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator/(_Lp, _Rp) noexcept
85 -> constant_wrapper<(_Lp::value / _Rp::value)> {
86 return {};
87 }
88 template <__constexpr_param _Lp, __constexpr_param _Rp>
89 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator%(_Lp, _Rp) noexcept
90 -> constant_wrapper<(_Lp::value % _Rp::value)> {
91 return {};
92 }
93
94 template <__constexpr_param _Lp, __constexpr_param _Rp>
95 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<<(_Lp, _Rp) noexcept
96 -> constant_wrapper<(_Lp::value << _Rp::value)> {
97 return {};
98 }
99 template <__constexpr_param _Lp, __constexpr_param _Rp>
100 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>>(_Lp, _Rp) noexcept
101 -> constant_wrapper<(_Lp::value >> _Rp::value)> {
102 return {};
103 }
104 template <__constexpr_param _Lp, __constexpr_param _Rp>
105 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&(_Lp, _Rp) noexcept
106 -> constant_wrapper<(_Lp::value & _Rp::value)> {
107 return {};
108 }
109 template <__constexpr_param _Lp, __constexpr_param _Rp>
110 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator|(_Lp, _Rp) noexcept
111 -> constant_wrapper<(_Lp::value | _Rp::value)> {
112 return {};
113 }
114 template <__constexpr_param _Lp, __constexpr_param _Rp>
115 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator^(_Lp, _Rp) noexcept
116 -> constant_wrapper<(_Lp::value ^ _Rp::value)> {
117 return {};
118 }
119
120 template <__constexpr_param _Lp, __constexpr_param _Rp>
121 requires(!is_constructible_v<bool, decltype(_Lp::value)> || !is_constructible_v<bool, decltype(_Rp::value)>)
122 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator&&(_Lp, _Rp) noexcept
123 -> constant_wrapper<(_Lp::value && _Rp::value)> {
124 return {};
125 }
126 template <__constexpr_param _Lp, __constexpr_param _Rp>
127 requires(!is_constructible_v<bool, decltype(_Lp::value)> || !is_constructible_v<bool, decltype(_Rp::value)>)
128 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator||(_Lp, _Rp) noexcept
129 -> constant_wrapper<(_Lp::value || _Rp::value)> {
130 return {};
131 }
132
133 // comparisons
134 template <__constexpr_param _Lp, __constexpr_param _Rp>
135 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(_Lp, _Rp) noexcept
136 -> constant_wrapper<(_Lp::value <=> _Rp::value)> {
137 return {};
138 }
139 template <__constexpr_param _Lp, __constexpr_param _Rp>
140 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<(_Lp, _Rp) noexcept
141 -> constant_wrapper<(_Lp::value < _Rp::value)> {
142 return {};
143 }
144 template <__constexpr_param _Lp, __constexpr_param _Rp>
145 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=(_Lp, _Rp) noexcept
146 -> constant_wrapper<(_Lp::value <= _Rp::value)> {
147 return {};
148 }
149 template <__constexpr_param _Lp, __constexpr_param _Rp>
150 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator==(_Lp, _Rp) noexcept
151 -> constant_wrapper<(_Lp::value == _Rp::value)> {
152 return {};
153 }
154 template <__constexpr_param _Lp, __constexpr_param _Rp>
155 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator!=(_Lp, _Rp) noexcept
156 -> constant_wrapper<(_Lp::value != _Rp::value)> {
157 return {};
158 }
159 template <__constexpr_param _Lp, __constexpr_param _Rp>
160 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>(_Lp, _Rp) noexcept
161 -> constant_wrapper<(_Lp::value > _Rp::value)> {
162 return {};
163 }
164 template <__constexpr_param _Lp, __constexpr_param _Rp>
165 _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator>=(_Lp, _Rp) noexcept
166 -> constant_wrapper<(_Lp::value >= _Rp::value)> {
167 return {};
168 }
169
170 template <__constexpr_param _Lp, __constexpr_param _Rp>
171 friend auto operator,(_Lp, _Rp) = delete;
172
173 template <__constexpr_param _Lp, __constexpr_param _Rp>
174 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator->*(_Lp, _Rp) noexcept
175 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
176 -> constant_wrapper<auto(_Lp::value->*_Rp::value)> {
177 return {};
178 }
179
180 // pseudo-mutators
181 template <__constexpr_param _Tp>
182 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(this _Tp) noexcept -> constant_wrapper<(++_Tp::value)> {
183 return {};
184 }
185 template <__constexpr_param _Tp>
186 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(this _Tp, int) noexcept
187 -> constant_wrapper<(_Tp::value++)> {
188 return {};
189 }
190 template <__constexpr_param _Tp>
191 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator--(this _Tp) noexcept -> constant_wrapper<(--_Tp::value)> {
192 return {};
193 }
194 template <__constexpr_param _Tp>
195 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator--(this _Tp, int) noexcept
196 -> constant_wrapper<(_Tp::value--)> {
197 return {};
198 }
199
200 template <__constexpr_param _Tp, __constexpr_param _Rp>
201 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator+=(this _Tp, _Rp) noexcept
202 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
203 -> constant_wrapper<auto(_Tp::value += _Rp::value)> {
204 return {};
205 }
206 template <__constexpr_param _Tp, __constexpr_param _Rp>
207 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator-=(this _Tp, _Rp) noexcept
208 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
209 -> constant_wrapper<auto(_Tp::value -= _Rp::value)> {
210 return {};
211 }
212 template <__constexpr_param _Tp, __constexpr_param _Rp>
213 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator*=(this _Tp, _Rp) noexcept
214 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
215 -> constant_wrapper<auto(_Tp::value *= _Rp::value)> {
216 return {};
217 }
218 template <__constexpr_param _Tp, __constexpr_param _Rp>
219 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator/=(this _Tp, _Rp) noexcept
220 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
221 -> constant_wrapper<auto(_Tp::value /= _Rp::value)> {
222 return {};
223 }
224 template <__constexpr_param _Tp, __constexpr_param _Rp>
225 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator%=(this _Tp, _Rp) noexcept
226 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
227 -> constant_wrapper<auto(_Tp::value %= _Rp::value)> {
228 return {};
229 }
230 template <__constexpr_param _Tp, __constexpr_param _Rp>
231 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator&=(this _Tp, _Rp) noexcept
232 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
233 -> constant_wrapper<auto(_Tp::value &= _Rp::value)> {
234 return {};
235 }
236 template <__constexpr_param _Tp, __constexpr_param _Rp>
237 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator|=(this _Tp, _Rp) noexcept
238 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
239 -> constant_wrapper<auto(_Tp::value |= _Rp::value)> {
240 return {};
241 }
242 template <__constexpr_param _Tp, __constexpr_param _Rp>
243 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator^=(this _Tp, _Rp) noexcept
244 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
245 -> constant_wrapper<auto(_Tp::value ^= _Rp::value)> {
246 return {};
247 }
248 template <__constexpr_param _Tp, __constexpr_param _Rp>
249 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator<<=(this _Tp, _Rp) noexcept
250 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
251 -> constant_wrapper<auto(_Tp::value <<= _Rp::value)> {
252 return {};
253 }
254 template <__constexpr_param _Tp, __constexpr_param _Rp>
255 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator>>=(this _Tp, _Rp) noexcept
256 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
257 -> constant_wrapper<auto(_Tp::value >>= _Rp::value)> {
258 return {};
259 }
260};
261
262template <const auto& _Callable, class... _Args>
263concept __constexpr_callable = (__constexpr_param<remove_cvref_t<_Args>> && ...) && requires {
264 typename constant_wrapper<std::invoke(_Callable, remove_cvref_t<_Args>::value...)>;
265};
266
267template <const auto& _Obj, class... _Args>
268concept __constexpr_indexable = (__constexpr_param<remove_cvref_t<_Args>> && ...) && requires {
269 typename constant_wrapper<auto(_Obj[remove_cvref_t<_Args>::value...])>;
270};
271
272template <auto _Xp, class _Tp>
273struct constant_wrapper : __cw_operators {
274 static constexpr decltype((_Xp)) value = (_Xp);
275
276 using type = constant_wrapper;
277 using value_type = decltype(_Xp);
278
279 static_assert(is_same_v<_Tp, value_type>,
280 "the second template parameter of std::constant_wrapper must be its value_type");
281
282 template <__constexpr_param _Rp>
283 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator=(_Rp) const noexcept
284 // TODO: Remove `auto` when all support versions of Clang have https://llvm.org/PR202693 fixed.
285 -> constant_wrapper<auto(value = _Rp::value)> {
286 return {};
287 }
288
289 _LIBCPP_HIDE_FROM_ABI constexpr operator decltype(value)() const noexcept { return value; }
290
291 template <class... _Args>
292 requires __constexpr_callable<value, _Args...>
293 [[nodiscard]]
294 _LIBCPP_HIDE_FROM_ABI static constexpr constant_wrapper<std::invoke(value, remove_cvref_t<_Args>::value...)>
295 operator()(_Args&&...) noexcept {
296 return {};
297 }
298
299 template <class... _Args>
300 requires(!__constexpr_callable<value, _Args...> && is_invocable_v<const value_type&, _Args && ...>)
301 _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
302 operator()(_Args&&... __args) noexcept(noexcept(std::invoke(value, std::forward<_Args>(__args)...))) {
303 return std::invoke(value, std::forward<_Args>(__args)...);
304 }
305
306 template <class... _Args>
307 requires __constexpr_indexable<value, _Args...>
308 [[nodiscard]]
309 _LIBCPP_HIDE_FROM_ABI static constexpr constant_wrapper<auto(value[remove_cvref_t<_Args>::value...])>
310 operator[](_Args&&...) noexcept {
311 return {};
312 }
313
314 template <class... _Args>
315 requires(!__constexpr_indexable<value, _Args...> && requires { value[std::declval<_Args>()...]; })
316 _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto)
317 operator[](_Args&&... __args) noexcept(noexcept(value[std::forward<_Args>(__args)...])) {
318 return value[std::forward<_Args>(__args)...];
319 }
320};
321
322#endif // _LIBCPP_STD_VER >= 26
323
324_LIBCPP_END_NAMESPACE_STD
325
326#endif // _LIBCPP___UTILITY_CONSTANT_WRAPPER_H
lib/libcxx/include/__utility/default_three_way_comparator.h+2-2
......@@ -31,7 +31,7 @@ template <class _LHS, class _RHS>
3131struct __default_three_way_comparator<_LHS,
3232 _RHS,
3333 __enable_if_t<is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value> > {
34 _LIBCPP_HIDE_FROM_ABI static int operator()(_LHS __lhs, _RHS __rhs) {
34 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static int operator()(_LHS __lhs, _RHS __rhs) {
3535 if (__lhs < __rhs)
3636 return -1;
3737 if (__lhs > __rhs)
......@@ -47,7 +47,7 @@ struct __default_three_way_comparator<
4747 _RHS,
4848 __enable_if_t<!(is_arithmetic<_LHS>::value && is_arithmetic<_RHS>::value) &&
4949 __builtin_lt_synthesizes_from_spaceship(const _LHS&, const _RHS&)>> {
50 _LIBCPP_HIDE_FROM_ABI static int operator()(const _LHS& __lhs, const _RHS& __rhs) {
50 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static int operator()(const _LHS& __lhs, const _RHS& __rhs) {
5151 auto __res = __lhs <=> __rhs;
5252 if (__res < 0)
5353 return -1;
lib/libcxx/include/__utility/exchange.h+14-3
......@@ -10,6 +10,9 @@
1010#define _LIBCPP___UTILITY_EXCHANGE_H
1111
1212#include <__config>
13#include <__type_traits/enable_if.h>
14#include <__type_traits/is_assignable.h>
15#include <__type_traits/is_constructible.h>
1316#include <__type_traits/is_nothrow_assignable.h>
1417#include <__type_traits/is_nothrow_constructible.h>
1518#include <__utility/forward.h>
......@@ -24,14 +27,22 @@ _LIBCPP_PUSH_MACROS
2427
2528_LIBCPP_BEGIN_NAMESPACE_STD
2629
27#if _LIBCPP_STD_VER >= 14
2830template <class _T1, class _T2 = _T1>
29inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
30 is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
31[[__nodiscard__]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1
32__exchange(_T1& __obj, _T2&& __new_value)
33 _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value&& is_nothrow_assignable<_T1&, _T2>::value) {
3134 _T1 __old_value = std::move(__obj);
3235 __obj = std::forward<_T2>(__new_value);
3336 return __old_value;
3437}
38
39#if _LIBCPP_STD_VER >= 14
40template <class _T1, class _T2 = _T1>
41[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
42_LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
43 is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
44 return std::__exchange(__obj, std::forward<_T2>(__new_value));
45}
3546#endif // _LIBCPP_STD_VER >= 14
3647
3748_LIBCPP_END_NAMESPACE_STD
lib/libcxx/include/__utility/forward_like.h+4-4
......@@ -21,10 +21,10 @@
2121# pragma GCC system_header
2222#endif
2323
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2624#if _LIBCPP_STD_VER >= 23
2725
26_LIBCPP_BEGIN_NAMESPACE_STD
27
2828template <class _Ap, class _Bp>
2929using _CopyConst _LIBCPP_NODEBUG = _If<is_const_v<_Ap>, const _Bp, _Bp>;
3030
......@@ -56,8 +56,8 @@ __forward_as(_LIBCPP_LIFETIMEBOUND _Up&& __val) noexcept {
5656 return static_cast<_ForwardLike<_Tp, _As>>(__val);
5757}
5858
59#endif // _LIBCPP_STD_VER >= 23
60
6159_LIBCPP_END_NAMESPACE_STD
6260
61#endif // _LIBCPP_STD_VER >= 23
62
6363#endif // _LIBCPP___UTILITY_FORWARD_LIKE_H
lib/libcxx/include/__utility/in_place.h+4-4
......@@ -18,10 +18,10 @@
1818# pragma GCC system_header
1919#endif
2020
21_LIBCPP_BEGIN_NAMESPACE_STD
22
2321#if _LIBCPP_STD_VER >= 17
2422
23_LIBCPP_BEGIN_NAMESPACE_STD
24
2525struct in_place_t {
2626 explicit in_place_t() = default;
2727};
......@@ -57,8 +57,8 @@ struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
5757template <class _Tp>
5858using __is_inplace_index _LIBCPP_NODEBUG = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
5959
60#endif // _LIBCPP_STD_VER >= 17
61
6260_LIBCPP_END_NAMESPACE_STD
6361
62#endif // _LIBCPP_STD_VER >= 17
63
6464#endif // _LIBCPP___UTILITY_IN_PLACE_H
lib/libcxx/include/__utility/is_pointer_in_range.h+6-6
......@@ -12,12 +12,12 @@
1212#include <__algorithm/comp.h>
1313#include <__assert>
1414#include <__config>
15#include <__memory/valid_range.h>
1516#include <__type_traits/enable_if.h>
1617#include <__type_traits/integral_constant.h>
1718#include <__type_traits/is_constant_evaluated.h>
1819#include <__type_traits/void_t.h>
1920#include <__utility/declval.h>
20#include <__utility/is_valid_range.h>
2121
2222#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2323# pragma GCC system_header
......@@ -26,13 +26,13 @@
2626_LIBCPP_BEGIN_NAMESPACE_STD
2727
2828template <class _Tp, class _Up, class = void>
29struct __is_less_than_comparable : false_type {};
29inline const bool __is_less_than_comparable_v = false;
3030
3131template <class _Tp, class _Up>
32struct __is_less_than_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() < std::declval<_Up>())> > : true_type {
33};
32inline const bool
33 __is_less_than_comparable_v<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() < std::declval<_Up>())> > = true;
3434
35template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
35template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable_v<const _Tp*, const _Up*>, int> = 0>
3636_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
3737__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
3838 _LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__begin, __end), "[__begin, __end) is not a valid range");
......@@ -47,7 +47,7 @@ __is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
4747 return !__less<>()(__ptr, __begin) && __less<>()(__ptr, __end);
4848}
4949
50template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
50template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable_v<const _Tp*, const _Up*>, int> = 0>
5151_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
5252__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
5353 if (__libcpp_is_constant_evaluated())
lib/libcxx/include/__utility/is_valid_range.h deleted-37
......@@ -1,37 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___UTILITY_IS_VALID_RANGE_H
10#define _LIBCPP___UTILITY_IS_VALID_RANGE_H
11
12#include <__algorithm/comp.h>
13#include <__config>
14#include <__type_traits/is_constant_evaluated.h>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20_LIBCPP_BEGIN_NAMESPACE_STD
21
22template <class _Tp>
23_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
24__is_valid_range(const _Tp* __first, const _Tp* __last) {
25 if (__libcpp_is_constant_evaluated()) {
26 // If this is not a constant during constant evaluation, that is because __first and __last are not
27 // part of the same allocation. If they are part of the same allocation, we must still make sure they
28 // are ordered properly.
29 return __builtin_constant_p(__first <= __last) && __first <= __last;
30 }
31
32 return !__less<>()(__last, __first);
33}
34
35_LIBCPP_END_NAMESPACE_STD
36
37#endif // _LIBCPP___UTILITY_IS_VALID_RANGE_H
lib/libcxx/include/__utility/lazy_synth_three_way_comparator.h+18-15
......@@ -35,20 +35,20 @@ struct __lazy_compare_result {
3535 const _LHS& __lhs_;
3636 const _RHS& __rhs_;
3737
38 _LIBCPP_HIDE_FROM_ABI
39 __lazy_compare_result(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp,
40 _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs,
41 _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs)
38 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result(
39 _LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp,
40 _LIBCPP_CTOR_LIFETIMEBOUND const _LHS& __lhs,
41 _LIBCPP_CTOR_LIFETIMEBOUND const _RHS& __rhs)
4242 : __comp_(__comp), __lhs_(__lhs), __rhs_(__rhs) {}
4343
44 _LIBCPP_HIDE_FROM_ABI bool __less() const {
44 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const {
4545 bool __result = __comp_(__lhs_, __rhs_);
4646 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__rhs_, __lhs_)) : true,
4747 "Comparator does not induce a strict weak ordering");
4848 return __result;
4949 }
5050
51 _LIBCPP_HIDE_FROM_ABI bool __greater() const {
51 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const {
5252 bool __result = __comp_(__rhs_, __lhs_);
5353 _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(__result ? !static_cast<bool>(__comp_(__lhs_, __rhs_)) : true,
5454 "Comparator does not induce a strict weak ordering");
......@@ -63,10 +63,11 @@ template <class _Comparator, class _LHS, class _RHS, class = void>
6363struct __lazy_synth_three_way_comparator {
6464 const _Comparator& __comp_;
6565
66 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp)
66 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
67 __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator& __comp)
6768 : __comp_(__comp) {}
6869
69 _LIBCPP_HIDE_FROM_ABI __lazy_compare_result<_Comparator, _LHS, _RHS>
70 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_compare_result<_Comparator, _LHS, _RHS>
7071 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) const {
7172 return __lazy_compare_result<_Comparator, _LHS, _RHS>(__comp_, __lhs, __rhs);
7273 }
......@@ -75,10 +76,10 @@ struct __lazy_synth_three_way_comparator {
7576struct __eager_compare_result {
7677 int __res_;
7778
78 _LIBCPP_HIDE_FROM_ABI explicit __eager_compare_result(int __res) : __res_(__res) {}
79 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit __eager_compare_result(int __res) : __res_(__res) {}
7980
80 _LIBCPP_HIDE_FROM_ABI bool __less() const { return __res_ < 0; }
81 _LIBCPP_HIDE_FROM_ABI bool __greater() const { return __res_ > 0; }
81 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __less() const { return __res_ < 0; }
82 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __greater() const { return __res_ > 0; }
8283};
8384
8485template <class _Comparator, class _LHS, class _RHS>
......@@ -89,10 +90,11 @@ struct __lazy_synth_three_way_comparator<_Comparator,
8990 __has_default_three_way_comparator<_LHS, _RHS> >::value> > {
9091 // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
9192 // the comparator.
92 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
93 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
94 __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
9395
9496 // Same comment as above.
95 _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
97 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result
9698 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
9799 return __eager_compare_result(__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
98100 }
......@@ -106,10 +108,11 @@ struct __lazy_synth_three_way_comparator<_Comparator,
106108 __has_default_three_way_comparator<_LHS, _RHS> >::value> > {
107109 // This lifetimebound annotation is technically incorrect, but other specializations actually capture the lifetime of
108110 // the comparator.
109 _LIBCPP_HIDE_FROM_ABI __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
111 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
112 __lazy_synth_three_way_comparator(_LIBCPP_CTOR_LIFETIMEBOUND const _Comparator&) {}
110113
111114 // Same comment as above.
112 _LIBCPP_HIDE_FROM_ABI static __eager_compare_result
115 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __eager_compare_result
113116 operator()(_LIBCPP_LIFETIMEBOUND const _LHS& __lhs, _LIBCPP_LIFETIMEBOUND const _RHS& __rhs) {
114117 return __eager_compare_result(-__default_three_way_comparator<_LHS, _RHS>()(__lhs, __rhs));
115118 }
lib/libcxx/include/__utility/pair.h+77-97
......@@ -55,22 +55,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
5555template <class _T1, class _T2>
5656struct __check_pair_construction {
5757 template <int&...>
58 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_implicit_default() {
58 static constexpr bool __enable_implicit_default() {
5959 return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value;
6060 }
6161
6262 template <int&...>
63 static _LIBCPP_HIDE_FROM_ABI constexpr bool __enable_default() {
63 static constexpr bool __enable_default() {
6464 return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value;
6565 }
6666
6767 template <class _U1, class _U2>
68 static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_pair_constructible() {
68 static constexpr bool __is_pair_constructible() {
6969 return is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value;
7070 }
7171
7272 template <class _U1, class _U2>
73 static _LIBCPP_HIDE_FROM_ABI constexpr bool __is_implicit() {
73 static constexpr bool __is_implicit() {
7474 return is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value;
7575 }
7676};
......@@ -79,9 +79,8 @@ struct __check_pair_construction {
7979
8080template <class, class>
8181struct __non_trivially_copyable_base {
82 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base() _NOEXCEPT {}
83 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
84 __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {}
82 _LIBCPP_CONSTEXPR __non_trivially_copyable_base() _NOEXCEPT {}
83 _LIBCPP_CONSTEXPR_SINCE_CXX14 __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {}
8584};
8685
8786template <class _T1, class _T2>
......@@ -101,18 +100,18 @@ struct pair
101100 pair,
102101 void>;
103102
104 _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
105 _LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
103 pair(pair const&) = default;
104 pair(pair&&) = default;
106105
107106#ifdef _LIBCPP_CXX03_LANG
108 _LIBCPP_HIDE_FROM_ABI pair() : first(), second() {}
107 pair() : first(), second() {}
109108
110 _LIBCPP_HIDE_FROM_ABI pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
109 pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {}
111110
112111 template <class _U1, class _U2>
113 _LIBCPP_HIDE_FROM_ABI pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
112 pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
114113
115 _LIBCPP_HIDE_FROM_ABI pair& operator=(pair const& __p) {
114 pair& operator=(pair const& __p) {
116115 first = __p.first;
117116 second = __p.second;
118117 return *this;
......@@ -126,7 +125,7 @@ struct pair
126125 class _U2,
127126 __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value,
128127 int> = 0>
129 _LIBCPP_HIDE_FROM_ABI pair& operator=(pair<_U1, _U2> const& __p) {
128 pair& operator=(pair<_U1, _U2> const& __p) {
130129 first = __p.first;
131130 second = __p.second;
132131 return *this;
......@@ -134,13 +133,12 @@ struct pair
134133#else
135134 template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>,
136135 __enable_if_t<_CheckArgsDep::__enable_default(), int> = 0>
137 explicit(!_CheckArgsDep::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI constexpr pair() noexcept(
136 explicit(!_CheckArgsDep::__enable_implicit_default()) constexpr pair() noexcept(
138137 is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value)
139138 : first(), second() {}
140139
141140 template <class _CheckArgsDep = __check_pair_construction<_T1, _T2>,
142141 __enable_if_t<_CheckArgsDep::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0>
143 _LIBCPP_HIDE_FROM_ABI
144142 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgsDep::template __is_implicit<_T1 const&, _T2 const&>())
145143 pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value &&
146144 is_nothrow_copy_constructible<second_type>::value)
......@@ -155,7 +153,6 @@ struct pair
155153 class _U2,
156154# endif
157155 __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0 >
158 _LIBCPP_HIDE_FROM_ABI
159156 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>())
160157 pair(_U1&& __u1, _U2&& __u2) noexcept(is_nothrow_constructible<first_type, _U1>::value &&
161158 is_nothrow_constructible<second_type, _U2>::value)
......@@ -166,7 +163,7 @@ struct pair
166163 template <class _U1,
167164 class _U2,
168165 __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1&, _U2&>(), int> = 0>
169 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1&, _U2&>())
166 constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1&, _U2&>())
170167 pair(pair<_U1, _U2>& __p) noexcept((is_nothrow_constructible<first_type, _U1&>::value &&
171168 is_nothrow_constructible<second_type, _U2&>::value))
172169 : first(__p.first), second(__p.second) {}
......@@ -177,7 +174,7 @@ struct pair
177174 class _U2,
178175 __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1 const&, _U2 const&>(),
179176 int> = 0>
180 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
177 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
181178 !__check_pair_construction<_T1, _T2>::template __is_implicit<_U1 const&, _U2 const&>())
182179 pair(pair<_U1, _U2> const& __p) noexcept(is_nothrow_constructible<first_type, _U1 const&>::value &&
183180 is_nothrow_constructible<second_type, _U2 const&>::value)
......@@ -186,7 +183,6 @@ struct pair
186183 template <class _U1,
187184 class _U2,
188185 __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<_U1, _U2>(), int> = 0>
189 _LIBCPP_HIDE_FROM_ABI
190186 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<_U1, _U2>())
191187 pair(pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, _U1&&>::value &&
192188 is_nothrow_constructible<second_type, _U2&&>::value)
......@@ -198,8 +194,7 @@ struct pair
198194 class _U2,
199195 __enable_if_t<__check_pair_construction<_T1, _T2>::template __is_pair_constructible<const _U1&&, const _U2&&>(),
200196 int> = 0>
201 _LIBCPP_HIDE_FROM_ABI constexpr explicit(
202 !__check_pair_construction<_T1, _T2>::template __is_implicit<const _U1&&, const _U2&&>())
197 constexpr explicit(!__check_pair_construction<_T1, _T2>::template __is_implicit<const _U1&&, const _U2&&>())
203198 pair(const pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, const _U1&&>::value &&
204199 is_nothrow_constructible<second_type, const _U2&&>::value)
205200 : first(std::move(__p.first)), second(std::move(__p.second)) {}
......@@ -209,19 +204,19 @@ struct pair
209204 template <__pair_like_no_subrange _PairLike>
210205 requires(is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike &&>()))> &&
211206 is_constructible_v<second_type, decltype(std::get<1>(std::declval<_PairLike &&>()))>)
212 _LIBCPP_HIDE_FROM_ABI constexpr explicit(
213 !is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
214 !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>) pair(_PairLike&& __p)
207 constexpr explicit(!is_convertible_v<decltype(std::get<0>(std::declval<_PairLike&&>())), first_type> ||
208 !is_convertible_v<decltype(std::get<1>(std::declval<_PairLike&&>())), second_type>)
209 pair(_PairLike&& __p)
215210 : first(std::get<0>(std::forward<_PairLike>(__p))), second(std::get<1>(std::forward<_PairLike>(__p))) {}
216211# endif
217212
218213 template <class... _Args1, class... _Args2>
219 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
214 _LIBCPP_CONSTEXPR_SINCE_CXX20
220215 pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept(
221216 is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value)
222217 : pair(__pc, __first_args, __second_args, __index_sequence_for<_Args1...>(), __index_sequence_for<_Args2...>()) {}
223218
224 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
219 _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
225220 operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
226221 pair,
227222 __nat> const& __p) noexcept(is_nothrow_copy_assignable<first_type>::value &&
......@@ -231,7 +226,7 @@ struct pair
231226 return *this;
232227 }
233228
234 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(
229 _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(
235230 __conditional_t<is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
236231 __p) noexcept(is_nothrow_move_assignable<first_type>::value &&
237232 is_nothrow_move_assignable<second_type>::value) {
......@@ -245,7 +240,7 @@ struct pair
245240 class _U2,
246241 __enable_if_t<is_assignable<first_type&, _U1 const&>::value && is_assignable<second_type&, _U2 const&>::value,
247242 int> = 0>
248 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) {
243 _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2> const& __p) {
249244 first = __p.first;
250245 second = __p.second;
251246 return *this;
......@@ -254,7 +249,7 @@ struct pair
254249 template <class _U1,
255250 class _U2,
256251 __enable_if_t<is_assignable<first_type&, _U1>::value && is_assignable<second_type&, _U2>::value, int> = 0>
257 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) {
252 _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(pair<_U1, _U2>&& __p) {
258253 first = std::forward<_U1>(__p.first);
259254 second = std::forward<_U2>(__p.second);
260255 return *this;
......@@ -262,7 +257,7 @@ struct pair
262257
263258# if _LIBCPP_STD_VER >= 23
264259 template <class = void>
265 _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const
260 constexpr const pair& operator=(pair const& __p) const
266261 noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>)
267262 requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>)
268263 {
......@@ -272,7 +267,7 @@ struct pair
272267 }
273268
274269 template <class = void>
275 _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair&& __p) const
270 constexpr const pair& operator=(pair&& __p) const
276271 noexcept(is_nothrow_assignable_v<const first_type&, first_type> &&
277272 is_nothrow_assignable_v<const second_type&, second_type>)
278273 requires(is_assignable_v<const first_type&, first_type> && is_assignable_v<const second_type&, second_type>)
......@@ -283,7 +278,7 @@ struct pair
283278 }
284279
285280 template <class _U1, class _U2>
286 _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(const pair<_U1, _U2>& __p) const
281 constexpr const pair& operator=(const pair<_U1, _U2>& __p) const
287282 requires(is_assignable_v<const first_type&, const _U1&> && is_assignable_v<const second_type&, const _U2&>)
288283 {
289284 first = __p.first;
......@@ -292,7 +287,7 @@ struct pair
292287 }
293288
294289 template <class _U1, class _U2>
295 _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair<_U1, _U2>&& __p) const
290 constexpr const pair& operator=(pair<_U1, _U2>&& __p) const
296291 requires(is_assignable_v<const first_type&, _U1> && is_assignable_v<const second_type&, _U2>)
297292 {
298293 first = std::forward<_U1>(__p.first);
......@@ -304,7 +299,7 @@ struct pair
304299 requires(__different_from<_PairLike, pair> &&
305300 is_assignable_v<first_type&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
306301 is_assignable_v<second_type&, decltype(std::get<1>(std::declval<_PairLike>()))>)
307 _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(_PairLike&& __p) {
302 constexpr pair& operator=(_PairLike&& __p) {
308303 first = std::get<0>(std::forward<_PairLike>(__p));
309304 second = std::get<1>(std::forward<_PairLike>(__p));
310305 return *this;
......@@ -314,7 +309,7 @@ struct pair
314309 requires(__different_from<_PairLike, pair> &&
315310 is_assignable_v<first_type const&, decltype(std::get<0>(std::declval<_PairLike>()))> &&
316311 is_assignable_v<second_type const&, decltype(std::get<1>(std::declval<_PairLike>()))>)
317 _LIBCPP_HIDE_FROM_ABI constexpr pair const& operator=(_PairLike&& __p) const {
312 constexpr pair const& operator=(_PairLike&& __p) const {
318313 first = std::get<0>(std::forward<_PairLike>(__p));
319314 second = std::get<1>(std::forward<_PairLike>(__p));
320315 return *this;
......@@ -328,34 +323,33 @@ struct pair
328323 template <class _U1,
329324 class _U2,
330325 __enable_if_t<is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value, int> = 0>
331 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p)
332 : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
326 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2> const& __p) : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
333327
334328 template < class _U1,
335329 class _U2,
336330 __enable_if_t<is_constructible<_T1, _U1 const&>::value && is_constructible<_T2, _U2 const&>::value &&
337331 !(is_convertible<_U1 const&, _T1>::value && is_convertible<_U2 const&, _T2>::value),
338332 int> = 0>
339 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p)
333 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2> const& __p)
340334 : first(std::get<0>(__p)), second(std::get<1>(__p)) {}
341335
342336 template <class _U1,
343337 class _U2,
344338 __enable_if_t<is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value, int> = 0>
345 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p)
339 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(tuple<_U1, _U2>&& __p)
346340 : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
347341
348342 template <class _U1,
349343 class _U2,
350344 __enable_if_t<is_constructible<_T1, _U1>::value && is_constructible<_T2, _U2>::value &&
351345 !(is_convertible<_U1, _T1>::value && is_convertible<_U2, _T2>::value) > = 0>
352 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p)
346 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(tuple<_U1, _U2>&& __p)
353347 : first(std::get<0>(std::move(__p))), second(std::get<1>(std::move(__p))) {}
354348
355349 template <class _U1,
356350 class _U2,
357351 __enable_if_t<is_assignable<_T1&, _U1 const&>::value && is_assignable<_T2&, _U2 const&>::value, int> = 0>
358 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) {
352 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2> const& __p) {
359353 first = std::get<0>(__p);
360354 second = std::get<1>(__p);
361355 return *this;
......@@ -364,7 +358,7 @@ struct pair
364358 template <class _U1,
365359 class _U2,
366360 __enable_if_t<is_assignable<_T1&, _U1&&>::value && is_assignable<_T2&, _U2&&>::value, int> = 0>
367 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) {
361 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(tuple<_U1, _U2>&& __p) {
368362 first = std::get<0>(std::move(__p));
369363 second = std::get<1>(std::move(__p));
370364 return *this;
......@@ -373,36 +367,34 @@ struct pair
373367 // from std::array
374368 template <class _Up,
375369 __enable_if_t<is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value, int> = 0>
376 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {}
370 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {}
377371
378372 template <class _Up,
379373 __enable_if_t<is_constructible<_T1, _Up const&>::value && is_constructible<_T2, _Up const&>::value &&
380374 !(is_convertible<_Up const&, _T1>::value && is_convertible<_Up const&, _T2>::value),
381375 int> = 0>
382 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p)
383 : first(__p[0]), second(__p[1]) {}
376 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2> const& __p) : first(__p[0]), second(__p[1]) {}
384377
385378 template <class _Up, __enable_if_t< is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value, int> = 0>
386 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p)
387 : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
379 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(array<_Up, 2>&& __p) : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
388380
389381 template <class _Up,
390382 __enable_if_t<is_constructible<_T1, _Up>::value && is_constructible<_T2, _Up>::value &&
391383 !(is_convertible<_Up, _T1>::value && is_convertible<_Up, _T2>::value),
392384 int> = 0>
393 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p)
385 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(array<_Up, 2>&& __p)
394386 : first(std::move(__p)[0]), second(std::move(__p)[1]) {}
395387
396388 template <class _Up,
397389 __enable_if_t<is_assignable<_T1&, _Up const&>::value && is_assignable<_T2&, _Up const&>::value, int> = 0>
398 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) {
390 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2> const& __p) {
399391 first = std::get<0>(__p);
400392 second = std::get<1>(__p);
401393 return *this;
402394 }
403395
404396 template <class _Up, __enable_if_t<is_assignable<_T1&, _Up>::value && is_assignable<_T2&, _Up>::value, int> = 0>
405 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) {
397 _LIBCPP_CONSTEXPR_SINCE_CXX14 pair& operator=(array<_Up, 2>&& __p) {
406398 first = std::get<0>(std::move(__p));
407399 second = std::get<1>(std::move(__p));
408400 return *this;
......@@ -410,7 +402,7 @@ struct pair
410402# endif // _LIBCPP_STD_VER < 23
411403#endif // _LIBCPP_CXX03_LANG
412404
413 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p)
405 _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p)
414406 _NOEXCEPT_(__is_nothrow_swappable_v<first_type>&& __is_nothrow_swappable_v<second_type>) {
415407 using std::swap;
416408 swap(first, __p.first);
......@@ -418,7 +410,7 @@ struct pair
418410 }
419411
420412#if _LIBCPP_STD_VER >= 23
421 _LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const
413 constexpr void swap(const pair& __p) const
422414 noexcept(__is_nothrow_swappable_v<const first_type> && __is_nothrow_swappable_v<const second_type>) {
423415 using std::swap;
424416 swap(first, __p.first);
......@@ -429,7 +421,7 @@ struct pair
429421private:
430422#ifndef _LIBCPP_CXX03_LANG
431423 template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
432 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
424 _LIBCPP_CONSTEXPR_SINCE_CXX20
433425 pair(piecewise_construct_t,
434426 tuple<_Args1...>& __first_args,
435427 tuple<_Args2...>& __second_args,
......@@ -448,8 +440,7 @@ pair(_T1, _T2) -> pair<_T1, _T2>;
448440// [pairs.spec], specialized algorithms
449441
450442template <class _T1, class _T2, class _U1, class _U2>
451inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
452operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y)
443inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y)
453444#if _LIBCPP_STD_VER >= 26
454445 requires requires {
455446 { __x.first == __y.first } -> __boolean_testable;
......@@ -463,8 +454,7 @@ operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y)
463454#if _LIBCPP_STD_VER >= 20
464455
465456template <class _T1, class _T2, class _U1, class _U2>
466_LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>,
467 __synth_three_way_result<_T2, _U2> >
457constexpr common_comparison_category_t< __synth_three_way_result<_T1, _U1>, __synth_three_way_result<_T2, _U2> >
468458operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
469459 if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) {
470460 return __c;
......@@ -475,32 +465,27 @@ operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
475465#else // _LIBCPP_STD_VER >= 20
476466
477467template <class _T1, class _T2, class _U1, class _U2>
478inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
479operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
468inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator!=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
480469 return !(__x == __y);
481470}
482471
483472template <class _T1, class _T2, class _U1, class _U2>
484inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
485operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
473inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator<(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
486474 return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second);
487475}
488476
489477template <class _T1, class _T2, class _U1, class _U2>
490inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
491operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
478inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
492479 return __y < __x;
493480}
494481
495482template <class _T1, class _T2, class _U1, class _U2>
496inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
497operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
483inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator>=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
498484 return !(__x < __y);
499485}
500486
501487template <class _T1, class _T2, class _U1, class _U2>
502inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
503operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
488inline _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator<=(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
504489 return !(__y < __x);
505490}
506491
......@@ -524,7 +509,7 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> {
524509#endif // _LIBCPP_STD_VER >= 23
525510
526511template <class _T1, class _T2, __enable_if_t<__is_swappable_v<_T1> && __is_swappable_v<_T2>, int> = 0>
527inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
512inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
528513 _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) {
529514 __x.swap(__y);
530515}
......@@ -532,15 +517,14 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _
532517#if _LIBCPP_STD_VER >= 23
533518template <class _T1, class _T2>
534519 requires(__is_swappable_v<const _T1> && __is_swappable_v<const _T2>)
535_LIBCPP_HIDE_FROM_ABI constexpr void
536swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) {
520constexpr void swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) {
537521 __x.swap(__y);
538522}
539523#endif
540524
541525template <class _T1, class _T2>
542[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
543pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> > make_pair(_T1&& __t1, _T2&& __t2) {
526[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >
527make_pair(_T1&& __t1, _T2&& __t2) {
544528 return pair<__unwrap_ref_decay_t<_T1>, __unwrap_ref_decay_t<_T2> >(std::forward<_T1>(__t1), std::forward<_T2>(__t2));
545529}
546530
......@@ -568,22 +552,22 @@ struct __get_pair;
568552template <>
569553struct __get_pair<0> {
570554 template <class _T1, class _T2>
571 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
555 static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
572556 return __p.first;
573557 }
574558
575559 template <class _T1, class _T2>
576 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
560 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
577561 return __p.first;
578562 }
579563
580564 template <class _T1, class _T2>
581 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
565 static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
582566 return std::forward<_T1>(__p.first);
583567 }
584568
585569 template <class _T1, class _T2>
586 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
570 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
587571 return std::forward<const _T1>(__p.first);
588572 }
589573};
......@@ -591,92 +575,88 @@ struct __get_pair<0> {
591575template <>
592576struct __get_pair<1> {
593577 template <class _T1, class _T2>
594 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
578 static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
595579 return __p.second;
596580 }
597581
598582 template <class _T1, class _T2>
599 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
583 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {
600584 return __p.second;
601585 }
602586
603587 template <class _T1, class _T2>
604 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
588 static _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
605589 return std::forward<_T2>(__p.second);
606590 }
607591
608592 template <class _T1, class _T2>
609 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
593 static _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
610594 return std::forward<const _T2>(__p.second);
611595 }
612596};
613597
614598template <size_t _Ip, class _T1, class _T2>
615[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
616typename tuple_element<_Ip, pair<_T1, _T2> >::type&
599[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
617600get(pair<_T1, _T2>& __p) _NOEXCEPT {
618601 return __get_pair<_Ip>::get(__p);
619602}
620603
621604template <size_t _Ip, class _T1, class _T2>
622[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
623_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
605[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
624606get(const pair<_T1, _T2>& __p) _NOEXCEPT {
625607 return __get_pair<_Ip>::get(__p);
626608}
627609
628610template <size_t _Ip, class _T1, class _T2>
629[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
630typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
611[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
631612get(pair<_T1, _T2>&& __p) _NOEXCEPT {
632613 return __get_pair<_Ip>::get(std::move(__p));
633614}
634615
635616template <size_t _Ip, class _T1, class _T2>
636[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
637_LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
617[[__nodiscard__]] inline _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
638618get(const pair<_T1, _T2>&& __p) _NOEXCEPT {
639619 return __get_pair<_Ip>::get(std::move(__p));
640620}
641621
642622#if _LIBCPP_STD_VER >= 14
643623template <class _T1, class _T2>
644[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
624[[__nodiscard__]] inline constexpr _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {
645625 return __p.first;
646626}
647627
648628template <class _T1, class _T2>
649[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
629[[__nodiscard__]] inline constexpr _T1 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
650630 return __p.first;
651631}
652632
653633template <class _T1, class _T2>
654[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
634[[__nodiscard__]] inline constexpr _T1&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
655635 return std::forward<_T1&&>(__p.first);
656636}
657637
658638template <class _T1, class _T2>
659[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
639[[__nodiscard__]] inline constexpr _T1 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
660640 return std::forward<_T1 const&&>(__p.first);
661641}
662642
663643template <class _T2, class _T1>
664[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
644[[__nodiscard__]] inline constexpr _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {
665645 return __p.second;
666646}
667647
668648template <class _T2, class _T1>
669[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
649[[__nodiscard__]] inline constexpr _T2 const& get(pair<_T1, _T2> const& __p) _NOEXCEPT {
670650 return __p.second;
671651}
672652
673653template <class _T2, class _T1>
674[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
654[[__nodiscard__]] inline constexpr _T2&& get(pair<_T1, _T2>&& __p) _NOEXCEPT {
675655 return std::forward<_T2&&>(__p.second);
676656}
677657
678658template <class _T2, class _T1>
679[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
659[[__nodiscard__]] inline constexpr _T2 const&& get(pair<_T1, _T2> const&& __p) _NOEXCEPT {
680660 return std::forward<_T2 const&&>(__p.second);
681661}
682662
lib/libcxx/include/__utility/try_key_extraction.h+16-12
......@@ -27,61 +27,65 @@
2727
2828_LIBCPP_BEGIN_NAMESPACE_STD
2929
30template <class _KeyT, class _Ret, class _WithKey, class _WithoutKey, class... _Args>
31_LIBCPP_HIDE_FROM_ABI _Ret
30template <class _KeyT, bool, class _Ret, class _WithKey, class _WithoutKey, class... _Args>
31_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret
3232__try_key_extraction_impl(__priority_tag<0>, _WithKey, _WithoutKey __without_key, _Args&&... __args) {
3333 return __without_key(std::forward<_Args>(__args)...);
3434}
3535
3636template <class _KeyT,
37 bool,
3738 class _Ret,
3839 class _WithKey,
3940 class _WithoutKey,
4041 class _Arg,
4142 __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg> >::value, int> = 0>
42_LIBCPP_HIDE_FROM_ABI _Ret
43_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret
4344__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) {
4445 return __with_key(__arg, std::forward<_Arg>(__arg));
4546}
4647
4748template <class _KeyT,
49 bool __is_map,
4850 class _Ret,
4951 class _WithKey,
5052 class _WithoutKey,
5153 class _Arg,
52 __enable_if_t<__is_pair_v<__remove_const_ref_t<_Arg> > &&
54 __enable_if_t<__is_map && __is_pair_v<__remove_const_ref_t<_Arg> > &&
5355 is_same<__remove_const_t<typename __remove_const_ref_t<_Arg>::first_type>, _KeyT>::value,
5456 int> = 0>
55_LIBCPP_HIDE_FROM_ABI _Ret
57_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret
5658__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg&& __arg) {
5759 return __with_key(__arg.first, std::forward<_Arg>(__arg));
5860}
5961
6062template <class _KeyT,
63 bool __is_map,
6164 class _Ret,
6265 class _WithKey,
6366 class _WithoutKey,
6467 class _Arg1,
6568 class _Arg2,
66 __enable_if_t<is_same<_KeyT, __remove_const_ref_t<_Arg1> >::value, int> = 0>
67_LIBCPP_HIDE_FROM_ABI _Ret
69 __enable_if_t<__is_map && is_same<_KeyT, __remove_const_ref_t<_Arg1> >::value, int> = 0>
70_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret
6871__try_key_extraction_impl(__priority_tag<1>, _WithKey __with_key, _WithoutKey, _Arg1&& __arg1, _Arg2&& __arg2) {
6972 return __with_key(__arg1, std::forward<_Arg1>(__arg1), std::forward<_Arg2>(__arg2));
7073}
7174
7275#ifndef _LIBCPP_CXX03_LANG
7376template <class _KeyT,
77 bool __is_map,
7478 class _Ret,
7579 class _WithKey,
7680 class _WithoutKey,
7781 class _PiecewiseConstruct,
7882 class _Tuple1,
7983 class _Tuple2,
80 __enable_if_t<is_same<__remove_const_ref_t<_PiecewiseConstruct>, piecewise_construct_t>::value &&
84 __enable_if_t<__is_map && is_same<__remove_const_ref_t<_PiecewiseConstruct>, piecewise_construct_t>::value &&
8185 __is_tuple_v<_Tuple1> && tuple_size<_Tuple1>::value == 1 &&
8286 is_same<__remove_const_ref_t<typename tuple_element<0, _Tuple1>::type>, _KeyT>::value,
8387 int> = 0>
84_LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl(
88_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _Ret __try_key_extraction_impl(
8589 __priority_tag<1>,
8690 _WithKey __with_key,
8791 _WithoutKey,
......@@ -101,11 +105,11 @@ _LIBCPP_HIDE_FROM_ABI _Ret __try_key_extraction_impl(
101105// arguments. Otherwise it calls the `__without_key` function with all of the arguments.
102106//
103107// Both `__with_key` and `__without_key` must take all arguments by reference.
104template <class _KeyT, class _WithKey, class _WithoutKey, class... _Args>
105_LIBCPP_HIDE_FROM_ABI decltype(std::declval<_WithoutKey>()(std::declval<_Args>()...))
108template <class _KeyT, class _ValT, class _WithKey, class _WithoutKey, class... _Args>
109_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 decltype(std::declval<_WithoutKey>()(std::declval<_Args>()...))
106110__try_key_extraction(_WithKey __with_key, _WithoutKey __without_key, _Args&&... __args) {
107111 using _Ret = decltype(__without_key(std::forward<_Args>(__args)...));
108 return std::__try_key_extraction_impl<_KeyT, _Ret>(
112 return std::__try_key_extraction_impl<_KeyT, !is_same<_KeyT, _ValT>::value, _Ret>(
109113 __priority_tag<1>(), __with_key, __without_key, std::forward<_Args>(__args)...);
110114}
111115
lib/libcxx/include/__variant/monostate.h+4-4
......@@ -19,10 +19,10 @@
1919# pragma GCC system_header
2020#endif
2121
22_LIBCPP_BEGIN_NAMESPACE_STD
23
2422#if _LIBCPP_STD_VER >= 17
2523
24_LIBCPP_BEGIN_NAMESPACE_STD
25
2626struct monostate {};
2727
2828_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(monostate, monostate) noexcept { return true; }
......@@ -59,8 +59,8 @@ struct hash<monostate> {
5959 }
6060};
6161
62#endif // _LIBCPP_STD_VER >= 17
63
6462_LIBCPP_END_NAMESPACE_STD
6563
64#endif // _LIBCPP_STD_VER >= 17
65
6666#endif // _LIBCPP___VARIANT_MONOSTATE_H
lib/libcxx/include/__vector/layout.h created+479
......@@ -0,0 +1,479 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___VECTOR_LAYOUT_H
10#define _LIBCPP___VECTOR_LAYOUT_H
11
12#include <__assert>
13#include <__config>
14#include <__debug_utils/sanitizers.h>
15#include <__memory/allocator_traits.h>
16#include <__memory/compressed_pair.h>
17#include <__memory/pointer_traits.h>
18#include <__memory/swap_allocator.h>
19#include <__memory/uninitialized_algorithms.h>
20#include <__split_buffer>
21#include <__type_traits/is_nothrow_constructible.h>
22#include <__utility/exchange.h>
23#include <__utility/move.h>
24#include <__utility/swap.h>
25
26#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
27# pragma GCC system_header
28#endif
29
30_LIBCPP_PUSH_MACROS
31#include <__undef_macros>
32
33_LIBCPP_BEGIN_NAMESPACE_STD
34
35/// Defines `std::vector`'s storage layout and any operations that are affected by a change in the
36/// layout.
37///
38/// `std::vector` can be represented in a variety of ways. Each representation strongly influences
39/// the codegen when calling vector operations, which can significantly impact runtime performance
40/// and memory utilisation. libc++ provides two alternative layouts for `std::vector`, although only
41/// one can be active for an entire binary:
42///
43/// * pointer-based layout (stable ABI default)
44/// * size-based layout (unstable ABI alternative)
45//
46/// We describe these layouts below. All vector representations have a pointer that points to where
47/// the memory is allocated (called `__begin_`).
48///
49/// **Pointer-based layout**
50///
51/// The pointer-based layout uses two more pointers in addition to `__begin_`. The second pointer
52/// (called `__end_`) points past the end of the part of the buffer that holds valid elements.
53/// Another pointer (called `__capacity_`) points past the end of the allocated buffer. The original
54/// libc++ `std::vector` implementation only provided the pointer-based layout. libc++ continues to
55/// use the pointer-based layout, by default, in order to maintain binary compatibility with
56/// existing software.
57///
58/// The `__end_` pointer has three primary use-cases:
59/// * to compute the size of the vector; and
60/// * to construct the past-the-end iterator; and
61/// * to indicate where the next element should be appended.
62///
63/// The `__capacity_` is used to compute the capacity of the vector, which lets the vector know how
64/// many elements can be added to the vector before a reallocation is necessary.
65///
66/// __begin_ = 0xE4FD0, __end_ = 0xE4FF0, __capacity_ = 0xE5000
67/// 0xE4FD0 0xE4FF0 0xE5000
68/// v v v
69/// +---------------+--------+--------+--------+--------+--------+--------+---------------------+
70/// | ????????????? | 3174 | 5656 | 648 | 489 | ------ | ------ | ??????????????????? |
71/// +---------------+--------+--------+--------+--------+--------+--------+---------------------+
72/// ^ ^ ^
73/// __begin_ __end_ __capacity_
74///
75/// Figure 1: A visual representation of a pointer-based `std::vector<short>`. This vector has
76/// four elements, with the capacity to store six. Boxes with numbers are valid elements within
77/// the vector, and boxes with `xx` have been allocated, but aren't being used as elements right
78/// now.
79///
80/// This is the default layout for libc++.
81///
82/// **Size-based layout**
83///
84/// The size-based layout uses integers to track its size and capacity, and computes pointers to
85/// past-the-end of the valid range and the whole buffer only when it's necessary. Programs using
86/// the size-based layout have been measured to yield improved compute and memory performance over
87/// the pointer-based layout. Despite these promising measurements, the size-based layout is opt-in,
88/// to preserve ABI compatibility with prebuilt binaries. Given the improved performance, we
89/// recommend preferring the size-based layout in the absence of such ABI constraints.
90///
91/// __begin_ = 0xE4FD0, __size_ = 4, __capacity_ = 6
92/// 0xE4FD0
93/// v
94/// +---------------+--------+--------+--------+--------+--------+--------+---------------------+
95/// | ????????????? | 3174 | 5656 | 648 | 489 | ------ | ------ | ??????????????????? |
96/// +---------------+--------+--------+--------+--------+--------+--------+---------------------+
97/// ^
98/// __begin_
99///
100/// Figure 2: A visual representation of this a size-based layout. Blank boxes are not a part
101/// of the vector's allocated buffer.
102///
103/// **Class design**
104///
105/// __vector_layout was designed with the following goals:
106/// 1. to abstractly represent the buffer's boundaries; and
107/// 2. to limit the number of `#ifdef` blocks that a reader needs to pass through; and
108/// 3. given (1) and (2), to have no logically identical components in multiple `#ifdef` clauses.
109///
110/// To facilitate these goals, there is a single `__vector_layout` definition. Users must choose
111/// their vector's layout when libc++ is being configured, so there is no need to manage multiple
112/// vector layout types (e.g. `__vector_size_layout`, `__vector_pointer_layout`, etc.). In doing so,
113/// we reduce a significant portion of duplicate code.
114template <class _Tp, class _Allocator>
115class __vector_layout {
116public:
117 using value_type _LIBCPP_NODEBUG = _Tp;
118 using allocator_type _LIBCPP_NODEBUG = _Allocator;
119 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
120 using size_type _LIBCPP_NODEBUG = typename __alloc_traits::size_type;
121 using pointer _LIBCPP_NODEBUG = typename __alloc_traits::pointer;
122 using const_pointer _LIBCPP_NODEBUG = typename __alloc_traits::const_pointer;
123#ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED
124 using _SplitBuffer _LIBCPP_NODEBUG = __split_buffer<_Tp, _Allocator, __split_buffer_size_layout>;
125 using __bound_type _LIBCPP_NODEBUG = size_type;
126#else
127 using _SplitBuffer _LIBCPP_NODEBUG = __split_buffer<_Tp, _Allocator, __split_buffer_pointer_layout>;
128 using __bound_type _LIBCPP_NODEBUG = pointer;
129#endif
130
131 // Cannot be defaulted, since `_LIBCPP_COMPRESSED_PAIR` isn't an aggregate before C++14.
132 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __vector_layout()
133 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
134 : __capacity_() {}
135
136 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __vector_layout(allocator_type const& __a)
137 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
138 : __capacity_(), __alloc_(__a) {}
139
140 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __vector_layout(allocator_type&& __a)
141 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
142 : __capacity_(), __alloc_(std::move(__a)) {}
143
144 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __vector_layout(__vector_layout&& __other)
145 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
146
147 /// Returns a reference to the stored allocator.
148 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT {
149 return __alloc_;
150 }
151
152 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type const&
153 __alloc() const _NOEXCEPT {
154 return __alloc_;
155 }
156
157 /// Returns a pointer to the beginning of the buffer.
158 ///
159 /// `__begin_ptr()` is not called `data()` because `vector::data()` returns `T*`, but `__begin_`
160 /// is allowed to be a fancy pointer.
161 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __begin_ptr() _NOEXCEPT {
162 return __begin_;
163 }
164
165 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __begin_ptr() const _NOEXCEPT {
166 return __begin_;
167 }
168
169 /// Returns a built-in pointer to the beginning of the buffer.
170 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp* __data() _NOEXCEPT {
171 return std::__to_address(__begin_);
172 }
173
174 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _Tp const* __data() const _NOEXCEPT {
175 return std::__to_address(__begin_);
176 }
177
178 /// Returns how many elements can be added before a reallocation occurs.
179 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type
180 __remaining_capacity() const _NOEXCEPT;
181
182 /// Sets the member pointing to the first element in the vector to `__new_begin`, the member used
183 /// to obtain the vector's bound to the equivalent of `__new_size`, and the member that represents
184 /// the vector's capacity to the equivalent to `__new_capacity`.
185 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
186 __set_layout(pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT;
187
188 /// Sets the member used to obtain the vector's bound to the equivalent of `__ptr`.
189 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_bound_using_pointer(pointer __ptr) _NOEXCEPT;
190
191 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __reset_without_allocator() _NOEXCEPT;
192 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap(__vector_layout& __other) _NOEXCEPT;
193 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
194 __move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT;
195
196 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __relocate(_SplitBuffer& __buffer);
197 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
198 __relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot);
199
200 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __size() const _NOEXCEPT;
201 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __capacity() const _NOEXCEPT;
202 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __empty() const _NOEXCEPT;
203 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __end_ptr() _NOEXCEPT;
204 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __end_ptr() const _NOEXCEPT;
205 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __capacity_ptr() _NOEXCEPT;
206 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer __capacity_ptr() const _NOEXCEPT;
207 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const _NOEXCEPT;
208
209private:
210 pointer __begin_ = nullptr;
211
212#ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED
213 size_type __size_ = 0;
214 size_type __capacity_ = 0;
215 _LIBCPP_NO_UNIQUE_ADDRESS allocator_type __alloc_;
216#else
217 pointer __end_ = nullptr;
218 _LIBCPP_COMPRESSED_PAIR(pointer, __capacity_ = nullptr, allocator_type, __alloc_);
219#endif
220
221 _LIBCPP_CONSTEXPR_SINCE_CXX20
222 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
223 std::__annotate_contiguous_container<_Allocator>(__data(), __data() + __capacity(), __old_mid, __new_mid);
224 }
225
226 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
227 __annotate_contiguous_container(__data() + __capacity(), __data() + __current_size);
228 }
229
230 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
231 __annotate_contiguous_container(__data() + __size(), __data() + __capacity());
232 }
233};
234
235#ifdef _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED
236template <class _Tp, class _Alloc>
237_LIBCPP_CONSTEXPR_SINCE_CXX20 __vector_layout<_Tp, _Alloc>::__vector_layout(__vector_layout&& __other)
238 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
239 : __begin_(std::__exchange(__other.__begin_, nullptr)),
240 __size_(std::__exchange(__other.__size_, 0)),
241 __capacity_(std::__exchange(__other.__capacity_, 0)),
242 __alloc_(std::move(__other.__alloc_)) {}
243
244template <class _Tp, class _Alloc>
245_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
246__vector_layout<_Tp, _Alloc>::__remaining_capacity() const _NOEXCEPT {
247 return __capacity_ - __size_;
248}
249
250template <class _Tp, class _Alloc>
251_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_layout(
252 pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT {
253 __begin_ = __new_begin;
254 __size_ = __new_size;
255 __capacity_ = __new_capacity;
256}
257
258template <class _Tp, class _Alloc>
259_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_bound_using_pointer(pointer __ptr) _NOEXCEPT {
260 __size_ = static_cast<size_type>(__ptr - __begin_);
261}
262
263template <class _Tp, class _Alloc>
264_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__reset_without_allocator() _NOEXCEPT {
265 __begin_ = nullptr;
266 __size_ = 0;
267 __capacity_ = 0;
268}
269
270template <class _Tp, class _Alloc>
271_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__swap(__vector_layout& __other) _NOEXCEPT {
272 using std::swap;
273 swap(__begin_, __other.__begin_);
274 swap(__size_, __other.__size_);
275 swap(__capacity_, __other.__capacity_);
276 std::__swap_allocator(__alloc_, __other.__alloc_);
277}
278
279template <class _Tp, class _Alloc>
280_LIBCPP_CONSTEXPR_SINCE_CXX20 void
281__vector_layout<_Tp, _Alloc>::__move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT {
282 __begin_ = __other.__begin_;
283 __size_ = __other.__size_;
284 __capacity_ = __other.__capacity_;
285
286 __other.__reset_without_allocator();
287}
288
289template <class _Tp, class _Alloc>
290_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__relocate(_SplitBuffer& __buffer) {
291 __annotate_delete();
292 __buffer.__relocate(__begin_, __size_, __capacity_);
293 __annotate_new(__size_);
294}
295
296template <class _Tp, class _Alloc>
297_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
298__vector_layout<_Tp, _Alloc>::__relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot) {
299 __annotate_delete();
300 auto __result = __buffer.__relocate_with_pivot(__pivot, __begin_, __size_, __capacity_);
301 __annotate_new(__size_);
302 return __result;
303}
304
305template <class _Tp, class _Alloc>
306_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
307__vector_layout<_Tp, _Alloc>::__size() const _NOEXCEPT {
308 return __size_;
309}
310
311template <class _Tp, class _Alloc>
312_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
313__vector_layout<_Tp, _Alloc>::__capacity() const _NOEXCEPT {
314 return __capacity_;
315}
316
317template <class _Tp, class _Alloc>
318_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__empty() const _NOEXCEPT {
319 return __size_ == 0;
320}
321
322template <class _Tp, class _Alloc>
323_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
324__vector_layout<_Tp, _Alloc>::__end_ptr() _NOEXCEPT {
325 return __begin_ + __size_;
326}
327
328template <class _Tp, class _Alloc>
329_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer
330__vector_layout<_Tp, _Alloc>::__end_ptr() const _NOEXCEPT {
331 return __begin_ + __size_;
332}
333
334template <class _Tp, class _Alloc>
335_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
336__vector_layout<_Tp, _Alloc>::__capacity_ptr() _NOEXCEPT {
337 return __begin_ + __capacity_;
338}
339
340template <class _Tp, class _Alloc>
341_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer
342__vector_layout<_Tp, _Alloc>::__capacity_ptr() const _NOEXCEPT {
343 return __begin_ + __capacity_;
344}
345
346template <class _Tp, class _Alloc>
347_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__invariants() const _NOEXCEPT {
348 if (__begin_ == nullptr)
349 return __size_ == 0 && __capacity_ == 0;
350 return __size_ <= __capacity_;
351}
352#else // !defined(_LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED)
353template <class _Tp, class _Alloc>
354_LIBCPP_CONSTEXPR_SINCE_CXX20 __vector_layout<_Tp, _Alloc>::__vector_layout(__vector_layout&& __other)
355 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
356 : __begin_(std::__exchange(__other.__begin_, nullptr)),
357 __end_(std::__exchange(__other.__end_, nullptr)),
358 __capacity_(std::__exchange(__other.__capacity_, nullptr)),
359 __alloc_(std::move(__other.__alloc_)) {}
360
361template <class _Tp, class _Alloc>
362_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
363__vector_layout<_Tp, _Alloc>::__remaining_capacity() const _NOEXCEPT {
364 return __capacity_ - __end_;
365}
366
367template <class _Tp, class _Alloc>
368_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_layout(
369 pointer __new_begin, size_type __new_size, size_type __new_capacity) _NOEXCEPT {
370 __begin_ = __new_begin;
371 __end_ = __new_begin + __new_size;
372 __capacity_ = __new_begin + __new_capacity;
373}
374
375template <class _Tp, class _Alloc>
376_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__set_bound_using_pointer(pointer __ptr) _NOEXCEPT {
377 __end_ = __ptr;
378}
379
380template <class _Tp, class _Alloc>
381_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__reset_without_allocator() _NOEXCEPT {
382 __begin_ = nullptr;
383 __end_ = nullptr;
384 __capacity_ = nullptr;
385}
386
387template <class _Tp, class _Alloc>
388_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__swap(__vector_layout& __other) _NOEXCEPT {
389 using std::swap;
390 swap(__begin_, __other.__begin_);
391 swap(__end_, __other.__end_);
392 swap(__capacity_, __other.__capacity_);
393 std::__swap_allocator(__alloc_, __other.__alloc_);
394}
395
396template <class _Tp, class _Alloc>
397_LIBCPP_CONSTEXPR_SINCE_CXX20 void
398__vector_layout<_Tp, _Alloc>::__move_assign_without_allocator(__vector_layout& __other) _NOEXCEPT {
399 __begin_ = __other.__begin_;
400 __end_ = __other.__end_;
401 __capacity_ = __other.__capacity_;
402
403 __other.__reset_without_allocator();
404}
405
406template <class _Tp, class _Alloc>
407_LIBCPP_CONSTEXPR_SINCE_CXX20 void __vector_layout<_Tp, _Alloc>::__relocate(_SplitBuffer& __buffer) {
408 __annotate_delete();
409 __buffer.__relocate(__begin_, __end_, __capacity_);
410 __annotate_new(__size());
411}
412
413template <class _Tp, class _Alloc>
414_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
415__vector_layout<_Tp, _Alloc>::__relocate_with_pivot(_SplitBuffer& __buffer, pointer __pivot) {
416 __annotate_delete();
417 auto __result = __buffer.__relocate_with_pivot(__pivot, __begin_, __end_, __capacity_);
418 __annotate_new(__size());
419 return __result;
420}
421
422template <class _Tp, class _Alloc>
423_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
424__vector_layout<_Tp, _Alloc>::__size() const _NOEXCEPT {
425 return static_cast<size_type>(__end_ - __begin_);
426}
427
428template <class _Tp, class _Alloc>
429_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::size_type
430__vector_layout<_Tp, _Alloc>::__capacity() const _NOEXCEPT {
431 return static_cast<size_type>(__capacity_ - __begin_);
432}
433
434template <class _Tp, class _Alloc>
435_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__empty() const _NOEXCEPT {
436 return __begin_ == __end_;
437}
438
439template <class _Tp, class _Alloc>
440_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
441__vector_layout<_Tp, _Alloc>::__end_ptr() _NOEXCEPT {
442 return __end_;
443}
444
445template <class _Tp, class _Alloc>
446_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer
447__vector_layout<_Tp, _Alloc>::__end_ptr() const _NOEXCEPT {
448 return __end_;
449}
450
451template <class _Tp, class _Alloc>
452_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::pointer
453__vector_layout<_Tp, _Alloc>::__capacity_ptr() _NOEXCEPT {
454 return __capacity_;
455}
456
457template <class _Tp, class _Alloc>
458_LIBCPP_CONSTEXPR_SINCE_CXX20 typename __vector_layout<_Tp, _Alloc>::const_pointer
459__vector_layout<_Tp, _Alloc>::__capacity_ptr() const _NOEXCEPT {
460 return __capacity_;
461}
462
463template <class _Tp, class _Alloc>
464_LIBCPP_CONSTEXPR_SINCE_CXX20 bool __vector_layout<_Tp, _Alloc>::__invariants() const _NOEXCEPT {
465 if (__begin_ == nullptr)
466 return __end_ == nullptr && __capacity_ == nullptr;
467 if (__begin_ > __end_)
468 return false;
469 if (__begin_ == __capacity_)
470 return false;
471 return __end_ <= __capacity_;
472}
473#endif // _LIBCPP_ABI_VECTOR_LAYOUT_SIZE_BASED
474
475_LIBCPP_END_NAMESPACE_STD
476
477_LIBCPP_POP_MACROS
478
479#endif // _LIBCPP___VECTOR_LAYOUT_H
lib/libcxx/include/__vector/vector.h+218-301
......@@ -56,6 +56,7 @@
5656#include <__type_traits/is_nothrow_constructible.h>
5757#include <__type_traits/is_pointer.h>
5858#include <__type_traits/is_same.h>
59#include <__type_traits/is_swappable.h>
5960#include <__type_traits/is_trivially_relocatable.h>
6061#include <__type_traits/type_identity.h>
6162#include <__utility/declval.h>
......@@ -72,6 +73,7 @@
7273// These headers define parts of vectors definition, since they define ADL functions or class specializations.
7374#include <__vector/comparison.h>
7475#include <__vector/container_traits.h>
76#include <__vector/layout.h>
7577#include <__vector/swap.h>
7678
7779#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -85,19 +87,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
8587
8688template <class _Tp, class _Allocator /* = allocator<_Tp> */>
8789class vector {
88 template <class _Up, class _Alloc>
89 using __split_buffer _LIBCPP_NODEBUG = std::__split_buffer<_Up, _Alloc, __split_buffer_pointer_layout>;
90 using __base_type _LIBCPP_NODEBUG = __vector_layout<_Tp, _Allocator>;
91 using __bound_type _LIBCPP_NODEBUG = typename __base_type::__bound_type;
92 using _SplitBuffer _LIBCPP_NODEBUG = typename __base_type::_SplitBuffer;
9093
9194public:
9295 //
9396 // Types
9497 //
95 using __self _LIBCPP_NODEBUG = vector;
9698 using value_type = _Tp;
9799 using allocator_type = _Allocator;
98 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<allocator_type>;
99 using reference = value_type&;
100 using const_reference = const value_type&;
100 using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Allocator>;
101 using reference = _Tp&;
102 using const_reference = const _Tp&;
101103 using size_type = typename __alloc_traits::size_type;
102104 using difference_type = typename __alloc_traits::difference_type;
103105 using pointer = typename __alloc_traits::pointer;
......@@ -106,8 +108,8 @@ public:
106108 // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's
107109 // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is
108110 // considered contiguous.
109 using iterator = __bounded_iter<__wrap_iter<pointer> >;
110 using const_iterator = __bounded_iter<__wrap_iter<const_pointer> >;
111 using iterator = __bounded_iter<pointer>;
112 using const_iterator = __bounded_iter<const_pointer>;
111113#else
112114 using iterator = __wrap_iter<pointer>;
113115 using const_iterator = __wrap_iter<const_pointer>;
......@@ -139,7 +141,7 @@ public:
139141#else
140142 noexcept
141143#endif
142 : __alloc_(__a) {
144 : __layout_(__a) {
143145 }
144146
145147 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) {
......@@ -151,9 +153,8 @@ public:
151153 __guard.__complete();
152154 }
153155
154#if _LIBCPP_STD_VER >= 14
155156 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a)
156 : __alloc_(__a) {
157 : __layout_(__a) {
157158 auto __guard = std::__make_exception_guard(__destroy_vector(*this));
158159 if (__n > 0) {
159160 __vallocate(__n);
......@@ -161,7 +162,6 @@ public:
161162 }
162163 __guard.__complete();
163164 }
164#endif
165165
166166 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x) {
167167 auto __guard = std::__make_exception_guard(__destroy_vector(*this));
......@@ -175,7 +175,7 @@ public:
175175 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
176176 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
177177 vector(size_type __n, const value_type& __x, const allocator_type& __a)
178 : __alloc_(__a) {
178 : __layout_(__a) {
179179 auto __guard = std::__make_exception_guard(__destroy_vector(*this));
180180 if (__n > 0) {
181181 __vallocate(__n);
......@@ -198,7 +198,7 @@ public:
198198 int> = 0>
199199 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
200200 vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
201 : __alloc_(__a) {
201 : __layout_(__a) {
202202 __init_with_sentinel(__first, __last);
203203 }
204204
......@@ -219,16 +219,15 @@ public:
219219 int> = 0>
220220 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
221221 vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a)
222 : __alloc_(__a) {
222 : __layout_(__a) {
223223 size_type __n = static_cast<size_type>(std::distance(__first, __last));
224224 __init_with_size(__first, __last, __n);
225225 }
226226
227227#if _LIBCPP_STD_VER >= 23
228228 template <_ContainerCompatibleRange<_Tp> _Range>
229 _LIBCPP_HIDE_FROM_ABI constexpr vector(
230 from_range_t, _Range&& __range, const allocator_type& __alloc = allocator_type())
231 : __alloc_(__alloc) {
229 _LIBCPP_HIDE_FROM_ABI constexpr vector(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
230 : __layout_(__a) {
232231 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
233232 auto __n = static_cast<size_type>(ranges::distance(__range));
234233 __init_with_size(ranges::begin(__range), ranges::end(__range), __n);
......@@ -245,10 +244,10 @@ private:
245244 _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
246245
247246 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
248 if (__vec_.__begin_ != nullptr) {
247 if (__vec_.__layout_.__begin_ptr() != nullptr) {
249248 __vec_.clear();
250249 __vec_.__annotate_delete();
251 __alloc_traits::deallocate(__vec_.__alloc_, __vec_.__begin_, __vec_.capacity());
250 __alloc_traits::deallocate(__vec_.__layout_.__alloc(), __vec_.__layout_.__begin_ptr(), __vec_.capacity());
252251 }
253252 }
254253
......@@ -256,17 +255,19 @@ private:
256255 vector& __vec_;
257256 };
258257
258 using __emplace_back_result_t _LIBCPP_NODEBUG = _If<(_LIBCPP_STD_VER < 17), void, reference>;
259
259260public:
260261 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~vector() { __destroy_vector (*this)(); }
261262
262263 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(const vector& __x)
263 : __alloc_(__alloc_traits::select_on_container_copy_construction(__x.__alloc_)) {
264 __init_with_size(__x.__begin_, __x.__end_, __x.size());
264 : __layout_(__alloc_traits::select_on_container_copy_construction(__x.__layout_.__alloc())) {
265 __init_with_size(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr(), __x.size());
265266 }
266267 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
267268 vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
268 : __alloc_(__a) {
269 __init_with_size(__x.__begin_, __x.__end_, __x.size());
269 : __layout_(__a) {
270 __init_with_size(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr(), __x.size());
270271 }
271272 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(const vector& __x);
272273
......@@ -277,7 +278,7 @@ public:
277278
278279 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
279280 vector(initializer_list<value_type> __il, const allocator_type& __a)
280 : __alloc_(__a) {
281 : __layout_(__a) {
281282 __init_with_size(__il.begin(), __il.end(), __il.size());
282283 }
283284
......@@ -294,8 +295,8 @@ public:
294295 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
295296#endif
296297
297 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
298 vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
298 _LIBCPP_CONSTEXPR_SINCE_CXX20
299 _LIBCPP_HIDE_FROM_ABI vector(vector&& __x, const __type_identity_t<allocator_type>& __a);
299300 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector& operator=(vector&& __x)
300301 _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) {
301302 __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
......@@ -340,23 +341,23 @@ public:
340341#endif
341342
342343 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
343 return this->__alloc_;
344 return this->__layout_.__alloc();
344345 }
345346
346347 //
347348 // Iterators
348349 //
349350 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
350 return __make_iter(__add_alignment_assumption(this->__begin_));
351 return __make_iter(__add_alignment_assumption(this->__layout_.__begin_ptr()));
351352 }
352353 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
353 return __make_iter(__add_alignment_assumption(this->__begin_));
354 return __make_iter(__add_alignment_assumption(this->__layout_.__begin_ptr()));
354355 }
355356 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
356 return __make_iter(__add_alignment_assumption(this->__end_));
357 return __make_iter(__add_alignment_assumption(__layout_.__end_ptr()));
357358 }
358359 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
359 return __make_iter(__add_alignment_assumption(this->__end_));
360 return __make_iter(__add_alignment_assumption(__layout_.__end_ptr()));
360361 }
361362
362363 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
......@@ -391,16 +392,17 @@ public:
391392 // [vector.capacity], capacity
392393 //
393394 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
394 return static_cast<size_type>(this->__end_ - this->__begin_);
395 return __layout_.__size();
395396 }
396397 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT {
397 return static_cast<size_type>(this->__cap_ - this->__begin_);
398 return __layout_.__capacity();
398399 }
399400 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
400 return this->__begin_ == this->__end_;
401 return __layout_.__empty();
401402 }
403
402404 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
403 return std::min<size_type>(__alloc_traits::max_size(this->__alloc_), numeric_limits<difference_type>::max());
405 return std::min<size_type>(__alloc_traits::max_size(__layout_.__alloc()), numeric_limits<difference_type>::max());
404406 }
405407 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n);
406408 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
......@@ -410,50 +412,50 @@ public:
410412 //
411413 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __n) _NOEXCEPT {
412414 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
413 return this->__begin_[__n];
415 return this->__layout_.__begin_ptr()[__n];
414416 }
415417 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference
416418 operator[](size_type __n) const _NOEXCEPT {
417419 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__n < size(), "vector[] index out of bounds");
418 return this->__begin_[__n];
420 return this->__layout_.__begin_ptr()[__n];
419421 }
420422 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference at(size_type __n) {
421423 if (__n >= size())
422424 this->__throw_out_of_range();
423 return this->__begin_[__n];
425 return this->__layout_.__begin_ptr()[__n];
424426 }
425427 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __n) const {
426428 if (__n >= size())
427429 this->__throw_out_of_range();
428 return this->__begin_[__n];
430 return this->__layout_.__begin_ptr()[__n];
429431 }
430432
431433 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT {
432434 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
433 return *this->__begin_;
435 return *this->__layout_.__begin_ptr();
434436 }
435437 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT {
436438 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "front() called on an empty vector");
437 return *this->__begin_;
439 return *this->__layout_.__begin_ptr();
438440 }
439441 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT {
440442 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
441 return *(this->__end_ - 1);
443 return end()[-1];
442444 }
443445 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT {
444446 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "back() called on an empty vector");
445 return *(this->__end_ - 1);
447 return end()[-1];
446448 }
447449
448450 //
449451 // [vector.data], data access
450452 //
451453 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI value_type* data() _NOEXCEPT {
452 return std::__to_address(this->__begin_);
454 return __layout_.__data();
453455 }
454456
455457 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const value_type* data() const _NOEXCEPT {
456 return std::__to_address(this->__begin_);
458 return __layout_.__data();
457459 }
458460
459461 //
......@@ -464,21 +466,15 @@ public:
464466 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x) { emplace_back(std::move(__x)); }
465467
466468 template <class... _Args>
467 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
468#if _LIBCPP_STD_VER >= 17
469 reference
470 emplace_back(_Args&&... __args);
471#else
472 void
473 emplace_back(_Args&&... __args);
474#endif
469 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __emplace_back_result_t emplace_back(_Args&&... __args);
475470
476471 template <class... _Args>
477472 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __emplace_back_assume_capacity(_Args&&... __args) {
478473 _LIBCPP_ASSERT_INTERNAL(
479474 size() < capacity(), "We assume that we have enough space to insert an element at the end of the vector");
480475 _ConstructTransaction __tx(*this, 1);
481 __alloc_traits::construct(this->__alloc_, std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...);
476 __alloc_traits::construct(
477 this->__layout_.__alloc(), std::__to_address(__tx.__pos_), std::forward<_Args>(__args)...);
482478 ++__tx.__pos_;
483479 }
484480
......@@ -487,15 +483,15 @@ public:
487483 _LIBCPP_HIDE_FROM_ABI constexpr void append_range(_Range&& __range) {
488484 if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
489485 auto __len = ranges::distance(__range);
490 if (__len <= __cap_ - __end_) {
486 if (__len <= static_cast<difference_type>(__layout_.__remaining_capacity())) {
491487 __construct_at_end(ranges::begin(__range), ranges::end(__range), __len);
492488 } else {
493 __split_buffer<value_type, allocator_type> __buffer(__recommend(size() + __len), size(), __alloc_);
489 _SplitBuffer __buffer(__recommend(size() + __len), size(), __layout_.__alloc());
494490 __buffer.__construct_at_end_with_size(ranges::begin(__range), __len);
495 __swap_out_circular_buffer(__buffer);
491 __layout_.__relocate(__buffer);
496492 }
497493 } else {
498 vector __buffer(__alloc_);
494 vector __buffer(__layout_.__alloc());
499495 for (auto&& __val : __range)
500496 __buffer.emplace_back(std::forward<decltype(__val)>(__val));
501497 append_range(ranges::as_rvalue_view(__buffer));
......@@ -505,7 +501,7 @@ public:
505501
506502 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() {
507503 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "vector::pop_back called on an empty vector");
508 this->__destruct_at_end(this->__end_ - 1);
504 this->__destruct_at_end(__layout_.__end_ptr() - 1);
509505 }
510506
511507 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, const_reference __x);
......@@ -550,8 +546,8 @@ public:
550546#endif
551547
552548#ifndef _LIBCPP_CXX03_LANG
553 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator
554 insert(const_iterator __position, initializer_list<value_type> __il) {
549 _LIBCPP_CONSTEXPR_SINCE_CXX20
550 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __position, initializer_list<value_type> __il) {
555551 return insert(__position, __il.begin(), __il.end());
556552 }
557553#endif
......@@ -561,7 +557,7 @@ public:
561557
562558 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT {
563559 size_type __old_size = size();
564 __base_destruct_at_end(this->__begin_);
560 __base_destruct_at_end(this->__layout_.__begin_ptr());
565561 __annotate_shrink(__old_size);
566562 }
567563
......@@ -575,27 +571,41 @@ public:
575571 _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
576572#endif
577573
578 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
574 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const _NOEXCEPT {
575 return __layout_.__invariants();
576 }
579577
580578private:
581 pointer __begin_ = nullptr;
582 pointer __end_ = nullptr;
583 _LIBCPP_COMPRESSED_PAIR(pointer, __cap_ = nullptr, allocator_type, __alloc_);
579 __base_type __layout_;
584580
585581 // Allocate space for __n objects
586582 // throws length_error if __n > max_size()
587583 // throws (probably bad_alloc) if memory run out
588 // Precondition: __begin_ == __end_ == __cap_ == nullptr
584 // Precondition: begin() == nullptr
585 // Precondition: size() == 0
586 // Precondition: capacity() == 0
589587 // Precondition: __n > 0
590588 // Postcondition: capacity() >= __n
591589 // Postcondition: size() == 0
592590 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
591 _LIBCPP_ASSERT_INTERNAL(
592 __layout_.__begin_ptr() == nullptr,
593 "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already "
594 "owns a buffer, or a deallocation function didn't reset the layout's begin pointer.");
595 _LIBCPP_ASSERT_INTERNAL(
596 size() == 0,
597 "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already "
598 "owns a buffer, or a deallocation function didn't reset the layout's size.");
599 _LIBCPP_ASSERT_INTERNAL(
600 __layout_.__capacity() == 0,
601 "vector::__vallocate can only be called on a vector that hasn't allocated memory. This vector either already "
602 "owns a buffer, or a deallocation function didn't reset the layout's capacity.");
603 _LIBCPP_ASSERT_INTERNAL(__n > 0, "vector::__vallocate cannot allocate 0 bytes");
604
593605 if (__n > max_size())
594606 this->__throw_length_error();
595 auto __allocation = std::__allocate_at_least(this->__alloc_, __n);
596 __begin_ = __allocation.ptr;
597 __end_ = __allocation.ptr;
598 __cap_ = __begin_ + __allocation.count;
607 auto __allocation = std::__allocate_at_least(this->__layout_.__alloc(), __n);
608 __layout_.__set_layout(__allocation.ptr, 0, __allocation.count);
599609 __annotate_new(0);
600610 }
601611
......@@ -644,7 +654,7 @@ private:
644654 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
645655 __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) {
646656 for (pointer __end_position = __position + __n; __position != __end_position; ++__position, (void)++__first) {
647 __temp_value<value_type, _Allocator> __tmp(this->__alloc_, *__first);
657 __temp_value<value_type, _Allocator> __tmp(this->__layout_.__alloc(), *__first);
648658 *__position = std::move(__tmp.get());
649659 }
650660 }
......@@ -680,10 +690,7 @@ private:
680690 // current implementation, there is no connection between a bounded iterator and its associated container, so we
681691 // don't have a way to update existing valid iterators when the container is resized and thus have to go with
682692 // a laxer approach.
683 return std::__make_bounded_iter(
684 std::__wrap_iter<pointer>(__p),
685 std::__wrap_iter<pointer>(this->__begin_),
686 std::__wrap_iter<pointer>(this->__cap_));
693 return std::__make_bounded_iter(__p, __layout_.__begin_ptr(), __layout_.__capacity_ptr());
687694#else
688695 return iterator(__p);
689696#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
......@@ -692,19 +699,12 @@ private:
692699 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT {
693700#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
694701 // Bound the iterator according to the capacity, rather than the size.
695 return std::__make_bounded_iter(
696 std::__wrap_iter<const_pointer>(__p),
697 std::__wrap_iter<const_pointer>(this->__begin_),
698 std::__wrap_iter<const_pointer>(this->__cap_));
702 return std::__make_bounded_iter(__p, __layout_.__begin_ptr(), __layout_.__capacity_ptr());
699703#else
700704 return const_iterator(__p);
701705#endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
702706 }
703707
704 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
705 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v);
706 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
707 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p);
708708 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
709709 __move_range(pointer __from_s, pointer __from_e, pointer __to);
710710 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign(vector& __c, true_type)
......@@ -751,14 +751,14 @@ private:
751751
752752 struct _ConstructTransaction {
753753 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n)
754 : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
754 : __v_(__v), __pos_(__v.__layout_.__end_ptr()), __new_end_(__pos_ + __n) {
755755 __v_.__annotate_increase(__n);
756756 }
757757
758758 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
759 __v_.__end_ = __pos_;
759 __v_.__layout_.__set_bound_using_pointer(__pos_);
760760 if (__pos_ != __new_end_) {
761 __v_.__annotate_shrink(__new_end_ - __v_.__begin_);
761 __v_.__annotate_shrink(__new_end_ - __v_.__layout_.__begin_ptr());
762762 }
763763 }
764764
......@@ -771,10 +771,10 @@ private:
771771 };
772772
773773 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __base_destruct_at_end(pointer __new_last) _NOEXCEPT {
774 pointer __soon_to_be_end = this->__end_;
774 pointer __soon_to_be_end = __layout_.__end_ptr();
775775 while (__new_last != __soon_to_be_end)
776 __alloc_traits::destroy(this->__alloc_, std::__to_address(--__soon_to_be_end));
777 this->__end_ = __new_last;
776 __alloc_traits::destroy(this->__layout_.__alloc(), std::__to_address(--__soon_to_be_end));
777 __layout_.__set_bound_using_pointer(__new_last);
778778 }
779779
780780 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c) {
......@@ -792,56 +792,38 @@ private:
792792 [[__noreturn__]] _LIBCPP_HIDE_FROM_ABI static void __throw_out_of_range() { std::__throw_out_of_range("vector"); }
793793
794794 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector& __c, true_type) {
795 if (this->__alloc_ != __c.__alloc_) {
795 if (this->__layout_.__alloc() != __c.__layout_.__alloc()) {
796796 clear();
797797 __annotate_delete();
798 __alloc_traits::deallocate(this->__alloc_, this->__begin_, capacity());
799 this->__begin_ = this->__end_ = this->__cap_ = nullptr;
798 __alloc_traits::deallocate(this->__layout_.__alloc(), this->__layout_.__begin_ptr(), capacity());
799 __layout_.__reset_without_allocator();
800800 }
801 this->__alloc_ = __c.__alloc_;
801 this->__layout_.__alloc() = __c.__layout_.__alloc();
802802 }
803803
804804 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const vector&, false_type) {}
805805
806806 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector& __c, true_type)
807807 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
808 this->__alloc_ = std::move(__c.__alloc_);
808 this->__layout_.__alloc() = std::move(__c.__layout_.__alloc());
809809 }
810810
811811 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(vector&, false_type) _NOEXCEPT {}
812812
813813 template <class _Ptr = pointer, __enable_if_t<is_pointer<_Ptr>::value, int> = 0>
814 static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer
814 static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr
815815 __add_alignment_assumption(_Ptr __p) _NOEXCEPT {
816816 if (!__libcpp_is_constant_evaluated()) {
817 return static_cast<pointer>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p))));
817 return static_cast<_Ptr>(__builtin_assume_aligned(__p, _LIBCPP_ALIGNOF(decltype(*__p))));
818818 }
819819 return __p;
820820 }
821821
822822 template <class _Ptr = pointer, __enable_if_t<!is_pointer<_Ptr>::value, int> = 0>
823 static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI pointer
823 static _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Ptr
824824 __add_alignment_assumption(_Ptr __p) _NOEXCEPT {
825825 return __p;
826826 }
827
828 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_layouts(__split_buffer<_Tp, allocator_type>& __sb) {
829 auto __vector_begin = __begin_;
830 auto __vector_sentinel = __end_;
831 auto __vector_cap = __cap_;
832
833 auto __sb_begin = __sb.begin();
834 auto __sb_sentinel = __sb.__raw_sentinel();
835 auto __sb_cap = __sb.__raw_capacity();
836
837 // TODO: replace with __set_valid_range and __set_capacity when vector supports it.
838 __begin_ = __sb_begin;
839 __end_ = __sb_sentinel;
840 __cap_ = __sb_cap;
841
842 __sb.__set_valid_range(__vector_begin, __vector_sentinel);
843 __sb.__set_capacity(__vector_cap);
844 }
845827};
846828
847829#if _LIBCPP_STD_VER >= 17
......@@ -865,60 +847,13 @@ template <ranges::input_range _Range,
865847vector(from_range_t, _Range&&, _Alloc = _Alloc()) -> vector<ranges::range_value_t<_Range>, _Alloc>;
866848#endif
867849
868// __swap_out_circular_buffer relocates the objects in [__begin_, __end_) into the front of __v and swaps the buffers of
869// *this and __v. It is assumed that __v provides space for exactly (__end_ - __begin_) objects in the front. This
870// function has a strong exception guarantee.
871template <class _Tp, class _Allocator>
872_LIBCPP_CONSTEXPR_SINCE_CXX20 void
873vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v) {
874 __annotate_delete();
875 auto __new_begin = __v.begin() - size();
876 std::__uninitialized_allocator_relocate(
877 this->__alloc_, std::__to_address(__begin_), std::__to_address(__end_), std::__to_address(__new_begin));
878 __v.__set_valid_range(__new_begin, __v.end());
879 __end_ = __begin_; // All the objects have been destroyed by relocating them.
880
881 __swap_layouts(__v);
882 __v.__set_data(__v.begin());
883 __annotate_new(size());
884}
885
886// __swap_out_circular_buffer relocates the objects in [__begin_, __p) into the front of __v, the objects in
887// [__p, __end_) into the back of __v and swaps the buffers of *this and __v. It is assumed that __v provides space for
888// exactly (__p - __begin_) objects in the front and space for at least (__end_ - __p) objects in the back. This
889// function has a strong exception guarantee if __begin_ == __p || __end_ == __p.
890template <class _Tp, class _Allocator>
891_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
892vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type>& __v, pointer __p) {
893 __annotate_delete();
894 pointer __ret = __v.begin();
895
896 // Relocate [__p, __end_) first to avoid having a hole in [__begin_, __end_)
897 // in case something in [__begin_, __p) throws.
898 std::__uninitialized_allocator_relocate(
899 this->__alloc_, std::__to_address(__p), std::__to_address(__end_), std::__to_address(__v.end()));
900 auto __relocated_so_far = __end_ - __p;
901 __v.__set_sentinel(__v.end() + __relocated_so_far);
902 __end_ = __p; // The objects in [__p, __end_) have been destroyed by relocating them.
903 auto __new_begin = __v.begin() - (__p - __begin_);
904
905 std::__uninitialized_allocator_relocate(
906 this->__alloc_, std::__to_address(__begin_), std::__to_address(__p), std::__to_address(__new_begin));
907 __v.__set_valid_range(__new_begin, __v.end());
908 __end_ = __begin_; // All the objects have been destroyed by relocating them.
909 __swap_layouts(__v);
910 __v.__set_data(__v.begin());
911 __annotate_new(size());
912 return __ret;
913}
914
915850template <class _Tp, class _Allocator>
916851_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__vdeallocate() _NOEXCEPT {
917 if (this->__begin_ != nullptr) {
852 if (this->__layout_.__begin_ptr() != nullptr) {
918853 clear();
919854 __annotate_delete();
920 __alloc_traits::deallocate(this->__alloc_, this->__begin_, capacity());
921 this->__begin_ = this->__end_ = this->__cap_ = nullptr;
855 __alloc_traits::deallocate(this->__layout_.__alloc(), this->__layout_.__begin_ptr(), capacity());
856 __layout_.__reset_without_allocator();
922857 }
923858}
924859
......@@ -935,7 +870,7 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const {
935870 return std::max<size_type>(2 * __cap, __new_size);
936871}
937872
938// Default constructs __n objects starting at __end_
873// Default constructs __n objects starting at __layout_.__end_ptr()
939874// throws if construction throws
940875// Precondition: __n > 0
941876// Precondition: size() + __n <= capacity()
......@@ -945,11 +880,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__construct_at_end(s
945880 _ConstructTransaction __tx(*this, __n);
946881 const_pointer __new_end = __tx.__new_end_;
947882 for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
948 __alloc_traits::construct(this->__alloc_, std::__to_address(__pos));
883 __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos));
949884 }
950885}
951886
952// Copy constructs __n objects starting at __end_ from __x
887// Copy constructs __n objects starting at __layout_.__end_ptr() from __x
953888// throws if construction throws
954889// Precondition: __n > 0
955890// Precondition: size() + __n <= capacity()
......@@ -961,7 +896,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
961896 _ConstructTransaction __tx(*this, __n);
962897 const_pointer __new_end = __tx.__new_end_;
963898 for (pointer __pos = __tx.__pos_; __pos != __new_end; __tx.__pos_ = ++__pos) {
964 __alloc_traits::construct(this->__alloc_, std::__to_address(__pos), __x);
899 __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos), __x);
965900 }
966901}
967902
......@@ -970,7 +905,8 @@ template <class _InputIterator, class _Sentinel>
970905_LIBCPP_CONSTEXPR_SINCE_CXX20 void
971906vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
972907 _ConstructTransaction __tx(*this, __n);
973 __tx.__pos_ = std::__uninitialized_allocator_copy(this->__alloc_, std::move(__first), std::move(__last), __tx.__pos_);
908 __tx.__pos_ = std::__uninitialized_allocator_copy(
909 this->__layout_.__alloc(), std::move(__first), std::move(__last), __tx.__pos_);
974910}
975911
976912template <class _Tp, class _Allocator>
......@@ -980,22 +916,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato
980916#else
981917 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
982918#endif
983 : __alloc_(std::move(__x.__alloc_)) {
984 this->__begin_ = __x.__begin_;
985 this->__end_ = __x.__end_;
986 this->__cap_ = __x.__cap_;
987 __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr;
919 : __layout_(std::move(__x.__layout_)) {
988920}
989921
990922template <class _Tp, class _Allocator>
991923_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
992924vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
993 : __alloc_(__a) {
994 if (__a == __x.__alloc_) {
995 this->__begin_ = __x.__begin_;
996 this->__end_ = __x.__end_;
997 this->__cap_ = __x.__cap_;
998 __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr;
925 : __layout_(__a) {
926 if (__a == __x.__layout_.__alloc()) {
927 __layout_.__move_assign_without_allocator(__x.__layout_);
999928 } else {
1000929 typedef move_iterator<iterator> _Ip;
1001930 __init_with_size(_Ip(__x.begin()), _Ip(__x.end()), __x.size());
......@@ -1005,7 +934,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_
1005934template <class _Tp, class _Allocator>
1006935_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
1007936 _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
1008 if (this->__alloc_ != __c.__alloc_) {
937 if (this->__layout_.__alloc() != __c.__layout_.__alloc()) {
1009938 typedef move_iterator<iterator> _Ip;
1010939 assign(_Ip(__c.begin()), _Ip(__c.end()));
1011940 } else
......@@ -1017,10 +946,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__move_assign(vector
1017946 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
1018947 __vdeallocate();
1019948 __move_assign_alloc(__c); // this can throw
1020 this->__begin_ = __c.__begin_;
1021 this->__end_ = __c.__end_;
1022 this->__cap_ = __c.__cap_;
1023 __c.__begin_ = __c.__end_ = __c.__cap_ = nullptr;
949 __layout_.__move_assign_without_allocator(__c.__layout_);
1024950}
1025951
1026952template <class _Tp, class _Allocator>
......@@ -1028,7 +954,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato
1028954vector<_Tp, _Allocator>::operator=(const vector& __x) {
1029955 if (this != std::addressof(__x)) {
1030956 __copy_assign_alloc(__x);
1031 assign(__x.__begin_, __x.__end_);
957 assign(__x.__layout_.__begin_ptr(), __x.__layout_.__end_ptr());
1032958 }
1033959 return *this;
1034960}
......@@ -1037,10 +963,11 @@ template <class _Tp, class _Allocator>
1037963template <class _Iterator, class _Sentinel>
1038964_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
1039965vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
1040 pointer __cur = __begin_;
1041 for (; __first != __last && __cur != __end_; ++__first, (void)++__cur)
966 pointer __cur = __layout_.__begin_ptr();
967 pointer __end = __layout_.__end_ptr();
968 for (; __first != __last && __cur != __end; ++__first, (void)++__cur)
1042969 *__cur = *__first;
1043 if (__cur != __end_) {
970 if (__cur != __end) {
1044971 __destruct_at_end(__cur);
1045972 } else {
1046973 for (; __first != __last; ++__first)
......@@ -1054,11 +981,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
1054981vector<_Tp, _Allocator>::__assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n) {
1055982 size_type __new_size = static_cast<size_type>(__n);
1056983 if (__new_size <= capacity()) {
1057 if (__new_size > size()) {
1058 auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), size(), this->__begin_).first;
1059 __construct_at_end(std::move(__mid), std::move(__last), __new_size - size());
984 auto const __size = size();
985 if (__new_size > __size) {
986 auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), __size, this->__layout_.__begin_ptr()).__in_;
987 __construct_at_end(std::move(__mid), std::move(__last), __new_size - __size);
1060988 } else {
1061 pointer __m = std::__copy(std::move(__first), __last, this->__begin_).second;
989 pointer __m = std::__copy(std::move(__first), __last, this->__layout_.__begin_ptr()).__out_;
1062990 this->__destruct_at_end(__m);
1063991 }
1064992 } else {
......@@ -1072,11 +1000,11 @@ template <class _Tp, class _Allocator>
10721000_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) {
10731001 if (__n <= capacity()) {
10741002 size_type __s = size();
1075 std::fill_n(this->__begin_, std::min(__n, __s), __u);
1003 std::fill_n(this->__layout_.__begin_ptr(), std::min(__n, __s), __u);
10761004 if (__n > __s)
10771005 __construct_at_end(__n - __s, __u);
10781006 else
1079 this->__destruct_at_end(this->__begin_ + __n);
1007 this->__destruct_at_end(this->__layout_.__begin_ptr() + __n);
10801008 } else {
10811009 __vdeallocate();
10821010 __vallocate(__recommend(static_cast<size_type>(__n)));
......@@ -1089,8 +1017,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __
10891017 if (__n > capacity()) {
10901018 if (__n > max_size())
10911019 this->__throw_length_error();
1092 __split_buffer<value_type, allocator_type> __v(__n, size(), this->__alloc_);
1093 __swap_out_circular_buffer(__v);
1020 _SplitBuffer __v(__n, size(), this->__layout_.__alloc());
1021 __layout_.__relocate(__v);
10941022 }
10951023}
10961024
......@@ -1100,12 +1028,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE
11001028#if _LIBCPP_HAS_EXCEPTIONS
11011029 try {
11021030#endif // _LIBCPP_HAS_EXCEPTIONS
1103 __split_buffer<value_type, allocator_type> __v(size(), size(), this->__alloc_);
1031 _SplitBuffer __v(size(), size(), this->__layout_.__alloc());
11041032 // The Standard mandates shrink_to_fit() does not increase the capacity.
11051033 // With equal capacity keep the existing buffer. This avoids extra work
11061034 // due to swapping the elements.
11071035 if (__v.capacity() < capacity())
1108 __swap_out_circular_buffer(__v);
1036 __layout_.__relocate(__v);
11091037#if _LIBCPP_HAS_EXCEPTIONS
11101038 } catch (...) {
11111039 }
......@@ -1117,13 +1045,13 @@ template <class _Tp, class _Allocator>
11171045template <class... _Args>
11181046_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
11191047vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
1120 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), size(), this->__alloc_);
1048 _SplitBuffer __v(__recommend(size() + 1), size(), this->__layout_.__alloc());
11211049 // __v.emplace_back(std::forward<_Args>(__args)...);
11221050 pointer __end = __v.end();
1123 __alloc_traits::construct(this->__alloc_, std::__to_address(__end), std::forward<_Args>(__args)...);
1051 __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__end), std::forward<_Args>(__args)...);
11241052 __v.__set_sentinel(++__end);
1125 __swap_out_circular_buffer(__v);
1126 return this->__end_;
1053 __layout_.__relocate(__v);
1054 return __end;
11271055}
11281056
11291057// This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without
......@@ -1144,27 +1072,22 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __if_likely_else(bool _
11441072 }
11451073}
11461074
1147template <class _Tp, class _Allocator>
1075template <class _Tp, class _Alloc>
11481076template <class... _Args>
1149_LIBCPP_CONSTEXPR_SINCE_CXX20 inline
1150#if _LIBCPP_STD_VER >= 17
1151 typename vector<_Tp, _Allocator>::reference
1152#else
1153 void
1154#endif
1155 vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
1156 pointer __end = this->__end_;
1077_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Alloc>::__emplace_back_result_t
1078vector<_Tp, _Alloc>::emplace_back(_Args&&... __args) {
1079 pointer __end = __layout_.__end_ptr();
11571080 std::__if_likely_else(
1158 __end < this->__cap_,
1081 size() != capacity(),
11591082 [&] {
11601083 __emplace_back_assume_capacity(std::forward<_Args>(__args)...);
11611084 ++__end;
11621085 },
11631086 [&] { __end = __emplace_back_slow_path(std::forward<_Args>(__args)...); });
11641087
1165 this->__end_ = __end;
1088 __layout_.__set_bound_using_pointer(__end);
11661089#if _LIBCPP_STD_VER >= 17
1167 return *(__end - 1);
1090 return back();
11681091#endif
11691092}
11701093
......@@ -1174,8 +1097,8 @@ vector<_Tp, _Allocator>::erase(const_iterator __position) {
11741097 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
11751098 __position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator");
11761099 difference_type __ps = __position - cbegin();
1177 pointer __p = this->__begin_ + __ps;
1178 this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
1100 pointer __p = this->__layout_.__begin_ptr() + __ps;
1101 this->__destruct_at_end(std::move(__p + 1, __layout_.__end_ptr(), __p));
11791102 return __make_iter(__p);
11801103}
11811104
......@@ -1183,9 +1106,9 @@ template <class _Tp, class _Allocator>
11831106_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
11841107vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) {
11851108 _LIBCPP_ASSERT_VALID_INPUT_RANGE(__first <= __last, "vector::erase(first, last) called with invalid range");
1186 pointer __p = this->__begin_ + (__first - begin());
1109 pointer __p = this->__layout_.__begin_ptr() + (__first - begin());
11871110 if (__first != __last) {
1188 this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
1111 this->__destruct_at_end(std::move(__p + (__last - __first), __layout_.__end_ptr(), __p));
11891112 }
11901113 return __make_iter(__p);
11911114}
......@@ -1193,13 +1116,13 @@ vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) {
11931116template <class _Tp, class _Allocator>
11941117_LIBCPP_CONSTEXPR_SINCE_CXX20 void
11951118vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) {
1196 pointer __old_last = this->__end_;
1119 pointer __old_last = __layout_.__end_ptr();
11971120 difference_type __n = __old_last - __to;
11981121 {
11991122 pointer __i = __from_s + __n;
12001123 _ConstructTransaction __tx(*this, __from_e - __i);
12011124 for (pointer __pos = __tx.__pos_; __i < __from_e; ++__i, (void)++__pos, __tx.__pos_ = __pos) {
1202 __alloc_traits::construct(this->__alloc_, std::__to_address(__pos), std::move(*__i));
1125 __alloc_traits::construct(this->__layout_.__alloc(), std::__to_address(__pos), std::move(*__i));
12031126 }
12041127 }
12051128 std::move_backward(__from_s, __from_s + __n, __old_last);
......@@ -1208,21 +1131,22 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe
12081131template <class _Tp, class _Allocator>
12091132_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
12101133vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) {
1211 pointer __p = this->__begin_ + (__position - begin());
1212 if (this->__end_ < this->__cap_) {
1213 if (__p == this->__end_) {
1134 pointer __p = this->__layout_.__begin_ptr() + (__position - begin());
1135 if (size() != capacity()) {
1136 pointer __end = __layout_.__end_ptr();
1137 if (__p == __end) {
12141138 __emplace_back_assume_capacity(__x);
12151139 } else {
1216 __move_range(__p, this->__end_, __p + 1);
1140 __move_range(__p, __end, __p + 1);
12171141 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
1218 if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x)))
1142 if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end), std::addressof(__x)))
12191143 ++__xr;
12201144 *__p = *__xr;
12211145 }
12221146 } else {
1223 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1147 _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc());
12241148 __v.emplace_back(__x);
1225 __p = __swap_out_circular_buffer(__v, __p);
1149 __p = __layout_.__relocate_with_pivot(__v, __p);
12261150 }
12271151 return __make_iter(__p);
12281152}
......@@ -1230,18 +1154,19 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
12301154template <class _Tp, class _Allocator>
12311155_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
12321156vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) {
1233 pointer __p = this->__begin_ + (__position - begin());
1234 if (this->__end_ < this->__cap_) {
1235 if (__p == this->__end_) {
1157 pointer __p = this->__layout_.__begin_ptr() + (__position - begin());
1158 if (size() != capacity()) {
1159 pointer __end = __layout_.__end_ptr();
1160 if (__p == __end) {
12361161 __emplace_back_assume_capacity(std::move(__x));
12371162 } else {
1238 __move_range(__p, this->__end_, __p + 1);
1163 __move_range(__p, __end, __p + 1);
12391164 *__p = std::move(__x);
12401165 }
12411166 } else {
1242 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1167 _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc());
12431168 __v.emplace_back(std::move(__x));
1244 __p = __swap_out_circular_buffer(__v, __p);
1169 __p = __layout_.__relocate_with_pivot(__v, __p);
12451170 }
12461171 return __make_iter(__p);
12471172}
......@@ -1250,19 +1175,20 @@ template <class _Tp, class _Allocator>
12501175template <class... _Args>
12511176_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
12521177vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
1253 pointer __p = this->__begin_ + (__position - begin());
1254 if (this->__end_ < this->__cap_) {
1255 if (__p == this->__end_) {
1178 pointer __p = this->__layout_.__begin_ptr() + (__position - begin());
1179 if (size() != capacity()) {
1180 pointer __end = __layout_.__end_ptr();
1181 if (__p == __end) {
12561182 __emplace_back_assume_capacity(std::forward<_Args>(__args)...);
12571183 } else {
1258 __temp_value<value_type, _Allocator> __tmp(this->__alloc_, std::forward<_Args>(__args)...);
1259 __move_range(__p, this->__end_, __p + 1);
1184 __temp_value<value_type, _Allocator> __tmp(this->__layout_.__alloc(), std::forward<_Args>(__args)...);
1185 __move_range(__p, __end, __p + 1);
12601186 *__p = std::move(__tmp.get());
12611187 }
12621188 } else {
1263 __split_buffer<value_type, allocator_type> __v(__recommend(size() + 1), __p - this->__begin_, this->__alloc_);
1189 _SplitBuffer __v(__recommend(size() + 1), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc());
12641190 __v.emplace_back(std::forward<_Args>(__args)...);
1265 __p = __swap_out_circular_buffer(__v, __p);
1191 __p = __layout_.__relocate_with_pivot(__v, __p);
12661192 }
12671193 return __make_iter(__p);
12681194}
......@@ -1270,27 +1196,28 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
12701196template <class _Tp, class _Allocator>
12711197_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::iterator
12721198vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) {
1273 pointer __p = this->__begin_ + (__position - begin());
1199 pointer __p = this->__layout_.__begin_ptr() + (__position - begin());
12741200 if (__n > 0) {
1275 if (__n <= static_cast<size_type>(this->__cap_ - this->__end_)) {
1201 if (__n <= __layout_.__remaining_capacity()) {
12761202 size_type __old_n = __n;
1277 pointer __old_last = this->__end_;
1278 if (__n > static_cast<size_type>(this->__end_ - __p)) {
1279 size_type __cx = __n - (this->__end_ - __p);
1203 pointer __end = __layout_.__end_ptr();
1204 pointer __old_last = __end;
1205 if (__n > static_cast<size_type>(__end - __p)) {
1206 size_type __cx = __n - (__end - __p);
12801207 __construct_at_end(__cx, __x);
12811208 __n -= __cx;
12821209 }
12831210 if (__n > 0) {
12841211 __move_range(__p, __old_last, __p + __old_n);
12851212 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
1286 if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x)))
1213 if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end), std::addressof(__x)))
12871214 __xr += __old_n;
12881215 std::fill_n(__p, __n, *__xr);
12891216 }
12901217 } else {
1291 __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
1218 _SplitBuffer __v(__recommend(size() + __n), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc());
12921219 __v.__construct_at_end(__n, __x);
1293 __p = __swap_out_circular_buffer(__v, __p);
1220 __p = __layout_.__relocate_with_pivot(__v, __p);
12941221 }
12951222 }
12961223 return __make_iter(__p);
......@@ -1301,30 +1228,38 @@ template <class _InputIterator, class _Sentinel>
13011228_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
13021229vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
13031230 difference_type __off = __position - begin();
1304 pointer __p = this->__begin_ + __off;
1305 pointer __old_last = this->__end_;
1306 for (; this->__end_ != this->__cap_ && __first != __last; ++__first)
1231 pointer __p = this->__layout_.__begin_ptr() + __off;
1232 pointer __old_last = __layout_.__end_ptr();
1233 for (; size() != capacity() && __first != __last; ++__first)
13071234 __emplace_back_assume_capacity(*__first);
13081235
13091236 if (__first == __last)
1310 (void)std::rotate(__p, __old_last, this->__end_);
1237 (void)std::rotate(__p, __old_last, __layout_.__end_ptr());
13111238 else {
1312 __split_buffer<value_type, allocator_type> __v(__alloc_);
1313 auto __guard = std::__make_exception_guard(
1314 _AllocatorDestroyRangeReverse<allocator_type, pointer>(__alloc_, __old_last, this->__end_));
1239 _SplitBuffer __v(__layout_.__alloc());
1240 pointer __end = __layout_.__end_ptr();
1241 auto __guard = std::__make_exception_guard(
1242 _AllocatorDestroyRangeReverse<allocator_type, pointer>(__layout_.__alloc(), __old_last, __end));
13151243 __v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
1316 __split_buffer<value_type, allocator_type> __merged(
1317 __recommend(size() + __v.size()), __off, __alloc_); // has `__off` positions available at the front
1244 _SplitBuffer __merged(
1245 __recommend(size() + __v.size()), __off, __layout_.__alloc()); // has `__off` positions available at the front
13181246 std::__uninitialized_allocator_relocate(
1319 __alloc_, std::__to_address(__old_last), std::__to_address(this->__end_), std::__to_address(__merged.end()));
1320 __guard.__complete(); // Release the guard once objects in [__old_last_, __end_) have been successfully relocated.
1321 __merged.__set_sentinel(__merged.end() + (this->__end_ - __old_last));
1322 this->__end_ = __old_last;
1247 __layout_.__alloc(),
1248 std::__to_address(__old_last),
1249 std::__to_address(__layout_.__end_ptr()),
1250 std::__to_address(__merged.end()));
1251 __guard.__complete(); // Release the guard once objects in [__old_last_, __layout_.__end_ptr()) have been
1252 // successfully relocated.
1253 __merged.__set_sentinel(__merged.end() + (__layout_.__end_ptr() - __old_last));
1254 __layout_.__set_bound_using_pointer(__old_last);
13231255 std::__uninitialized_allocator_relocate(
1324 __alloc_, std::__to_address(__v.begin()), std::__to_address(__v.end()), std::__to_address(__merged.end()));
1256 __layout_.__alloc(),
1257 std::__to_address(__v.begin()),
1258 std::__to_address(__v.end()),
1259 std::__to_address(__merged.end()));
13251260 __merged.__set_sentinel(__merged.size() + __v.size());
13261261 __v.__set_sentinel(__v.begin());
1327 __p = __swap_out_circular_buffer(__merged, __p);
1262 __p = __layout_.__relocate_with_pivot(__merged, __p);
13281263 }
13291264 return __make_iter(__p);
13301265}
......@@ -1334,16 +1269,17 @@ template <class _AlgPolicy, class _Iterator, class _Sentinel>
13341269_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::iterator
13351270vector<_Tp, _Allocator>::__insert_with_size(
13361271 const_iterator __position, _Iterator __first, _Sentinel __last, difference_type __n) {
1337 pointer __p = this->__begin_ + (__position - begin());
1272 pointer __p = this->__layout_.__begin_ptr() + (__position - begin());
13381273 if (__n > 0) {
1339 if (__n <= this->__cap_ - this->__end_) {
1340 pointer __old_last = this->__end_;
1341 difference_type __dx = this->__end_ - __p;
1274 if (__n <= static_cast<difference_type>(__layout_.__remaining_capacity())) {
1275 pointer __end = __layout_.__end_ptr();
1276 pointer __old_last = __end;
1277 difference_type __dx = __end - __p;
13421278 if (__n > __dx) {
13431279#if _LIBCPP_STD_VER >= 23
13441280 if constexpr (!forward_iterator<_Iterator>) {
13451281 __construct_at_end(std::move(__first), std::move(__last), __n);
1346 std::rotate(__p, __old_last, this->__end_);
1282 std::rotate(__p, __old_last, __end);
13471283 } else
13481284#endif
13491285 {
......@@ -1359,9 +1295,9 @@ vector<_Tp, _Allocator>::__insert_with_size(
13591295 __insert_assign_n_unchecked<_AlgPolicy>(std::move(__first), __n, __p);
13601296 }
13611297 } else {
1362 __split_buffer<value_type, allocator_type> __v(__recommend(size() + __n), __p - this->__begin_, this->__alloc_);
1298 _SplitBuffer __v(__recommend(size() + __n), __p - this->__layout_.__begin_ptr(), this->__layout_.__alloc());
13631299 __v.__construct_at_end_with_size(std::move(__first), __n);
1364 __p = __swap_out_circular_buffer(__v, __p);
1300 __p = __layout_.__relocate_with_pivot(__v, __p);
13651301 }
13661302 }
13671303 return __make_iter(__p);
......@@ -1374,12 +1310,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n
13741310 if (__new_size <= capacity()) {
13751311 __construct_at_end(__new_size - __current_size);
13761312 } else {
1377 __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_);
1313 _SplitBuffer __v(__recommend(__new_size), __current_size, __layout_.__alloc());
13781314 __v.__construct_at_end(__new_size - __current_size);
1379 __swap_out_circular_buffer(__v);
1315 __layout_.__relocate(__v);
13801316 }
13811317 } else if (__current_size > __new_size) {
1382 this->__destruct_at_end(this->__begin_ + __new_size);
1318 this->__destruct_at_end(this->__layout_.__begin_ptr() + __new_size);
13831319 }
13841320}
13851321
......@@ -1390,12 +1326,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n
13901326 if (__new_size <= capacity())
13911327 __construct_at_end(__new_size - __current_size, __x);
13921328 else {
1393 __split_buffer<value_type, allocator_type> __v(__recommend(__new_size), __current_size, __alloc_);
1329 _SplitBuffer __v(__recommend(__new_size), __current_size, __layout_.__alloc());
13941330 __v.__construct_at_end(__new_size - __current_size, __x);
1395 __swap_out_circular_buffer(__v);
1331 __layout_.__relocate(__v);
13961332 }
13971333 } else if (__current_size > __new_size) {
1398 this->__destruct_at_end(this->__begin_ + __new_size);
1334 this->__destruct_at_end(this->__layout_.__begin_ptr() + __new_size);
13991335 }
14001336}
14011337
......@@ -1408,29 +1344,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
14081344#endif
14091345{
14101346 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
1411 __alloc_traits::propagate_on_container_swap::value || this->__alloc_ == __x.__alloc_,
1347 __alloc_traits::propagate_on_container_swap::value || __layout_.__alloc() == __x.__layout_.__alloc(),
14121348 "vector::swap: Either propagate_on_container_swap must be true"
14131349 " or the allocators must compare equal");
1414 std::swap(this->__begin_, __x.__begin_);
1415 std::swap(this->__end_, __x.__end_);
1416 std::swap(this->__cap_, __x.__cap_);
1417 std::__swap_allocator(this->__alloc_, __x.__alloc_);
1418}
1419
1420template <class _Tp, class _Allocator>
1421_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const {
1422 if (this->__begin_ == nullptr) {
1423 if (this->__end_ != nullptr || this->__cap_ != nullptr)
1424 return false;
1425 } else {
1426 if (this->__begin_ > this->__end_)
1427 return false;
1428 if (this->__begin_ == this->__cap_)
1429 return false;
1430 if (this->__end_ > this->__cap_)
1431 return false;
1432 }
1433 return true;
1350 __layout_.__swap(__x.__layout_);
14341351}
14351352
14361353#if _LIBCPP_STD_VER >= 20
lib/libcxx/include/__vector/vector_bool.h+10-20
......@@ -45,6 +45,7 @@
4545#include <__type_traits/is_nothrow_constructible.h>
4646#include <__type_traits/type_identity.h>
4747#include <__utility/exception_guard.h>
48#include <__utility/exchange.h>
4849#include <__utility/forward.h>
4950#include <__utility/move.h>
5051#include <__utility/swap.h>
......@@ -151,9 +152,7 @@ public:
151152 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector (*this)(); }
152153
153154 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n);
154#if _LIBCPP_STD_VER >= 14
155155 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a);
156#endif
157156 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v);
158157 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
159158 vector(size_type __n, const value_type& __v, const allocator_type& __a);
......@@ -604,7 +603,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n)
604603 }
605604}
606605
607#if _LIBCPP_STD_VER >= 14
608606template <class _Allocator>
609607_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
610608 : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(static_cast<__storage_allocator>(__a)) {
......@@ -614,7 +612,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, co
614612 __size_ = __n;
615613 }
616614}
617#endif
618615
619616template <class _Allocator>
620617_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
......@@ -740,13 +737,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocat
740737#else
741738 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
742739#endif
743 : __begin_(__v.__begin_),
744 __size_(__v.__size_),
745 __cap_(__v.__cap_),
740 : __begin_(std::__exchange(__v.__begin_, nullptr)),
741 __size_(std::__exchange(__v.__size_, 0)),
742 __cap_(std::__exchange(__v.__cap_, 0)),
746743 __alloc_(std::move(__v.__alloc_)) {
747 __v.__begin_ = nullptr;
748 __v.__size_ = 0;
749 __v.__cap_ = 0;
750744}
751745
752746template <class _Allocator>
......@@ -754,11 +748,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
754748vector<bool, _Allocator>::vector(vector&& __v, const __type_identity_t<allocator_type>& __a)
755749 : __begin_(nullptr), __size_(0), __cap_(0), __alloc_(__a) {
756750 if (__a == allocator_type(__v.__alloc_)) {
757 this->__begin_ = __v.__begin_;
758 this->__size_ = __v.__size_;
759 this->__cap_ = __v.__cap_;
760 __v.__begin_ = nullptr;
761 __v.__cap_ = __v.__size_ = 0;
751 __begin_ = std::__exchange(__v.__begin_, nullptr);
752 __size_ = std::__exchange(__v.__size_, 0);
753 __cap_ = std::__exchange(__v.__cap_, 0);
762754 } else if (__v.size() > 0) {
763755 __vallocate(__v.size());
764756 __size_ = __v.__size_;
......@@ -787,11 +779,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::__move_assign(vecto
787779 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
788780 __vdeallocate();
789781 __move_assign_alloc(__c);
790 this->__begin_ = __c.__begin_;
791 this->__size_ = __c.__size_;
792 this->__cap_ = __c.__cap_;
793 __c.__begin_ = nullptr;
794 __c.__cap_ = __c.__size_ = 0;
782 __begin_ = std::__exchange(__c.__begin_, nullptr);
783 __size_ = std::__exchange(__c.__size_, 0);
784 __cap_ = std::__exchange(__c.__cap_, 0);
795785}
796786
797787template <class _Allocator>
lib/libcxx/include/__verbose_abort+2
......@@ -20,8 +20,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2020
2121// This function should never be called directly from the code -- it should only be called through
2222// the _LIBCPP_VERBOSE_ABORT macro.
23_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2324[[__noreturn__]] _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(
2425 __printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...) _NOEXCEPT;
26_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2527
2628// _LIBCPP_VERBOSE_ABORT(format, args...)
2729//
lib/libcxx/include/__verbose_trap+1-12
......@@ -16,21 +16,10 @@
1616# pragma GCC system_header
1717#endif
1818
19_LIBCPP_BEGIN_NAMESPACE_STD
20
2119#if __has_builtin(__builtin_verbose_trap)
22// AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream
23// version before upstream Clang actually got the builtin.
24// TODO: Remove once AppleClang supports the two-arguments version of the builtin.
25# if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
26# define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap(message)
27# else
28# define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message)
29# endif
20# define _LIBCPP_VERBOSE_TRAP(message) __builtin_verbose_trap("libc++", message)
3021#else
3122# define _LIBCPP_VERBOSE_TRAP(message) ((void)message, __builtin_trap())
3223#endif
3324
34_LIBCPP_END_NAMESPACE_STD
35
3625#endif // _LIBCPP___VERBOSE_TRAP
lib/libcxx/include/algorithm+57-2
......@@ -883,6 +883,13 @@ namespace ranges {
883883 uniform_random_bit_generator<remove_reference_t<Gen>>
884884 O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20
885885
886 template<permutable I, sentinel_for<I> S>
887 constexpr subrange<I> ranges::shift_left(I first, S last, iter_difference_t<I> n); // since C++23
888
889 template<forward_range R>
890 requires permutable<iterator_t<R>>
891 constexpr borrowed_subrange_t<R> ranges::shift_left(R&& r, range_difference_t<R> n) // since C++23
892
886893 template<random_access_iterator I, sentinel_for<I> S, class Gen>
887894 requires permutable<I> &&
888895 uniform_random_bit_generator<remove_reference_t<Gen>>
......@@ -944,6 +951,33 @@ namespace ranges {
944951 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
945952 constexpr auto fold_left(R&& r, T init, F f); // since C++23
946953
954 template<input_iterator I, sentinel_for<I> S,
955 indirectly-binary-left-foldable<iter_value_t<I>, I> F>
956 requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
957 constexpr auto ranges::fold_left_first(I first, S last, F f); // since C++23
958
959 template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F>
960 requires constructible_from<range_value_t<R>, range_reference_t<R>>
961 constexpr auto ranges::fold_left_first(R&& r, F f); // since C++23
962
963 template<bidirectional_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
964 indirectly-binary-right-foldable<T, I> F>
965 constexpr auto ranges::fold_right(I first, S last, T init, F f); // since C++23
966
967 template<bidirectional_range R, class T = range_value_t<R>,
968 indirectly-binary-right-foldable<T, iterator_t<R>> F>
969 constexpr auto ranges::fold_right(R&& r, T init, F f); // since C++23
970
971 template<bidirectional_iterator I, sentinel_for<I> S,
972 indirectly-binary-right-foldable<iter_value_t<I>, I> F>
973 requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
974 constexpr auto ranges::fold_right_last(I first, S last, F f); // since C++23
975
976 template<bidirectional_range R,
977 indirectly-binary-right-foldable<range_value_t<R>, iterator_t<R>> F>
978 requires constructible_from<range_value_t<R>, range_reference_t<R>>
979 constexpr auto ranges::fold_right_last(R&& r, F f); // since C++23
980
947981 template<class I, class T>
948982 using fold_left_with_iter_result = in_value_result<I, T>; // since C++23
949983
......@@ -954,6 +988,18 @@ namespace ranges {
954988 template<input_range R, class T, indirectly-binary-left-foldable<T, iterator_t<R>> F>
955989 constexpr see below fold_left_with_iter(R&& r, T init, F f); // since C++23
956990
991 template<class I, class T>
992 using fold_left_first_with_iter_result = in_value_result<I, T>; // since C++23
993
994 template<input_iterator I, sentinel_for<I> S,
995 indirectly-binary-left-foldable<iter_value_t<I>, I> F>
996 requires constructible_from<iter_value_t<I>, iter_reference_t<I>>
997 constexpr see below ranges::fold_left_first_with_iter(I first, S last, F f); // since C++23
998
999 template<input_range R, indirectly-binary-left-foldable<range_value_t<R>, iterator_t<R>> F>
1000 requires constructible_from<range_value_t<R>, range_reference_t<R>>
1001 constexpr see below ranges::fold_left_first_with_iter(R&& r, F f); // since C++23
1002
9571003 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
9581004 class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
9591005 requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
......@@ -1489,6 +1535,13 @@ template<class ForwardIterator>
14891535 shift_right(ForwardIterator first, ForwardIterator last,
14901536 typename iterator_traits<ForwardIterator>::difference_type n); // C++20
14911537
1538 template<permutable I, sentinel_for<I> S>
1539 constexpr subrange<I> ranges::shift_right(I first, S last, iter_difference_t<I> n); // since C++23
1540
1541 template<forward_range R>
1542 requires permutable<iterator_t<R>>
1543 constexpr borrowed_subrange_t<R> ranges::shift_right(R&& r, range_difference_t<R> n) // since C++23
1544
14921545template <class InputIterator, class Predicate>
14931546 constexpr bool // constexpr since C++20
14941547 is_partitioned(InputIterator first, InputIterator last, Predicate pred);
......@@ -2035,6 +2088,8 @@ template <class BidirectionalIterator, class Compare>
20352088# include <__algorithm/ranges_ends_with.h>
20362089# include <__algorithm/ranges_find_last.h>
20372090# include <__algorithm/ranges_fold.h>
2091# include <__algorithm/ranges_shift_left.h>
2092# include <__algorithm/ranges_shift_right.h>
20382093# include <__algorithm/ranges_starts_with.h>
20392094# endif // _LIBCPP_STD_VER >= 23
20402095
......@@ -2049,11 +2104,11 @@ template <class BidirectionalIterator, class Compare>
20492104# pragma GCC system_header
20502105# endif
20512106
2052# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 14
2107# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 14
20532108# include <execution>
20542109# endif
20552110
2056# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2111# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
20572112# include <atomic>
20582113# include <bit>
20592114# include <concepts>
lib/libcxx/include/any+11-9
......@@ -120,16 +120,20 @@ _LIBCPP_PUSH_MACROS
120120# include <__undef_macros>
121121
122122_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
123_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
124
123125class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast {
124126public:
125127 const char* what() const _NOEXCEPT override;
126128};
127_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
128129
129_LIBCPP_BEGIN_NAMESPACE_STD
130_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
131_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
130132
131133# if _LIBCPP_STD_VER >= 17
132134
135_LIBCPP_BEGIN_NAMESPACE_STD
136
133137[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_any_cast() {
134138# if _LIBCPP_HAS_EXCEPTIONS
135139 throw bad_any_cast();
......@@ -522,8 +526,6 @@ template <class _ValueType>
522526
523527template <class _ValueType>
524528[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) noexcept {
525 static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
526 static_assert(!is_reference_v<_ValueType>, "_ValueType may not be a reference.");
527529 return std::any_cast<_ValueType>(const_cast<any*>(__any));
528530}
529531
......@@ -550,17 +552,17 @@ template <class _ValueType>
550552 return nullptr;
551553}
552554
553# endif // _LIBCPP_STD_VER >= 17
554
555555_LIBCPP_END_NAMESPACE_STD
556556
557# endif // _LIBCPP_STD_VER >= 17
558
557559_LIBCPP_POP_MACROS
558560
559# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
561# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17
560562# include <chrono>
561563# endif
562564
563# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
565# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
564566# include <atomic>
565567# include <concepts>
566568# include <cstdlib>
......@@ -572,7 +574,7 @@ _LIBCPP_POP_MACROS
572574# include <variant>
573575# endif
574576
575# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
577# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
576578# include <cstring>
577579# include <limits>
578580# endif
lib/libcxx/include/array+1-1
......@@ -594,7 +594,7 @@ _LIBCPP_END_NAMESPACE_STD
594594
595595_LIBCPP_POP_MACROS
596596
597# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
597# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
598598# include <algorithm>
599599# include <concepts>
600600# include <cstdlib>
lib/libcxx/include/atomic+1-5
......@@ -626,11 +626,7 @@ template <class T>
626626# pragma GCC system_header
627627# endif
628628
629# if !_LIBCPP_HAS_ATOMIC_HEADER
630# error <atomic> is not implemented
631# endif
632
633# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
629# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
634630# include <cmath>
635631# include <compare>
636632# include <cstddef>
lib/libcxx/include/barrier+3-1
......@@ -95,6 +95,7 @@ using __barrier_phase_t _LIBCPP_NODEBUG = uint8_t;
9595
9696class __barrier_algorithm_base;
9797
98_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
9899[[__gnu__::__returns_nonnull__, __gnu__::__malloc__]]
99100_LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorithm_base(ptrdiff_t& __expected);
100101
......@@ -104,6 +105,7 @@ __arrive_barrier_algorithm_base([[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barr
104105
105106_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(
106107 [[__gnu__::__nonnull__]] _LIBCPP_NOESCAPE __barrier_algorithm_base* __barrier) noexcept;
108_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
107109
108110template <class _CompletionF>
109111class __barrier_base {
......@@ -190,7 +192,7 @@ _LIBCPP_POP_MACROS
190192
191193# endif // _LIBCPP_HAS_THREADS
192194
193# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
195# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
194196# include <atomic>
195197# include <concepts>
196198# include <iterator>
lib/libcxx/include/bit+1-1
......@@ -90,7 +90,7 @@ namespace std {
9090# pragma GCC system_header
9191# endif
9292
93# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
93# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
9494# include <cstdlib>
9595# include <iosfwd>
9696# include <limits>
lib/libcxx/include/bitset+1-1
......@@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD
971971
972972_LIBCPP_POP_MACROS
973973
974# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
974# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
975975# include <concepts>
976976# include <cstdlib>
977977# include <optional>
lib/libcxx/include/cctype+5-63
......@@ -39,13 +39,11 @@ int toupper(int c);
3939#else
4040# include <__config>
4141
42# include <ctype.h>
43
44# ifndef _LIBCPP_CTYPE_H
45# error <cctype> tried including <ctype.h> but didn't find libc++'s <ctype.h> header. \
46 This usually means that your header search paths are not configured properly. \
47 The header search paths should contain the C++ Standard Library headers before \
48 any C Standard Library.
42# if __has_include(<ctype.h>)
43# include <ctype.h>
44# ifdef _LIBCPP_CTYPE_H
45# error "If libc++ starts defining <ctype.h>, the __has_include check should move to libc++'s <ctype.h>"
46# endif
4947# endif
5048
5149# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
......@@ -54,62 +52,6 @@ int toupper(int c);
5452
5553_LIBCPP_BEGIN_NAMESPACE_STD
5654
57# ifdef isalnum
58# undef isalnum
59# endif
60
61# ifdef isalpha
62# undef isalpha
63# endif
64
65# ifdef isblank
66# undef isblank
67# endif
68
69# ifdef iscntrl
70# undef iscntrl
71# endif
72
73# ifdef isdigit
74# undef isdigit
75# endif
76
77# ifdef isgraph
78# undef isgraph
79# endif
80
81# ifdef islower
82# undef islower
83# endif
84
85# ifdef isprint
86# undef isprint
87# endif
88
89# ifdef ispunct
90# undef ispunct
91# endif
92
93# ifdef isspace
94# undef isspace
95# endif
96
97# ifdef isupper
98# undef isupper
99# endif
100
101# ifdef isxdigit
102# undef isxdigit
103# endif
104
105# ifdef tolower
106# undef tolower
107# endif
108
109# ifdef toupper
110# undef toupper
111# endif
112
11355using ::isalnum _LIBCPP_USING_IF_EXISTS;
11456using ::isalpha _LIBCPP_USING_IF_EXISTS;
11557using ::isblank _LIBCPP_USING_IF_EXISTS;
lib/libcxx/include/cfenv+5-8
......@@ -57,14 +57,11 @@ int feupdateenv(const fenv_t* envp);
5757#else
5858# include <__config>
5959
60# include <fenv.h>
61
62# ifndef _LIBCPP_FENV_H
63# error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.h> header. \
64 This usually means that your header search paths are not configured properly. \
65 The header search paths should contain the C++ Standard Library headers before \
66 any C Standard Library, and you are probably using compiler flags that make that \
67 not be the case.
60# if __has_include(<fenv.h>)
61# include <fenv.h>
62# ifdef _LIBCPP_FENV_H
63# error "If libc++ starts defining <fenv.h>, the __has_include check should move to libc++'s <fenv.h>"
64# endif
6865# endif
6966
7067# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/cfloat+6-8
......@@ -74,14 +74,12 @@ Macros:
7474#else
7575# include <__config>
7676
77# include <float.h>
78
79# ifndef _LIBCPP_FLOAT_H
80# error <cfloat> tried including <float.h> but didn't find libc++'s <float.h> header. \
81 This usually means that your header search paths are not configured properly. \
82 The header search paths should contain the C++ Standard Library headers before \
83 any C Standard Library, and you are probably using compiler flags that make that \
84 not be the case.
77// <float.h> is not provided by libc++
78# if __has_include(<float.h>)
79# include <float.h>
80# ifdef _LIBCPP_FLOAT_H
81# error "If libc++ starts defining <float.h>, the __has_include check should move to libc++'s <float.h>"
82# endif
8583# endif
8684
8785# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/charconv+1-5
......@@ -100,11 +100,7 @@ namespace std {
100100# pragma GCC system_header
101101# endif
102102
103_LIBCPP_BEGIN_NAMESPACE_STD
104
105_LIBCPP_END_NAMESPACE_STD
106
107# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
103# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
108104# include <cmath>
109105# include <concepts>
110106# include <cstddef>
lib/libcxx/include/chrono+4-3
......@@ -46,6 +46,7 @@ public:
4646template <class Rep, class Period = ratio<1>>
4747class duration
4848{
49 static_assert(__is_unqualified_v<Rep>, "A duration representation cannot be qualified");
4950 static_assert(!__is_duration<Rep>::value, "A duration representation can not be a duration");
5051 static_assert(__is_ratio<Period>::value, "Second template parameter of duration must be a std::ratio");
5152 static_assert(Period::num > 0, "duration period must be positive");
......@@ -1148,13 +1149,13 @@ namespace std {
11481149# pragma GCC system_header
11491150# endif
11501151
1151# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
1152# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17
11521153# include <cstdint>
11531154# include <stdexcept>
11541155# include <string_view>
11551156# endif
11561157
1157# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1158# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
11581159# include <bit>
11591160# include <concepts>
11601161# include <cstring>
......@@ -1164,7 +1165,7 @@ namespace std {
11641165# include <vector>
11651166# endif
11661167
1167# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20
1168# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 20
11681169# include <charconv>
11691170# if _LIBCPP_HAS_LOCALIZATION
11701171# include <locale>
lib/libcxx/include/cinttypes+5-8
......@@ -244,14 +244,11 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
244244// [cinttypes.syn]
245245# include <cstdint>
246246
247# include <inttypes.h>
248
249# ifndef _LIBCPP_INTTYPES_H
250# error <cinttypes> tried including <inttypes.h> but didn't find libc++'s <inttypes.h> header. \
251 This usually means that your header search paths are not configured properly. \
252 The header search paths should contain the C++ Standard Library headers before \
253 any C Standard Library, and you are probably using compiler flags that make that \
254 not be the case.
247# if __has_include(<inttypes.h>)
248# include <inttypes.h>
249# ifdef _LIBCPP_INTTYPES_H
250# error "If libc++ starts defining <inttypes.h>, the __has_include check should move to libc++'s <float.h>"
251# endif
255252# endif
256253
257254# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
lib/libcxx/include/cmath+1-1
......@@ -612,7 +612,7 @@ _LIBCPP_END_NAMESPACE_STD
612612
613613_LIBCPP_POP_MACROS
614614
615# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
615# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
616616# include <type_traits>
617617# endif
618618#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/codecvt+3-1
......@@ -71,6 +71,7 @@ class codecvt_utf8_utf16
7171# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
7272
7373_LIBCPP_BEGIN_NAMESPACE_STD
74_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
7475
7576enum _LIBCPP_DEPRECATED_IN_CXX17 codecvt_mode { consume_header = 4, generate_header = 2, little_endian = 1 };
7677
......@@ -579,13 +580,14 @@ public:
579580};
580581_LIBCPP_SUPPRESS_DEPRECATED_POP
581582
583_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
582584_LIBCPP_END_NAMESPACE_STD
583585
584586# endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
585587
586588# endif // _LIBCPP_HAS_LOCALIZATION
587589
588# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
590# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
589591# include <atomic>
590592# include <concepts>
591593# include <cstddef>
lib/libcxx/include/compare+1-1
......@@ -167,7 +167,7 @@ namespace std {
167167# pragma GCC system_header
168168# endif
169169
170# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
170# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
171171# include <cmath>
172172# include <cstddef>
173173# include <type_traits>
lib/libcxx/include/complex+1-1
......@@ -1484,7 +1484,7 @@ _LIBCPP_END_NAMESPACE_STD
14841484
14851485_LIBCPP_POP_MACROS
14861486
1487# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1487# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
14881488# include <iosfwd>
14891489# include <stdexcept>
14901490# include <type_traits>
lib/libcxx/include/concepts+1-1
......@@ -161,7 +161,7 @@ namespace std {
161161
162162# include <version>
163163
164# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
164# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
165165# include <cstddef>
166166# include <type_traits>
167167# endif
lib/libcxx/include/condition_variable+6-1
......@@ -146,6 +146,7 @@ _LIBCPP_PUSH_MACROS
146146# if _LIBCPP_HAS_THREADS
147147
148148_LIBCPP_BEGIN_NAMESPACE_STD
149_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
149150
150151template <class _Lock>
151152struct __unlock_guard {
......@@ -342,14 +343,18 @@ bool condition_variable_any::wait_for(
342343
343344_LIBCPP_EXPORTED_FROM_ABI void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>);
344345
346_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
345347_LIBCPP_END_NAMESPACE_STD
346348
347349# endif // _LIBCPP_HAS_THREADS
348350
349351_LIBCPP_POP_MACROS
350352
351# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
353# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
352354# include <atomic>
355# endif
356
357# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
353358# include <concepts>
354359# include <cstdint>
355360# include <cstdlib>
lib/libcxx/include/coroutine+1-1
......@@ -61,7 +61,7 @@ struct suspend_always;
6161# pragma GCC system_header
6262# endif
6363
64# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
64# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
6565# include <cstddef>
6666# include <iosfwd>
6767# include <limits>
lib/libcxx/include/ctype.h deleted-65
......@@ -1,65 +0,0 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_CTYPE_H
11#define _LIBCPP_CTYPE_H
12
13/*
14 ctype.h synopsis
15
16int isalnum(int c);
17int isalpha(int c);
18int isblank(int c); // C99
19int iscntrl(int c);
20int isdigit(int c);
21int isgraph(int c);
22int islower(int c);
23int isprint(int c);
24int ispunct(int c);
25int isspace(int c);
26int isupper(int c);
27int isxdigit(int c);
28int tolower(int c);
29int toupper(int c);
30*/
31
32#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
33# include <__cxx03/__config>
34#else
35# include <__config>
36#endif
37
38#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
39# pragma GCC system_header
40#endif
41
42#if __has_include_next(<ctype.h>)
43# include_next <ctype.h>
44#endif
45
46#ifdef __cplusplus
47
48# undef isalnum
49# undef isalpha
50# undef isblank
51# undef iscntrl
52# undef isdigit
53# undef isgraph
54# undef islower
55# undef isprint
56# undef ispunct
57# undef isspace
58# undef isupper
59# undef isxdigit
60# undef tolower
61# undef toupper
62
63#endif
64
65#endif // _LIBCPP_CTYPE_H
lib/libcxx/include/cuchar+4-4
......@@ -56,10 +56,10 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps);
5656# pragma GCC system_header
5757# endif
5858
59_LIBCPP_BEGIN_NAMESPACE_STD
60
6159# if !defined(_LIBCPP_CXX03_LANG)
6260
61_LIBCPP_BEGIN_NAMESPACE_STD
62
6363using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
6464
6565# if _LIBCPP_HAS_C8RTOMB_MBRTOC8
......@@ -71,10 +71,10 @@ using ::c16rtomb _LIBCPP_USING_IF_EXISTS;
7171using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS;
7272using ::c32rtomb _LIBCPP_USING_IF_EXISTS;
7373
74# endif // _LIBCPP_CXX03_LANG
75
7674_LIBCPP_END_NAMESPACE_STD
7775
76# endif // _LIBCPP_CXX03_LANG
77
7878#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
7979
8080#endif // _LIBCPP_CUCHAR
lib/libcxx/include/cwchar+1-1
......@@ -258,7 +258,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp
258258
259259_LIBCPP_END_NAMESPACE_STD
260260
261# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
261# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
262262# include <cstddef>
263263# endif
264264#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/deque+45-31
......@@ -40,7 +40,7 @@ public:
4040 deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
4141 explicit deque(const allocator_type& a);
4242 explicit deque(size_type n);
43 explicit deque(size_type n, const allocator_type& a); // C++14
43 explicit deque(size_type n, const allocator_type& a);
4444 deque(size_type n, const value_type& v);
4545 deque(size_type n, const value_type& v, const allocator_type& a);
4646 template <class InputIterator>
......@@ -263,10 +263,17 @@ _LIBCPP_PUSH_MACROS
263263
264264_LIBCPP_BEGIN_NAMESPACE_STD
265265
266# ifndef _LIBCPP_ABI_USE_SMALL_DEQUE_BLOCK_SIZE
266267template <class _ValueType, class _DiffType>
267268struct __deque_block_size {
268269 static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
269270};
271# else
272template <class _ValueType, class _DiffType>
273struct __deque_block_size {
274 static const _DiffType value = sizeof(_ValueType) < 128 ? 512 / sizeof(_ValueType) : 4;
275};
276# endif
270277
271278template <class _ValueType,
272279 class _Pointer,
......@@ -283,7 +290,18 @@ template <class _ValueType,
283290# endif
284291 >
285292class __deque_iterator {
286 typedef _MapPointer __map_iterator;
293 using __map_iterator _LIBCPP_NODEBUG = __rebind_pointer_t<_Pointer, const __rebind_pointer_t<_Pointer, _ValueType> >;
294
295// TODO(LLVM 25): Remove this check
296# ifndef _LIBCPP_ABI_DEQUE_ITERATORS
297 static_assert(
298 sizeof(__map_iterator) == sizeof(_MapPointer) && _LIBCPP_ALIGNOF(__map_iterator) == _LIBCPP_ALIGNOF(_MapPointer),
299 "It looks like you are using fancy pointers such that FancyPtr<const FancyPtr<const value_type>> is not "
300 "layout-compatible with FancyPtr<FancyPtr<value_type>> or FancyPtr<const FancyPtr<value_type>>. "
301 "This means that your ABI is being broken between LLVM 22 and LLVM 23 if deque::iterator or "
302 "deque::const_iterator is used. If you don't care about your ABI being broken, define the "
303 "_LIBCPP_ABI_DEQUE_ITERATORS macro to silence this diagnostic.");
304# endif
287305
288306public:
289307 typedef _Pointer pointer;
......@@ -459,7 +477,7 @@ private:
459477 __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>;
460478
461479public:
462 using __segment_iterator _LIBCPP_NODEBUG = _MapPointer;
480 using __segment_iterator _LIBCPP_NODEBUG = typename _Iterator::__map_iterator;
463481 using __local_iterator _LIBCPP_NODEBUG = _Pointer;
464482
465483 static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; }
......@@ -626,9 +644,7 @@ public:
626644 }
627645
628646 explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
629# if _LIBCPP_STD_VER >= 14
630647 explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
631# endif
632648 _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
633649
634650 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
......@@ -725,24 +741,24 @@ public:
725741 // iterators:
726742
727743 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
728 __map_pointer __mp = __map_.begin() + __start_ / __block_size;
744 auto __mp = __map_.begin() + __start_ / __block_size;
729745 return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
730746 }
731747
732748 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
733 __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
749 auto __mp = __map_.begin() + __start_ / __block_size;
734750 return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
735751 }
736752
737753 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
738 size_type __p = size() + __start_;
739 __map_pointer __mp = __map_.begin() + __p / __block_size;
754 size_type __p = size() + __start_;
755 auto __mp = __map_.begin() + __p / __block_size;
740756 return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
741757 }
742758
743759 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
744 size_type __p = size() + __start_;
745 __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
760 size_type __p = size() + __start_;
761 auto __mp = __map_.begin() + __p / __block_size;
746762 return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
747763 }
748764
......@@ -953,7 +969,7 @@ private:
953969 (void)__end;
954970 (void)__annotation_type;
955971 (void)__place;
956# if __has_feature(address_sanitizer)
972# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
957973 // __beg - index of the first item to annotate
958974 // __end - index behind the last item to annotate (so last item + 1)
959975 // __annotation_type - __asan_unposion or __asan_poison
......@@ -1046,23 +1062,23 @@ private:
10461062 std::__annotate_double_ended_contiguous_container<_Allocator>(
10471063 __mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
10481064 }
1049# endif // __has_feature(address_sanitizer)
1065# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10501066 }
10511067
10521068 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
10531069 (void)__current_size;
1054# if __has_feature(address_sanitizer)
1070# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10551071 if (__current_size == 0)
10561072 __annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
10571073 else {
10581074 __annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
10591075 __annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
10601076 }
1061# endif // __has_feature(address_sanitizer)
1077# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10621078 }
10631079
10641080 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
1065# if __has_feature(address_sanitizer)
1081# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10661082 if (empty()) {
10671083 for (size_t __i = 0; __i < __map_.size(); ++__i) {
10681084 __annotate_whole_block(__i, __asan_unposion);
......@@ -1071,19 +1087,19 @@ private:
10711087 __annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
10721088 __annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
10731089 }
1074# endif // __has_feature(address_sanitizer)
1090# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10751091 }
10761092
10771093 _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
10781094 (void)__n;
1079# if __has_feature(address_sanitizer)
1095# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10801096 __annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
10811097# endif
10821098 }
10831099
10841100 _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
10851101 (void)__n;
1086# if __has_feature(address_sanitizer)
1102# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10871103 __annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
10881104# endif
10891105 }
......@@ -1091,7 +1107,7 @@ private:
10911107 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
10921108 (void)__old_size;
10931109 (void)__old_start;
1094# if __has_feature(address_sanitizer)
1110# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
10951111 __annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
10961112# endif
10971113 }
......@@ -1099,7 +1115,7 @@ private:
10991115 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
11001116 (void)__old_size;
11011117 (void)__old_start;
1102# if __has_feature(address_sanitizer)
1118# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
11031119 __annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
11041120# endif
11051121 }
......@@ -1112,7 +1128,7 @@ private:
11121128 __annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
11131129 (void)__block_index;
11141130 (void)__annotation_type;
1115# if __has_feature(address_sanitizer)
1131# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
11161132 __map_const_iterator __block_it = __map_.begin() + __block_index;
11171133 const void* __block_start = std::__to_address(*__block_it);
11181134 const void* __block_end = std::__to_address(*__block_it + __block_size);
......@@ -1125,7 +1141,7 @@ private:
11251141 }
11261142# endif
11271143 }
1128# if __has_feature(address_sanitizer)
1144# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
11291145
11301146public:
11311147 _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
......@@ -1187,7 +1203,7 @@ public:
11871203 }
11881204
11891205private:
1190# endif // __has_feature(address_sanitizer)
1206# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
11911207 _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
11921208 if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
11931209 __annotate_whole_block(0, __asan_unposion);
......@@ -1305,7 +1321,6 @@ deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) {
13051321 __append(__n);
13061322}
13071323
1308# if _LIBCPP_STD_VER >= 14
13091324template <class _Tp, class _Allocator>
13101325deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
13111326 : __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
......@@ -1313,7 +1328,6 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
13131328 if (__n > 0)
13141329 __append(__n);
13151330}
1316# endif
13171331
13181332template <class _Tp, class _Allocator>
13191333deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0) {
......@@ -2220,7 +2234,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
22202234 __fe = __fb + __bs;
22212235 }
22222236 if (__fb <= __vt && __vt < __fe)
2223 __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
2237 __vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
22242238 __r = std::move(__fb, __fe, __r);
22252239 __n -= __bs;
22262240 __f += __bs;
......@@ -2247,7 +2261,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
22472261 __lb = __le - __bs;
22482262 }
22492263 if (__lb <= __vt && __vt < __le)
2250 __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
2264 __vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
22512265 __r = std::move_backward(__lb, __le, __r);
22522266 __n -= __bs;
22532267 __l -= __bs - 1;
......@@ -2273,7 +2287,7 @@ void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator _
22732287 __fe = __fb + __bs;
22742288 }
22752289 if (__fb <= __vt && __vt < __fe)
2276 __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
2290 __vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
22772291 for (; __fb != __fe; ++__fb, ++__r, ++__size())
22782292 __alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
22792293 __n -= __bs;
......@@ -2305,7 +2319,7 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
23052319 __lb = __le - __bs;
23062320 }
23072321 if (__lb <= __vt && __vt < __le)
2308 __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
2322 __vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
23092323 while (__le != __lb) {
23102324 __alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
23112325 --__start_;
......@@ -2532,7 +2546,7 @@ _LIBCPP_END_NAMESPACE_STD
25322546
25332547_LIBCPP_POP_MACROS
25342548
2535# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2549# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
25362550# include <algorithm>
25372551# include <atomic>
25382552# include <concepts>
lib/libcxx/include/exception+2-2
......@@ -91,13 +91,13 @@ template <class E> void rethrow_if_nested(const E& e);
9191# pragma GCC system_header
9292# endif
9393
94# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
94# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
9595# include <cstddef>
9696# include <new>
9797# include <type_traits>
9898# endif
9999
100# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
100# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
101101# include <cstdlib>
102102# endif
103103#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/execution+1-1
......@@ -155,7 +155,7 @@ _LIBCPP_END_NAMESPACE_STD
155155
156156# endif // _LIBCPP_HAS_EXPERIMENTAL_PSTL && _LIBCPP_STD_VER >= 17
157157
158# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
158# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
159159# include <cstddef>
160160# endif
161161#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/experimental/iterator+2-2
......@@ -124,14 +124,14 @@ _LIBCPP_END_NAMESPACE_LFTS
124124
125125_LIBCPP_POP_MACROS
126126
127# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
127# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
128128# include <cstddef>
129129# include <iosfwd>
130130# include <optional>
131131# include <type_traits>
132132# endif
133133
134# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
134# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
135135# include <locale>
136136# endif
137137
lib/libcxx/include/experimental/memory+5-7
......@@ -70,10 +70,10 @@ public:
7070
7171# ifdef _LIBCPP_ENABLE_EXPERIMENTAL
7272
73_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
74
7573# if _LIBCPP_STD_VER >= 17
7674
75_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
76
7777template <class _Wp>
7878class observer_ptr {
7979public:
......@@ -175,28 +175,26 @@ _LIBCPP_HIDE_FROM_ABI bool operator>=(observer_ptr<_W1> __a, observer_ptr<_W2> _
175175 return !(__a < __b);
176176}
177177
178# endif // _LIBCPP_STD_VER >= 17
179
180178_LIBCPP_END_NAMESPACE_LFTS_V2
181179
182180_LIBCPP_BEGIN_NAMESPACE_STD
183181
184182// hash
185183
186# if _LIBCPP_STD_VER >= 17
187184template <class _Tp>
188185struct hash<experimental::observer_ptr<_Tp>> {
189186 _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::observer_ptr<_Tp>& __ptr) const noexcept {
190187 return hash<_Tp*>()(__ptr.get());
191188 }
192189};
193# endif // _LIBCPP_STD_VER >= 17
194190
195191_LIBCPP_END_NAMESPACE_STD
196192
193# endif // _LIBCPP_STD_VER >= 17
194
197195# endif // _LIBCPP_ENABLE_EXPERIMENTAL
198196
199# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
197# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
200198# include <cstddef>
201199# include <limits>
202200# endif
lib/libcxx/include/experimental/propagate_const+1-1
......@@ -488,7 +488,7 @@ _LIBCPP_END_NAMESPACE_STD
488488
489489_LIBCPP_POP_MACROS
490490
491# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
491# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
492492# include <cstddef>
493493# include <type_traits>
494494# endif
lib/libcxx/include/experimental/simd+1-1
......@@ -88,7 +88,7 @@ inline namespace parallelism_v2 {
8888# include <experimental/__simd/traits.h>
8989# include <experimental/__simd/vec_ext.h>
9090
91# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
91# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
9292# include <cstddef>
9393# endif
9494#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/experimental/type_traits+1-1
......@@ -151,7 +151,7 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar
151151
152152_LIBCPP_END_NAMESPACE_LFTS
153153
154# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
154# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
155155# include <cstddef>
156156# endif
157157
lib/libcxx/include/experimental/utility+1-1
......@@ -46,7 +46,7 @@ struct erased_type {};
4646
4747_LIBCPP_END_NAMESPACE_LFTS
4848
49# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
49# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
5050# include <cstddef>
5151# endif
5252#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/ext/hash_map+1-1
......@@ -825,7 +825,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Has
825825
826826} // namespace __gnu_cxx
827827
828# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
828# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
829829# include <concepts>
830830# include <iterator>
831831# include <type_traits>
lib/libcxx/include/ext/hash_set+1-1
......@@ -572,7 +572,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash,
572572
573573} // namespace __gnu_cxx
574574
575# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
575# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
576576# include <concepts>
577577# include <iterator>
578578# include <type_traits>
lib/libcxx/include/fenv.h deleted-118
......@@ -1,118 +0,0 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FENV_H
11#define _LIBCPP_FENV_H
12
13/*
14 fenv.h synopsis
15
16This entire header is C99 / C++0X
17
18Macros:
19
20 FE_DIVBYZERO
21 FE_INEXACT
22 FE_INVALID
23 FE_OVERFLOW
24 FE_UNDERFLOW
25 FE_ALL_EXCEPT
26 FE_DOWNWARD
27 FE_TONEAREST
28 FE_TOWARDZERO
29 FE_UPWARD
30 FE_DFL_ENV
31
32Types:
33
34 fenv_t
35 fexcept_t
36
37int feclearexcept(int excepts);
38int fegetexceptflag(fexcept_t* flagp, int excepts);
39int feraiseexcept(int excepts);
40int fesetexceptflag(const fexcept_t* flagp, int excepts);
41int fetestexcept(int excepts);
42int fegetround();
43int fesetround(int round);
44int fegetenv(fenv_t* envp);
45int feholdexcept(fenv_t* envp);
46int fesetenv(const fenv_t* envp);
47int feupdateenv(const fenv_t* envp);
48
49
50*/
51
52#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
53# include <__cxx03/__config>
54#else
55# include <__config>
56#endif
57
58#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
59# pragma GCC system_header
60#endif
61
62#if __has_include_next(<fenv.h>)
63# include_next <fenv.h>
64#endif
65
66#ifdef __cplusplus
67
68extern "C++" {
69
70# ifdef feclearexcept
71# undef feclearexcept
72# endif
73
74# ifdef fegetexceptflag
75# undef fegetexceptflag
76# endif
77
78# ifdef feraiseexcept
79# undef feraiseexcept
80# endif
81
82# ifdef fesetexceptflag
83# undef fesetexceptflag
84# endif
85
86# ifdef fetestexcept
87# undef fetestexcept
88# endif
89
90# ifdef fegetround
91# undef fegetround
92# endif
93
94# ifdef fesetround
95# undef fesetround
96# endif
97
98# ifdef fegetenv
99# undef fegetenv
100# endif
101
102# ifdef feholdexcept
103# undef feholdexcept
104# endif
105
106# ifdef fesetenv
107# undef fesetenv
108# endif
109
110# ifdef feupdateenv
111# undef feupdateenv
112# endif
113
114} // extern "C++"
115
116#endif // defined(__cplusplus)
117
118#endif // _LIBCPP_FENV_H
lib/libcxx/include/filesystem+1-1
......@@ -568,7 +568,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
568568# pragma GCC system_header
569569# endif
570570
571# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
571# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
572572# include <concepts>
573573# include <cstdlib>
574574# include <cstring>
lib/libcxx/include/float.h deleted-99
......@@ -1,99 +0,0 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_FLOAT_H
11#define _LIBCPP_FLOAT_H
12
13/*
14 float.h synopsis
15
16Macros:
17
18 FLT_ROUNDS
19 FLT_EVAL_METHOD // C99
20 FLT_RADIX
21
22 FLT_MANT_DIG
23 DBL_MANT_DIG
24 LDBL_MANT_DIG
25
26 FLT_HAS_SUBNORM // C11
27 DBL_HAS_SUBNORM // C11
28 LDBL_HAS_SUBNORM // C11
29
30 DECIMAL_DIG // C99
31 FLT_DECIMAL_DIG // C11
32 DBL_DECIMAL_DIG // C11
33 LDBL_DECIMAL_DIG // C11
34
35 FLT_DIG
36 DBL_DIG
37 LDBL_DIG
38
39 FLT_MIN_EXP
40 DBL_MIN_EXP
41 LDBL_MIN_EXP
42
43 FLT_MIN_10_EXP
44 DBL_MIN_10_EXP
45 LDBL_MIN_10_EXP
46
47 FLT_MAX_EXP
48 DBL_MAX_EXP
49 LDBL_MAX_EXP
50
51 FLT_MAX_10_EXP
52 DBL_MAX_10_EXP
53 LDBL_MAX_10_EXP
54
55 FLT_MAX
56 DBL_MAX
57 LDBL_MAX
58
59 FLT_EPSILON
60 DBL_EPSILON
61 LDBL_EPSILON
62
63 FLT_MIN
64 DBL_MIN
65 LDBL_MIN
66
67 FLT_TRUE_MIN // C11
68 DBL_TRUE_MIN // C11
69 LDBL_TRUE_MIN // C11
70
71*/
72
73#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
74# include <__cxx03/__config>
75#else
76# include <__config>
77#endif
78
79#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
80# pragma GCC system_header
81#endif
82
83#if __has_include_next(<float.h>)
84# include_next <float.h>
85#endif
86
87#ifdef __cplusplus
88
89# ifndef FLT_EVAL_METHOD
90# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
91# endif
92
93# ifndef DECIMAL_DIG
94# define DECIMAL_DIG __DECIMAL_DIG__
95# endif
96
97#endif // __cplusplus
98
99#endif // _LIBCPP_FLOAT_H
lib/libcxx/include/format+13-10
......@@ -31,7 +31,7 @@ namespace std {
3131
3232 public:
3333 template<class T> consteval basic_format_string(const T& s);
34 basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {} // since C++26
34 basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {} // since C++26
3535
3636 constexpr basic_string_view<charT> get() const noexcept { return str; }
3737 };
......@@ -42,21 +42,21 @@ namespace std {
4242 using wformat_string = // since C++23, exposition only before C++23
4343 basic_format_string<wchar_t, type_identity_t<Args>...>;
4444
45 template<class charT> struct runtime-format-string { // since C++26, exposition-only
45 template<class charT> struct dynamic-format-string { // since C++26, exposition-only
4646 private:
4747 basic_string_view<charT> str; // exposition-only
4848
4949 public:
50 runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}
50 dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {}
5151
52 runtime-format-string(const runtime-format-string&) = delete;
53 runtime-format-string& operator=(const runtime-format-string&) = delete;
52 dynamic-format-string(const dynamic-format-string&) = delete;
53 dynamic-format-string& operator=(const dynamic-format-string&) = delete;
5454 };
5555
56 runtime-format-string<char> runtime_format(string_view fmt) noexcept {
56 dynamic-format-string<char> dynamic_format(string_view fmt) noexcept {
5757 return fmt;
5858 }
59 runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept {
59 dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept {
6060 return fmt;
6161 }
6262
......@@ -213,7 +213,7 @@ namespace std {
213213# include <__format/format_string.h>
214214# include <__format/format_to_n_result.h>
215215# include <__format/formatter.h>
216# include <__format/formatter_bool.h>
216# include <__format/formatter_bool_impl.h>
217217# include <__format/formatter_char.h>
218218# include <__format/formatter_floating_point.h>
219219# include <__format/formatter_integer.h>
......@@ -233,12 +233,15 @@ namespace std {
233233# pragma GCC system_header
234234# endif
235235
236# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
236# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
237# include <cmath>
238# endif
239
240# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
237241# include <array>
238242# include <cctype>
239243# include <cerrno>
240244# include <clocale>
241# include <cmath>
242245# include <cstddef>
243246# include <cstdint>
244247# include <cstdlib>
lib/libcxx/include/forward_list+4-8
......@@ -37,7 +37,7 @@ public:
3737 noexcept(is_nothrow_default_constructible<allocator_type>::value);
3838 explicit forward_list(const allocator_type& a);
3939 explicit forward_list(size_type n);
40 explicit forward_list(size_type n, const allocator_type& a); // C++14
40 explicit forward_list(size_type n, const allocator_type& a);
4141 forward_list(size_type n, const value_type& v);
4242 forward_list(size_type n, const value_type& v, const allocator_type& a);
4343 template <class InputIterator>
......@@ -234,6 +234,7 @@ template <class T, class Allocator, class Predicate>
234234# include <__type_traits/remove_cv.h>
235235# include <__type_traits/type_identity.h>
236236# include <__utility/exception_guard.h>
237# include <__utility/exchange.h>
237238# include <__utility/forward.h>
238239# include <__utility/move.h>
239240# include <__utility/swap.h>
......@@ -663,9 +664,7 @@ public:
663664 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {} // = default;
664665 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(const allocator_type& __a);
665666 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n);
666# if _LIBCPP_STD_VER >= 14
667667 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit forward_list(size_type __n, const allocator_type& __a);
668# endif
669668 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI forward_list(size_type __n, const value_type& __v);
670669
671670 template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
......@@ -940,7 +939,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type
940939 }
941940}
942941
943# if _LIBCPP_STD_VER >= 14
944942template <class _Tp, class _Alloc>
945943_LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc)
946944 : __base(__base_alloc) {
......@@ -951,7 +949,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type
951949 }
952950 }
953951}
954# endif
955952
956953template <class _Tp, class _Alloc>
957954_LIBCPP_CONSTEXPR_SINCE_CXX26 forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) {
......@@ -1022,8 +1019,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void forward_list<_Tp, _Alloc>::__move_assign(forw
10221019 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
10231020 clear();
10241021 __base::__move_assign_alloc(__x);
1025 __base::__before_begin()->__next_ = __x.__before_begin()->__next_;
1026 __x.__before_begin()->__next_ = nullptr;
1022 __base::__before_begin()->__next_ = std::__exchange(__x.__before_begin()->__next_, nullptr);
10271023}
10281024
10291025template <class _Tp, class _Alloc>
......@@ -1603,7 +1599,7 @@ _LIBCPP_END_NAMESPACE_STD
16031599
16041600_LIBCPP_POP_MACROS
16051601
1606# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1602# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
16071603# include <algorithm>
16081604# include <atomic>
16091605# include <concepts>
lib/libcxx/include/fstream+90-31
......@@ -220,6 +220,7 @@ _LIBCPP_PUSH_MACROS
220220# include <__undef_macros>
221221
222222_LIBCPP_BEGIN_NAMESPACE_STD
223_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
223224
224225# if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_WIN32API)
225226_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept;
......@@ -308,6 +309,34 @@ protected:
308309 return basic_streambuf<_CharT, _Traits>::xsputn(__str, __len);
309310 }
310311
312 _LIBCPP_HIDE_FROM_ABI_VIRTUAL streamsize xsgetn(char_type* __str, streamsize __len) override {
313 if (__file_ && __always_noconv_) {
314 char_type __1buf;
315 __read_guard __guard(__1buf, *this);
316 const streamsize __n = std::min(this->egptr() - this->gptr(), __len);
317 if (__n != 0) {
318 traits_type::copy(__str, this->gptr(), __n);
319 this->__gbump_ptrdiff(__n);
320 }
321 const streamsize __remainder = __len - __n;
322 const streamsize __buffer_space = this->egptr() - this->eback();
323
324 if (__remainder >= __buffer_space) {
325 auto __res = std::fread(__str + __n, sizeof(char_type), __remainder, __file_) + __n;
326
327 // Copy the buffer-sized tail into the buffer so that `unget`ting works correctly
328 auto __buf_size = std::min<size_t>(__res, this->egptr() - this->eback());
329 traits_type::copy(this->eback(), __str + __res - __buf_size, __buf_size);
330 this->setg(this->eback(), this->eback() + __buf_size, this->eback() + __buf_size);
331
332 return __res;
333 } else if (__remainder > 0)
334 return basic_streambuf<_CharT, _Traits>::xsgetn(__str + __n, __remainder) + __n;
335 return __n;
336 }
337 return basic_streambuf<_CharT, _Traits>::xsgetn(__str, __len);
338 }
339
311340private:
312341 char* __extbuf_;
313342 const char* __extbufnext_;
......@@ -364,6 +393,40 @@ private:
364393 bool __always_noconv_;
365394
366395 bool __read_mode();
396
397 struct [[__nodiscard__]] __read_guard {
398 basic_filebuf& __self_;
399 size_t __unget_size_;
400 char_type& __1buf_;
401
402 _LIBCPP_HIDE_FROM_ABI __read_guard(char_type& __1buf, basic_filebuf& __self) : __self_(__self), __1buf_(__1buf) {
403 if (__self.__cm_ & ios_base::in) {
404 __unget_size_ = std::min<size_t>((__self.egptr() - __self.eback()) / 2, 4);
405 } else {
406 __self.setp(nullptr, nullptr);
407 if (__self.__always_noconv_) {
408 __self.setg(reinterpret_cast<char_type*>(__self.__extbuf_),
409 reinterpret_cast<char_type*>(__self.__extbuf_) + __self.__ebs_,
410 reinterpret_cast<char_type*>(__self.__extbuf_) + __self.__ebs_);
411 } else {
412 __self.setg(__self.__intbuf_, __self.__intbuf_ + __self.__ibs_, __self.__intbuf_ + __self.__ibs_);
413 }
414 __self.__cm_ = ios_base::in;
415 __unget_size_ = 0;
416 }
417
418 if (__self.gptr() == nullptr)
419 __self.setg(std::addressof(__1buf_), std::addressof(__1buf_) + 1, std::addressof(__1buf_) + 1);
420 }
421
422 _LIBCPP_HIDE_FROM_ABI size_t __unget_size() { return __unget_size_; }
423
424 _LIBCPP_HIDE_FROM_ABI ~__read_guard() {
425 if (__self_.eback() == std::addressof(__1buf_))
426 __self_.setg(nullptr, nullptr, nullptr);
427 }
428 };
429
367430 void __write_mode();
368431
369432 _LIBCPP_HIDE_FROM_ABI static int __fseek(FILE* __file, pos_type __offset, int __whence);
......@@ -400,14 +463,12 @@ private:
400463 // If the file is already open, switch to unbuffered mode. Otherwise, record
401464 // the request to use unbuffered mode so that we use that mode when we
402465 // eventually open the file.
403 _LIBCPP_HIDE_FROM_ABI void __request_unbuffered_mode(char_type* __s, streamsize __n) {
404 if (__cm_ == __no_io_operations && __s == nullptr && __n == 0) {
405 if (__file_) {
406 std::setbuf(__file_, nullptr);
407 __cm_ = 0;
408 } else {
409 __cm_ = __no_io_operations | __use_unbuffered_io;
410 }
466 _LIBCPP_HIDE_FROM_ABI void __request_unbuffered_mode() {
467 if (__file_) {
468 std::setbuf(__file_, nullptr);
469 __cm_ = 0;
470 } else {
471 __cm_ = __no_io_operations | __use_unbuffered_io;
411472 }
412473 }
413474
......@@ -601,6 +662,17 @@ inline bool basic_filebuf<_CharT, _Traits>::is_open() const {
601662 return __file_ != nullptr;
602663}
603664
665// Configures the fopen close-on-exec mode character, if any. This string will
666// be appended to any mode string used by fstream for fopen/fdopen.
667//
668// Not all platforms support this, but it helps avoid fd-leaks on platforms that
669// do.
670# if defined(__BIONIC__)
671# define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
672# else
673# define _LIBCPP_FOPEN_CLOEXEC_MODE
674# endif
675
604676template <class _CharT, class _Traits>
605677const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode __mode) _NOEXCEPT {
606678 switch (__mode & ~ios_base::ate) {
......@@ -773,11 +845,11 @@ template <class _CharT, class _Traits>
773845typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() {
774846 if (__file_ == nullptr)
775847 return traits_type::eof();
776 bool __initial = __read_mode();
848
777849 char_type __1buf;
778 if (this->gptr() == nullptr)
779 this->setg(std::addressof(__1buf), std::addressof(__1buf) + 1, std::addressof(__1buf) + 1);
780 const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4);
850 __read_guard __guard(__1buf, *this);
851
852 const size_t __unget_sz = __guard.__unget_size();
781853 int_type __c = traits_type::eof();
782854 if (this->gptr() == this->egptr()) {
783855 std::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
......@@ -820,8 +892,6 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
820892 }
821893 } else
822894 __c = traits_type::to_int_type(*this->gptr());
823 if (this->eback() == std::addressof(__1buf))
824 this->setg(nullptr, nullptr, nullptr);
825895 return __c;
826896}
827897
......@@ -920,7 +990,9 @@ template <class _CharT, class _Traits>
920990basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) {
921991 this->setg(nullptr, nullptr, nullptr);
922992 this->setp(nullptr, nullptr);
923 __request_unbuffered_mode(__s, __n);
993 // Calling setbuf(nullptr, 0) before any i/o operation switches the stream to unbuffered mode
994 if (__cm_ == __no_io_operations && __s == nullptr && __n == 0)
995 __request_unbuffered_mode();
924996 if (__owns_eb_)
925997 delete[] __extbuf_;
926998 if (__owns_ib_)
......@@ -1110,20 +1182,6 @@ void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) {
11101182 }
11111183}
11121184
1113template <class _CharT, class _Traits>
1114bool basic_filebuf<_CharT, _Traits>::__read_mode() {
1115 if (!(__cm_ & ios_base::in)) {
1116 this->setp(nullptr, nullptr);
1117 if (__always_noconv_)
1118 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
1119 else
1120 this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
1121 __cm_ = ios_base::in;
1122 return true;
1123 }
1124 return false;
1125}
1126
11271185template <class _CharT, class _Traits>
11281186void basic_filebuf<_CharT, _Traits>::__write_mode() {
11291187 if (!(__cm_ & ios_base::out)) {
......@@ -1616,13 +1674,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>;
16161674extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;
16171675# endif
16181676
1677_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
16191678_LIBCPP_END_NAMESPACE_STD
16201679
16211680_LIBCPP_POP_MACROS
16221681
16231682# endif // _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION
16241683
1625# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1684# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
16261685# include <atomic>
16271686# include <concepts>
16281687# include <cstdlib>
......@@ -1634,7 +1693,7 @@ _LIBCPP_POP_MACROS
16341693# include <type_traits>
16351694# endif
16361695
1637# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
1696# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
16381697# include <filesystem>
16391698# endif
16401699#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/functional+7-5
......@@ -221,6 +221,8 @@ template <auto f>
221221// [func.bind.partial], function templates bind_front and bind_back
222222template<class F, class... Args>
223223 constexpr unspecified bind_front(F&&, Args&&...); // C++20
224template<auto f, class... Args>
225 constexpr unspecified bind_front(Args&&...); // C++26
224226template<class F, class... Args>
225227 constexpr unspecified bind_back(F&&, Args&&...); // C++23
226228
......@@ -540,7 +542,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
540542# include <__functional/binder1st.h>
541543# include <__functional/binder2nd.h>
542544# include <__functional/hash.h>
543# include <__functional/mem_fn.h> // TODO: deprecate
545# include <__functional/mem_fn.h>
544546# include <__functional/mem_fun_ref.h>
545547# include <__functional/operations.h>
546548# include <__functional/pointer_to_binary_function.h>
......@@ -575,18 +577,18 @@ POLICY: For non-variadic implementations, the number of arguments is limited
575577# pragma GCC system_header
576578# endif
577579
578# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_CXX03_LANG)
580# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && defined(_LIBCPP_CXX03_LANG)
579581# include <limits>
580582# include <new>
581583# endif
582584
583# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
585# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 14
584586# include <array>
585587# include <initializer_list>
586588# include <unordered_map>
587589# endif
588590
589# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
591# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
590592# include <atomic>
591593# include <concepts>
592594# include <cstdlib>
......@@ -601,7 +603,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
601603# include <vector>
602604# endif
603605
604# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 23
606# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER == 23
605607# include <__vector/vector.h>
606608# endif
607609#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/future+23-10
......@@ -379,7 +379,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
379379# include <__memory/allocator_arg_t.h>
380380# include <__memory/allocator_destructor.h>
381381# include <__memory/allocator_traits.h>
382# include <__memory/compressed_pair.h>
383382# include <__memory/pointer_traits.h>
384383# include <__memory/shared_count.h>
385384# include <__memory/unique_ptr.h>
......@@ -420,6 +419,7 @@ _LIBCPP_PUSH_MACROS
420419# include <__undef_macros>
421420
422421_LIBCPP_BEGIN_NAMESPACE_STD
422_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
423423
424424// enum class future_errc
425425_LIBCPP_DECLARE_STRONG_ENUM(future_errc){
......@@ -435,7 +435,12 @@ struct is_error_code_enum<future_errc::__lx> : public true_type {};
435435# endif
436436
437437// enum class launch
438_LIBCPP_DECLARE_STRONG_ENUM(launch){async = 1, deferred = 2, any = async | deferred};
438_LIBCPP_DECLARE_STRONG_ENUM(launch){
439 async = 1,
440 deferred = 2,
441 any _LIBCPP_DEPRECATED_("std::launch::any is a deprecated extension. "
442 "Use std::launch::async | std::launch::deferred instead. "
443 "It will be removed in LLVM 25.") = async | deferred};
439444_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
440445
441446# ifndef _LIBCPP_CXX03_LANG
......@@ -1407,8 +1412,10 @@ template <class _FD, class _Alloc, class _FB>
14071412class __packaged_task_func;
14081413
14091414template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
1410class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
1411 _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Alloc, __alloc_);
1415class _LIBCPP_HIDE_STRUCT_FROM_ABI
1416 __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> {
1417 _LIBCPP_NO_UNIQUE_ADDRESS _Fp __func_;
1418 _LIBCPP_NO_UNIQUE_ADDRESS _Alloc __alloc_;
14121419
14131420public:
14141421 _LIBCPP_HIDE_FROM_ABI explicit __packaged_task_func(const _Fp& __f) : __func_(__f) {}
......@@ -1429,8 +1436,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
14291436
14301437template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
14311438void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() {
1432 __func_.~_Fp();
14331439 __alloc_.~_Alloc();
1440 __func_.~_Fp();
14341441}
14351442
14361443template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
......@@ -1439,8 +1446,8 @@ void __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
14391446 typedef allocator_traits<_Ap> _ATraits;
14401447 typedef pointer_traits<typename _ATraits::pointer> _PTraits;
14411448 _Ap __a(__alloc_);
1442 __func_.~_Fp();
14431449 __alloc_.~_Alloc();
1450 __func_.~_Fp();
14441451 __a.deallocate(_PTraits::pointer_to(*this), 1);
14451452}
14461453
......@@ -1744,7 +1751,7 @@ public:
17441751template <class _Rp, class... _Args>
17451752packaged_task(_Rp (*)(_Args...)) -> packaged_task<_Rp(_Args...)>;
17461753
1747template <class _Fp, class _Stripped = typename __strip_signature<decltype(&_Fp::operator())>::type>
1754template <class _Fp, class _Stripped = __strip_signature_t<decltype(&_Fp::operator())>>
17481755packaged_task(_Fp) -> packaged_task<_Stripped>;
17491756
17501757# endif
......@@ -1876,7 +1883,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) {
18761883template <class _Fp, class... _Args>
18771884[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI future<__invoke_result_t<__decay_t<_Fp>, __decay_t<_Args>...> >
18781885async(_Fp&& __f, _Args&&... __args) {
1879 return std::async(launch::any, std::forward<_Fp>(__f), std::forward<_Args>(__args)...);
1886 return std::async(launch::async | launch::deferred, std::forward<_Fp>(__f), std::forward<_Args>(__args)...);
18801887}
18811888
18821889# endif // C++03
......@@ -2052,17 +2059,18 @@ inline shared_future<_Rp&> future<_Rp&>::share() _NOEXCEPT {
20522059
20532060inline shared_future<void> future<void>::share() _NOEXCEPT { return shared_future<void>(std::move(*this)); }
20542061
2062_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
20552063_LIBCPP_END_NAMESPACE_STD
20562064
20572065_LIBCPP_POP_MACROS
20582066
20592067# endif // _LIBCPP_HAS_THREADS
20602068
2061# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
2069# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17
20622070# include <chrono>
20632071# endif
20642072
2065# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2073# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
20662074# include <atomic>
20672075# include <cstdlib>
20682076# include <exception>
......@@ -2070,6 +2078,11 @@ _LIBCPP_POP_MACROS
20702078# include <system_error>
20712079# include <thread>
20722080# endif
2081
2082# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
2083# include <sstream>
2084# endif
2085
20732086#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
20742087
20752088#endif // _LIBCPP_FUTURE
lib/libcxx/include/initializer_list+5-5
......@@ -53,11 +53,11 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
5353# pragma GCC system_header
5454# endif
5555
56# ifndef _LIBCPP_CXX03_LANG
57
5658namespace std // purposefully not versioned
5759{
5860
59# ifndef _LIBCPP_CXX03_LANG
60
6161template <class _Ep>
6262class _LIBCPP_NO_SPECIALIZATIONS initializer_list {
6363 const _Ep* __begin_;
......@@ -101,11 +101,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia
101101 return __il.end();
102102}
103103
104# endif // !defined(_LIBCPP_CXX03_LANG)
105
106104} // namespace std
107105
108# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
106# endif // _LIBCPP_CXX03_LANG
107
108# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
109109# include <cstddef>
110110# endif
111111#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/inttypes.h deleted-268
......@@ -1,268 +0,0 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_INTTYPES_H
11// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
12// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
13// case the header guard macro is defined.
14#if !defined(_AIX) || !defined(_STD_TYPES_T)
15# define _LIBCPP_INTTYPES_H
16#endif // _STD_TYPES_T
17
18/*
19 inttypes.h synopsis
20
21This entire header is C99 / C++0X
22
23#include <stdint.h> // <cinttypes> includes <cstdint>
24
25Macros:
26
27 PRId8
28 PRId16
29 PRId32
30 PRId64
31
32 PRIdLEAST8
33 PRIdLEAST16
34 PRIdLEAST32
35 PRIdLEAST64
36
37 PRIdFAST8
38 PRIdFAST16
39 PRIdFAST32
40 PRIdFAST64
41
42 PRIdMAX
43 PRIdPTR
44
45 PRIi8
46 PRIi16
47 PRIi32
48 PRIi64
49
50 PRIiLEAST8
51 PRIiLEAST16
52 PRIiLEAST32
53 PRIiLEAST64
54
55 PRIiFAST8
56 PRIiFAST16
57 PRIiFAST32
58 PRIiFAST64
59
60 PRIiMAX
61 PRIiPTR
62
63 PRIo8
64 PRIo16
65 PRIo32
66 PRIo64
67
68 PRIoLEAST8
69 PRIoLEAST16
70 PRIoLEAST32
71 PRIoLEAST64
72
73 PRIoFAST8
74 PRIoFAST16
75 PRIoFAST32
76 PRIoFAST64
77
78 PRIoMAX
79 PRIoPTR
80
81 PRIu8
82 PRIu16
83 PRIu32
84 PRIu64
85
86 PRIuLEAST8
87 PRIuLEAST16
88 PRIuLEAST32
89 PRIuLEAST64
90
91 PRIuFAST8
92 PRIuFAST16
93 PRIuFAST32
94 PRIuFAST64
95
96 PRIuMAX
97 PRIuPTR
98
99 PRIx8
100 PRIx16
101 PRIx32
102 PRIx64
103
104 PRIxLEAST8
105 PRIxLEAST16
106 PRIxLEAST32
107 PRIxLEAST64
108
109 PRIxFAST8
110 PRIxFAST16
111 PRIxFAST32
112 PRIxFAST64
113
114 PRIxMAX
115 PRIxPTR
116
117 PRIX8
118 PRIX16
119 PRIX32
120 PRIX64
121
122 PRIXLEAST8
123 PRIXLEAST16
124 PRIXLEAST32
125 PRIXLEAST64
126
127 PRIXFAST8
128 PRIXFAST16
129 PRIXFAST32
130 PRIXFAST64
131
132 PRIXMAX
133 PRIXPTR
134
135 SCNd8
136 SCNd16
137 SCNd32
138 SCNd64
139
140 SCNdLEAST8
141 SCNdLEAST16
142 SCNdLEAST32
143 SCNdLEAST64
144
145 SCNdFAST8
146 SCNdFAST16
147 SCNdFAST32
148 SCNdFAST64
149
150 SCNdMAX
151 SCNdPTR
152
153 SCNi8
154 SCNi16
155 SCNi32
156 SCNi64
157
158 SCNiLEAST8
159 SCNiLEAST16
160 SCNiLEAST32
161 SCNiLEAST64
162
163 SCNiFAST8
164 SCNiFAST16
165 SCNiFAST32
166 SCNiFAST64
167
168 SCNiMAX
169 SCNiPTR
170
171 SCNo8
172 SCNo16
173 SCNo32
174 SCNo64
175
176 SCNoLEAST8
177 SCNoLEAST16
178 SCNoLEAST32
179 SCNoLEAST64
180
181 SCNoFAST8
182 SCNoFAST16
183 SCNoFAST32
184 SCNoFAST64
185
186 SCNoMAX
187 SCNoPTR
188
189 SCNu8
190 SCNu16
191 SCNu32
192 SCNu64
193
194 SCNuLEAST8
195 SCNuLEAST16
196 SCNuLEAST32
197 SCNuLEAST64
198
199 SCNuFAST8
200 SCNuFAST16
201 SCNuFAST32
202 SCNuFAST64
203
204 SCNuMAX
205 SCNuPTR
206
207 SCNx8
208 SCNx16
209 SCNx32
210 SCNx64
211
212 SCNxLEAST8
213 SCNxLEAST16
214 SCNxLEAST32
215 SCNxLEAST64
216
217 SCNxFAST8
218 SCNxFAST16
219 SCNxFAST32
220 SCNxFAST64
221
222 SCNxMAX
223 SCNxPTR
224
225Types:
226
227 imaxdiv_t
228
229intmax_t imaxabs(intmax_t j);
230imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
231intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
232uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
233intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
234uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
235
236*/
237
238#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
239# include <__cxx03/__config>
240#else
241# include <__config>
242#endif
243
244#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
245# pragma GCC system_header
246#endif
247
248/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
249 for C++11 unless __STDC_FORMAT_MACROS is defined
250*/
251#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
252# define __STDC_FORMAT_MACROS
253#endif
254
255#if __has_include_next(<inttypes.h>)
256# include_next <inttypes.h>
257#endif
258
259#ifdef __cplusplus
260
261# include <stdint.h>
262
263# undef imaxabs
264# undef imaxdiv
265
266#endif // __cplusplus
267
268#endif // _LIBCPP_INTTYPES_H
lib/libcxx/include/iomanip+4-18
......@@ -413,6 +413,8 @@ inline _LIBCPP_HIDE_FROM_ABI __iom_t10<_CharT> put_time(const tm* __tm, const _C
413413 return __iom_t10<_CharT>(__tm, __fmt);
414414}
415415
416# if _LIBCPP_STD_VER >= 14
417
416418template <class _CharT, class _Traits>
417419_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output(
418420 basic_ostream<_CharT, _Traits>& __os,
......@@ -502,22 +504,6 @@ struct _LIBCPP_HIDDEN __quoted_proxy {
502504 }
503505};
504506
505template <class _CharT, class _Traits, class _Allocator>
506_LIBCPP_HIDE_FROM_ABI __quoted_output_proxy<_CharT, _Traits>
507__quoted(const basic_string<_CharT, _Traits, _Allocator>& __s,
508 _CharT __delim = _CharT('"'),
509 _CharT __escape = _CharT('\\')) {
510 return __quoted_output_proxy<_CharT, _Traits>(__s.data(), __s.data() + __s.size(), __delim, __escape);
511}
512
513template <class _CharT, class _Traits, class _Allocator>
514_LIBCPP_HIDE_FROM_ABI __quoted_proxy<_CharT, _Traits, _Allocator>
515__quoted(basic_string<_CharT, _Traits, _Allocator>& __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
516 return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape);
517}
518
519# if _LIBCPP_STD_VER >= 14
520
521507template <class _CharT>
522508_LIBCPP_HIDE_FROM_ABI auto quoted(const _CharT* __s, _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) {
523509 const _CharT* __end = __s;
......@@ -552,7 +538,7 @@ _LIBCPP_END_NAMESPACE_STD
552538
553539# endif // _LIBCPP_HAS_LOCALIZATION
554540
555# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
541# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
556542# include <array>
557543# include <bitset>
558544# include <deque>
......@@ -567,7 +553,7 @@ _LIBCPP_END_NAMESPACE_STD
567553# include <vector>
568554# endif
569555
570# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
556# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
571557# include <locale>
572558# endif
573559
lib/libcxx/include/ios+18-15
......@@ -235,10 +235,6 @@ storage-class-specifier const error_category& iostream_category() noexcept;
235235# include <__verbose_abort>
236236# include <version>
237237
238# if _LIBCPP_HAS_ATOMIC_HEADER
239# include <__atomic/atomic.h> // for __xindex_
240# endif
241
242238# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
243239# pragma GCC system_header
244240# endif
......@@ -247,6 +243,7 @@ _LIBCPP_PUSH_MACROS
247243# include <__undef_macros>
248244
249245_LIBCPP_BEGIN_NAMESPACE_STD
246_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
250247
251248typedef ptrdiff_t streamsize;
252249
......@@ -361,7 +358,7 @@ public:
361358 }
362359
363360protected:
364 _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(nullptr) {
361 _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(__private_constructor_tag(), nullptr) {
365362 // Purposefully does no initialization
366363 //
367364 // Except for the locale, this is a sentinel to avoid destroying
......@@ -386,25 +383,25 @@ protected:
386383 _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; }
387384
388385private:
389 // All data members must be scalars
390386 fmtflags __fmtflags_;
391387 streamsize __precision_;
392388 streamsize __width_;
393389 iostate __rdstate_;
394390 iostate __exceptions_;
395391 void* __rdbuf_;
396 void* __loc_;
392# ifndef _LIBCPP_CXX03_LANG
393 union {
394 locale __loc_;
395 };
396# else
397 // We only care about the union above to implement the destructor correctly, which we do in C++26 anyways. No need to
398 // handle C++03 shenanigans.
399 locale __loc_;
400# endif
397401 event_callback* __fn_;
398402 int* __index_;
399403 size_t __event_size_;
400404 size_t __event_cap_;
401// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
402// enabled with clang.
403# if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
404 static atomic<int> __xindex_;
405# else
406 static int __xindex_;
407# endif
408405 long* __iarray_;
409406 size_t __iarray_size_;
410407 size_t __iarray_cap_;
......@@ -871,13 +868,19 @@ _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) {
871868 return __str;
872869}
873870
871_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
874872_LIBCPP_END_NAMESPACE_STD
875873
876874_LIBCPP_POP_MACROS
877875
878876# endif // _LIBCPP_HAS_LOCALIZATION
879877
880# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
878# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
879# include <ctime>
880# include <ratio>
881# endif
882
883# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
881884# include <atomic>
882885# include <concepts>
883886# include <cstddef>
lib/libcxx/include/istream+4-2
......@@ -190,6 +190,7 @@ _LIBCPP_PUSH_MACROS
190190# include <__undef_macros>
191191
192192_LIBCPP_BEGIN_NAMESPACE_STD
193_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
193194
194195template <class _CharT, class _Traits>
195196class basic_istream : virtual public basic_ios<_CharT, _Traits> {
......@@ -1405,20 +1406,21 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>;
14051406# endif
14061407extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>;
14071408
1409_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
14081410_LIBCPP_END_NAMESPACE_STD
14091411
14101412_LIBCPP_POP_MACROS
14111413
14121414# endif // _LIBCPP_HAS_LOCALIZATION
14131415
1414# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1416# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
14151417# include <concepts>
14161418# include <iosfwd>
14171419# include <ostream>
14181420# include <type_traits>
14191421# endif
14201422
1421# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
1423# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
14221424# include <locale>
14231425# endif
14241426
lib/libcxx/include/iterator+2-2
......@@ -751,11 +751,11 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
751751# pragma GCC system_header
752752# endif
753753
754# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
754# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17
755755# include <variant>
756756# endif
757757
758# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
758# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
759759# include <cstddef>
760760# include <cstdlib>
761761# include <exception>
lib/libcxx/include/latch+1-1
......@@ -128,7 +128,7 @@ _LIBCPP_POP_MACROS
128128
129129# endif // _LIBCPP_HAS_THREADS
130130
131# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
131# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
132132# include <atomic>
133133# include <cstddef>
134134# endif
lib/libcxx/include/limits+12-4
......@@ -108,6 +108,7 @@ template<> class numeric_limits<cv long double>;
108108# include <__config>
109109# include <__type_traits/is_arithmetic.h>
110110# include <__type_traits/is_same.h>
111# include <__type_traits/make_unsigned.h>
111112
112113# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
113114# pragma GCC system_header
......@@ -184,9 +185,16 @@ protected:
184185
185186 static _LIBCPP_CONSTEXPR const bool is_specialized = true;
186187
187 static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
188 static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
189 static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
188 static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
189 // Number of value bits in type. Works for any integer type, including
190 // _BitInt(N), whose sizeof(type) * CHAR_BIT may include padding.
191 static _LIBCPP_CONSTEXPR const int digits =
192 __builtin_popcountg(static_cast<__make_unsigned_t<type> >(~__make_unsigned_t<type>(0))) - is_signed;
193 // digits10 = floor(digits * log10(2)). 1936274/6432163 is a continued-fraction
194 // convergent of log10(2) and matches floor(digits * log10(2)) exactly for every
195 // digits in [1, 8388608], i.e. up to __BITINT_MAXWIDTH__ on x86.
196 // TODO: switch to __builtin_log10 once it becomes constexpr.
197 static _LIBCPP_CONSTEXPR const int digits10 = static_cast<int>((digits * 1936274LL) / 6432163);
190198 static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
191199 static _LIBCPP_CONSTEXPR const type __min = is_signed ? _Tp(_Tp(1) << digits) : 0;
192200 static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
......@@ -520,7 +528,7 @@ _LIBCPP_END_NAMESPACE_STD
520528
521529_LIBCPP_POP_MACROS
522530
523# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
531# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
524532# include <type_traits>
525533# endif
526534#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/list+6-6
......@@ -39,7 +39,7 @@ public:
3939 noexcept(is_nothrow_default_constructible<allocator_type>::value);
4040 explicit list(const allocator_type& a);
4141 explicit list(size_type n);
42 explicit list(size_type n, const allocator_type& a); // C++14
42 explicit list(size_type n, const allocator_type& a);
4343 list(size_type n, const value_type& value);
4444 list(size_type n, const value_type& value, const allocator_type& a);
4545 template <class Iter>
......@@ -708,9 +708,7 @@ public:
708708 _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {}
709709 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : __base(__a) {}
710710 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
711# if _LIBCPP_STD_VER >= 14
712711 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit list(size_type __n, const allocator_type& __a);
713# endif
714712 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x);
715713 template <__enable_if_t<__is_allocator_v<_Alloc>, int> = 0>
716714 _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
......@@ -1066,13 +1064,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n) {
10661064# endif
10671065}
10681066
1069# if _LIBCPP_STD_VER >= 14
10701067template <class _Tp, class _Alloc>
10711068_LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : __base(__a) {
10721069 for (; __n > 0; --__n)
1070# ifndef _LIBCPP_CXX03_LANG
10731071 emplace_back();
1074}
1072# else
1073 push_back(value_type());
10751074# endif
1075}
10761076
10771077template <class _Tp, class _Alloc>
10781078_LIBCPP_CONSTEXPR_SINCE_CXX26 list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) {
......@@ -1815,7 +1815,7 @@ _LIBCPP_END_NAMESPACE_STD
18151815
18161816_LIBCPP_POP_MACROS
18171817
1818# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1818# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
18191819# include <algorithm>
18201820# include <atomic>
18211821# include <concepts>
lib/libcxx/include/locale+1-1
......@@ -210,7 +210,7 @@ template <class charT> class messages_byname;
210210
211211# endif // _LIBCPP_HAS_LOCALIZATION
212212
213# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
213# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
214214# include <atomic>
215215# include <concepts>
216216# include <cstdarg>
lib/libcxx/include/map+565-397
......@@ -57,177 +57,175 @@ public:
5757 };
5858
5959 // construct/copy/destroy:
60 map()
60 constexpr map()
6161 noexcept(
6262 is_nothrow_default_constructible<allocator_type>::value &&
6363 is_nothrow_default_constructible<key_compare>::value &&
6464 is_nothrow_copy_constructible<key_compare>::value);
65 explicit map(const key_compare& comp);
66 map(const key_compare& comp, const allocator_type& a);
65 constexpr explicit map(const key_compare& comp);
66 constexpr map(const key_compare& comp, const allocator_type& a);
6767 template <class InputIterator>
68 map(InputIterator first, InputIterator last,
68 constexpr map(InputIterator first, InputIterator last,
6969 const key_compare& comp = key_compare());
7070 template <class InputIterator>
71 map(InputIterator first, InputIterator last,
71 constexpr map(InputIterator first, InputIterator last,
7272 const key_compare& comp, const allocator_type& a);
7373 template<container-compatible-range<value_type> R>
74 map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
75 map(const map& m);
76 map(map&& m)
74 constexpr map(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
75 constexpr map(const map& m);
76 constexpr map(map&& m)
7777 noexcept(
7878 is_nothrow_move_constructible<allocator_type>::value &&
7979 is_nothrow_move_constructible<key_compare>::value);
80 explicit map(const allocator_type& a);
81 map(const map& m, const allocator_type& a);
82 map(map&& m, const allocator_type& a);
83 map(initializer_list<value_type> il, const key_compare& comp = key_compare());
84 map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
80 constexpr explicit map(const allocator_type& a);
81 constexpr map(const map& m, const allocator_type& a);
82 constexpr map(map&& m, const allocator_type& a);
83 constexpr map(initializer_list<value_type> il, const key_compare& comp = key_compare());
84 constexpr map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
8585 template <class InputIterator>
86 map(InputIterator first, InputIterator last, const allocator_type& a)
87 : map(first, last, Compare(), a) {} // C++14
86 constexpr map(InputIterator first, InputIterator last, const allocator_type& a)
87 : map(first, last, Compare(), a) {}
8888 template<container-compatible-range<value_type> R>
89 map(from_range_t, R&& rg, const Allocator& a))
90 : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
91 map(initializer_list<value_type> il, const allocator_type& a)
92 : map(il, Compare(), a) {} // C++14
93 ~map();
94
95 map& operator=(const map& m);
96 map& operator=(map&& m)
89 constexpr map(from_range_t, R&& rg, const Allocator& a))
90 : map(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
91 constexpr map(initializer_list<value_type> il, const allocator_type& a)
92 : map(il, Compare(), a) {}
93 constexpr ~map();
94
95 constexpr map& operator=(const map& m);
96 constexpr map& operator=(map&& m)
9797 noexcept(
9898 allocator_type::propagate_on_container_move_assignment::value &&
9999 is_nothrow_move_assignable<allocator_type>::value &&
100100 is_nothrow_move_assignable<key_compare>::value);
101 map& operator=(initializer_list<value_type> il);
101 constexpr map& operator=(initializer_list<value_type> il);
102102
103103 // iterators:
104 iterator begin() noexcept;
105 const_iterator begin() const noexcept;
106 iterator end() noexcept;
107 const_iterator end() const noexcept;
104 constexpr iterator begin() noexcept;
105 constexpr const_iterator begin() const noexcept;
106 constexpr iterator end() noexcept;
107 constexpr const_iterator end() const noexcept;
108108
109 reverse_iterator rbegin() noexcept;
110 const_reverse_iterator rbegin() const noexcept;
111 reverse_iterator rend() noexcept;
112 const_reverse_iterator rend() const noexcept;
109 constexpr reverse_iterator rbegin() noexcept;
110 constexpr const_reverse_iterator rbegin() const noexcept;
111 constexpr reverse_iterator rend() noexcept;
112 constexpr const_reverse_iterator rend() const noexcept;
113113
114 const_iterator cbegin() const noexcept;
115 const_iterator cend() const noexcept;
116 const_reverse_iterator crbegin() const noexcept;
117 const_reverse_iterator crend() const noexcept;
114 constexpr const_iterator cbegin() const noexcept;
115 constexpr const_iterator cend() const noexcept;
116 constexpr const_reverse_iterator crbegin() const noexcept;
117 constexpr const_reverse_iterator crend() const noexcept;
118118
119119 // capacity:
120 bool empty() const noexcept;
121 size_type size() const noexcept;
122 size_type max_size() const noexcept;
120 constexpr bool empty() const noexcept;
121 constexpr size_type size() const noexcept;
122 constexpr size_type max_size() const noexcept;
123123
124124 // element access:
125 mapped_type& operator[](const key_type& k);
126 mapped_type& operator[](key_type&& k);
125 constexpr mapped_type& operator[](const key_type& k);
126 constexpr mapped_type& operator[](key_type&& k);
127127
128 mapped_type& at(const key_type& k);
129 const mapped_type& at(const key_type& k) const;
128 constexpr mapped_type& at(const key_type& k);
129 constexpr const mapped_type& at(const key_type& k) const;
130130
131131 // modifiers:
132132 template <class... Args>
133 pair<iterator, bool> emplace(Args&&... args);
133 constexpr pair<iterator, bool> emplace(Args&&... args);
134134 template <class... Args>
135 iterator emplace_hint(const_iterator position, Args&&... args);
136 pair<iterator, bool> insert(const value_type& v);
137 pair<iterator, bool> insert( value_type&& v); // C++17
138 template <class P>
139 pair<iterator, bool> insert(P&& p);
140 iterator insert(const_iterator position, const value_type& v);
141 iterator insert(const_iterator position, value_type&& v); // C++17
142 template <class P>
143 iterator insert(const_iterator position, P&& p);
144 template <class InputIterator>
145 void insert(InputIterator first, InputIterator last);
135 constexpr iterator emplace_hint(const_iterator position, Args&&... args);
136 constexpr pair<iterator, bool> insert(const value_type& v);
137 constexpr pair<iterator, bool> insert( value_type&& v); // C++17
138 template <class P> constexpr pair<iterator, bool> insert(P&& p);
139 constexpr iterator insert(const_iterator position, const value_type& v);
140 constexpr iterator insert(const_iterator position, value_type&& v); // C++17
141 template <class P> constexpr iterator insert(const_iterator position, P&& p);
142 template <class InputIterator> constexpr void insert(InputIterator first, InputIterator last);
143
146144 template<container-compatible-range<value_type> R>
147 void insert_range(R&& rg); // C++23
148 void insert(initializer_list<value_type> il);
145 constexpr void insert_range(R&& rg); // C++23
146 constexpr void insert(initializer_list<value_type> il);
149147
150 node_type extract(const_iterator position); // C++17
151 node_type extract(const key_type& x); // C++17
152 insert_return_type insert(node_type&& nh); // C++17
153 iterator insert(const_iterator hint, node_type&& nh); // C++17
148 constexpr node_type extract(const_iterator position); // C++17
149 constexpr node_type extract(const key_type& x); // C++17
150 constexpr insert_return_type insert(node_type&& nh); // C++17
151 constexpr iterator insert(const_iterator hint, node_type&& nh); // C++17
154152
155153 template <class... Args>
156 pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
154 constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
157155 template <class... Args>
158 pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
156 constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
159157 template <class... Args>
160 iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
158 constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
161159 template <class... Args>
162 iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
160 constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
163161 template <class M>
164 pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
162 constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
165163 template <class M>
166 pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
164 constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
167165 template <class M>
168 iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
166 constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
169167 template <class M>
170 iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
168 constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
171169
172 iterator erase(const_iterator position);
173 iterator erase(iterator position); // C++14
174 size_type erase(const key_type& k);
175 iterator erase(const_iterator first, const_iterator last);
176 void clear() noexcept;
170 constexpr iterator erase(const_iterator position);
171 constexpr iterator erase(iterator position); // C++14
172 constexpr size_type erase(const key_type& k);
173 constexpr iterator erase(const_iterator first, const_iterator last);
174 constexpr void clear() noexcept;
177175
178176 template<class C2>
179 void merge(map<Key, T, C2, Allocator>& source); // C++17
177 constexpr void merge(map<Key, T, C2, Allocator>& source); // C++17
180178 template<class C2>
181 void merge(map<Key, T, C2, Allocator>&& source); // C++17
179 constexpr void merge(map<Key, T, C2, Allocator>&& source); // C++17
182180 template<class C2>
183 void merge(multimap<Key, T, C2, Allocator>& source); // C++17
181 constexpr void merge(multimap<Key, T, C2, Allocator>& source); // C++17
184182 template<class C2>
185 void merge(multimap<Key, T, C2, Allocator>&& source); // C++17
183 constexpr void merge(multimap<Key, T, C2, Allocator>&& source); // C++17
186184
187 void swap(map& m)
185 constexpr void swap(map& m)
188186 noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
189 is_nothrow_swappable<key_compare>::value); // C++17
187 is_nothrow_swappable<key_compare>::value); // C++17
190188
191189 // observers:
192 allocator_type get_allocator() const noexcept;
193 key_compare key_comp() const;
194 value_compare value_comp() const;
190 constexpr allocator_type get_allocator() const noexcept;
191 constexpr key_compare key_comp() const;
192 constexpr value_compare value_comp() const;
195193
196194 // map operations:
197 iterator find(const key_type& k);
198 const_iterator find(const key_type& k) const;
195 constexpr iterator find(const key_type& k);
196 constexpr const_iterator find(const key_type& k) const;
199197 template<typename K>
200 iterator find(const K& x); // C++14
198 constexpr iterator find(const K& x); // C++14
201199 template<typename K>
202 const_iterator find(const K& x) const; // C++14
200 constexpr const_iterator find(const K& x) const; // C++14
203201
204202 template<typename K>
205 size_type count(const K& x) const; // C++14
206 size_type count(const key_type& k) const;
203 constexpr size_type count(const K& x) const; // C++14
204 constexpr size_type count(const key_type& k) const;
207205
208 bool contains(const key_type& x) const; // C++20
209 template<class K> bool contains(const K& x) const; // C++20
206 constexpr bool contains(const key_type& x) const; // C++20
207 template<class K> constexpr bool contains(const K& x) const; // C++20
210208
211 iterator lower_bound(const key_type& k);
212 const_iterator lower_bound(const key_type& k) const;
209 constexpr iterator lower_bound(const key_type& k);
210 constexpr const_iterator lower_bound(const key_type& k) const;
213211 template<typename K>
214 iterator lower_bound(const K& x); // C++14
212 constexpr iterator lower_bound(const K& x); // C++14
215213 template<typename K>
216 const_iterator lower_bound(const K& x) const; // C++14
214 constexpr const_iterator lower_bound(const K& x) const; // C++14
217215
218 iterator upper_bound(const key_type& k);
219 const_iterator upper_bound(const key_type& k) const;
216 constexpr iterator upper_bound(const key_type& k);
217 constexpr const_iterator upper_bound(const key_type& k) const;
220218 template<typename K>
221 iterator upper_bound(const K& x); // C++14
219 constexpr iterator upper_bound(const K& x); // C++14
222220 template<typename K>
223 const_iterator upper_bound(const K& x) const; // C++14
221 constexpr const_iterator upper_bound(const K& x) const; // C++14
224222
225 pair<iterator,iterator> equal_range(const key_type& k);
226 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
223 constexpr pair<iterator,iterator> equal_range(const key_type& k);
224 constexpr pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
227225 template<typename K>
228 pair<iterator,iterator> equal_range(const K& x); // C++14
226 constexpr pair<iterator,iterator> equal_range(const K& x); // C++14
229227 template<typename K>
230 pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
228 constexpr pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
231229};
232230
233231template <class InputIterator,
......@@ -370,12 +368,12 @@ public:
370368 const allocator_type& a);
371369 template <class InputIterator>
372370 multimap(InputIterator first, InputIterator last, const allocator_type& a)
373 : multimap(first, last, Compare(), a) {} // C++14
371 : multimap(first, last, Compare(), a) {}
374372 template<container-compatible-range<value_type> R>
375373 multimap(from_range_t, R&& rg, const Allocator& a))
376374 : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
377375 multimap(initializer_list<value_type> il, const allocator_type& a)
378 : multimap(il, Compare(), a) {} // C++14
376 : multimap(il, Compare(), a) {}
379377 ~multimap();
380378
381379 multimap& operator=(const multimap& m);
......@@ -411,7 +409,7 @@ public:
411409 template <class... Args>
412410 iterator emplace(Args&&... args);
413411 template <class... Args>
414 iterator emplace_hint(const_iterator position, Args&&... args);
412 iterator emplace_hint(const_iterator position, Args&&... args);
415413 iterator insert(const value_type& v);
416414 iterator insert( value_type&& v); // C++17
417415 template <class P>
......@@ -641,28 +639,37 @@ class __map_value_compare {
641639 _LIBCPP_COMPRESSED_ELEMENT(_Compare, __comp_);
642640
643641public:
644 _LIBCPP_HIDE_FROM_ABI __map_value_compare() _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
642 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare()
643 _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
645644 : __comp_() {}
646 _LIBCPP_HIDE_FROM_ABI __map_value_compare(_Compare __c) _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
645 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_value_compare(_Compare __c)
646 _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
647647 : __comp_(__c) {}
648 _LIBCPP_HIDE_FROM_ABI const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
648 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const _Compare& key_comp() const _NOEXCEPT { return __comp_; }
649649
650 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _CP& __y) const { return __comp_(__x.first, __y.first); }
651 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _Key& __y) const { return __comp_(__x.first, __y); }
652 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const { return __comp_(__x, __y.first); }
653 _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
650 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _CP& __y) const {
651 return __comp_(__x.first, __y.first);
652 }
653 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _Key& __y) const {
654 return __comp_(__x.first, __y);
655 }
656 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _Key& __x, const _CP& __y) const {
657 return __comp_(__x, __y.first);
658 }
659 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__map_value_compare& __y)
660 _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
654661 using std::swap;
655662 swap(__comp_, __y.__comp_);
656663 }
657664
658665# if _LIBCPP_STD_VER >= 14
659666 template <typename _K2>
660 _LIBCPP_HIDE_FROM_ABI bool operator()(const _K2& __x, const _CP& __y) const {
667 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _K2& __x, const _CP& __y) const {
661668 return __comp_(__x, __y.first);
662669 }
663670
664671 template <typename _K2>
665 _LIBCPP_HIDE_FROM_ABI bool operator()(const _CP& __x, const _K2& __y) const {
672 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool operator()(const _CP& __x, const _K2& __y) const {
666673 return __comp_(__x.first, __y);
667674 }
668675# endif
......@@ -678,11 +685,11 @@ template <class _MapValueT, class _Key, class _Compare>
678685struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> {
679686 __lazy_synth_three_way_comparator<_Compare, _Key, _Key> __comp_;
680687
681 __lazy_synth_three_way_comparator(
688 _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
682689 _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
683690 : __comp_(__comp.key_comp()) {}
684691
685 _LIBCPP_HIDE_FROM_ABI auto
692 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
686693 operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
687694 return __comp_(__lhs.first, __rhs.first);
688695 }
......@@ -692,11 +699,11 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
692699struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _TransparentKey, _MapValueT> {
693700 __lazy_synth_three_way_comparator<_Compare, _TransparentKey, _Key> __comp_;
694701
695 __lazy_synth_three_way_comparator(
702 _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
696703 _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
697704 : __comp_(__comp.key_comp()) {}
698705
699 _LIBCPP_HIDE_FROM_ABI auto
706 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
700707 operator()(_LIBCPP_LIFETIMEBOUND const _TransparentKey& __lhs, _LIBCPP_LIFETIMEBOUND const _MapValueT& __rhs) const {
701708 return __comp_(__lhs, __rhs.first);
702709 }
......@@ -718,7 +725,7 @@ struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _
718725# endif // _LIBCPP_STD_VER >= 14
719726
720727template <class _Key, class _CP, class _Compare>
721inline _LIBCPP_HIDE_FROM_ABI void
728inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
722729swap(__map_value_compare<_Key, _CP, _Compare>& __x, __map_value_compare<_Key, _CP, _Compare>& __y)
723730 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
724731 __x.swap(__y);
......@@ -779,37 +786,41 @@ public:
779786 using reference = value_type&;
780787 using pointer = typename _TreeIterator::pointer;
781788
782 _LIBCPP_HIDE_FROM_ABI __map_iterator() _NOEXCEPT {}
789 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator() _NOEXCEPT {}
783790
784 _LIBCPP_HIDE_FROM_ABI __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
791 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
785792
786 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; }
787 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); }
793 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; }
794 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
795 return pointer_traits<pointer>::pointer_to(*__i_);
796 }
788797
789 _LIBCPP_HIDE_FROM_ABI __map_iterator& operator++() {
798 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator++() {
790799 ++__i_;
791800 return *this;
792801 }
793 _LIBCPP_HIDE_FROM_ABI __map_iterator operator++(int) {
802 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator++(int) {
794803 __map_iterator __t(*this);
795804 ++(*this);
796805 return __t;
797806 }
798807
799 _LIBCPP_HIDE_FROM_ABI __map_iterator& operator--() {
808 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator& operator--() {
800809 --__i_;
801810 return *this;
802811 }
803 _LIBCPP_HIDE_FROM_ABI __map_iterator operator--(int) {
812 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_iterator operator--(int) {
804813 __map_iterator __t(*this);
805814 --(*this);
806815 return __t;
807816 }
808817
809 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_iterator& __x, const __map_iterator& __y) {
818 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
819 operator==(const __map_iterator& __x, const __map_iterator& __y) {
810820 return __x.__i_ == __y.__i_;
811821 }
812 friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_iterator& __x, const __map_iterator& __y) {
822 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
823 operator!=(const __map_iterator& __x, const __map_iterator& __y) {
813824 return __x.__i_ != __y.__i_;
814825 }
815826
......@@ -834,7 +845,8 @@ struct __specialized_algorithm<_Alg, __iterator_pair<__map_iterator<_TreeIterato
834845 using __iterator _LIBCPP_NODEBUG = __map_iterator<_TreeIterator>;
835846
836847 template <class... _Args>
837 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) {
848 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void
849 operator()(__iterator __first, __iterator __last, _Args&&... __args) {
838850 __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...);
839851 }
840852};
......@@ -851,39 +863,43 @@ public:
851863 using reference = const value_type&;
852864 using pointer = typename _TreeIterator::pointer;
853865
854 _LIBCPP_HIDE_FROM_ABI __map_const_iterator() _NOEXCEPT {}
866 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator() _NOEXCEPT {}
855867
856 _LIBCPP_HIDE_FROM_ABI __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
857 _LIBCPP_HIDE_FROM_ABI
868 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
869 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
858870 __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT : __i_(__i.__i_) {}
859871
860 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__i_; }
861 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return pointer_traits<pointer>::pointer_to(*__i_); }
872 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reference operator*() const { return *__i_; }
873 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer operator->() const {
874 return pointer_traits<pointer>::pointer_to(*__i_);
875 }
862876
863 _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator++() {
877 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator++() {
864878 ++__i_;
865879 return *this;
866880 }
867 _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator++(int) {
881 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator++(int) {
868882 __map_const_iterator __t(*this);
869883 ++(*this);
870884 return __t;
871885 }
872886
873 _LIBCPP_HIDE_FROM_ABI __map_const_iterator& operator--() {
887 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator& operator--() {
874888 --__i_;
875889 return *this;
876890 }
877 _LIBCPP_HIDE_FROM_ABI __map_const_iterator operator--(int) {
891 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __map_const_iterator operator--(int) {
878892 __map_const_iterator __t(*this);
879893 --(*this);
880894 return __t;
881895 }
882896
883 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
897 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
898 operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {
884899 return __x.__i_ == __y.__i_;
885900 }
886 friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
901 friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
902 operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {
887903 return __x.__i_ != __y.__i_;
888904 }
889905
......@@ -910,7 +926,8 @@ struct __specialized_algorithm<
910926 using __iterator _LIBCPP_NODEBUG = __map_const_iterator<_TreeIterator>;
911927
912928 template <class... _Args>
913 _LIBCPP_HIDE_FROM_ABI static void operator()(__iterator __first, __iterator __last, _Args&&... __args) {
929 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void
930 operator()(__iterator __first, __iterator __last, _Args&&... __args) {
914931 __base()(__first.__i_, __last.__i_, std::forward<_Args>(__args)...);
915932 }
916933};
......@@ -940,10 +957,11 @@ public:
940957 protected:
941958 key_compare comp;
942959
943 _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
960 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {}
944961
945962 public:
946 _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
963 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
964 operator()(const value_type& __x, const value_type& __y) const {
947965 return comp(__x.first, __y.first);
948966 }
949967 };
......@@ -979,26 +997,27 @@ public:
979997 template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
980998 friend class multimap;
981999
982 _LIBCPP_HIDE_FROM_ABI map() _NOEXCEPT_(
1000 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map() _NOEXCEPT_(
9831001 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
9841002 is_nothrow_copy_constructible<key_compare>::value)
9851003 : __tree_(__vc(key_compare())) {}
9861004
987 _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp) _NOEXCEPT_(
1005 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp) _NOEXCEPT_(
9881006 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
9891007 : __tree_(__vc(__comp)) {}
9901008
991 _LIBCPP_HIDE_FROM_ABI explicit map(const key_compare& __comp, const allocator_type& __a)
1009 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const key_compare& __comp, const allocator_type& __a)
9921010 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
9931011
9941012 template <class _InputIterator>
995 _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
1013 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1014 map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
9961015 : __tree_(__vc(__comp)) {
9971016 insert(__f, __l);
9981017 }
9991018
10001019 template <class _InputIterator>
1001 _LIBCPP_HIDE_FROM_ABI
1020 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
10021021 map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
10031022 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
10041023 insert(__f, __l);
......@@ -1006,7 +1025,7 @@ public:
10061025
10071026# if _LIBCPP_STD_VER >= 23
10081027 template <_ContainerCompatibleRange<value_type> _Range>
1009 _LIBCPP_HIDE_FROM_ABI
1028 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
10101029 map(from_range_t,
10111030 _Range&& __range,
10121031 const key_compare& __comp = key_compare(),
......@@ -1016,46 +1035,46 @@ public:
10161035 }
10171036# endif
10181037
1019# if _LIBCPP_STD_VER >= 14
10201038 template <class _InputIterator>
1021 _LIBCPP_HIDE_FROM_ABI map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1039 _LIBCPP_HIDE_FROM_ABI
1040 _LIBCPP_CONSTEXPR_SINCE_CXX26 map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
10221041 : map(__f, __l, key_compare(), __a) {}
1023# endif
10241042
10251043# if _LIBCPP_STD_VER >= 23
10261044 template <_ContainerCompatibleRange<value_type> _Range>
1027 _LIBCPP_HIDE_FROM_ABI map(from_range_t, _Range&& __range, const allocator_type& __a)
1045 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(from_range_t, _Range&& __range, const allocator_type& __a)
10281046 : map(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
10291047# endif
10301048
1031 _LIBCPP_HIDE_FROM_ABI map(const map& __m) = default;
1049 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m) = default;
10321050
1033 _LIBCPP_HIDE_FROM_ABI map& operator=(const map& __m) = default;
1051 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(const map& __m) = default;
10341052
10351053# ifndef _LIBCPP_CXX03_LANG
10361054
1037 _LIBCPP_HIDE_FROM_ABI map(map&& __m) = default;
1055 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m) = default;
10381056
1039 _LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {}
1057 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(map&& __m, const allocator_type& __a)
1058 : __tree_(std::move(__m.__tree_), __a) {}
10401059
1041 _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) = default;
1060 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(map&& __m) = default;
10421061
1043 _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1062 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1063 map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
10441064 : __tree_(__vc(__comp)) {
10451065 insert(__il.begin(), __il.end());
10461066 }
10471067
1048 _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
1068 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1069 map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
10491070 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
10501071 insert(__il.begin(), __il.end());
10511072 }
10521073
1053# if _LIBCPP_STD_VER >= 14
1054 _LIBCPP_HIDE_FROM_ABI map(initializer_list<value_type> __il, const allocator_type& __a)
1074 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(initializer_list<value_type> __il, const allocator_type& __a)
10551075 : map(__il, key_compare(), __a) {}
1056# endif
10571076
1058 _LIBCPP_HIDE_FROM_ABI map& operator=(initializer_list<value_type> __il) {
1077 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map& operator=(initializer_list<value_type> __il) {
10591078 clear();
10601079 insert(__il.begin(), __il.end());
10611080 return *this;
......@@ -1063,118 +1082,157 @@ public:
10631082
10641083# endif // _LIBCPP_CXX03_LANG
10651084
1066 _LIBCPP_HIDE_FROM_ABI explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
1085 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit map(const allocator_type& __a)
1086 : __tree_(typename __base::allocator_type(__a)) {}
10671087
1068 _LIBCPP_HIDE_FROM_ABI map(const map& __m, const allocator_type& __alloc) : __tree_(__m.__tree_, __alloc) {}
1088 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 map(const map& __m, const allocator_type& __alloc)
1089 : __tree_(__m.__tree_, __alloc) {}
10691090
1070 _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
1091 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~map() {
1092 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
1093 }
10711094
1072 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1073 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1074 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1075 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
1095 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
1096 return __tree_.begin();
1097 }
1098 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
1099 return __tree_.begin();
1100 }
1101 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
1102 return __tree_.end();
1103 }
1104 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
1105 return __tree_.end();
1106 }
10761107
1077 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1078 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
1108 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
1109 return reverse_iterator(end());
1110 }
1111 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1112 rbegin() const _NOEXCEPT {
10791113 return const_reverse_iterator(end());
10801114 }
1081 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1082 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
1115 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
1116 return reverse_iterator(begin());
1117 }
1118 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
10831119 return const_reverse_iterator(begin());
10841120 }
10851121
1086 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1087 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1088 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1089 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
1122 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
1123 return begin();
1124 }
1125 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
1126 return end();
1127 }
1128 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1129 crbegin() const _NOEXCEPT {
1130 return rbegin();
1131 }
1132 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
1133 return rend();
1134 }
10901135
1091 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1092 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1093 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
1136 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
1137 return __tree_.size() == 0;
1138 }
1139 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
1140 return __tree_.size();
1141 }
1142 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
1143 return __tree_.max_size();
1144 }
10941145
1095 _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](const key_type& __k);
1146 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](const key_type& __k);
10961147# ifndef _LIBCPP_CXX03_LANG
1097 _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
1148 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& operator[](key_type&& __k);
10981149# endif
10991150
11001151 template <class _Arg,
11011152 __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
1102 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(_Arg&& __arg) {
1103 auto [_, __child] = __tree_.__find_equal(__arg);
1153 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(_Arg&& __arg) {
1154 auto [__dummy, __child] = __tree_.__find_equal(__arg);
11041155 if (__child == nullptr)
11051156 std::__throw_out_of_range("map::at: key not found");
1106 return static_cast<__node_pointer>(__child)->__get_value().second;
1157 return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
11071158 }
11081159
11091160 template <class _Arg,
11101161 __enable_if_t<__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t<_Arg> >, int> = 0>
1111 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(_Arg&& __arg) const {
1112 auto [_, __child] = __tree_.__find_equal(__arg);
1162 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type& at(_Arg&& __arg) const {
1163 auto [__dummy, __child] = __tree_.__find_equal(__arg);
11131164 if (__child == nullptr)
11141165 std::__throw_out_of_range("map::at: key not found");
1115 return static_cast<__node_pointer>(__child)->__get_value().second;
1166 return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
11161167 }
11171168
1118 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mapped_type& at(const key_type& __k);
1119 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const mapped_type& at(const key_type& __k) const;
1169 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 mapped_type& at(const key_type& __k);
1170 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const mapped_type&
1171 at(const key_type& __k) const;
11201172
1121 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1173 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
11221174 return allocator_type(__tree_.__alloc());
11231175 }
1124 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
1125 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const {
1176 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
1177 return __tree_.value_comp().key_comp();
1178 }
1179 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
11261180 return value_compare(__tree_.value_comp().key_comp());
11271181 }
11281182
11291183# ifndef _LIBCPP_CXX03_LANG
11301184 template <class... _Args>
1131 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
1185 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) {
11321186 return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
11331187 }
11341188
11351189 template <class... _Args>
1136 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
1190 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
11371191 return __tree_.__emplace_hint_unique(__p.__i_, std::forward<_Args>(__args)...).first;
11381192 }
11391193
11401194 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
1141 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(_Pp&& __p) {
1195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(_Pp&& __p) {
11421196 return __tree_.__emplace_unique(std::forward<_Pp>(__p));
11431197 }
11441198
11451199 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
1146 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
1200 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) {
11471201 return __tree_.__emplace_hint_unique(__pos.__i_, std::forward<_Pp>(__p)).first;
11481202 }
11491203
11501204# endif // _LIBCPP_CXX03_LANG
11511205
1152 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
1206 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
1207 return __tree_.__emplace_unique(__v);
1208 }
11531209
1154 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
1210 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
11551211 return __tree_.__emplace_hint_unique(__p.__i_, __v).first;
11561212 }
11571213
11581214# ifndef _LIBCPP_CXX03_LANG
1159 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
1215 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) {
11601216 return __tree_.__emplace_unique(std::move(__v));
11611217 }
11621218
1163 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
1219 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
11641220 return __tree_.__emplace_hint_unique(__p.__i_, std::move(__v)).first;
11651221 }
11661222
1167 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
1223 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
1224 insert(__il.begin(), __il.end());
1225 }
11681226# endif
11691227
11701228 template <class _InputIterator>
1171 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
1229 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
11721230 __tree_.__insert_range_unique(__first, __last);
11731231 }
11741232
11751233# if _LIBCPP_STD_VER >= 23
11761234 template <_ContainerCompatibleRange<value_type> _Range>
1177 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1235 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
11781236 __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
11791237 }
11801238# endif
......@@ -1182,13 +1240,15 @@ public:
11821240# if _LIBCPP_STD_VER >= 17
11831241
11841242 template <class... _Args>
1185 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) {
1243 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
1244 try_emplace(const key_type& __k, _Args&&... __args) {
11861245 return __tree_.__emplace_unique(
11871246 std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple(std::forward<_Args>(__args)...));
11881247 }
11891248
11901249 template <class... _Args>
1191 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args) {
1250 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
1251 try_emplace(key_type&& __k, _Args&&... __args) {
11921252 return __tree_.__emplace_unique(
11931253 std::piecewise_construct,
11941254 std::forward_as_tuple(std::move(__k)),
......@@ -1196,7 +1256,8 @@ public:
11961256 }
11971257
11981258 template <class... _Args>
1199 _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
1259 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1260 try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args) {
12001261 return __tree_
12011262 .__emplace_hint_unique(
12021263 __h.__i_,
......@@ -1207,7 +1268,8 @@ public:
12071268 }
12081269
12091270 template <class... _Args>
1210 _LIBCPP_HIDE_FROM_ABI iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
1271 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1272 try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args) {
12111273 return __tree_
12121274 .__emplace_hint_unique(
12131275 __h.__i_,
......@@ -1218,7 +1280,8 @@ public:
12181280 }
12191281
12201282 template <class _Vp>
1221 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v) {
1283 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool>
1284 insert_or_assign(const key_type& __k, _Vp&& __v) {
12221285 auto __result = __tree_.__emplace_unique(__k, std::forward<_Vp>(__v));
12231286 auto& [__iter, __inserted] = __result;
12241287 if (!__inserted)
......@@ -1227,7 +1290,7 @@ public:
12271290 }
12281291
12291292 template <class _Vp>
1230 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
1293 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v) {
12311294 auto __result = __tree_.__emplace_unique(std::move(__k), std::forward<_Vp>(__v));
12321295 auto& [__iter, __inserted] = __result;
12331296 if (!__inserted)
......@@ -1236,7 +1299,8 @@ public:
12361299 }
12371300
12381301 template <class _Vp>
1239 _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
1302 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1303 insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v) {
12401304 auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, __k, std::forward<_Vp>(__v));
12411305
12421306 if (!__inserted)
......@@ -1246,7 +1310,8 @@ public:
12461310 }
12471311
12481312 template <class _Vp>
1249 _LIBCPP_HIDE_FROM_ABI iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
1313 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
1314 insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v) {
12501315 auto [__r, __inserted] = __tree_.__emplace_hint_unique(__h.__i_, std::move(__k), std::forward<_Vp>(__v));
12511316
12521317 if (!__inserted)
......@@ -1257,101 +1322,118 @@ public:
12571322
12581323# endif // _LIBCPP_STD_VER >= 17
12591324
1260 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
1261 _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
1262 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
1263 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
1325 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) {
1326 return __tree_.erase(__p.__i_);
1327 }
1328 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
1329 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
1330 return __tree_.__erase_unique(__k);
1331 }
1332 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
12641333 return __tree_.erase(__f.__i_, __l.__i_);
12651334 }
1266 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
1335 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
12671336
12681337# if _LIBCPP_STD_VER >= 17
1269 _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
1338 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) {
12701339 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
12711340 "node_type with incompatible allocator passed to map::insert()");
12721341 return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
12731342 }
1274 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
1343 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
12751344 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
12761345 "node_type with incompatible allocator passed to map::insert()");
12771346 return __tree_.template __node_handle_insert_unique<node_type>(__hint.__i_, std::move(__nh));
12781347 }
1279 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1348 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
12801349 return __tree_.template __node_handle_extract<node_type>(__key);
12811350 }
1282 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1351 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
12831352 return __tree_.template __node_handle_extract<node_type>(__it.__i_);
12841353 }
12851354 template <class _Compare2>
1286 _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
1355 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1356 merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
12871357 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12881358 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12891359 __tree_.__node_handle_merge_unique(__source.__tree_);
12901360 }
12911361 template <class _Compare2>
1292 _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
1362 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1363 merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
12931364 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12941365 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12951366 __tree_.__node_handle_merge_unique(__source.__tree_);
12961367 }
12971368 template <class _Compare2>
1298 _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
1369 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1370 merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
12991371 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
13001372 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
13011373 __tree_.__node_handle_merge_unique(__source.__tree_);
13021374 }
13031375 template <class _Compare2>
1304 _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
1376 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1377 merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
13051378 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
13061379 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
13071380 __tree_.__node_handle_merge_unique(__source.__tree_);
13081381 }
13091382# endif
13101383
1311 _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__m.__tree_); }
1384 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
1385 __tree_.swap(__m.__tree_);
1386 }
13121387
1313 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1314 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
1388 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
1389 return __tree_.find(__k);
1390 }
1391 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
1392 return __tree_.find(__k);
1393 }
13151394# if _LIBCPP_STD_VER >= 14
13161395 template <typename _K2,
1317 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1318 int> = 0>
1319 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1396 class _Comp = _Compare,
1397 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1398 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
13201399 return __tree_.find(__k);
13211400 }
13221401 template <typename _K2,
1323 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1324 int> = 0>
1325 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1402 class _Comp = _Compare,
1403 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1404 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
13261405 return __tree_.find(__k);
13271406 }
13281407# endif
13291408
1330 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1409 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
13311410 return __tree_.__count_unique(__k);
13321411 }
13331412# if _LIBCPP_STD_VER >= 14
1334 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1335 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1413 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1414 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
13361415 return __tree_.__count_multi(__k);
13371416 }
13381417# endif
13391418
13401419# if _LIBCPP_STD_VER >= 20
1341 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1420 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
1421 return find(__k) != end();
1422 }
13421423 template <typename _K2,
1343 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1344 int> = 0>
1345 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1424 class _Comp = _Compare,
1425 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1426 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
13461427 return find(__k) != end();
13471428 }
13481429# endif // _LIBCPP_STD_VER >= 20
13491430
1350 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
1431 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
13511432 return __tree_.__lower_bound_unique(__k);
13521433 }
13531434
1354 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
1435 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1436 lower_bound(const key_type& __k) const {
13551437 return __tree_.__lower_bound_unique(__k);
13561438 }
13571439
......@@ -1359,56 +1441,63 @@ public:
13591441 // match multiple elements.
13601442# if _LIBCPP_STD_VER >= 14
13611443 template <typename _K2,
1362 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1363 int> = 0>
1364 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1444 class _Comp = _Compare,
1445 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1446 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
13651447 return __tree_.__lower_bound_multi(__k);
13661448 }
13671449
13681450 template <typename _K2,
1369 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1370 int> = 0>
1371 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1451 class _Comp = _Compare,
1452 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1453 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1454 lower_bound(const _K2& __k) const {
13721455 return __tree_.__lower_bound_multi(__k);
13731456 }
13741457# endif
13751458
1376 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
1459 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
13771460 return __tree_.__upper_bound_unique(__k);
13781461 }
13791462
1380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
1463 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1464 upper_bound(const key_type& __k) const {
13811465 return __tree_.__upper_bound_unique(__k);
13821466 }
13831467
13841468# if _LIBCPP_STD_VER >= 14
13851469 template <typename _K2,
1386 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1387 int> = 0>
1388 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1470 class _Comp = _Compare,
1471 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1472 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
13891473 return __tree_.__upper_bound_multi(__k);
13901474 }
13911475 template <typename _K2,
1392 enable_if_t<__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1393 int> = 0>
1394 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1476 class _Comp = _Compare,
1477 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1478 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1479 upper_bound(const _K2& __k) const {
13951480 return __tree_.__upper_bound_multi(__k);
13961481 }
13971482# endif
13981483
1399 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1484 [[__nodiscard__]]
1485 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
14001486 return __tree_.__equal_range_unique(__k);
14011487 }
1402 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1488 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1489 equal_range(const key_type& __k) const {
14031490 return __tree_.__equal_range_unique(__k);
14041491 }
14051492# if _LIBCPP_STD_VER >= 14
1406 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1407 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1493 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1494 [[__nodiscard__]]
1495 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
14081496 return __tree_.__equal_range_multi(__k);
14091497 }
1410 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1411 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1498 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1499 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1500 equal_range(const _K2& __k) const {
14121501 return __tree_.__equal_range_multi(__k);
14131502 }
14141503# endif
......@@ -1487,8 +1576,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key,
14871576 static const bool __has_algorithm = true;
14881577
14891578 template <class _Map, class _Func, class _Proj>
1490 _LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
1491 auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
1579 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
1580 auto [__dummy, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
14921581 __map.__tree_, std::move(__func), std::move(__proj));
14931582 return std::make_pair(__map.end(), std::move(__func2));
14941583 }
......@@ -1497,13 +1586,13 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<map<_Key,
14971586
14981587# ifndef _LIBCPP_CXX03_LANG
14991588template <class _Key, class _Tp, class _Compare, class _Allocator>
1500_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
1589_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
15011590 return __tree_.__emplace_unique(std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple())
15021591 .first->second;
15031592}
15041593
15051594template <class _Key, class _Tp, class _Compare, class _Allocator>
1506_Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
1595_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) {
15071596 return __tree_
15081597 .__emplace_unique(std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple())
15091598 .first->second;
......@@ -1538,23 +1627,23 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) {
15381627# endif // _LIBCPP_CXX03_LANG
15391628
15401629template <class _Key, class _Tp, class _Compare, class _Allocator>
1541_Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
1542 auto [_, __child] = __tree_.__find_equal(__k);
1630_LIBCPP_CONSTEXPR_SINCE_CXX26 _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
1631 auto [__dummy, __child] = __tree_.__find_equal(__k);
15431632 if (__child == nullptr)
15441633 std::__throw_out_of_range("map::at: key not found");
1545 return static_cast<__node_pointer>(__child)->__get_value().second;
1634 return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
15461635}
15471636
15481637template <class _Key, class _Tp, class _Compare, class _Allocator>
1549const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
1550 auto [_, __child] = __tree_.__find_equal(__k);
1638_LIBCPP_CONSTEXPR_SINCE_CXX26 const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
1639 auto [__dummy, __child] = __tree_.__find_equal(__k);
15511640 if (__child == nullptr)
15521641 std::__throw_out_of_range("map::at: key not found");
1553 return static_cast<__node_pointer>(__child)->__get_value().second;
1642 return std::__static_fancy_pointer_cast<__node_pointer>(__child)->__get_value().second;
15541643}
15551644
15561645template <class _Key, class _Tp, class _Compare, class _Allocator>
1557inline _LIBCPP_HIDE_FROM_ABI bool
1646inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15581647operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15591648 return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
15601649}
......@@ -1562,31 +1651,31 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
15621651# if _LIBCPP_STD_VER <= 17
15631652
15641653template <class _Key, class _Tp, class _Compare, class _Allocator>
1565inline _LIBCPP_HIDE_FROM_ABI bool
1654inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15661655operator<(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15671656 return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
15681657}
15691658
15701659template <class _Key, class _Tp, class _Compare, class _Allocator>
1571inline _LIBCPP_HIDE_FROM_ABI bool
1660inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15721661operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15731662 return !(__x == __y);
15741663}
15751664
15761665template <class _Key, class _Tp, class _Compare, class _Allocator>
1577inline _LIBCPP_HIDE_FROM_ABI bool
1666inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15781667operator>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15791668 return __y < __x;
15801669}
15811670
15821671template <class _Key, class _Tp, class _Compare, class _Allocator>
1583inline _LIBCPP_HIDE_FROM_ABI bool
1672inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15841673operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15851674 return !(__x < __y);
15861675}
15871676
15881677template <class _Key, class _Tp, class _Compare, class _Allocator>
1589inline _LIBCPP_HIDE_FROM_ABI bool
1678inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
15901679operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15911680 return !(__y < __x);
15921681}
......@@ -1594,7 +1683,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp,
15941683# else // #if _LIBCPP_STD_VER <= 17
15951684
15961685template <class _Key, class _Tp, class _Compare, class _Allocator>
1597_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
1686_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>>
15981687operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) {
15991688 return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
16001689}
......@@ -1602,7 +1691,7 @@ operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp
16021691# endif // #if _LIBCPP_STD_VER <= 17
16031692
16041693template <class _Key, class _Tp, class _Compare, class _Allocator>
1605inline _LIBCPP_HIDE_FROM_ABI void
1694inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
16061695swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y)
16071696 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
16081697 __x.swap(__y);
......@@ -1610,7 +1699,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Alloca
16101699
16111700# if _LIBCPP_STD_VER >= 20
16121701template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
1613inline _LIBCPP_HIDE_FROM_ABI typename map<_Key, _Tp, _Compare, _Allocator>::size_type
1702inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename map<_Key, _Tp, _Compare, _Allocator>::size_type
16141703erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
16151704 return std::__libcpp_erase_if_container(__c, __pred);
16161705}
......@@ -1648,10 +1737,11 @@ public:
16481737 protected:
16491738 key_compare comp;
16501739
1651 _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
1740 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {}
16521741
16531742 public:
1654 _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
1743 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
1744 operator()(const value_type& __x, const value_type& __y) const {
16551745 return comp(__x.first, __y.first);
16561746 }
16571747 };
......@@ -1684,26 +1774,28 @@ public:
16841774 template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
16851775 friend class multimap;
16861776
1687 _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_(
1777 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap() _NOEXCEPT_(
16881778 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
16891779 is_nothrow_copy_constructible<key_compare>::value)
16901780 : __tree_(__vc(key_compare())) {}
16911781
1692 _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_(
1782 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp) _NOEXCEPT_(
16931783 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
16941784 : __tree_(__vc(__comp)) {}
16951785
1696 _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a)
1786 _LIBCPP_HIDE_FROM_ABI
1787 _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp, const allocator_type& __a)
16971788 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
16981789
16991790 template <class _InputIterator>
1700 _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
1791 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1792 multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
17011793 : __tree_(__vc(__comp)) {
17021794 insert(__f, __l);
17031795 }
17041796
17051797 template <class _InputIterator>
1706 _LIBCPP_HIDE_FROM_ABI
1798 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
17071799 multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
17081800 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
17091801 insert(__f, __l);
......@@ -1711,7 +1803,7 @@ public:
17111803
17121804# if _LIBCPP_STD_VER >= 23
17131805 template <_ContainerCompatibleRange<value_type> _Range>
1714 _LIBCPP_HIDE_FROM_ABI
1806 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
17151807 multimap(from_range_t,
17161808 _Range&& __range,
17171809 const key_compare& __comp = key_compare(),
......@@ -1721,47 +1813,48 @@ public:
17211813 }
17221814# endif
17231815
1724# if _LIBCPP_STD_VER >= 14
17251816 template <class _InputIterator>
1726 _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1817 _LIBCPP_HIDE_FROM_ABI
1818 _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
17271819 : multimap(__f, __l, key_compare(), __a) {}
1728# endif
17291820
17301821# if _LIBCPP_STD_VER >= 23
17311822 template <_ContainerCompatibleRange<value_type> _Range>
1732 _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a)
1823 _LIBCPP_HIDE_FROM_ABI
1824 _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(from_range_t, _Range&& __range, const allocator_type& __a)
17331825 : multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
17341826# endif
17351827
1736 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m) = default;
1828 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m) = default;
17371829
1738 _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) = default;
1830 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(const multimap& __m) = default;
17391831
17401832# ifndef _LIBCPP_CXX03_LANG
17411833
1742 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) = default;
1834 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m) = default;
17431835
1744 _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {}
1836 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m, const allocator_type& __a)
1837 : __tree_(std::move(__m.__tree_), __a) {}
17451838
1746 _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) = default;
1839 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(multimap&& __m) = default;
17471840
1748 _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1841 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1842 multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
17491843 : __tree_(__vc(__comp)) {
17501844 insert(__il.begin(), __il.end());
17511845 }
17521846
1753 _LIBCPP_HIDE_FROM_ABI
1847 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
17541848 multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
17551849 : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
17561850 insert(__il.begin(), __il.end());
17571851 }
17581852
1759# if _LIBCPP_STD_VER >= 14
1760 _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a)
1853 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1854 multimap(initializer_list<value_type> __il, const allocator_type& __a)
17611855 : multimap(__il, key_compare(), __a) {}
1762# endif
17631856
1764 _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
1857 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(initializer_list<value_type> __il) {
17651858 clear();
17661859 insert(__il.begin(), __il.end());
17671860 return *this;
......@@ -1769,234 +1862,309 @@ public:
17691862
17701863# endif // _LIBCPP_CXX03_LANG
17711864
1772 _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
1865 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const allocator_type& __a)
1866 : __tree_(typename __base::allocator_type(__a)) {}
17731867
1774 _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a) : __tree_(__m.__tree_, __a) {}
1868 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m, const allocator_type& __a)
1869 : __tree_(__m.__tree_, __a) {}
17751870
1776 _LIBCPP_HIDE_FROM_ABI ~multimap() {
1871 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multimap() {
17771872 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
17781873 }
17791874
1780 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1781 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1782 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1783 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
1875 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
1876 return __tree_.begin();
1877 }
1878 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
1879 return __tree_.begin();
1880 }
1881 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
1882 return __tree_.end();
1883 }
1884 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
1885 return __tree_.end();
1886 }
17841887
1785 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1786 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
1888 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
1889 return reverse_iterator(end());
1890 }
1891 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1892 rbegin() const _NOEXCEPT {
17871893 return const_reverse_iterator(end());
17881894 }
1789 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1790 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
1895 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
1896 return reverse_iterator(begin());
1897 }
1898 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
17911899 return const_reverse_iterator(begin());
17921900 }
17931901
1794 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1795 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1796 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1797 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
1902 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
1903 return begin();
1904 }
1905 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
1906 return end();
1907 }
1908 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1909 crbegin() const _NOEXCEPT {
1910 return rbegin();
1911 }
1912 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
1913 return rend();
1914 }
17981915
1799 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1800 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1801 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
1916 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
1917 return __tree_.size() == 0;
1918 }
1919 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
1920 return __tree_.size();
1921 }
1922 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
1923 return __tree_.max_size();
1924 }
18021925
1803 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
1926 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
18041927 return allocator_type(__tree_.__alloc());
18051928 }
1806 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
1807 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const {
1929 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
1930 return __tree_.value_comp().key_comp();
1931 }
1932 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
18081933 return value_compare(__tree_.value_comp().key_comp());
18091934 }
18101935
18111936# ifndef _LIBCPP_CXX03_LANG
18121937
18131938 template <class... _Args>
1814 _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
1939 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
18151940 return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
18161941 }
18171942
18181943 template <class... _Args>
1819 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
1944 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
18201945 return __tree_.__emplace_hint_multi(__p.__i_, std::forward<_Args>(__args)...);
18211946 }
18221947
18231948 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
1824 _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) {
1949 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(_Pp&& __p) {
18251950 return __tree_.__emplace_multi(std::forward<_Pp>(__p));
18261951 }
18271952
18281953 template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
1829 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
1954 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) {
18301955 return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p));
18311956 }
18321957
1833 _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); }
1958 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) {
1959 return __tree_.__emplace_multi(std::move(__v));
1960 }
18341961
1835 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
1962 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
18361963 return __tree_.__emplace_hint_multi(__p.__i_, std::move(__v));
18371964 }
18381965
1839 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
1966 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
1967 insert(__il.begin(), __il.end());
1968 }
18401969
18411970# endif // _LIBCPP_CXX03_LANG
18421971
1843 _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
1972 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) {
1973 return __tree_.__emplace_multi(__v);
1974 }
18441975
1845 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
1976 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
18461977 return __tree_.__emplace_hint_multi(__p.__i_, __v);
18471978 }
18481979
18491980 template <class _InputIterator>
1850 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
1981 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __f, _InputIterator __l) {
18511982 __tree_.__insert_range_multi(__f, __l);
18521983 }
18531984
18541985# if _LIBCPP_STD_VER >= 23
18551986 template <_ContainerCompatibleRange<value_type> _Range>
1856 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1987 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
18571988 __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
18581989 }
18591990# endif
18601991
1861 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
1862 _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
1863 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
1864 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) {
1992 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) {
1993 return __tree_.erase(__p.__i_);
1994 }
1995 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
1996 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
1997 return __tree_.__erase_multi(__k);
1998 }
1999 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
18652000 return __tree_.erase(__f.__i_, __l.__i_);
18662001 }
18672002
18682003# if _LIBCPP_STD_VER >= 17
1869 _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
2004 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) {
18702005 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
18712006 "node_type with incompatible allocator passed to multimap::insert()");
18722007 return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
18732008 }
1874 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
2009 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
18752010 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
18762011 "node_type with incompatible allocator passed to multimap::insert()");
18772012 return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, std::move(__nh));
18782013 }
1879 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
2014 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
18802015 return __tree_.template __node_handle_extract<node_type>(__key);
18812016 }
1882 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
2017 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
18832018 return __tree_.template __node_handle_extract<node_type>(__it.__i_);
18842019 }
18852020 template <class _Compare2>
1886 _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
2021 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
2022 merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
18872023 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
18882024 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
18892025 return __tree_.__node_handle_merge_multi(__source.__tree_);
18902026 }
18912027 template <class _Compare2>
1892 _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
2028 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
2029 merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
18932030 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
18942031 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
18952032 return __tree_.__node_handle_merge_multi(__source.__tree_);
18962033 }
18972034 template <class _Compare2>
1898 _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
2035 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
2036 merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
18992037 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
19002038 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
19012039 return __tree_.__node_handle_merge_multi(__source.__tree_);
19022040 }
19032041 template <class _Compare2>
1904 _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
2042 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
2043 merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
19052044 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
19062045 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
19072046 return __tree_.__node_handle_merge_multi(__source.__tree_);
19082047 }
19092048# endif
19102049
1911 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
2050 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
19122051
1913 _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
2052 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multimap& __m)
2053 _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
19142054 __tree_.swap(__m.__tree_);
19152055 }
19162056
1917 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1918 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
2057 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
2058 return __tree_.find(__k);
2059 }
2060 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
2061 return __tree_.find(__k);
2062 }
19192063# if _LIBCPP_STD_VER >= 14
1920 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1921 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
2064 template <typename _K2,
2065 class _Comp = _Compare,
2066 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2067 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
19222068 return __tree_.find(__k);
19232069 }
1924 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1925 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
2070 template <typename _K2,
2071 class _Comp = _Compare,
2072 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2073 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
19262074 return __tree_.find(__k);
19272075 }
19282076# endif
19292077
1930 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
2078 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
19312079 return __tree_.__count_multi(__k);
19322080 }
19332081# if _LIBCPP_STD_VER >= 14
1934 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1935 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
2082 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
2083 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
19362084 return __tree_.__count_multi(__k);
19372085 }
19382086# endif
19392087
19402088# if _LIBCPP_STD_VER >= 20
1941 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1942 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1943 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
2089 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
2090 return find(__k) != end();
2091 }
2092 template <typename _K2,
2093 class _Comp = _Compare,
2094 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2095 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
19442096 return find(__k) != end();
19452097 }
19462098# endif // _LIBCPP_STD_VER >= 20
19472099
1948 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
2100 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
19492101 return __tree_.__lower_bound_multi(__k);
19502102 }
19512103
1952 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
2104 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
2105 lower_bound(const key_type& __k) const {
19532106 return __tree_.__lower_bound_multi(__k);
19542107 }
19552108
19562109# if _LIBCPP_STD_VER >= 14
1957 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1958 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
2110 template <typename _K2,
2111 class _Comp = _Compare,
2112 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2113 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
19592114 return __tree_.__lower_bound_multi(__k);
19602115 }
19612116
1962 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1963 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
2117 template <typename _K2,
2118 class _Comp = _Compare,
2119 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2120 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
2121 lower_bound(const _K2& __k) const {
19642122 return __tree_.__lower_bound_multi(__k);
19652123 }
19662124# endif
19672125
1968 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
2126 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
19692127 return __tree_.__upper_bound_multi(__k);
19702128 }
19712129
1972 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
2130 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
2131 upper_bound(const key_type& __k) const {
19732132 return __tree_.__upper_bound_multi(__k);
19742133 }
19752134
19762135# if _LIBCPP_STD_VER >= 14
1977 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1978 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
2136 template <typename _K2,
2137 class _Comp = _Compare,
2138 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2139 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
19792140 return __tree_.__upper_bound_multi(__k);
19802141 }
1981 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1982 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
2142 template <typename _K2,
2143 class _Comp = _Compare,
2144 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
2145 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
2146 upper_bound(const _K2& __k) const {
19832147 return __tree_.__upper_bound_multi(__k);
19842148 }
19852149# endif
19862150
1987 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
2151 [[__nodiscard__]]
2152 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
19882153 return __tree_.__equal_range_multi(__k);
19892154 }
1990 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
2155 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
2156 equal_range(const key_type& __k) const {
19912157 return __tree_.__equal_range_multi(__k);
19922158 }
19932159# if _LIBCPP_STD_VER >= 14
1994 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1995 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
2160 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
2161 [[__nodiscard__]]
2162 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
19962163 return __tree_.__equal_range_multi(__k);
19972164 }
1998 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1999 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
2165 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
2166 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
2167 equal_range(const _K2& __k) const {
20002168 return __tree_.__equal_range_multi(__k);
20012169 }
20022170# endif
......@@ -2070,8 +2238,8 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_
20702238 static const bool __has_algorithm = true;
20712239
20722240 template <class _Map, class _Func, class _Proj>
2073 _LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
2074 auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
2241 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
2242 auto [__dummy, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
20752243 __map.__tree_, std::move(__func), std::move(__proj));
20762244 return std::make_pair(__map.end(), std::move(__func2));
20772245 }
......@@ -2079,7 +2247,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_
20792247# endif
20802248
20812249template <class _Key, class _Tp, class _Compare, class _Allocator>
2082inline _LIBCPP_HIDE_FROM_ABI bool
2250inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX26
20832251operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
20842252 return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
20852253}
......@@ -2087,31 +2255,31 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
20872255# if _LIBCPP_STD_VER <= 17
20882256
20892257template <class _Key, class _Tp, class _Compare, class _Allocator>
2090inline _LIBCPP_HIDE_FROM_ABI bool
2258inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
20912259operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
20922260 return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
20932261}
20942262
20952263template <class _Key, class _Tp, class _Compare, class _Allocator>
2096inline _LIBCPP_HIDE_FROM_ABI bool
2264inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
20972265operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
20982266 return !(__x == __y);
20992267}
21002268
21012269template <class _Key, class _Tp, class _Compare, class _Allocator>
2102inline _LIBCPP_HIDE_FROM_ABI bool
2270inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
21032271operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
21042272 return __y < __x;
21052273}
21062274
21072275template <class _Key, class _Tp, class _Compare, class _Allocator>
2108inline _LIBCPP_HIDE_FROM_ABI bool
2276inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
21092277operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
21102278 return !(__x < __y);
21112279}
21122280
21132281template <class _Key, class _Tp, class _Compare, class _Allocator>
2114inline _LIBCPP_HIDE_FROM_ABI bool
2282inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
21152283operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
21162284 return !(__y < __x);
21172285}
......@@ -2119,7 +2287,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
21192287# else // #if _LIBCPP_STD_VER <= 17
21202288
21212289template <class _Key, class _Tp, class _Compare, class _Allocator>
2122_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
2290_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>>
21232291operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
21242292 const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
21252293 return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
......@@ -2128,7 +2296,7 @@ operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
21282296# endif // #if _LIBCPP_STD_VER <= 17
21292297
21302298template <class _Key, class _Tp, class _Compare, class _Allocator>
2131inline _LIBCPP_HIDE_FROM_ABI void
2299inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
21322300swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y)
21332301 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
21342302 __x.swap(__y);
......@@ -2136,7 +2304,7 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compar
21362304
21372305# if _LIBCPP_STD_VER >= 20
21382306template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
2139inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
2307inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
21402308erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
21412309 return std::__libcpp_erase_if_container(__c, __pred);
21422310}
......@@ -2170,7 +2338,7 @@ _LIBCPP_END_NAMESPACE_STD
21702338
21712339_LIBCPP_POP_MACROS
21722340
2173# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2341# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
21742342# include <concepts>
21752343# include <cstdlib>
21762344# include <functional>
lib/libcxx/include/mdspan+46-46
......@@ -46,15 +46,15 @@ namespace std {
4646// extents synopsis
4747
4848namespace std {
49 template<class _IndexType, size_t... _Extents>
49 template<class IndexType, size_t... Extents>
5050 class extents {
5151 public:
52 using index_type = _IndexType;
52 using index_type = IndexType;
5353 using size_type = make_unsigned_t<index_type>;
5454 using rank_type = size_t;
5555
5656 // [mdspan.extents.obs], observers of the multidimensional index space
57 static constexpr rank_type rank() noexcept { return sizeof...(_Extents); }
57 static constexpr rank_type rank() noexcept { return sizeof...(Extents); }
5858 static constexpr rank_type rank_dynamic() noexcept { return dynamic-index(rank()); }
5959 static constexpr size_t static_extent(rank_type) noexcept;
6060 constexpr index_type extent(rank_type) const noexcept;
......@@ -62,20 +62,20 @@ namespace std {
6262 // [mdspan.extents.cons], constructors
6363 constexpr extents() noexcept = default;
6464
65 template<class _OtherIndexType, size_t... _OtherExtents>
65 template<class OtherIndexType, size_t... OtherExtents>
6666 constexpr explicit(see below)
67 extents(const extents<_OtherIndexType, _OtherExtents...>&) noexcept;
68 template<class... _OtherIndexTypes>
69 constexpr explicit extents(_OtherIndexTypes...) noexcept;
70 template<class _OtherIndexType, size_t N>
67 extents(const extents<OtherIndexType, OtherExtents...>&) noexcept;
68 template<class... OtherIndexTypes>
69 constexpr explicit extents(OtherIndexTypes...) noexcept;
70 template<class OtherIndexType, size_t N>
7171 constexpr explicit(N != rank_dynamic())
72 extents(span<_OtherIndexType, N>) noexcept;
73 template<class _OtherIndexType, size_t N>
72 extents(span<OtherIndexType, N>) noexcept;
73 template<class OtherIndexType, size_t N>
7474 constexpr explicit(N != rank_dynamic())
75 extents(const array<_OtherIndexType, N>&) noexcept;
75 extents(const array<OtherIndexType, N>&) noexcept;
7676
7777 // [mdspan.extents.cmp], comparison operators
78 template<class _OtherIndexType, size_t... _OtherExtents>
78 template<class OtherIndexType, size_t... OtherExtents>
7979 friend constexpr bool operator==(const extents&,
8080 const extents<_OtherIndexType, _OtherExtents...>&) noexcept;
8181
......@@ -97,12 +97,12 @@ namespace std {
9797 class layout_left::mapping {
9898 public:
9999 using extents_type = Extents;
100 using index_type = typename extents_type::index_type;
101 using size_type = typename extents_type::size_type;
102 using rank_type = typename extents_type::rank_type;
100 using index_type = extents_type::index_type;
101 using size_type = extents_type::size_type;
102 using rank_type = extents_type::rank_type;
103103 using layout_type = layout_left;
104104
105 // [mdspan.layout.right.cons], constructors
105 // [mdspan.layout.left.cons], constructors
106106 constexpr mapping() noexcept = default;
107107 constexpr mapping(const mapping&) noexcept = default;
108108 constexpr mapping(const extents_type&) noexcept;
......@@ -118,7 +118,7 @@ namespace std {
118118
119119 constexpr mapping& operator=(const mapping&) noexcept = default;
120120
121 // [mdspan.layout.right.obs], observers
121 // [mdspan.layout.left.obs], observers
122122 constexpr const extents_type& extents() const noexcept { return extents_; }
123123
124124 constexpr index_type required_span_size() const noexcept;
......@@ -151,9 +151,9 @@ namespace std {
151151 class layout_right::mapping {
152152 public:
153153 using extents_type = Extents;
154 using index_type = typename extents_type::index_type;
155 using size_type = typename extents_type::size_type;
156 using rank_type = typename extents_type::rank_type;
154 using index_type = extents_type::index_type;
155 using size_type = extents_type::size_type;
156 using rank_type = extents_type::rank_type;
157157 using layout_type = layout_right;
158158
159159 // [mdspan.layout.right.cons], constructors
......@@ -205,9 +205,9 @@ namespace std {
205205 class layout_stride::mapping {
206206 public:
207207 using extents_type = Extents;
208 using index_type = typename extents_type::index_type;
209 using size_type = typename extents_type::size_type;
210 using rank_type = typename extents_type::rank_type;
208 using index_type = extents_type::index_type;
209 using size_type = extents_type::size_type;
210 using rank_type = extents_type::rank_type;
211211 using layout_type = layout_stride;
212212
213213 private:
......@@ -237,7 +237,7 @@ namespace std {
237237 constexpr index_type operator()(Indices...) const noexcept;
238238
239239 static constexpr bool is_always_unique() noexcept { return true; }
240 static constexpr bool is_always_exhaustive() noexcept { return false; }
240 static constexpr bool is_always_exhaustive() noexcept;
241241 static constexpr bool is_always_strided() noexcept { return true; }
242242
243243 static constexpr bool is_unique() noexcept { return true; }
......@@ -286,22 +286,19 @@ namespace std {
286286 static constexpr size_t byte_alignment = ByteAlignment;
287287
288288 constexpr aligned_accessor() noexcept = default;
289
290289 template<class OtherElementType, size_t OtherByteAlignment>
291290 constexpr aligned_accessor(
292291 aligned_accessor<OtherElementType, OtherByteAlignment>) noexcept;
293
294292 template<class OtherElementType>
295 explicit constexpr aligned_accessor(
296 default_accessor<OtherElementType>) noexcept;
293 constexpr explicit aligned_accessor(default_accessor<OtherElementType>) noexcept;
297294
298295 template<class OtherElementType>
299 constexpr operator default_accessor<OtherElementType>() const noexcept;
296 constexpr operator default_accessor<OtherElementType>() const noexcept;
300297
301298 constexpr reference access(data_handle_type p, size_t i) const noexcept;
302299
303 constexpr typename offset_policy::data_handle_type
304 offset(data_handle_type p, size_t i) const noexcept;
300 constexpr typename offset_policy::data_handle_type offset(
301 data_handle_type p, size_t i) const noexcept;
305302 };
306303}
307304
......@@ -315,14 +312,14 @@ namespace std {
315312 using extents_type = Extents;
316313 using layout_type = LayoutPolicy;
317314 using accessor_type = AccessorPolicy;
318 using mapping_type = typename layout_type::template mapping<extents_type>;
315 using mapping_type = layout_type::template mapping<extents_type>;
319316 using element_type = ElementType;
320317 using value_type = remove_cv_t<element_type>;
321 using index_type = typename extents_type::index_type;
322 using size_type = typename extents_type::size_type;
323 using rank_type = typename extents_type::rank_type;
324 using data_handle_type = typename accessor_type::data_handle_type;
325 using reference = typename accessor_type::reference;
318 using index_type = extents_type::index_type;
319 using size_type = extents_type::size_type;
320 using rank_type = extents_type::rank_type;
321 using data_handle_type = accessor_type::data_handle_type;
322 using reference = accessor_type::reference;
326323
327324 static constexpr rank_type rank() noexcept { return extents_type::rank(); }
328325 static constexpr rank_type rank_dynamic() noexcept { return extents_type::rank_dynamic(); }
......@@ -364,8 +361,15 @@ namespace std {
364361 template<class OtherIndexType>
365362 constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const;
366363
364 template<class... OtherIndexTypes>
365 constexpr reference at(OtherIndexTypes... indices) const;
366 template<class OtherIndexType>
367 constexpr reference at(span<OtherIndexType, rank()> indices) const;
368 template<class OtherIndexType>
369 constexpr reference at(const array<OtherIndexType, rank()>& indices) const;
370
367371 constexpr size_type size() const noexcept;
368 [[nodiscard]] constexpr bool empty() const noexcept;
372 constexpr bool empty() const noexcept;
369373
370374 friend constexpr void swap(mdspan& x, mdspan& y) noexcept;
371375
......@@ -398,23 +402,19 @@ namespace std {
398402 };
399403
400404 template<class CArray>
401 requires(is_array_v<CArray> && rank_v<CArray> == 1)
405 requires (is_array_v<CArray> && rank_v<CArray> == 1)
402406 mdspan(CArray&)
403407 -> mdspan<remove_all_extents_t<CArray>, extents<size_t, extent_v<CArray, 0>>>;
404408
405409 template<class Pointer>
406 requires(is_pointer_v<remove_reference_t<Pointer>>)
410 requires (is_pointer_v<remove_reference_t<Pointer>>)
407411 mdspan(Pointer&&)
408412 -> mdspan<remove_pointer_t<remove_reference_t<Pointer>>, extents<size_t>>;
409413
410414 template<class ElementType, class... Integrals>
411415 requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
412416 explicit mdspan(ElementType*, Integrals...)
413 -> mdspan<ElementType, dextents<size_t, sizeof...(Integrals)>>; // until C++26
414 template<class ElementType, class... Integrals>
415 requires((is_convertible_v<Integrals, size_t> && ...) && sizeof...(Integrals) > 0)
416 explicit mdspan(ElementType*, Integrals...)
417 -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals>...>>; // since C++26
417 -> mdspan<ElementType, extents<size_t, maybe-static-ext<Integrals>...>>;
418418
419419 template<class ElementType, class OtherIndexType, size_t N>
420420 mdspan(ElementType*, span<OtherIndexType, N>)
......@@ -434,7 +434,7 @@ namespace std {
434434 typename MappingType::layout_type>;
435435
436436 template<class MappingType, class AccessorType>
437 mdspan(const typename AccessorType::data_handle_type&, const MappingType&,
437 mdspan(typename AccessorType::data_handle_type, const MappingType&,
438438 const AccessorType&)
439439 -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type,
440440 typename MappingType::layout_type, AccessorType>;
lib/libcxx/include/memory+1-1
......@@ -987,7 +987,7 @@ template<class Pointer = void, class Smart, class... Args>
987987# pragma GCC system_header
988988# endif
989989
990# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
990# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
991991# include <atomic>
992992# include <concepts>
993993# include <cstddef>
lib/libcxx/include/memory_resource+2-2
......@@ -69,11 +69,11 @@ namespace std::pmr {
6969# pragma GCC system_header
7070# endif
7171
72# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER >= 17 && _LIBCPP_STD_VER <= 20
72# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER >= 17 && _LIBCPP_STD_VER <= 20
7373# include <mutex>
7474# endif
7575
76# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
76# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
7777# include <stdexcept>
7878# endif
7979#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/mutex+20-11
......@@ -214,10 +214,11 @@ template<class Callable, class ...Args>
214214_LIBCPP_PUSH_MACROS
215215# include <__undef_macros>
216216
217_LIBCPP_BEGIN_NAMESPACE_STD
218
219217# if _LIBCPP_HAS_THREADS
220218
219_LIBCPP_BEGIN_NAMESPACE_STD
220_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
221
221222class _LIBCPP_EXPORTED_FROM_ABI recursive_mutex {
222223 __libcpp_recursive_mutex_t __m_;
223224
......@@ -457,7 +458,7 @@ public:
457458 __m_.lock();
458459 }
459460
460 _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __m_.unlock(); }
461 _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __m_.unlock(); }
461462
462463 [[nodiscard]]
463464 _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_REQUIRES_CAPABILITY(__m)
......@@ -468,25 +469,31 @@ public:
468469};
469470
470471template <class... _MArgs>
471class scoped_lock {
472class _LIBCPP_SCOPED_LOCKABLE scoped_lock {
472473 static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
473474 typedef tuple<_MArgs&...> _MutexTuple;
474475
475476public:
476 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) : __t_(__margs...) {
477 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(_MArgs&... __margs) _LIBCPP_ACQUIRE_CAPABILITY(__margs...)
478 : __t_(__margs...) {
477479 std::lock(__margs...);
478480 }
479481
480 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {}
482 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs)
483 _LIBCPP_REQUIRES_CAPABILITY(__margs...)
484 : __t_(__margs...) {}
481485
482 _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_); }
486 _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI ~scoped_lock() {
487 __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_);
488 }
483489
484490 scoped_lock(scoped_lock const&) = delete;
485491 scoped_lock& operator=(scoped_lock const&) = delete;
486492
487493private:
488494 template <size_t... _Indx>
489 _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt) {
495 _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt)
496 _LIBCPP_RELEASE_CAPABILITY(std::get<_Indx>(__mt)...) {
490497 (std::get<_Indx>(__mt).unlock(), ...);
491498 }
492499
......@@ -495,17 +502,19 @@ private:
495502_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock);
496503
497504# endif // _LIBCPP_STD_VER >= 17
498# endif // _LIBCPP_HAS_THREADS
499505
506_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
500507_LIBCPP_END_NAMESPACE_STD
501508
509# endif // _LIBCPP_HAS_THREADS
510
502511_LIBCPP_POP_MACROS
503512
504# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
513# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
505514# include <typeinfo>
506515# endif
507516
508# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
517# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
509518# include <atomic>
510519# include <concepts>
511520# include <cstdlib>
lib/libcxx/include/new+3-3
......@@ -81,8 +81,8 @@ void operator delete[](void* ptr, std::align_val_t alignment,
8181
8282void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26
8383void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++20, constexpr since C++26
84void operator delete (void* ptr, void*) noexcept;
85void operator delete[](void* ptr, void*) noexcept;
84void operator delete (void* ptr, void*) noexcept; // constexpr since C++26
85void operator delete[](void* ptr, void*) noexcept; // constexpr since C++26
8686
8787*/
8888
......@@ -114,7 +114,7 @@ void operator delete[](void* ptr, void*) noexcept;
114114# pragma GCC system_header
115115# endif
116116
117# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
117# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
118118# include <cstddef>
119119# include <cstdlib>
120120# include <type_traits>
lib/libcxx/include/numbers+1-1
......@@ -159,7 +159,7 @@ _LIBCPP_END_NAMESPACE_STD
159159
160160# endif // _LIBCPP_STD_VER >= 20
161161
162# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
162# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
163163# include <concepts>
164164# include <cstddef>
165165# include <type_traits>
lib/libcxx/include/numeric+7-7
......@@ -142,15 +142,15 @@ template<class T>
142142
143143// [numeric.sat], saturation arithmetic
144144template<class T>
145constexpr T add_sat(T x, T y) noexcept; // freestanding, Since C++26
145constexpr T saturating_add(T x, T y) noexcept; // freestanding, Since C++26
146146template<class T>
147constexpr T sub_sat(T x, T y) noexcept; // freestanding, Since C++26
147constexpr T saturating_sub(T x, T y) noexcept; // freestanding, Since C++26
148148template<class T>
149constexpr T mul_sat(T x, T y) noexcept; // freestanding, Since C++26
149constexpr T saturating_mul(T x, T y) noexcept; // freestanding, Since C++26
150150template<class T>
151constexpr T div_sat(T x, T y) noexcept; // freestanding, Since C++26
151constexpr T saturating_div(T x, T y) noexcept; // freestanding, Since C++26
152152template<class T, class U>
153constexpr T saturate_cast(U x) noexcept; // freestanding, Since C++26
153constexpr T saturating_cast(U x) noexcept; // freestanding, Since C++26
154154
155155} // std
156156
......@@ -190,12 +190,12 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin
190190# pragma GCC system_header
191191# endif
192192
193# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
193# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 14
194194# include <initializer_list>
195195# include <limits>
196196# endif
197197
198# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
198# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
199199# include <climits>
200200# include <cmath>
201201# include <concepts>
lib/libcxx/include/optional+341-383
......@@ -264,15 +264,14 @@ namespace std {
264264# include <__compare/three_way_comparable.h>
265265# include <__concepts/invocable.h>
266266# include <__config>
267# include <__cstddef/ptrdiff_t.h>
268267# include <__exception/exception.h>
269# include <__format/range_format.h>
270268# include <__functional/hash.h>
271269# include <__functional/invoke.h>
272270# include <__functional/unary_function.h>
271# include <__fwd/format.h>
273272# include <__fwd/functional.h>
274273# include <__iterator/bounded_iter.h>
275# include <__iterator/wrap_iter.h>
274# include <__iterator/capacity_aware_iterator.h>
276275# include <__memory/addressof.h>
277276# include <__memory/construct_at.h>
278277# include <__ranges/enable_borrowed_range.h>
......@@ -493,6 +492,61 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> {
493492 }
494493 }
495494 }
495
496 // [optional.observe]
497 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept {
498 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
499 return std::addressof(this->__get());
500 }
501
502 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept {
503 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
504 return std::addressof(this->__get());
505 }
506
507 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
508 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
509 return this->__get();
510 }
511
512 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
513 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
514 return this->__get();
515 }
516
517 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
518 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
519 return std::move(this->__get());
520 }
521
522 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
523 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
524 return std::move(this->__get());
525 }
526
527 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const& {
528 if (!this->has_value())
529 std::__throw_bad_optional_access();
530 return this->__get();
531 }
532
533 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & {
534 if (!this->has_value())
535 std::__throw_bad_optional_access();
536 return this->__get();
537 }
538
539 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && {
540 if (!this->has_value())
541 std::__throw_bad_optional_access();
542 return std::move(this->__get());
543 }
544
545 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&& {
546 if (!this->has_value())
547 std::__throw_bad_optional_access();
548 return std::move(this->__get());
549 }
496550};
497551
498552template <class _Tp>
......@@ -504,7 +558,7 @@ struct __optional_storage_base<_Tp, true> {
504558 _LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
505559
506560 template <class _Up>
507 _LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) noexcept {
561 _LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) {
508562 _Tp& __r(std::forward<_Up>(__val));
509563 __value_ = std::addressof(__r);
510564 }
......@@ -517,6 +571,14 @@ struct __optional_storage_base<_Tp, true> {
517571 __convert_init_ref_val(std::forward<_UArg>(__uarg));
518572 }
519573
574# if _LIBCPP_STD_VER >= 23
575 template <class _Fp, class... _Args>
576 constexpr __optional_storage_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) {
577 __convert_init_ref_val(std::forward<invoke_result_t<_Fp, _Args...>>(
578 std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)));
579 }
580# endif
581
520582 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
521583
522584 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
......@@ -525,7 +587,6 @@ struct __optional_storage_base<_Tp, true> {
525587
526588 template <class _UArg>
527589 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
528 _LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
529590 static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>,
530591 "Attempted to construct a reference element in tuple from a "
531592 "possible temporary");
......@@ -554,9 +615,26 @@ struct __optional_storage_base<_Tp, true> {
554615 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept {
555616 std::swap(__value_, __rhs.__value_);
556617 }
618
619 // [optional.ref.observe]
620 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept {
621 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
622 return std::addressof(this->__get());
623 }
624
625 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept {
626 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
627 return this->__get();
628 }
629
630 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const {
631 if (!this->has_value())
632 std::__throw_bad_optional_access();
633 return this->__get();
634 }
557635};
558636
559template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
637template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp>>
560638struct __optional_copy_base : __optional_storage_base<_Tp> {
561639 using __optional_storage_base<_Tp>::__optional_storage_base;
562640};
......@@ -576,7 +654,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
576654 _LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
577655};
578656
579template <class _Tp, bool = is_trivially_move_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
657template <class _Tp, bool = is_trivially_move_constructible_v<_Tp>>
580658struct __optional_move_base : __optional_copy_base<_Tp> {
581659 using __optional_copy_base<_Tp>::__optional_copy_base;
582660};
......@@ -600,8 +678,7 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
600678
601679template <class _Tp,
602680 bool = (is_trivially_destructible_v<_Tp> && is_trivially_copy_constructible_v<_Tp> &&
603 is_trivially_copy_assignable_v<_Tp>) ||
604 is_lvalue_reference_v<_Tp>>
681 is_trivially_copy_assignable_v<_Tp>)>
605682struct __optional_copy_assign_base : __optional_move_base<_Tp> {
606683 using __optional_move_base<_Tp>::__optional_move_base;
607684};
......@@ -625,8 +702,7 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
625702
626703template <class _Tp,
627704 bool = (is_trivially_destructible_v<_Tp> && is_trivially_move_constructible_v<_Tp> &&
628 is_trivially_move_assignable_v<_Tp>) ||
629 is_lvalue_reference_v<_Tp>>
705 is_trivially_move_assignable_v<_Tp>)>
630706struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
631707 using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
632708};
......@@ -655,8 +731,8 @@ using __optional_sfinae_ctor_base_t _LIBCPP_NODEBUG =
655731
656732template <class _Tp>
657733using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG =
658 __sfinae_assign_base< (is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>,
659 (is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>>;
734 __sfinae_assign_base< (is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Tp>),
735 (is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>)>;
660736
661737template <class _Tp>
662738class optional;
......@@ -685,126 +761,115 @@ struct __is_std_optional : false_type {};
685761template <class _Tp>
686762struct __is_std_optional<optional<_Tp>> : true_type {};
687763
688template <class _Tp, class... _Args>
689inline constexpr bool __is_constructible_for_optional_v = is_constructible_v<_Tp, _Args...>;
690
691template <class _Tp, class... _Args>
692struct __is_constructible_for_optional : bool_constant<__is_constructible_for_optional_v<_Tp, _Args...>> {};
764# if _LIBCPP_STD_VER < 26
765template <class _Tp>
766inline constexpr bool __is_valid_optional_contained_type = is_object_v<_Tp>;
767# else
768template <class _Tp>
769inline constexpr bool __is_valid_optional_contained_type = is_object_v<_Tp> || is_lvalue_reference_v<_Tp>;
770# endif
693771
694template <class _Tp, class _Up, class... _Args>
695inline constexpr bool __is_constructible_for_optional_initializer_list_v =
696 is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>;
772template <class _Tp>
773struct __optional_iterator_base : __optional_move_assign_base<_Tp> {
774 using __optional_move_assign_base<_Tp>::__optional_move_assign_base;
775};
697776
698777# if _LIBCPP_STD_VER >= 26
699template <class _Tp, class... _Args>
700inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false;
701template <class _Tp, class _Arg>
702inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> =
703 is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>;
704
705template <class _Tp, class _Up, class... _Args>
706inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false;
707# endif
778template <class _Tp>
779struct __optional_iterator_base<_Tp&> : __optional_storage_base<_Tp&> {
780 using __optional_storage_base<_Tp&>::__optional_storage_base;
781};
708782
709template <class _Tp, class = void>
710struct __optional_iterator {};
711
712# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
783# if _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
713784
714785template <class _Tp>
715struct __optional_iterator<_Tp, enable_if_t<is_object_v<_Tp>>> {
786 requires is_object_v<_Tp>
787struct __optional_iterator_base<_Tp> : __optional_move_assign_base<_Tp> {
716788private:
717789 using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
718790 using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const _Tp>;
719791
720792public:
721# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
722 using iterator = __bounded_iter<__wrap_iter<__pointer>>;
723 using const_iterator = __bounded_iter<__wrap_iter<__const_pointer>>;
724# else
725 using iterator = __wrap_iter<__pointer>;
726 using const_iterator = __wrap_iter<__const_pointer>;
727# endif
793 using __optional_move_assign_base<_Tp>::__optional_move_assign_base;
794
795# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
796 using iterator = __bounded_iter<__pointer>;
797 using const_iterator = __bounded_iter<__const_pointer>;
798# else
799 using iterator = __capacity_aware_iterator<__pointer, optional<_Tp>, 1>;
800 using const_iterator = __capacity_aware_iterator<__const_pointer, optional<_Tp>, 1>;
801# endif
728802
729803 // [optional.iterators], iterator support
730804 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() noexcept {
731 auto& __derived_self = static_cast<optional<_Tp>&>(*this);
732 auto* __ptr = std::addressof(__derived_self.__get());
805 auto* __ptr = std::addressof(this->__get());
733806
734# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
735 return std::__make_bounded_iter(
736 __wrap_iter<__pointer>(__ptr),
737 __wrap_iter<__pointer>(__ptr),
738 __wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
739# else
740 return iterator(__ptr);
741# endif
807# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
808 return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0));
809# else
810 return std::__make_capacity_aware_iterator<__pointer, optional<_Tp>, 1>(__ptr);
811# endif
742812 }
743813
744814 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept {
745 auto& __derived_self = static_cast<const optional<_Tp>&>(*this);
746 auto* __ptr = std::addressof(__derived_self.__get());
815 auto* __ptr = std::addressof(this->__get());
747816
748# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
749 return std::__make_bounded_iter(
750 __wrap_iter<__const_pointer>(__ptr),
751 __wrap_iter<__const_pointer>(__ptr),
752 __wrap_iter<__const_pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
753# else
754 return const_iterator(__ptr);
755# endif
817# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
818 return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0));
819# else
820 return std::__make_capacity_aware_iterator<__const_pointer, optional<_Tp>, 1>(__ptr);
821# endif
756822 }
757823
758824 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() noexcept {
759 return begin() + (static_cast<optional<_Tp>&>(*this).has_value() ? 1 : 0);
825 return begin() + (this->has_value() ? 1 : 0);
760826 }
761827 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept {
762 return begin() + (static_cast<const optional<_Tp>&>(*this).has_value() ? 1 : 0);
828 return begin() + (this->has_value() ? 1 : 0);
763829 }
764830};
765831
766832template <class _Tp>
767struct __optional_iterator<_Tp&, enable_if_t<is_object_v<_Tp> && !__is_unbounded_array_v<_Tp> >> {
833 requires(is_object_v<_Tp> && !__is_unbounded_array_v<_Tp>)
834struct __optional_iterator_base<_Tp&> : __optional_storage_base<_Tp&> {
768835private:
769836 using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
770837
771838public:
772# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
773 using iterator = __bounded_iter<__wrap_iter<__pointer>>;
774# else
775 using iterator = __wrap_iter<__pointer>;
776# endif
839 using __optional_storage_base<_Tp&>::__optional_storage_base;
840
841# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
842 using iterator = __bounded_iter<__pointer>;
843# else
844 using iterator = __capacity_aware_iterator<__pointer, optional<_Tp&>, 1>;
845# endif
777846
778847 // [optional.ref.iterators], iterator support
779848
780849 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const noexcept {
781 auto& __derived_self = static_cast<const optional<_Tp&>&>(*this);
782 auto* __ptr = __derived_self.has_value() ? std::addressof(__derived_self.__get()) : nullptr;
850 auto* __ptr = this->has_value() ? std::addressof(this->__get()) : nullptr;
783851
784# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
785 return std::__make_bounded_iter(
786 __wrap_iter<__pointer>(__ptr),
787 __wrap_iter<__pointer>(__ptr),
788 __wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
789# else
790 return iterator(__ptr);
791# endif
852# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
853 return std::__make_bounded_iter(__ptr, __ptr, __ptr + (this->has_value() ? 1 : 0));
854# else
855 return std::__make_capacity_aware_iterator<__pointer, optional<_Tp&>, 1>(__ptr);
856# endif
792857 }
793858
794859 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const noexcept {
795 return begin() + (static_cast<const optional<_Tp&>&>(*this).has_value() ? 1 : 0);
860 return begin() + (this->has_value() ? 1 : 0);
796861 }
797862};
798863
799# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
864# endif // _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
865# endif // _LIBCPP_STD_VER >= 26
800866
801867template <class _Tp>
802868class _LIBCPP_DECLSPEC_EMPTY_BASES optional
803 : private __optional_move_assign_base<_Tp>,
869 : public __optional_iterator_base<_Tp>,
804870 private __optional_sfinae_ctor_base_t<_Tp>,
805 private __optional_sfinae_assign_base_t<_Tp>,
806 public __optional_iterator<_Tp> {
807 using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
871 private __optional_sfinae_assign_base_t<_Tp> {
872 using __base _LIBCPP_NODEBUG = __optional_iterator_base<_Tp>;
808873
809874public:
810875 using value_type = __libcpp_remove_reference_t<_Tp>;
......@@ -813,9 +878,8 @@ public:
813878 conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>;
814879
815880private:
816 static_assert(!is_same_v<__remove_cvref_t<_Tp>, in_place_t>,
817 "instantiation of optional with in_place_t is ill-formed");
818 static_assert(!is_same_v<__remove_cvref_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed");
881 static_assert(!is_same_v<remove_cv_t<_Tp>, in_place_t>, "instantiation of optional with in_place_t is ill-formed");
882 static_assert(!is_same_v<remove_cv_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed");
819883# if _LIBCPP_STD_VER >= 26
820884 static_assert(!is_rvalue_reference_v<_Tp>, "instantiation of optional with an rvalue reference type is ill-formed");
821885# else
......@@ -824,16 +888,6 @@ private:
824888 static_assert(is_destructible_v<_Tp>, "instantiation of optional with a non-destructible type is ill-formed");
825889 static_assert(!is_array_v<_Tp>, "instantiation of optional with an array type is ill-formed");
826890
827# if _LIBCPP_STD_VER >= 26
828 template <class _Up>
829 constexpr static bool __libcpp_opt_ref_ctor_deleted =
830 is_lvalue_reference_v<_Tp> && reference_constructs_from_temporary_v<_Tp, _Up>;
831
832 template <class _Up>
833 constexpr static bool __ref_ctor_enabled =
834 is_lvalue_reference_v<_Tp> && !reference_constructs_from_temporary_v<_Tp, _Up>;
835# endif
836
837891 // LWG2756: conditionally explicit conversion from _Up
838892 struct _CheckOptionalArgsConstructor {
839893 template <class _Up>
......@@ -905,131 +959,48 @@ public:
905959 _LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
906960 _LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
907961
908 template <
909 class _InPlaceT,
910 class... _Args,
911 enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, __is_constructible_for_optional<_Tp, _Args...>>::value, int> = 0>
962 template <class _InPlaceT,
963 class... _Args,
964 enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, is_constructible<_Tp, _Args...>>::value, int> = 0>
912965 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
913966 : __base(in_place, std::forward<_Args>(__args)...) {}
914967
915 template <class _Up,
916 class... _Args,
917 enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
968 template <class _Up, class... _Args, enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
918969 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
919970 : __base(in_place, __il, std::forward<_Args>(__args)...) {}
920971
921972 template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
922 _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v)
923# if _LIBCPP_STD_VER >= 26
924 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
925# endif
926 : __base(in_place, std::forward<_Up>(__v)) {
927 }
973 _LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
974 : __base(in_place, std::forward<_Up>(__v)) {}
928975
929976 template <class _Up = remove_cv_t<_Tp>,
930977 enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
931 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v)
932# if _LIBCPP_STD_VER >= 26
933 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
934# endif
935 : __base(in_place, std::forward<_Up>(__v)) {
936 }
978 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v) noexcept(
979 is_nothrow_constructible_v<_Tp, _Up>) // strengthened
980 : __base(in_place, std::forward<_Up>(__v)) {}
937981
938982 // LWG2756: conditionally explicit conversion from const optional<_Up>&
939983 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
940 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
941# if _LIBCPP_STD_VER >= 26
942 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, const _Up&>)
943# endif
944 {
984 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v) {
945985 this->__construct_from(__v);
946986 }
987
947988 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
948 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
949# if _LIBCPP_STD_VER >= 26
950 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, const _Up&>)
951# endif
952 {
989 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v) {
953990 this->__construct_from(__v);
954991 }
955992
956993 // LWG2756: conditionally explicit conversion from optional<_Up>&&
957994 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
958 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
959# if _LIBCPP_STD_VER >= 26
960 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
961# endif
962 {
963 this->__construct_from(std::move(__v));
964 }
965 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
966 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
967# if _LIBCPP_STD_VER >= 26
968 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
969# endif
970 {
995 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v) {
971996 this->__construct_from(std::move(__v));
972997 }
973998
974 // deleted optional<T&> constructors and additional optional<T&> constructors
975# if _LIBCPP_STD_VER >= 26
976 // optional(U&&)
977 template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
978 requires __libcpp_opt_ref_ctor_deleted<_Up>
979 optional(_Up&&) = delete;
980
981 template <class _Up = remove_cv_t<_Tp>,
982 enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
983 requires __libcpp_opt_ref_ctor_deleted<_Up>
984 explicit optional(_Up&&) = delete;
985
986 // optional(optional<U>& rhs)
987 template <class _Up>
988 requires __ref_ctor_enabled<_Up&> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) && (!is_same_v<_Tp&, _Up>) &&
989 is_constructible_v<_Tp&, _Up&>
990 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up&, _Tp&>)
991 optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) {
992 this->__construct_from(__rhs);
993 }
994
995 template <class _Up>
996 requires __libcpp_opt_ref_ctor_deleted<_Up&> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
997 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&>
998 constexpr explicit optional(optional<_Up>& __rhs) noexcept = delete;
999
1000 // optional(const optional<U>&)
1001 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
1002 requires __libcpp_opt_ref_ctor_deleted<const _Up&>
1003 optional(const optional<_Up>&) = delete;
1004
1005 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
1006 requires __libcpp_opt_ref_ctor_deleted<const _Up&>
1007 explicit optional(const optional<_Up>&) = delete;
1008
1009 // optional(optional<U>&&)
1010 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
1011 requires __libcpp_opt_ref_ctor_deleted<_Up>
1012 optional(optional<_Up>&&) = delete;
1013
1014999 template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
1015 requires __libcpp_opt_ref_ctor_deleted<_Up>
1016 explicit optional(optional<_Up>&&) = delete;
1017
1018 // optional(const optional<U>&&)
1019 template <class _Up>
1020 requires __ref_ctor_enabled<const _Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
1021 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, const _Up>
1022 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!is_convertible_v<const _Up, _Tp&>)
1023 optional(const optional<_Up>&& __v) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) {
1000 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v) {
10241001 this->__construct_from(std::move(__v));
10251002 }
10261003
1027 template <class _Up>
1028 requires __libcpp_opt_ref_ctor_deleted<const _Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
1029 (!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, const _Up>
1030 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>&& __v) noexcept = delete;
1031# endif
1032
10331004# if _LIBCPP_STD_VER >= 23
10341005 template <class _Tag,
10351006 class _Fp,
......@@ -1052,8 +1023,7 @@ public:
10521023 enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Up>, optional>,
10531024 _Or<_IsNotSame<__remove_cvref_t<_Up>, _Tp>, _Not<is_scalar<_Tp>>>,
10541025 is_constructible<_Tp, _Up>,
1055 is_assignable<_Tp&, _Up>,
1056 is_object<_Tp>>::value,
1026 is_assignable<_Tp&, _Up>>::value,
10571027 int> = 0>
10581028 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
10591029 if (this->has_value())
......@@ -1077,138 +1047,35 @@ public:
10771047 return *this;
10781048 }
10791049
1080 template <class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0>
1081 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args)
1082# if _LIBCPP_STD_VER >= 26
1083 noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp, _Args...>)
1084# endif
1085 {
1050 template <class... _Args, enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
1051 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args) {
10861052 reset();
10871053 this->__construct(std::forward<_Args>(__args)...);
10881054 return this->__get();
10891055 }
10901056
1091 template <class _Up,
1092 class... _Args,
1093 enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
1057 template <class _Up, class... _Args, enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>, int> = 0>
10941058 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
10951059 reset();
10961060 this->__construct(__il, std::forward<_Args>(__args)...);
10971061 return this->__get();
10981062 }
10991063
1100 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) noexcept(
1101 (is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>)
1102# if _LIBCPP_STD_VER >= 26
1103 || is_lvalue_reference_v<_Tp>
1104# endif
1105 ) {
1064 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
1065 swap(optional& __opt) noexcept((is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>)) {
11061066 this->__swap(__opt);
11071067 }
11081068
1109 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept
1110# if _LIBCPP_STD_VER >= 26
1111 requires(is_object_v<_Tp>)
1112# endif
1113 {
1114 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
1115 return std::addressof(this->__get());
1116 }
1117
1118 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept
1119# if _LIBCPP_STD_VER >= 26
1120 requires(is_object_v<_Tp>)
1121# endif
1122 {
1123 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
1124 return std::addressof(this->__get());
1125 }
1126
1127 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept
1128# if _LIBCPP_STD_VER >= 26
1129 requires(is_object_v<_Tp>)
1130# endif
1131 {
1132 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1133 return this->__get();
1134 }
1135
1136 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept
1137# if _LIBCPP_STD_VER >= 26
1138 requires(is_object_v<_Tp>)
1139# endif
1140 {
1141 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1142 return this->__get();
1143 }
1144
1145 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept
1146# if _LIBCPP_STD_VER >= 26
1147 requires(is_object_v<_Tp>)
1148# endif
1149 {
1150 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1151 return std::move(this->__get());
1152 }
1153
1154 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept
1155# if _LIBCPP_STD_VER >= 26
1156 requires(is_object_v<_Tp>)
1157# endif
1158 {
1159 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1160 return std::move(this->__get());
1161 }
1069 using __base::operator*;
1070 using __base::operator->;
11621071
11631072 _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return has_value(); }
11641073
11651074 using __base::__get;
11661075 using __base::has_value;
1167
1168 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const&
1169# if _LIBCPP_STD_VER >= 26
1170 requires(is_object_v<_Tp>)
1171# endif
1172 {
1173 if (!this->has_value())
1174 std::__throw_bad_optional_access();
1175 return this->__get();
1176 }
1177
1178 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() &
1179# if _LIBCPP_STD_VER >= 26
1180 requires(is_object_v<_Tp>)
1181# endif
1182 {
1183 if (!this->has_value())
1184 std::__throw_bad_optional_access();
1185 return this->__get();
1186 }
1187
1188 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() &&
1189# if _LIBCPP_STD_VER >= 26
1190 requires(is_object_v<_Tp>)
1191# endif
1192 {
1193 if (!this->has_value())
1194 std::__throw_bad_optional_access();
1195 return std::move(this->__get());
1196 }
1197
1198 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&&
1199# if _LIBCPP_STD_VER >= 26
1200 requires(is_object_v<_Tp>)
1201# endif
1202 {
1203 if (!this->has_value())
1204 std::__throw_bad_optional_access();
1205 return std::move(this->__get());
1206 }
1076 using __base::value;
12071077
12081078 template <class _Up = remove_cv_t<_Tp>>
1209# if _LIBCPP_STD_VER >= 26
1210 requires(is_object_v<_Tp>)
1211# endif
12121079 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
12131080 static_assert(is_copy_constructible_v<_Tp>, "optional<T>::value_or: T must be copy constructible");
12141081 static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
......@@ -1216,9 +1083,6 @@ public:
12161083 }
12171084
12181085 template <class _Up = remove_cv_t<_Tp>>
1219# if _LIBCPP_STD_VER >= 26
1220 requires(is_object_v<_Tp>)
1221# endif
12221086 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
12231087 static_assert(is_move_constructible_v<_Tp>, "optional<T>::value_or: T must be move constructible");
12241088 static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
......@@ -1227,9 +1091,6 @@ public:
12271091
12281092# if _LIBCPP_STD_VER >= 23
12291093 template <class _Func>
1230# if _LIBCPP_STD_VER >= 26
1231 requires(is_object_v<_Tp>)
1232# endif
12331094 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
12341095 using _Up = invoke_result_t<_Func, _Tp&>;
12351096 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
......@@ -1240,9 +1101,6 @@ public:
12401101 }
12411102
12421103 template <class _Func>
1243# if _LIBCPP_STD_VER >= 26
1244 requires(is_object_v<_Tp>)
1245# endif
12461104 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
12471105 using _Up = invoke_result_t<_Func, const _Tp&>;
12481106 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
......@@ -1253,9 +1111,6 @@ public:
12531111 }
12541112
12551113 template <class _Func>
1256# if _LIBCPP_STD_VER >= 26
1257 requires(is_object_v<_Tp>)
1258# endif
12591114 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
12601115 using _Up = invoke_result_t<_Func, _Tp&&>;
12611116 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
......@@ -1266,9 +1121,6 @@ public:
12661121 }
12671122
12681123 template <class _Func>
1269# if _LIBCPP_STD_VER >= 26
1270 requires(is_object_v<_Tp>)
1271# endif
12721124 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
12731125 using _Up = invoke_result_t<_Func, const _Tp&&>;
12741126 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
......@@ -1279,60 +1131,52 @@ public:
12791131 }
12801132
12811133 template <class _Func>
1282# if _LIBCPP_STD_VER >= 26
1283 requires(is_object_v<_Tp>)
1284# endif
12851134 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
12861135 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
12871136 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
12881137 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
12891138 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
1290 static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
1139 static_assert(
1140 __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional");
12911141 if (*this)
12921142 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
12931143 return optional<_Up>();
12941144 }
12951145
12961146 template <class _Func>
1297# if _LIBCPP_STD_VER >= 26
1298 requires(is_object_v<_Tp>)
1299# endif
13001147 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
13011148 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>;
13021149 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
13031150 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
13041151 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
1305 static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
1152 static_assert(
1153 __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional");
13061154 if (*this)
13071155 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
13081156 return optional<_Up>();
13091157 }
13101158
13111159 template <class _Func>
1312# if _LIBCPP_STD_VER >= 26
1313 requires(is_object_v<_Tp>)
1314# endif
13151160 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
13161161 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>;
13171162 static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
13181163 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
13191164 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
1320 static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
1165 static_assert(
1166 __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional");
13211167 if (*this)
13221168 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
13231169 return optional<_Up>();
13241170 }
13251171
13261172 template <class _Func>
1327# if _LIBCPP_STD_VER >= 26
1328 requires(is_object_v<_Tp>)
1329# endif
13301173 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
13311174 using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>;
13321175 static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
13331176 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
13341177 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
1335 static_assert(is_object_v<_Up>, "Result of f(std::move(value())) should be an object type");
1178 static_assert(
1179 __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional");
13361180 if (*this)
13371181 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), std::move(value()));
13381182 return optional<_Up>();
......@@ -1341,9 +1185,6 @@ public:
13411185 template <invocable _Func>
13421186 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
13431187 requires is_copy_constructible_v<_Tp>
1344# if _LIBCPP_STD_VER >= 26
1345 && (is_object_v<_Tp>)
1346# endif
13471188 {
13481189 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
13491190 "Result of f() should be the same type as this optional");
......@@ -1355,9 +1196,6 @@ public:
13551196 template <invocable _Func>
13561197 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
13571198 requires is_move_constructible_v<_Tp>
1358# if _LIBCPP_STD_VER >= 26
1359 && (is_object_v<_Tp>)
1360# endif
13611199 {
13621200 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
13631201 "Result of f() should be the same type as this optional");
......@@ -1368,46 +1206,137 @@ public:
13681206# endif // _LIBCPP_STD_VER >= 23
13691207
13701208 using __base::reset;
1209};
13711210
1372// optional<T&> overloads
13731211# if _LIBCPP_STD_VER >= 26
1212template <class _Tp>
1213class optional<_Tp&> : public __optional_iterator_base<_Tp&> {
1214 using __base _LIBCPP_NODEBUG = __optional_iterator_base<_Tp&>;
13741215
1375 _LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept
1376 requires(is_lvalue_reference_v<_Tp>)
1377 {
1378 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
1379 return std::addressof(this->__get());
1216 template <class _Up, class _QualUp>
1217 static constexpr bool __check_optionalU_ctor =
1218 !is_same_v<remove_cv_t<_Tp>, optional<_Up>> && !is_same_v<_Tp&, _Up> && is_constructible_v<_Tp&, _QualUp>;
1219 static_assert(!is_same_v<remove_cv_t<_Tp>, in_place_t>, "instantiation of optional with in_place_t is ill-formed");
1220 static_assert(!is_same_v<remove_cv_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed");
1221
1222public:
1223 using value_type = _Tp;
1224
1225 constexpr optional() noexcept = default;
1226 constexpr optional(nullopt_t) noexcept {}
1227 constexpr optional(const optional&) noexcept = default;
1228
1229 template <class _Arg>
1230 requires(is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>)
1231 constexpr explicit optional(in_place_t, _Arg&& __arg) : __base(in_place, std::forward<_Arg>(__arg)) {}
1232
1233 template <class _Up>
1234 requires(!is_same_v<remove_cvref_t<_Up>, optional> && !is_same_v<remove_cvref_t<_Up>, in_place_t> &&
1235 is_constructible_v<_Tp&, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>)
1236 constexpr explicit(!is_convertible_v<_Up, _Tp&>) optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp&, _Up>)
1237 : __base(in_place, std::forward<_Up>(__v)) {}
1238
1239 template <class _Up>
1240 requires(__check_optionalU_ctor<_Up, _Up&> && !reference_constructs_from_temporary_v<_Tp&, _Up&>)
1241 constexpr explicit(!is_convertible_v<_Up&, _Tp&>)
1242 optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) {
1243 this->__construct_from(__rhs);
13801244 }
13811245
1382 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept
1383 requires(is_lvalue_reference_v<_Tp>)
1384 {
1385 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
1386 return this->__get();
1246 template <class _Up>
1247 requires(__check_optionalU_ctor<_Up, const _Up&> && !reference_constructs_from_temporary_v<_Tp&, const _Up&>)
1248 constexpr explicit(!is_convertible_v<const _Up&, _Tp&>)
1249 optional(const optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up&>) {
1250 this->__construct_from(__rhs);
13871251 }
13881252
1389 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const
1390 requires(is_lvalue_reference_v<_Tp>)
1391 {
1392 if (!this->has_value())
1393 std::__throw_bad_optional_access();
1253 template <class _Up>
1254 requires(__check_optionalU_ctor<_Up, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>)
1255 constexpr explicit(!is_convertible_v<_Up, _Tp&>)
1256 optional(optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) {
1257 this->__construct_from(std::move(__rhs));
1258 }
1259
1260 template <class _Up>
1261 requires(__check_optionalU_ctor<_Up, const _Up> && !reference_constructs_from_temporary_v<_Tp&, const _Up>)
1262 constexpr explicit(!is_convertible_v<const _Up, _Tp&>)
1263 optional(const optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) {
1264 this->__construct_from(std::move(__rhs));
1265 }
1266
1267 template <class _Tag, class _Fp, class... _Args>
1268 requires(is_same_v<_Tag, __optional_construct_from_invoke_tag>)
1269 _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Tag, _Fp&& __f, _Args&&... __args)
1270 : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {}
1271
1272 // deleted overloads
1273
1274 template <class _Up>
1275 requires(!is_same_v<remove_cvref_t<_Up>, optional> && !is_same_v<remove_cvref_t<_Up>, in_place_t> &&
1276 is_constructible_v<_Tp&, _Up> && reference_constructs_from_temporary_v<_Tp&, _Up>)
1277 constexpr explicit(!is_convertible_v<_Up, _Tp&>)
1278 optional(_Up&& __v) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) = delete;
1279
1280 template <class _Up>
1281 requires(__check_optionalU_ctor<_Up, _Up&> && reference_constructs_from_temporary_v<_Tp&, _Up&>)
1282 constexpr explicit(!is_convertible_v<_Up&, _Tp&>)
1283 optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) = delete;
1284
1285 template <class _Up>
1286 requires(__check_optionalU_ctor<_Up, const _Up&> && reference_constructs_from_temporary_v<_Tp&, const _Up&>)
1287 constexpr explicit(!is_convertible_v<const _Up&, _Tp&>)
1288 optional(const optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up&>) = delete;
1289
1290 template <class _Up>
1291 requires(__check_optionalU_ctor<_Up, _Up> && reference_constructs_from_temporary_v<_Tp&, _Up>)
1292 constexpr explicit(!is_convertible_v<_Up, _Tp&>)
1293 optional(optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) = delete;
1294
1295 template <class _Up>
1296 requires(__check_optionalU_ctor<_Up, const _Up> && reference_constructs_from_temporary_v<_Tp&, const _Up>)
1297 constexpr explicit(!is_convertible_v<const _Up, _Tp&>)
1298 optional(const optional<_Up>&& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) = delete;
1299
1300 constexpr ~optional() = default;
1301
1302 using __base::__get;
1303
1304 _LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(nullopt_t) noexcept {
1305 reset();
1306 return *this;
1307 }
1308
1309 constexpr optional& operator=(const optional&) noexcept = default;
1310
1311 template <class _Up>
1312 requires(is_constructible_v<_Tp&, _Up> && !reference_constructs_from_temporary_v<_Tp&, _Up>)
1313 constexpr _Tp& emplace(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp&, _Up>) {
1314 this->__construct(std::forward<_Up>(__u));
1315
13941316 return this->__get();
13951317 }
13961318
1397 template <class _Up = remove_cvref_t<_Tp>>
1398 requires(is_lvalue_reference_v<_Tp> && is_object_v<__libcpp_remove_reference_t<_Tp>> &&
1399 !is_array_v<__libcpp_remove_reference_t<_Tp>>)
1400 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decay_t<_Tp> value_or(_Up&& __v) const {
1401 static_assert(
1402 is_constructible_v<remove_cvref_t<_Tp>, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible");
1403 static_assert(
1404 is_convertible_v<_Up, remove_cvref_t<_Tp>>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>");
1405 return this->has_value() ? this->__get() : static_cast<remove_cvref_t<_Tp>>(std::forward<_Up>(__v));
1319 constexpr void swap(optional& __rhs) noexcept { this->__swap(__rhs); }
1320
1321 using __base::operator->;
1322 using __base::operator*;
1323
1324 constexpr explicit operator bool() const noexcept { return has_value(); }
1325
1326 using __base::has_value;
1327 using __base::value;
1328
1329 template <class _Up = remove_cv_t<_Tp>>
1330 requires(!is_array_v<_Tp> && is_object_v<_Tp>)
1331 [[nodiscard]] constexpr decay_t<_Tp> value_or(_Up&& __v) const {
1332 using _XTp = remove_cv_t<_Tp>;
1333 static_assert(is_constructible_v<_XTp, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible");
1334 static_assert(is_convertible_v<_Up, _XTp>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>");
1335 return this->has_value() ? this->__get() : static_cast<_XTp>(std::forward<_Up>(__v));
14061336 }
14071337
14081338 template <class _Func>
1409 requires(is_lvalue_reference_v<_Tp>)
1410 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const {
1339 [[nodiscard]] constexpr auto and_then(_Func&& __f) const {
14111340 using _Up = invoke_result_t<_Func, _Tp&>;
14121341 static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
14131342 "Result of f(value()) must be a specialization of std::optional");
......@@ -1417,30 +1346,31 @@ public:
14171346 }
14181347
14191348 template <class _Func>
1420 requires(is_lvalue_reference_v<_Tp>)
1421 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>>
1422 transform(_Func&& __f) const {
1423 using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
1349 [[nodiscard]] constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>> transform(_Func&& __f) const {
1350 using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
14241351 static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
14251352 static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
14261353 static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
1427 static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
1354 static_assert(
1355 __is_valid_optional_contained_type<_Up>, "Result of f(value()) should be a valid contained type for optional");
1356
14281357 if (*this)
14291358 return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
14301359 return optional<_Up>();
14311360 }
14321361
14331362 template <invocable _Func>
1434 requires(is_lvalue_reference_v<_Tp>)
1435 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const {
1363 [[nodiscard]] constexpr optional or_else(_Func&& __f) const {
14361364 static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
14371365 "Result of f() should be the same type as this optional");
14381366 if (*this)
14391367 return *this;
14401368 return std::forward<_Func>(__f)();
14411369 }
1442# endif
1370
1371 using __base::reset;
14431372};
1373# endif
14441374
14451375template <class _Tp>
14461376optional(_Tp) -> optional<_Tp>;
......@@ -1749,7 +1679,13 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) {
17491679
17501680# endif // _LIBCPP_STD_VER >= 20
17511681
1752template <class _Tp, enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, int> = 0>
1682template <class _Tp,
1683 enable_if_t<(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)
1684# if _LIBCPP_STD_VER >= 26
1685 || is_reference_v<_Tp>
1686# endif
1687 ,
1688 int> = 0>
17531689inline _LIBCPP_HIDE_FROM_ABI
17541690_LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
17551691 __x.swap(__y);
......@@ -1759,6 +1695,28 @@ struct __make_optional_barrier_tag {
17591695 explicit __make_optional_barrier_tag() = default;
17601696};
17611697
1698template <class _Tp, class... _Args>
1699inline constexpr bool __is_constructible_for_optional_v = is_constructible_v<_Tp, _Args...>;
1700
1701template <class _Tp, class... _Args>
1702struct __is_constructible_for_optional : bool_constant<__is_constructible_for_optional_v<_Tp, _Args...>> {};
1703
1704template <class _Tp, class _Up, class... _Args>
1705inline constexpr bool __is_constructible_for_optional_initializer_list_v =
1706 is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>;
1707
1708# if _LIBCPP_STD_VER >= 26
1709template <class _Tp, class... _Args>
1710inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false;
1711
1712template <class _Tp, class _Arg>
1713inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> =
1714 is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>;
1715
1716template <class _Tp, class _Up, class... _Args>
1717inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false;
1718# endif
1719
17621720template <
17631721# if _LIBCPP_STD_VER >= 26
17641722 __make_optional_barrier_tag = __make_optional_barrier_tag{},
......@@ -1801,7 +1759,7 @@ _LIBCPP_END_NAMESPACE_STD
18011759
18021760_LIBCPP_POP_MACROS
18031761
1804# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1762# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
18051763# include <atomic>
18061764# include <climits>
18071765# include <concepts>
lib/libcxx/include/ostream+2-2
......@@ -193,7 +193,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
193193
194194# endif // _LIBCPP_HAS_LOCALIZATION
195195
196# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
196# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
197197# include <atomic>
198198# include <concepts>
199199# include <cstdio>
......@@ -206,7 +206,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
206206# include <type_traits>
207207# endif
208208
209# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23
209# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
210210# include <locale>
211211# endif
212212
lib/libcxx/include/print+56-80
......@@ -52,12 +52,15 @@ namespace std {
5252# pragma GCC system_header
5353# endif
5454
55# if _LIBCPP_STD_VER >= 23
56
5557_LIBCPP_BEGIN_NAMESPACE_STD
5658
57# ifdef _LIBCPP_WIN32API
59# ifdef _LIBCPP_WIN32API
60_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
5861_LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
5962
60# if _LIBCPP_HAS_WIDE_CHARACTERS
63# if _LIBCPP_HAS_WIDE_CHARACTERS
6164// A wrapper for WriteConsoleW which is used to write to the Windows
6265// console. This function is in the dylib to avoid pulling in windows.h
6366// in the library headers. The function itself uses some private parts
......@@ -68,12 +71,9 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream);
6871//
6972// Note the function is only implemented on the Windows platform.
7073_LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console(FILE* __stream, wstring_view __view);
71# endif // _LIBCPP_HAS_WIDE_CHARACTERS
72# elif __has_include(<unistd.h>)
73_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream);
74# endif // _LIBCPP_WIN32API
75
76# if _LIBCPP_STD_VER >= 23
74# endif // _LIBCPP_HAS_WIDE_CHARACTERS
75_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
76# endif // _LIBCPP_WIN32API
7777
7878# if _LIBCPP_HAS_UNICODE
7979// This is the code to transcode UTF-8 to UTF-16. This is used on
......@@ -197,36 +197,30 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE
197197inline constexpr bool __use_unicode_execution_charset = true;
198198# endif
199199
200# ifdef _LIBCPP_WIN32API
200201_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) {
201202 // The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
202203 // the behavior in the test. This is not part of the public API.
203# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
204# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
204205 return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
205# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || !_LIBCPP_HAS_TERMINAL
206 return false;
207# elif defined(_LIBCPP_WIN32API)
206# else
208207 return std::__is_windows_terminal(__stream);
209# elif __has_include(<unistd.h>)
210 return std::__is_posix_terminal(__stream);
211# else
212# error "Provide a way to determine whether a FILE* is a terminal"
213# endif
208# endif
209}
210# endif // _LIBCPP_WIN32API
211
212[[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void __handle_output_error(FILE* __stream) {
213 if (std::feof(__stream))
214 std::__throw_system_error(EIO, "EOF while writing the formatted output");
215 std::__throw_system_error(std::ferror(__stream), "failed to write formatted output");
214216}
215217
216218template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
217_LIBCPP_HIDE_FROM_ABI inline void
218__vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl) {
219_LIBCPP_HIDE_FROM_ABI inline void __output_nonunicode(FILE* __stream, string_view __text) {
219220 _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream");
220 string __str = std::vformat(__fmt, __args);
221 if (__write_nl)
222 __str.push_back('\n');
223
224 size_t __size = fwrite(__str.data(), 1, __str.size(), __stream);
225 if (__size < __str.size()) {
226 if (std::feof(__stream))
227 std::__throw_system_error(EIO, "EOF while writing the formatted output");
228 std::__throw_system_error(std::ferror(__stream), "failed to write formatted output");
229 }
221 size_t __size = std::fwrite(__text.data(), 1, __text.size(), __stream);
222 if (__size < __text.size())
223 __print::__handle_output_error(__stream);
230224}
231225
232226# if _LIBCPP_HAS_UNICODE
......@@ -236,27 +230,10 @@ __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool
236230// terminal when the output is redirected. Typically during testing the
237231// output is redirected to be able to capture it. This makes it hard to
238232// test this code path.
239template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
240_LIBCPP_HIDE_FROM_ABI inline void
241__vprint_unicode_posix(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
242 // TODO PRINT Should flush errors throw too?
243 if (__is_terminal)
244 std::fflush(__stream);
245
246 __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
247}
248233
249234# if _LIBCPP_HAS_WIDE_CHARACTERS
250235template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
251_LIBCPP_HIDE_FROM_ABI inline void
252__vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
253 if (!__is_terminal)
254 return __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
255
256 // TODO PRINT Should flush errors throw too?
257 std::fflush(__stream);
258
259 string __str = std::vformat(__fmt, __args);
236_LIBCPP_HIDE_FROM_ABI inline void __output_unicode_windows([[maybe_unused]] FILE* __stream, string_view __text) {
260237 // UTF-16 uses the same number or less code units than UTF-8.
261238 // However the size of the code unit is 16 bits instead of 8 bits.
262239 //
......@@ -266,11 +243,8 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args,
266243 // the final size might be larger when the estimate is wrong.
267244 //
268245 // TODO PRINT profile and improve the speed of this code.
269 __format::__retarget_buffer<wchar_t> __buffer{__str.size()};
270 __unicode::__transcode(__str.begin(), __str.end(), __buffer.__make_output_iterator());
271 if (__write_nl)
272 __buffer.push_back(L'\n');
273
246 __format::__retarget_buffer<wchar_t> __buffer{__text.size()};
247 __unicode::__transcode(__text.begin(), __text.end(), __buffer.__make_output_iterator());
274248 [[maybe_unused]] wstring_view __view = __buffer.__view();
275249
276250 // The macro _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION is used to change
......@@ -287,11 +261,7 @@ __vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args,
287261# endif // _LIBCPP_HAS_WIDE_CHARACTERS
288262
289263template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
290_LIBCPP_HIDE_FROM_ABI inline void
291__vprint_unicode([[maybe_unused]] FILE* __stream,
292 [[maybe_unused]] string_view __fmt,
293 [[maybe_unused]] format_args __args,
294 [[maybe_unused]] bool __write_nl) {
264_LIBCPP_HIDE_FROM_ABI inline void __output_unicode([[maybe_unused]] FILE* __stream, string_view __text) {
295265 _LIBCPP_ASSERT_NON_NULL(__stream, "__stream must be a valid pointer to an output C stream");
296266
297267 // [print.fun]
......@@ -302,9 +272,6 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
302272 // Otherwise writes out to stream unchanged. If the native
303273 // Unicode API is used, the function flushes stream before
304274 // writing out.
305 // 8 - Throws: Any exception thrown by the call to vformat
306 // ([format.err.report]). system_error if writing to the terminal
307 // or stream fails. May throw bad_alloc.
308275 // 9 - Recommended practice: If invoking the native Unicode API
309276 // requires transcoding, implementations should substitute
310277 // invalid code units with U+FFFD replacement character per the
......@@ -316,9 +283,15 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
316283 // Windows there is a different API. This API requires transcoding.
317284
318285# ifndef _LIBCPP_WIN32API
319 __print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
286 __print::__output_nonunicode(__stream, __text);
320287# elif _LIBCPP_HAS_WIDE_CHARACTERS
321 __print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
288 if (__print::__is_terminal(__stream)) {
289 // TODO PRINT Should flush errors throw too?
290 std::fflush(__stream);
291 __print::__output_unicode_windows(__stream, __text);
292 } else {
293 __print::__output_nonunicode(__stream, __text);
294 }
322295# else
323296# error "Windows builds with wchar_t disabled are not supported."
324297# endif
......@@ -329,51 +302,54 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
329302} // namespace __print
330303
331304template <class... _Args>
332_LIBCPP_HIDE_FROM_ABI void
305_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void
333306print(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) {
307 auto __result = std::vformat(__fmt.get(), std::make_format_args(__args...));
334308# if _LIBCPP_HAS_UNICODE
335309 if constexpr (__print::__use_unicode_execution_charset)
336 __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
310 __print::__output_unicode(__stream, __result);
337311 else
338 __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
312 __print::__output_nonunicode(__stream, __result);
339313# else // _LIBCPP_HAS_UNICODE
340 __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
314 __print::__output_nonunicode(__stream, __result);
341315# endif // _LIBCPP_HAS_UNICODE
342316}
343317
344318template <class... _Args>
345_LIBCPP_HIDE_FROM_ABI void print(format_string<_Args...> __fmt, _Args&&... __args) {
319_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void print(format_string<_Args...> __fmt, _Args&&... __args) {
346320 std::print(stdout, __fmt, std::forward<_Args>(__args)...);
347321}
348322
349323template <class... _Args>
350_LIBCPP_HIDE_FROM_ABI void
324_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void
351325println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, format_string<_Args...> __fmt, _Args&&... __args) {
326 auto __result = std::vformat(__fmt.get(), std::make_format_args(__args...));
327 __result.push_back('\n');
352328# if _LIBCPP_HAS_UNICODE
353329 // Note the wording in the Standard is inefficient. The output of
354330 // std::format is a std::string which is then copied. This solution
355331 // just appends a newline at the end of the output.
356332 if constexpr (__print::__use_unicode_execution_charset)
357 __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
333 __print::__output_unicode(__stream, __result);
358334 else
359 __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
335 __print::__output_nonunicode(__stream, __result);
360336# else // _LIBCPP_HAS_UNICODE
361 __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
337 __print::__output_nonunicode(__stream, __result);
362338# endif // _LIBCPP_HAS_UNICODE
363339}
364340
365template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
366_LIBCPP_HIDE_FROM_ABI inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) {
367 std::print(__stream, "\n");
341template <class _Void = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
342_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void println(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream) {
343 std::print(__stream, (_Void(), "\n"));
368344}
369345
370346template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
371_LIBCPP_HIDE_FROM_ABI inline void println() {
347_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE inline void println() {
372348 println(stdout);
373349}
374350
375351template <class... _Args>
376_LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __args) {
352_LIBCPP_HIDE_FROM_ABI _LIBCPP_ALWAYS_INLINE void println(format_string<_Args...> __fmt, _Args&&... __args) {
377353 std::println(stdout, __fmt, std::forward<_Args>(__args)...);
378354}
379355
......@@ -381,7 +357,7 @@ _LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __a
381357template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
382358_LIBCPP_HIDE_FROM_ABI inline void
383359vprint_unicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) {
384 __print::__vprint_unicode(__stream, __fmt, __args, false);
360 __print::__output_unicode(__stream, std::vformat(__fmt, __args));
385361}
386362
387363template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
......@@ -394,7 +370,7 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_unicode(string_view __fmt, format_args
394370template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
395371_LIBCPP_HIDE_FROM_ABI inline void
396372vprint_nonunicode(FILE* _LIBCPP_DIAGNOSE_NULLPTR __stream, string_view __fmt, format_args __args) {
397 __print::__vprint_nonunicode(__stream, __fmt, __args, false);
373 __print::__output_nonunicode(__stream, std::vformat(__fmt, __args));
398374}
399375
400376template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
......@@ -402,10 +378,10 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(string_view __fmt, format_ar
402378 std::vprint_nonunicode(stdout, __fmt, __args);
403379}
404380
405# endif // _LIBCPP_STD_VER >= 23
406
407381_LIBCPP_END_NAMESPACE_STD
408382
383# endif // _LIBCPP_STD_VER >= 23
384
409385#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
410386
411387#endif // _LIBCPP_PRINT
lib/libcxx/include/queue+1-1
......@@ -970,7 +970,7 @@ _LIBCPP_END_NAMESPACE_STD
970970
971971_LIBCPP_POP_MACROS
972972
973# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
973# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
974974# include <concepts>
975975# include <cstdlib>
976976# include <functional>
lib/libcxx/include/random+1-1
......@@ -1726,7 +1726,7 @@ class piecewise_linear_distribution
17261726# pragma GCC system_header
17271727# endif
17281728
1729# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1729# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
17301730# include <algorithm>
17311731# include <climits>
17321732# include <cmath>
lib/libcxx/include/ranges+39-1
......@@ -201,6 +201,16 @@ namespace std::ranges {
201201 inline constexpr unspecified filter = unspecified;
202202 }
203203
204 // [range.concat], concat view
205 template <input_range... Views>
206 requires (view<Views> && ...) && (sizeof...(Views) > 0) &&
207 concatable<Views...>
208 class concat_view;
209
210 namespace views {
211 inline constexpr unspecified concat = unspecified;
212 }
213
204214 // [range.drop], drop view
205215 template<view V>
206216 class drop_view;
......@@ -337,6 +347,17 @@ namespace std::ranges {
337347
338348 namespace views { template<class T> inline constexpr unspecified istream = unspecified; }
339349
350 // [range.enumerate], enumerate view
351 template<view View>
352 requires see below
353 class enumerate_view; // since C++23
354
355 template<class View>
356 constexpr bool enable_borrowed_range<enumerate_view<View>> = // since C++23
357 enable_borrowed_range<View>;
358
359 namespace views { inline constexpr unspecified enumerate = unspecified; } // since C++23
360
340361 // [range.zip], zip view
341362 template<input_range... Views>
342363 requires (view<Views> && ...) && (sizeof...(Views) > 0)
......@@ -396,6 +417,17 @@ namespace std::ranges {
396417 class chunk_by_view; // C++23
397418
398419 namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23
420
421 // [range.stride.view], stride view
422 template<input_range V>
423 requires view<V>
424 class stride_view; // C++23
425
426 template<class V>
427 constexpr bool enable_borrowed_range<stride_view<V>> =
428 enable_borrowed_range<V>; // C++23
429
430 namespace views { inline constexpr unspecified stride = unspecified; } // C++23
399431}
400432
401433namespace std {
......@@ -482,14 +514,20 @@ namespace std {
482514# include <__ranges/adjacent_view.h>
483515# include <__ranges/as_rvalue_view.h>
484516# include <__ranges/chunk_by_view.h>
517# include <__ranges/enumerate_view.h>
485518# include <__ranges/from_range.h>
486519# include <__ranges/join_with_view.h>
487520# include <__ranges/repeat_view.h>
521# include <__ranges/stride_view.h>
488522# include <__ranges/to.h>
489523# include <__ranges/zip_transform_view.h>
490524# include <__ranges/zip_view.h>
491525# endif
492526
527# if _LIBCPP_STD_VER >= 26
528# include <__ranges/concat_view.h>
529# endif
530
493531# include <version>
494532
495533// standard-mandated includes
......@@ -507,7 +545,7 @@ namespace std {
507545# pragma GCC system_header
508546# endif
509547
510# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
548# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
511549# include <cstdlib>
512550# include <iosfwd>
513551# include <type_traits>
lib/libcxx/include/ratio+1-1
......@@ -491,7 +491,7 @@ _LIBCPP_END_NAMESPACE_STD
491491
492492_LIBCPP_POP_MACROS
493493
494# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
494# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
495495# include <type_traits>
496496# endif
497497#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/regex+5-2
......@@ -817,6 +817,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
817817# include <__iterator/wrap_iter.h>
818818# include <__locale>
819819# include <__memory/addressof.h>
820# include <__memory/pointer_traits.h>
820821# include <__memory/shared_ptr.h>
821822# include <__memory_resource/polymorphic_allocator.h>
822823# include <__type_traits/is_swappable.h>
......@@ -840,6 +841,7 @@ _LIBCPP_PUSH_MACROS
840841# define _LIBCPP_REGEX_COMPLEXITY_FACTOR 4096
841842
842843_LIBCPP_BEGIN_NAMESPACE_STD
844_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
843845
844846namespace regex_constants {
845847
......@@ -5167,7 +5169,7 @@ regex_search(__wrap_iter<_Iter> __first,
51675169 const basic_regex<_CharT, _Traits>& __e,
51685170 regex_constants::match_flag_type __flags = regex_constants::match_default) {
51695171 match_results<const _CharT*> __mc;
5170 bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
5172 bool __r = __e.__search(std::__to_address(__first), std::__to_address(__last), __mc, __flags);
51715173 __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
51725174 return __r;
51735175}
......@@ -5807,6 +5809,7 @@ regex_replace(const _CharT* __s,
58075809 return __r;
58085810}
58095811
5812_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
58105813_LIBCPP_END_NAMESPACE_STD
58115814
58125815# if _LIBCPP_STD_VER >= 17
......@@ -5831,7 +5834,7 @@ _LIBCPP_POP_MACROS
58315834
58325835# endif // _LIBCPP_HAS_LOCALIZATION
58335836
5834# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
5837# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
58355838# include <atomic>
58365839# include <concepts>
58375840# include <cstdlib>
lib/libcxx/include/scoped_allocator+5-5
......@@ -135,10 +135,10 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
135135_LIBCPP_PUSH_MACROS
136136# include <__undef_macros>
137137
138_LIBCPP_BEGIN_NAMESPACE_STD
139
140138# if !defined(_LIBCPP_CXX03_LANG)
141139
140_LIBCPP_BEGIN_NAMESPACE_STD
141
142142// scoped_allocator_adaptor
143143
144144template <class... _Allocs>
......@@ -558,13 +558,13 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const scoped_allocator_adaptor<_Out
558558
559559# endif // _LIBCPP_STD_VER <= 17
560560
561# endif // !defined(_LIBCPP_CXX03_LANG)
562
563561_LIBCPP_END_NAMESPACE_STD
564562
563# endif // !defined(_LIBCPP_CXX03_LANG)
564
565565_LIBCPP_POP_MACROS
566566
567# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
567# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
568568# include <atomic>
569569# include <climits>
570570# include <concepts>
lib/libcxx/include/semaphore+1-1
......@@ -180,7 +180,7 @@ _LIBCPP_POP_MACROS
180180
181181# endif // _LIBCPP_HAS_THREADS
182182
183# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
183# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
184184# include <atomic>
185185# include <cstddef>
186186# endif
lib/libcxx/include/set+373-214
......@@ -71,12 +71,12 @@ public:
7171 const allocator_type& a);
7272 template <class InputIterator>
7373 set(InputIterator first, InputIterator last, const allocator_type& a)
74 : set(first, last, Compare(), a) {} // C++14
74 : set(first, last, Compare(), a) {}
7575 template<container-compatible-range<value_type> R>
7676 set(from_range_t, R&& rg, const Allocator& a))
7777 : set(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
7878 set(initializer_list<value_type> il, const allocator_type& a)
79 : set(il, Compare(), a) {} // C++14
79 : set(il, Compare(), a) {}
8080 ~set();
8181
8282 set& operator=(const set& s);
......@@ -316,12 +316,12 @@ public:
316316 const allocator_type& a);
317317 template <class InputIterator>
318318 multiset(InputIterator first, InputIterator last, const allocator_type& a)
319 : set(first, last, Compare(), a) {} // C++14
319 : set(first, last, Compare(), a) {}
320320 template<container-compatible-range<value_type> R>
321321 multiset(from_range_t, R&& rg, const Allocator& a))
322322 : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
323323 multiset(initializer_list<value_type> il, const allocator_type& a)
324 : set(il, Compare(), a) {} // C++14
324 : set(il, Compare(), a) {}
325325 ~multiset();
326326
327327 multiset& operator=(const multiset& s);
......@@ -615,24 +615,27 @@ public:
615615 template <class _Key2, class _Compare2, class _Alloc2>
616616 friend class multiset;
617617
618 _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_(
618 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set() _NOEXCEPT_(
619619 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
620620 is_nothrow_copy_constructible<key_compare>::value)
621621 : __tree_(value_compare()) {}
622622
623 _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_(
623 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp) _NOEXCEPT_(
624624 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
625625 : __tree_(__comp) {}
626626
627 _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {}
627 _LIBCPP_HIDE_FROM_ABI
628 _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp, const allocator_type& __a)
629 : __tree_(__comp, __a) {}
628630 template <class _InputIterator>
629 _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
631 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
632 set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
630633 : __tree_(__comp) {
631634 insert(__f, __l);
632635 }
633636
634637 template <class _InputIterator>
635 _LIBCPP_HIDE_FROM_ABI
638 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
636639 set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
637640 : __tree_(__comp, __a) {
638641 insert(__f, __l);
......@@ -640,7 +643,7 @@ public:
640643
641644# if _LIBCPP_STD_VER >= 23
642645 template <_ContainerCompatibleRange<value_type> _Range>
643 _LIBCPP_HIDE_FROM_ABI
646 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
644647 set(from_range_t,
645648 _Range&& __range,
646649 const key_compare& __comp = key_compare(),
......@@ -650,263 +653,340 @@ public:
650653 }
651654# endif
652655
653# if _LIBCPP_STD_VER >= 14
654656 template <class _InputIterator>
655 _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
657 _LIBCPP_HIDE_FROM_ABI
658 _LIBCPP_CONSTEXPR_SINCE_CXX26 set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
656659 : set(__f, __l, key_compare(), __a) {}
657# endif
658660
659661# if _LIBCPP_STD_VER >= 23
660662 template <_ContainerCompatibleRange<value_type> _Range>
661 _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a)
663 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(from_range_t, _Range&& __range, const allocator_type& __a)
662664 : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
663665# endif
664666
665 _LIBCPP_HIDE_FROM_ABI set(const set& __s) = default;
667 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s) = default;
666668
667 _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default;
669 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(const set& __s) = default;
668670
669671# ifndef _LIBCPP_CXX03_LANG
670 _LIBCPP_HIDE_FROM_ABI set(set&& __s) = default;
672 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s) = default;
671673# endif // _LIBCPP_CXX03_LANG
672674
673 _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
675 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const allocator_type& __a) : __tree_(__a) {}
674676
675 _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __alloc) : __tree_(__s.__tree_, __alloc) {}
677 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s, const allocator_type& __alloc)
678 : __tree_(__s.__tree_, __alloc) {}
676679
677680# ifndef _LIBCPP_CXX03_LANG
678 _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __alloc) : __tree_(std::move(__s.__tree_), __alloc) {}
681 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s, const allocator_type& __alloc)
682 : __tree_(std::move(__s.__tree_), __alloc) {}
679683
680 _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
684 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
685 set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
681686 : __tree_(__comp) {
682687 insert(__il.begin(), __il.end());
683688 }
684689
685 _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
690 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
691 set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
686692 : __tree_(__comp, __a) {
687693 insert(__il.begin(), __il.end());
688694 }
689695
690# if _LIBCPP_STD_VER >= 14
691 _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a)
696 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(initializer_list<value_type> __il, const allocator_type& __a)
692697 : set(__il, key_compare(), __a) {}
693# endif
694698
695 _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
699 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(initializer_list<value_type> __il) {
696700 clear();
697701 insert(__il.begin(), __il.end());
698702 return *this;
699703 }
700704
701 _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default;
705 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(set&& __s) = default;
702706# endif // _LIBCPP_CXX03_LANG
703707
704 _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
708 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~set() {
709 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
710 }
705711
706 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
707 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
708 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
709 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
712 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
713 return __tree_.begin();
714 }
715 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
716 return __tree_.begin();
717 }
718 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
719 return __tree_.end();
720 }
721 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
722 return __tree_.end();
723 }
710724
711 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
712 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
725 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
726 return reverse_iterator(end());
727 }
728 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
729 rbegin() const _NOEXCEPT {
713730 return const_reverse_iterator(end());
714731 }
715 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
716 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
732 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
733 return reverse_iterator(begin());
734 }
735 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
717736 return const_reverse_iterator(begin());
718737 }
719738
720 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
721 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
722 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
723 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
739 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
740 return begin();
741 }
742 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
743 return end();
744 }
745 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
746 crbegin() const _NOEXCEPT {
747 return rbegin();
748 }
749 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
750 return rend();
751 }
724752
725 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
726 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
727 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
753 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
754 return __tree_.size() == 0;
755 }
756 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
757 return __tree_.size();
758 }
759 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
760 return __tree_.max_size();
761 }
728762
729763 // modifiers:
730764# ifndef _LIBCPP_CXX03_LANG
731765 template <class... _Args>
732 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
766 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) {
733767 return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
734768 }
735769 template <class... _Args>
736 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
770 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
737771 return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first;
738772 }
739773# endif // _LIBCPP_CXX03_LANG
740774
741 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
742 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
775 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
776 return __tree_.__emplace_unique(__v);
777 }
778 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
743779 return __tree_.__emplace_hint_unique(__p, __v).first;
744780 }
745781
746782 template <class _InputIterator>
747 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
783 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
748784 __tree_.__insert_range_unique(__first, __last);
749785 }
750786
751787# if _LIBCPP_STD_VER >= 23
752788 template <_ContainerCompatibleRange<value_type> _Range>
753 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
789 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
754790 __tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
755791 }
756792# endif
757793
758794# ifndef _LIBCPP_CXX03_LANG
759 _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
795 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) {
760796 return __tree_.__emplace_unique(std::move(__v));
761797 }
762798
763 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
799 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
764800 return __tree_.__emplace_hint_unique(__p, std::move(__v)).first;
765801 }
766802
767 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
803 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
804 insert(__il.begin(), __il.end());
805 }
768806# endif // _LIBCPP_CXX03_LANG
769807
770 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
771 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
772 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
773 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
808 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); }
809 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
810 return __tree_.__erase_unique(__k);
811 }
812 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
813 return __tree_.erase(__f, __l);
814 }
815 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
774816
775817# if _LIBCPP_STD_VER >= 17
776 _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
818 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) {
777819 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
778820 "node_type with incompatible allocator passed to set::insert()");
779821 return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
780822 }
781 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
823 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
782824 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
783825 "node_type with incompatible allocator passed to set::insert()");
784826 return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
785827 }
786 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
828 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
787829 return __tree_.template __node_handle_extract<node_type>(__key);
788830 }
789 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
831 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
790832 return __tree_.template __node_handle_extract<node_type>(__it);
791833 }
792834 template <class _Compare2>
793 _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
835 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) {
794836 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
795837 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
796838 __tree_.__node_handle_merge_unique(__source.__tree_);
797839 }
798840 template <class _Compare2>
799 _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
841 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) {
800842 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
801843 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
802844 __tree_.__node_handle_merge_unique(__source.__tree_);
803845 }
804846 template <class _Compare2>
805 _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
847 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
848 merge(multiset<key_type, _Compare2, allocator_type>& __source) {
806849 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
807850 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
808851 __tree_.__node_handle_merge_unique(__source.__tree_);
809852 }
810853 template <class _Compare2>
811 _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
854 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
855 merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
812856 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
813857 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
814858 __tree_.__node_handle_merge_unique(__source.__tree_);
815859 }
816860# endif
817861
818 _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); }
862 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
863 __tree_.swap(__s.__tree_);
864 }
819865
820 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
821 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
822 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
866 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
867 return __tree_.__alloc();
868 }
869 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
870 return __tree_.value_comp();
871 }
872 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
873 return __tree_.value_comp();
874 }
823875
824876 // set operations:
825 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
826 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
877 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
878 return __tree_.find(__k);
879 }
880 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
881 return __tree_.find(__k);
882 }
827883# if _LIBCPP_STD_VER >= 14
828 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
829 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
884 template <typename _K2,
885 class _Comp = _Compare,
886 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
887 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
830888 return __tree_.find(__k);
831889 }
832 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
833 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
890 template <typename _K2,
891 class _Comp = _Compare,
892 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
893 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
834894 return __tree_.find(__k);
835895 }
836896# endif
837897
838 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
898 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
839899 return __tree_.__count_unique(__k);
840900 }
841901# if _LIBCPP_STD_VER >= 14
842 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
843 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
902 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
903 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
844904 return __tree_.__count_multi(__k);
845905 }
846906# endif
847907
848908# if _LIBCPP_STD_VER >= 20
849 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
850 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
851 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
909 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
910 return find(__k) != end();
911 }
912 template <typename _K2,
913 class _Comp = _Compare,
914 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
915 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
852916 return find(__k) != end();
853917 }
854918# endif // _LIBCPP_STD_VER >= 20
855919
856 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
920 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
857921 return __tree_.__lower_bound_unique(__k);
858922 }
859923
860 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
924 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
925 lower_bound(const key_type& __k) const {
861926 return __tree_.__lower_bound_unique(__k);
862927 }
863928
864929 // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to
865930 // match multiple elements.
866931# if _LIBCPP_STD_VER >= 14
867 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
868 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
932 template <typename _K2,
933 class _Comp = _Compare,
934 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
935 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
869936 return __tree_.__lower_bound_multi(__k);
870937 }
871938
872 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
873 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
939 template <typename _K2,
940 class _Comp = _Compare,
941 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
942 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
943 lower_bound(const _K2& __k) const {
874944 return __tree_.__lower_bound_multi(__k);
875945 }
876946# endif
877947
878 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
948 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
879949 return __tree_.__upper_bound_unique(__k);
880950 }
881951
882 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
952 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
953 upper_bound(const key_type& __k) const {
883954 return __tree_.__upper_bound_unique(__k);
884955 }
885956
886957# if _LIBCPP_STD_VER >= 14
887 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
888 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
958 template <typename _K2,
959 class _Comp = _Compare,
960 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
961 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
889962 return __tree_.__upper_bound_multi(__k);
890963 }
891 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
892 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
964 template <typename _K2,
965 class _Comp = _Compare,
966 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
967 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
968 upper_bound(const _K2& __k) const {
893969 return __tree_.__upper_bound_multi(__k);
894970 }
895971# endif
896972
897 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
973 [[__nodiscard__]]
974 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
898975 return __tree_.__equal_range_unique(__k);
899976 }
900 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
977 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
978 equal_range(const key_type& __k) const {
901979 return __tree_.__equal_range_unique(__k);
902980 }
903981# if _LIBCPP_STD_VER >= 14
904 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
905 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
982 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
983 [[__nodiscard__]]
984 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
906985 return __tree_.__equal_range_multi(__k);
907986 }
908 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
909 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
987 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
988 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
989 equal_range(const _K2& __k) const {
910990 return __tree_.__equal_range_multi(__k);
911991 }
912992# endif
......@@ -969,7 +1049,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat
9691049
9701050 // set's begin() and end() are identical with and without const qualification
9711051 template <class... _Args>
972 _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
1052 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) {
9731053 return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
9741054 __set.__tree_, std::forward<_Args>(__args)...);
9751055 }
......@@ -977,7 +1057,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat
9771057# endif
9781058
9791059template <class _Key, class _Compare, class _Allocator>
980inline _LIBCPP_HIDE_FROM_ABI bool
1060inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
9811061operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
9821062 return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
9831063}
......@@ -985,31 +1065,31 @@ operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
9851065# if _LIBCPP_STD_VER <= 17
9861066
9871067template <class _Key, class _Compare, class _Allocator>
988inline _LIBCPP_HIDE_FROM_ABI bool
1068inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
9891069operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
9901070 return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
9911071}
9921072
9931073template <class _Key, class _Compare, class _Allocator>
994inline _LIBCPP_HIDE_FROM_ABI bool
1074inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
9951075operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
9961076 return !(__x == __y);
9971077}
9981078
9991079template <class _Key, class _Compare, class _Allocator>
1000inline _LIBCPP_HIDE_FROM_ABI bool
1080inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
10011081operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
10021082 return __y < __x;
10031083}
10041084
10051085template <class _Key, class _Compare, class _Allocator>
1006inline _LIBCPP_HIDE_FROM_ABI bool
1086inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
10071087operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
10081088 return !(__x < __y);
10091089}
10101090
10111091template <class _Key, class _Compare, class _Allocator>
1012inline _LIBCPP_HIDE_FROM_ABI bool
1092inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
10131093operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
10141094 return !(__y < __x);
10151095}
......@@ -1017,7 +1097,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
10171097# else // _LIBCPP_STD_VER <= 17
10181098
10191099template <class _Key, class _Compare, class _Allocator>
1020_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
1100_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key>
10211101operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
10221102 return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
10231103}
......@@ -1026,14 +1106,14 @@ operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare
10261106
10271107// specialized algorithms:
10281108template <class _Key, class _Compare, class _Allocator>
1029inline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y)
1030 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
1109inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1110swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
10311111 __x.swap(__y);
10321112}
10331113
10341114# if _LIBCPP_STD_VER >= 20
10351115template <class _Key, class _Compare, class _Allocator, class _Predicate>
1036inline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type
1116inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename set<_Key, _Compare, _Allocator>::size_type
10371117erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
10381118 return std::__libcpp_erase_if_container(__c, __pred);
10391119}
......@@ -1092,31 +1172,32 @@ public:
10921172 friend class multiset;
10931173
10941174 // construct/copy/destroy:
1095 _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_(
1175 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset() _NOEXCEPT_(
10961176 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
10971177 is_nothrow_copy_constructible<key_compare>::value)
10981178 : __tree_(value_compare()) {}
10991179
1100 _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_(
1180 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp) _NOEXCEPT_(
11011181 is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
11021182 : __tree_(__comp) {}
11031183
1104 _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a)
1184 _LIBCPP_HIDE_FROM_ABI
1185 _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp, const allocator_type& __a)
11051186 : __tree_(__comp, __a) {}
11061187 template <class _InputIterator>
1107 _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
1188 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1189 multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
11081190 : __tree_(__comp) {
11091191 insert(__f, __l);
11101192 }
11111193
1112# if _LIBCPP_STD_VER >= 14
11131194 template <class _InputIterator>
1114 _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1195 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1196 multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
11151197 : multiset(__f, __l, key_compare(), __a) {}
1116# endif
11171198
11181199 template <class _InputIterator>
1119 _LIBCPP_HIDE_FROM_ABI
1200 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
11201201 multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
11211202 : __tree_(__comp, __a) {
11221203 insert(__f, __l);
......@@ -1124,7 +1205,7 @@ public:
11241205
11251206# if _LIBCPP_STD_VER >= 23
11261207 template <_ContainerCompatibleRange<value_type> _Range>
1127 _LIBCPP_HIDE_FROM_ABI
1208 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
11281209 multiset(from_range_t,
11291210 _Range&& __range,
11301211 const key_compare& __comp = key_compare(),
......@@ -1134,254 +1215,332 @@ public:
11341215 }
11351216
11361217 template <_ContainerCompatibleRange<value_type> _Range>
1137 _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a)
1218 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1219 multiset(from_range_t, _Range&& __range, const allocator_type& __a)
11381220 : multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
11391221# endif
11401222
1141 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s) = default;
1223 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s) = default;
11421224
1143 _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) = default;
1225 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(const multiset& __s) = default;
11441226
11451227# ifndef _LIBCPP_CXX03_LANG
1146 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) = default;
1228 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s) = default;
11471229
1148 _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {}
1230 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s, const allocator_type& __a)
1231 : __tree_(std::move(__s.__tree_), __a) {}
11491232# endif // _LIBCPP_CXX03_LANG
1150 _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {}
1151 _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a) : __tree_(__s.__tree_, __a) {}
1233 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const allocator_type& __a) : __tree_(__a) {}
1234 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s, const allocator_type& __a)
1235 : __tree_(__s.__tree_, __a) {}
11521236
11531237# ifndef _LIBCPP_CXX03_LANG
1154 _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
1238 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1239 multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
11551240 : __tree_(__comp) {
11561241 insert(__il.begin(), __il.end());
11571242 }
11581243
1159 _LIBCPP_HIDE_FROM_ABI
1244 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
11601245 multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
11611246 : __tree_(__comp, __a) {
11621247 insert(__il.begin(), __il.end());
11631248 }
11641249
1165# if _LIBCPP_STD_VER >= 14
1166 _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a)
1250 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
1251 multiset(initializer_list<value_type> __il, const allocator_type& __a)
11671252 : multiset(__il, key_compare(), __a) {}
1168# endif
11691253
1170 _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) {
1254 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(initializer_list<value_type> __il) {
11711255 clear();
11721256 insert(__il.begin(), __il.end());
11731257 return *this;
11741258 }
11751259
1176 _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) = default;
1260 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(multiset&& __s) = default;
11771261# endif // _LIBCPP_CXX03_LANG
11781262
1179 _LIBCPP_HIDE_FROM_ABI ~multiset() {
1263 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multiset() {
11801264 static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
11811265 }
11821266
1183 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
1184 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
1185 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
1186 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
1267 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
1268 return __tree_.begin();
1269 }
1270 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
1271 return __tree_.begin();
1272 }
1273 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
1274 return __tree_.end();
1275 }
1276 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
1277 return __tree_.end();
1278 }
11871279
1188 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
1189 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
1280 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
1281 return reverse_iterator(end());
1282 }
1283 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1284 rbegin() const _NOEXCEPT {
11901285 return const_reverse_iterator(end());
11911286 }
1192 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
1193 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
1287 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
1288 return reverse_iterator(begin());
1289 }
1290 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
11941291 return const_reverse_iterator(begin());
11951292 }
11961293
1197 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
1198 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
1199 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
1200 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
1294 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
1295 return begin();
1296 }
1297 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
1298 return end();
1299 }
1300 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
1301 crbegin() const _NOEXCEPT {
1302 return rbegin();
1303 }
1304 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
1305 return rend();
1306 }
12011307
1202 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
1203 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
1204 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
1308 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
1309 return __tree_.size() == 0;
1310 }
1311 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
1312 return __tree_.size();
1313 }
1314 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
1315 return __tree_.max_size();
1316 }
12051317
12061318 // modifiers:
12071319# ifndef _LIBCPP_CXX03_LANG
12081320 template <class... _Args>
1209 _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
1321 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
12101322 return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
12111323 }
12121324 template <class... _Args>
1213 _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
1325 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
12141326 return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
12151327 }
12161328# endif // _LIBCPP_CXX03_LANG
12171329
1218 _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
1219 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
1330 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) {
1331 return __tree_.__emplace_multi(__v);
1332 }
1333 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
12201334 return __tree_.__emplace_hint_multi(__p, __v);
12211335 }
12221336
12231337 template <class _InputIterator>
1224 _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
1338 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
12251339 __tree_.__insert_range_multi(__first, __last);
12261340 }
12271341
12281342# if _LIBCPP_STD_VER >= 23
12291343 template <_ContainerCompatibleRange<value_type> _Range>
1230 _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
1344 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
12311345 __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
12321346 }
12331347# endif
12341348
12351349# ifndef _LIBCPP_CXX03_LANG
1236 _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); }
1350 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) {
1351 return __tree_.__emplace_multi(std::move(__v));
1352 }
12371353
1238 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
1354 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
12391355 return __tree_.__emplace_hint_multi(__p, std::move(__v));
12401356 }
12411357
1242 _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
1358 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
1359 insert(__il.begin(), __il.end());
1360 }
12431361# endif // _LIBCPP_CXX03_LANG
12441362
1245 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
1246 _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
1247 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
1248 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
1363 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); }
1364 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
1365 return __tree_.__erase_multi(__k);
1366 }
1367 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
1368 return __tree_.erase(__f, __l);
1369 }
1370 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
12491371
12501372# if _LIBCPP_STD_VER >= 17
1251 _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
1373 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) {
12521374 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
12531375 "node_type with incompatible allocator passed to multiset::insert()");
12541376 return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
12551377 }
1256 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
1378 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
12571379 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
12581380 "node_type with incompatible allocator passed to multiset::insert()");
12591381 return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
12601382 }
1261 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
1383 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
12621384 return __tree_.template __node_handle_extract<node_type>(__key);
12631385 }
1264 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
1386 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
12651387 return __tree_.template __node_handle_extract<node_type>(__it);
12661388 }
12671389 template <class _Compare2>
1268 _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
1390 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1391 merge(multiset<key_type, _Compare2, allocator_type>& __source) {
12691392 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12701393 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12711394 __tree_.__node_handle_merge_multi(__source.__tree_);
12721395 }
12731396 template <class _Compare2>
1274 _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
1397 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1398 merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
12751399 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12761400 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12771401 __tree_.__node_handle_merge_multi(__source.__tree_);
12781402 }
12791403 template <class _Compare2>
1280 _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
1404 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) {
12811405 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12821406 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12831407 __tree_.__node_handle_merge_multi(__source.__tree_);
12841408 }
12851409 template <class _Compare2>
1286 _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
1410 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) {
12871411 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
12881412 __source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
12891413 __tree_.__node_handle_merge_multi(__source.__tree_);
12901414 }
12911415# endif
12921416
1293 _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
1417 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multiset& __s)
1418 _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
12941419 __tree_.swap(__s.__tree_);
12951420 }
12961421
1297 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
1298 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
1299 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
1422 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
1423 return __tree_.__alloc();
1424 }
1425 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
1426 return __tree_.value_comp();
1427 }
1428 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
1429 return __tree_.value_comp();
1430 }
13001431
13011432 // set operations:
1302 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
1303 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
1433 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
1434 return __tree_.find(__k);
1435 }
1436 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
1437 return __tree_.find(__k);
1438 }
13041439# if _LIBCPP_STD_VER >= 14
1305 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1306 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
1440 template <typename _K2,
1441 class _Comp = _Compare,
1442 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1443 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
13071444 return __tree_.find(__k);
13081445 }
1309 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1310 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
1446 template <typename _K2,
1447 class _Comp = _Compare,
1448 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1449 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
13111450 return __tree_.find(__k);
13121451 }
13131452# endif
13141453
1315 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
1454 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
13161455 return __tree_.__count_multi(__k);
13171456 }
13181457# if _LIBCPP_STD_VER >= 14
1319 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1320 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
1458 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1459 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
13211460 return __tree_.__count_multi(__k);
13221461 }
13231462# endif
13241463
13251464# if _LIBCPP_STD_VER >= 20
1326 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
1327 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1328 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
1465 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
1466 return find(__k) != end();
1467 }
1468 template <typename _K2,
1469 class _Comp = _Compare,
1470 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1471 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
13291472 return find(__k) != end();
13301473 }
13311474# endif // _LIBCPP_STD_VER >= 20
13321475
1333 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
1476 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
13341477 return __tree_.__lower_bound_multi(__k);
13351478 }
13361479
1337 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
1480 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1481 lower_bound(const key_type& __k) const {
13381482 return __tree_.__lower_bound_multi(__k);
13391483 }
13401484
13411485# if _LIBCPP_STD_VER >= 14
1342 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1343 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
1486 template <typename _K2,
1487 class _Comp = _Compare,
1488 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1489 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
13441490 return __tree_.__lower_bound_multi(__k);
13451491 }
13461492
1347 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1348 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
1493 template <typename _K2,
1494 class _Comp = _Compare,
1495 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1496 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1497 lower_bound(const _K2& __k) const {
13491498 return __tree_.__lower_bound_multi(__k);
13501499 }
13511500# endif
13521501
1353 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
1502 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
13541503 return __tree_.__upper_bound_multi(__k);
13551504 }
13561505
1357 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
1506 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1507 upper_bound(const key_type& __k) const {
13581508 return __tree_.__upper_bound_multi(__k);
13591509 }
13601510
13611511# if _LIBCPP_STD_VER >= 14
1362 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1363 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
1512 template <typename _K2,
1513 class _Comp = _Compare,
1514 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1515 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
13641516 return __tree_.__upper_bound_multi(__k);
13651517 }
1366 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1367 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
1518 template <typename _K2,
1519 class _Comp = _Compare,
1520 enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
1521 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
1522 upper_bound(const _K2& __k) const {
13681523 return __tree_.__upper_bound_multi(__k);
13691524 }
13701525# endif
13711526
1372 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
1527 [[__nodiscard__]]
1528 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
13731529 return __tree_.__equal_range_multi(__k);
13741530 }
1375 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
1531 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1532 equal_range(const key_type& __k) const {
13761533 return __tree_.__equal_range_multi(__k);
13771534 }
13781535# if _LIBCPP_STD_VER >= 14
1379 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
1536 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1537 [[__nodiscard__]]
1538 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
13811539 return __tree_.__equal_range_multi(__k);
13821540 }
1383 template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0>
1384 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
1541 template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
1542 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
1543 equal_range(const _K2& __k) const {
13851544 return __tree_.__equal_range_multi(__k);
13861545 }
13871546# endif
......@@ -1445,7 +1604,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al
14451604
14461605 // set's begin() and end() are identical with and without const qualification
14471606 template <class... _Args>
1448 _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
1607 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) {
14491608 return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
14501609 __set.__tree_, std::forward<_Args>(__args)...);
14511610 }
......@@ -1453,7 +1612,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al
14531612# endif
14541613
14551614template <class _Key, class _Compare, class _Allocator>
1456inline _LIBCPP_HIDE_FROM_ABI bool
1615inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14571616operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14581617 return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
14591618}
......@@ -1461,31 +1620,31 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key,
14611620# if _LIBCPP_STD_VER <= 17
14621621
14631622template <class _Key, class _Compare, class _Allocator>
1464inline _LIBCPP_HIDE_FROM_ABI bool
1623inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14651624operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14661625 return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
14671626}
14681627
14691628template <class _Key, class _Compare, class _Allocator>
1470inline _LIBCPP_HIDE_FROM_ABI bool
1629inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14711630operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14721631 return !(__x == __y);
14731632}
14741633
14751634template <class _Key, class _Compare, class _Allocator>
1476inline _LIBCPP_HIDE_FROM_ABI bool
1635inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14771636operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14781637 return __y < __x;
14791638}
14801639
14811640template <class _Key, class _Compare, class _Allocator>
1482inline _LIBCPP_HIDE_FROM_ABI bool
1641inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14831642operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14841643 return !(__x < __y);
14851644}
14861645
14871646template <class _Key, class _Compare, class _Allocator>
1488inline _LIBCPP_HIDE_FROM_ABI bool
1647inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
14891648operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14901649 return !(__y < __x);
14911650}
......@@ -1493,7 +1652,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key,
14931652# else // _LIBCPP_STD_VER <= 17
14941653
14951654template <class _Key, class _Compare, class _Allocator>
1496_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
1655_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key>
14971656operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
14981657 return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
14991658}
......@@ -1501,7 +1660,7 @@ operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key
15011660# endif // _LIBCPP_STD_VER <= 17
15021661
15031662template <class _Key, class _Compare, class _Allocator>
1504inline _LIBCPP_HIDE_FROM_ABI void
1663inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
15051664swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y)
15061665 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
15071666 __x.swap(__y);
......@@ -1509,7 +1668,7 @@ swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Alloca
15091668
15101669# if _LIBCPP_STD_VER >= 20
15111670template <class _Key, class _Compare, class _Allocator, class _Predicate>
1512inline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type
1671inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multiset<_Key, _Compare, _Allocator>::size_type
15131672erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
15141673 return std::__libcpp_erase_if_container(__c, __pred);
15151674}
......@@ -1541,7 +1700,7 @@ _LIBCPP_END_NAMESPACE_STD
15411700
15421701_LIBCPP_POP_MACROS
15431702
1544# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1703# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
15451704# include <concepts>
15461705# include <cstdlib>
15471706# include <functional>
lib/libcxx/include/shared_mutex+34-24
......@@ -153,6 +153,7 @@ _LIBCPP_PUSH_MACROS
153153# endif
154154
155155_LIBCPP_BEGIN_NAMESPACE_STD
156_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
156157
157158struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base {
158159 mutex __mut_;
......@@ -196,12 +197,14 @@ public:
196197
197198 // Exclusive ownership
198199 _LIBCPP_ACQUIRE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI void lock() { return __base_.lock(); }
199 _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock() { return __base_.try_lock(); }
200 _LIBCPP_RELEASE_CAPABILITY _LIBCPP_HIDE_FROM_ABI void unlock() { return __base_.unlock(); }
200 [[nodiscard]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock() {
201 return __base_.try_lock();
202 }
203 _LIBCPP_RELEASE_CAPABILITY() _LIBCPP_HIDE_FROM_ABI void unlock() { return __base_.unlock(); }
201204
202205 // Shared ownership
203206 _LIBCPP_ACQUIRE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void lock_shared() { return __base_.lock_shared(); }
204 _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock_shared() {
207 [[nodiscard]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool try_lock_shared() {
205208 return __base_.try_lock_shared();
206209 }
207210 _LIBCPP_RELEASE_SHARED_CAPABILITY _LIBCPP_HIDE_FROM_ABI void unlock_shared() { return __base_.unlock_shared(); }
......@@ -223,15 +226,15 @@ public:
223226
224227 // Exclusive ownership
225228 void lock() _LIBCPP_ACQUIRE_CAPABILITY();
226 _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock();
229 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) bool try_lock();
227230 template <class _Rep, class _Period>
228 _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
231 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
229232 try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time) {
230233 return try_lock_until(chrono::steady_clock::now() + __rel_time);
231234 }
232235
233236 template <class _Clock, class _Duration>
234 _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
237 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
235238 try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time) {
236239 unique_lock<mutex> __lk(__base_.__mut_);
237240 if (__base_.__state_ & __base_.__write_entered_) {
......@@ -259,19 +262,19 @@ public:
259262 return true;
260263 }
261264
262 _LIBCPP_RELEASE_CAPABILITY void unlock();
265 _LIBCPP_RELEASE_CAPABILITY() void unlock();
263266
264267 // Shared ownership
265268 _LIBCPP_ACQUIRE_SHARED_CAPABILITY void lock_shared();
266 _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) bool try_lock_shared();
269 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) bool try_lock_shared();
267270 template <class _Rep, class _Period>
268 _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
271 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
269272 try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time) {
270273 return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
271274 }
272275
273276 template <class _Clock, class _Duration>
274 _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
277 [[__nodiscard__]] _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(true) _LIBCPP_HIDE_FROM_ABI bool
275278 try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time) {
276279 unique_lock<mutex> __lk(__base_.__mut_);
277280 if ((__base_.__state_ & __base_.__write_entered_) ||
......@@ -304,27 +307,31 @@ private:
304307 bool __owns_;
305308
306309public:
307 _LIBCPP_HIDE_FROM_ABI shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
310 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
308311
309 _LIBCPP_HIDE_FROM_ABI explicit shared_lock(mutex_type& __m) : __m_(std::addressof(__m)), __owns_(true) {
312 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI explicit shared_lock(mutex_type& __m)
313 : __m_(std::addressof(__m)), __owns_(true) {
310314 __m_->lock_shared();
311315 }
312316
313 _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
317 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
314318 : __m_(std::addressof(__m)),
315319 __owns_(false) {}
316320
317 _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, try_to_lock_t)
321 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, try_to_lock_t)
318322 : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared()) {}
319323
320 _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, adopt_lock_t) : __m_(std::addressof(__m)), __owns_(true) {}
324 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, adopt_lock_t)
325 : __m_(std::addressof(__m)), __owns_(true) {}
321326
322327 template <class _Clock, class _Duration>
323 _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __abs_time)
328 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
329 shared_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __abs_time)
324330 : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_until(__abs_time)) {}
325331
326332 template <class _Rep, class _Period>
327 _LIBCPP_HIDE_FROM_ABI shared_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rel_time)
333 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
334 shared_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __rel_time)
328335 : __m_(std::addressof(__m)), __owns_(__m.try_lock_shared_for(__rel_time)) {}
329336
330337 _LIBCPP_HIDE_FROM_ABI ~shared_lock() {
......@@ -335,7 +342,9 @@ public:
335342 shared_lock(shared_lock const&) = delete;
336343 shared_lock& operator=(shared_lock const&) = delete;
337344
338 _LIBCPP_HIDE_FROM_ABI shared_lock(shared_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) {
345 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI shared_lock(shared_lock&& __u) _NOEXCEPT
346 : __m_(__u.__m_),
347 __owns_(__u.__owns_) {
339348 __u.__m_ = nullptr;
340349 __u.__owns_ = false;
341350 }
......@@ -347,11 +356,11 @@ public:
347356 }
348357
349358 _LIBCPP_HIDE_FROM_ABI void lock();
350 _LIBCPP_HIDE_FROM_ABI bool try_lock();
359 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock();
351360 template <class _Rep, class _Period>
352 _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time);
361 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time);
353362 template <class _Clock, class _Duration>
354 _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
363 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
355364 _LIBCPP_HIDE_FROM_ABI void unlock();
356365
357366 // Setters
......@@ -368,11 +377,11 @@ public:
368377 }
369378
370379 // Getters
371 _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; }
380 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; }
372381
373382 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; }
374383
375 _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; }
384 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; }
376385};
377386_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock);
378387
......@@ -431,6 +440,7 @@ inline _LIBCPP_HIDE_FROM_ABI void swap(shared_lock<_Mutex>& __x, shared_lock<_Mu
431440 __x.swap(__y);
432441}
433442
443_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
434444_LIBCPP_END_NAMESPACE_STD
435445
436446# endif // _LIBCPP_STD_VER >= 14
......@@ -439,7 +449,7 @@ _LIBCPP_POP_MACROS
439449
440450# endif // _LIBCPP_HAS_THREADS
441451
442# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
452# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
443453# include <optional>
444454# include <system_error>
445455# endif
lib/libcxx/include/source_location+4-4
......@@ -36,10 +36,10 @@ namespace std {
3636# pragma GCC system_header
3737# endif
3838
39_LIBCPP_BEGIN_NAMESPACE_STD
40
4139# if _LIBCPP_STD_VER >= 20
4240
41_LIBCPP_BEGIN_NAMESPACE_STD
42
4343class source_location {
4444 // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column
4545 // are hard-coded in the compiler and must not be changed here.
......@@ -81,10 +81,10 @@ public:
8181 }
8282};
8383
84# endif // _LIBCPP_STD_VER >= 20
85
8684_LIBCPP_END_NAMESPACE_STD
8785
86# endif // _LIBCPP_STD_VER >= 20
87
8888#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
8989
9090#endif // _LIBCPP_SOURCE_LOCATION
lib/libcxx/include/span+15-36
......@@ -19,16 +19,16 @@ namespace std {
1919inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
2020
2121template<class T>
22 concept integral-constant-like = // exposition only, since C++26
23 is_integral_v<decltype(T::value)> &&
24 !is_same_v<bool, remove_const_t<decltype(T::value)>> &&
22 concept integral-constant-like = // exposition only
23 is_integral_v<remove_cvref_t<decltype(T::value)>> &&
24 !is_same_v<bool, remove_cvref_t<decltype(T::value)>> &&
2525 convertible_to<T, decltype(T::value)> &&
2626 equality_comparable_with<T, decltype(T::value)> &&
2727 bool_constant<T() == T::value>::value &&
2828 bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;
2929
3030template<class T>
31 constexpr size_t maybe-static-ext = dynamic_extent; // exposition only, since C++26
31 constexpr size_t maybe-static-ext = dynamic_extent; // exposition only
3232template<integral-constant-like T>
3333 constexpr size_t maybe-static-ext<T> = {T::value};
3434
......@@ -82,7 +82,6 @@ public:
8282 constexpr span(const array<value_type, N>& arr) noexcept;
8383 template<class R>
8484 constexpr explicit(Extent != dynamic_extent) span(R&& r);
85 constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since C++26
8685 constexpr span(const span& other) noexcept = default;
8786 template <class OtherElementType, size_t OtherExtent>
8887 constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept;
......@@ -124,9 +123,7 @@ private:
124123};
125124
126125template<class It, class EndOrSize>
127 span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; // until C++26
128template<class It, class EndOrSize>
129 span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>; // since C++26
126 span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>, maybe-static-ext<EndOrSize>>;
130127
131128template<class T, size_t N>
132129 span(T (&)[N]) -> span<T, N>;
......@@ -153,6 +150,7 @@ template<class R>
153150# include <__config>
154151# include <__cstddef/byte.h>
155152# include <__cstddef/ptrdiff_t.h>
153# include <__cstddef/size_t.h>
156154# include <__fwd/array.h>
157155# include <__fwd/span.h>
158156# include <__iterator/bounded_iter.h>
......@@ -172,13 +170,13 @@ template<class R>
172170# include <__type_traits/is_convertible.h>
173171# include <__type_traits/is_integral.h>
174172# include <__type_traits/is_same.h>
173# include <__type_traits/is_volatile.h>
175174# include <__type_traits/remove_const.h>
176175# include <__type_traits/remove_cv.h>
177176# include <__type_traits/remove_cvref.h>
178177# include <__type_traits/remove_reference.h>
179178# include <__type_traits/type_identity.h>
180179# include <__utility/forward.h>
181# include <initializer_list>
182180# include <stdexcept>
183181# include <version>
184182
......@@ -198,10 +196,10 @@ template<class R>
198196_LIBCPP_PUSH_MACROS
199197# include <__undef_macros>
200198
201_LIBCPP_BEGIN_NAMESPACE_STD
202
203199# if _LIBCPP_STD_VER >= 20
204200
201_LIBCPP_BEGIN_NAMESPACE_STD
202
205203template <class _Tp>
206204struct __is_std_span : false_type {};
207205
......@@ -254,15 +252,6 @@ public:
254252 requires(_Sz == 0)
255253 _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
256254
257# if _LIBCPP_STD_VER >= 26
258 _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il)
259 requires is_const_v<element_type>
260 : __data_{__il.begin()} {
261 _LIBCPP_ASSERT_VALID_INPUT_RANGE(
262 _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size().");
263 }
264# endif
265
266255 constexpr span(const span&) noexcept = default;
267256 constexpr span& operator=(const span&) noexcept = default;
268257
......@@ -443,12 +432,6 @@ public:
443432 // [span.cons], span constructors, copy, assignment, and destructor
444433 _LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
445434
446# if _LIBCPP_STD_VER >= 26
447 _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il)
448 requires is_const_v<element_type>
449 : __data_{__il.begin()}, __size_{__il.size()} {}
450# endif
451
452435 constexpr span(const span&) noexcept = default;
453436 constexpr span& operator=(const span&) noexcept = default;
454437
......@@ -601,20 +584,20 @@ inline constexpr bool ranges::enable_view<span<_ElementType, _Extent>> = true;
601584
602585// as_bytes & as_writable_bytes
603586template <class _Tp, size_t _Extent>
587 requires(!is_volatile_v<_Tp>)
604588[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_bytes(span<_Tp, _Extent> __s) noexcept {
605589 return __s.__as_bytes();
606590}
607591
608592template <class _Tp, size_t _Extent>
609 requires(!is_const_v<_Tp>)
593 requires(!is_const_v<_Tp> && !is_volatile_v<_Tp>)
610594[[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept {
611595 return __s.__as_writable_bytes();
612596}
613597
614# if _LIBCPP_STD_VER >= 26
615598template <class _Tp>
616599concept __integral_constant_like =
617 is_integral_v<decltype(_Tp::value)> && !is_same_v<bool, remove_const_t<decltype(_Tp::value)>> &&
600 is_integral_v<remove_cvref_t<decltype(_Tp::value)>> && !is_same_v<bool, remove_cvref_t<decltype(_Tp::value)>> &&
618601 convertible_to<_Tp, decltype(_Tp::value)> && equality_comparable_with<_Tp, decltype(_Tp::value)> &&
619602 bool_constant<_Tp() == _Tp::value>::value &&
620603 bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == _Tp::value>::value;
......@@ -627,10 +610,6 @@ inline constexpr size_t __maybe_static_ext<_Tp> = {_Tp::value};
627610
628611template <contiguous_iterator _It, class _EndOrSize>
629612span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>, __maybe_static_ext<_EndOrSize>>;
630# else
631template <contiguous_iterator _It, class _EndOrSize>
632span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>;
633# endif
634613
635614template <class _Tp, size_t _Sz>
636615span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>;
......@@ -644,13 +623,13 @@ span(const array<_Tp, _Sz>&) -> span<const _Tp, _Sz>;
644623template <ranges::contiguous_range _Range>
645624span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>;
646625
647# endif // _LIBCPP_STD_VER >= 20
648
649626_LIBCPP_END_NAMESPACE_STD
650627
628# endif // _LIBCPP_STD_VER >= 20
629
651630_LIBCPP_POP_MACROS
652631
653# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
632# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
654633# include <array>
655634# include <concepts>
656635# include <functional>
lib/libcxx/include/sstream+3-1
......@@ -338,6 +338,7 @@ _LIBCPP_PUSH_MACROS
338338# include <__undef_macros>
339339
340340_LIBCPP_BEGIN_NAMESPACE_STD
341_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
341342
342343// Class template basic_stringbuf [stringbuf]
343344
......@@ -1288,13 +1289,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>
12881289extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>;
12891290# endif
12901291
1292_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
12911293_LIBCPP_END_NAMESPACE_STD
12921294
12931295_LIBCPP_POP_MACROS
12941296
12951297# endif // _LIBCPP_HAS_LOCALIZATION
12961298
1297# if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
1299# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
12981300# include <ostream>
12991301# include <type_traits>
13001302# endif
lib/libcxx/include/stack+1-1
......@@ -377,7 +377,7 @@ _LIBCPP_END_NAMESPACE_STD
377377
378378_LIBCPP_POP_MACROS
379379
380# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
380# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
381381# include <concepts>
382382# include <functional>
383383# include <type_traits>
lib/libcxx/include/stdatomic.h+1-1
......@@ -231,7 +231,7 @@ using std::atomic_store_explicit _LIBCPP_USING_IF_EXISTS;
231231using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
232232using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;
233233
234# elif defined(_LIBCPP_COMPILER_CLANG_BASED)
234# elif !defined(__cplusplus) || defined(_LIBCPP_COMPILER_CLANG_BASED)
235235
236236// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
237237// the header. We do this because Clang has historically shipped a <stdatomic.h>
lib/libcxx/include/stdbool.h deleted-44
......@@ -1,44 +0,0 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_STDBOOL_H
11#define _LIBCPP_STDBOOL_H
12
13/*
14 stdbool.h synopsis
15
16Macros:
17
18 __bool_true_false_are_defined
19
20*/
21
22#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
23# include <__cxx03/stdbool.h>
24#else
25# include <__config>
26
27# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
28# pragma GCC system_header
29# endif
30
31# if __has_include_next(<stdbool.h>)
32# include_next <stdbool.h>
33# endif
34
35# ifdef __cplusplus
36# undef bool
37# undef true
38# undef false
39# undef __bool_true_false_are_defined
40# define __bool_true_false_are_defined 1
41# endif
42#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
43
44#endif // _LIBCPP_STDBOOL_H
lib/libcxx/include/stdexcept+3-1
......@@ -212,7 +212,9 @@ public:
212212_LIBCPP_BEGIN_NAMESPACE_STD
213213
214214// in the dylib
215_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
215216[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
217_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
216218
217219[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
218220# if _LIBCPP_HAS_EXCEPTIONS
......@@ -280,7 +282,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
280282
281283_LIBCPP_END_NAMESPACE_STD
282284
283# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
285# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
284286# include <cstddef>
285287# include <cstdlib>
286288# include <exception>
lib/libcxx/include/stop_token+5-1
......@@ -52,7 +52,11 @@ namespace std {
5252
5353# endif // _LIBCPP_HAS_THREADS
5454
55# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
55# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
56# include <atomic>
57# endif
58
59# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
5660# include <cstddef>
5761# include <iosfwd>
5862# endif
lib/libcxx/include/streambuf+4-2
......@@ -117,8 +117,8 @@ protected:
117117# include <__assert>
118118# include <__fwd/streambuf.h>
119119# include <__locale>
120# include <__memory/valid_range.h>
120121# include <__type_traits/is_same.h>
121# include <__utility/is_valid_range.h>
122122# include <__utility/scope_guard.h>
123123# include <climits>
124124# include <ios>
......@@ -133,6 +133,7 @@ _LIBCPP_PUSH_MACROS
133133# include <__undef_macros>
134134
135135_LIBCPP_BEGIN_NAMESPACE_STD
136_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
136137
137138template <class _CharT, class _Traits>
138139class basic_streambuf {
......@@ -430,13 +431,14 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>;
430431extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>;
431432# endif
432433
434_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
433435_LIBCPP_END_NAMESPACE_STD
434436
435437_LIBCPP_POP_MACROS
436438
437439# endif // _LIBCPP_HAS_LOCALIZATION
438440
439# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
441# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
440442# include <cstdint>
441443# include <optional>
442444# endif
lib/libcxx/include/string+164-224
......@@ -201,6 +201,7 @@ public:
201201 basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
202202 basic_string& append(const value_type* s, size_type n); // constexpr since C++20
203203 basic_string& append(const value_type* s); // constexpr since C++20
204 basic_string& append(const value_type* s, size_type pos, size_type n); // constexpr since C++20
204205 basic_string& append(size_type n, value_type c); // constexpr since C++20
205206 template<class InputIterator>
206207 basic_string& append(InputIterator first, InputIterator last); // constexpr since C++20
......@@ -224,6 +225,7 @@ public:
224225 basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17, constexpr since C++20
225226 basic_string& assign(const value_type* s, size_type n); // constexpr since C++20
226227 basic_string& assign(const value_type* s); // constexpr since C++20
228 basic_string& assign(const value_type* s, size_type pos, size_type n); // constexpr since C++20
227229 basic_string& assign(size_type n, value_type c); // constexpr since C++20
228230 template<class InputIterator>
229231 basic_string& assign(InputIterator first, InputIterator last); // constexpr since C++20
......@@ -597,6 +599,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
597599# include <__algorithm/remove_if.h>
598600# include <__assert>
599601# include <__config>
602# include <__cstddef/size_t.h>
600603# include <__debug_utils/sanitizers.h>
601604# include <__format/enable_insertable.h>
602605# include <__functional/hash.h>
......@@ -625,9 +628,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
625628# include <__string/char_traits.h>
626629# include <__string/extern_template_lists.h>
627630# include <__type_traits/conditional.h>
631# include <__type_traits/desugars_to.h>
628632# include <__type_traits/enable_if.h>
629633# include <__type_traits/is_allocator.h>
630634# include <__type_traits/is_array.h>
635# include <__type_traits/is_constant_evaluated.h>
631636# include <__type_traits/is_convertible.h>
632637# include <__type_traits/is_generic_transparent_comparator.h>
633638# include <__type_traits/is_nothrow_assignable.h>
......@@ -637,9 +642,11 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
637642# include <__type_traits/is_trivially_constructible.h>
638643# include <__type_traits/is_trivially_copyable.h>
639644# include <__type_traits/is_trivially_relocatable.h>
645# include <__type_traits/remove_cv.h>
640646# include <__type_traits/remove_cvref.h>
641647# include <__utility/default_three_way_comparator.h>
642648# include <__utility/exception_guard.h>
649# include <__utility/exchange.h>
643650# include <__utility/forward.h>
644651# include <__utility/is_pointer_in_range.h>
645652# include <__utility/move.h>
......@@ -678,18 +685,18 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
678685_LIBCPP_PUSH_MACROS
679686# include <__undef_macros>
680687
681# if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN
682# define _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS __attribute__((__no_sanitize__("address")))
683// This macro disables AddressSanitizer (ASan) instrumentation for a specific function,
684// allowing memory accesses that would normally trigger ASan errors to proceed without crashing.
685// This is useful for accessing parts of objects memory, which should not be accessed,
686// such as unused bytes in short strings, that should never be accessed
687// by other parts of the program.
688// Since std::string is partially instantiated in the built library, we require that the library
689// has been built with ASAN support in order to enable the container checks in std::string.
690// Within the <string> implementation, use `_LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING`
691// to determine whether ASAN container checks should be provided.
692# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS && _LIBCPP_INSTRUMENTED_WITH_ASAN
693# define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING 1
688694# else
689# define _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
695# define _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING 0
690696# endif
691697
692698_LIBCPP_BEGIN_NAMESPACE_STD
699_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
693700
694701// basic_string
695702
......@@ -749,44 +756,10 @@ public:
749756 //
750757 // This string implementation doesn't contain any references into itself. It only contains a bit that says whether
751758 // it is in small or large string mode, so the entire structure is trivially relocatable if its members are.
752# if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN
753 // When compiling with AddressSanitizer (ASan), basic_string cannot be trivially
754 // relocatable. Because the object's memory might be poisoned when its content
755 // is kept inside objects memory (short string optimization), instead of in allocated
756 // external memory. In such cases, the destructor is responsible for unpoisoning
757 // the memory to avoid triggering false positives.
758 // Therefore it's crucial to ensure the destructor is called.
759 using __trivially_relocatable _LIBCPP_NODEBUG = void;
760# else
761759 using __trivially_relocatable _LIBCPP_NODEBUG = __conditional_t<
762760 __libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value,
763761 basic_string,
764762 void>;
765# endif
766
767# if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN
768 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const {
769 if (__libcpp_is_constant_evaluated())
770 return __ptr;
771
772 pointer volatile __copy_ptr = __ptr;
773
774 return const_cast<pointer&>(__copy_ptr);
775 }
776
777 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer
778 __asan_volatile_wrapper(const_pointer const& __ptr) const {
779 if (__libcpp_is_constant_evaluated())
780 return __ptr;
781
782 const_pointer volatile __copy_ptr = __ptr;
783
784 return const_cast<const_pointer&>(__copy_ptr);
785 }
786# define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) __asan_volatile_wrapper(PTR)
787# else
788# define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) PTR
789# endif
790763
791764 static_assert(!is_array<value_type>::value, "Character type of basic_string must not be an array");
792765 static_assert(is_standard_layout<value_type>::value, "Character type of basic_string must be standard-layout");
......@@ -803,8 +776,8 @@ public:
803776 // Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's
804777 // pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is
805778 // considered contiguous.
806 using iterator = __bounded_iter<__wrap_iter<pointer> >;
807 using const_iterator = __bounded_iter<__wrap_iter<const_pointer> >;
779 using iterator = __bounded_iter<pointer>;
780 using const_iterator = __bounded_iter<const_pointer>;
808781# else
809782 using iterator = __wrap_iter<pointer>;
810783 using const_iterator = __wrap_iter<const_pointer>;
......@@ -949,10 +922,7 @@ private:
949922 // regardless of whether reallocation occurs. This allows us to check for out-of-bounds accesses using logical size,
950923 // a stricter check, since correct code can never rely on being able to access newly-added elements via an existing
951924 // iterator.
952 return std::__make_bounded_iter(
953 std::__wrap_iter<pointer>(__p),
954 std::__wrap_iter<pointer>(__get_pointer()),
955 std::__wrap_iter<pointer>(__get_pointer() + size()));
925 return std::__make_bounded_iter(__p, __get_pointer(), __get_pointer() + size());
956926# else
957927 return iterator(__p);
958928# endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
......@@ -961,10 +931,7 @@ private:
961931 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
962932# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
963933 // Bound the iterator according to the size (and not the capacity, unlike vector).
964 return std::__make_bounded_iter(
965 std::__wrap_iter<const_pointer>(__p),
966 std::__wrap_iter<const_pointer>(__get_pointer()),
967 std::__wrap_iter<const_pointer>(__get_pointer() + size()));
934 return std::__make_bounded_iter(__p, __get_pointer(), __get_pointer() + size());
968935# else
969936 return const_iterator(__p);
970937# endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
......@@ -975,12 +942,7 @@ public:
975942
976943 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string()
977944 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
978# if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567
979 : __rep_(__short())
980# else
981 : __rep_()
982# endif
983 {
945 : __rep_() {
984946 __annotate_new(0);
985947 }
986948
......@@ -990,16 +952,11 @@ public:
990952# else
991953 _NOEXCEPT
992954# endif
993# if _LIBCPP_STD_VER >= 20 // TODO(LLVM 23): Remove this condition; this is a workaround for https://llvm.org/PR154567
994 : __rep_(__short()),
995# else
996 : __rep_(),
997# endif
998 __alloc_(__a) {
955 : __rep_(), __alloc_(__a) {
999956 __annotate_new(0);
1000957 }
1001958
1002 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string(const basic_string& __str)
959 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str)
1003960 : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc_)) {
1004961 if (!__str.__is_long()) {
1005962 __rep_ = __str.__rep_;
......@@ -1008,9 +965,7 @@ public:
1008965 __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
1009966 }
1010967
1011 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
1012 basic_string(const basic_string& __str, const allocator_type& __a)
1013 : __alloc_(__a) {
968 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a) : __alloc_(__a) {
1014969 if (!__str.__is_long()) {
1015970 __rep_ = __str.__rep_;
1016971 __annotate_new(__get_short_size());
......@@ -1025,15 +980,7 @@ public:
1025980# else
1026981 _NOEXCEPT
1027982# endif
1028 // Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
1029 // does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first.
1030 // __str's memory needs to be unpoisoned only in the case where it's a short string.
1031 : __rep_([](basic_string& __s) -> decltype(__s.__rep_)&& {
1032 if (!__s.__is_long())
1033 __s.__annotate_delete();
1034 return std::move(__s.__rep_);
1035 }(__str)),
1036 __alloc_(std::move(__str.__alloc_)) {
983 : __rep_(std::move(__str.__rep_)), __alloc_(std::move(__str.__alloc_)) {
1037984 __str.__rep_ = __rep();
1038985 __str.__annotate_new(0);
1039986 if (!__is_long())
......@@ -1058,15 +1005,9 @@ public:
10581005 }
10591006# endif // _LIBCPP_CXX03_LANG
10601007
1061 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
1062 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) {
1063 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*) detected nullptr");
1064 __init(__s, traits_type::length(__s));
1065 }
1066
10671008 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
10681009 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
1069 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a)
1010 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a = _Allocator())
10701011 : __alloc_(__a) {
10711012 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
10721013 __init(__s, traits_type::length(__s));
......@@ -1076,22 +1017,14 @@ public:
10761017 basic_string(nullptr_t) = delete;
10771018# endif
10781019
1079 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n)
1080 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
1081 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
1082 __init(__s, __n);
1083 }
1084
1085 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
1086 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
1020 _LIBCPP_HIDE_FROM_ABI
1021 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a = _Allocator())
10871022 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero")
10881023 : __alloc_(__a) {
10891024 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
10901025 __init(__s, __n);
10911026 }
10921027
1093 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c) { __init(__n, __c); }
1094
10951028# if _LIBCPP_STD_VER >= 23
10961029 _LIBCPP_HIDE_FROM_ABI constexpr basic_string(
10971030 basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator())
......@@ -1114,7 +1047,8 @@ public:
11141047# endif
11151048
11161049 template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
1117 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a)
1050 _LIBCPP_HIDE_FROM_ABI
1051 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a = _Allocator())
11181052 : __alloc_(__a) {
11191053 __init(__n, __c);
11201054 }
......@@ -1153,29 +1087,16 @@ public:
11531087 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
11541088 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
11551089 int> = 0>
1156 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) {
1157 __self_view __sv = __t;
1158 __init(__sv.data(), __sv.size());
1159 }
1160
1161 template <class _Tp,
1162 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
1163 !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
1164 int> = 0>
1165 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a)
1090 _LIBCPP_HIDE_FROM_ABI
1091 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a = allocator_type())
11661092 : __alloc_(__a) {
11671093 __self_view __sv = __t;
11681094 __init(__sv.data(), __sv.size());
11691095 }
11701096
1171 template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
1172 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) {
1173 __init(__first, __last);
1174 }
1175
11761097 template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
11771098 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
1178 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
1099 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type())
11791100 : __alloc_(__a) {
11801101 __init(__first, __last);
11811102 }
......@@ -1194,11 +1115,8 @@ public:
11941115# endif
11951116
11961117# ifndef _LIBCPP_CXX03_LANG
1197 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il) {
1198 __init(__il.begin(), __il.end());
1199 }
1200
1201 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a)
1118 _LIBCPP_HIDE_FROM_ABI
1119 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a = _Allocator())
12021120 : __alloc_(__a) {
12031121 __init(__il.begin(), __il.end());
12041122 }
......@@ -1213,8 +1131,7 @@ public:
12131131 return __self_view(typename __self_view::__assume_valid(), data(), size());
12141132 }
12151133
1216 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string&
1217 operator=(const basic_string& __str);
1134 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const basic_string& __str);
12181135
12191136 template <class _Tp,
12201137 __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
......@@ -1427,6 +1344,8 @@ public:
14271344 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n)
14281345 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
14291346 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
1347 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __pos, size_type __n)
1348 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
14301349 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
14311350
14321351 template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
......@@ -1450,7 +1369,7 @@ public:
14501369 if (__cap - __sz < __n)
14511370 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
14521371 __annotate_increase(__n);
1453 auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz));
1372 auto __end = __copy_non_overlapping_range(__first, __last, __data() + __sz);
14541373 traits_type::assign(*__end, value_type());
14551374 __set_size(__sz + __n);
14561375 return *this;
......@@ -1510,8 +1429,7 @@ public:
15101429 size_type __old_sz = __str.size();
15111430 if (!__str.__is_long())
15121431 __str.__annotate_delete();
1513 __rep_ = __str.__rep_;
1514 __str.__rep_ = __rep();
1432 __rep_ = std::__exchange(__str.__rep_, __rep());
15151433 __str.__annotate_new(0);
15161434
15171435 _Traits::move(data(), data() + __pos, __len);
......@@ -1554,6 +1472,8 @@ public:
15541472 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n)
15551473 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
15561474 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
1475 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __pos, size_type __n)
1476 _LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
15571477 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
15581478
15591479 template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
......@@ -1807,6 +1727,13 @@ public:
18071727 }
18081728# endif
18091729
1730 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* __data() const _NOEXCEPT {
1731 return std::__to_address(__get_pointer());
1732 }
1733 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* __data() _NOEXCEPT {
1734 return std::__to_address(__get_pointer());
1735 }
1736
18101737 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
18111738 return __alloc_;
18121739 }
......@@ -1815,14 +1742,14 @@ public:
18151742
18161743 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18171744 find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1818 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
1745 return find(__str.data(), __pos, __str.size());
18191746 }
18201747
18211748 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18221749 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18231750 find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
18241751 __self_view __sv = __t;
1825 return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
1752 return find(__sv.data(), __pos, __sv.size());
18261753 }
18271754
18281755 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1835,8 +1762,7 @@ public:
18351762 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18361763 find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
18371764 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
1838 return std::__str_find<value_type, size_type, traits_type, npos>(
1839 data(), size(), __s, __pos, traits_type::length(__s));
1765 return find(__s, __pos, traits_type::length(__s));
18401766 }
18411767
18421768 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
......@@ -1847,15 +1773,14 @@ public:
18471773
18481774 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18491775 rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1850 return std::__str_rfind<value_type, size_type, traits_type, npos>(
1851 data(), size(), __str.data(), __pos, __str.size());
1776 return rfind(__str.data(), __pos, __str.size());
18521777 }
18531778
18541779 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18551780 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18561781 rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
18571782 __self_view __sv = __t;
1858 return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
1783 return rfind(__sv.data(), __pos, __sv.size());
18591784 }
18601785
18611786 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1868,8 +1793,7 @@ public:
18681793 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18691794 rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
18701795 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
1871 return std::__str_rfind<value_type, size_type, traits_type, npos>(
1872 data(), size(), __s, __pos, traits_type::length(__s));
1796 return rfind(__s, __pos, traits_type::length(__s));
18731797 }
18741798
18751799 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1881,16 +1805,14 @@ public:
18811805
18821806 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18831807 find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1884 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1885 data(), size(), __str.data(), __pos, __str.size());
1808 return find_first_of(__str.data(), __pos, __str.size());
18861809 }
18871810
18881811 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18891812 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18901813 find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
18911814 __self_view __sv = __t;
1892 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1893 data(), size(), __sv.data(), __pos, __sv.size());
1815 return find_first_of(__sv.data(), __pos, __sv.size());
18941816 }
18951817
18961818 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1903,8 +1825,7 @@ public:
19031825 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19041826 find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
19051827 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
1906 return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1907 data(), size(), __s, __pos, traits_type::length(__s));
1828 return find_first_of(__s, __pos, traits_type::length(__s));
19081829 }
19091830
19101831 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1916,16 +1837,14 @@ public:
19161837
19171838 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19181839 find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1919 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1920 data(), size(), __str.data(), __pos, __str.size());
1840 return find_last_of(__str.data(), __pos, __str.size());
19211841 }
19221842
19231843 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19241844 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19251845 find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
19261846 __self_view __sv = __t;
1927 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1928 data(), size(), __sv.data(), __pos, __sv.size());
1847 return find_last_of(__sv.data(), __pos, __sv.size());
19291848 }
19301849
19311850 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1938,8 +1857,7 @@ public:
19381857 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19391858 find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
19401859 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
1941 return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1942 data(), size(), __s, __pos, traits_type::length(__s));
1860 return find_last_of(__s, __pos, traits_type::length(__s));
19431861 }
19441862
19451863 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1951,16 +1869,14 @@ public:
19511869
19521870 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19531871 find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1954 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1955 data(), size(), __str.data(), __pos, __str.size());
1872 return find_first_not_of(__str.data(), __pos, __str.size());
19561873 }
19571874
19581875 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19591876 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19601877 find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
19611878 __self_view __sv = __t;
1962 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1963 data(), size(), __sv.data(), __pos, __sv.size());
1879 return find_first_not_of(__sv.data(), __pos, __sv.size());
19641880 }
19651881
19661882 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1973,8 +1889,7 @@ public:
19731889 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19741890 find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
19751891 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
1976 return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1977 data(), size(), __s, __pos, traits_type::length(__s));
1892 return find_first_not_of(__s, __pos, traits_type::length(__s));
19781893 }
19791894
19801895 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -1986,16 +1901,14 @@ public:
19861901
19871902 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19881903 find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1989 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
1990 data(), size(), __str.data(), __pos, __str.size());
1904 return find_last_not_of(__str.data(), __pos, __str.size());
19911905 }
19921906
19931907 template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19941908 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19951909 find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
19961910 __self_view __sv = __t;
1997 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
1998 data(), size(), __sv.data(), __pos, __sv.size());
1911 return find_last_not_of(__sv.data(), __pos, __sv.size());
19991912 }
20001913
20011914 [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -2008,8 +1921,7 @@ public:
20081921 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
20091922 find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
20101923 _LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
2011 return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
2012 data(), size(), __s, __pos, traits_type::length(__s));
1924 return find_last_not_of(__s, __pos, traits_type::length(__s));
20131925 }
20141926
20151927 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
......@@ -2134,8 +2046,7 @@ public:
21342046 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __invariants() const;
21352047
21362048private:
2137 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS bool
2138 __is_long() const _NOEXCEPT {
2049 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_long() const _NOEXCEPT {
21392050 if (__libcpp_is_constant_evaluated() && __builtin_constant_p(__rep_.__l.__is_long_)) {
21402051 return __rep_.__l.__is_long_;
21412052 }
......@@ -2180,7 +2091,7 @@ private:
21802091 value_type* __p;
21812092 if (__cap - __sz >= __n) {
21822093 __annotate_increase(__n);
2183 __p = std::__to_address(__get_pointer());
2094 __p = __data();
21842095 size_type __n_move = __sz - __ip;
21852096 if (__n_move != 0)
21862097 traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
......@@ -2203,15 +2114,13 @@ private:
22032114 // internal buffer accessors
22042115 // -------------------------
22052116
2206 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
2207 __set_short_size(size_type __s) _NOEXCEPT {
2117 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_short_size(size_type __s) _NOEXCEPT {
22082118 _LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
22092119 __rep_.__s.__size_ = __s;
22102120 __rep_.__s.__is_long_ = false;
22112121 }
22122122
2213 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS size_type
2214 __get_short_size() const _NOEXCEPT {
2123 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_short_size() const _NOEXCEPT {
22152124 _LIBCPP_ASSERT_INTERNAL(!__rep_.__s.__is_long_, "String has to be short when trying to get the short size");
22162125 return __rep_.__s.__size_;
22172126 }
......@@ -2239,22 +2148,20 @@ private:
22392148
22402149 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT {
22412150 _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer");
2242 return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_);
2151 return __rep_.__l.__data_;
22432152 }
22442153
22452154 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT {
22462155 _LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer");
2247 return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_);
2156 return __rep_.__l.__data_;
22482157 }
22492158
2250 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS pointer
2251 __get_short_pointer() _NOEXCEPT {
2252 return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<pointer>::pointer_to(__rep_.__s.__data_[0]));
2159 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_short_pointer() _NOEXCEPT {
2160 return pointer_traits<pointer>::pointer_to(__rep_.__s.__data_[0]);
22532161 }
22542162
2255 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS const_pointer
2256 __get_short_pointer() const _NOEXCEPT {
2257 return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<const_pointer>::pointer_to(__rep_.__s.__data_[0]));
2163 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_short_pointer() const _NOEXCEPT {
2164 return pointer_traits<const_pointer>::pointer_to(__rep_.__s.__data_[0]);
22582165 }
22592166
22602167 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT {
......@@ -2272,17 +2179,24 @@ private:
22722179
22732180 // Allocate a buffer of __capacity size with __alloc and return it
22742181 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long
2275 __allocate_long_buffer(_Allocator& __alloc, size_type __capacity) {
2276 _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__capacity),
2182 __allocate_long_buffer(_Allocator& __alloc, size_type __size, size_type __min_capacity) {
2183 _LIBCPP_ASSERT_INTERNAL(
2184 __size <= __min_capacity, "Trying to allocate a long buffer with a smaller capacity than size");
2185 _LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__min_capacity),
22772186 "Trying to allocate long buffer for a capacity what would fit into the small buffer");
2278 auto __buffer = std::__allocate_at_least(__alloc, __align_allocation_size(__capacity));
2187 auto __buffer = std::__allocate_at_least(__alloc, __align_allocation_size(__min_capacity));
22792188
22802189 if (__libcpp_is_constant_evaluated()) {
22812190 for (size_type __i = 0; __i != __buffer.count; ++__i)
22822191 std::__construct_at(std::addressof(__buffer.ptr[__i]));
22832192 }
22842193
2285 return __long(__buffer, __capacity);
2194 return __long(__buffer, __size);
2195 }
2196
2197 _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long
2198 __allocate_long_buffer(_Allocator& __alloc, size_type __size) {
2199 return __allocate_long_buffer(__alloc, __size, __size);
22862200 }
22872201
22882202 // Replace the current buffer with __new_rep. Deallocate the old long buffer if it exists.
......@@ -2321,13 +2235,9 @@ private:
23212235 __annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
23222236 (void)__old_mid;
23232237 (void)__new_mid;
2324# if _LIBCPP_INSTRUMENTED_WITH_ASAN
2325# if defined(__APPLE__)
2326 // TODO: remove after addressing issue #96099 (https://llvm.org/PR96099)
2327 if (!__is_long())
2328 return;
2329# endif
2330 std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid);
2238# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS_FOR_STRING
2239 if (__is_long())
2240 std::__annotate_contiguous_container<_Allocator>(data(), data() + capacity() + 1, __old_mid, __new_mid);
23312241# endif
23322242 }
23332243
......@@ -2366,7 +2276,17 @@ private:
23662276 static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __align_it(size_type __s) _NOEXCEPT {
23672277 return (__s + (__a - 1)) & ~(__a - 1);
23682278 }
2369 enum { __alignment = 8 };
2279
2280 // GCC currently doesn't define __STDCPP_DEFAULT_NEW_ALIGNMENT__ unconditionally
2281 // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123872
2282# ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
2283 static inline const size_t
2284 __alignment = __is_std_allocator_v<allocator_type> && __STDCPP_DEFAULT_NEW_ALIGNMENT__ > sizeof(void*)
2285 ? __STDCPP_DEFAULT_NEW_ALIGNMENT__
2286 : sizeof(void*);
2287# else
2288 static inline const size_t __alignment = sizeof(void*);
2289# endif
23702290
23712291 // This makes sure that we're using a capacity with some extra alignment, since allocators almost always over-align
23722292 // the allocations anyways, improving memory usage. More importantly, this ensures that the lowest bit is never set
......@@ -2458,7 +2378,7 @@ private:
24582378
24592379 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __erase_to_end(size_type __pos) {
24602380 _LIBCPP_ASSERT_INTERNAL(__pos <= capacity(), "Trying to erase at position outside the strings capacity!");
2461 __null_terminate_at(std::__to_address(__get_pointer()), __pos);
2381 __null_terminate_at(__data(), __pos);
24622382 }
24632383
24642384 // __erase_external_with_move is invoked for erase() invocations where
......@@ -2494,8 +2414,7 @@ private:
24942414# ifndef _LIBCPP_CXX03_LANG
24952415 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
24962416 __move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value);
2497 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
2498 __move_assign(basic_string& __str, true_type)
2417 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, true_type)
24992418# if _LIBCPP_STD_VER >= 17
25002419 noexcept;
25012420# else
......@@ -2610,19 +2529,29 @@ struct __default_three_way_comparator<basic_string<_CharT, _Traits, _Alloc>, bas
26102529};
26112530# endif
26122531
2613template <class _Comparator, class _CharT, class _Traits, class _Alloc>
2614inline const bool __is_transparently_comparable_v<_Comparator,
2615 basic_string<_CharT, _Traits, _Alloc>,
2616 const _CharT*,
2617 __enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > =
2618 true;
2532template <class _Comparator, class _CharT2, class _CharT, class _Traits, class _Alloc>
2533inline const bool __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT2*> =
2534 is_same<_CharT, __remove_cv_t<_CharT2> >::value &&
2535 (__desugars_to_v<__less_tag,
2536 _Comparator,
2537 basic_string<_CharT, _Traits, _Alloc>,
2538 basic_string<_CharT, _Traits, _Alloc> > ||
2539 __desugars_to_v<__greater_tag,
2540 _Comparator,
2541 basic_string<_CharT, _Traits, _Alloc>,
2542 basic_string<_CharT, _Traits, _Alloc> >);
2543
2544template <class _Comparator, class _CharT2, class _CharT, class _Traits, class _Alloc>
2545inline const bool __is_transparently_comparable_v<_Comparator, _CharT2*, basic_string<_CharT, _Traits, _Alloc> > =
2546 __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT2*>;
26192547
26202548template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np>
2621inline const bool __is_transparently_comparable_v<_Comparator,
2622 basic_string<_CharT, _Traits, _Alloc>,
2623 _CharT[_Np],
2624 __enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > =
2625 true;
2549inline const bool __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, _CharT[_Np]> =
2550 __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, const _CharT*>;
2551
2552template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np>
2553inline const bool __is_transparently_comparable_v<_Comparator, _CharT[_Np], basic_string<_CharT, _Traits, _Alloc> > =
2554 __is_transparently_comparable_v<_Comparator, basic_string<_CharT, _Traits, _Alloc>, const _CharT*>;
26262555
26272556# if _LIBCPP_STD_VER >= 17
26282557template <class _InputIterator,
......@@ -2728,19 +2657,18 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
27282657 size_type __n_del,
27292658 size_type __n_add,
27302659 const value_type* __p_new_stuff) {
2731 __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
2732 pointer __old_p = __get_pointer();
2660 __long __buffer = __allocate_long_buffer(__alloc_, 0, __get_amortized_growth_capacity(__old_cap + __delta_cap));
2661 value_type* __old_p = __data();
27332662 __annotate_delete();
27342663 auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
27352664 if (__n_copy != 0)
2736 traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
2665 traits_type::copy(std::__to_address(__buffer.__data_), __old_p, __n_copy);
27372666 if (__n_add != 0)
27382667 traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy, __p_new_stuff, __n_add);
27392668 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
27402669 if (__sec_cp_sz != 0)
2741 traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add,
2742 std::__to_address(__old_p) + __n_copy + __n_del,
2743 __sec_cp_sz);
2670 traits_type::copy(
2671 std::__to_address(__buffer.__data_) + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
27442672 __buffer.__size_ = __n_copy + __n_add + __sec_cp_sz;
27452673 traits_type::assign(__buffer.__data_[__buffer.__size_], value_type());
27462674 __reset_internal_buffer(__buffer);
......@@ -2761,16 +2689,14 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
27612689 size_type __n_copy,
27622690 size_type __n_del,
27632691 size_type __n_add) {
2764 __long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
2765 pointer __old_p = __get_pointer();
2692 __long __buffer = __allocate_long_buffer(__alloc_, 0, __get_amortized_growth_capacity(__old_cap + __delta_cap));
2693 value_type* __old_p = __data();
27662694 if (__n_copy != 0)
2767 traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
2695 traits_type::copy(std::__to_address(__buffer.__data_), __old_p, __n_copy);
27682696 size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
27692697 if (__sec_cp_sz != 0)
2770 traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add,
2771 std::__to_address(__old_p) + __n_copy + __n_del,
2772 __sec_cp_sz);
2773
2698 traits_type::copy(
2699 std::__to_address(__buffer.__data_) + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
27742700 // This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size
27752701 // at all.
27762702 __buffer.__size_ = -1;
......@@ -2831,7 +2757,7 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_external(const value_type* _
28312757 if (__cap >= __n) {
28322758 if (__n > __size)
28332759 __annotate_increase(__n - __size);
2834 value_type* __p = std::__to_address(__get_pointer());
2760 value_type* __p = __data();
28352761 traits_type::move(__p, __s, __n);
28362762 return __null_terminate_at(__p, __n);
28372763 } else {
......@@ -2847,6 +2773,13 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_ty
28472773 return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n);
28482774}
28492775
2776template <class _CharT, class _Traits, class _Allocator>
2777_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
2778basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __pos, size_type __n) {
2779 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::assign received nullptr");
2780 return assign(__self_view(__s).substr(__pos, __n));
2781}
2782
28502783template <class _CharT, class _Traits, class _Allocator>
28512784_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
28522785basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) {
......@@ -2857,7 +2790,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
28572790 __annotate_increase(__n);
28582791 } else if (__n > __old_size)
28592792 __annotate_increase(__n - __old_size);
2860 value_type* __p = std::__to_address(__get_pointer());
2793 value_type* __p = __data();
28612794 traits_type::assign(__p, __n, __c);
28622795 return __null_terminate_at(__p, __n);
28632796}
......@@ -2884,7 +2817,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) {
28842817}
28852818
28862819template <class _CharT, class _Traits, class _Allocator>
2887_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string<_CharT, _Traits, _Allocator>&
2820_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
28882821basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) {
28892822 if (this == std::addressof(__str))
28902823 return *this;
......@@ -2916,7 +2849,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
29162849}
29172850
29182851template <class _CharT, class _Traits, class _Allocator>
2919inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
2852inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
29202853basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
29212854# if _LIBCPP_STD_VER >= 17
29222855 noexcept
......@@ -3042,7 +2975,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
30422975 return *this;
30432976
30442977 __annotate_increase(__n);
3045 value_type* __p = std::__to_address(__get_pointer());
2978 value_type* __p = __data();
30462979 traits_type::copy(__p + __sz, __s, __n);
30472980 __sz += __n;
30482981 __set_size(__sz);
......@@ -3061,7 +2994,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
30612994 if (__cap - __sz < __n)
30622995 __grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
30632996 __annotate_increase(__n);
3064 pointer __p = __get_pointer();
2997 value_type* __p = __data();
30652998 traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
30662999 __sz += __n;
30673000 __set_size(__sz);
......@@ -3114,6 +3047,13 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) {
31143047 return append(__s, traits_type::length(__s));
31153048}
31163049
3050template <class _CharT, class _Traits, class _Allocator>
3051_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
3052basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __pos, size_type __n) {
3053 _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
3054 return append(__self_view(__s).substr(__pos, __n));
3055}
3056
31173057// insert
31183058
31193059template <class _CharT, class _Traits, class _Allocator>
......@@ -3134,7 +3074,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
31343074 return *this;
31353075
31363076 __annotate_increase(__n);
3137 value_type* __p = std::__to_address(__get_pointer());
3077 value_type* __p = __data();
31383078 size_type __n_move = __sz - __pos;
31393079 if (__n_move != 0) {
31403080 if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
......@@ -3162,7 +3102,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
31623102 value_type* __p;
31633103 if (__cap - __sz >= __n) {
31643104 __annotate_increase(__n);
3165 __p = std::__to_address(__get_pointer());
3105 __p = __data();
31663106 size_type __n_move = __sz - __pos;
31673107 if (__n_move != 0)
31683108 traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
......@@ -3223,7 +3163,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
32233163 __p = std::__to_address(__get_long_pointer());
32243164 } else {
32253165 __annotate_increase(1);
3226 __p = std::__to_address(__get_pointer());
3166 __p = __data();
32273167 size_type __n_move = __sz - __ip;
32283168 if (__n_move != 0)
32293169 traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
......@@ -3252,7 +3192,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
32523192 return *this;
32533193 }
32543194
3255 value_type* __p = std::__to_address(__get_pointer());
3195 value_type* __p = __data();
32563196 if (__n1 != __n2) {
32573197 if (__n2 > __n1)
32583198 __annotate_increase(__n2 - __n1);
......@@ -3291,7 +3231,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
32913231 size_type __cap = capacity();
32923232 value_type* __p;
32933233 if (__cap - __sz + __n1 >= __n2) {
3294 __p = std::__to_address(__get_pointer());
3234 __p = __data();
32953235 if (__n1 != __n2) {
32963236 if (__n2 > __n1)
32973237 __annotate_increase(__n2 - __n1);
......@@ -3335,7 +3275,7 @@ basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type
33353275 return;
33363276
33373277 size_type __sz = size();
3338 value_type* __p = std::__to_address(__get_pointer());
3278 value_type* __p = __data();
33393279 __n = std::min(__n, __sz - __pos);
33403280 size_type __n_move = __sz - __pos - __n;
33413281 if (__n_move != 0)
......@@ -3419,8 +3359,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re
34193359 return;
34203360
34213361 __annotation_guard __g(*this);
3422 __long __buffer = __allocate_long_buffer(__alloc_, __requested_capacity);
3423 __buffer.__size_ = size();
3362 __long __buffer = __allocate_long_buffer(__alloc_, size(), __requested_capacity);
34243363 traits_type::copy(std::__to_address(__buffer.__data_), data(), __buffer.__size_ + 1);
34253364 __reset_internal_buffer(__buffer);
34263365}
......@@ -3717,7 +3656,7 @@ __concatenate_strings(const _Allocator& __alloc,
37173656 _String __r(__uninitialized_size_tag(),
37183657 __str1.size() + __str2.size(),
37193658 _String::__alloc_traits::select_on_container_copy_construction(__alloc));
3720 auto __ptr = std::__to_address(__r.__get_pointer());
3659 auto __ptr = __r.__data();
37213660 _Traits::copy(__ptr, __str1.data(), __str1.size());
37223661 _Traits::copy(__ptr + __str1.size(), __str2.data(), __str2.size());
37233662 _Traits::assign(__ptr[__str1.size() + __str2.size()], _CharT());
......@@ -4019,11 +3958,12 @@ inline constexpr bool __format::__enable_insertable<std::basic_string<wchar_t>>
40193958
40203959# endif
40213960
3961_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
40223962_LIBCPP_END_NAMESPACE_STD
40233963
40243964_LIBCPP_POP_MACROS
40253965
4026# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
3966# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
40273967# include <algorithm>
40283968# include <concepts>
40293969# include <cstdlib>
lib/libcxx/include/string.h+2
......@@ -64,6 +64,8 @@ size_t strlen(const char* s);
6464# include_next <string.h>
6565# endif
6666
67# include <stddef.h>
68
6769// MSVCRT, GNU libc and its derivates may already have the correct prototype in
6870// <string.h>. This macro can be defined by users if their C library provides
6971// the right signature.
lib/libcxx/include/string_view+1-1
......@@ -971,7 +971,7 @@ _LIBCPP_END_NAMESPACE_STD
971971
972972_LIBCPP_POP_MACROS
973973
974# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
974# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
975975# include <algorithm>
976976# include <concepts>
977977# include <cstdlib>
lib/libcxx/include/strstream+2
......@@ -151,6 +151,7 @@ _LIBCPP_PUSH_MACROS
151151# include <__undef_macros>
152152
153153_LIBCPP_BEGIN_NAMESPACE_STD
154_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
154155
155156class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
156157public:
......@@ -349,6 +350,7 @@ private:
349350 strstreambuf __sb_; // exposition only
350351};
351352
353_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
352354_LIBCPP_END_NAMESPACE_STD
353355
354356_LIBCPP_POP_MACROS
lib/libcxx/include/syncstream+6-5
......@@ -147,10 +147,10 @@ namespace std {
147147_LIBCPP_PUSH_MACROS
148148# include <__undef_macros>
149149
150_LIBCPP_BEGIN_NAMESPACE_STD
151
152150# if _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
153151
152_LIBCPP_BEGIN_NAMESPACE_STD
153
154154// [syncstream.syncbuf.overview]/1
155155// Class template basic_syncbuf stores character data written to it,
156156// known as the associated output, into internal buffers allocated
......@@ -196,7 +196,8 @@ public:
196196 // calling __inc_reference.
197197 //
198198 // pre: __ptr is in __lut_
199 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard<mutex> __get_lock([[maybe_unused]] void* __ptr) noexcept {
199 _LIBCPP_NO_THREAD_SAFETY_ANALYSIS [[nodiscard]] _LIBCPP_HIDE_FROM_ABI lock_guard<mutex>
200 __get_lock([[maybe_unused]] void* __ptr) noexcept {
200201 shared_lock __lock{__mutex_};
201202 return lock_guard{__get_it(__ptr)->second.__mutex};
202203 }
......@@ -511,10 +512,10 @@ using std::osyncstream;
511512using std::wosyncstream;
512513# endif
513514
514# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
515
516515_LIBCPP_END_NAMESPACE_STD
517516
517# endif // _LIBCPP_STD_VER >= 20 && _LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
518
518519_LIBCPP_POP_MACROS
519520
520521# endif // _LIBCPP_HAS_LOCALIZATION
lib/libcxx/include/system_error+1-1
......@@ -164,7 +164,7 @@ template <> struct hash<std::error_condition>;
164164# pragma GCC system_header
165165# endif
166166
167# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
167# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
168168# include <cstdint>
169169# include <cstring>
170170# include <limits>
lib/libcxx/include/text_encoding created+835
......@@ -0,0 +1,835 @@
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_TEXT_ENCODING
11#define _LIBCPP_TEXT_ENCODING
12
13/* text_encoding synopsis
14namespace std {
15
16struct text_encoding;
17
18// [text.encoding.hash], hash support
19template<class T> struct hash;
20template<> struct hash<text_encoding>;
21
22struct text_encoding
23{
24 static constexpr size_t max_name_length = 63;
25
26 // [text.encoding.id], enumeration text_encoding::id
27 enum class id : int_least32_t {
28 see below
29 };
30 using enum id;
31
32 constexpr text_encoding() = default;
33 constexpr explicit text_encoding(string_view enc) noexcept;
34 constexpr text_encoding(id i) noexcept;
35
36 constexpr id mib() const noexcept;
37 constexpr const char* name() const noexcept;
38
39 // [text.encoding.aliases], class text_encoding::aliases_view
40 // struct aliases_view;
41 constexpr aliases_view aliases() const noexcept;
42
43 friend constexpr bool operator==(const text_encoding& a,
44 const text_encoding& b) noexcept;
45 friend constexpr bool operator==(const text_encoding& encoding, id i) noexcept;
46
47 static consteval text_encoding literal() noexcept;
48 static text_encoding environment();
49 template<id i> static bool environment_is();
50
51 private:
52 id mib_ = id::unknown; // exposition only
53 char name_[max_name_length + 1] = {0}; // exposition only
54 static constexpr bool comp-name(string_view a, string_view b); // exposition only
55};
56}
57
58*/
59
60#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
61# include <__cxx03/__config>
62#else
63# include <__config>
64
65# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
66# pragma GCC system_header
67# endif
68
69# if _LIBCPP_STD_VER >= 26
70
71# include <__algorithm/count.h>
72# include <__algorithm/find_if.h>
73# include <__algorithm/lower_bound.h>
74# include <__cstddef/ptrdiff_t.h>
75# include <__functional/hash.h>
76# include <__iterator/iterator_traits.h>
77# include <__ranges/enable_borrowed_range.h>
78# include <__ranges/view_interface.h>
79# include <climits>
80# include <cstdint>
81# include <string_view>
82# include <version>
83
84_LIBCPP_BEGIN_NAMESPACE_STD
85struct text_encoding;
86
87_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
88
89_LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT _LIBCPP_EXPORTED_FROM_ABI text_encoding
90__get_locale_encoding(const char* __name);
91
92_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
93
94struct text_encoding {
95 static_assert(CHAR_BIT == 8, "libc++ only supports platforms where CHAR_BIT == 8");
96 enum class id : int_least32_t {
97 other = 1,
98 unknown = 2,
99 ASCII = 3,
100 ISOLatin1 = 4,
101 ISOLatin2 = 5,
102 ISOLatin3 = 6,
103 ISOLatin4 = 7,
104 ISOLatinCyrillic = 8,
105 ISOLatinArabic = 9,
106 ISOLatinGreek = 10,
107 ISOLatinHebrew = 11,
108 ISOLatin5 = 12,
109 ISOLatin6 = 13,
110 ISOTextComm = 14,
111 HalfWidthKatakana = 15,
112 JISEncoding = 16,
113 ShiftJIS = 17,
114 EUCPkdFmtJapanese = 18,
115 EUCFixWidJapanese = 19,
116 ISO4UnitedKingdom = 20,
117 ISO11SwedishForNames = 21,
118 ISO15Italian = 22,
119 ISO17Spanish = 23,
120 ISO21German = 24,
121 ISO60DanishNorwegian = 25,
122 ISO69French = 26,
123 ISO10646UTF1 = 27,
124 ISO646basic1983 = 28,
125 INVARIANT = 29,
126 ISO2IntlRefVersion = 30,
127 NATSSEFI = 31,
128 NATSSEFIADD = 32, // NATS-DANO (33) and NATS-DANO-ADD (34) are omitted by the standard.
129 ISO10Swedish = 35,
130 KSC56011987 = 36,
131 ISO2022KR = 37,
132 EUCKR = 38,
133 ISO2022JP = 39,
134 ISO2022JP2 = 40,
135 ISO13JISC6220jp = 41,
136 ISO14JISC6220ro = 42,
137 ISO16Portuguese = 43,
138 ISO18Greek7Old = 44,
139 ISO19LatinGreek = 45,
140 ISO25French = 46,
141 ISO27LatinGreek1 = 47,
142 ISO5427Cyrillic = 48,
143 ISO42JISC62261978 = 49,
144 ISO47BSViewdata = 50,
145 ISO49INIS = 51,
146 ISO50INIS8 = 52,
147 ISO51INISCyrillic = 53,
148 ISO54271981 = 54,
149 ISO5428Greek = 55,
150 ISO57GB1988 = 56,
151 ISO58GB231280 = 57,
152 ISO61Norwegian2 = 58,
153 ISO70VideotexSupp1 = 59,
154 ISO84Portuguese2 = 60,
155 ISO85Spanish2 = 61,
156 ISO86Hungarian = 62,
157 ISO87JISX0208 = 63,
158 ISO88Greek7 = 64,
159 ISO89ASMO449 = 65,
160 ISO90 = 66,
161 ISO91JISC62291984a = 67,
162 ISO92JISC62991984b = 68,
163 ISO93JIS62291984badd = 69,
164 ISO94JIS62291984hand = 70,
165 ISO95JIS62291984handadd = 71,
166 ISO96JISC62291984kana = 72,
167 ISO2033 = 73,
168 ISO99NAPLPS = 74,
169 ISO102T617bit = 75,
170 ISO103T618bit = 76,
171 ISO111ECMACyrillic = 77,
172 ISO121Canadian1 = 78,
173 ISO122Canadian2 = 79,
174 ISO123CSAZ24341985gr = 80,
175 ISO88596E = 81,
176 ISO88596I = 82,
177 ISO128T101G2 = 83,
178 ISO88598E = 84,
179 ISO88598I = 85,
180 ISO139CSN369103 = 86,
181 ISO141JUSIB1002 = 87,
182 ISO143IECP271 = 88,
183 ISO146Serbian = 89,
184 ISO147Macedonian = 90,
185 ISO150 = 91,
186 ISO151Cuba = 92,
187 ISO6937Add = 93,
188 ISO153GOST1976874 = 94,
189 ISO8859Supp = 95,
190 ISO10367Box = 96,
191 ISO158Lap = 97,
192 ISO159JISX02121990 = 98,
193 ISO646Danish = 99,
194 USDK = 100,
195 DKUS = 101,
196 KSC5636 = 102,
197 Unicode11UTF7 = 103,
198 ISO2022CN = 104,
199 ISO2022CNEXT = 105,
200 UTF8 = 106,
201 ISO885913 = 109,
202 ISO885914 = 110,
203 ISO885915 = 111,
204 ISO885916 = 112,
205 GBK = 113,
206 GB18030 = 114,
207 OSDEBCDICDF0415 = 115,
208 OSDEBCDICDF03IRV = 116,
209 OSDEBCDICDF041 = 117,
210 ISO115481 = 118,
211 KZ1048 = 119,
212 UCS2 = 1000,
213 UCS4 = 1001,
214 UnicodeASCII = 1002,
215 UnicodeLatin1 = 1003,
216 UnicodeJapanese = 1004,
217 UnicodeIBM1261 = 1005,
218 UnicodeIBM1268 = 1006,
219 UnicodeIBM1276 = 1007,
220 UnicodeIBM1264 = 1008,
221 UnicodeIBM1265 = 1009,
222 Unicode11 = 1010,
223 SCSU = 1011,
224 UTF7 = 1012,
225 UTF16BE = 1013,
226 UTF16LE = 1014,
227 UTF16 = 1015,
228 CESU8 = 1016,
229 UTF32 = 1017,
230 UTF32BE = 1018,
231 UTF32LE = 1019,
232 BOCU1 = 1020,
233 UTF7IMAP = 1021,
234 Windows30Latin1 = 2000,
235 Windows31Latin1 = 2001,
236 Windows31Latin2 = 2002,
237 Windows31Latin5 = 2003,
238 HPRoman8 = 2004,
239 AdobeStandardEncoding = 2005,
240 VenturaUS = 2006,
241 VenturaInternational = 2007,
242 DECMCS = 2008,
243 PC850Multilingual = 2009,
244 PC8DanishNorwegian = 2012,
245 PC862LatinHebrew = 2013,
246 PC8Turkish = 2014,
247 IBMSymbols = 2015,
248 IBMThai = 2016,
249 HPLegal = 2017,
250 HPPiFont = 2018,
251 HPMath8 = 2019,
252 HPPSMath = 2020,
253 HPDesktop = 2021,
254 VenturaMath = 2022,
255 MicrosoftPublishing = 2023,
256 Windows31J = 2024,
257 GB2312 = 2025,
258 Big5 = 2026,
259 Macintosh = 2027,
260 IBM037 = 2028,
261 IBM038 = 2029,
262 IBM273 = 2030,
263 IBM274 = 2031,
264 IBM275 = 2032,
265 IBM277 = 2033,
266 IBM278 = 2034,
267 IBM280 = 2035,
268 IBM281 = 2036,
269 IBM284 = 2037,
270 IBM285 = 2038,
271 IBM290 = 2039,
272 IBM297 = 2040,
273 IBM420 = 2041,
274 IBM423 = 2042,
275 IBM424 = 2043,
276 PC8CodePage437 = 2011,
277 IBM500 = 2044,
278 IBM851 = 2045,
279 PCp852 = 2010,
280 IBM855 = 2046,
281 IBM857 = 2047,
282 IBM860 = 2048,
283 IBM861 = 2049,
284 IBM863 = 2050,
285 IBM864 = 2051,
286 IBM865 = 2052,
287 IBM868 = 2053,
288 IBM869 = 2054,
289 IBM870 = 2055,
290 IBM871 = 2056,
291 IBM880 = 2057,
292 IBM891 = 2058,
293 IBM903 = 2059,
294 IBM904 = 2060,
295 IBM905 = 2061,
296 IBM918 = 2062,
297 IBM1026 = 2063,
298 IBMEBCDICATDE = 2064,
299 EBCDICATDEA = 2065,
300 EBCDICCAFR = 2066,
301 EBCDICDKNO = 2067,
302 EBCDICDKNOA = 2068,
303 EBCDICFISE = 2069,
304 EBCDICFISEA = 2070,
305 EBCDICFR = 2071,
306 EBCDICIT = 2072,
307 EBCDICPT = 2073,
308 EBCDICES = 2074,
309 EBCDICESA = 2075,
310 EBCDICESS = 2076,
311 EBCDICUK = 2077,
312 EBCDICUS = 2078,
313 Unknown8BiT = 2079,
314 Mnemonic = 2080,
315 Mnem = 2081,
316 VISCII = 2082,
317 VIQR = 2083,
318 KOI8R = 2084,
319 HZGB2312 = 2085,
320 IBM866 = 2086,
321 PC775Baltic = 2087,
322 KOI8U = 2088,
323 IBM00858 = 2089,
324 IBM00924 = 2090,
325 IBM01140 = 2091,
326 IBM01141 = 2092,
327 IBM01142 = 2093,
328 IBM01143 = 2094,
329 IBM01144 = 2095,
330 IBM01145 = 2096,
331 IBM01146 = 2097,
332 IBM01147 = 2098,
333 IBM01148 = 2099,
334 IBM01149 = 2100,
335 Big5HKSCS = 2101,
336 IBM1047 = 2102,
337 PTCP154 = 2103,
338 Amiga1251 = 2104,
339 KOI7switched = 2105,
340 BRF = 2106,
341 TSCII = 2107,
342 CP51932 = 2108,
343 windows874 = 2109,
344 windows1250 = 2250,
345 windows1251 = 2251,
346 windows1252 = 2252,
347 windows1253 = 2253,
348 windows1254 = 2254,
349 windows1255 = 2255,
350 windows1256 = 2256,
351 windows1257 = 2257,
352 windows1258 = 2258,
353 TIS620 = 2259,
354 CP50220 = 2260
355 };
356
357private:
358 static constexpr int __nats_dano_ = 33;
359 static constexpr int __nats_dano_add_ = 34;
360
361 // A __te_data structure stores:
362 // Index into a table of offsets in the giant aliases string
363 // The MIB of that text encoding
364 // Number of aliases the current MIB holds
365 // We only need 6 bytes of information to store this information.
366
367 // The data is structured in three different locations:
368 // The mib table (array of __te_data)
369 // Aliases string
370 // Table of offsets into the aliases string
371
372 // All of the alias strings were transformed from an array of char* into one giant string split by '\0'.
373 // This allows us to reduce runtime memory footprint by not only removing the need to store ~884 pointers, it also
374 // significantly reduces the disk space taken by removing the need for relocation data for those pointers.
375 // We also know ahead of time that the total number of characters of all of these aliases combined can fit into 2
376 // bytes, so we can also save even more memory by using 2 byte offsets rather than a full pointer into the aliases
377 // string.
378
379 struct __te_data {
380 unsigned short __first_alias_index_;
381 unsigned short __mib_rep_;
382 unsigned char __num_aliases_;
383
384 friend constexpr bool operator<(const __te_data& __enc, id __i) noexcept {
385 return __enc.__mib_rep_ < static_cast<unsigned short>(__i);
386 }
387 };
388
389 static constexpr bool __comp_name(string_view __a, string_view __b) noexcept {
390 if (__a.empty() || __b.empty()) {
391 return false;
392 }
393
394 // Map any non-alphanumeric character to 255, skip prefix 0s, else get tolower(__n).
395 auto __map_char = [](char __n, bool& __in_number) -> unsigned char {
396 if (__n == '0') {
397 return __in_number ? '0' : 255;
398 }
399 __in_number = __n >= '1' && __n <= '9';
400
401 if ((__n >= '1' && __n <= '9') || (__n >= 'a' && __n <= 'z')) {
402 return __n;
403 }
404 if (__n >= 'A' && __n <= 'Z') {
405 return __n + ('a' - 'A'); // tolower
406 }
407
408 return 255;
409 };
410
411 auto __a_ptr = __a.begin(), __b_ptr = __b.begin();
412 bool __a_in_number = false, __b_in_number = false;
413
414 unsigned char __a_val = 255, __b_val = 255;
415 for (;; __a_ptr++, __b_ptr++) {
416 while (__a_ptr != __a.end() && (__a_val = __map_char(*__a_ptr, __a_in_number)) == 255)
417 __a_ptr++;
418 while (__b_ptr != __b.end() && (__b_val = __map_char(*__b_ptr, __b_in_number)) == 255)
419 __b_ptr++;
420
421 if (__a_ptr == __a.end())
422 return __b_ptr == __b.end();
423 if (__b_ptr == __b.end())
424 return false;
425 if (__a_val != __b_val)
426 return false;
427 }
428 return true;
429 }
430
431 static constexpr unsigned short __find_data_idx(string_view __a) noexcept {
432 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__a.size() <= max_name_length, "input string_view must have size <= 63");
433 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__a.contains('\0'), "input string_view must not contain '\\0'");
434
435 auto __pred = [&__a](const __te_data& __entry) -> bool {
436 // Search aliases of text encoding for string
437 aliases_view __aliases(__entry);
438 return std::find_if(__aliases.begin(), __aliases.end(), [&__a](auto __alias) {
439 return __comp_name(__a, __alias);
440 }) != __aliases.end();
441 };
442
443 const __te_data* __found = std::find_if(__entries + 2, std::end(__entries), __pred);
444 if (__found == std::end(__entries)) {
445 return __other_idx_; // other
446 }
447
448 return __found - __entries;
449 }
450
451 static constexpr unsigned short __find_data_idx_by_id(id __i) noexcept {
452 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i >= id::other, "invalid text_encoding::id passed");
453 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__i <= id::CP50220, "invalid text_encoding::id passed");
454 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __nats_dano_, "Mib for NATS-DANO used");
455 _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(int_least32_t(__i) != __nats_dano_add_, "Mib for NATS-DANO-ADD used");
456 auto __found = std::lower_bound(std::begin(__entries), std::end(__entries), __i);
457
458 if (__found == std::end(__entries)) {
459 return __unknown_idx_; // unknown
460 }
461
462 return __found - __entries;
463 }
464
465public:
466 using enum id;
467 static constexpr size_t max_name_length = 63;
468
469 // [text.encoding.aliases], class text_encoding::aliases_view
470 struct aliases_view : ranges::view_interface<aliases_view> {
471 struct __iterator {
472 using iterator_concept = random_access_iterator_tag;
473 using iterator_category = random_access_iterator_tag;
474 using value_type = const char*;
475 using reference = const char*;
476 using difference_type = int;
477
478 constexpr __iterator() noexcept = default;
479
480 [[nodiscard]] constexpr reference operator*() const noexcept {
481 return __get_alias_from_offset_table(__current_idx_);
482 }
483
484 [[nodiscard]] constexpr reference operator[](difference_type __n) const noexcept {
485 auto __it = *this;
486 return *(__it + __n);
487 }
488
489 [[nodiscard]] friend constexpr __iterator operator+(__iterator __it, difference_type __n) noexcept {
490 __it += __n;
491 return __it;
492 }
493
494 [[nodiscard]] friend constexpr __iterator operator+(difference_type __n, __iterator __it) noexcept {
495 __it += __n;
496 return __it;
497 }
498
499 [[nodiscard]] friend constexpr __iterator operator-(__iterator __it, difference_type __n) noexcept {
500 __it -= __n;
501 return __it;
502 }
503
504 [[nodiscard]] constexpr difference_type operator-(const __iterator& __other) const noexcept {
505 return __current_idx_ - __other.__current_idx_;
506 }
507
508 constexpr __iterator& operator++() noexcept {
509 __current_idx_++;
510 return *this;
511 }
512
513 constexpr __iterator operator++(int) noexcept {
514 auto __old = *this;
515 __current_idx_++;
516 return __old;
517 }
518
519 constexpr __iterator& operator--() noexcept {
520 __current_idx_--;
521 return *this;
522 }
523
524 constexpr __iterator operator--(int) noexcept {
525 auto __old = *this;
526 __current_idx_--;
527 return __old;
528 }
529
530 constexpr __iterator& operator+=(difference_type __n) noexcept {
531 __current_idx_ += __n;
532 return *this;
533 }
534
535 constexpr __iterator& operator-=(difference_type __n) noexcept { return (*this += -__n); }
536
537 friend constexpr auto operator<=>(const __iterator& __it, const __iterator& __it2) noexcept = default;
538
539 private:
540 friend struct aliases_view;
541
542 constexpr __iterator(unsigned short __enc_d) noexcept : __current_idx_(__enc_d) {}
543
544 unsigned short __current_idx_;
545 }; // __iterator
546
547 [[nodiscard]] constexpr __iterator begin() const noexcept { return __iterator(__first_idx_); }
548
549 [[nodiscard]] constexpr __iterator end() const noexcept { return __iterator(__last_idx_); }
550
551 private:
552 friend struct text_encoding;
553
554 constexpr aliases_view(const __te_data& __d)
555 : __first_idx_(__d.__first_alias_index_), __last_idx_(__d.__first_alias_index_ + __d.__num_aliases_) {}
556
557 unsigned short __first_idx_;
558 unsigned short __last_idx_;
559 }; // aliases_view
560
561 constexpr text_encoding() = default;
562
563 constexpr explicit text_encoding(string_view __enc) noexcept : __encoding_idx_(__find_data_idx(__enc)) {
564 __enc.copy(__name_, max_name_length, 0);
565 }
566
567 constexpr text_encoding(id __i) noexcept : __encoding_idx_(__find_data_idx_by_id(__i)) {
568 const char* __alias = __get_alias_from_offset_table(__get().__first_alias_index_);
569 if (__alias[0] != '\0') {
570 string_view(__alias).copy(__name_, max_name_length);
571 }
572 }
573
574 [[nodiscard]] constexpr id mib() const noexcept { return id(__get().__mib_rep_); }
575
576 [[nodiscard]] constexpr const char* name() const noexcept { return __name_; }
577
578 [[nodiscard]] constexpr aliases_view aliases() const noexcept { return aliases_view(__get()); }
579
580 friend constexpr bool operator==(const text_encoding& __a, const text_encoding& __b) noexcept {
581 return __a.mib() == id::other && __b.mib() == id::other
582 ? __comp_name(__a.__name_, __b.__name_)
583 : __a.mib() == __b.mib();
584 }
585
586 friend constexpr bool operator==(const text_encoding& __encoding, id __i) noexcept { return __encoding.mib() == __i; }
587
588 [[nodiscard]] static consteval text_encoding literal() noexcept {
589 // TODO: Remove this branch once we have __GNUC_EXECUTION_CHARSET_NAME or __clang_literal_encoding__ unconditionally
590# ifdef __GNUC_EXECUTION_CHARSET_NAME
591 return text_encoding(__GNUC_EXECUTION_CHARSET_NAME);
592# elif defined(__clang_literal_encoding__)
593 return text_encoding(__clang_literal_encoding__);
594# else
595 return text_encoding();
596# endif
597 }
598
599# if _LIBCPP_HAS_LOCALIZATION
600 [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT static text_encoding environment() {
601# if defined(_LIBCPP_WIN32API)
602 return __get_locale_encoding(nullptr);
603# else
604 return __get_locale_encoding("");
605# endif
606 }
607
608 template <id _Id>
609 [[nodiscard]] _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT static bool environment_is() {
610 // TODO: It may be worthwhile to implement an optimization for popular encodings, e.g. UTF-8,
611 // to allow checking the environment text encoding without needing to use the data tables.
612
613# if defined(__ANDROID__)
614 return _Id == std::text_encoding::id::UTF8;
615# else
616 return environment() == _Id;
617# endif
618 }
619# else
620 static text_encoding environment() = delete;
621
622 template <id>
623 static bool environment_is() = delete;
624# endif
625
626private:
627 constexpr const __te_data& __get() const { return __entries[__encoding_idx_]; }
628
629 static constexpr char const* __get_alias_from_offset_table(unsigned short __idx) {
630 return __aliases_string + __alias_offsets.__table[__idx];
631 }
632
633 static constexpr auto __other_idx_ = 0u;
634 static constexpr auto __unknown_idx_ = 1u;
635
636 char __name_[max_name_length + 1]{};
637 unsigned short __encoding_idx_{1u};
638
639 static constexpr __te_data __entries[] = {
640 {0, 1, 0}, {1, 2, 0}, {2, 3, 11}, {13, 4, 9}, {22, 5, 7}, {29, 6, 7}, {36, 7, 7},
641 {43, 8, 6}, {49, 9, 8}, {57, 10, 9}, {66, 11, 6}, {72, 12, 7}, {79, 13, 6}, {85, 14, 3},
642 {88, 15, 3}, {91, 16, 2}, {93, 17, 3}, {96, 18, 3}, {99, 19, 2}, {101, 20, 6}, {107, 21, 5},
643 {112, 22, 4}, {116, 23, 4}, {120, 24, 5}, {125, 25, 6}, {131, 26, 5}, {136, 27, 2}, {138, 28, 3},
644 {141, 29, 2}, {143, 30, 4}, {147, 31, 3}, {150, 32, 3}, {153, 35, 7}, {160, 36, 6}, {166, 37, 2},
645 {168, 38, 2}, {170, 39, 2}, {172, 40, 2}, {174, 41, 6}, {180, 42, 5}, {185, 43, 4}, {189, 44, 3},
646 {192, 45, 3}, {195, 46, 4}, {199, 47, 3}, {202, 48, 3}, {205, 49, 3}, {208, 50, 3}, {211, 51, 3},
647 {214, 52, 3}, {217, 53, 3}, {220, 54, 4}, {224, 55, 3}, {227, 56, 5}, {232, 57, 4}, {236, 58, 5},
648 {241, 59, 3}, {244, 60, 4}, {248, 61, 4}, {252, 62, 5}, {257, 63, 5}, {262, 64, 3}, {265, 65, 5},
649 {270, 66, 2}, {272, 67, 4}, {276, 68, 5}, {281, 69, 4}, {285, 70, 4}, {289, 71, 4}, {293, 72, 3},
650 {296, 73, 4}, {300, 74, 5}, {305, 75, 3}, {308, 76, 4}, {312, 77, 4}, {316, 78, 7}, {323, 79, 6},
651 {329, 80, 3}, {332, 81, 3}, {335, 82, 3}, {338, 83, 3}, {341, 84, 3}, {344, 85, 3}, {347, 86, 3},
652 {350, 87, 6}, {356, 88, 3}, {359, 89, 4}, {363, 90, 4}, {367, 91, 4}, {371, 92, 5}, {376, 93, 3},
653 {379, 94, 4}, {383, 95, 4}, {387, 96, 3}, {390, 97, 4}, {394, 98, 4}, {398, 99, 5}, {403, 100, 2},
654 {405, 101, 2}, {407, 102, 3}, {410, 103, 2}, {412, 104, 2}, {414, 105, 2}, {416, 106, 2}, {418, 109, 2},
655 {420, 110, 8}, {428, 111, 4}, {432, 112, 7}, {439, 113, 5}, {444, 114, 2}, {446, 115, 2}, {448, 116, 2},
656 {450, 117, 2}, {452, 118, 4}, {456, 119, 4}, {460, 1000, 2}, {462, 1001, 2}, {464, 1002, 2}, {466, 1003, 3},
657 {469, 1004, 2}, {471, 1005, 2}, {473, 1006, 2}, {475, 1007, 2}, {477, 1008, 2}, {479, 1009, 2}, {481, 1010, 2},
658 {483, 1011, 2}, {485, 1012, 2}, {487, 1013, 2}, {489, 1014, 2}, {491, 1015, 2}, {493, 1016, 3}, {496, 1017, 2},
659 {498, 1018, 2}, {500, 1019, 2}, {502, 1020, 3}, {505, 1021, 2}, {507, 2000, 2}, {509, 2001, 2}, {511, 2002, 2},
660 {513, 2003, 2}, {515, 2004, 4}, {519, 2005, 2}, {521, 2006, 2}, {523, 2007, 2}, {525, 2008, 3}, {528, 2009, 4},
661 {532, 2010, 4}, {536, 2011, 4}, {540, 2012, 2}, {542, 2013, 4}, {546, 2014, 2}, {548, 2015, 2}, {550, 2016, 2},
662 {552, 2017, 2}, {554, 2018, 2}, {556, 2019, 2}, {558, 2020, 2}, {560, 2021, 2}, {562, 2022, 2}, {564, 2023, 2},
663 {566, 2024, 2}, {568, 2025, 2}, {570, 2026, 2}, {572, 2027, 3}, {575, 2028, 7}, {582, 2029, 4}, {586, 2030, 3},
664 {589, 2031, 4}, {593, 2032, 4}, {597, 2033, 4}, {601, 2034, 5}, {606, 2035, 4}, {610, 2036, 4}, {614, 2037, 4},
665 {618, 2038, 4}, {622, 2039, 4}, {626, 2040, 4}, {630, 2041, 4}, {634, 2042, 4}, {638, 2043, 4}, {642, 2044, 5},
666 {647, 2045, 4}, {651, 2046, 4}, {655, 2047, 4}, {659, 2048, 4}, {663, 2049, 5}, {668, 2050, 4}, {672, 2051, 3},
667 {675, 2052, 4}, {679, 2053, 4}, {683, 2054, 5}, {688, 2055, 5}, {693, 2056, 4}, {697, 2057, 4}, {701, 2058, 3},
668 {704, 2059, 3}, {707, 2060, 4}, {711, 2061, 4}, {715, 2062, 4}, {719, 2063, 3}, {722, 2064, 2}, {724, 2065, 2},
669 {726, 2066, 2}, {728, 2067, 2}, {730, 2068, 2}, {732, 2069, 2}, {734, 2070, 2}, {736, 2071, 2}, {738, 2072, 2},
670 {740, 2073, 2}, {742, 2074, 2}, {744, 2075, 2}, {746, 2076, 2}, {748, 2077, 2}, {750, 2078, 2}, {752, 2079, 2},
671 {754, 2080, 2}, {756, 2081, 2}, {758, 2082, 2}, {760, 2083, 2}, {762, 2084, 2}, {764, 2085, 1}, {765, 2086, 4},
672 {769, 2087, 3}, {772, 2088, 2}, {774, 2089, 5}, {779, 2090, 5}, {784, 2091, 5}, {789, 2092, 5}, {794, 2093, 6},
673 {800, 2094, 6}, {806, 2095, 5}, {811, 2096, 5}, {816, 2097, 5}, {821, 2098, 5}, {826, 2099, 5}, {831, 2100, 5},
674 {836, 2101, 2}, {838, 2102, 3}, {841, 2103, 5}, {846, 2104, 5}, {851, 2105, 2}, {853, 2106, 2}, {855, 2107, 2},
675 {857, 2108, 2}, {859, 2109, 2}, {861, 2250, 2}, {863, 2251, 2}, {865, 2252, 2}, {867, 2253, 2}, {869, 2254, 2},
676 {871, 2255, 2}, {873, 2256, 2}, {875, 2257, 2}, {877, 2258, 2}, {879, 2259, 3}, {882, 2260, 2}};
677
678 static constexpr char __aliases_string[] =
679 "US-ASCII\0iso-ir-6\0ANSI_X3.4-1968\0ANSI_X3.4-1986\0ISO_646.irv:1991\0ISO646-"
680 "US\0us\0IBM367\0cp367\0csASCII\0ASCII\0ISO_8859-1:1987\0iso-ir-100\0ISO_8859-1\0ISO-8859-"
681 "1\0latin1\0l1\0IBM819\0CP819\0csISOLatin1\0ISO_8859-2:1987\0iso-ir-101\0ISO_8859-2\0ISO-8859-"
682 "2\0latin2\0l2\0csISOLatin2\0ISO_8859-3:1988\0iso-ir-109\0ISO_8859-3\0ISO-8859-3\0latin3\0l3\0csISOLatin3\0ISO_"
683 "8859-4:1988\0iso-ir-110\0ISO_8859-4\0ISO-8859-4\0latin4\0l4\0csISOLatin4\0ISO_8859-5:1988\0iso-ir-144\0ISO_8859-"
684 "5\0ISO-8859-5\0cyrillic\0csISOLatinCyrillic\0ISO_8859-6:1987\0iso-ir-127\0ISO_8859-6\0ISO-8859-6\0ECMA-"
685 "114\0ASMO-708\0arabic\0csISOLatinArabic\0ISO_8859-7:1987\0iso-ir-126\0ISO_8859-7\0ISO-8859-7\0ELOT_928\0ECMA-"
686 "118\0greek\0greek8\0csISOLatinGreek\0ISO_8859-8:1988\0iso-ir-138\0ISO_8859-8\0ISO-8859-"
687 "8\0hebrew\0csISOLatinHebrew\0ISO_8859-9:1989\0iso-ir-148\0ISO_8859-9\0ISO-8859-9\0latin5\0l5\0csISOLatin5\0ISO-"
688 "8859-10\0iso-ir-157\0l6\0ISO_8859-10:1992\0csISOLatin6\0latin6\0ISO_6937-2-add\0iso-ir-142\0csISOTextComm\0JIS_"
689 "X0201\0X0201\0csHalfWidthKatakana\0JIS_Encoding\0csJISEncoding\0Shift_JIS\0MS_Kanji\0csShiftJIS\0Extended_UNIX_"
690 "Code_Packed_Format_for_Japanese\0csEUCPkdFmtJapanese\0EUC-JP\0Extended_UNIX_Code_Fixed_Width_for_"
691 "Japanese\0csEUCFixWidJapanese\0BS_4730\0iso-ir-4\0ISO646-GB\0gb\0uk\0csISO4UnitedKingdom\0SEN_850200_C\0iso-ir-"
692 "11\0ISO646-SE2\0se2\0csISO11SwedishForNames\0IT\0iso-ir-15\0ISO646-IT\0csISO15Italian\0ES\0iso-ir-17\0ISO646-"
693 "ES\0csISO17Spanish\0DIN_66003\0iso-ir-21\0de\0ISO646-DE\0csISO21German\0NS_4551-1\0iso-ir-60\0ISO646-"
694 "NO\0no\0csISO60DanishNorwegian\0csISO60Norwegian1\0NF_Z_62-010\0iso-ir-69\0ISO646-FR\0fr\0csISO69French\0ISO-"
695 "10646-UTF-1\0csISO10646UTF1\0ISO_646.basic:1983\0ref\0csISO646basic1983\0INVARIANT\0csINVARIANT\0ISO_646.irv:"
696 "1983\0iso-ir-2\0irv\0csISO2IntlRefVersion\0NATS-SEFI\0iso-ir-8-1\0csNATSSEFI\0NATS-SEFI-ADD\0iso-ir-8-"
697 "2\0csNATSSEFIADD\0SEN_850200_B\0iso-ir-10\0FI\0ISO646-FI\0ISO646-SE\0se\0csISO10Swedish\0KS_C_5601-1987\0iso-ir-"
698 "149\0KS_C_5601-1989\0KSC_5601\0korean\0csKSC56011987\0ISO-2022-KR\0csISO2022KR\0EUC-KR\0csEUCKR\0ISO-2022-"
699 "JP\0csISO2022JP\0ISO-2022-JP-2\0csISO2022JP2\0JIS_C6220-1969-jp\0JIS_C6220-1969\0iso-ir-13\0katakana\0x0201-"
700 "7\0csISO13JISC6220jp\0JIS_C6220-1969-ro\0iso-ir-14\0jp\0ISO646-JP\0csISO14JISC6220ro\0PT\0iso-ir-16\0ISO646-"
701 "PT\0csISO16Portuguese\0greek7-old\0iso-ir-18\0csISO18Greek7Old\0latin-greek\0iso-ir-19\0csISO19LatinGreek\0NF_Z_"
702 "62-010_(1973)\0iso-ir-25\0ISO646-FR1\0csISO25French\0Latin-greek-1\0iso-ir-27\0csISO27LatinGreek1\0ISO_"
703 "5427\0iso-ir-37\0csISO5427Cyrillic\0JIS_C6226-1978\0iso-ir-42\0csISO42JISC62261978\0BS_viewdata\0iso-ir-"
704 "47\0csISO47BSViewdata\0INIS\0iso-ir-49\0csISO49INIS\0INIS-8\0iso-ir-50\0csISO50INIS8\0INIS-cyrillic\0iso-ir-"
705 "51\0csISO51INISCyrillic\0ISO_5427:1981\0iso-ir-54\0ISO5427Cyrillic1981\0csISO54271981\0ISO_5428:1980\0iso-ir-"
706 "55\0csISO5428Greek\0GB_1988-80\0iso-ir-57\0cn\0ISO646-CN\0csISO57GB1988\0GB_2312-80\0iso-ir-"
707 "58\0chinese\0csISO58GB231280\0NS_4551-2\0ISO646-NO2\0iso-ir-61\0no2\0csISO61Norwegian2\0videotex-suppl\0iso-ir-"
708 "70\0csISO70VideotexSupp1\0PT2\0iso-ir-84\0ISO646-PT2\0csISO84Portuguese2\0ES2\0iso-ir-85\0ISO646-"
709 "ES2\0csISO85Spanish2\0MSZ_7795.3\0iso-ir-86\0ISO646-HU\0hu\0csISO86Hungarian\0JIS_C6226-1983\0iso-ir-"
710 "87\0x0208\0JIS_X0208-1983\0csISO87JISX0208\0greek7\0iso-ir-88\0csISO88Greek7\0ASMO_449\0ISO_9036\0arabic7\0iso-"
711 "ir-89\0csISO89ASMO449\0iso-ir-90\0csISO90\0JIS_C6229-1984-a\0iso-ir-91\0jp-ocr-a\0csISO91JISC62291984a\0JIS_"
712 "C6229-1984-b\0iso-ir-92\0ISO646-JP-OCR-B\0jp-ocr-b\0csISO92JISC62991984b\0JIS_C6229-1984-b-add\0iso-ir-93\0jp-"
713 "ocr-b-add\0csISO93JIS62291984badd\0JIS_C6229-1984-hand\0iso-ir-94\0jp-ocr-hand\0csISO94JIS62291984hand\0JIS_"
714 "C6229-1984-hand-add\0iso-ir-95\0jp-ocr-hand-add\0csISO95JIS62291984handadd\0JIS_C6229-1984-kana\0iso-ir-"
715 "96\0csISO96JISC62291984kana\0ISO_2033-1983\0iso-ir-98\0e13b\0csISO2033\0ANSI_X3.110-1983\0iso-ir-99\0CSA_T500-"
716 "1983\0NAPLPS\0csISO99NAPLPS\0T.61-7bit\0iso-ir-102\0csISO102T617bit\0T.61-8bit\0T.61\0iso-ir-"
717 "103\0csISO103T618bit\0ECMA-cyrillic\0iso-ir-111\0KOI8-E\0csISO111ECMACyrillic\0CSA_Z243.4-1985-1\0iso-ir-"
718 "121\0ISO646-CA\0csa7-1\0csa71\0ca\0csISO121Canadian1\0CSA_Z243.4-1985-2\0iso-ir-122\0ISO646-CA2\0csa7-"
719 "2\0csa72\0csISO122Canadian2\0CSA_Z243.4-1985-gr\0iso-ir-123\0csISO123CSAZ24341985gr\0ISO_8859-6-"
720 "E\0csISO88596E\0ISO-8859-6-E\0ISO_8859-6-I\0csISO88596I\0ISO-8859-6-I\0T.101-G2\0iso-ir-"
721 "128\0csISO128T101G2\0ISO_8859-8-E\0csISO88598E\0ISO-8859-8-E\0ISO_8859-8-I\0csISO88598I\0ISO-8859-8-I\0CSN_"
722 "369103\0iso-ir-139\0csISO139CSN369103\0JUS_I.B1.002\0iso-ir-141\0ISO646-YU\0js\0yu\0csISO141JUSIB1002\0IEC_P27-"
723 "1\0iso-ir-143\0csISO143IECP271\0JUS_I.B1.003-serb\0iso-ir-146\0serbian\0csISO146Serbian\0JUS_I.B1.003-"
724 "mac\0macedonian\0iso-ir-147\0csISO147Macedonian\0greek-ccitt\0iso-ir-150\0csISO150\0csISO150GreekCCITT\0NC_NC00-"
725 "10:81\0cuba\0iso-ir-151\0ISO646-CU\0csISO151Cuba\0ISO_6937-2-25\0iso-ir-152\0csISO6937Add\0GOST_19768-74\0ST_"
726 "SEV_358-88\0iso-ir-153\0csISO153GOST1976874\0ISO_8859-supp\0iso-ir-154\0latin1-2-5\0csISO8859Supp\0ISO_10367-"
727 "box\0iso-ir-155\0csISO10367Box\0latin-lap\0lap\0iso-ir-158\0csISO158Lap\0JIS_X0212-1990\0x0212\0iso-ir-"
728 "159\0csISO159JISX02121990\0DS_2089\0DS2089\0ISO646-DK\0dk\0csISO646Danish\0us-dk\0csUSDK\0dk-"
729 "us\0csDKUS\0KSC5636\0ISO646-KR\0csKSC5636\0UNICODE-1-1-UTF-7\0csUnicode11UTF7\0ISO-2022-CN\0csISO2022CN\0ISO-"
730 "2022-CN-EXT\0csISO2022CNEXT\0UTF-8\0csUTF8\0ISO-8859-13\0csISO885913\0ISO-8859-14\0iso-ir-199\0ISO_8859-14:"
731 "1998\0ISO_8859-14\0latin8\0iso-celtic\0l8\0csISO885914\0ISO-8859-15\0ISO_8859-15\0Latin-9\0csISO885915\0ISO-"
732 "8859-16\0iso-ir-226\0ISO_8859-16:2001\0ISO_8859-16\0latin10\0l10\0csISO885916\0GBK\0CP936\0MS936\0windows-"
733 "936\0csGBK\0GB18030\0csGB18030\0OSD_EBCDIC_DF04_15\0csOSDEBCDICDF0415\0OSD_EBCDIC_DF03_"
734 "IRV\0csOSDEBCDICDF03IRV\0OSD_EBCDIC_DF04_1\0csOSDEBCDICDF041\0ISO-11548-1\0ISO_11548-1\0ISO_TR_11548-"
735 "1\0csISO115481\0KZ-1048\0STRK1048-2002\0RK1048\0csKZ1048\0ISO-10646-UCS-2\0csUnicode\0ISO-10646-UCS-"
736 "4\0csUCS4\0ISO-10646-UCS-Basic\0csUnicodeASCII\0ISO-10646-Unicode-Latin1\0csUnicodeLatin1\0ISO-10646\0ISO-10646-"
737 "J-1\0csUnicodeJapanese\0ISO-Unicode-IBM-1261\0csUnicodeIBM1261\0ISO-Unicode-IBM-1268\0csUnicodeIBM1268\0ISO-"
738 "Unicode-IBM-1276\0csUnicodeIBM1276\0ISO-Unicode-IBM-1264\0csUnicodeIBM1264\0ISO-Unicode-IBM-"
739 "1265\0csUnicodeIBM1265\0UNICODE-1-1\0csUnicode11\0SCSU\0csSCSU\0UTF-7\0csUTF7\0UTF-16BE\0csUTF16BE\0UTF-"
740 "16LE\0csUTF16LE\0UTF-16\0csUTF16\0CESU-8\0csCESU8\0csCESU-8\0UTF-32\0csUTF32\0UTF-32BE\0csUTF32BE\0UTF-"
741 "32LE\0csUTF32LE\0BOCU-1\0csBOCU1\0csBOCU-1\0UTF-7-IMAP\0csUTF7IMAP\0ISO-8859-1-Windows-3.0-Latin-"
742 "1\0csWindows30Latin1\0ISO-8859-1-Windows-3.1-Latin-1\0csWindows31Latin1\0ISO-8859-2-Windows-Latin-"
743 "2\0csWindows31Latin2\0ISO-8859-9-Windows-Latin-5\0csWindows31Latin5\0hp-roman8\0roman8\0r8\0csHPRoman8\0Adobe-"
744 "Standard-Encoding\0csAdobeStandardEncoding\0Ventura-US\0csVenturaUS\0Ventura-"
745 "International\0csVenturaInternational\0DEC-"
746 "MCS\0dec\0csDECMCS\0IBM850\0cp850\0850\0csPC850Multilingual\0IBM852\0cp852\0852\0csPCp852\0IBM437\0cp437\0"
747 "437\0csPC8CodePage437\0PC8-Danish-Norwegian\0csPC8DanishNorwegian\0IBM862\0cp862\0862\0csPC862LatinHebrew\0PC8-"
748 "Turkish\0csPC8Turkish\0IBM-Symbols\0csIBMSymbols\0IBM-Thai\0csIBMThai\0HP-Legal\0csHPLegal\0HP-Pi-"
749 "font\0csHPPiFont\0HP-Math8\0csHPMath8\0Adobe-Symbol-Encoding\0csHPPSMath\0HP-DeskTop\0csHPDesktop\0Ventura-"
750 "Math\0csVenturaMath\0Microsoft-Publishing\0csMicrosoftPublishing\0Windows-"
751 "31J\0csWindows31J\0GB2312\0csGB2312\0Big5\0csBig5\0macintosh\0mac\0csMacintosh\0IBM037\0cp037\0ebcdic-cp-"
752 "us\0ebcdic-cp-ca\0ebcdic-cp-wt\0ebcdic-cp-nl\0csIBM037\0IBM038\0EBCDIC-"
753 "INT\0cp038\0csIBM038\0IBM273\0CP273\0csIBM273\0IBM274\0EBCDIC-BE\0CP274\0csIBM274\0IBM275\0EBCDIC-"
754 "BR\0cp275\0csIBM275\0IBM277\0EBCDIC-CP-DK\0EBCDIC-CP-NO\0csIBM277\0IBM278\0CP278\0ebcdic-cp-fi\0ebcdic-cp-"
755 "se\0csIBM278\0IBM280\0CP280\0ebcdic-cp-it\0csIBM280\0IBM281\0EBCDIC-JP-"
756 "E\0cp281\0csIBM281\0IBM284\0CP284\0ebcdic-cp-es\0csIBM284\0IBM285\0CP285\0ebcdic-cp-"
757 "gb\0csIBM285\0IBM290\0cp290\0EBCDIC-JP-kana\0csIBM290\0IBM297\0cp297\0ebcdic-cp-"
758 "fr\0csIBM297\0IBM420\0cp420\0ebcdic-cp-ar1\0csIBM420\0IBM423\0cp423\0ebcdic-cp-"
759 "gr\0csIBM423\0IBM424\0cp424\0ebcdic-cp-he\0csIBM424\0IBM500\0CP500\0ebcdic-cp-be\0ebcdic-cp-"
760 "ch\0csIBM500\0IBM851\0cp851\0851\0csIBM851\0IBM855\0cp855\0855\0csIBM855\0IBM857\0cp857\0857\0csIBM857\0IBM860\0"
761 "cp860\0860\0csIBM860\0IBM861\0cp861\0861\0cp-"
762 "is\0csIBM861\0IBM863\0cp863\0863\0csIBM863\0IBM864\0cp864\0csIBM864\0IBM865\0cp865\0865\0csIBM865\0IBM868\0CP868"
763 "\0cp-ar\0csIBM868\0IBM869\0cp869\0869\0cp-gr\0csIBM869\0IBM870\0CP870\0ebcdic-cp-roece\0ebcdic-cp-"
764 "yu\0csIBM870\0IBM871\0CP871\0ebcdic-cp-is\0csIBM871\0IBM880\0cp880\0EBCDIC-"
765 "Cyrillic\0csIBM880\0IBM891\0cp891\0csIBM891\0IBM903\0cp903\0csIBM903\0IBM904\0cp904\0904\0csIBBM904\0IBM905\0CP9"
766 "05\0ebcdic-cp-tr\0csIBM905\0IBM918\0CP918\0ebcdic-cp-ar2\0csIBM918\0IBM1026\0CP1026\0csIBM1026\0EBCDIC-AT-"
767 "DE\0csIBMEBCDICATDE\0EBCDIC-AT-DE-A\0csEBCDICATDEA\0EBCDIC-CA-FR\0csEBCDICCAFR\0EBCDIC-DK-"
768 "NO\0csEBCDICDKNO\0EBCDIC-DK-NO-A\0csEBCDICDKNOA\0EBCDIC-FI-SE\0csEBCDICFISE\0EBCDIC-FI-SE-"
769 "A\0csEBCDICFISEA\0EBCDIC-FR\0csEBCDICFR\0EBCDIC-IT\0csEBCDICIT\0EBCDIC-PT\0csEBCDICPT\0EBCDIC-"
770 "ES\0csEBCDICES\0EBCDIC-ES-A\0csEBCDICESA\0EBCDIC-ES-S\0csEBCDICESS\0EBCDIC-UK\0csEBCDICUK\0EBCDIC-"
771 "US\0csEBCDICUS\0UNKNOWN-"
772 "8BIT\0csUnknown8BiT\0MNEMONIC\0csMnemonic\0MNEM\0csMnem\0VISCII\0csVISCII\0VIQR\0csVIQR\0KOI8-R\0csKOI8R\0HZ-GB-"
773 "2312\0IBM866\0cp866\0866\0csIBM866\0IBM775\0cp775\0csPC775Baltic\0KOI8-"
774 "U\0csKOI8U\0IBM00858\0CCSID00858\0CP00858\0PC-Multilingual-850+"
775 "euro\0csIBM00858\0IBM00924\0CCSID00924\0CP00924\0ebcdic-Latin9--"
776 "euro\0csIBM00924\0IBM01140\0CCSID01140\0CP01140\0ebcdic-us-37+"
777 "euro\0csIBM01140\0IBM01141\0CCSID01141\0CP01141\0ebcdic-de-273+"
778 "euro\0csIBM01141\0IBM01142\0CCSID01142\0CP01142\0ebcdic-dk-277+euro\0ebcdic-no-277+"
779 "euro\0csIBM01142\0IBM01143\0CCSID01143\0CP01143\0ebcdic-fi-278+euro\0ebcdic-se-278+"
780 "euro\0csIBM01143\0IBM01144\0CCSID01144\0CP01144\0ebcdic-it-280+"
781 "euro\0csIBM01144\0IBM01145\0CCSID01145\0CP01145\0ebcdic-es-284+"
782 "euro\0csIBM01145\0IBM01146\0CCSID01146\0CP01146\0ebcdic-gb-285+"
783 "euro\0csIBM01146\0IBM01147\0CCSID01147\0CP01147\0ebcdic-fr-297+"
784 "euro\0csIBM01147\0IBM01148\0CCSID01148\0CP01148\0ebcdic-international-500+"
785 "euro\0csIBM01148\0IBM01149\0CCSID01149\0CP01149\0ebcdic-is-871+euro\0csIBM01149\0Big5-"
786 "HKSCS\0csBig5HKSCS\0IBM1047\0IBM-1047\0csIBM1047\0PTCP154\0csPTCP154\0PT154\0CP154\0Cyrillic-Asian\0Amiga-"
787 "1251\0Ami1251\0Amiga1251\0Ami-1251\0csAmiga1251\0KOI7-"
788 "switched\0csKOI7switched\0BRF\0csBRF\0TSCII\0csTSCII\0CP51932\0csCP51932\0windows-874\0cswindows874\0windows-"
789 "1250\0cswindows1250\0windows-1251\0cswindows1251\0windows-1252\0cswindows1252\0windows-"
790 "1253\0cswindows1253\0windows-1254\0cswindows1254\0windows-1255\0cswindows1255\0windows-"
791 "1256\0cswindows1256\0windows-1257\0cswindows1257\0windows-1258\0cswindows1258\0TIS-620\0csTIS620\0ISO-8859-"
792 "11\0CP50220\0csCP50220\0";
793
794 struct __offset_table {
795 constexpr static unsigned long long __num_aliases =
796 std::count(__aliases_string, __aliases_string + sizeof(__aliases_string), '\0') + 1;
797 unsigned short __table[__num_aliases];
798 };
799
800 static constexpr __offset_table __alias_offsets = [] {
801 __offset_table __aliases{};
802 __aliases.__table[0] = sizeof(__aliases_string) - 1;
803 __aliases.__table[1] = sizeof(__aliases_string) - 1;
804 __aliases.__table[2] = 0;
805
806 unsigned long long __idx = 3;
807
808 for (unsigned short __pos = 0; __pos < sizeof(__aliases_string) - 1 && __idx < __offset_table::__num_aliases;
809 __pos++) {
810 if (__aliases_string[__pos] == '\0') {
811 __aliases.__table[__idx++] = __pos + 1;
812 }
813 }
814
815 return __aliases;
816 }();
817};
818
819template <>
820struct hash<text_encoding> {
821 [[nodiscard]] static size_t operator()(const text_encoding& __enc) noexcept {
822 return std::hash<std::text_encoding::id>()(__enc.mib());
823 }
824};
825
826template <>
827inline constexpr bool ranges::enable_borrowed_range<text_encoding::aliases_view> = true;
828
829_LIBCPP_END_NAMESPACE_STD
830
831# endif // _LIBCPP_STD_VER >= 26
832
833#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
834
835#endif // _LIBCPP_TEXT_ENCODING
lib/libcxx/include/thread+13-7
......@@ -91,6 +91,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
9191#else
9292# include <__config>
9393
94// standard-mandated includes
95
96// [thread.syn]
97# include <compare>
98
9499# if _LIBCPP_HAS_THREADS
95100
96101# include <__thread/this_thread.h>
......@@ -106,28 +111,29 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
106111
107112# include <version>
108113
109// standard-mandated includes
110
111// [thread.syn]
112# include <compare>
113
114114# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
115115# pragma GCC system_header
116116# endif
117117
118118# endif // _LIBCPP_HAS_THREADS
119119
120# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
120# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 17
121121# include <chrono>
122122# endif
123123
124# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
124# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
125125# include <cstring>
126126# include <functional>
127127# include <new>
128128# include <system_error>
129129# include <type_traits>
130130# endif
131
132# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
133# include <atomic>
134# include <sstream>
135# endif
136
131137#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
132138
133139#endif // _LIBCPP_THREAD
lib/libcxx/include/tuple+53-65
......@@ -255,7 +255,6 @@ template <class... Types>
255255# include <__type_traits/is_same.h>
256256# include <__type_traits/is_swappable.h>
257257# include <__type_traits/is_trivially_relocatable.h>
258# include <__type_traits/lazy.h>
259258# include <__type_traits/maybe_const.h>
260259# include <__type_traits/nat.h>
261260# include <__type_traits/negation.h>
......@@ -284,10 +283,10 @@ template <class... Types>
284283_LIBCPP_PUSH_MACROS
285284# include <__undef_macros>
286285
287_LIBCPP_BEGIN_NAMESPACE_STD
288
289286# ifndef _LIBCPP_CXX03_LANG
290287
288_LIBCPP_BEGIN_NAMESPACE_STD
289
291290template <size_t _Ip, class _Tp, class _Up>
292291_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(const _Tp& __x, const _Up& __y) {
293292 if constexpr (_Ip == 0)
......@@ -296,20 +295,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool __tuple_compare_equal(c
296295 return std::__tuple_compare_equal<_Ip - 1>(__x, __y) && std::get<_Ip - 1>(__x) == std::get<_Ip - 1>(__y);
297296}
298297
299# if _LIBCPP_STD_VER >= 26
300template <class _Tp, class _Up, class _IndexSeq = make_index_sequence<tuple_size_v<_Tp>>>
301inline constexpr bool __can_tuple_compare_equal = false;
302
303// TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends
304// because the resolution of CWG2369 landed in LLVM-21.
305template <class _Tp, class _Up, size_t... _Is>
306 requires(tuple_size_v<_Tp> == tuple_size_v<_Up>)
307inline constexpr bool __can_tuple_compare_equal<_Tp, _Up, index_sequence<_Is...>> =
308 __all<requires(const tuple_element_t<_Is, _Tp>& __t, const tuple_element_t<_Is, _Up>& __u) {
309 { __t == __u } -> __boolean_testable;
310 }...>::value;
311# endif // _LIBCPP_STD_VER >= 26
312
313298# if _LIBCPP_STD_VER >= 20
314299template <class _Ret, class _Tp, class _Up, size_t... _Is>
315300_LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, const _Up& __y, index_sequence<_Is...>) {
......@@ -324,24 +309,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ret __tuple_compare_three_way(const _Tp& __x, c
324309template <class _Tp>
325310concept __tuple_like_no_tuple = __tuple_like<_Tp> && !__is_tuple_v<_Tp>;
326311
327template <class _Tp, class _Up, class _IndexSeq>
328struct __tuple_common_comparison_category_impl {};
312template <__tuple_like _Tp, class _IndexSequence = make_index_sequence<tuple_size_v<_Tp>>>
313struct __to_tuple;
329314
330// TODO(LLVM 23): Remove `tuple_size_v<_Tp> == tuple_size_v<_Up>` here once once LLVM-20 support ends
331// because the resolution of CWG2369 landed in LLVM-21.
332template <class _Tp, class _Up, size_t... _Is>
333 requires(tuple_size_v<_Tp> == tuple_size_v<_Up>) && requires {
334 typename common_comparison_category_t<
335 __synth_three_way_result<tuple_element_t<_Is, _Tp>, tuple_element_t<_Is, _Up>>...>;
336 }
337struct __tuple_common_comparison_category_impl<_Tp, _Up, index_sequence<_Is...>> {
338 using type _LIBCPP_NODEBUG =
339 common_comparison_category_t<__synth_three_way_result<tuple_element_t<_Is, _Tp>, tuple_element_t<_Is, _Up>>...>;
315template <__tuple_like _Tp, size_t... _Index>
316struct __to_tuple<_Tp, index_sequence<_Index...>> {
317 using type _LIBCPP_NODEBUG = tuple<tuple_element_t<_Index, _Tp>...>;
340318};
341319
342template <__tuple_like _Tp, __tuple_like _Up>
343using __tuple_common_comparison_category _LIBCPP_NODEBUG =
344 __tuple_common_comparison_category_impl<_Tp, _Up, make_index_sequence<tuple_size_v<_Tp>>>::type;
320template <__tuple_like _Tp>
321using __to_tuple_t _LIBCPP_NODEBUG = typename __to_tuple<_Tp>::type;
345322# endif // _LIBCPP_STD_VER >= 23
346323
347324// __tuple_leaf
......@@ -602,30 +579,28 @@ public:
602579 template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
603580 template <class...> class _IsDefault = is_default_constructible,
604581 __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
605 _LIBCPP_HIDE_FROM_ABI constexpr explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
582 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<_IsImpDefault<_Tp>...>::value)
606583 tuple() noexcept(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
607584
608585 template <class _Alloc,
609586 template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
610587 template <class...> class _IsDefault = is_default_constructible,
611588 __enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
612 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
613 tuple(allocator_arg_t, _Alloc const& __a)
589 _LIBCPP_HIDE_FROM_ABI
590 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<_IsImpDefault<_Tp>...>::value) tuple(allocator_arg_t, _Alloc const& __a)
614591 : __base_(allocator_arg_t(), __a, __value_init{}) {}
615592
616593 // tuple(const T&...) constructors (including allocator_arg_t variants)
617594 template <template <class...> class _And = _And,
618595 __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
619 _LIBCPP_HIDE_FROM_ABI
620 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
596 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<const _Tp&, _Tp>...>::value)
621597 tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value)
622598 : __base_(__forward_args{}, __t...) {}
623599
624600 template <class _Alloc,
625601 template <class...> class _And = _And,
626602 __enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
627 _LIBCPP_HIDE_FROM_ABI
628 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
603 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<const _Tp&, _Tp>...>::value)
629604 tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
630605 : __base_(allocator_arg_t(), __a, __forward_args{}, __t...) {}
631606
......@@ -644,7 +619,7 @@ public:
644619 template <class... _Up,
645620 __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
646621 int> = 0>
647 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
622 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<_Up, _Tp>...>::value)
648623 tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
649624 : __base_(__forward_args{}, std::forward<_Up>(__u)...) {}
650625
......@@ -652,7 +627,7 @@ public:
652627 class... _Up,
653628 __enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
654629 int> = 0>
655 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
630 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<_Up, _Tp>...>::value)
656631 tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
657632 : __base_(allocator_arg_t(), __a, __forward_args{}, std::forward<_Up>(__u)...) {}
658633
......@@ -690,26 +665,22 @@ public:
690665 _Not<is_same<_OtherTuple, const tuple&> >,
691666 _Not<is_same<_OtherTuple, tuple&&> >,
692667 is_constructible<_Tp, __copy_cvref_t<_OtherTuple, _Up> >...,
693 _Lazy<_Or,
694 _BoolConstant<sizeof...(_Tp) != 1>,
695 // _Tp and _Up are 1-element packs - the pack expansions look
696 // weird to avoid tripping up the type traits in degenerate cases
697 _Lazy<_And,
698 _Not<is_same<_Tp, _Up> >...,
699 _Not<is_convertible<_OtherTuple, _Tp> >...,
700 _Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
668 _Or<_BoolConstant<sizeof...(_Tp) != 1>,
669 // _Tp and _Up are 1-element packs - the pack expansions look
670 // weird to avoid tripping up the type traits in degenerate cases
671 _And<_Not<is_same<_Tp, _Up> >...,
672 _Not<is_convertible<_OtherTuple, _Tp> >...,
673 _Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
701674
702675 template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
703 _LIBCPP_HIDE_FROM_ABI
704 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
676 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<const _Up&, _Tp>...>::value)
705677 tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)
706678 : __base_(__from_tuple(), __t) {}
707679
708680 template <class... _Up,
709681 class _Alloc,
710682 __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
711 _LIBCPP_HIDE_FROM_ABI
712 _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
683 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<const _Up&, _Tp>...>::value)
713684 tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
714685 : __base_(allocator_arg_t(), __a, __from_tuple(), __t) {}
715686
......@@ -717,25 +688,25 @@ public:
717688 // tuple(tuple<U...>&) constructors (including allocator_arg_t variants)
718689
719690 template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
720 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
691 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<_Up&, _Tp>...>::value) tuple(tuple<_Up...>& __t)
721692 : __base_(__from_tuple(), __t) {}
722693
723694 template <class _Alloc, class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<tuple<_Up...>&>::value>* = nullptr>
724 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<_Up&, _Tp>...>::value)
695 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<_Up&, _Tp>...>::value)
725696 tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t)
726697 : __base_(allocator_arg_t(), __alloc, __from_tuple(), __t) {}
727698# endif // _LIBCPP_STD_VER >= 23
728699
729700 // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
730701 template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
731 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
702 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_And<is_convertible<_Up, _Tp>...>::value)
732703 tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
733704 : __base_(__from_tuple(), std::move(__t)) {}
734705
735706 template <class _Alloc,
736707 class... _Up,
737708 __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
738 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
709 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!_And<is_convertible<_Up, _Tp>...>::value)
739710 tuple(allocator_arg_t, const _Alloc& __a, tuple<_Up...>&& __t)
740711 : __base_(allocator_arg_t(), __a, __from_tuple(), std::move(__t)) {}
741712
......@@ -743,14 +714,14 @@ public:
743714 // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants)
744715
745716 template <class... _Up, enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
746 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
717 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<const _Up&&, _Tp>...>::value)
747718 tuple(const tuple<_Up...>&& __t)
748719 : __base_(__from_tuple(), std::move(__t)) {}
749720
750721 template <class _Alloc,
751722 class... _Up,
752723 enable_if_t< _EnableCtorFromUTypesTuple<const tuple<_Up...>&&>::value>* = nullptr>
753 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_Lazy<_And, is_convertible<const _Up&&, _Tp>...>::value)
724 _LIBCPP_HIDE_FROM_ABI constexpr explicit(!_And<is_convertible<const _Up&&, _Tp>...>::value)
754725 tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t)
755726 : __base_(allocator_arg_t(), __alloc, __from_tuple(), std::move(__t)) {}
756727# endif // _LIBCPP_STD_VER >= 23
......@@ -1011,20 +982,37 @@ public:
1011982 __base_.swap(__t.__base_);
1012983 }
1013984
985 template <class _Tuple>
986 static constexpr bool __can_compare_equal = false;
987
988 template <class... _Up>
989 static constexpr bool __can_compare_equal<tuple<_Up...>> = __all<requires(const _Tp& __t, const _Up& __u) {
990 { __t == __u } -> __boolean_testable;
991 }...>::value;
992
1014993 template <__tuple_like_no_tuple _UTuple>
1015994# if _LIBCPP_STD_VER >= 26
1016 requires __can_tuple_compare_equal<tuple, _UTuple> && (sizeof...(_Tp) == tuple_size_v<_UTuple>)
995 requires(sizeof...(_Tp) == tuple_size_v<_UTuple>) && __can_compare_equal<__to_tuple_t<_UTuple>>
1017996# endif // _LIBCPP_STD_VER >= 26
1018997 _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const tuple& __x, const _UTuple& __y) {
1019998 static_assert(sizeof...(_Tp) == tuple_size_v<_UTuple>, "Can't compare tuple-like values of different sizes");
1020999 return std::__tuple_compare_equal<sizeof...(_Tp)>(__x, __y);
10211000 }
10221001
1002 template <class _Tuple>
1003 struct __common_comparison_category_with;
1004
1005 template <class... _Up>
1006 requires requires { typename common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>; }
1007 struct __common_comparison_category_with<tuple<_Up...>> {
1008 using type _LIBCPP_NODEBUG = common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...>;
1009 };
1010
10231011 template <__tuple_like_no_tuple _UTuple>
10241012 requires(sizeof...(_Tp) == tuple_size_v<_UTuple>)
1025 _LIBCPP_HIDE_FROM_ABI friend constexpr __tuple_common_comparison_category<tuple, _UTuple>
1013 _LIBCPP_HIDE_FROM_ABI friend constexpr typename __common_comparison_category_with<__to_tuple_t<_UTuple>>::type
10261014 operator<=>(const tuple& __x, const _UTuple& __y) {
1027 return std::__tuple_compare_three_way<__tuple_common_comparison_category<tuple, _UTuple>>(
1015 return std::__tuple_compare_three_way<typename __common_comparison_category_with<__to_tuple_t<_UTuple>>::type>(
10281016 __x, __y, index_sequence_for<_Tp...>{});
10291017 }
10301018# endif // _LIBCPP_STD_VER >= 23
......@@ -1455,15 +1443,15 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp
14551443
14561444# endif // _LIBCPP_STD_VER >= 17
14571445
1458#endif // !defined(_LIBCPP_CXX03_LANG)
1459
14601446_LIBCPP_END_NAMESPACE_STD
14611447
1448#endif // !defined(_LIBCPP_CXX03_LANG)
1449
14621450_LIBCPP_POP_MACROS
14631451
14641452// clang-format on
14651453
1466# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1454# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
14671455# include <cstddef>
14681456# include <exception>
14691457# include <iosfwd>
lib/libcxx/include/typeindex+1-1
......@@ -102,7 +102,7 @@ struct hash<type_index> : public __unary_function<type_index, size_t> {
102102
103103_LIBCPP_END_NAMESPACE_STD
104104
105# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
105# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
106106# include <cstddef>
107107# include <iosfwd>
108108# include <new>
lib/libcxx/include/typeinfo+2-2
......@@ -302,7 +302,7 @@ class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH type_info
302302protected:
303303 typedef __type_info_implementations::__impl __impl;
304304
305 __impl::__type_name_t __type_name;
305 _LIBCPP_DISABLE_POINTER_FIELD_PROTECTION __impl::__type_name_t __type_name;
306306
307307 _LIBCPP_HIDE_FROM_ABI explicit type_info(const char* __n) : __type_name(__impl::__string_to_type_name(__n)) {}
308308
......@@ -389,7 +389,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
389389}
390390_LIBCPP_END_NAMESPACE_STD
391391
392# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
392# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
393393# include <cstddef>
394394# include <cstdlib>
395395# include <type_traits>
lib/libcxx/include/unordered_map+67-31
......@@ -77,16 +77,16 @@ public:
7777 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
7878 const allocator_type& a = allocator_type());
7979 unordered_map(size_type n, const allocator_type& a)
80 : unordered_map(n, hasher(), key_equal(), a) {} // C++14
80 : unordered_map(n, hasher(), key_equal(), a) {}
8181 unordered_map(size_type n, const hasher& hf, const allocator_type& a)
82 : unordered_map(n, hf, key_equal(), a) {} // C++14
82 : unordered_map(n, hf, key_equal(), a) {}
8383 template <class InputIterator>
8484 unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
85 : unordered_map(f, l, n, hasher(), key_equal(), a) {} // C++14
85 : unordered_map(f, l, n, hasher(), key_equal(), a) {}
8686 template <class InputIterator>
8787 unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
8888 const allocator_type& a)
89 : unordered_map(f, l, n, hf, key_equal(), a) {} // C++14
89 : unordered_map(f, l, n, hf, key_equal(), a) {}
9090 template<container-compatible-range<value_type> R>
9191 unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
9292 : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
......@@ -94,10 +94,10 @@ public:
9494 unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
9595 : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23
9696 unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
97 : unordered_map(il, n, hasher(), key_equal(), a) {} // C++14
97 : unordered_map(il, n, hasher(), key_equal(), a) {}
9898 unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
9999 const allocator_type& a)
100 : unordered_map(il, n, hf, key_equal(), a) {} // C++14
100 : unordered_map(il, n, hf, key_equal(), a) {}
101101 ~unordered_map();
102102 unordered_map& operator=(const unordered_map&);
103103 unordered_map& operator=(unordered_map&&)
......@@ -363,16 +363,16 @@ public:
363363 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
364364 const allocator_type& a = allocator_type());
365365 unordered_multimap(size_type n, const allocator_type& a)
366 : unordered_multimap(n, hasher(), key_equal(), a) {} // C++14
366 : unordered_multimap(n, hasher(), key_equal(), a) {}
367367 unordered_multimap(size_type n, const hasher& hf, const allocator_type& a)
368 : unordered_multimap(n, hf, key_equal(), a) {} // C++14
368 : unordered_multimap(n, hf, key_equal(), a) {}
369369 template <class InputIterator>
370370 unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
371 : unordered_multimap(f, l, n, hasher(), key_equal(), a) {} // C++14
371 : unordered_multimap(f, l, n, hasher(), key_equal(), a) {}
372372 template <class InputIterator>
373373 unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
374374 const allocator_type& a)
375 : unordered_multimap(f, l, n, hf, key_equal(), a) {} // C++14
375 : unordered_multimap(f, l, n, hf, key_equal(), a) {}
376376 template<container-compatible-range<value_type> R>
377377 unordered_multimap(from_range_t, R&& rg, size_type n, const allocator_type& a)
378378 : unordered_multimap(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
......@@ -380,10 +380,10 @@ public:
380380 unordered_multimap(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
381381 : unordered_multimap(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23
382382 unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
383 : unordered_multimap(il, n, hasher(), key_equal(), a) {} // C++14
383 : unordered_multimap(il, n, hasher(), key_equal(), a) {}
384384 unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
385385 const allocator_type& a)
386 : unordered_multimap(il, n, hf, key_equal(), a) {} // C++14
386 : unordered_multimap(il, n, hf, key_equal(), a) {}
387387 ~unordered_multimap();
388388 unordered_multimap& operator=(const unordered_multimap&);
389389 unordered_multimap& operator=(unordered_multimap&&)
......@@ -993,7 +993,6 @@ public:
993993 const key_equal& __eql,
994994 const allocator_type& __a);
995995# endif // _LIBCPP_CXX03_LANG
996# if _LIBCPP_STD_VER >= 14
997996 _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const allocator_type& __a)
998997 : unordered_map(__n, hasher(), key_equal(), __a) {}
999998 _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a)
......@@ -1007,7 +1006,7 @@ public:
10071006 _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
10081007 : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {}
10091008
1010# if _LIBCPP_STD_VER >= 23
1009# if _LIBCPP_STD_VER >= 23
10111010 template <_ContainerCompatibleRange<value_type> _Range>
10121011 _LIBCPP_HIDE_FROM_ABI unordered_map(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
10131012 : unordered_map(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
......@@ -1016,8 +1015,9 @@ public:
10161015 _LIBCPP_HIDE_FROM_ABI
10171016 unordered_map(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
10181017 : unordered_map(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
1019# endif
1018# endif
10201019
1020# ifndef _LIBCPP_CXX03_LANG
10211021 _LIBCPP_HIDE_FROM_ABI unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
10221022 : unordered_map(__il, __n, hasher(), key_equal(), __a) {}
10231023 _LIBCPP_HIDE_FROM_ABI
......@@ -1216,11 +1216,17 @@ public:
12161216 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
12171217 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
12181218# if _LIBCPP_STD_VER >= 20
1219 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1219 template <class _K2,
1220 class _Hasher = hasher,
1221 class _Comp = key_equal,
1222 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12201223 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
12211224 return __table_.find(__k);
12221225 }
1223 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1226 template <class _K2,
1227 class _Hasher = hasher,
1228 class _Comp = key_equal,
1229 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12241230 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
12251231 return __table_.find(__k);
12261232 }
......@@ -1230,7 +1236,10 @@ public:
12301236 return __table_.__count_unique(__k);
12311237 }
12321238# if _LIBCPP_STD_VER >= 20
1233 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1239 template <class _K2,
1240 class _Hasher = hasher,
1241 class _Comp = key_equal,
1242 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12341243 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
12351244 return __table_.__count_unique(__k);
12361245 }
......@@ -1239,7 +1248,10 @@ public:
12391248# if _LIBCPP_STD_VER >= 20
12401249 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
12411250
1242 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1251 template <class _K2,
1252 class _Hasher = hasher,
1253 class _Comp = key_equal,
1254 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12431255 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
12441256 return find(__k) != end();
12451257 }
......@@ -1252,11 +1264,17 @@ public:
12521264 return __table_.__equal_range_unique(__k);
12531265 }
12541266# if _LIBCPP_STD_VER >= 20
1255 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1267 template <class _K2,
1268 class _Hasher = hasher,
1269 class _Comp = key_equal,
1270 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12561271 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
12571272 return __table_.__equal_range_unique(__k);
12581273 }
1259 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1274 template <class _K2,
1275 class _Hasher = hasher,
1276 class _Comp = key_equal,
1277 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
12601278 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
12611279 return __table_.__equal_range_unique(__k);
12621280 }
......@@ -1769,7 +1787,6 @@ public:
17691787 const key_equal& __eql,
17701788 const allocator_type& __a);
17711789# endif // _LIBCPP_CXX03_LANG
1772# if _LIBCPP_STD_VER >= 14
17731790 _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const allocator_type& __a)
17741791 : unordered_multimap(__n, hasher(), key_equal(), __a) {}
17751792 _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a)
......@@ -1783,7 +1800,7 @@ public:
17831800 _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
17841801 : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {}
17851802
1786# if _LIBCPP_STD_VER >= 23
1803# if _LIBCPP_STD_VER >= 23
17871804 template <_ContainerCompatibleRange<value_type> _Range>
17881805 _LIBCPP_HIDE_FROM_ABI unordered_multimap(from_range_t, _Range&& __range, size_type __n, const allocator_type& __a)
17891806 : unordered_multimap(from_range, std::forward<_Range>(__range), __n, hasher(), key_equal(), __a) {}
......@@ -1792,8 +1809,9 @@ public:
17921809 _LIBCPP_HIDE_FROM_ABI
17931810 unordered_multimap(from_range_t, _Range&& __range, size_type __n, const hasher& __hf, const allocator_type& __a)
17941811 : unordered_multimap(from_range, std::forward<_Range>(__range), __n, __hf, key_equal(), __a) {}
1795# endif
1812# endif
17961813
1814# ifndef _LIBCPP_CXX03_LANG
17971815 _LIBCPP_HIDE_FROM_ABI unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
17981816 : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {}
17991817 _LIBCPP_HIDE_FROM_ABI
......@@ -1936,11 +1954,17 @@ public:
19361954 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
19371955 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
19381956# if _LIBCPP_STD_VER >= 20
1939 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1957 template <class _K2,
1958 class _Hasher = hasher,
1959 class _Comp = key_equal,
1960 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19401961 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
19411962 return __table_.find(__k);
19421963 }
1943 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1964 template <class _K2,
1965 class _Hasher = hasher,
1966 class _Comp = key_equal,
1967 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19441968 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
19451969 return __table_.find(__k);
19461970 }
......@@ -1950,7 +1974,10 @@ public:
19501974 return __table_.__count_multi(__k);
19511975 }
19521976# if _LIBCPP_STD_VER >= 20
1953 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1977 template <class _K2,
1978 class _Hasher = hasher,
1979 class _Comp = key_equal,
1980 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19541981 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
19551982 return __table_.__count_multi(__k);
19561983 }
......@@ -1959,7 +1986,10 @@ public:
19591986# if _LIBCPP_STD_VER >= 20
19601987 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
19611988
1962 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1989 template <class _K2,
1990 class _Hasher = hasher,
1991 class _Comp = key_equal,
1992 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19631993 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
19641994 return find(__k) != end();
19651995 }
......@@ -1972,11 +2002,17 @@ public:
19722002 return __table_.__equal_range_multi(__k);
19732003 }
19742004# if _LIBCPP_STD_VER >= 20
1975 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2005 template <class _K2,
2006 class _Hasher = hasher,
2007 class _Comp = key_equal,
2008 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19762009 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
19772010 return __table_.__equal_range_multi(__k);
19782011 }
1979 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
2012 template <class _K2,
2013 class _Hasher = hasher,
2014 class _Comp = key_equal,
2015 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
19802016 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
19812017 return __table_.__equal_range_multi(__k);
19822018 }
......@@ -2345,7 +2381,7 @@ _LIBCPP_END_NAMESPACE_STD
23452381
23462382_LIBCPP_POP_MACROS
23472383
2348# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
2384# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
23492385# include <algorithm>
23502386# include <bit>
23512387# include <cmath>
lib/libcxx/include/unordered_set+61-37
......@@ -76,22 +76,22 @@ public:
7676 unordered_set(initializer_list<value_type>, size_type n = 0,
7777 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
7878 const allocator_type& a = allocator_type());
79 unordered_set(size_type n, const allocator_type& a); // C++14
80 unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
79 unordered_set(size_type n, const allocator_type& a);
80 unordered_set(size_type n, const hasher& hf, const allocator_type& a);
8181 template <class InputIterator>
82 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
82 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a);
8383 template <class InputIterator>
8484 unordered_set(InputIterator f, InputIterator l, size_type n,
85 const hasher& hf, const allocator_type& a); // C++14
85 const hasher& hf, const allocator_type& a);
8686 template<container-compatible-range<value_type> R>
8787 unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a)
8888 : unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
8989 template<container-compatible-range<value_type> R>
9090 unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
9191 : unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23
92 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
92 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a);
9393 unordered_set(initializer_list<value_type> il, size_type n,
94 const hasher& hf, const allocator_type& a); // C++14
94 const hasher& hf, const allocator_type& a);
9595 ~unordered_set();
9696 unordered_set& operator=(const unordered_set&);
9797 unordered_set& operator=(unordered_set&&)
......@@ -324,22 +324,22 @@ public:
324324 unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
325325 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
326326 const allocator_type& a = allocator_type());
327 unordered_multiset(size_type n, const allocator_type& a); // C++14
328 unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
327 unordered_multiset(size_type n, const allocator_type& a);
328 unordered_multiset(size_type n, const hasher& hf, const allocator_type& a);
329329 template <class InputIterator>
330 unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
330 unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a);
331331 template <class InputIterator>
332332 unordered_multiset(InputIterator f, InputIterator l, size_type n,
333 const hasher& hf, const allocator_type& a); // C++14
333 const hasher& hf, const allocator_type& a);
334334 template<container-compatible-range<value_type> R>
335335 unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a)
336336 : unordered_multiset(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { } // C++23
337337 template<container-compatible-range<value_type> R>
338338 unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
339339 : unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { } // C++23
340 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
340 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a);
341341 unordered_multiset(initializer_list<value_type> il, size_type n,
342 const hasher& hf, const allocator_type& a); // C++14
342 const hasher& hf, const allocator_type& a);
343343 ~unordered_multiset();
344344 unordered_multiset& operator=(const unordered_multiset&);
345345 unordered_multiset& operator=(unordered_multiset&&)
......@@ -634,12 +634,10 @@ public:
634634 _LIBCPP_HIDE_FROM_ABI unordered_set() _NOEXCEPT_(is_nothrow_default_constructible<__table>::value) {}
635635 explicit _LIBCPP_HIDE_FROM_ABI
636636 unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
637# if _LIBCPP_STD_VER >= 14
638637 inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const allocator_type& __a)
639638 : unordered_set(__n, hasher(), key_equal(), __a) {}
640639 inline _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
641640 : unordered_set(__n, __hf, key_equal(), __a) {}
642# endif
643641 _LIBCPP_HIDE_FROM_ABI
644642 unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
645643 template <class _InputIterator>
......@@ -677,7 +675,6 @@ public:
677675 }
678676# endif
679677
680# if _LIBCPP_STD_VER >= 14
681678 template <class _InputIterator>
682679 inline _LIBCPP_HIDE_FROM_ABI
683680 unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
......@@ -686,7 +683,6 @@ public:
686683 _LIBCPP_HIDE_FROM_ABI unordered_set(
687684 _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
688685 : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
689# endif
690686
691687# if _LIBCPP_STD_VER >= 23
692688 template <_ContainerCompatibleRange<value_type> _Range>
......@@ -717,14 +713,12 @@ public:
717713 const hasher& __hf,
718714 const key_equal& __eql,
719715 const allocator_type& __a);
720# if _LIBCPP_STD_VER >= 14
721716 inline _LIBCPP_HIDE_FROM_ABI
722717 unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
723718 : unordered_set(__il, __n, hasher(), key_equal(), __a) {}
724719 inline _LIBCPP_HIDE_FROM_ABI
725720 unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
726721 : unordered_set(__il, __n, __hf, key_equal(), __a) {}
727# endif
728722# endif // _LIBCPP_CXX03_LANG
729723 _LIBCPP_HIDE_FROM_ABI ~unordered_set() {
730724 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
......@@ -844,11 +838,17 @@ public:
844838 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
845839 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
846840# if _LIBCPP_STD_VER >= 20
847 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
841 template <class _K2,
842 class _Hasher = hasher,
843 class _Comp = key_equal,
844 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
848845 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
849846 return __table_.find(__k);
850847 }
851 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
848 template <class _K2,
849 class _Hasher = hasher,
850 class _Comp = key_equal,
851 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
852852 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
853853 return __table_.find(__k);
854854 }
......@@ -858,7 +858,10 @@ public:
858858 return __table_.__count_unique(__k);
859859 }
860860# if _LIBCPP_STD_VER >= 20
861 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
861 template <class _K2,
862 class _Hasher = hasher,
863 class _Comp = key_equal,
864 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
862865 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
863866 return __table_.__count_unique(__k);
864867 }
......@@ -867,7 +870,10 @@ public:
867870# if _LIBCPP_STD_VER >= 20
868871 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
869872
870 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
873 template <class _K2,
874 class _Hasher = hasher,
875 class _Comp = key_equal,
876 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
871877 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
872878 return find(__k) != end();
873879 }
......@@ -880,11 +886,17 @@ public:
880886 return __table_.__equal_range_unique(__k);
881887 }
882888# if _LIBCPP_STD_VER >= 20
883 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
889 template <class _K2,
890 class _Hasher = hasher,
891 class _Comp = key_equal,
892 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
884893 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
885894 return __table_.__equal_range_unique(__k);
886895 }
887 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
896 template <class _K2,
897 class _Hasher = hasher,
898 class _Comp = key_equal,
899 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
888900 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
889901 return __table_.__equal_range_unique(__k);
890902 }
......@@ -1232,12 +1244,10 @@ public:
12321244 unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
12331245 _LIBCPP_HIDE_FROM_ABI
12341246 unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a);
1235# if _LIBCPP_STD_VER >= 14
12361247 inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const allocator_type& __a)
12371248 : unordered_multiset(__n, hasher(), key_equal(), __a) {}
12381249 inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
12391250 : unordered_multiset(__n, __hf, key_equal(), __a) {}
1240# endif
12411251 template <class _InputIterator>
12421252 _LIBCPP_HIDE_FROM_ABI unordered_multiset(_InputIterator __first, _InputIterator __last);
12431253 template <class _InputIterator>
......@@ -1273,7 +1283,6 @@ public:
12731283 }
12741284# endif
12751285
1276# if _LIBCPP_STD_VER >= 14
12771286 template <class _InputIterator>
12781287 inline _LIBCPP_HIDE_FROM_ABI
12791288 unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a)
......@@ -1282,7 +1291,6 @@ public:
12821291 inline _LIBCPP_HIDE_FROM_ABI unordered_multiset(
12831292 _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a)
12841293 : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
1285# endif
12861294
12871295# if _LIBCPP_STD_VER >= 23
12881296 template <_ContainerCompatibleRange<value_type> _Range>
......@@ -1313,14 +1321,12 @@ public:
13131321 const hasher& __hf,
13141322 const key_equal& __eql,
13151323 const allocator_type& __a);
1316# if _LIBCPP_STD_VER >= 14
13171324 inline _LIBCPP_HIDE_FROM_ABI
13181325 unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
13191326 : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
13201327 inline _LIBCPP_HIDE_FROM_ABI
13211328 unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
13221329 : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
1323# endif
13241330# endif // _LIBCPP_CXX03_LANG
13251331 _LIBCPP_HIDE_FROM_ABI ~unordered_multiset() {
13261332 static_assert(sizeof(std::__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
......@@ -1443,11 +1449,17 @@ public:
14431449 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); }
14441450 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); }
14451451# if _LIBCPP_STD_VER >= 20
1446 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1452 template <class _K2,
1453 class _Hasher = hasher,
1454 class _Comp = key_equal,
1455 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14471456 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
14481457 return __table_.find(__k);
14491458 }
1450 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1459 template <class _K2,
1460 class _Hasher = hasher,
1461 class _Comp = key_equal,
1462 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14511463 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
14521464 return __table_.find(__k);
14531465 }
......@@ -1457,7 +1469,10 @@ public:
14571469 return __table_.__count_multi(__k);
14581470 }
14591471# if _LIBCPP_STD_VER >= 20
1460 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1472 template <class _K2,
1473 class _Hasher = hasher,
1474 class _Comp = key_equal,
1475 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14611476 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
14621477 return __table_.__count_multi(__k);
14631478 }
......@@ -1466,7 +1481,10 @@ public:
14661481# if _LIBCPP_STD_VER >= 20
14671482 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
14681483
1469 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1484 template <class _K2,
1485 class _Hasher = hasher,
1486 class _Comp = key_equal,
1487 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14701488 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
14711489 return find(__k) != end();
14721490 }
......@@ -1479,11 +1497,17 @@ public:
14791497 return __table_.__equal_range_multi(__k);
14801498 }
14811499# if _LIBCPP_STD_VER >= 20
1482 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1500 template <class _K2,
1501 class _Hasher = hasher,
1502 class _Comp = key_equal,
1503 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14831504 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
14841505 return __table_.__equal_range_multi(__k);
14851506 }
1486 template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
1507 template <class _K2,
1508 class _Hasher = hasher,
1509 class _Comp = key_equal,
1510 enable_if_t<__is_transparent_v<_Hasher> && __is_transparent_v<_Comp>>* = nullptr>
14871511 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
14881512 return __table_.__equal_range_multi(__k);
14891513 }
......@@ -1812,7 +1836,7 @@ _LIBCPP_END_NAMESPACE_STD
18121836
18131837_LIBCPP_POP_MACROS
18141838
1815# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1839# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
18161840# include <cmath>
18171841# include <concepts>
18181842# include <cstdlib>
lib/libcxx/include/utility+16-5
......@@ -195,6 +195,19 @@ template<class T1, class T2>
195195template<class T1, class T2>
196196 constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14
197197
198// [const.wrap.class], class template constant_wrapper
199template<auto X, class = decltype(X)>
200 struct constant_wrapper; // since C++26
201
202template<class T>
203 concept constexpr-param = // exposition only, since C++26
204 requires { typename constant_wrapper<T::value>; };
205
206struct cw-operators; // exposition only, since C++26
207
208template<auto X>
209 constexpr auto cw = constant_wrapper<X>{}; // since C++26
210
198211// C++14
199212
200213template<class T, T... I>
......@@ -292,6 +305,7 @@ template <class T>
292305# endif
293306
294307# if _LIBCPP_STD_VER >= 26
308# include <__utility/constant_wrapper.h>
295309# include <__variant/monostate.h>
296310# endif
297311
......@@ -315,14 +329,11 @@ template <class T>
315329# pragma GCC system_header
316330# endif
317331
318# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
319# include <limits>
320# endif
321
322# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
332# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
323333# include <cstddef>
324334# include <cstdlib>
325335# include <iosfwd>
336# include <limits>
326337# include <type_traits>
327338# endif
328339#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/valarray+3-1
......@@ -381,6 +381,7 @@ _LIBCPP_PUSH_MACROS
381381# include <__undef_macros>
382382
383383_LIBCPP_BEGIN_NAMESPACE_STD
384_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
384385
385386template <class _Tp>
386387class valarray;
......@@ -3300,11 +3301,12 @@ template <class _Tp>
33003301 return __v.__end_;
33013302}
33023303
3304_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
33033305_LIBCPP_END_NAMESPACE_STD
33043306
33053307_LIBCPP_POP_MACROS
33063308
3307# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
3309# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
33083310# include <algorithm>
33093311# include <concepts>
33103312# include <cstdlib>
lib/libcxx/include/variant+39-19
......@@ -235,7 +235,6 @@ namespace std {
235235# include <__type_traits/conditional.h>
236236# include <__type_traits/conjunction.h>
237237# include <__type_traits/decay.h>
238# include <__type_traits/dependent_type.h>
239238# include <__type_traits/enable_if.h>
240239# include <__type_traits/invoke.h>
241240# include <__type_traits/is_array.h>
......@@ -285,18 +284,33 @@ _LIBCPP_PUSH_MACROS
285284# include <__undef_macros>
286285
287286_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD
287_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
288288
289289class _LIBCPP_EXPORTED_FROM_ABI bad_variant_access : public exception {
290290public:
291291 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
292292};
293293
294_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
294class _LIBCPP_EXPORTED_FROM_ABI __bad_variant_access_with_msg : public bad_variant_access {
295public:
296 _LIBCPP_HIDE_FROM_ABI explicit __bad_variant_access_with_msg(const char* __msg) _NOEXCEPT : __msg_(__msg) {}
297# if _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION
298 [[__nodiscard__]] const char* what() const _NOEXCEPT override;
299# else
300 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI_VIRTUAL const char* what() const _NOEXCEPT override { return __msg_; }
301# endif
295302
296_LIBCPP_BEGIN_NAMESPACE_STD
303private:
304 const char* __msg_;
305};
306
307_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
308_LIBCPP_END_UNVERSIONED_NAMESPACE_STD
297309
298310# if _LIBCPP_STD_VER >= 17
299311
312_LIBCPP_BEGIN_NAMESPACE_STD
313
300314// Light N-dimensional array of function pointers. Used in place of std::array to avoid
301315// adding a dependency.
302316template <class _Tp, size_t _Size>
......@@ -307,11 +321,11 @@ struct __farray {
307321 _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
308322};
309323
310[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access() {
324[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access(const char* __msg) {
311325# if _LIBCPP_HAS_EXCEPTIONS
312 throw bad_variant_access();
326 throw __bad_variant_access_with_msg(__msg);
313327# else
314 _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
328 _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode: %s", __msg);
315329# endif
316330}
317331
......@@ -539,9 +553,12 @@ private:
539553 return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
540554 }
541555
556 template <class, class _Tp>
557 using __expander _LIBCPP_NODEBUG = _Tp;
558
542559 template <size_t _Ip, class _Fp, class... _Vs>
543560 _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal_impl() {
544 return __make_dispatch<_Fp, _Vs...>(index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{});
561 return __make_dispatch<_Fp, _Vs...>(index_sequence<static_cast<__expander<_Vs, size_t>>(_Ip)...>{});
545562 }
546563
547564 template <class _Fp, class... _Vs, size_t... _Is>
......@@ -614,7 +631,8 @@ private:
614631 template <class _Visitor>
615632 struct __value_visitor {
616633 template <class... _Alts>
617 _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator()(_Alts&&... __alts) const {
634 _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Alts&&... __alts) const
635 -> invoke_result_t<_Visitor&&, decltype((std::forward<_Alts>(__alts).__value))...> {
618636 __std_visit_exhaustive_visitor_check< _Visitor, decltype((std::forward<_Alts>(__alts).__value))...>();
619637 return std::__invoke(std::forward<_Visitor>(__visitor), std::forward<_Alts>(__alts).__value...);
620638 }
......@@ -1164,8 +1182,7 @@ public:
11641182 using __trivially_relocatable _LIBCPP_NODEBUG =
11651183 conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>;
11661184
1167 template <bool _Dummy = true,
1168 enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
1185 template <class _FirstType = __first_type, enable_if_t<is_default_constructible_v<_FirstType>, int> = 0>
11691186 _LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
11701187 : __impl_(in_place_index<0>) {}
11711188
......@@ -1280,10 +1297,10 @@ public:
12801297
12811298 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t index() const noexcept { return __impl_.index(); }
12821299
1283 template < bool _Dummy = true,
1284 enable_if_t< __all<(__dependent_type<is_move_constructible<_Types>, _Dummy>::value &&
1285 __dependent_type<is_swappable<_Types>, _Dummy>::value)...>::value,
1286 int> = 0>
1300 template <
1301 bool _Dummy = true,
1302 enable_if_t<_And<_And<bool_constant<_Dummy>, is_move_constructible<_Types>, is_swappable<_Types>>...>::value,
1303 int> = 0>
12871304 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(variant& __that) noexcept(
12881305 __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) {
12891306 __impl_.__swap(__that.__impl_);
......@@ -1329,7 +1346,9 @@ template <size_t _Ip, class _Vp>
13291346_LIBCPP_HIDE_FROM_ABI constexpr auto&& __generic_get(_Vp&& __v) {
13301347 using __variant_detail::__access::__variant;
13311348 if (!std::__holds_alternative<_Ip>(__v)) {
1332 std::__throw_bad_variant_access();
1349 if (__v.valueless_by_exception())
1350 std::__throw_bad_variant_access("std::get: variant is valueless");
1351 std::__throw_bad_variant_access("std::get: wrong alternative for variant");
13331352 }
13341353 return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
13351354}
......@@ -1566,7 +1585,7 @@ template <class... _Vs>
15661585_LIBCPP_HIDE_FROM_ABI constexpr void __throw_if_valueless(_Vs&&... __vs) {
15671586 const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception());
15681587 if (__valueless) {
1569 std::__throw_bad_variant_access();
1588 std::__throw_bad_variant_access("std::visit: variant is valueless");
15701589 }
15711590}
15721591
......@@ -1574,6 +1593,7 @@ template < class _Visitor, class... _Vs, typename>
15741593_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
15751594 using __variant_detail::__visitation::__variant;
15761595 std::__throw_if_valueless(std::forward<_Vs>(__vs)...);
1596 // NOLINTNEXTLINE(bugprone-use-after-move) __throw_if_valueless doesn't actually forward the variants
15771597 return __variant::__visit_value(std::forward<_Visitor>(__visitor), std::forward<_Vs>(__vs)...);
15781598}
15791599
......@@ -1635,13 +1655,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto&& __unchecked_get(variant<_Types...>& __v)
16351655 return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
16361656}
16371657
1638# endif // _LIBCPP_STD_VER >= 17
1639
16401658_LIBCPP_END_NAMESPACE_STD
16411659
1660# endif // _LIBCPP_STD_VER >= 17
1661
16421662_LIBCPP_POP_MACROS
16431663
1644# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1664# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
16451665# include <cstddef>
16461666# include <exception>
16471667# include <tuple>
lib/libcxx/include/vector+12-8
......@@ -39,7 +39,7 @@ public:
3939 noexcept(is_nothrow_default_constructible<allocator_type>::value);
4040 explicit vector(const allocator_type&);
4141 explicit vector(size_type n);
42 explicit vector(size_type n, const allocator_type&); // C++14
42 explicit vector(size_type n, const allocator_type&);
4343 vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
4444 template <class InputIterator>
4545 vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
......@@ -171,7 +171,7 @@ public:
171171 vector()
172172 noexcept(is_nothrow_default_constructible<allocator_type>::value);
173173 explicit vector(const allocator_type&) noexcept;
174 explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14
174 explicit vector(size_type n, const allocator_type& a = allocator_type());
175175 vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
176176 template <class InputIterator>
177177 vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
......@@ -348,16 +348,21 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
348348# pragma GCC system_header
349349# endif
350350
351# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
352# include <algorithm>
351# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 23
353352# include <array>
354# include <atomic>
355# include <cctype>
356353# include <cerrno>
357354# include <clocale>
355# include <cstddef>
356# include <cstdlib>
357# include <typeinfo>
358# endif
359
360# if defined(_LIBCPP_KEEP_TRANSITIVE_INCLUDES_LLVM23) && _LIBCPP_STD_VER <= 20
361# include <algorithm>
362# include <atomic>
363# include <cctype>
358364# include <concepts>
359365# include <cstdint>
360# include <cstdlib>
361366# include <iosfwd>
362367# if _LIBCPP_HAS_LOCALIZATION
363368# include <locale>
......@@ -367,7 +372,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
367372# include <string_view>
368373# include <tuple>
369374# include <type_traits>
370# include <typeinfo>
371375# include <utility>
372376# endif
373377#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
lib/libcxx/include/version+27-11
......@@ -37,7 +37,7 @@ __cpp_lib_atomic_float 201711L <atomic>
3737__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
3838__cpp_lib_atomic_lock_free_type_aliases 201907L <atomic>
3939__cpp_lib_atomic_min_max 202403L <atomic>
40__cpp_lib_atomic_ref 202411L <atomic>
40__cpp_lib_atomic_ref 202603L <atomic>
4141 201806L // C++20
4242__cpp_lib_atomic_shared_ptr 201711L <atomic>
4343__cpp_lib_atomic_value_initialization 201911L <atomic> <memory>
......@@ -64,6 +64,7 @@ __cpp_lib_common_reference 202302L <type_traits>
6464__cpp_lib_common_reference_wrapper 202302L <functional>
6565__cpp_lib_complex_udls 201309L <complex>
6666__cpp_lib_concepts 202207L <concepts>
67__cpp_lib_constant_wrapper 202606L <utility>
6768__cpp_lib_constexpr_algorithms 202306L <algorithm> <utility>
6869 201806L // C++20
6970__cpp_lib_constexpr_bitset 202207L <bitset>
......@@ -77,11 +78,13 @@ __cpp_lib_constexpr_forward_list 202502L <forward_list>
7778__cpp_lib_constexpr_functional 201907L <functional>
7879__cpp_lib_constexpr_iterator 201811L <iterator>
7980__cpp_lib_constexpr_list 202502L <list>
81__cpp_lib_constexpr_map 202502L <map>
8082__cpp_lib_constexpr_memory 202202L <memory>
8183 201811L // C++20
8284__cpp_lib_constexpr_new 202406L <new>
8385__cpp_lib_constexpr_numeric 201911L <numeric>
8486__cpp_lib_constexpr_queue 202502L <queue>
87__cpp_lib_constexpr_set 202502L <set>
8588__cpp_lib_constexpr_string 201907L <string>
8689__cpp_lib_constexpr_string_view 201811L <string_view>
8790__cpp_lib_constexpr_tuple 201811L <tuple>
......@@ -209,17 +212,21 @@ __cpp_lib_ranges_chunk 202202L <ranges>
209212__cpp_lib_ranges_chunk_by 202202L <ranges>
210213__cpp_lib_ranges_concat 202403L <ranges>
211214__cpp_lib_ranges_contains 202207L <algorithm>
215__cpp_lib_ranges_enumerate 202302L <ranges>
212216__cpp_lib_ranges_find_last 202207L <algorithm>
217__cpp_lib_ranges_fold 202207L <algorithm>
213218__cpp_lib_ranges_indices 202506L <ranges>
214219__cpp_lib_ranges_iota 202202L <numeric>
215220__cpp_lib_ranges_join_with 202202L <ranges>
216221__cpp_lib_ranges_repeat 202207L <ranges>
217222__cpp_lib_ranges_slide 202202L <ranges>
218223__cpp_lib_ranges_starts_ends_with 202106L <algorithm>
224__cpp_lib_ranges_stride 202207L <ranges>
219225__cpp_lib_ranges_to_container 202202L <ranges>
220226__cpp_lib_ranges_zip 202110L <ranges> <tuple> <utility>
221227__cpp_lib_ratio 202306L <ratio>
222__cpp_lib_raw_memory_algorithms 201606L <memory>
228__cpp_lib_raw_memory_algorithms 202411L <memory>
229 201606L // C++17
223230__cpp_lib_rcu 202306L <rcu>
224231__cpp_lib_reference_from_temporary 202202L <type_traits>
225232__cpp_lib_reference_wrapper 202403L <functional>
......@@ -227,7 +234,7 @@ __cpp_lib_remove_cvref 201711L <type_traits>
227234__cpp_lib_result_of_sfinae 201210L <functional> <type_traits>
228235__cpp_lib_robust_nonmodifying_seq_ops 201304L <algorithm>
229236__cpp_lib_sample 201603L <algorithm>
230__cpp_lib_saturation_arithmetic 202311L <numeric>
237__cpp_lib_saturation_arithmetic 202603L <numeric>
231238__cpp_lib_scoped_lock 201703L <mutex>
232239__cpp_lib_semaphore 201907L <semaphore>
233240__cpp_lib_senders 202406L <execution>
......@@ -236,13 +243,13 @@ __cpp_lib_shared_ptr_arrays 201707L <memory>
236243 201611L // C++17
237244__cpp_lib_shared_ptr_weak_type 201606L <memory>
238245__cpp_lib_shared_timed_mutex 201402L <shared_mutex>
239__cpp_lib_shift 201806L <algorithm>
246__cpp_lib_shift 202202L <algorithm>
247 201806L // C++20
240248__cpp_lib_smart_ptr_for_overwrite 202002L <memory>
241249__cpp_lib_smart_ptr_owner_equality 202306L <memory>
242250__cpp_lib_source_location 201907L <source_location>
243251__cpp_lib_span 202002L <span>
244252__cpp_lib_span_at 202311L <span>
245__cpp_lib_span_initializer_list 202311L <span>
246253__cpp_lib_spanstream 202106L <spanstream>
247254__cpp_lib_ssize 201902L <iterator>
248255__cpp_lib_sstream_from_string_view 202306L <sstream>
......@@ -423,7 +430,7 @@ __cpp_lib_void_t 201411L <type_traits>
423430# define __cpp_lib_constexpr_utility 201811L
424431# define __cpp_lib_constexpr_vector 201907L
425432# define __cpp_lib_coroutine 201902L
426# if _LIBCPP_STD_VER >= 20 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
433# if defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
427434# define __cpp_lib_destroying_delete 201806L
428435# endif
429436# define __cpp_lib_endian 201907L
......@@ -524,15 +531,20 @@ __cpp_lib_void_t 201411L <type_traits>
524531// # define __cpp_lib_ranges_chunk 202202L
525532# define __cpp_lib_ranges_chunk_by 202202L
526533# define __cpp_lib_ranges_contains 202207L
534# define __cpp_lib_ranges_enumerate 202302L
527535# define __cpp_lib_ranges_find_last 202207L
536# define __cpp_lib_ranges_fold 202207L
528537# define __cpp_lib_ranges_iota 202202L
529538# define __cpp_lib_ranges_join_with 202202L
530539# define __cpp_lib_ranges_repeat 202207L
531540// # define __cpp_lib_ranges_slide 202202L
532541# define __cpp_lib_ranges_starts_ends_with 202106L
542# define __cpp_lib_ranges_stride 202207L
533543# define __cpp_lib_ranges_to_container 202202L
534544# define __cpp_lib_ranges_zip 202110L
535545// # define __cpp_lib_reference_from_temporary 202202L
546# undef __cpp_lib_shift
547# define __cpp_lib_shift 202202L
536548// # define __cpp_lib_spanstream 202106L
537549// # define __cpp_lib_stacktrace 202011L
538550# define __cpp_lib_stdatomic_h 202011L
......@@ -548,20 +560,23 @@ __cpp_lib_void_t 201411L <type_traits>
548560// # define __cpp_lib_associative_heterogeneous_insertion 202306L
549561// # define __cpp_lib_atomic_min_max 202403L
550562# undef __cpp_lib_atomic_ref
551# define __cpp_lib_atomic_ref 202411L
563# define __cpp_lib_atomic_ref 202603L
552564# undef __cpp_lib_bind_front
553565# define __cpp_lib_bind_front 202306L
554566# define __cpp_lib_bitset 202306L
567# define __cpp_lib_constant_wrapper 202606L
555568# undef __cpp_lib_constexpr_algorithms
556569# define __cpp_lib_constexpr_algorithms 202306L
557570# define __cpp_lib_constexpr_flat_map 202502L
558571# define __cpp_lib_constexpr_flat_set 202502L
559572# define __cpp_lib_constexpr_forward_list 202502L
560573# define __cpp_lib_constexpr_list 202502L
574# define __cpp_lib_constexpr_map 202502L
561575# if !defined(_LIBCPP_ABI_VCRUNTIME)
562576# define __cpp_lib_constexpr_new 202406L
563577# endif
564578# define __cpp_lib_constexpr_queue 202502L
579# define __cpp_lib_constexpr_set 202502L
565580# define __cpp_lib_constrained_equality 202411L
566581// # define __cpp_lib_copyable_function 202306L
567582// # define __cpp_lib_debugging 202311L
......@@ -604,22 +619,23 @@ __cpp_lib_void_t 201411L <type_traits>
604619# undef __cpp_lib_out_ptr
605620# define __cpp_lib_out_ptr 202311L
606621// # define __cpp_lib_philox_engine 202406L
607// # define __cpp_lib_ranges_concat 202403L
622# define __cpp_lib_ranges_concat 202403L
608623# define __cpp_lib_ranges_indices 202506L
609624# define __cpp_lib_ratio 202306L
625# undef __cpp_lib_raw_memory_algorithms
626# define __cpp_lib_raw_memory_algorithms 202411L
610627// # define __cpp_lib_rcu 202306L
611628# define __cpp_lib_reference_wrapper 202403L
612# define __cpp_lib_saturation_arithmetic 202311L
629# define __cpp_lib_saturation_arithmetic 202603L
613630// # define __cpp_lib_senders 202406L
614631// # define __cpp_lib_smart_ptr_owner_equality 202306L
615632# define __cpp_lib_span_at 202311L
616# define __cpp_lib_span_initializer_list 202311L
617633# define __cpp_lib_sstream_from_string_view 202306L
618634# define __cpp_lib_string_subview 202506L
619635# undef __cpp_lib_string_view
620636# define __cpp_lib_string_view 202403L
621637// # define __cpp_lib_submdspan 202306L
622// # define __cpp_lib_text_encoding 202306L
638# define __cpp_lib_text_encoding 202306L
623639# undef __cpp_lib_to_chars
624640// # define __cpp_lib_to_chars 202306L
625641// # define __cpp_lib_to_string 202306L
lib/libcxx/include/wchar.h+2
......@@ -133,6 +133,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
133133# if defined(_CRT_CONST_CORRECT_OVERLOADS)
134134# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
135135# endif
136# elif _LIBCPP_LIBC_LLVM_LIBC
137# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
136138# endif
137139
138140# if _LIBCPP_HAS_WIDE_CHARACTERS
lib/libcxx/libc/hdr/errno_macros.h+1-1
......@@ -25,6 +25,6 @@
2525
2626#include <errno.h>
2727
28#endif // LLVM_LIBC_FULL_BUILD
28#endif // LIBC_FULL_BUILD
2929
3030#endif // LLVM_LIBC_HDR_ERRNO_MACROS_H
lib/libcxx/libc/hdr/fenv_macros.h+1-1
......@@ -56,6 +56,6 @@
5656#define FE_UPWARD 0x800
5757#endif // FE_UPWARD
5858
59#endif // LLVM_LIBC_FULL_BUILD
59#endif // LIBC_FULL_BUILD
6060
6161#endif // LLVM_LIBC_HDR_FENV_MACROS_H
lib/libcxx/libc/hdr/float_macros.h+1-1
......@@ -17,6 +17,6 @@
1717
1818#include <float.h>
1919
20#endif // LLVM_LIBC_FULL_BUILD
20#endif // LIBC_FULL_BUILD
2121
2222#endif // LLVM_LIBC_HDR_FLOAT_MACROS_H
lib/libcxx/libc/hdr/limits_macros.h+1-1
......@@ -17,6 +17,6 @@
1717
1818#include <limits.h>
1919
20#endif // LLVM_LIBC_FULL_BUILD
20#endif // LIBC_FULL_BUILD
2121
2222#endif // LLVM_LIBC_HDR_LIMITS_MACROS_H
lib/libcxx/libc/hdr/types/size_t.h created+23
......@@ -0,0 +1,23 @@
1//===-- Proxy for size_t --------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H
9#define LLVM_LIBC_HDR_TYPES_SIZE_T_H
10
11#ifdef LIBC_FULL_BUILD
12
13#include "include/llvm-libc-types/size_t.h"
14
15#else
16
17#define __need_size_t
18#include <stddef.h>
19#undef __need_size_t
20
21#endif // LIBC_FULL_BUILD
22
23#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H
lib/libcxx/libc/hdr/types/wchar_t.h+1-1
......@@ -18,6 +18,6 @@
1818
1919#include "hdr/wchar_overlay.h"
2020
21#endif // LLVM_LIBC_FULL_BUILD
21#endif // LIBC_FULL_BUILD
2222
2323#endif // LLVM_LIBC_HDR_TYPES_WCHAR_T_H
lib/libcxx/libc/hdr/types/wint_t.h created+23
......@@ -0,0 +1,23 @@
1//===-- Definition of wint_t.h --------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_LIBC_HDR_TYPES_WINT_T_H
11#define LLVM_LIBC_HDR_TYPES_WINT_T_H
12
13#ifdef LIBC_FULL_BUILD
14
15#include "include/llvm-libc-types/wint_t.h"
16
17#else // overlay mode
18
19#include "hdr/wchar_overlay.h"
20
21#endif // LIBC_FULL_BUILD
22
23#endif // LLVM_LIBC_HDR_TYPES_WINT_T_H
lib/libcxx/libc/include/llvm-libc-macros/cfloat128-macros.h+1-1
......@@ -27,7 +27,7 @@
2727#define LIBC_TYPES_HAS_CFLOAT128
2828#endif
2929#elif defined(__GNUC__)
30#if (defined(__STDC_IEC_60559_COMPLEX__) || defined(__SIZEOF_FLOAT128__)) && \
30#if (defined(__STDC_IEC_60559_COMPLEX__) && defined(__SIZEOF_FLOAT128__)) && \
3131 (__GNUC__ >= 13 || (!defined(__cplusplus)))
3232#define LIBC_TYPES_HAS_CFLOAT128
3333#endif
lib/libcxx/libc/include/llvm-libc-macros/float-macros.h+6
......@@ -9,6 +9,12 @@
99#ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
1010#define LLVM_LIBC_MACROS_FLOAT_MACROS_H
1111
12// __has_builtin is a Clang extension; GCC < 10 doesn't define it, which
13// turns a bare `#if __has_builtin(...)` into a preprocessor syntax error.
14#ifndef __has_builtin
15#define __has_builtin(x) 0
16#endif
17
1218#ifndef FLT_RADIX
1319#define FLT_RADIX __FLT_RADIX__
1420#endif // FLT_RADIX
lib/libcxx/libc/include/llvm-libc-macros/float16-macros.h+2-1
......@@ -12,7 +12,8 @@
1212#include "../llvm-libc-types/float128.h"
1313
1414#if defined(__FLT16_MANT_DIG__) && \
15 (!defined(__GNUC__) || __GNUC__ >= 13 || defined(__clang__)) && \
15 (!defined(__GNUC__) || __GNUC__ >= 13 || \
16 (defined(__clang__) && __clang_major__ >= 12)) && \
1617 !defined(__arm__) && !defined(_M_ARM) && !defined(__riscv) && \
1718 !defined(_WIN32)
1819#define LIBC_TYPES_HAS_FLOAT16
lib/libcxx/libc/include/llvm-libc-macros/stdfix-macros.h+1-1
......@@ -9,7 +9,7 @@
99#ifndef LLVM_LIBC_MACROS_STDFIX_MACROS_H
1010#define LLVM_LIBC_MACROS_STDFIX_MACROS_H
1111
12#ifdef __FRACT_FBIT__
12#if defined(__FRACT_FBIT__) && defined(__clang__)
1313// _Fract and _Accum types are available
1414#define LIBC_COMPILER_HAS_FIXED_POINT
1515#endif // __FRACT_FBIT__
lib/libcxx/libc/include/llvm-libc-types/size_t.h created+14
......@@ -0,0 +1,14 @@
1//===-- Definition of size_t types ----------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIBC_TYPES_SIZE_T_H
10#define LLVM_LIBC_TYPES_SIZE_T_H
11
12typedef __SIZE_TYPE__ size_t;
13
14#endif // LLVM_LIBC_TYPES_SIZE_T_H
lib/libcxx/libc/src/__support/CPP/bit.h+46-14
......@@ -6,7 +6,7 @@
66//
77//===----------------------------------------------------------------------===//
88// This is inspired by LLVM ADT/bit.h header.
9// Some functions are missing, we can add them as needed (popcount, byteswap).
9// Some functions are missing, we can add them as needed.
1010
1111#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H
1212#define LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H
......@@ -27,9 +27,14 @@ namespace cpp {
2727#endif
2828
2929template <unsigned N>
30LIBC_INLINE static void inline_copy(const char *from, char *to) {
31#if __has_builtin(__builtin_memcpy_inline)
32 __builtin_memcpy_inline(to, from, N);
30LIBC_INLINE constexpr void inline_copy(const char *from, char *to) {
31#if __has_builtin(__builtin_memcpy_inline) && \
32 defined(LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED)
33 if (cpp::is_constant_evaluated())
34 for (unsigned i = 0; i < N; ++i)
35 to[i] = from[i];
36 else
37 __builtin_memcpy_inline(to, from, N);
3338#else
3439 for (unsigned i = 0; i < N; ++i)
3540 to[i] = from[i];
......@@ -39,15 +44,14 @@ LIBC_INLINE static void inline_copy(const char *from, char *to) {
3944// This implementation of bit_cast requires trivially-constructible To, to avoid
4045// UB in the implementation.
4146template <typename To, typename From>
42LIBC_INLINE constexpr cpp::enable_if_t<
47LIBC_INLINE static constexpr cpp::enable_if_t<
4348 (sizeof(To) == sizeof(From)) &&
4449 cpp::is_trivially_constructible<To>::value &&
4550 cpp::is_trivially_copyable<To>::value &&
4651 cpp::is_trivially_copyable<From>::value,
4752 To>
4853bit_cast(const From &from) {
49 MSAN_UNPOISON(&from, sizeof(From));
50#if __has_builtin(__builtin_bit_cast) || defined(LIBC_COMPILER_IS_MSVC)
54#if LIBC_HAS_BUILTIN_BIT_CAST
5155 return __builtin_bit_cast(To, from);
5256#else
5357 To to{};
......@@ -60,14 +64,12 @@ bit_cast(const From &from) {
6064
6165// The following simple bit copy from a smaller type to maybe-larger type.
6266template <typename To, typename From>
63LIBC_INLINE constexpr cpp::enable_if_t<
64 (sizeof(To) >= sizeof(From)) &&
65 cpp::is_trivially_constructible<To>::value &&
66 cpp::is_trivially_copyable<To>::value &&
67 cpp::is_trivially_copyable<From>::value,
68 void>
67LIBC_INLINE cpp::enable_if_t<(sizeof(To) >= sizeof(From)) &&
68 cpp::is_trivially_constructible<To>::value &&
69 cpp::is_trivially_copyable<To>::value &&
70 cpp::is_trivially_copyable<From>::value,
71 void>
6972bit_copy(const From &from, To &to) {
70 MSAN_UNPOISON(&from, sizeof(From));
7173 char *dst = reinterpret_cast<char *>(&to);
7274 const char *src = reinterpret_cast<const char *>(&from);
7375 inline_copy<sizeof(From)>(src, dst);
......@@ -330,6 +332,36 @@ ADD_SPECIALIZATION(unsigned long long, __builtin_popcountll)
330332#endif // __builtin_popcountg
331333#undef ADD_SPECIALIZATION
332334
335/// Reverses the bytes in the given integer value.
336///
337/// All integral types are allowed, matching C++23 std::byteswap semantics.
338/// Signed types delegate to the unsigned path via static_cast.
339///
340/// The recursive decomposition generates optimal 'bswap' or 'rolw'
341/// instructions on Clang at -O2 without requiring compiler intrinsics.
342template <typename T>
343[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_integral_v<T>, T>
344byteswap(T value) {
345 static_assert(sizeof(T) <= 16, "byteswap: unsupported type size");
346 if constexpr (!cpp::is_unsigned_v<T>) {
347 using U = cpp::make_unsigned_t<T>;
348 return static_cast<T>(byteswap(static_cast<U>(value)));
349 } else if constexpr (sizeof(T) == 1) {
350 return value;
351 } else {
352 constexpr unsigned half_bits = sizeof(T) * 8 / 2;
353 using Half = cpp::conditional_t<
354 sizeof(T) == 2, uint8_t,
355 cpp::conditional_t<
356 sizeof(T) == 4, uint16_t,
357 cpp::conditional_t<sizeof(T) == 8, uint32_t, uint64_t>>>;
358 Half lo = static_cast<Half>(value);
359 Half hi = static_cast<Half>(value >> half_bits);
360 return static_cast<T>((static_cast<T>(byteswap(lo)) << half_bits) |
361 static_cast<T>(byteswap(hi)));
362 }
363}
364
333365} // namespace cpp
334366} // namespace LIBC_NAMESPACE_DECL
335367
lib/libcxx/libc/src/__support/CPP/iterator.h+29
......@@ -9,6 +9,7 @@
99#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_ITERATOR_H
1010#define LLVM_LIBC_SRC___SUPPORT_CPP_ITERATOR_H
1111
12#include "hdr/types/size_t.h"
1213#include "src/__support/CPP/type_traits/enable_if.h"
1314#include "src/__support/CPP/type_traits/is_convertible.h"
1415#include "src/__support/CPP/type_traits/is_same.h"
......@@ -18,9 +19,13 @@
1819namespace LIBC_NAMESPACE_DECL {
1920namespace cpp {
2021
22struct input_iterator_tag {};
23struct random_access_iterator_tag : input_iterator_tag {};
24
2125template <typename T> struct iterator_traits;
2226template <typename T> struct iterator_traits<T *> {
2327 using reference = T &;
28 using iterator_category = random_access_iterator_tag;
2429 using value_type = T;
2530};
2631
......@@ -93,6 +98,30 @@ public:
9398 }
9499};
95100
101namespace cpp_internal {
102
103template <typename It>
104LIBC_INLINE constexpr size_t distance(It first, It last,
105 random_access_iterator_tag) {
106 return last - first;
107}
108
109template <typename It>
110LIBC_INLINE constexpr auto distance(It first, It last, input_iterator_tag) {
111 size_t n = 0;
112 for (; first != last; ++first) {
113 ++n;
114 }
115 return n;
116}
117
118} // namespace cpp_internal
119
120template <typename It> LIBC_INLINE constexpr auto distance(It first, It last) {
121 return cpp_internal::distance(
122 first, last, typename iterator_traits<It>::iterator_category{});
123}
124
96125} // namespace cpp
97126} // namespace LIBC_NAMESPACE_DECL
98127
lib/libcxx/libc/src/__support/CPP/limits.h+26-62
......@@ -1,4 +1,4 @@
1//===-- A self contained equivalent of std::limits --------------*- C++ -*-===//
1//===-- A self contained equivalent of <limits> ----------------*- C++ -*-===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
......@@ -13,78 +13,42 @@
1313#include "src/__support/CPP/type_traits/is_integral.h"
1414#include "src/__support/CPP/type_traits/is_signed.h"
1515#include "src/__support/macros/attributes.h" // LIBC_INLINE
16#include "src/__support/macros/config.h"
17#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
1816
1917namespace LIBC_NAMESPACE_DECL {
2018namespace cpp {
2119
2220namespace internal {
2321
24template <typename T, T min_value, T max_value> struct integer_impl {
25 static_assert(cpp::is_integral_v<T>);
26 LIBC_INLINE static constexpr T max() { return max_value; }
27 LIBC_INLINE static constexpr T min() { return min_value; }
22template <typename T, bool is_integral> struct numeric_limits_impl {};
23
24template <typename T> struct numeric_limits_impl<T, true> {
25 LIBC_INLINE_VAR static constexpr bool is_signed = T(-1) < T(0);
26
2827 LIBC_INLINE_VAR static constexpr int digits =
29 CHAR_BIT * sizeof(T) - cpp::is_signed_v<T>;
28 (CHAR_BIT * sizeof(T)) - is_signed;
29
30 LIBC_INLINE static constexpr T min() {
31 if constexpr (is_signed) {
32 return T(T(1) << digits);
33 } else {
34 return 0;
35 }
36 }
37
38 LIBC_INLINE static constexpr T max() {
39 if constexpr (is_signed) {
40 return T(T(~0) ^ min());
41 } else {
42 return T(~0);
43 }
44 }
3045};
3146
3247} // namespace internal
3348
34template <class T> struct numeric_limits {};
35
36// TODO: Add numeric_limits specializations as needed for new types.
37template <>
38struct numeric_limits<short>
39 : public internal::integer_impl<short, SHRT_MIN, SHRT_MAX> {};
40
41template <>
42struct numeric_limits<unsigned short>
43 : public internal::integer_impl<unsigned short, 0, USHRT_MAX> {};
44
45template <>
46struct numeric_limits<int>
47 : public internal::integer_impl<int, INT_MIN, INT_MAX> {};
48
49template <>
50struct numeric_limits<unsigned int>
51 : public internal::integer_impl<unsigned int, 0, UINT_MAX> {};
52
53template <>
54struct numeric_limits<long>
55 : public internal::integer_impl<long, LONG_MIN, LONG_MAX> {};
56
57template <>
58struct numeric_limits<unsigned long>
59 : public internal::integer_impl<unsigned long, 0, ULONG_MAX> {};
60
61template <>
62struct numeric_limits<long long>
63 : public internal::integer_impl<long long, LLONG_MIN, LLONG_MAX> {};
64
65template <>
66struct numeric_limits<unsigned long long>
67 : public internal::integer_impl<unsigned long long, 0, ULLONG_MAX> {};
68
69template <>
70struct numeric_limits<char>
71 : public internal::integer_impl<char, CHAR_MIN, CHAR_MAX> {};
72
73template <>
74struct numeric_limits<signed char>
75 : public internal::integer_impl<signed char, SCHAR_MIN, SCHAR_MAX> {};
76
77template <>
78struct numeric_limits<unsigned char>
79 : public internal::integer_impl<unsigned char, 0, UCHAR_MAX> {};
80
81#ifdef LIBC_TYPES_HAS_INT128
82// On platform where UInt128 resolves to __uint128_t, this specialization
83// provides the limits of UInt128.
84template <>
85struct numeric_limits<__uint128_t>
86 : public internal::integer_impl<__uint128_t, 0, ~__uint128_t(0)> {};
87#endif
49template <typename T>
50struct numeric_limits
51 : public internal::numeric_limits_impl<T, is_integral_v<T>> {};
8852
8953} // namespace cpp
9054} // namespace LIBC_NAMESPACE_DECL
lib/libcxx/libc/src/__support/CPP/string_view.h+79-62
......@@ -18,46 +18,52 @@
1818namespace LIBC_NAMESPACE_DECL {
1919namespace cpp {
2020
21// This is very simple alternate of the std::string_view class. There is no
22// bounds check performed in any of the methods. The callers are expected to
23// do the checks before invoking the methods.
21template <typename CharT> class basic_string_view;
22
23using string_view = basic_string_view<char>;
24using wstring_view = basic_string_view<wchar_t>;
25
26// This is a very simple alternate of the std::basic_string_view class template.
27// There is no bounds check performed in any of the methods. The callers are
28// expected to do the checks before invoking the methods.
2429//
2530// This class will be extended as needed in future.
26class string_view {
31template <typename CharT> class basic_string_view {
2732private:
28 const char *Data;
33 const CharT *Data;
2934 size_t Len;
3035
31 LIBC_INLINE static size_t min(size_t A, size_t B) { return A <= B ? A : B; }
36 LIBC_INLINE static constexpr size_t min(size_t A, size_t B) {
37 return A <= B ? A : B;
38 }
3239
33 LIBC_INLINE static int compareMemory(const char *Lhs, const char *Rhs,
34 size_t Length) {
40 LIBC_INLINE static constexpr int compareN(const CharT *Lhs, const CharT *Rhs,
41 size_t Length) {
3542 for (size_t i = 0; i < Length; ++i)
36 if (int Diff = (int)Lhs[i] - (int)Rhs[i])
37 return Diff;
43 if (Lhs[i] != Rhs[i])
44 return Lhs[i] < Rhs[i] ? -1 : 1;
3845 return 0;
3946 }
4047
41 LIBC_INLINE static constexpr size_t length(const char *Str) {
42 for (const char *End = Str;; ++End)
43 if (*End == '\0')
48 LIBC_INLINE static constexpr size_t length(const CharT *Str) {
49 for (const CharT *End = Str;; ++End)
50 if (*End == CharT{0})
4451 return static_cast<size_t>(End - Str);
4552 }
4653
47 LIBC_INLINE bool equals(string_view Other) const {
48 return (Len == Other.Len &&
49 compareMemory(Data, Other.Data, Other.Len) == 0);
54 LIBC_INLINE constexpr bool equals(basic_string_view Other) const {
55 return (Len == Other.Len && compareN(Data, Other.Data, Other.Len) == 0);
5056 }
5157
5258public:
53 using value_type = char;
59 using value_type = CharT;
5460 using size_type = size_t;
5561 using difference_type = ptrdiff_t;
56 using pointer = char *;
57 using const_pointer = const char *;
58 using reference = char &;
59 using const_reference = const char &;
60 using const_iterator = char *;
62 using pointer = CharT *;
63 using const_pointer = const CharT *;
64 using reference = CharT &;
65 using const_reference = const CharT &;
66 using const_iterator = CharT *;
6167 using iterator = const_iterator;
6268
6369 // special value equal to the maximum value representable by the type
......@@ -65,124 +71,126 @@ public:
6571 LIBC_INLINE_VAR static constexpr size_t npos =
6672 cpp::numeric_limits<size_t>::max();
6773
68 LIBC_INLINE constexpr string_view() : Data(nullptr), Len(0) {}
74 LIBC_INLINE constexpr basic_string_view() : Data(nullptr), Len(0) {}
6975
7076 // Assumes Str is a null-terminated string. The length of the string does
7177 // not include the terminating null character.
7278 // Preconditions: [Str, Str + ​length(Str)) is a valid range.
73 LIBC_INLINE constexpr string_view(const char *Str)
79 LIBC_INLINE constexpr basic_string_view(const CharT *Str)
7480 : Data(Str), Len(length(Str)) {}
7581
7682 // Preconditions: [Str, Str + N) is a valid range.
77 LIBC_INLINE constexpr string_view(const char *Str, size_t N)
83 LIBC_INLINE constexpr basic_string_view(const CharT *Str, size_t N)
7884 : Data(Str), Len(N) {}
7985
80 LIBC_INLINE constexpr const char *data() const { return Data; }
86 LIBC_INLINE constexpr const CharT *data() const { return Data; }
8187
82 // Returns the size of the string_view.
88 // Returns the size of the basic_string_view.
8389 LIBC_INLINE constexpr size_t size() const { return Len; }
8490
85 // Returns whether the string_view is empty.
91 // Returns whether the basic_string_view is empty.
8692 LIBC_INLINE constexpr bool empty() const { return Len == 0; }
8793
8894 // Returns an iterator to the first character of the view.
89 LIBC_INLINE const char *begin() const { return Data; }
95 LIBC_INLINE constexpr const CharT *begin() const { return Data; }
9096
9197 // Returns an iterator to the character following the last character of the
9298 // view.
93 LIBC_INLINE const char *end() const { return Data + Len; }
99 LIBC_INLINE constexpr const CharT *end() const { return Data + Len; }
94100
95101 // Returns a const reference to the character at specified location pos.
96102 // No bounds checking is performed: the behavior is undefined if pos >=
97103 // size().
98 LIBC_INLINE constexpr const char &operator[](size_t Index) const {
104 LIBC_INLINE constexpr const CharT &operator[](size_t Index) const {
99105 return Data[Index];
100106 }
101107
102108 /// compare - Compare two strings; the result is -1, 0, or 1 if this string
103109 /// is lexicographically less than, equal to, or greater than the \p Other.
104 LIBC_INLINE int compare(string_view Other) const {
110 LIBC_INLINE constexpr int compare(basic_string_view Other) const {
105111 // Check the prefix for a mismatch.
106 if (int Res = compareMemory(Data, Other.Data, min(Len, Other.Len)))
107 return Res < 0 ? -1 : 1;
112 if (int Res = compareN(Data, Other.Data, min(Len, Other.Len)))
113 return Res;
108114 // Otherwise the prefixes match, so we only need to check the lengths.
109115 if (Len == Other.Len)
110116 return 0;
111117 return Len < Other.Len ? -1 : 1;
112118 }
113119
114 LIBC_INLINE bool operator==(string_view Other) const { return equals(Other); }
115 LIBC_INLINE bool operator!=(string_view Other) const {
120 LIBC_INLINE constexpr bool operator==(basic_string_view Other) const {
121 return equals(Other);
122 }
123 LIBC_INLINE constexpr bool operator!=(basic_string_view Other) const {
116124 return !(*this == Other);
117125 }
118 LIBC_INLINE bool operator<(string_view Other) const {
126 LIBC_INLINE constexpr bool operator<(basic_string_view Other) const {
119127 return compare(Other) == -1;
120128 }
121 LIBC_INLINE bool operator<=(string_view Other) const {
129 LIBC_INLINE constexpr bool operator<=(basic_string_view Other) const {
122130 return compare(Other) != 1;
123131 }
124 LIBC_INLINE bool operator>(string_view Other) const {
132 LIBC_INLINE constexpr bool operator>(basic_string_view Other) const {
125133 return compare(Other) == 1;
126134 }
127 LIBC_INLINE bool operator>=(string_view Other) const {
135 LIBC_INLINE constexpr bool operator>=(basic_string_view Other) const {
128136 return compare(Other) != -1;
129137 }
130138
131139 // Moves the start of the view forward by n characters.
132140 // The behavior is undefined if n > size().
133 LIBC_INLINE void remove_prefix(size_t N) {
141 LIBC_INLINE constexpr void remove_prefix(size_t N) {
134142 Len -= N;
135143 Data += N;
136144 }
137145
138146 // Moves the end of the view back by n characters.
139147 // The behavior is undefined if n > size().
140 LIBC_INLINE void remove_suffix(size_t N) { Len -= N; }
148 LIBC_INLINE constexpr void remove_suffix(size_t N) { Len -= N; }
141149
142150 // Check if this string starts with the given Prefix.
143 LIBC_INLINE bool starts_with(string_view Prefix) const {
144 return Len >= Prefix.Len &&
145 compareMemory(Data, Prefix.Data, Prefix.Len) == 0;
151 LIBC_INLINE constexpr bool starts_with(basic_string_view Prefix) const {
152 return Len >= Prefix.Len && compareN(Data, Prefix.Data, Prefix.Len) == 0;
146153 }
147154
148155 // Check if this string starts with the given Prefix.
149 LIBC_INLINE bool starts_with(const char Prefix) const {
156 LIBC_INLINE constexpr bool starts_with(const CharT Prefix) const {
150157 return !empty() && front() == Prefix;
151158 }
152159
153160 // Check if this string ends with the given Prefix.
154 LIBC_INLINE bool ends_with(const char Suffix) const {
161 LIBC_INLINE constexpr bool ends_with(const CharT Suffix) const {
155162 return !empty() && back() == Suffix;
156163 }
157164
158165 // Check if this string ends with the given Suffix.
159 LIBC_INLINE bool ends_with(string_view Suffix) const {
166 LIBC_INLINE constexpr bool ends_with(basic_string_view Suffix) const {
160167 return Len >= Suffix.Len &&
161 compareMemory(end() - Suffix.Len, Suffix.Data, Suffix.Len) == 0;
168 compareN(end() - Suffix.Len, Suffix.Data, Suffix.Len) == 0;
162169 }
163170
164171 // Return a reference to the substring from [Start, Start + N).
165172 //
166 // Start The index of the starting character in the substring; if the index is
167 // npos or greater than the length of the string then the empty substring will
168 // be returned.
173 // Start The index of the starting character in the substring; if the index
174 // is npos or greater than the length of the string then the empty substring
175 // will be returned.
169176 //
170177 // N The number of characters to included in the substring. If N exceeds the
171178 // number of characters remaining in the string, the string suffix (starting
172179 // with Start) will be returned.
173 LIBC_INLINE string_view substr(size_t Start, size_t N = npos) const {
180 LIBC_INLINE constexpr basic_string_view substr(size_t Start,
181 size_t N = npos) const {
174182 Start = min(Start, Len);
175 return string_view(Data + Start, min(N, Len - Start));
183 return basic_string_view(Data + Start, min(N, Len - Start));
176184 }
177185
178186 // front - Get the first character in the string.
179 LIBC_INLINE char front() const { return Data[0]; }
187 LIBC_INLINE constexpr CharT front() const { return Data[0]; }
180188
181189 // back - Get the last character in the string.
182 LIBC_INLINE char back() const { return Data[Len - 1]; }
190 LIBC_INLINE constexpr CharT back() const { return Data[Len - 1]; }
183191
184192 // Finds the first occurence of c in this view, starting at position From.
185 LIBC_INLINE constexpr size_t find_first_of(const char c,
193 LIBC_INLINE constexpr size_t find_first_of(const CharT c,
186194 size_t From = 0) const {
187195 for (size_t Pos = From; Pos < size(); ++Pos)
188196 if ((*this)[Pos] == c)
......@@ -191,7 +199,7 @@ public:
191199 }
192200
193201 // Finds the last occurence of c in this view, ending at position End.
194 LIBC_INLINE constexpr size_t find_last_of(const char c,
202 LIBC_INLINE constexpr size_t find_last_of(const CharT c,
195203 size_t End = npos) const {
196204 End = End >= size() ? size() : End + 1;
197205 for (; End > 0; --End)
......@@ -200,9 +208,18 @@ public:
200208 return npos;
201209 }
202210
203 // Finds the first character not equal to c in this view, starting at position
204 // From.
205 LIBC_INLINE constexpr size_t find_first_not_of(const char c,
211 LIBC_INLINE constexpr size_t find_last_not_of(const char c,
212 size_t end = npos) const {
213 end = end >= size() ? size() : end + 1;
214 for (; end > 0; --end)
215 if ((*this)[end - 1] != c)
216 return end - 1;
217 return npos;
218 }
219
220 // Finds the first character not equal to c in this view, starting at
221 // position From.
222 LIBC_INLINE constexpr size_t find_first_not_of(const CharT c,
206223 size_t From = 0) const {
207224 for (size_t Pos = From; Pos < size(); ++Pos)
208225 if ((*this)[Pos] != c)
......@@ -211,7 +228,7 @@ public:
211228 }
212229
213230 // Check if this view contains the given character.
214 LIBC_INLINE constexpr bool contains(char c) const {
231 LIBC_INLINE constexpr bool contains(CharT c) const {
215232 return find_first_of(c) != npos;
216233 }
217234};
lib/libcxx/libc/src/__support/CPP/type_traits/is_assignable.h created+63
......@@ -0,0 +1,63 @@
1//===------------------------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// \file
10// This file contains a free-standing implementation of is_assignable
11// type trait.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ASSIGNABLE_H
16#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ASSIGNABLE_H
17
18#include "src/__support/CPP/type_traits/bool_constant.h"
19#include "src/__support/CPP/utility/declval.h"
20#include "src/__support/macros/attributes.h"
21#include "src/__support/macros/config.h"
22
23namespace LIBC_NAMESPACE_DECL {
24namespace cpp {
25
26namespace is_assignable_detail {
27
28#if LIBC_HAS_BUILTIN_IS_ASSIGNABLE
29
30template <typename T, typename U>
31struct is_assignable_impl : public bool_constant<__is_assignable(T, U)> {};
32
33#else
34// Fallback SFINAE implementation for GCC 7 and older toolchains
35
36template <typename T, typename U> struct is_assignable_impl {
37private:
38 template <typename T1, typename U1>
39 LIBC_INLINE static auto test(int)
40 -> decltype(declval<T1>() = declval<U1>(), bool_constant<true>());
41
42 template <typename, typename>
43 LIBC_INLINE static auto test(...) -> bool_constant<false>;
44
45public:
46 using type = decltype(test<T, U>(0));
47};
48
49#endif // LIBC_HAS_BUILTIN_IS_ASSIGNABLE
50
51} // namespace is_assignable_detail
52
53// is_assignable
54template <typename T, typename U>
55struct is_assignable : public is_assignable_detail::is_assignable_impl<T, U> {};
56
57template <typename T, typename U>
58LIBC_INLINE_VAR constexpr bool is_assignable_v = is_assignable<T, U>::value;
59
60} // namespace cpp
61} // namespace LIBC_NAMESPACE_DECL
62
63#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ASSIGNABLE_H
lib/libcxx/libc/src/__support/CPP/type_traits/is_constant_evaluated.h+4
......@@ -15,7 +15,11 @@ namespace LIBC_NAMESPACE_DECL {
1515namespace cpp {
1616
1717LIBC_INLINE constexpr bool is_constant_evaluated() {
18#if LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED
1819 return __builtin_is_constant_evaluated();
20#else
21 return false;
22#endif
1923}
2024
2125} // namespace cpp
lib/libcxx/libc/src/__support/CPP/type_traits/is_constructible.h created+65
......@@ -0,0 +1,65 @@
1//===------------------------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// \file
10// This file contains a free-standing implementation of is_constructible
11// type trait.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONSTRUCTIBLE_H
16#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONSTRUCTIBLE_H
17
18#include "src/__support/CPP/type_traits/bool_constant.h"
19#include "src/__support/CPP/utility/declval.h"
20#include "src/__support/macros/attributes.h"
21#include "src/__support/macros/config.h"
22
23namespace LIBC_NAMESPACE_DECL {
24namespace cpp {
25
26namespace is_contructible_detail {
27
28#if LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE
29
30template <typename T, typename... Args>
31struct is_constructible_impl
32 : public bool_constant<__is_constructible(T, Args...)> {};
33
34#else
35// Fallback SFINAE implementation for GCC 7 and older toolchains
36
37template <typename T, typename... Args> struct is_constructible_impl {
38private:
39 template <typename T1, typename... Args1>
40 LIBC_INLINE static auto test(int)
41 -> decltype(T1(declval<Args1>()...), bool_constant<true>());
42
43 template <typename, typename...>
44 LIBC_INLINE static auto test(...) -> bool_constant<false>;
45
46public:
47 using type = decltype(test<T, Args...>(0));
48};
49
50#endif // LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE
51
52} // namespace is_contructible_detail
53
54template <typename T, typename... Args>
55struct is_constructible
56 : public is_contructible_detail::is_constructible_impl<T, Args...> {};
57
58template <typename T, typename... Args>
59LIBC_INLINE_VAR constexpr bool is_constructible_v =
60 is_constructible<T, Args...>::value;
61
62} // namespace cpp
63} // namespace LIBC_NAMESPACE_DECL
64
65#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONSTRUCTIBLE_H
lib/libcxx/libc/src/__support/CPP/type_traits/is_copy_assignable.h+3-4
......@@ -9,7 +9,7 @@
99#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_COPY_ASSIGNABLE_H
1010
1111#include "src/__support/CPP/type_traits/add_lvalue_reference.h"
12#include "src/__support/CPP/type_traits/integral_constant.h"
12#include "src/__support/CPP/type_traits/is_assignable.h"
1313#include "src/__support/macros/config.h"
1414
1515namespace LIBC_NAMESPACE_DECL {
......@@ -18,9 +18,8 @@ namespace cpp {
1818// is copy assignable
1919template <class T>
2020struct is_copy_assignable
21 : public integral_constant<
22 bool, __is_assignable(cpp::add_lvalue_reference_t<T>,
23 cpp::add_lvalue_reference_t<const T>)> {};
21 : public cpp::is_assignable<cpp::add_lvalue_reference_t<T>,
22 cpp::add_lvalue_reference_t<const T>> {};
2423
2524template <class T>
2625LIBC_INLINE_VAR constexpr bool is_copy_assignable_v =
lib/libcxx/libc/src/__support/CPP/type_traits/is_copy_constructible.h+2-3
......@@ -9,7 +9,7 @@
99#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_COPY_CONSTRUCTIBLE_H
1010
1111#include "src/__support/CPP/type_traits/add_lvalue_reference.h"
12#include "src/__support/CPP/type_traits/integral_constant.h"
12#include "src/__support/CPP/type_traits/is_constructible.h"
1313#include "src/__support/macros/config.h"
1414
1515namespace LIBC_NAMESPACE_DECL {
......@@ -18,8 +18,7 @@ namespace cpp {
1818// is copy constructible
1919template <class T>
2020struct is_copy_constructible
21 : public integral_constant<
22 bool, __is_constructible(T, cpp::add_lvalue_reference_t<const T>)> {};
21 : public cpp::is_constructible<T, cpp::add_lvalue_reference_t<const T>> {};
2322
2423template <class T>
2524LIBC_INLINE_VAR constexpr bool is_copy_constructible_v =
lib/libcxx/libc/src/__support/CPP/type_traits/is_integral.h+10-5
......@@ -26,13 +26,18 @@ private:
2626 }
2727
2828public:
29 LIBC_INLINE_VAR static constexpr bool value = __is_unqualified_any_of<
30 T,
29 LIBC_INLINE_VAR static constexpr bool value =
30 __is_unqualified_any_of<T,
3131#ifdef LIBC_TYPES_HAS_INT128
32 __int128_t, __uint128_t,
32 __int128_t, __uint128_t,
3333#endif
34 char, signed char, unsigned char, short, unsigned short, int,
35 unsigned int, long, unsigned long, long long, unsigned long long, bool>();
34#ifdef __cpp_char8_t
35 char8_t,
36#endif
37 char16_t, char32_t, wchar_t, char, signed char,
38 unsigned char, short, unsigned short, int,
39 unsigned int, long, unsigned long, long long,
40 unsigned long long, bool>();
3641};
3742template <typename T>
3843LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value;
lib/libcxx/libc/src/__support/CPP/type_traits/is_move_assignable.h+3-4
......@@ -10,7 +10,7 @@
1010
1111#include "src/__support/CPP/type_traits/add_lvalue_reference.h"
1212#include "src/__support/CPP/type_traits/add_rvalue_reference.h"
13#include "src/__support/CPP/type_traits/integral_constant.h"
13#include "src/__support/CPP/type_traits/is_assignable.h"
1414#include "src/__support/macros/config.h"
1515
1616namespace LIBC_NAMESPACE_DECL {
......@@ -19,9 +19,8 @@ namespace cpp {
1919// is move assignable
2020template <class T>
2121struct is_move_assignable
22 : public integral_constant<bool, __is_assignable(
23 cpp::add_lvalue_reference_t<T>,
24 cpp::add_rvalue_reference_t<T>)> {};
22 : public cpp::is_assignable<cpp::add_lvalue_reference_t<T>,
23 cpp::add_rvalue_reference_t<T>> {};
2524
2625template <class T>
2726LIBC_INLINE_VAR constexpr bool is_move_assignable_v =
lib/libcxx/libc/src/__support/CPP/type_traits/is_move_constructible.h+2-3
......@@ -9,7 +9,7 @@
99#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MOVE_CONSTRUCTIBLE_H
1010
1111#include "src/__support/CPP/type_traits/add_rvalue_reference.h"
12#include "src/__support/CPP/type_traits/integral_constant.h"
12#include "src/__support/CPP/type_traits/is_constructible.h"
1313#include "src/__support/macros/config.h"
1414
1515namespace LIBC_NAMESPACE_DECL {
......@@ -18,8 +18,7 @@ namespace cpp {
1818// is move constructible
1919template <class T>
2020struct is_move_constructible
21 : public integral_constant<bool, __is_constructible(
22 T, cpp::add_rvalue_reference_t<T>)> {};
21 : public cpp::is_constructible<T, cpp::add_rvalue_reference_t<T>> {};
2322
2423template <class T>
2524LIBC_INLINE_VAR constexpr bool is_move_constructible_v =
lib/libcxx/libc/src/__support/CPP/type_traits/is_unsigned.h+3-3
......@@ -10,7 +10,7 @@
1010
1111#include "include/llvm-libc-macros/stdfix-macros.h"
1212#include "src/__support/CPP/type_traits/bool_constant.h"
13#include "src/__support/CPP/type_traits/is_arithmetic.h"
13#include "src/__support/CPP/type_traits/is_integral.h"
1414#include "src/__support/CPP/type_traits/is_same.h"
1515#include "src/__support/CPP/type_traits/remove_cv.h"
1616#include "src/__support/macros/attributes.h"
......@@ -23,7 +23,7 @@ namespace cpp {
2323
2424#ifndef LIBC_COMPILER_HAS_FIXED_POINT
2525template <typename T>
26struct is_unsigned : bool_constant<(is_arithmetic_v<T> && (T(-1) > T(0)))> {
26struct is_unsigned : bool_constant<(is_integral_v<T> && (T(-1) > T(0)))> {
2727 LIBC_INLINE constexpr operator bool() const { return is_unsigned::value; }
2828 LIBC_INLINE constexpr bool operator()() const { return is_unsigned::value; }
2929};
......@@ -37,7 +37,7 @@ private:
3737
3838public:
3939 LIBC_INLINE_VAR static constexpr bool value =
40 (is_arithmetic_v<T> && (T(-1) > T(0))) ||
40 (is_integral_v<T> && (T(-1) > T(0))) ||
4141 __is_unqualified_any_of<T, unsigned short fract, unsigned fract,
4242 unsigned long fract, unsigned short accum,
4343 unsigned accum, unsigned long accum,
lib/libcxx/libc/src/__support/FPUtil/FPBits.h+16-13
......@@ -798,7 +798,9 @@ template <typename T> LIBC_INLINE static constexpr FPType get_fp_type() {
798798 return FPType::IEEE754_Binary64;
799799 else if constexpr (LDBL_MANT_DIG == 64)
800800 return FPType::X86_Binary80;
801 else if constexpr (LDBL_MANT_DIG == 113)
801 // TODO: properly treat double-double type.
802 // else if constexpr (LDBL_MANT_DIG == 113)
803 else
802804 return FPType::IEEE754_Binary128;
803805 }
804806#if defined(LIBC_TYPES_HAS_FLOAT16)
......@@ -833,21 +835,22 @@ struct FPBits final : public internal::FPRepImpl<get_fp_type<T>(), FPBits<T>> {
833835 // Constructors.
834836 LIBC_INLINE constexpr FPBits() = default;
835837
836 template <typename XType> LIBC_INLINE constexpr explicit FPBits(XType x) {
837 using Unqual = typename cpp::remove_cv_t<XType>;
838 if constexpr (cpp::is_same_v<Unqual, T>) {
839 UP::bits = cpp::bit_cast<StorageType>(x);
840 } else if constexpr (cpp::is_same_v<Unqual, StorageType>) {
841 UP::bits = x;
842 } else {
843 // We don't want accidental type promotions/conversions, so we require
844 // exact type match.
845 static_assert(cpp::always_false<XType>);
846 }
838 template <
839 typename XType,
840 cpp::enable_if_t<cpp::is_same_v<cpp::remove_cv_t<XType>, T>, int> = 0>
841 LIBC_INLINE LIBC_BIT_CAST_CONSTEXPR explicit FPBits(XType x) {
842 UP::bits = cpp::bit_cast<StorageType>(x);
847843 }
848844
845 template <typename XType,
846 cpp::enable_if_t<
847 cpp::is_same_v<cpp::remove_cv_t<XType>, StorageType>, int> = 0>
848 LIBC_INLINE constexpr explicit FPBits(XType x) : UP(x) {}
849
849850 // Floating-point conversions.
850 LIBC_INLINE constexpr T get_val() const { return cpp::bit_cast<T>(UP::bits); }
851 LIBC_INLINE LIBC_BIT_CAST_CONSTEXPR T get_val() const {
852 return cpp::bit_cast<T>(UP::bits);
853 }
851854};
852855
853856} // namespace fputil
lib/libcxx/libc/src/__support/FPUtil/rounding_mode.h+25-5
......@@ -24,8 +24,12 @@ namespace generic {
2424// 1.0f + 2^-25 = 1.0f for FE_TONEAREST, FE_DOWNWARD, FE_TOWARDZERO
2525// = 0x1.000002f for FE_UPWARD.
2626LIBC_INLINE bool fenv_is_round_up() {
27#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
28 return false;
29#else
2730 static volatile float x = 0x1.0p-25f;
2831 return (1.0f + x != 1.0f);
32#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
2933}
3034
3135// Quick free-standing test whether fegetround() == FE_DOWNWARD.
......@@ -33,8 +37,12 @@ LIBC_INLINE bool fenv_is_round_up() {
3337// -1.0f - 2^-25 = -1.0f for FE_TONEAREST, FE_UPWARD, FE_TOWARDZERO
3438// = -0x1.000002f for FE_DOWNWARD.
3539LIBC_INLINE bool fenv_is_round_down() {
40#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
41 return false;
42#else
3643 static volatile float x = 0x1.0p-25f;
3744 return (-1.0f - x != -1.0f);
45#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
3846}
3947
4048// Quick free-standing test whether fegetround() == FE_TONEAREST.
......@@ -44,9 +52,13 @@ LIBC_INLINE bool fenv_is_round_down() {
4452// 1.5f - 2^-24 = 1.5f for FE_TONEAREST, FE_UPWARD
4553// = 0x1.0ffffep-1f for FE_DOWNWARD, FE_TOWARDZERO
4654LIBC_INLINE bool fenv_is_round_to_nearest() {
55#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
56 return true;
57#else
4758 static volatile float x = 0x1.0p-24f;
4859 float y = 1.5f + x;
4960 return (y == 1.5f - x);
61#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
5062}
5163
5264// Quick free-standing test whether fegetround() == FE_TOWARDZERO.
......@@ -60,13 +72,20 @@ LIBC_INLINE bool fenv_is_round_to_nearest() {
6072// = 2^-22 for FE_TONEAREST, FE_UPWARD
6173// = 0 for FE_DOWNWARD
6274LIBC_INLINE bool fenv_is_round_to_zero() {
75#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
76 return false;
77#else
6378 static volatile float x = 0x1.0p-24f;
6479 float y = x;
6580 return ((0x1.000002p0f + y) + (-1.0f - y) == 0x1.0p-23f);
81#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
6682}
6783
6884// Quick free standing get rounding mode based on the above observations.
6985LIBC_INLINE int quick_get_round() {
86#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
87 return FE_TONEAREST;
88#else
7089 static volatile float x = 0x1.0p-24f;
7190 float y = x;
7291 float z = (0x1.000002p0f + y) + (-1.0f - y);
......@@ -76,11 +95,12 @@ LIBC_INLINE int quick_get_round() {
7695 if (z == 0x1.0p-23f)
7796 return FE_TOWARDZERO;
7897 return (2.0f + y == 2.0f) ? FE_TONEAREST : FE_UPWARD;
98#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
7999}
80100
81101} // namespace generic
82102
83LIBC_INLINE static constexpr bool fenv_is_round_up() {
103LIBC_INLINE LIBC_CONSTEXPR_DEFAULT bool fenv_is_round_up() {
84104 if (cpp::is_constant_evaluated()) {
85105 return false;
86106 } else {
......@@ -88,7 +108,7 @@ LIBC_INLINE static constexpr bool fenv_is_round_up() {
88108 }
89109}
90110
91LIBC_INLINE static constexpr bool fenv_is_round_down() {
111LIBC_INLINE LIBC_CONSTEXPR_DEFAULT bool fenv_is_round_down() {
92112 if (cpp::is_constant_evaluated()) {
93113 return false;
94114 } else {
......@@ -96,7 +116,7 @@ LIBC_INLINE static constexpr bool fenv_is_round_down() {
96116 }
97117}
98118
99LIBC_INLINE static constexpr bool fenv_is_round_to_nearest() {
119LIBC_INLINE LIBC_CONSTEXPR_DEFAULT bool fenv_is_round_to_nearest() {
100120 if (cpp::is_constant_evaluated()) {
101121 return true;
102122 } else {
......@@ -104,7 +124,7 @@ LIBC_INLINE static constexpr bool fenv_is_round_to_nearest() {
104124 }
105125}
106126
107LIBC_INLINE static constexpr bool fenv_is_round_to_zero() {
127LIBC_INLINE LIBC_CONSTEXPR_DEFAULT bool fenv_is_round_to_zero() {
108128 if (cpp::is_constant_evaluated()) {
109129 return false;
110130 } else {
......@@ -113,7 +133,7 @@ LIBC_INLINE static constexpr bool fenv_is_round_to_zero() {
113133}
114134
115135// Quick free standing get rounding mode based on the above observations.
116LIBC_INLINE static constexpr int quick_get_round() {
136LIBC_INLINE LIBC_CONSTEXPR_DEFAULT int quick_get_round() {
117137 if (cpp::is_constant_evaluated()) {
118138 return FE_TONEAREST;
119139 } else {
lib/libcxx/libc/src/__support/big_int.h+35-49
......@@ -242,10 +242,9 @@ LIBC_INLINE constexpr void quick_mul_hi(cpp::array<word, N> &dst,
242242
243243template <typename word, size_t N>
244244LIBC_INLINE constexpr bool is_negative(const cpp::array<word, N> &array) {
245 using signed_word = cpp::make_signed_t<word>;
246 return cpp::bit_cast<signed_word>(array.back()) < 0;
245 constexpr size_t WORD_BITS = cpp::numeric_limits<word>::digits;
246 return (array.back() >> (WORD_BITS - 1)) != 0;
247247}
248
249248// An enum for the shift function below.
250249enum Direction { LEFT, RIGHT };
251250
......@@ -257,9 +256,11 @@ LIBC_INLINE constexpr cpp::array<word, N> shift(cpp::array<word, N> array,
257256 size_t offset) {
258257 static_assert(direction == LEFT || direction == RIGHT);
259258 constexpr size_t WORD_BITS = cpp::numeric_limits<word>::digits;
259#if LIBC_HAS_BUILTIN_BIT_CAST
260260#ifdef LIBC_TYPES_HAS_INT128
261261 constexpr size_t TOTAL_BITS = N * WORD_BITS;
262 if constexpr (TOTAL_BITS == 128) {
262 if constexpr (TOTAL_BITS == 128 &&
263 __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) {
263264 using type = cpp::conditional_t<is_signed, __int128_t, __uint128_t>;
264265 auto tmp = cpp::bit_cast<type>(array);
265266 if constexpr (direction == LEFT)
......@@ -269,6 +270,8 @@ LIBC_INLINE constexpr cpp::array<word, N> shift(cpp::array<word, N> array,
269270 return cpp::bit_cast<cpp::array<word, N>>(tmp);
270271 }
271272#endif
273#endif // LIBC_HAS_BUILTIN_BIT_CAST
274
272275 if (LIBC_UNLIKELY(offset == 0))
273276 return array;
274277 const bool is_neg = is_signed && is_negative(array);
......@@ -336,8 +339,8 @@ private:
336339 "WordType must be unsigned integer.");
337340
338341 struct Division {
339 BigInt quotient;
340 BigInt remainder;
342 BigInt quotient{};
343 BigInt remainder{};
341344 };
342345
343346public:
......@@ -355,7 +358,7 @@ public:
355358
356359 LIBC_INLINE_VAR static constexpr size_t WORD_COUNT = Bits / WORD_SIZE;
357360
358 cpp::array<WordType, WORD_COUNT> val{}; // zero initialized.
361 cpp::array<WordType, WORD_COUNT> val;
359362
360363 LIBC_INLINE constexpr BigInt() = default;
361364
......@@ -363,9 +366,10 @@ public:
363366
364367 template <size_t OtherBits, bool OtherSigned, typename OtherWordType>
365368 LIBC_INLINE constexpr BigInt(
366 const BigInt<OtherBits, OtherSigned, OtherWordType> &other) {
369 const BigInt<OtherBits, OtherSigned, OtherWordType> &other)
370 : val{} {
367371 using BigIntOther = BigInt<OtherBits, OtherSigned, OtherWordType>;
368 const bool should_sign_extend = Signed && other.is_neg();
372 [[maybe_unused]] const bool should_sign_extend = Signed && other.is_neg();
369373
370374 static_assert(!(Bits == OtherBits && WORD_SIZE != BigIntOther::WORD_SIZE) &&
371375 "This is currently untested for casting between bigints with "
......@@ -453,20 +457,22 @@ public:
453457 }
454458
455459 // Construct a BigInt from a C array.
456 template <size_t N> LIBC_INLINE constexpr BigInt(const WordType (&nums)[N]) {
460 template <size_t N>
461 LIBC_INLINE constexpr BigInt(const WordType (&nums)[N]) : val{} {
457462 static_assert(N == WORD_COUNT);
458463 for (size_t i = 0; i < WORD_COUNT; ++i)
459464 val[i] = nums[i];
460465 }
461466
462467 LIBC_INLINE constexpr explicit BigInt(
463 const cpp::array<WordType, WORD_COUNT> &words) {
468 const cpp::array<WordType, WORD_COUNT> &words)
469 : val{} {
464470 val = words;
465471 }
466472
467473 // Initialize the first word to |v| and the rest to 0.
468474 template <typename T, typename = cpp::enable_if_t<cpp::is_integral_v<T>>>
469 LIBC_INLINE constexpr BigInt(T v) {
475 LIBC_INLINE constexpr BigInt(T v) : val{} {
470476 constexpr size_t T_SIZE = sizeof(T) * CHAR_BIT;
471477 const bool is_neg = v < 0;
472478 for (size_t i = 0; i < WORD_COUNT; ++i) {
......@@ -488,7 +494,7 @@ public:
488494 LIBC_INLINE static constexpr BigInt one() { return BigInt(1); }
489495 LIBC_INLINE static constexpr BigInt all_ones() { return ~zero(); }
490496 LIBC_INLINE static constexpr BigInt min() {
491 BigInt out;
497 BigInt out{};
492498 if constexpr (SIGNED)
493499 out.set_msb();
494500 return out;
......@@ -601,7 +607,7 @@ public:
601607 template <size_t OtherBits>
602608 LIBC_INLINE constexpr auto
603609 ful_mul(const BigInt<OtherBits, Signed, WordType> &other) const {
604 BigInt<Bits + OtherBits, Signed, WordType> result;
610 BigInt<Bits + OtherBits, Signed, WordType> result{};
605611 multiword::multiply_with_carry(result.val, val, other.val);
606612 return result;
607613 }
......@@ -633,7 +639,7 @@ public:
633639 // 256 4 16 10 3
634640 // 512 8 64 36 7
635641 LIBC_INLINE constexpr BigInt quick_mul_hi(const BigInt &other) const {
636 BigInt result;
642 BigInt result{};
637643 multiword::quick_mul_hi(result.val, val, other.val);
638644 return result;
639645 }
......@@ -686,7 +692,7 @@ public:
686692 // And finally we perform some extra alignment steps for the remaining bits.
687693 LIBC_INLINE constexpr cpp::optional<BigInt>
688694 div_uint_half_times_pow_2(multiword::half_width_t<WordType> x, size_t e) {
689 BigInt remainder;
695 BigInt remainder{};
690696 if (x == 0)
691697 return cpp::nullopt;
692698 if (e >= Bits) {
......@@ -694,7 +700,7 @@ public:
694700 *this = BigInt<Bits, false, WordType>();
695701 return remainder;
696702 }
697 BigInt quotient;
703 BigInt quotient{};
698704 WordType x_word = static_cast<WordType>(x);
699705 constexpr size_t LOG2_WORD_SIZE =
700706 static_cast<size_t>(cpp::bit_width(WORD_SIZE) - 1);
......@@ -846,13 +852,13 @@ public:
846852#define DEFINE_BINOP(OP) \
847853 LIBC_INLINE friend constexpr BigInt operator OP(const BigInt &lhs, \
848854 const BigInt &rhs) { \
849 BigInt result; \
855 BigInt result{}; \
850856 for (size_t i = 0; i < WORD_COUNT; ++i) \
851857 result[i] = lhs[i] OP rhs[i]; \
852858 return result; \
853859 } \
854 LIBC_INLINE friend constexpr BigInt operator OP##=(BigInt &lhs, \
855 const BigInt &rhs) { \
860 LIBC_INLINE friend constexpr BigInt operator OP## = \
861 (BigInt & lhs, const BigInt &rhs) { \
856862 for (size_t i = 0; i < WORD_COUNT; ++i) \
857863 lhs[i] OP## = rhs[i]; \
858864 return lhs; \
......@@ -864,7 +870,7 @@ public:
864870#undef DEFINE_BINOP
865871
866872 LIBC_INLINE constexpr BigInt operator~() const {
867 BigInt result;
873 BigInt result{};
868874 for (size_t i = 0; i < WORD_COUNT; ++i)
869875 result[i] = static_cast<WordType>(~val[i]);
870876 return result;
......@@ -1004,7 +1010,7 @@ private:
10041010 LIBC_INLINE constexpr static Division divide_unsigned(const BigInt &dividend,
10051011 const BigInt &divider) {
10061012 BigInt remainder = dividend;
1007 BigInt quotient;
1013 BigInt quotient{};
10081014 if (remainder >= divider) {
10091015 BigInt subtractor = divider;
10101016 int cur_bit = multiword::countl_zero(subtractor.val) -
......@@ -1181,31 +1187,6 @@ LIBC_INLINE_VAR constexpr bool is_unsigned_integral_or_big_int_v =
11811187
11821188namespace cpp {
11831189
1184// Specialization of cpp::bit_cast ('bit.h') from T to BigInt.
1185template <typename To, typename From>
1186LIBC_INLINE constexpr cpp::enable_if_t<
1187 (sizeof(To) == sizeof(From)) && cpp::is_trivially_copyable<To>::value &&
1188 cpp::is_trivially_copyable<From>::value && is_big_int<To>::value,
1189 To>
1190bit_cast(const From &from) {
1191 To out;
1192 using Storage = decltype(out.val);
1193 out.val = cpp::bit_cast<Storage>(from);
1194 return out;
1195}
1196
1197// Specialization of cpp::bit_cast ('bit.h') from BigInt to T.
1198template <typename To, size_t Bits>
1199LIBC_INLINE constexpr cpp::enable_if_t<
1200 sizeof(To) == sizeof(UInt<Bits>) &&
1201 cpp::is_trivially_constructible<To>::value &&
1202 cpp::is_trivially_copyable<To>::value &&
1203 cpp::is_trivially_copyable<UInt<Bits>>::value,
1204 To>
1205bit_cast(const UInt<Bits> &from) {
1206 return cpp::bit_cast<To>(from.val);
1207}
1208
12091190// Specialization of cpp::popcount ('bit.h') for BigInt.
12101191template <typename T>
12111192[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<is_big_int_v<T>, int>
......@@ -1311,7 +1292,7 @@ mask_trailing_ones() {
13111292 return T::all_ones();
13121293 constexpr size_t QUOTIENT = count / T::WORD_SIZE;
13131294 constexpr size_t REMAINDER = count % T::WORD_SIZE;
1314 T out; // zero initialized
1295 T out{};
13151296 for (size_t i = 0; i <= QUOTIENT; ++i)
13161297 out[i] = i < QUOTIENT
13171298 ? cpp::numeric_limits<typename T::word_type>::max()
......@@ -1327,7 +1308,7 @@ LIBC_INLINE constexpr cpp::enable_if_t<is_big_int_v<T>, T> mask_leading_ones() {
13271308 return T::all_ones();
13281309 constexpr size_t QUOTIENT = (T::BITS - count - 1U) / T::WORD_SIZE;
13291310 constexpr size_t REMAINDER = count % T::WORD_SIZE;
1330 T out; // zero initialized
1311 T out{};
13311312 for (size_t i = QUOTIENT; i < T::WORD_COUNT; ++i)
13321313 out[i] = i > QUOTIENT
13331314 ? cpp::numeric_limits<typename T::word_type>::max()
......@@ -1386,6 +1367,11 @@ first_trailing_one(T value) {
13861367 return value == 0 ? 0 : cpp::countr_zero(value) + 1;
13871368}
13881369
1370static_assert(LIBC_NAMESPACE::cpp::is_trivially_constructible<
1371 LIBC_NAMESPACE::BigInt<128, false>>::value);
1372static_assert(LIBC_NAMESPACE::cpp::is_trivially_copyable<
1373 LIBC_NAMESPACE::BigInt<128, false>>::value);
1374
13891375} // namespace LIBC_NAMESPACE_DECL
13901376
13911377#endif // LLVM_LIBC_SRC___SUPPORT_BIG_INT_H
lib/libcxx/libc/src/__support/common.h+45-32
......@@ -22,6 +22,10 @@
2222#define LLVM_LIBC_FUNCTION_ATTR
2323#endif
2424
25#ifndef LLVM_LIBC_VARIABLE_ATTR
26#define LLVM_LIBC_VARIABLE_ATTR
27#endif
28
2529// clang-format off
2630// Allow each function `func` to have extra attributes specified by defining:
2731// `LLVM_LIBC_FUNCTION_ATTR_func` macro, which should always start with
......@@ -33,7 +37,9 @@
3337// clang-format on
3438#define LLVM_LIBC_EMPTY
3539
40#define GET_NOTHING(...) 0
3641#define GET_SECOND(first, second, ...) second
42#define GET_FIFTH(first, second, third, fourth, fifth, ...) fifth
3743#define EXPAND_THEN_SECOND(name) GET_SECOND(name, LLVM_LIBC_EMPTY)
3844
3945#define LLVM_LIBC_ATTR(name) EXPAND_THEN_SECOND(LLVM_LIBC_FUNCTION_ATTR_##name)
......@@ -44,50 +50,57 @@
4450// symbol. Moreover, a C symbol `func` in macOS is mangled as `_func`.
4551#if defined(LIBC_COPT_PUBLIC_PACKAGING) && !defined(LIBC_COMPILER_IS_MSVC)
4652#ifndef __APPLE__
47#define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist) \
53#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
4854 LLVM_LIBC_ATTR(name) \
4955 LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) \
50 __##name##_impl__ asm(#name); \
51 decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]]; \
56 __##name##_impl__ asm(c_alias); \
57 decltype(LIBC_NAMESPACE::name) name [[gnu::alias(c_alias)]]; \
5258 type __##name##_impl__ arglist
5359#else // __APPLE__
54#define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist) \
60#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
5561 LLVM_LIBC_ATTR(name) \
56 LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) name asm("_" #name); \
62 LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) name asm( \
63 "_" c_alias); \
5764 type name arglist
5865#endif // __APPLE__
66
5967#else // LIBC_COPT_PUBLIC_PACKAGING
60#define LLVM_LIBC_FUNCTION_IMPL(type, name, arglist) type name arglist
68#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
69 type name arglist
6170#endif // LIBC_COPT_PUBLIC_PACKAGING
6271
63// This extra layer of macro allows `name` to be a macro to rename a function.
64#define LLVM_LIBC_FUNCTION(type, name, arglist) \
65 LLVM_LIBC_FUNCTION_IMPL(type, name, arglist)
72#define LLVM_LIBC_FUNCTION_IMPL_3(type, name, arglist) \
73 LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, #name)
6674
67namespace LIBC_NAMESPACE_DECL {
68namespace internal {
69LIBC_INLINE constexpr bool same_string(char const *lhs, char const *rhs) {
70 for (; *lhs || *rhs; ++lhs, ++rhs)
71 if (*lhs != *rhs)
72 return false;
73 return true;
74}
75} // namespace internal
76} // namespace LIBC_NAMESPACE_DECL
75// LLVM_LIBC_FUNCTION(type, name, arglist) is equivalent to
76// LLVM_LIBC_FUNCTION(type, name, arglist, #name)
77#define LLVM_LIBC_FUNCTION(...) \
78 GET_FIFTH(__VA_ARGS__, LLVM_LIBC_FUNCTION_IMPL_4, LLVM_LIBC_FUNCTION_IMPL_3, \
79 GET_NOTHING)(__VA_ARGS__)
7780
78#define __LIBC_MACRO_TO_STRING(str) #str
79#define LIBC_MACRO_TO_STRING(str) __LIBC_MACRO_TO_STRING(str)
81// At the moment, [[gnu::alias()]] is not supported on MacOS, and it is needed
82// to cleanly export and alias the C++ symbol `LIBC_NAMESPACE::func` with the C
83// symbol `func`. So for public packaging on MacOS, we will only export the C
84// symbol. Moreover, a C symbol `func` in macOS is mangled as `_func`.
85#if defined(LIBC_COPT_PUBLIC_PACKAGING) && !defined(LIBC_COMPILER_IS_MSVC)
86#ifndef __APPLE__
87#define LLVM_LIBC_VARIABLE_IMPL(type, name) \
88 LLVM_LIBC_ATTR(name) \
89 extern LLVM_LIBC_VARIABLE_ATTR decltype(LIBC_NAMESPACE::name) \
90 __##name##_impl__ asm(#name); \
91 extern decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]]; \
92 type __##name##_impl__
93#else // __APPLE__
94#define LLVM_LIBC_VARIABLE_IMPL(type, name) \
95 LLVM_LIBC_ATTR(name) \
96 extern LLVM_LIBC_VARIABLE_ATTR decltype(LIBC_NAMESPACE::name) name asm( \
97 "_" #name); \
98 type name
99#endif // __APPLE__
100#else // LIBC_COPT_PUBLIC_PACKAGING
101#define LLVM_LIBC_VARIABLE_IMPL(type, name) type name
102#endif // LIBC_COPT_PUBLIC_PACKAGING
80103
81// LLVM_LIBC_IS_DEFINED checks whether a particular macro is defined.
82// Usage: constexpr bool kUseAvx = LLVM_LIBC_IS_DEFINED(__AVX__);
83//
84// This works by comparing the stringified version of the macro with and without
85// evaluation. If FOO is not undefined both stringifications yield "FOO". If FOO
86// is defined, one stringification yields "FOO" while the other yields its
87// stringified value "1".
88#define LLVM_LIBC_IS_DEFINED(macro) \
89 !LIBC_NAMESPACE::internal::same_string( \
90 LLVM_LIBC_IS_DEFINED__EVAL_AND_STRINGIZE(macro), #macro)
91#define LLVM_LIBC_IS_DEFINED__EVAL_AND_STRINGIZE(s) #s
104#define LLVM_LIBC_VARIABLE(type, name) LLVM_LIBC_VARIABLE_IMPL(type, name)
92105
93106#endif // LLVM_LIBC_SRC___SUPPORT_COMMON_H
lib/libcxx/libc/src/__support/ctype_utils.h+27-15
......@@ -37,7 +37,7 @@ namespace internal {
3737// EBCDIC. Technically we could use some smaller ranges, but that's even harder
3838// to read.
3939
40LIBC_INLINE static constexpr bool islower(char ch) {
40LIBC_INLINE constexpr bool islower(char ch) {
4141 switch (ch) {
4242 case 'a':
4343 case 'b':
......@@ -71,7 +71,7 @@ LIBC_INLINE static constexpr bool islower(char ch) {
7171 }
7272}
7373
74LIBC_INLINE static constexpr bool isupper(char ch) {
74LIBC_INLINE constexpr bool isupper(char ch) {
7575 switch (ch) {
7676 case 'A':
7777 case 'B':
......@@ -105,7 +105,7 @@ LIBC_INLINE static constexpr bool isupper(char ch) {
105105 }
106106}
107107
108LIBC_INLINE static constexpr bool isdigit(char ch) {
108LIBC_INLINE constexpr bool isdigit(char ch) {
109109 switch (ch) {
110110 case '0':
111111 case '1':
......@@ -123,7 +123,7 @@ LIBC_INLINE static constexpr bool isdigit(char ch) {
123123 }
124124}
125125
126LIBC_INLINE static constexpr char tolower(char ch) {
126LIBC_INLINE constexpr char tolower(char ch) {
127127 switch (ch) {
128128 case 'A':
129129 return 'a';
......@@ -182,7 +182,7 @@ LIBC_INLINE static constexpr char tolower(char ch) {
182182 }
183183}
184184
185LIBC_INLINE static constexpr char toupper(char ch) {
185LIBC_INLINE constexpr char toupper(char ch) {
186186 switch (ch) {
187187 case 'a':
188188 return 'A';
......@@ -241,7 +241,7 @@ LIBC_INLINE static constexpr char toupper(char ch) {
241241 }
242242}
243243
244LIBC_INLINE static constexpr bool isalpha(char ch) {
244LIBC_INLINE constexpr bool isalpha(char ch) {
245245 switch (ch) {
246246 case 'a':
247247 case 'b':
......@@ -301,7 +301,7 @@ LIBC_INLINE static constexpr bool isalpha(char ch) {
301301 }
302302}
303303
304LIBC_INLINE static constexpr bool isalnum(char ch) {
304LIBC_INLINE constexpr bool isalnum(char ch) {
305305 switch (ch) {
306306 case 'a':
307307 case 'b':
......@@ -371,7 +371,8 @@ LIBC_INLINE static constexpr bool isalnum(char ch) {
371371 }
372372}
373373
374LIBC_INLINE static constexpr int b36_char_to_int(char ch) {
374#ifndef LIBC_COPT_CTYPE_SMALLER_ASCII
375LIBC_INLINE constexpr int b36_char_to_int(char ch) {
375376 switch (ch) {
376377 case '0':
377378 return 0;
......@@ -475,8 +476,21 @@ LIBC_INLINE static constexpr int b36_char_to_int(char ch) {
475476 return 0;
476477 }
477478}
479#else // LIBC_COPT_SMALL_ASCII_CTYPE
480// This version assumes ASCII for the tolower, but generates smaller code since
481// the switch version of this function ends up with a table. This should only be
482// used when the target is known to be ASCII.
483LIBC_INLINE constexpr int b36_char_to_int(char ch) {
484 if (ch >= '0' && ch <= '9')
485 return ch - '0';
486 char ch_unsafe_lower = ch | 32;
487 if (ch_unsafe_lower >= 'a' && ch_unsafe_lower <= 'z')
488 return ch_unsafe_lower - 'a' + 10;
489 return 0;
490}
491#endif // LIBC_COPT_SMALL_ASCII_CTYPE
478492
479LIBC_INLINE static constexpr char int_to_b36_char(int num) {
493LIBC_INLINE constexpr char int_to_b36_char(int num) {
480494 // Can't actually use LIBC_ASSERT here because it depends on integer_to_string
481495 // which depends on this.
482496
......@@ -559,7 +573,7 @@ LIBC_INLINE static constexpr char int_to_b36_char(int num) {
559573 }
560574}
561575
562LIBC_INLINE static constexpr bool isspace(char ch) {
576LIBC_INLINE constexpr bool isspace(char ch) {
563577 switch (ch) {
564578 case ' ':
565579 case '\t':
......@@ -574,14 +588,12 @@ LIBC_INLINE static constexpr bool isspace(char ch) {
574588}
575589
576590// not yet encoding independent.
577LIBC_INLINE static constexpr bool isgraph(char ch) {
578 return 0x20 < ch && ch < 0x7f;
579}
591LIBC_INLINE constexpr bool isgraph(char ch) { return 0x20 < ch && ch < 0x7f; }
580592
581593// An overload which provides a way to compare input with specific character
582594// values, when input can be of a regular or a wide character type.
583LIBC_INLINE static constexpr bool is_char_or_wchar(char ch, char c_value,
584 [[maybe_unused]] wchar_t) {
595LIBC_INLINE constexpr bool is_char_or_wchar(char ch, char c_value,
596 [[maybe_unused]] wchar_t) {
585597 return (ch == c_value);
586598}
587599
lib/libcxx/libc/src/__support/high_precision_decimal.h+1-1
......@@ -1,7 +1,7 @@
11//===-- High Precision Decimal ----------------------------------*- C++ -*-===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See httpss//llvm.org/LICENSE.txt for license information.
4// See https://llvm.org/LICENSE.txt for license information.
55// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66//
77//===----------------------------------------------------------------------===//
lib/libcxx/libc/src/__support/libc_assert.h+4-11
......@@ -25,8 +25,9 @@
2525#include "src/__support/OSUtil/exit.h"
2626#include "src/__support/OSUtil/io.h"
2727#include "src/__support/integer_to_string.h"
28#include "src/__support/macros/attributes.h" // For LIBC_INLINE
28#include "src/__support/macros/attributes.h" // For LIBC_INLINE
2929#include "src/__support/macros/config.h"
30#include "src/__support/macros/macro-utils.h"
3031#include "src/__support/macros/optimization.h" // For LIBC_UNLIKELY
3132
3233namespace LIBC_NAMESPACE_DECL {
......@@ -65,19 +66,11 @@ LIBC_INLINE void report_assertion_failure(const char *assertion,
6566 } while (false)
6667#else
6768
68// Convert __LINE__ to a string using macros. The indirection is necessary
69// because otherwise it will turn "__LINE__" into a string, not its value. The
70// value is evaluated in the indirection step.
71#define __LIBC_MACRO_TO_STR(x) #x
72#define __LIBC_MACRO_TO_STR_INDIR(y) __LIBC_MACRO_TO_STR(y)
73#define __LIBC_LINE_STR__ __LIBC_MACRO_TO_STR_INDIR(__LINE__)
74
7569#define LIBC_ASSERT(COND) \
7670 do { \
7771 if (LIBC_UNLIKELY(!(COND))) { \
78 LIBC_NAMESPACE::write_to_stderr(__FILE__ ":" __LIBC_LINE_STR__ \
79 ": Assertion failed: '" #COND \
80 "' in function: '"); \
72 LIBC_NAMESPACE::write_to_stderr(__FILE__ ":" LLVM_LIBC_STRINGIFY( \
73 __LINE__) ": Assertion failed: '" #COND "' in function: '"); \
8174 LIBC_NAMESPACE::write_to_stderr(__PRETTY_FUNCTION__); \
8275 LIBC_NAMESPACE::write_to_stderr("'\n"); \
8376 LIBC_NAMESPACE::internal::exit(0xFF); \
lib/libcxx/libc/src/__support/macros/attributes.h+74
......@@ -29,6 +29,80 @@
2929#define LIBC_INLINE_ASM __asm__ __volatile__
3030#define LIBC_UNUSED __attribute__((unused))
3131
32#ifndef LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED
33#if (defined(LIBC_COMPILER_IS_GCC) && (LIBC_COMPILER_GCC_VER >= 900)) || \
34 (defined(LIBC_COMPILER_IS_CLANG) && LIBC_COMPILER_CLANG_VER >= 900)
35#define LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED 1
36#else
37#define LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED \
38 (__has_builtin(__builtin_is_constant_evaluated))
39#endif // (defined(LIBC_COMPILER_IS_GCC) && (LIBC_COMPILER_GCC_VER >= 900)) ||
40 // (defined(LIBC_COMPILER_IS_CLANG) && LIBC_COMPILER_CLANG
41#endif // LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED
42
43#ifndef LIBC_HAS_BUILTIN_BIT_CAST
44#if __has_builtin(__builtin_bit_cast) || defined(LIBC_COMPILER_IS_MSVC)
45#define LIBC_HAS_BUILTIN_BIT_CAST 1
46#else
47#define LIBC_HAS_BUILTIN_BIT_CAST 0
48#endif // has_builtin(__builtin_bit_cast)
49#endif // LIBC_HAS_BUILTIN_BIT_CAST
50
51#if LIBC_HAS_BUILTIN_BIT_CAST
52#define LIBC_BIT_CAST_CONSTEXPR constexpr
53#define LIBC_BIT_CAST_CONSTEXPR_VAR constexpr
54#else
55#define LIBC_BIT_CAST_CONSTEXPR
56#define LIBC_BIT_CAST_CONSTEXPR_VAR const
57#endif // LIBC_HAS_BUILTIN_BIT_CAST
58
59#ifndef LIBC_HAS_CONSTANT_EVALUATION
60#define LIBC_HAS_CONSTANT_EVALUATION \
61 (LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED && LIBC_HAS_BUILTIN_BIT_CAST)
62#endif // LIBC_HAS_CONSTANT_EVALUATION
63
64#if LIBC_HAS_CONSTANT_EVALUATION
65#define LIBC_CONSTEXPR_DEFAULT constexpr
66#define LIBC_CONSTEXPR_VAR_DEFAULT constexpr
67#else
68#define LIBC_CONSTEXPR_DEFAULT
69#define LIBC_CONSTEXPR_VAR_DEFAULT const
70#endif // LIBC_HAS_CONSTANT_EVALUATION
71
72// TODO: Remove the macro once Clang/LLVM bump their minimum compilers' version.
73// The reason for indirection is GCC is known to fail with constexpr qualified
74// functions that doesn't produce constant expression.
75// Also, there are some circular dependency in the generic functions without
76// __builtin_func for the following functions:
77// fputil::fma
78// fputil::sqrt
79#if LIBC_ENABLE_CONSTEXPR && LIBC_HAS_CONSTANT_EVALUATION
80#define LIBC_USE_CONSTEXPR
81#define LIBC_CONSTEXPR constexpr
82#define LIBC_CONSTEXPR_VAR constexpr
83#else
84#define LIBC_CONSTEXPR
85#define LIBC_CONSTEXPR_VAR const
86#endif // LIBC_USE_CONSTEXPR
87
88#ifndef LIBC_HAS_BUILTIN_IS_ASSIGNABLE
89#if (__has_builtin(__is_assignable) || \
90 (defined(LIBC_COMPILER_IS_GCC) && (LIBC_COMPILER_GCC_VER >= 800)))
91#define LIBC_HAS_BUILTIN_IS_ASSIGNABLE 1
92#else
93#define LIBC_HAS_BUILTIN_IS_ASSIGNABLE 0
94#endif
95#endif // LIBC_HAS_BUILTIN_IS_ASSIGNABLE
96
97#ifndef LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE
98#if (__has_builtin(__is_constructible) || \
99 (defined(LIBC_COMPILER_IS_GCC) && (LIBC_COMPILER_GCC_VER >= 800)))
100#define LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE 1
101#else
102#define LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE 0
103#endif
104#endif // LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE
105
32106// Uses the platform specific specialization
33107#define LIBC_THREAD_MODE_PLATFORM 0
34108
lib/libcxx/libc/src/__support/macros/config.h+14
......@@ -48,6 +48,10 @@
4848
4949#define __builtin_prefetch(X, Y, Z)
5050
51#define LIBC_HAS_BUILTIN_IS_CONSTANT_EVALUATED 1
52#define LIBC_HAS_BUILTIN_IS_ASSIGNABLE 1
53#define LIBC_HAS_BUILTIN_IS_CONSTRUCTIBLE 1
54
5155#endif // LIBC_COMPILER_IS_MSVC
5256
5357#ifdef __clang__
......@@ -66,4 +70,14 @@
6670#define LIBC_NAMESPACE_DECL LIBC_NAMESPACE
6771#endif
6872
73// IMPORTANT (USE WITH CAUTION): This macro is intended to be used at the top of
74// the file and set to 1. It alters the signatures of some functions to have
75// constexpr qualifier and forces the use of constexpr-compatible
76// implementation, which might be a completely different code path or
77// instructions. Some of these functions exploit platform-specific non-constexpr
78// implementations to achieve certain goals, thus it is disabled by default.
79#ifndef LIBC_ENABLE_CONSTEXPR
80#define LIBC_ENABLE_CONSTEXPR 0
81#endif
82
6983#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_CONFIG_H
lib/libcxx/libc/src/__support/macros/macro-utils.h created+16
......@@ -0,0 +1,16 @@
1//===-- Macros used by other macros ----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_MACRO_UTILS_H
10#define LLVM_LIBC_SRC___SUPPORT_MACROS_MACRO_UTILS_H
11
12// Stringify the argument after an extra pass of macro expansion.
13#define LLVM_LIBC_STRINGIFY(x) LLVM_LIBC_STRINGIFY_IMPL(x)
14#define LLVM_LIBC_STRINGIFY_IMPL(x) #x
15
16#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_MACRO_UTILS_H
lib/libcxx/libc/src/__support/macros/optimization.h+18-7
......@@ -32,8 +32,13 @@ LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) {
3232#define LIBC_LOOP_NOUNROLL _Pragma("nounroll")
3333#define LIBC_LOOP_UNROLL _Pragma("unroll")
3434#elif defined(LIBC_COMPILER_IS_GCC)
35#if LIBC_COMPILER_GCC_VER >= 800
3536#define LIBC_LOOP_NOUNROLL _Pragma("GCC unroll 0")
3637#define LIBC_LOOP_UNROLL _Pragma("GCC unroll 2048")
38#else
39#define LIBC_LOOP_NOUNROLL
40#define LIBC_LOOP_UNROLL
41#endif
3742#elif defined(LIBC_COMPILER_IS_MSVC)
3843#define LIBC_LOOP_NOUNROLL
3944#define LIBC_LOOP_UNROLL
......@@ -47,33 +52,39 @@ LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) {
4752#define LIBC_MATH_SMALL_TABLES 0x02
4853#define LIBC_MATH_NO_ERRNO 0x04
4954#define LIBC_MATH_NO_EXCEPT 0x08
55#define LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT 0x10
56#define LIBC_MATH_ASSUME_ROUND_NEAREST_ONLY 0x20
5057#define LIBC_MATH_FAST \
5158 (LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES | \
52 LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT)
53#define LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT 0x10
59 LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT | \
60 LIBC_MATH_ASSUME_ROUND_NEAREST_ONLY)
5461
5562#ifndef LIBC_MATH
5663#define LIBC_MATH 0
5764#endif // LIBC_MATH
5865
59#if (LIBC_MATH & LIBC_MATH_SKIP_ACCURATE_PASS)
66#if ((LIBC_MATH) & LIBC_MATH_SKIP_ACCURATE_PASS)
6067#define LIBC_MATH_HAS_SKIP_ACCURATE_PASS
6168#endif
6269
63#if (LIBC_MATH & LIBC_MATH_SMALL_TABLES)
70#if ((LIBC_MATH) & LIBC_MATH_SMALL_TABLES)
6471#define LIBC_MATH_HAS_SMALL_TABLES
6572#endif
6673
67#if (LIBC_MATH & LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT)
74#if ((LIBC_MATH) & LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT)
6875#define LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
6976#endif
7077
71#if (LIBC_MATH & LIBC_MATH_NO_ERRNO)
78#if ((LIBC_MATH) & LIBC_MATH_NO_ERRNO)
7279#define LIBC_MATH_HAS_NO_ERRNO
7380#endif
7481
75#if (LIBC_MATH & LIBC_MATH_NO_EXCEPT)
82#if ((LIBC_MATH) & LIBC_MATH_NO_EXCEPT)
7683#define LIBC_MATH_HAS_NO_EXCEPT
7784#endif
7885
86#if ((LIBC_MATH) & LIBC_MATH_ASSUME_ROUND_NEAREST_ONLY)
87#define LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
88#endif
89
7990#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_OPTIMIZATION_H
lib/libcxx/libc/src/__support/macros/properties/architectures.h+6-1
......@@ -13,11 +13,16 @@
1313#define LIBC_TARGET_ARCH_IS_AMDGPU
1414#endif
1515
16#if defined(__SPIRV__)
17#define LIBC_TARGET_ARCH_IS_SPIRV
18#endif
19
1620#if defined(__NVPTX__)
1721#define LIBC_TARGET_ARCH_IS_NVPTX
1822#endif
1923
20#if defined(LIBC_TARGET_ARCH_IS_NVPTX) || defined(LIBC_TARGET_ARCH_IS_AMDGPU)
24#if defined(LIBC_TARGET_ARCH_IS_NVPTX) || \
25 defined(LIBC_TARGET_ARCH_IS_AMDGPU) || defined(LIBC_TARGET_ARCH_IS_SPIRV)
2126#define LIBC_TARGET_ARCH_IS_GPU
2227#endif
2328
lib/libcxx/libc/src/__support/macros/properties/cpu_features.h+7-2
......@@ -56,6 +56,10 @@
5656#define LIBC_TARGET_CPU_HAS_AVX512BW
5757#endif
5858
59#if defined(__AVX512F__) || defined(__AVX2__)
60#define LIBC_TARGET_CPU_HAS_GATHER
61#endif
62
5963#if defined(__ARM_FP)
6064#if (__ARM_FP & 0x2)
6165#define LIBC_TARGET_CPU_HAS_ARM_FPU_HALF
......@@ -91,13 +95,14 @@
9195#endif // LIBC_TARGET_CPU_HAS_RISCV_FPU_DOUBLE
9296#endif // __riscv_flen
9397
94#if defined(__NVPTX__) || defined(__AMDGPU__)
98#if defined(__NVPTX__) || defined(__AMDGPU__) || defined(__SPIRV__)
9599#define LIBC_TARGET_CPU_HAS_FPU_FLOAT
96100#define LIBC_TARGET_CPU_HAS_FPU_DOUBLE
97101#endif
98102
99103#if defined(__ARM_FEATURE_FMA) || (defined(__AVX2__) && defined(__FMA__)) || \
100 defined(__NVPTX__) || defined(__AMDGPU__) || defined(__riscv_flen)
104 defined(__NVPTX__) || defined(__AMDGPU__) || defined(__riscv_flen) || \
105 defined(__SPIRV__)
101106#define LIBC_TARGET_CPU_HAS_FMA
102107// Provide a more fine-grained control of FMA instruction for ARM targets.
103108#if defined(LIBC_TARGET_CPU_HAS_FPU_HALF)
lib/libcxx/libc/src/__support/macros/sanitizer.h+7-6
......@@ -26,24 +26,25 @@
2626#ifdef LIBC_HAS_MEMORY_SANITIZER
2727// Only perform MSAN unpoison in non-constexpr context.
2828#include <sanitizer/msan_interface.h>
29#define MSAN_UNPOISON(addr, size) \
29#define LIBC_MSAN_UNPOISON(addr, size) \
3030 do { \
3131 if (!__builtin_is_constant_evaluated()) \
3232 __msan_unpoison(addr, size); \
3333 } while (0)
3434#else
35#define MSAN_UNPOISON(ptr, size)
35#define LIBC_MSAN_UNPOISON(ptr, size)
3636#endif
3737
3838#ifdef LIBC_HAS_ADDRESS_SANITIZER
3939#include <sanitizer/asan_interface.h>
40#define ASAN_POISON_MEMORY_REGION(addr, size) \
40#define LIBC_ASAN_POISON_MEMORY_REGION(addr, size) \
4141 __asan_poison_memory_region((addr), (size))
42#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \
42#define LIBC_ASAN_UNPOISON_MEMORY_REGION(addr, size) \
4343 __asan_unpoison_memory_region((addr), (size))
4444#else
45#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
46#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
45#define LIBC_ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
46#define LIBC_ASAN_UNPOISON_MEMORY_REGION(addr, size) \
47 ((void)(addr), (void)(size))
4748#endif
4849
4950#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_SANITIZER_H
lib/libcxx/libc/src/__support/math_extras.h+15
......@@ -80,6 +80,21 @@ template <typename T>
8080#endif // __builtin_sub_overflow
8181}
8282
83template <typename T>
84[[nodiscard]] LIBC_INLINE constexpr bool mul_overflow(T a, T b, T &res) {
85#if __has_builtin(__builtin_mul_overflow)
86 return __builtin_mul_overflow(a, b, &res);
87#else
88 T max = cpp::numeric_limits<T>::max();
89 T min = cpp::numeric_limits<T>::min();
90 bool overflow = (b > 0 && (a > max / b || a < min / b)) ||
91 (b < 0 && (a < max / b || a > min / b));
92 if (!overflow)
93 res = a * b;
94 return overflow;
95#endif
96}
97
8398#define RETURN_IF(TYPE, BUILTIN) \
8499 if constexpr (cpp::is_same_v<T, TYPE>) \
85100 return BUILTIN(a, b, carry_in, &carry_out);
lib/libcxx/libc/src/__support/str_to_float.h+14-9
......@@ -124,7 +124,7 @@ eisel_lemire(ExpandedFloat<T> init_num,
124124 // Wider Approximation
125125 UInt128 final_approx;
126126 // The halfway constant is used to check if the bits that will be shifted away
127 // intially are all 1. For doubles this is 64 (bitstype size) - 52 (final
127 // initially are all 1. For doubles this is 64 (bitstype size) - 52 (final
128128 // mantissa size) - 3 (we shift away the last two bits separately for
129129 // accuracy, and the most significant bit is ignored.) = 9 bits. Similarly,
130130 // it's 6 bits for floats in this case.
......@@ -262,7 +262,7 @@ eisel_lemire<long double>(ExpandedFloat<long double> init_num,
262262 (final_approx_lower < approx_lower ? 1 : 0);
263263
264264 // The halfway constant is used to check if the bits that will be shifted away
265 // intially are all 1. For 80 bit floats this is 128 (bitstype size) - 64
265 // initially are all 1. For 80 bit floats this is 128 (bitstype size) - 64
266266 // (final mantissa size) - 3 (we shift away the last two bits separately for
267267 // accuracy, and the most significant bit is ignored.) = 61 bits. Similarly,
268268 // it's 12 bits for 128 bit floats in this case.
......@@ -680,17 +680,15 @@ template <> LIBC_INLINE constexpr int32_t get_lower_bound<double>() {
680680// accuracy.
681681template <typename T, typename CharType>
682682LIBC_INLINE FloatConvertReturn<T> decimal_exp_to_float(
683 ExpandedFloat<T> init_num, bool truncated, RoundDirection round,
684 const CharType *__restrict numStart,
683 ExpandedFloat<T> init_num, [[maybe_unused]] bool truncated,
684 RoundDirection round, const CharType *__restrict numStart,
685685 const size_t num_len = cpp::numeric_limits<size_t>::max()) {
686686 using FPBits = typename fputil::FPBits<T>;
687 using StorageType = typename FPBits::StorageType;
688687
689 StorageType mantissa = init_num.mantissa;
690688 int32_t exp10 = init_num.exponent;
691689
692690 FloatConvertReturn<T> output;
693 cpp::optional<ExpandedFloat<T>> opt_output;
691 [[maybe_unused]] cpp::optional<ExpandedFloat<T>> opt_output;
694692
695693 // If the exponent is too large and can't be represented in this size of
696694 // float, return inf. These bounds are relatively loose, but are mostly
......@@ -725,6 +723,8 @@ LIBC_INLINE FloatConvertReturn<T> decimal_exp_to_float(
725723
726724#ifndef LIBC_COPT_STRTOFLOAT_DISABLE_EISEL_LEMIRE
727725 // Try Eisel-Lemire
726 using StorageType = typename FPBits::StorageType;
727 StorageType mantissa = init_num.mantissa;
728728 opt_output = eisel_lemire<T>(init_num, round);
729729 if (opt_output.has_value()) {
730730 if (!truncated) {
......@@ -1093,7 +1093,7 @@ hexadecimal_string_to_float(const CharType *__restrict src,
10931093}
10941094
10951095template <typename T, typename CharType>
1096LIBC_INLINE typename fputil::FPBits<T>::StorageType
1096LIBC_INLINE constexpr typename fputil::FPBits<T>::StorageType
10971097nan_mantissa_from_ncharseq(const CharType *str, size_t len) {
10981098 using FPBits = typename fputil::FPBits<T>;
10991099 using StorageType = typename FPBits::StorageType;
......@@ -1129,7 +1129,9 @@ strtofloatingpoint(const CharType *__restrict src) {
11291129
11301130 size_t index = first_non_whitespace(src);
11311131 int sign = get_sign(src + index);
1132#ifndef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
11321133 bool is_positive = (sign >= 0);
1134#endif
11331135 index += (sign != 0);
11341136
11351137 if (sign < 0) {
......@@ -1146,6 +1148,7 @@ strtofloatingpoint(const CharType *__restrict src) {
11461148 }
11471149
11481150 RoundDirection round_direction = RoundDirection::Nearest;
1151#ifndef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
11491152 switch (fputil::quick_get_round()) {
11501153 case FE_TONEAREST:
11511154 round_direction = RoundDirection::Nearest;
......@@ -1160,6 +1163,7 @@ strtofloatingpoint(const CharType *__restrict src) {
11601163 round_direction = RoundDirection::Down;
11611164 break;
11621165 }
1166#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
11631167
11641168 StrToNumResult<ExpandedFloat<T>> parse_result({0, 0});
11651169 if (base == 16) {
......@@ -1221,7 +1225,8 @@ strtofloatingpoint(const CharType *__restrict src) {
12211225 return {result.get_val(), static_cast<ptrdiff_t>(index), error};
12221226}
12231227
1224template <class T> LIBC_INLINE StrToNumResult<T> strtonan(const char *arg) {
1228template <class T>
1229LIBC_INLINE constexpr StrToNumResult<T> strtonan(const char *arg) {
12251230 using FPBits = typename fputil::FPBits<T>;
12261231 using StorageType = typename FPBits::StorageType;
12271232
lib/libcxx/libc/src/__support/str_to_integer.h+21-2
......@@ -33,7 +33,7 @@ namespace internal {
3333// Returns the idx to the first character in src that is not a whitespace
3434// character (as determined by isspace())
3535template <typename CharType>
36LIBC_INLINE size_t
36LIBC_INLINE constexpr size_t
3737first_non_whitespace(const CharType *__restrict src,
3838 size_t src_len = cpp::numeric_limits<size_t>::max()) {
3939 size_t src_cur = 0;
......@@ -65,6 +65,18 @@ LIBC_INLINE static bool is_hex_start(const CharType *__restrict src,
6565 b36_char_to_int(src[2]) < 16;
6666}
6767
68// checks if the next 3 characters of the string pointer are the start of a
69// binary number. Does not advance the string pointer.
70template <typename CharType>
71LIBC_INLINE static bool is_binary_start(const CharType *__restrict src,
72 size_t src_len) {
73 if (src_len < 3)
74 return false;
75 return is_char_or_wchar(src[0], '0', L'0') &&
76 is_char_or_wchar(tolower(src[1]), 'b', L'b') && isalnum(src[2]) &&
77 b36_char_to_int(src[2]) < 2;
78}
79
6880// Takes the address of the string pointer and parses the base from the start of
6981// it.
7082template <typename CharType>
......@@ -75,6 +87,10 @@ LIBC_INLINE static int infer_base(const CharType *__restrict src,
7587 // with values 10 through 15 respectively." (C standard 6.4.4.1)
7688 if (is_hex_start(src, src_len))
7789 return 16;
90 // A binary number is defined as "the prefix 0b or 0B optionally followed
91 // by a sequence of letters and digits." (C standard 7.24.1.7)
92 if (is_binary_start(src, src_len))
93 return 2;
7894 // An octal number is defined as "the prefix 0 optionally followed by a
7995 // sequence of the digits 0 through 7 only" (C standard 6.4.4.1) and so any
8096 // number that starts with 0, including just 0, is an octal number.
......@@ -94,7 +110,7 @@ LIBC_INLINE static int infer_base(const CharType *__restrict src,
94110// Takes a pointer to a string and the base to convert to. This function is used
95111// as the backend for all of the string to int functions.
96112template <typename T, typename CharType>
97LIBC_INLINE StrToNumResult<T>
113LIBC_INLINE constexpr StrToNumResult<T>
98114strtointeger(const CharType *__restrict src, int base,
99115 const size_t src_len = cpp::numeric_limits<size_t>::max()) {
100116 using ResultType = make_integral_or_big_int_unsigned_t<T>;
......@@ -120,6 +136,9 @@ strtointeger(const CharType *__restrict src, int base,
120136 if (base == 16 && is_hex_start(src + src_cur, src_len - src_cur))
121137 src_cur = src_cur + 2;
122138
139 if (base == 2 && is_binary_start(src + src_cur, src_len - src_cur))
140 src_cur = src_cur + 2;
141
123142 constexpr bool IS_UNSIGNED = cpp::is_unsigned_v<T>;
124143 ResultType constexpr NEGATIVE_MAX =
125144 !IS_UNSIGNED ? static_cast<ResultType>(cpp::numeric_limits<T>::max()) + 1
lib/libcxx/libc/src/__support/wctype/wctype_classification_utils.h created+66
......@@ -0,0 +1,66 @@
1//===-- Utils for wctype classification functions ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8// DO NOT EDIT MANUALLY.
9// This file is generated by libc/utils/wctype_utils scripts.
10
11#ifndef LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CLASSIFICATION_UTILS_H
12#define LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CLASSIFICATION_UTILS_H
13
14#include "hdr/stdint_proxy.h"
15#include "hdr/types/wchar_t.h"
16#include "src/__support/CPP/limits.h"
17#include "src/__support/libc_assert.h"
18#include "src/__support/macros/attributes.h"
19#include "src/__support/macros/config.h"
20
21namespace LIBC_NAMESPACE_DECL {
22
23// Property flags for Unicode categories
24enum PropertyFlag : uint8_t {
25 UPPER = 1 << 0,
26 LOWER = 1 << 1,
27 ALPHA = 1 << 2,
28 SPACE = 1 << 3,
29 PRINT = 1 << 4,
30 BLANK = 1 << 5,
31 CNTRL = 1 << 6,
32 PUNCT = 1 << 7,
33};
34
35static_assert(4352 <= cpp::numeric_limits<unsigned short>::max());
36static_assert(39168 <= cpp::numeric_limits<unsigned short>::max());
37
38LIBC_INLINE_VAR constexpr uint16_t LEVEL1_SIZE = 4352;
39LIBC_INLINE_VAR constexpr uint16_t LEVEL2_SIZE = 39168;
40
41// Level 1 table: indexed by (codepoint >> 8), stores level2 block offsets
42extern const uint16_t LEVEL1[LEVEL1_SIZE];
43
44// Level 2 table: blocks of 256 property flags
45extern const uint8_t LEVEL2[LEVEL2_SIZE];
46
47// Returns the Unicode property flag for a given wide character.
48LIBC_INLINE uint8_t lookup_properties(const wchar_t wc) {
49 // Out of Unicode range
50 if (static_cast<uint32_t>(wc) > 0x10FFFF) {
51 return 0;
52 }
53
54 uint16_t l1_idx = static_cast<uint16_t>(wc >> 8);
55 LIBC_ASSERT(l1_idx < LEVEL1_SIZE);
56
57 uint16_t l2_offset = LEVEL1[l1_idx];
58 uint16_t l2_idx = l2_offset + (wc & 0xFF);
59 LIBC_ASSERT(l2_idx < LEVEL2_SIZE);
60
61 return LEVEL2[l2_idx];
62}
63
64} // namespace LIBC_NAMESPACE_DECL
65
66#endif // LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CLASSIFICATION_UTILS_H
lib/libcxx/libc/src/__support/wctype/wctype_conversion_utils.h created+34
......@@ -0,0 +1,34 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// Interface for wctype conversion functions.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CONVERSION_UTILS_H
15#define LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CONVERSION_UTILS_H
16
17#include "hdr/types/wchar_t.h"
18#include "hdr/types/wint_t.h"
19#include "src/__support/macros/attributes.h"
20#include "src/__support/macros/config.h"
21
22namespace LIBC_NAMESPACE_DECL {
23namespace wctype_internal {
24
25// Helper functions for non-ASCII case conversions.
26// These are implemented in wctype_conversion_utils.cpp using the generated
27// maps.
28wint_t tolower(wchar_t wch);
29wint_t toupper(wchar_t wch);
30
31} // namespace wctype_internal
32} // namespace LIBC_NAMESPACE_DECL
33
34#endif // LLVM_LIBC_SRC___SUPPORT_WCTYPE_WCTYPE_CONVERSION_UTILS_H
lib/libcxx/libc/src/__support/wctype_utils.h+351-137
......@@ -13,6 +13,18 @@
1313#include "src/__support/macros/attributes.h" // LIBC_INLINE
1414#include "src/__support/macros/config.h"
1515
16#define LIBC_WCTYPE_MODE_ASCII 0
17#define LIBC_WCTYPE_MODE_UTF8 1
18
19#ifndef LIBC_CONF_WCTYPE_MODE
20#define LIBC_CONF_WCTYPE_MODE LIBC_WCTYPE_MODE_ASCII
21#endif
22
23#if LIBC_CONF_WCTYPE_MODE == LIBC_WCTYPE_MODE_UTF8
24#include "src/__support/wctype/wctype_classification_utils.h"
25#include "src/__support/wctype/wctype_conversion_utils.h"
26#endif
27
1628namespace LIBC_NAMESPACE_DECL {
1729namespace internal {
1830
......@@ -38,8 +50,8 @@ namespace internal {
3850// This assumes the character ranges are contiguous, which they aren't in
3951// EBCDIC. Technically we could use some smaller ranges, but that's even harder
4052// to read.
41
42LIBC_INLINE static constexpr bool islower(wchar_t wch) {
53namespace ascii {
54LIBC_INLINE constexpr bool islower(wchar_t wch) {
4355 switch (wch) {
4456 case L'a':
4557 case L'b':
......@@ -73,7 +85,7 @@ LIBC_INLINE static constexpr bool islower(wchar_t wch) {
7385 }
7486}
7587
76LIBC_INLINE static constexpr bool isupper(wchar_t wch) {
88LIBC_INLINE constexpr bool isupper(wchar_t wch) {
7789 switch (wch) {
7890 case L'A':
7991 case L'B':
......@@ -107,7 +119,7 @@ LIBC_INLINE static constexpr bool isupper(wchar_t wch) {
107119 }
108120}
109121
110LIBC_INLINE static constexpr bool isdigit(wchar_t wch) {
122LIBC_INLINE constexpr bool isdigit(wchar_t wch) {
111123 switch (wch) {
112124 case L'0':
113125 case L'1':
......@@ -125,125 +137,169 @@ LIBC_INLINE static constexpr bool isdigit(wchar_t wch) {
125137 }
126138}
127139
128LIBC_INLINE static constexpr wchar_t tolower(wchar_t wch) {
140LIBC_INLINE constexpr bool isalpha(wchar_t wch) {
129141 switch (wch) {
142 case L'a':
143 case L'b':
144 case L'c':
145 case L'd':
146 case L'e':
147 case L'f':
148 case L'g':
149 case L'h':
150 case L'i':
151 case L'j':
152 case L'k':
153 case L'l':
154 case L'm':
155 case L'n':
156 case L'o':
157 case L'p':
158 case L'q':
159 case L'r':
160 case L's':
161 case L't':
162 case L'u':
163 case L'v':
164 case L'w':
165 case L'x':
166 case L'y':
167 case L'z':
130168 case L'A':
131 return L'a';
132169 case L'B':
133 return L'b';
134170 case L'C':
135 return L'c';
136171 case L'D':
137 return L'd';
138172 case L'E':
139 return L'e';
140173 case L'F':
141 return L'f';
142174 case L'G':
143 return L'g';
144175 case L'H':
145 return L'h';
146176 case L'I':
147 return L'i';
148177 case L'J':
149 return L'j';
150178 case L'K':
151 return L'k';
152179 case L'L':
153 return L'l';
154180 case L'M':
155 return L'm';
156181 case L'N':
157 return L'n';
158182 case L'O':
159 return L'o';
160183 case L'P':
161 return L'p';
162184 case L'Q':
163 return L'q';
164185 case L'R':
165 return L'r';
166186 case L'S':
167 return L's';
168187 case L'T':
169 return L't';
170188 case L'U':
171 return L'u';
172189 case L'V':
173 return L'v';
174190 case L'W':
175 return L'w';
176191 case L'X':
177 return L'x';
178192 case L'Y':
179 return L'y';
180193 case L'Z':
181 return L'z';
194 return true;
182195 default:
183 return wch;
196 return false;
184197 }
185198}
186199
187LIBC_INLINE static constexpr wchar_t toupper(wchar_t wch) {
200LIBC_INLINE constexpr bool isalnum(wchar_t wch) {
188201 switch (wch) {
189202 case L'a':
190 return L'A';
191203 case L'b':
192 return L'B';
193204 case L'c':
194 return L'C';
195205 case L'd':
196 return L'D';
197206 case L'e':
198 return L'E';
199207 case L'f':
200 return L'F';
201208 case L'g':
202 return L'G';
203209 case L'h':
204 return L'H';
205210 case L'i':
206 return L'I';
207211 case L'j':
208 return L'J';
209212 case L'k':
210 return L'K';
211213 case L'l':
212 return L'L';
213214 case L'm':
214 return L'M';
215215 case L'n':
216 return L'N';
217216 case L'o':
218 return L'O';
219217 case L'p':
220 return L'P';
221218 case L'q':
222 return L'Q';
223219 case L'r':
224 return L'R';
225220 case L's':
226 return L'S';
227221 case L't':
228 return L'T';
229222 case L'u':
230 return L'U';
231223 case L'v':
232 return L'V';
233224 case L'w':
234 return L'W';
235225 case L'x':
236 return L'X';
237226 case L'y':
238 return L'Y';
239227 case L'z':
240 return L'Z';
228 case L'A':
229 case L'B':
230 case L'C':
231 case L'D':
232 case L'E':
233 case L'F':
234 case L'G':
235 case L'H':
236 case L'I':
237 case L'J':
238 case L'K':
239 case L'L':
240 case L'M':
241 case L'N':
242 case L'O':
243 case L'P':
244 case L'Q':
245 case L'R':
246 case L'S':
247 case L'T':
248 case L'U':
249 case L'V':
250 case L'W':
251 case L'X':
252 case L'Y':
253 case L'Z':
254 case L'0':
255 case L'1':
256 case L'2':
257 case L'3':
258 case L'4':
259 case L'5':
260 case L'6':
261 case L'7':
262 case L'8':
263 case L'9':
264 return true;
241265 default:
242 return wch;
266 return false;
267 }
268}
269
270LIBC_INLINE constexpr bool isspace(wchar_t wch) {
271 switch (wch) {
272 case L' ':
273 case L'\t':
274 case L'\n':
275 case L'\v':
276 case L'\f':
277 case L'\r':
278 return true;
279 default:
280 return false;
281 }
282}
283
284LIBC_INLINE constexpr bool isblank(wchar_t wch) {
285 switch (wch) {
286 case L' ':
287 case L'\t':
288 return true;
289 default:
290 return false;
243291 }
244292}
245293
246LIBC_INLINE static constexpr bool isalpha(wchar_t wch) {
294LIBC_INLINE constexpr bool isgraph(wchar_t wch) {
295 return 0x20 < wch && wch < 0x7f;
296}
297
298LIBC_INLINE constexpr bool isprint(wchar_t wch) {
299 return (static_cast<unsigned>(wch) - ' ') < 95;
300}
301
302LIBC_INLINE constexpr bool isxdigit(wchar_t wch) {
247303 switch (wch) {
248304 case L'a':
249305 case L'b':
......@@ -251,129 +307,301 @@ LIBC_INLINE static constexpr bool isalpha(wchar_t wch) {
251307 case L'd':
252308 case L'e':
253309 case L'f':
254 case L'g':
255 case L'h':
256 case L'i':
257 case L'j':
258 case L'k':
259 case L'l':
260 case L'm':
261 case L'n':
262 case L'o':
263 case L'p':
264 case L'q':
265 case L'r':
266 case L's':
267 case L't':
268 case L'u':
269 case L'v':
270 case L'w':
271 case L'x':
272 case L'y':
273 case L'z':
274310 case L'A':
275311 case L'B':
276312 case L'C':
277313 case L'D':
278314 case L'E':
279315 case L'F':
316 case L'0':
317 case L'1':
318 case L'2':
319 case L'3':
320 case L'4':
321 case L'5':
322 case L'6':
323 case L'7':
324 case L'8':
325 case L'9':
326 return true;
327 default:
328 return false;
329 }
330}
331
332LIBC_INLINE constexpr bool iscntrl(wchar_t wch) {
333 return (wch < 0x20 || wch == 0x7f);
334}
335
336LIBC_INLINE constexpr bool ispunct(wchar_t wch) {
337 return !isalnum(wch) && isgraph(wch);
338}
339
340LIBC_INLINE constexpr wchar_t tolower(wchar_t wch) {
341 switch (wch) {
342 case L'A':
343 return L'a';
344 case L'B':
345 return L'b';
346 case L'C':
347 return L'c';
348 case L'D':
349 return L'd';
350 case L'E':
351 return L'e';
352 case L'F':
353 return L'f';
280354 case L'G':
355 return L'g';
281356 case L'H':
357 return L'h';
282358 case L'I':
359 return L'i';
283360 case L'J':
361 return L'j';
284362 case L'K':
363 return L'k';
285364 case L'L':
365 return L'l';
286366 case L'M':
367 return L'm';
287368 case L'N':
369 return L'n';
288370 case L'O':
371 return L'o';
289372 case L'P':
373 return L'p';
290374 case L'Q':
375 return L'q';
291376 case L'R':
377 return L'r';
292378 case L'S':
379 return L's';
293380 case L'T':
381 return L't';
294382 case L'U':
383 return L'u';
295384 case L'V':
385 return L'v';
296386 case L'W':
387 return L'w';
297388 case L'X':
389 return L'x';
298390 case L'Y':
391 return L'y';
299392 case L'Z':
300 return true;
393 return L'z';
301394 default:
302 return false;
395 return wch;
303396 }
304397}
305398
306LIBC_INLINE static constexpr bool isalnum(wchar_t wch) {
399LIBC_INLINE constexpr wchar_t toupper(wchar_t wch) {
307400 switch (wch) {
308401 case L'a':
402 return L'A';
309403 case L'b':
404 return L'B';
310405 case L'c':
406 return L'C';
311407 case L'd':
408 return L'D';
312409 case L'e':
410 return L'E';
313411 case L'f':
412 return L'F';
314413 case L'g':
414 return L'G';
315415 case L'h':
416 return L'H';
316417 case L'i':
418 return L'I';
317419 case L'j':
420 return L'J';
318421 case L'k':
422 return L'K';
319423 case L'l':
424 return L'L';
320425 case L'm':
426 return L'M';
321427 case L'n':
428 return L'N';
322429 case L'o':
430 return L'O';
323431 case L'p':
432 return L'P';
324433 case L'q':
434 return L'Q';
325435 case L'r':
436 return L'R';
326437 case L's':
438 return L'S';
327439 case L't':
440 return L'T';
328441 case L'u':
442 return L'U';
329443 case L'v':
444 return L'V';
330445 case L'w':
446 return L'W';
331447 case L'x':
448 return L'X';
332449 case L'y':
450 return L'Y';
333451 case L'z':
334 case L'A':
335 case L'B':
336 case L'C':
337 case L'D':
338 case L'E':
339 case L'F':
340 case L'G':
341 case L'H':
342 case L'I':
343 case L'J':
344 case L'K':
345 case L'L':
346 case L'M':
347 case L'N':
348 case L'O':
349 case L'P':
350 case L'Q':
351 case L'R':
352 case L'S':
353 case L'T':
354 case L'U':
355 case L'V':
356 case L'W':
357 case L'X':
358 case L'Y':
359 case L'Z':
360 case L'0':
361 case L'1':
362 case L'2':
363 case L'3':
364 case L'4':
365 case L'5':
366 case L'6':
367 case L'7':
368 case L'8':
369 case L'9':
370 return true;
452 return L'Z';
371453 default:
372 return false;
454 return wch;
455 }
456}
457
458} // namespace ascii
459
460LIBC_INLINE constexpr bool islower(wchar_t wch) {
461#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
462 return ascii::islower(wch);
463#else
464 if (static_cast<uint32_t>(wch) < 128) {
465 return ascii::islower(wch);
466 }
467 return lookup_properties(wch) & PropertyFlag::LOWER;
468#endif
469}
470
471LIBC_INLINE constexpr bool isupper(wchar_t wch) {
472#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
473 return ascii::isupper(wch);
474#else
475 if (static_cast<uint32_t>(wch) < 128) {
476 return ascii::isupper(wch);
477 }
478 return lookup_properties(wch) & PropertyFlag::UPPER;
479#endif
480}
481
482LIBC_INLINE constexpr bool isdigit(wchar_t wch) {
483 // In C.UT8, only ASCII digits are considered digits
484 return ascii::isdigit(wch);
485}
486
487LIBC_INLINE constexpr bool isalpha(wchar_t wch) {
488#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
489 return ascii::isalpha(wch);
490#else
491 if (static_cast<uint32_t>(wch) < 128) {
492 return ascii::isalpha(wch);
493 }
494 return lookup_properties(wch) & PropertyFlag::ALPHA;
495#endif
496}
497
498LIBC_INLINE constexpr bool isalnum(wchar_t wch) {
499#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
500 return ascii::isalnum(wch);
501#else
502 if (static_cast<uint32_t>(wch) < 128) {
503 return ascii::isalnum(wch);
504 }
505 // Only need to check ALPHA, digit cases are covered by ASCII path
506 return lookup_properties(wch) & PropertyFlag::ALPHA;
507#endif
508}
509
510LIBC_INLINE constexpr bool isspace(wchar_t wch) {
511#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
512 return ascii::isspace(wch);
513#else
514 if (static_cast<uint32_t>(wch) < 128) {
515 return ascii::isspace(wch);
516 }
517 return lookup_properties(wch) & PropertyFlag::SPACE;
518#endif
519}
520
521LIBC_INLINE constexpr bool isblank(wchar_t wch) {
522#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
523 return ascii::isblank(wch);
524#else
525 if (static_cast<uint32_t>(wch) < 128) {
526 return ascii::isblank(wch);
373527 }
528 return lookup_properties(wch) & PropertyFlag::BLANK;
529#endif
374530}
375531
376LIBC_INLINE static constexpr int b36_char_to_int(wchar_t wch) {
532LIBC_INLINE constexpr bool isgraph(wchar_t wch) {
533#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
534 return ascii::isgraph(wch);
535#else
536 if (static_cast<uint32_t>(wch) < 128) {
537 return ascii::isgraph(wch);
538 }
539 // print && !space
540 return (lookup_properties(wch) &
541 (PropertyFlag::PRINT | PropertyFlag::SPACE)) == PropertyFlag::PRINT;
542#endif
543}
544
545LIBC_INLINE constexpr bool isprint(wchar_t wch) {
546#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
547 return ascii::isprint(wch);
548#else
549 if (static_cast<uint32_t>(wch) < 128) {
550 return ascii::isprint(wch);
551 }
552 return lookup_properties(wch) & PropertyFlag::PRINT;
553#endif
554}
555LIBC_INLINE constexpr bool isxdigit(wchar_t wch) {
556 // Hexadecimal digits are the same in C.UTF8 as in ASCII
557 return ascii::isxdigit(wch);
558}
559
560LIBC_INLINE constexpr bool iscntrl(wchar_t wch) {
561#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
562 return ascii::iscntrl(wch);
563#else
564 if (static_cast<uint32_t>(wch) < 128) {
565 return ascii::iscntrl(wch);
566 }
567 return lookup_properties(wch) & PropertyFlag::CNTRL;
568#endif
569}
570
571LIBC_INLINE constexpr bool ispunct(wchar_t wch) {
572#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
573 return ascii::ispunct(wch);
574#else
575 if (static_cast<uint32_t>(wch) < 128) {
576 return ascii::ispunct(wch);
577 }
578 return lookup_properties(wch) & PropertyFlag::PUNCT;
579#endif
580}
581
582LIBC_INLINE constexpr wchar_t tolower(wchar_t wch) {
583#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
584 return ascii::tolower(wch);
585#else
586 if (static_cast<uint32_t>(wch) < 128) {
587 return ascii::tolower(wch);
588 }
589 return static_cast<wchar_t>(wctype_internal::tolower(wch));
590#endif
591}
592
593LIBC_INLINE constexpr wchar_t toupper(wchar_t wch) {
594#if LIBC_CONF_WCTYPE_MODE != LIBC_WCTYPE_MODE_UTF8
595 return ascii::toupper(wch);
596#else
597 if (static_cast<uint32_t>(wch) < 128) {
598 return ascii::toupper(wch);
599 }
600 return static_cast<wchar_t>(wctype_internal::toupper(wch));
601#endif
602}
603
604LIBC_INLINE constexpr int b36_char_to_int(wchar_t wch) {
377605 switch (wch) {
378606 case L'0':
379607 return 0;
......@@ -561,20 +789,6 @@ LIBC_INLINE static constexpr wchar_t int_to_b36_wchar(int num) {
561789 }
562790}
563791
564LIBC_INLINE static constexpr bool isspace(wchar_t wch) {
565 switch (wch) {
566 case L' ':
567 case L'\t':
568 case L'\n':
569 case L'\v':
570 case L'\f':
571 case L'\r':
572 return true;
573 default:
574 return false;
575 }
576}
577
578792// An overload which provides a way to compare input with specific character
579793// values, when input can be of a regular or a wide character type.
580794LIBC_INLINE static constexpr bool
lib/libcxx/src/algorithm.cpp+2
......@@ -10,6 +10,7 @@
1010#include <bit>
1111
1212_LIBCPP_BEGIN_NAMESPACE_STD
13_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1314
1415template <class Comp, class RandomAccessIterator>
1516void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) {
......@@ -47,4 +48,5 @@ template void __sort<__less<double>&, double*>(double*, double*, __less<double>&
4748template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
4849// clang-format on
4950
51_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5052_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/any.cpp+4-2
......@@ -19,6 +19,7 @@ const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
1919// Preserve std::experimental::any_bad_cast for ABI compatibility
2020// Even though it no longer exists in a header file
2121_LIBCPP_BEGIN_NAMESPACE_LFTS
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324class _LIBCPP_EXPORTED_FROM_ABI bad_any_cast : public bad_cast {
2425public:
......@@ -27,6 +28,7 @@ public:
2728
2829const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
2930
30#endif
31
31_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3232_LIBCPP_END_NAMESPACE_LFTS
33
34#endif
lib/libcxx/src/atomic.cpp+163-58
......@@ -17,7 +17,19 @@
1717#include <thread>
1818#include <type_traits>
1919
20#include "include/apple_availability.h"
20// Determine whether to use the public os_sync API on Apple platforms based on the deployment target.
21// Otherwise we fall back to the private __ulock API.
22#if defined(__APPLE__)
23# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
24 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 140400) || \
25 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
26 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 170400) || \
27 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 170400) || \
28 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \
29 __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 100400)
30# define _LIBCPP_USE_OS_SYNC
31# endif
32#endif
2133
2234#ifdef __linux__
2335
......@@ -51,6 +63,16 @@
5163# include <memory>
5264# include <windows.h>
5365
66#elif defined(__APPLE__)
67
68# if defined(_LIBCPP_USE_OS_SYNC)
69# include <os/os_sync_wait_on_address.h>
70# endif
71
72#elif defined(__Fuchsia__)
73
74# include <zircon/syscalls.h>
75
5476#else // <- Add other operating systems here
5577
5678// Baseline needs no new headers
......@@ -63,6 +85,7 @@ _LIBCPP_PUSH_MACROS
6385#include <__undef_macros>
6486
6587_LIBCPP_BEGIN_NAMESPACE_STD
88_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
6689
6790struct NoTimeout {};
6891
......@@ -90,20 +113,64 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
90113 _LIBCPP_FUTEX(__ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0);
91114}
92115
93#elif defined(__APPLE__) && defined(_LIBCPP_USE_ULOCK)
116#elif defined(__APPLE__)
117
118# if defined(_LIBCPP_USE_OS_SYNC)
119
120template <std::size_t _Size, class MaybeTimeout>
121static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
122 std::uint64_t __value = [__val]() -> std::uint64_t {
123 if constexpr (_Size == 4) {
124 std::uint32_t __result;
125 std::memcpy(&__result, __val, _Size);
126 return __result;
127 } else if constexpr (_Size == 8) {
128 std::uint64_t __result;
129 std::memcpy(&__result, __val, _Size);
130 return __result;
131 } else {
132 static_assert(false, "Can only wait on 8 bytes or 4 bytes value");
133 }
134 }();
135
136 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
137 os_sync_wait_on_address(const_cast<void*>(__ptr), __value, _Size, OS_SYNC_WAIT_ON_ADDRESS_NONE);
138 } else {
139 // os_sync_wait_on_address_with_timeout returns EINVAL on a 0-ns timeout, so clamp to 1ns
140 // when an already-expired deadline produced a zero-duration timeout.
141 uint64_t __timeout_ns = std::max<uint64_t>(maybe_timeout_ns, 1);
142 os_sync_wait_on_address_with_timeout(
143 const_cast<void*>(__ptr),
144 __value,
145 _Size,
146 OS_SYNC_WAIT_ON_ADDRESS_NONE,
147 OS_CLOCK_MACH_ABSOLUTE_TIME,
148 __timeout_ns);
149 }
150}
151
152template <std::size_t _Size>
153static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
154 static_assert(_Size == 8 || _Size == 4, "Can only wake up on 8 bytes or 4 bytes value");
155 if (__notify_one)
156 os_sync_wake_by_address_any(const_cast<void*>(__ptr), _Size, OS_SYNC_WAKE_BY_ADDRESS_NONE);
157 else
158 os_sync_wake_by_address_all(const_cast<void*>(__ptr), _Size, OS_SYNC_WAKE_BY_ADDRESS_NONE);
159}
160
161# else // !_LIBCPP_USE_OS_SYNC -- fall back to the private __ulock API
94162
95163extern "C" int __ulock_wait(
96164 uint32_t operation, void* addr, uint64_t value, uint32_t timeout); /* timeout is specified in microseconds */
97165extern "C" int __ulock_wake(uint32_t operation, void* addr, uint64_t wake_value);
98166
99167// https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/ulock.h#L82
100# define UL_COMPARE_AND_WAIT 1
101# define UL_COMPARE_AND_WAIT64 5
102# define ULF_WAKE_ALL 0x00000100
168# define UL_COMPARE_AND_WAIT 1
169# define UL_COMPARE_AND_WAIT64 5
170# define ULF_WAKE_ALL 0x00000100
103171
104172template <std::size_t _Size, class MaybeTimeout>
105173static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
106 static_assert(_Size == 8 || _Size == 4, "Can only wait on 8 bytes or 4 bytes value");
107174 auto __timeout_us = [&] {
108175 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
109176 return uint32_t(0);
......@@ -111,17 +178,23 @@ static void __platform_wait_on_address(void const* __ptr, void const* __val, May
111178 return std::max(static_cast<uint32_t>(maybe_timeout_ns / 1000), uint32_t(1));
112179 }
113180 }();
114 if constexpr (_Size == 4) {
115 alignas(uint32_t) char buffer[_Size];
116 std::memcpy(&buffer, const_cast<const void*>(__val), _Size);
117 __ulock_wait(
118 UL_COMPARE_AND_WAIT, const_cast<void*>(__ptr), *reinterpret_cast<uint32_t const*>(&buffer), __timeout_us);
119 } else {
120 alignas(uint64_t) char buffer[_Size];
121 std::memcpy(&buffer, const_cast<const void*>(__val), _Size);
122 __ulock_wait(
123 UL_COMPARE_AND_WAIT64, const_cast<void*>(__ptr), *reinterpret_cast<uint64_t const*>(&buffer), __timeout_us);
124 }
181
182 std::uint64_t __value = [__val]() -> std::uint64_t {
183 if constexpr (_Size == 4) {
184 std::uint32_t __result;
185 std::memcpy(&__result, __val, _Size);
186 return __result;
187 } else if constexpr (_Size == 8) {
188 std::uint64_t __result;
189 std::memcpy(&__result, __val, _Size);
190 return __result;
191 } else {
192 static_assert(false, "Can only wait on 8 bytes or 4 bytes value");
193 }
194 }();
195
196 __ulock_wait(
197 _Size == 4 ? UL_COMPARE_AND_WAIT : UL_COMPARE_AND_WAIT64, const_cast<void*>(__ptr), __value, __timeout_us);
125198}
126199
127200template <std::size_t _Size>
......@@ -134,6 +207,8 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
134207 __ulock_wake(UL_COMPARE_AND_WAIT64 | (__notify_one ? 0 : ULF_WAKE_ALL), const_cast<void*>(__ptr), 0);
135208}
136209
210# endif // _LIBCPP_USE_OS_SYNC
211
137212#elif defined(__FreeBSD__) && __SIZEOF_LONG__ == 8
138213/*
139214 * Since __cxx_contention_t is int64_t even on 32bit FreeBSD
......@@ -254,6 +329,37 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
254329 }
255330}
256331
332#elif defined(__Fuchsia__)
333
334template <std::size_t _Size>
335static inline zx_futex_t const* __get_zx_futex(void const* __ptr) {
336 static_assert(_Size == sizeof(zx_futex_t), "Can only wait/wake on zx_futex_t-compatible value");
337
338 // Implicitly link against the vDSO system call ABI without requiring the
339 // final link to specify -lzircon explicitly when statically linking libc++.
340# pragma comment(lib, "zircon")
341
342 return reinterpret_cast<zx_futex_t const*>(__ptr);
343}
344
345template <std::size_t _Size, class MaybeTimeout>
346static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
347 zx_futex_t val;
348 std::memcpy(&val, __val, _Size);
349 zx_instant_mono_t deadline;
350 if constexpr (is_same_v<MaybeTimeout, NoTimeout>) {
351 deadline = ZX_TIME_INFINITE;
352 } else {
353 deadline = _zx_deadline_after(maybe_timeout_ns);
354 }
355 _zx_futex_wait(__get_zx_futex<_Size>(__ptr), val, ZX_HANDLE_INVALID, deadline);
356}
357
358template <std::size_t _Size>
359static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
360 _zx_futex_wake(__get_zx_futex<_Size>(__ptr), __notify_one ? 1 : UINT32_MAX);
361}
362
257363#else // <- Add other operating systems here
258364
259365// Baseline is just a timed backoff
......@@ -308,45 +414,41 @@ static constexpr size_t __contention_table_size = (1 << 8); /* < there's no magi
308414
309415static constexpr hash<void const*> __contention_hasher;
310416
311// Waiter count table for all atomics with the correct size that use itself as the wait/notify address.
312
313struct alignas(
314 std::hardware_constructive_interference_size) /* aim to avoid false sharing */ __contention_state_native {
315 __cxx_atomic_contention_t __waiter_count;
316 constexpr __contention_state_native() : __waiter_count(0) {}
317};
318
319static __contention_state_native __contention_table_native[__contention_table_size];
320
321static __cxx_atomic_contention_t* __get_native_waiter_count(void const* p) {
322 return &__contention_table_native[__contention_hasher(p) & (__contention_table_size - 1)].__waiter_count;
323}
324
325// Global contention table for all atomics with the wrong size that use the global table's atomic as wait/notify
326// address.
327
328struct alignas(
329 std::hardware_constructive_interference_size) /* aim to avoid false sharing */ __contention_state_global {
330 __cxx_atomic_contention_t __waiter_count;
417// Unified contention table shared by both the native path (atomics whose size matches the platform
418// wait size and are waited on directly) and the global path (atomics with the wrong size, which use
419// the global table's atomic as the wait/notify address). The native path only reads/writes the native
420// waiter count, and the global path uses the global waiter count and the platform state.
421//
422// We use a single table for both the native and non-native states to minimize the size impact, since
423// we would have plenty of unused padding otherwise. This technically means that if both a native and
424// a non-native atomic fall into the same bucket and are reading/writing waiter counts on the same
425// cache line, we would end up in a "false-sharing" situation. However, in practice, it would require
426// both native and non-native atomics to be used concurrently, and to fall in the same bucket, which
427// is expected to be unlikely.
428struct alignas(std::hardware_destructive_interference_size) /* aim to avoid false sharing */ __contention_state {
429 __cxx_atomic_contention_t __waiter_count_native;
430 __cxx_atomic_contention_t __waiter_count_global;
331431 __cxx_atomic_contention_t __platform_state;
332 constexpr __contention_state_global() : __waiter_count(0), __platform_state(0) {}
432 constexpr __contention_state() : __waiter_count_native(0), __waiter_count_global(0), __platform_state(0) {}
333433};
334434
335static __contention_state_global __contention_table_global[__contention_table_size];
435static constinit __contention_state __contention_table[__contention_table_size];
336436
337static __contention_state_global* __get_global_contention_state(void const* p) {
338 return &__contention_table_global[__contention_hasher(p) & (__contention_table_size - 1)];
437static __contention_state* __get_contention_state(void const* p) {
438 return &__contention_table[__contention_hasher(p) & (__contention_table_size - 1)];
339439}
340440
341441/* When the incoming atomic is the wrong size for the platform wait size, need to
342442 launder the value sequence through an atomic from our table. */
343443
344444static void __atomic_notify_global_table(void const* __location) {
345 auto const __entry = __get_global_contention_state(__location);
445 auto const __entry = __get_contention_state(__location);
346446 // The value sequence laundering happens on the next line below.
347447 __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_seq_cst);
348448 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
349 &__entry->__waiter_count, &__entry->__platform_state, false /* when laundering, we can't handle notify_one */);
449 &__entry->__waiter_count_global,
450 &__entry->__platform_state,
451 false /* when laundering, we can't handle notify_one */);
350452}
351453
352454// =============================
......@@ -355,22 +457,22 @@ static void __atomic_notify_global_table(void const* __location) {
355457
356458// global
357459_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __atomic_monitor_global(void const* __location) noexcept {
358 auto const __entry = __get_global_contention_state(__location);
460 auto const __entry = __get_contention_state(__location);
359461 return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire);
360462}
361463
362464_LIBCPP_EXPORTED_FROM_ABI void
363465__atomic_wait_global_table(void const* __location, __cxx_contention_t __old_value) noexcept {
364 auto const __entry = __get_global_contention_state(__location);
466 auto const __entry = __get_contention_state(__location);
365467 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
366 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{});
468 &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, NoTimeout{});
367469}
368470
369471_LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_global_table_with_timeout(
370472 void const* __location, __cxx_contention_t __old_value, uint64_t __timeout_ns) _NOEXCEPT {
371 auto const __entry = __get_global_contention_state(__location);
473 auto const __entry = __get_contention_state(__location);
372474 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
373 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, __timeout_ns);
475 &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, __timeout_ns);
374476}
375477
376478_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_global_table(void const* __location) noexcept {
......@@ -385,23 +487,25 @@ _LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_global_table(void const* __lo
385487
386488template <std::size_t _Size>
387489_LIBCPP_EXPORTED_FROM_ABI void __atomic_wait_native(void const* __address, void const* __old_value) noexcept {
388 __contention_wait<_Size>(__get_native_waiter_count(__address), __address, __old_value, NoTimeout{});
490 __contention_wait<_Size>(
491 &__get_contention_state(__address)->__waiter_count_native, __address, __old_value, NoTimeout{});
389492}
390493
391494template <std::size_t _Size>
392495_LIBCPP_EXPORTED_FROM_ABI void
393496__atomic_wait_native_with_timeout(void const* __address, void const* __old_value, uint64_t __timeout_ns) noexcept {
394 __contention_wait<_Size>(__get_native_waiter_count(__address), __address, __old_value, __timeout_ns);
497 __contention_wait<_Size>(
498 &__get_contention_state(__address)->__waiter_count_native, __address, __old_value, __timeout_ns);
395499}
396500
397501template <std::size_t _Size>
398502_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_one_native(void const* __location) noexcept {
399 __contention_notify<_Size>(__get_native_waiter_count(__location), __location, true);
503 __contention_notify<_Size>(&__get_contention_state(__location)->__waiter_count_native, __location, true);
400504}
401505
402506template <std::size_t _Size>
403507_LIBCPP_EXPORTED_FROM_ABI void __atomic_notify_all_native(void const* __location) noexcept {
404 __contention_notify<_Size>(__get_native_waiter_count(__location), __location, false);
508 __contention_notify<_Size>(&__get_contention_state(__location)->__waiter_count_native, __location, false);
405509}
406510
407511// ==================================================
......@@ -452,34 +556,34 @@ _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __lo
452556}
453557
454558_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept {
455 auto const __entry = __get_global_contention_state(const_cast<void const*>(__location));
559 auto const __entry = __get_contention_state(const_cast<void const*>(__location));
456560 return __cxx_atomic_load(&__entry->__platform_state, memory_order_acquire);
457561}
458562
459563_LIBCPP_EXPORTED_FROM_ABI void
460564__libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept {
461 auto const __entry = __get_global_contention_state(const_cast<void const*>(__location));
565 auto const __entry = __get_contention_state(const_cast<void const*>(__location));
462566 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
463 &__entry->__waiter_count, &__entry->__platform_state, &__old_value, NoTimeout{});
567 &__entry->__waiter_count_global, &__entry->__platform_state, &__old_value, NoTimeout{});
464568}
465569
466570_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept {
467571 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
468572 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
469 __get_native_waiter_count(__location_cast), __location_cast, true);
573 &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, true);
470574}
471575
472576_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept {
473577 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
474578 __contention_notify<sizeof(__cxx_atomic_contention_t)>(
475 __get_native_waiter_count(__location_cast), __location_cast, false);
579 &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, false);
476580}
477581
478582_LIBCPP_EXPORTED_FROM_ABI void
479583__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept {
480584 auto __location_cast = const_cast<const void*>(static_cast<const volatile void*>(__location));
481585 __contention_wait<sizeof(__cxx_atomic_contention_t)>(
482 __get_native_waiter_count(__location_cast), __location_cast, &__old_value, NoTimeout{});
586 &__get_contention_state(__location_cast)->__waiter_count_native, __location_cast, &__old_value, NoTimeout{});
483587}
484588
485589// this function is even unused in the old ABI
......@@ -490,6 +594,7 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) no
490594
491595_LIBCPP_DIAGNOSTIC_POP
492596
597_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
493598_LIBCPP_END_NAMESPACE_STD
494599
495600_LIBCPP_POP_MACROS
lib/libcxx/src/barrier.cpp+2
......@@ -10,6 +10,7 @@
1010#include <thread>
1111
1212_LIBCPP_BEGIN_NAMESPACE_STD
13_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1314
1415class __barrier_algorithm_base {
1516public:
......@@ -69,4 +70,5 @@ __destroy_barrier_algorithm_base(_LIBCPP_NOESCAPE __barrier_algorithm_base* __ba
6970 delete __barrier;
7071}
7172
73_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7274_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/call_once.cpp+2
......@@ -17,6 +17,7 @@
1717#include "include/atomic_support.h"
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
20_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2021
2122// If dispatch_once_f ever handles C++ exceptions, and if one can get to it
2223// without illegal macros (unexpected macros not beginning with _UpperCase or
......@@ -68,4 +69,5 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(
6869#endif // !_LIBCPP_HAS_THREADS
6970}
7071
72_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7173_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/charconv.cpp+3
......@@ -13,6 +13,7 @@
1313#include "include/to_chars_floating_point.h"
1414
1515_LIBCPP_BEGIN_NAMESPACE_STD
16_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1617
1718#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
1819
......@@ -89,4 +90,6 @@ template __from_chars_result<float> __from_chars_floating_point(
8990
9091template __from_chars_result<double> __from_chars_floating_point(
9192 _LIBCPP_NOESCAPE const char* __first, _LIBCPP_NOESCAPE const char* __last, chars_format __fmt);
93
94_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
9295_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/chrono.cpp+3-2
......@@ -20,7 +20,6 @@
2020# include <__support/ibm/gettod_zos.h> // gettimeofdayMonotonic
2121#endif
2222
23#include "include/apple_availability.h"
2423#include <time.h> // clock_gettime and CLOCK_{MONOTONIC,REALTIME,MONOTONIC_RAW}
2524
2625#if __has_include(<unistd.h>)
......@@ -31,7 +30,7 @@
3130# include <sys/time.h> // for gettimeofday and timeval
3231#endif
3332
34#if defined(__LLVM_LIBC__)
33#if _LIBCPP_LIBC_LLVM_LIBC
3534# define _LIBCPP_HAS_TIMESPEC_GET
3635#endif
3736
......@@ -64,6 +63,7 @@
6463#endif
6564
6665_LIBCPP_BEGIN_NAMESPACE_STD
66_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
6767
6868namespace chrono {
6969
......@@ -262,4 +262,5 @@ steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_c
262262
263263} // namespace chrono
264264
265_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
265266_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/condition_variable.cpp+2
......@@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS
2323#include <__undef_macros>
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
26_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2627
2728// ~condition_variable is defined elsewhere.
2829
......@@ -72,6 +73,7 @@ void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
7273 __thread_local_data()->notify_all_at_thread_exit(&cond, lk.release());
7374}
7475
76_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7577_LIBCPP_END_NAMESPACE_STD
7678
7779_LIBCPP_POP_MACROS
lib/libcxx/src/condition_variable_destructor.cpp+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324#ifdef NEEDS_CONDVAR_DESTRUCTOR
2425
......@@ -37,4 +38,5 @@ public:
3738condition_variable::~condition_variable() { __libcpp_condvar_destroy(&__cv_); }
3839#endif
3940
41_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4042_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/error_category.cpp+2
......@@ -17,6 +17,7 @@
1717#include <system_error>
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
20_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2021
2122// class error_category
2223
......@@ -36,4 +37,5 @@ bool error_category::equivalent(const error_code& code, int condition) const noe
3637 return *this == code.category() && code.value() == condition;
3738}
3839
40_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3941_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/expected.cpp+4
......@@ -9,5 +9,9 @@
99#include <expected>
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
12_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
13
1214const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; }
15
16_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
1317_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/experimental/chrono_exception.cpp+2
......@@ -9,6 +9,7 @@
99#include <chrono>
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
12_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1213
1314namespace chrono {
1415
......@@ -19,4 +20,5 @@ _LIBCPP_EXPORTED_FROM_ABI ambiguous_local_time::~ambiguous_local_time() = defaul
1920
2021} // namespace chrono
2122
23_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2224_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/experimental/include/tzdb/tzdb_private.h+2
......@@ -16,6 +16,7 @@
1616#include "types_private.h"
1717
1818_LIBCPP_BEGIN_NAMESPACE_STD
19_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1920
2021namespace chrono {
2122
......@@ -23,6 +24,7 @@ void __init_tzdb(tzdb& __tzdb, __tz::__rules_storage_type& __rules);
2324
2425} // namespace chrono
2526
27_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2628_LIBCPP_END_NAMESPACE_STD
2729
2830#endif // _LIBCPP_SRC_INCLUDE_TZDB_TZ_PRIVATE_H
lib/libcxx/src/experimental/log_hardening_failure.cpp+2
......@@ -15,6 +15,7 @@
1515#endif // __BIONIC__
1616
1717_LIBCPP_BEGIN_NAMESPACE_STD
18_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1819
1920void __log_hardening_failure(const char* message) noexcept {
2021 // Always log the message to `stderr` in case the platform-specific system calls fail.
......@@ -28,4 +29,5 @@ void __log_hardening_failure(const char* message) noexcept {
2829#endif
2930}
3031
32_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3133_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/experimental/time_zone.cpp+2-6
......@@ -55,6 +55,7 @@
5555#endif
5656
5757_LIBCPP_BEGIN_NAMESPACE_STD
58_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
5859
5960#ifdef PRINT
6061template <>
......@@ -209,8 +210,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se
209210 return chrono::seconds{0};
210211 else
211212 static_assert(false);
212
213 std::__libcpp_unreachable();
214213 },
215214 __continuation.__rules);
216215
......@@ -235,8 +234,6 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se
235234 return __value(__year, __month);
236235 else
237236 static_assert(false);
238
239 std::__libcpp_unreachable();
240237 },
241238 __on);
242239}
......@@ -698,8 +695,6 @@ __get_sys_info(sys_seconds __time,
698695 return chrono::__get_sys_info_basic(__time, __continuation_begin, __continuation, __value.__time);
699696 else
700697 static_assert(false);
701
702 std::__libcpp_unreachable();
703698 },
704699 __continuation.__rules);
705700}
......@@ -1061,4 +1056,5 @@ time_zone::__get_info(local_seconds __local_time) const {
10611056
10621057} // namespace chrono
10631058
1059_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
10641060_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/experimental/tzdb.cpp+3-1
......@@ -46,6 +46,7 @@
4646// TODO TZDB Implement the Windows mapping in tzdb::current_zone
4747
4848_LIBCPP_BEGIN_NAMESPACE_STD
49_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4950
5051namespace chrono {
5152
......@@ -53,7 +54,7 @@ _LIBCPP_DIAGNOSTIC_PUSH
5354_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
5455// This function is weak so it can be overriden in the tests. The
5556// declaration is in the test header test/support/test_tzdb.h
56_LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
57[[gnu::weak]] string_view __libcpp_tzdb_directory() {
5758#if defined(__linux__)
5859 return "/usr/share/zoneinfo/";
5960#else
......@@ -825,4 +826,5 @@ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI string remote_version() {
825826
826827} // namespace chrono
827828
829_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
828830_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/experimental/tzdb_list.cpp+2
......@@ -13,6 +13,7 @@
1313#include "include/tzdb/tzdb_list_private.h"
1414
1515_LIBCPP_BEGIN_NAMESPACE_STD
16_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1617
1718namespace chrono {
1819
......@@ -40,4 +41,5 @@ _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::__erase_after(con
4041
4142} // namespace chrono
4243
44_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4345_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/filesystem/directory_entry.cpp+2
......@@ -16,6 +16,7 @@
1616#include "time_utils.h"
1717
1818_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
19_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1920
2021error_code directory_entry::__do_refresh() noexcept {
2122 __data_.__reset();
......@@ -70,4 +71,5 @@ error_code directory_entry::__do_refresh() noexcept {
7071 return failure_ec;
7172}
7273
74_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7375_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/filesystem/directory_iterator.cpp+2
......@@ -26,6 +26,7 @@
2626#endif
2727
2828_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
29_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2930
3031using detail::ErrorHandler;
3132
......@@ -320,4 +321,5 @@ bool recursive_directory_iterator::__try_recursion(error_code* ec) {
320321 return false;
321322}
322323
324_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
323325_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/filesystem/filesystem_clock.cpp+3-1
......@@ -32,7 +32,7 @@
3232# include <sys/time.h> // for gettimeofday and timeval
3333#endif
3434
35#if defined(__LLVM_LIBC__)
35#if _LIBCPP_LIBC_LLVM_LIBC
3636# define _LIBCPP_HAS_TIMESPEC_GET
3737#endif
3838
......@@ -42,6 +42,7 @@
4242#endif
4343
4444_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
45_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4546
4647_LIBCPP_DIAGNOSTIC_PUSH
4748_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
......@@ -76,4 +77,5 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept {
7677#endif
7778}
7879
80_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7981_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/filesystem/filesystem_error.cpp+2
......@@ -15,6 +15,7 @@
1515#include "format_string.h"
1616
1717_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
18_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1819
1920filesystem_error::~filesystem_error() {}
2021
......@@ -37,4 +38,5 @@ void filesystem_error::__create_what(int __num_paths) {
3738 }();
3839}
3940
41_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4042_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/filesystem/operations.cpp+5
......@@ -69,6 +69,7 @@
6969#endif
7070
7171_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
72_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
7273
7374using detail::capture_errno;
7475using detail::ErrorHandler;
......@@ -904,6 +905,9 @@ uintmax_t remove_all_impl(int parent_directory, const path& p, error_code& ec) {
904905 break; // we're done iterating through the directory
905906 } else {
906907 count += remove_all_impl(fd, str, ec);
908 // If there's an error removing the child, return immediately to preserve the error code.
909 if (ec)
910 return count;
907911 }
908912 }
909913
......@@ -1077,4 +1081,5 @@ path __weakly_canonical(const path& p, error_code* ec) {
10771081 return result.lexically_normal();
10781082}
10791083
1084_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
10801085_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/filesystem/path.cpp+12-11
......@@ -14,6 +14,7 @@
1414#include "path_parser.h"
1515
1616_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
17_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1718
1819using detail::ErrorHandler;
1920using parser::createView;
......@@ -139,21 +140,20 @@ string_view_t path::__extension() const { return parser::separate_filename(__fil
139140////////////////////////////////////////////////////////////////////////////
140141// path.gen
141142
142enum PathPartKind : unsigned char { PK_None, PK_RootSep, PK_Filename, PK_Dot, PK_DotDot, PK_TrailingSep };
143enum PathPartKind : unsigned char { PK_None, PK_RootName, PK_RootSep, PK_Filename, PK_Dot, PK_DotDot, PK_TrailingSep };
143144
144static PathPartKind ClassifyPathPart(string_view_t Part) {
145static PathPartKind ClassifyPathPart(const PathParser& PP) {
146 if (PP.inRootName())
147 return PK_RootName;
148 if (PP.inRootDir())
149 return PK_RootSep;
150 string_view_t Part = *PP;
145151 if (Part.empty())
146152 return PK_TrailingSep;
147153 if (Part == PATHSTR("."))
148154 return PK_Dot;
149155 if (Part == PATHSTR(".."))
150156 return PK_DotDot;
151 if (Part == PATHSTR("/"))
152 return PK_RootSep;
153#if defined(_LIBCPP_WIN32API)
154 if (Part == PATHSTR("\\"))
155 return PK_RootSep;
156#endif
157157 return PK_Filename;
158158}
159159
......@@ -183,13 +183,13 @@ path path::lexically_normal() const {
183183 // Build a stack containing the remaining elements of the path, popping off
184184 // elements which occur before a '..' entry.
185185 for (auto PP = PathParser::CreateBegin(__pn_); PP; ++PP) {
186 auto Part = *PP;
187 PathPartKind Kind = ClassifyPathPart(Part);
186 PathPartKind Kind = ClassifyPathPart(PP);
188187 switch (Kind) {
189188 case PK_Filename:
189 case PK_RootName:
190190 case PK_RootSep: {
191191 // Add all non-dot and non-dot-dot elements to the stack of elements.
192 AddPart(Kind, Part);
192 AddPart(Kind, *PP);
193193 MaybeNeedTrailingSep = false;
194194 break;
195195 }
......@@ -444,4 +444,5 @@ size_t __char_to_wide(const string& str, wchar_t* out, size_t outlen) {
444444}
445445#endif
446446
447_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
447448_LIBCPP_END_NAMESPACE_FILESYSTEM
lib/libcxx/src/fstream.cpp+2
......@@ -18,6 +18,7 @@
1818#endif
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
21_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2122
2223#if defined(_LIBCPP_WIN32API)
2324
......@@ -34,4 +35,5 @@ _LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) no
3435
3536#endif
3637
38_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3739_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/functional.cpp+2
......@@ -9,6 +9,7 @@
99#include <functional>
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
12_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1213
1314bad_function_call::~bad_function_call() noexcept {}
1415
......@@ -18,4 +19,5 @@ size_t __hash_memory(_LIBCPP_NOESCAPE const void* ptr, size_t size) noexcept {
1819 return __murmur2_or_cityhash<size_t>()(ptr, size);
1920}
2021
22_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
2123_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/future.cpp+2
......@@ -10,6 +10,7 @@
1010#include <string>
1111
1212_LIBCPP_BEGIN_NAMESPACE_STD
13_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1314
1415class _LIBCPP_HIDDEN __future_error_category : public __do_message {
1516public:
......@@ -194,4 +195,5 @@ shared_future<void>& shared_future<void>::operator=(const shared_future& __rhs)
194195 return *this;
195196}
196197
198_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
197199_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/hash.cpp+17-334
......@@ -13,6 +13,7 @@
1313_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare")
1414
1515_LIBCPP_BEGIN_NAMESPACE_STD
16_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1617
1718namespace {
1819
......@@ -30,6 +31,13 @@ const unsigned indices[] = {
3031 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139,
3132 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209};
3233
34// These are the amount we increment by when checking for potential
35// primes in the loop in __next_prime.
36const uint8_t increments[] = {
37 0, 10, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2,
38 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2, 6, 4, 2, 4, 2, 10,
39};
40
3341} // namespace
3442
3543// Returns: If n == 0, returns 0. Else returns the lowest prime number that
......@@ -97,340 +105,14 @@ size_t __next_prime(size_t n) {
97105 {
98106 size_t i = 211;
99107 while (true) {
100 std::size_t q = n / i;
101 if (q < i)
102 return n;
103 if (n == q * i)
104 break;
105
106 i += 10;
107 q = n / i;
108 if (q < i)
109 return n;
110 if (n == q * i)
111 break;
112
113 i += 2;
114 q = n / i;
115 if (q < i)
116 return n;
117 if (n == q * i)
118 break;
119
120 i += 4;
121 q = n / i;
122 if (q < i)
123 return n;
124 if (n == q * i)
125 break;
126
127 i += 2;
128 q = n / i;
129 if (q < i)
130 return n;
131 if (n == q * i)
132 break;
133
134 i += 4;
135 q = n / i;
136 if (q < i)
137 return n;
138 if (n == q * i)
139 break;
140
141 i += 6;
142 q = n / i;
143 if (q < i)
144 return n;
145 if (n == q * i)
146 break;
147
148 i += 2;
149 q = n / i;
150 if (q < i)
151 return n;
152 if (n == q * i)
153 break;
154
155 i += 6;
156 q = n / i;
157 if (q < i)
158 return n;
159 if (n == q * i)
160 break;
161
162 i += 4;
163 q = n / i;
164 if (q < i)
165 return n;
166 if (n == q * i)
167 break;
168
169 i += 2;
170 q = n / i;
171 if (q < i)
172 return n;
173 if (n == q * i)
174 break;
175
176 i += 4;
177 q = n / i;
178 if (q < i)
179 return n;
180 if (n == q * i)
181 break;
182
183 i += 6;
184 q = n / i;
185 if (q < i)
186 return n;
187 if (n == q * i)
188 break;
189
190 i += 6;
191 q = n / i;
192 if (q < i)
193 return n;
194 if (n == q * i)
195 break;
196
197 i += 2;
198 q = n / i;
199 if (q < i)
200 return n;
201 if (n == q * i)
202 break;
203
204 i += 6;
205 q = n / i;
206 if (q < i)
207 return n;
208 if (n == q * i)
209 break;
210
211 i += 4;
212 q = n / i;
213 if (q < i)
214 return n;
215 if (n == q * i)
216 break;
217
218 i += 2;
219 q = n / i;
220 if (q < i)
221 return n;
222 if (n == q * i)
223 break;
224
225 i += 6;
226 q = n / i;
227 if (q < i)
228 return n;
229 if (n == q * i)
230 break;
231
232 i += 4;
233 q = n / i;
234 if (q < i)
235 return n;
236 if (n == q * i)
237 break;
238
239 i += 6;
240 q = n / i;
241 if (q < i)
242 return n;
243 if (n == q * i)
244 break;
245
246 i += 8;
247 q = n / i;
248 if (q < i)
249 return n;
250 if (n == q * i)
251 break;
252
253 i += 4;
254 q = n / i;
255 if (q < i)
256 return n;
257 if (n == q * i)
258 break;
259
260 i += 2;
261 q = n / i;
262 if (q < i)
263 return n;
264 if (n == q * i)
265 break;
266
267 i += 4;
268 q = n / i;
269 if (q < i)
270 return n;
271 if (n == q * i)
272 break;
273
274 i += 2;
275 q = n / i;
276 if (q < i)
277 return n;
278 if (n == q * i)
279 break;
280
281 i += 4;
282 q = n / i;
283 if (q < i)
284 return n;
285 if (n == q * i)
286 break;
287
288 i += 8;
289 q = n / i;
290 if (q < i)
291 return n;
292 if (n == q * i)
293 break;
294
295 i += 6;
296 q = n / i;
297 if (q < i)
298 return n;
299 if (n == q * i)
300 break;
301
302 i += 4;
303 q = n / i;
304 if (q < i)
305 return n;
306 if (n == q * i)
307 break;
308
309 i += 6;
310 q = n / i;
311 if (q < i)
312 return n;
313 if (n == q * i)
314 break;
315
316 i += 2;
317 q = n / i;
318 if (q < i)
319 return n;
320 if (n == q * i)
321 break;
322
323 i += 4;
324 q = n / i;
325 if (q < i)
326 return n;
327 if (n == q * i)
328 break;
329
330 i += 6;
331 q = n / i;
332 if (q < i)
333 return n;
334 if (n == q * i)
335 break;
336
337 i += 2;
338 q = n / i;
339 if (q < i)
340 return n;
341 if (n == q * i)
342 break;
343
344 i += 6;
345 q = n / i;
346 if (q < i)
347 return n;
348 if (n == q * i)
349 break;
350
351 i += 6;
352 q = n / i;
353 if (q < i)
354 return n;
355 if (n == q * i)
356 break;
357
358 i += 4;
359 q = n / i;
360 if (q < i)
361 return n;
362 if (n == q * i)
363 break;
364
365 i += 2;
366 q = n / i;
367 if (q < i)
368 return n;
369 if (n == q * i)
370 break;
371
372 i += 4;
373 q = n / i;
374 if (q < i)
375 return n;
376 if (n == q * i)
377 break;
378
379 i += 6;
380 q = n / i;
381 if (q < i)
382 return n;
383 if (n == q * i)
384 break;
385
386 i += 2;
387 q = n / i;
388 if (q < i)
389 return n;
390 if (n == q * i)
391 break;
392
393 i += 6;
394 q = n / i;
395 if (q < i)
396 return n;
397 if (n == q * i)
398 break;
399
400 i += 4;
401 q = n / i;
402 if (q < i)
403 return n;
404 if (n == q * i)
405 break;
406
407 i += 2;
408 q = n / i;
409 if (q < i)
410 return n;
411 if (n == q * i)
412 break;
413
414 i += 4;
415 q = n / i;
416 if (q < i)
417 return n;
418 if (n == q * i)
419 break;
420
421 i += 2;
422 q = n / i;
423 if (q < i)
424 return n;
425 if (n == q * i)
426 break;
427
428 i += 10;
429 q = n / i;
430 if (q < i)
431 return n;
432 if (n == q * i)
433 break;
108 for (auto inc : increments) {
109 i += inc;
110 std::size_t q = n / i;
111 if (q < i)
112 return n;
113 if (n == q * i)
114 goto next;
115 }
434116
435117 // This will loop i to the next "plane" of potential primes
436118 i += 2;
......@@ -446,4 +128,5 @@ size_t __next_prime(size_t n) {
446128 }
447129}
448130
131_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
449132_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/include/apple_availability.h deleted-34
......@@ -1,34 +0,0 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H
10#define _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H
11
12#if defined(__APPLE__)
13
14# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
15# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500
16# define _LIBCPP_USE_ULOCK
17# endif
18# elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
19# if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000
20# define _LIBCPP_USE_ULOCK
21# endif
22# elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
23# if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000
24# define _LIBCPP_USE_ULOCK
25# endif
26# elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
27# if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000
28# define _LIBCPP_USE_ULOCK
29# endif
30# endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
31
32#endif // __APPLE__
33
34#endif // _LIBCPP_SRC_INCLUDE_APPLE_AVAILABILITY_H
lib/libcxx/src/include/config_elast.h+4-1
......@@ -21,7 +21,7 @@
2121// where strerror/strerror_r can't handle out-of-range errno values.
2222#if defined(ELAST)
2323# define _LIBCPP_ELAST ELAST
24#elif defined(__LLVM_LIBC__)
24#elif _LIBCPP_LIBC_LLVM_LIBC
2525// No _LIBCPP_ELAST needed for LLVM libc
2626#elif _LIBCPP_LIBC_NEWLIB
2727# define _LIBCPP_ELAST __ELASTERROR
......@@ -33,6 +33,9 @@
3333// No _LIBCPP_ELAST needed on WASI
3434#elif defined(__EMSCRIPTEN__)
3535// No _LIBCPP_ELAST needed on Emscripten
36// zig patch: haiku support
37#elif defined(__HAIKU__)
38// No _LIBCPP_ELAST needed on Haiku
3639#elif defined(__linux__) || _LIBCPP_HAS_MUSL_LIBC
3740# define _LIBCPP_ELAST 4095
3841#elif defined(__APPLE__)
lib/libcxx/src/include/overridable_function.h+80-50
......@@ -11,11 +11,6 @@
1111#define _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H
1212
1313#include <__config>
14#include <cstdint>
15
16#if __has_feature(ptrauth_calls)
17# include <ptrauth.h>
18#endif
1914
2015#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2116# pragma GCC system_header
......@@ -42,18 +37,19 @@
4237// -------------------
4338//
4439// Let's say we want to check whether a weak function `f` has been overridden by the user.
45// The general mechanism works by placing `f`'s definition (in the libc++ built library)
46// inside a special section, which we do using the `__section__` attribute via the
47// OVERRIDABLE_FUNCTION macro.
40// The general mechanism works by defining a local symbol `__impl_ref<f>::__impl_` with
41// the same address as `f` as a constant expression using direct PC-relative
42// materialization thus pointing at the symbol defined in the same TU. At runtime, it
43// compares the address of `__impl_ref<f>::__impl_` with the address of `f` loaded from
44// GOT: if `f` was overridden by the user in another TU, the addresses will be different.
4845//
49// Then, when comes the time to check whether the function has been overridden, we take
50// the address of the function and we check whether it falls inside the special function
51// we created. This can be done by finding pointers to the start and the end of the section
52// (which is done differently for ELF and Mach-O), and then checking whether `f` falls
53// within those bounds. If it falls within those bounds, then `f` is still inside the
54// special section and so it is the version we defined in the libc++ built library, i.e.
55// it was not overridden. Otherwise, it was overridden by the user because it falls
56// outside of the section.
46// When pointer authentication is used, the above mechanism doesn't work (yet) so we use
47// a different strategy placing `f`'s definition (in the libc++ built library) inside
48// a special section, which we do using the `__section__` attribute via the
49// OVERRIDABLE_FUNCTION macro. Then, when comes the time to check whether the function has
50// been overridden, we take the address of the function and we check whether it falls inside
51// the special section we created. This can be done by finding pointers to the start and
52// the end of the section, and then checking whether `f` falls within those bounds.
5753//
5854// Important note
5955// --------------
......@@ -63,50 +59,80 @@
6359// want to be defining special sections inside user's executables which use our headers.
6460//
6561
66#if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
62#if defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__))
6763
6864# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
69# define OVERRIDABLE_FUNCTION \
70 __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions"))) _LIBCPP_WEAK
7165
72_LIBCPP_BEGIN_NAMESPACE_STD template <typename T, T* _Func>
73_LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept {
74 // Declare two dummy bytes and give them these special `__asm` values. These values are
75 // defined by the linker, which means that referring to `&__lcxx_override_start` will
76 // effectively refer to the address where the section starts (and same for the end).
77 extern char __lcxx_override_start __asm("section$start$__TEXT$__lcxx_override");
78 extern char __lcxx_override_end __asm("section$end$__TEXT$__lcxx_override");
79
80 // Now get a uintptr_t out of these locations, and out of the function pointer.
81 uintptr_t __start = reinterpret_cast<uintptr_t>(&__lcxx_override_start);
82 uintptr_t __end = reinterpret_cast<uintptr_t>(&__lcxx_override_end);
83 uintptr_t __ptr = reinterpret_cast<uintptr_t>(_Func);
66# if !__has_feature(ptrauth_calls)
8467
85# if __has_feature(ptrauth_calls)
86 // We must pass a void* to ptrauth_strip since it only accepts a pointer type. Also, in particular,
87 // we must NOT pass a function pointer, otherwise we will strip the function pointer, and then attempt
88 // to authenticate and re-sign it when casting it to a uintptr_t again, which will fail because we just
89 // stripped the function pointer. See rdar://122927845.
90 __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer));
91# endif
68# define OVERRIDABLE_FUNCTION [[gnu::weak]]
9269
93 // Finally, the function was overridden if it falls outside of the section's bounds.
94 return __ptr < __start || __ptr > __end;
70_LIBCPP_BEGIN_NAMESPACE_STD
71
72namespace {
73
74// This is used to prevent TBAA from optimizing away the function pointer comparison.
75template <typename T>
76[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI T* __launder_function_pointer(T* __ptr) noexcept {
77 __asm__ volatile("" : "+r"(__ptr));
78 return __ptr;
9579}
80
81} // namespace
82
83template <auto* _Func>
84struct __impl_ref;
85
86// __impl_ref<...>::__impl_ is expected to be defined elsewhere, so the compiler emits
87// assembly references to the mangled symbol with no definition. This template saves us
88// the trouble of providing manual declarations for overloads with some other local name
89// for each function name being overloaded (operator new, operator new[], etc.).
90template <typename _Ret, typename... _Args, _Ret (*_Func)(_Args...)>
91struct __impl_ref<_Func> {
92 [[gnu::visibility("hidden")]] static _Ret __impl_(_Args...);
93};
94
95// This takes a function type template argument first so that the second non-type template
96// argument (pointer to the public function) gets the benefit of type-aware overload
97// resolution, rather than having to use a static_cast.
98template <typename T, T* _Func>
99_LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept {
100# if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2101
101 __asm__("%cc0 = %cc1" : : "X"(__impl_ref<_Func>::__impl_), "X"(_Func));
102# else
103 __asm__("%c0 = %c1" : : "X"(__impl_ref<_Func>::__impl_), "X"(_Func));
104# endif
105 // This just has the compiler compare the two symbols. For PIC mode, this will do a
106 // direct PC-relative materialization for __impl_ref<...>::__impl_ and a GOT load for
107 // the _Func symbol. The compiler thinks __impl_ref<...>::__impl_ is defined elsewhere
108 // at link time and will be an undefined symbol. It doesn't know that the __asm__ tells
109 // the assembler to define it as a local symbol.
110 return __launder_function_pointer(_Func) != __impl_ref<_Func>::__impl_;
111}
112
96113_LIBCPP_END_NAMESPACE_STD
97114
98// The NVPTX linker cannot create '__start/__stop' sections.
99#elif defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)
115# else // __has_feature(ptrauth_calls)
100116
101# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
102# define OVERRIDABLE_FUNCTION __attribute__((__section__("__lcxx_override"))) _LIBCPP_WEAK
117# include <cstdint>
118# include <ptrauth.h>
103119
120# if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
121# define OVERRIDABLE_FUNCTION [[gnu::weak, gnu::section("__TEXT,__lcxx_override,regular,pure_instructions")]]
122// Declare two dummy bytes and give them these special `__asm` values. These values are
123// defined by the linker, which means that referring to `&__lcxx_override_start` will
124// effectively refer to the address where the section starts (and same for the end).
125extern char __start___lcxx_override __asm("section$start$__TEXT$__lcxx_override");
126extern char __stop___lcxx_override __asm("section$end$__TEXT$__lcxx_override");
127# elif defined(_LIBCPP_OBJECT_FORMAT_ELF)
104128// This is very similar to what we do for Mach-O above. The ELF linker will implicitly define
105129// variables with those names corresponding to the start and the end of the section.
106130//
107131// See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section
132# define OVERRIDABLE_FUNCTION [[gnu::weak, gnu::section("__lcxx_override")]]
108133extern char __start___lcxx_override;
109134extern char __stop___lcxx_override;
135# endif
110136
111137_LIBCPP_BEGIN_NAMESPACE_STD
112138template <typename T, T* _Func>
......@@ -115,20 +141,24 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_function_overridden() noexcept {
115141 uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override);
116142 uintptr_t __ptr = reinterpret_cast<uintptr_t>(_Func);
117143
118# if __has_feature(ptrauth_calls)
119 // We must pass a void* to ptrauth_strip since it only accepts a pointer type. See full explanation above.
144 // We must pass a void* to ptrauth_strip since it only accepts a pointer type. Also, in particular,
145 // we must NOT pass a function pointer, otherwise we will strip the function pointer, and then attempt
146 // to authenticate and re-sign it when casting it to a uintptr_t again, which will fail because we just
147 // stripped the function pointer. See rdar://122927845.
120148 __ptr = reinterpret_cast<uintptr_t>(ptrauth_strip(reinterpret_cast<void*>(__ptr), ptrauth_key_function_pointer));
121# endif
122149
150 // Finally, the function was overridden if it falls outside of the section's bounds.
123151 return __ptr < __start || __ptr > __end;
124152}
125153_LIBCPP_END_NAMESPACE_STD
126154
127#else
155# endif // __has_feature(ptrauth_calls)
156
157#else // defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__))
128158
129159# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0
130# define OVERRIDABLE_FUNCTION _LIBCPP_WEAK
160# define OVERRIDABLE_FUNCTION [[gnu::weak]]
131161
132#endif
162#endif // defined(_LIBCPP_OBJECT_FORMAT_MACHO) || (defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__))
133163
134164#endif // _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H
lib/libcxx/src/include/refstring.h+1-1
......@@ -15,7 +15,7 @@
1515#include <cstring>
1616#include <stdexcept>
1717
18// MacOS and iOS used to ship with libstdc++, and still support old applications
18// macOS and iOS used to ship with libstdc++, and still support old applications
1919// linking against libstdc++. The libc++ and libstdc++ exceptions are supposed
2020// to be ABI compatible, such that they can be thrown from one library and caught
2121// in the other.
lib/libcxx/src/include/ryu/ryu.h-18
......@@ -67,24 +67,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
6767
6868// https://github.com/ulfjack/ryu/tree/59661c3/ryu
6969
70#if !defined(_MSC_VER)
71_LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward64(unsigned long* __index, unsigned long long __mask) {
72 if (__mask == 0) {
73 return false;
74 }
75 *__index = __builtin_ctzll(__mask);
76 return true;
77}
78
79_LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward(unsigned long* __index, unsigned int __mask) {
80 if (__mask == 0) {
81 return false;
82 }
83 *__index = __builtin_ctz(__mask);
84 return true;
85}
86#endif // !_MSC_VER
87
8870template <class _Floating>
8971[[nodiscard]] to_chars_result _Floating_to_chars_ryu(
9072 char* const _First, char* const _Last, const _Floating _Value, const chars_format _Fmt) noexcept {
lib/libcxx/src/include/to_chars_floating_point.h+1-1
......@@ -38,7 +38,7 @@ namespace __itoa {
3838inline constexpr char _Charconv_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e',
3939 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
4040static_assert(std::size(_Charconv_digits) == 36);
41} // __itoa
41} // namespace __itoa
4242
4343// vvvvvvvvvv DERIVED FROM corecrt_internal_fltintrn.h vvvvvvvvvv
4444
lib/libcxx/src/ios.cpp+38-39
......@@ -9,6 +9,7 @@
99#include <__config>
1010#include <__locale>
1111#include <algorithm>
12#include <atomic>
1213#include <ios>
1314#include <limits>
1415#include <memory>
......@@ -22,6 +23,7 @@ _LIBCPP_PUSH_MACROS
2223#include <__undef_macros>
2324
2425_LIBCPP_BEGIN_NAMESPACE_STD
26_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2527
2628class _LIBCPP_HIDDEN __iostream_category : public __do_message {
2729public:
......@@ -102,25 +104,13 @@ void ios_base::__call_callbacks(event ev) {
102104// locale
103105
104106locale ios_base::imbue(const locale& newloc) {
105 static_assert(sizeof(locale) == sizeof(__loc_), "");
106 locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
107 locale oldloc = loc_storage;
108 loc_storage = newloc;
107 locale loc = newloc;
108 std::swap(__loc_, loc);
109109 __call_callbacks(imbue_event);
110 return oldloc;
110 return loc;
111111}
112112
113locale ios_base::getloc() const {
114 const locale& loc_storage = *reinterpret_cast<const locale*>(&__loc_);
115 return loc_storage;
116}
117
118// xalloc
119#if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
120atomic<int> ios_base::__xindex_{0};
121#else
122int ios_base::__xindex_ = 0;
123#endif
113locale ios_base::getloc() const { return __loc_; }
124114
125115template <typename _Tp>
126116static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precondition: __req_size > __current_cap
......@@ -131,7 +121,17 @@ static size_t __ios_new_cap(size_t __req_size, size_t __current_cap) { // Precon
131121 return mx;
132122}
133123
134int ios_base::xalloc() { return __xindex_++; }
124int ios_base::xalloc() {
125#if _LIBCPP_HAS_THREADS
126 constinit static atomic<int> xindex = 0;
127#else
128 // If we don't have atomics, fall back to single-threaded implementation.
129 // FIXME: Should "single-threaded" be a separate option from
130 // _LIBCPP_HAS_THREADS?
131 static int xindex = 0;
132#endif // _LIBCPP_HAS_THREADS
133 return xindex++;
134}
135135
136136long& ios_base::iword(int index) {
137137 size_t req_size = static_cast<size_t>(index) + 1;
......@@ -180,12 +180,16 @@ void ios_base::register_callback(event_callback fn, int index) {
180180 if (req_size > __event_cap_) {
181181 size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_);
182182 event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback)));
183 if (fns == 0)
183 if (fns == 0) {
184184 setstate(badbit);
185 return;
186 }
185187 __fn_ = fns;
186188 int* indxs = static_cast<int*>(realloc(__index_, newcap * sizeof(int)));
187 if (indxs == 0)
189 if (indxs == 0) {
188190 setstate(badbit);
191 return;
192 }
189193 __index_ = indxs;
190194 __event_cap_ = newcap;
191195 }
......@@ -197,11 +201,10 @@ void ios_base::register_callback(event_callback fn, int index) {
197201ios_base::~ios_base() {
198202 // Avoid UB when not properly initialized. See ios_base::ios_base for
199203 // more information.
200 if (!__loc_)
204 if (!__loc_.__locale_)
201205 return;
202206 __call_callbacks(erase_event);
203 locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
204 loc_storage.~locale();
207 __loc_.~locale();
205208 free(__fn_);
206209 free(__index_);
207210 free(__iarray_);
......@@ -273,12 +276,10 @@ void ios_base::copyfmt(const ios_base& rhs) {
273276 std::__throw_bad_alloc();
274277 }
275278 // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
276 __fmtflags_ = rhs.__fmtflags_;
277 __precision_ = rhs.__precision_;
278 __width_ = rhs.__width_;
279 locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
280 const locale& rhs_loc = *reinterpret_cast<const locale*>(&rhs.__loc_);
281 lhs_loc = rhs_loc;
279 __fmtflags_ = rhs.__fmtflags_;
280 __precision_ = rhs.__precision_;
281 __width_ = rhs.__width_;
282 __loc_ = rhs.__loc_;
282283 if (__event_cap_ < rhs.__event_size_) {
283284 free(__fn_);
284285 __fn_ = new_callbacks.release();
......@@ -308,14 +309,13 @@ void ios_base::copyfmt(const ios_base& rhs) {
308309
309310void ios_base::move(ios_base& rhs) {
310311 // *this is uninitialized
311 __fmtflags_ = rhs.__fmtflags_;
312 __precision_ = rhs.__precision_;
313 __width_ = rhs.__width_;
314 __rdstate_ = rhs.__rdstate_;
315 __exceptions_ = rhs.__exceptions_;
316 __rdbuf_ = 0;
317 locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
318 ::new (&__loc_) locale(rhs_loc);
312 __fmtflags_ = rhs.__fmtflags_;
313 __precision_ = rhs.__precision_;
314 __width_ = rhs.__width_;
315 __rdstate_ = rhs.__rdstate_;
316 __exceptions_ = rhs.__exceptions_;
317 __rdbuf_ = 0;
318 ::new (&__loc_) locale(rhs.__loc_);
319319 __fn_ = rhs.__fn_;
320320 rhs.__fn_ = 0;
321321 __index_ = rhs.__index_;
......@@ -344,9 +344,7 @@ void ios_base::swap(ios_base& rhs) noexcept {
344344 std::swap(__width_, rhs.__width_);
345345 std::swap(__rdstate_, rhs.__rdstate_);
346346 std::swap(__exceptions_, rhs.__exceptions_);
347 locale& lhs_loc = *reinterpret_cast<locale*>(&__loc_);
348 locale& rhs_loc = *reinterpret_cast<locale*>(&rhs.__loc_);
349 std::swap(lhs_loc, rhs_loc);
347 std::swap(__loc_, rhs.__loc_);
350348 std::swap(__fn_, rhs.__fn_);
351349 std::swap(__index_, rhs.__index_);
352350 std::swap(__event_size_, rhs.__event_size_);
......@@ -382,6 +380,7 @@ bool ios_base::sync_with_stdio(bool sync) {
382380 return r;
383381}
384382
383_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
385384_LIBCPP_END_NAMESPACE_STD
386385
387386_LIBCPP_POP_MACROS
lib/libcxx/src/ios.instantiations.cpp+21
......@@ -15,6 +15,26 @@
1515#include <streambuf>
1616
1717_LIBCPP_BEGIN_NAMESPACE_STD
18_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
19
20#if _LIBCPP_HAS_FILESYSTEM
21// This is provided for ABI compatiblity with programs compiled against old headers.
22// TODO: Is this actually required? If so, this should be guarded with
23// `_LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 24`. Otherwise this should be removed.
24template <class _CharT, class _Traits>
25bool basic_filebuf<_CharT, _Traits>::__read_mode() {
26 if (!(__cm_ & ios_base::in)) {
27 this->setp(nullptr, nullptr);
28 if (__always_noconv_)
29 this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_);
30 else
31 this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_);
32 __cm_ = ios_base::in;
33 return true;
34 }
35 return false;
36}
37#endif
1838
1939// Original explicit instantiations provided in the library
2040template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
......@@ -45,4 +65,5 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>;
4565
4666// Add more here if needed...
4767
68_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4869_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/iostream.cpp+2
......@@ -15,6 +15,7 @@
1515#define ABI_NAMESPACE_STR _LIBCPP_TOSTRING(_LIBCPP_ABI_NAMESPACE)
1616
1717_LIBCPP_BEGIN_NAMESPACE_STD
18_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1819
1920// This file implements the various stream objects provided inside <iostream>. We're doing some ODR violations in here,
2021// so this quite fragile. Specifically, the size of the stream objects (i.e. cout, cin etc.) needs to stay the same.
......@@ -154,4 +155,5 @@ ios_base::Init::Init() {
154155
155156ios_base::Init::~Init() {}
156157
158_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
157159_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/locale.cpp+22-18
......@@ -45,6 +45,7 @@ _LIBCPP_PUSH_MACROS
4545#include <__undef_macros>
4646
4747_LIBCPP_BEGIN_NAMESPACE_STD
48_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
4849
4950struct __libcpp_unique_locale {
5051 __libcpp_unique_locale(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {}
......@@ -158,11 +159,11 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") {
158159 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
159160 install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
160161 install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
161 _LIBCPP_SUPPRESS_DEPRECATED_POP
162162#if _LIBCPP_HAS_CHAR8_T
163163 install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u));
164164 install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
165165#endif
166 _LIBCPP_SUPPRESS_DEPRECATED_POP
166167 install(&make<numpunct<char> >(1u));
167168#if _LIBCPP_HAS_WIDE_CHARACTERS
168169 install(&make<numpunct<wchar_t> >(1u));
......@@ -228,11 +229,11 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N),
228229 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
229230 install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
230231 install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
231 _LIBCPP_SUPPRESS_DEPRECATED_POP
232232#if _LIBCPP_HAS_CHAR8_T
233233 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
234234 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
235235#endif
236 _LIBCPP_SUPPRESS_DEPRECATED_POP
236237 install(new numpunct_byname<char>(name_));
237238#if _LIBCPP_HAS_WIDE_CHARACTERS
238239 install(new numpunct_byname<wchar_t>(name_));
......@@ -294,11 +295,11 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
294295 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
295296 install(new codecvt_byname<char16_t, char, mbstate_t>(name));
296297 install(new codecvt_byname<char32_t, char, mbstate_t>(name));
297 _LIBCPP_SUPPRESS_DEPRECATED_POP
298298#if _LIBCPP_HAS_CHAR8_T
299299 install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
300300 install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
301301#endif
302 _LIBCPP_SUPPRESS_DEPRECATED_POP
302303 }
303304 if (c & locale::monetary) {
304305 install(new moneypunct_byname<char, false>(name));
......@@ -366,11 +367,11 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
366367 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
367368 install_from<std::codecvt<char16_t, char, mbstate_t> >(one);
368369 install_from<std::codecvt<char32_t, char, mbstate_t> >(one);
369 _LIBCPP_SUPPRESS_DEPRECATED_POP
370370#if _LIBCPP_HAS_CHAR8_T
371371 install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one);
372372 install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one);
373373#endif
374 _LIBCPP_SUPPRESS_DEPRECATED_POP
374375#if _LIBCPP_HAS_WIDE_CHARACTERS
375376 install_from<std::codecvt<wchar_t, char, mbstate_t> >(one);
376377#endif
......@@ -2318,7 +2319,7 @@ static codecvt_base::result utf16be_to_ucs4(
23182319 frm_nxt += 2;
23192320 }
23202321 for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
2321 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
2322 uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]);
23222323 if ((c1 & 0xFC00) == 0xDC00)
23232324 return codecvt_base::error;
23242325 if ((c1 & 0xFC00) != 0xD800) {
......@@ -2329,7 +2330,7 @@ static codecvt_base::result utf16be_to_ucs4(
23292330 } else {
23302331 if (frm_end - frm_nxt < 4)
23312332 return codecvt_base::partial;
2332 uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
2333 uint16_t c2 = static_cast<uint16_t>((frm_nxt[2] << 8) | frm_nxt[3]);
23332334 if ((c2 & 0xFC00) != 0xDC00)
23342335 return codecvt_base::error;
23352336 uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
......@@ -2354,7 +2355,7 @@ static int utf16be_to_ucs4_length(
23542355 frm_nxt += 2;
23552356 }
23562357 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) {
2357 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
2358 uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]);
23582359 if ((c1 & 0xFC00) == 0xDC00)
23592360 break;
23602361 if ((c1 & 0xFC00) != 0xD800) {
......@@ -2364,7 +2365,7 @@ static int utf16be_to_ucs4_length(
23642365 } else {
23652366 if (frm_end - frm_nxt < 4)
23662367 break;
2367 uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
2368 uint16_t c2 = static_cast<uint16_t>((frm_nxt[2] << 8) | frm_nxt[3]);
23682369 if ((c2 & 0xFC00) != 0xDC00)
23692370 break;
23702371 uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
......@@ -2432,7 +2433,7 @@ static codecvt_base::result utf16le_to_ucs4(
24322433 frm_nxt += 2;
24332434 }
24342435 for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
2435 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
2436 uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]);
24362437 if ((c1 & 0xFC00) == 0xDC00)
24372438 return codecvt_base::error;
24382439 if ((c1 & 0xFC00) != 0xD800) {
......@@ -2443,7 +2444,7 @@ static codecvt_base::result utf16le_to_ucs4(
24432444 } else {
24442445 if (frm_end - frm_nxt < 4)
24452446 return codecvt_base::partial;
2446 uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
2447 uint16_t c2 = static_cast<uint16_t>((frm_nxt[3] << 8) | frm_nxt[2]);
24472448 if ((c2 & 0xFC00) != 0xDC00)
24482449 return codecvt_base::error;
24492450 uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
......@@ -2468,7 +2469,7 @@ static int utf16le_to_ucs4_length(
24682469 frm_nxt += 2;
24692470 }
24702471 for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) {
2471 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
2472 uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]);
24722473 if ((c1 & 0xFC00) == 0xDC00)
24732474 break;
24742475 if ((c1 & 0xFC00) != 0xD800) {
......@@ -2478,7 +2479,7 @@ static int utf16le_to_ucs4_length(
24782479 } else {
24792480 if (frm_end - frm_nxt < 4)
24802481 break;
2481 uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
2482 uint16_t c2 = static_cast<uint16_t>((frm_nxt[3] << 8) | frm_nxt[2]);
24822483 if ((c2 & 0xFC00) != 0xDC00)
24832484 break;
24842485 uint32_t t = static_cast<uint32_t>(((((c1 & 0x03C0) >> 6) + 1) << 16) | ((c1 & 0x003F) << 10) | (c2 & 0x03FF));
......@@ -2535,7 +2536,7 @@ static codecvt_base::result utf16be_to_ucs2(
25352536 frm_nxt += 2;
25362537 }
25372538 for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
2538 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
2539 uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]);
25392540 if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
25402541 return codecvt_base::error;
25412542 *to_nxt = c1;
......@@ -2556,7 +2557,7 @@ static int utf16be_to_ucs2_length(
25562557 frm_nxt += 2;
25572558 }
25582559 for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) {
2559 uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
2560 uint16_t c1 = static_cast<uint16_t>((frm_nxt[0] << 8) | frm_nxt[1]);
25602561 if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
25612562 break;
25622563 frm_nxt += 2;
......@@ -2609,7 +2610,7 @@ static codecvt_base::result utf16le_to_ucs2(
26092610 frm_nxt += 2;
26102611 }
26112612 for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) {
2612 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
2613 uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]);
26132614 if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
26142615 return codecvt_base::error;
26152616 *to_nxt = c1;
......@@ -2631,7 +2632,7 @@ static int utf16le_to_ucs2_length(
26312632 frm_nxt += 2;
26322633 }
26332634 for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) {
2634 uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
2635 uint16_t c1 = static_cast<uint16_t>((frm_nxt[1] << 8) | frm_nxt[0]);
26352636 if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
26362637 break;
26372638 frm_nxt += 2;
......@@ -5651,10 +5652,13 @@ template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_
56515652template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
56525653 codecvt_byname<char32_t, char, mbstate_t>;
56535654#if _LIBCPP_HAS_CHAR8_T
5654template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>;
5655template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>;
5655template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
5656 codecvt_byname<char16_t, char8_t, mbstate_t>;
5657template class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
5658 codecvt_byname<char32_t, char8_t, mbstate_t>;
56565659#endif
56575660
5661_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
56585662_LIBCPP_END_NAMESPACE_STD
56595663
56605664_LIBCPP_POP_MACROS
lib/libcxx/src/memory.cpp+3-2
......@@ -7,8 +7,7 @@
77//===----------------------------------------------------------------------===//
88
99#include <__config>
10#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && !defined(_LIBCPP_OBJECT_FORMAT_XCOFF) && \
11 _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 5
10#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 5
1211# define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
1312#endif
1413
......@@ -27,6 +26,7 @@
2726#include "include/atomic_support.h"
2827
2928_LIBCPP_BEGIN_NAMESPACE_STD
29_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3030
3131bad_weak_ptr::~bad_weak_ptr() noexcept {}
3232
......@@ -145,4 +145,5 @@ _LIBCPP_DIAGNOSTIC_POP
145145
146146#endif
147147
148_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
148149_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/memory_resource.cpp+3-34
......@@ -6,20 +6,13 @@
66//
77//===----------------------------------------------------------------------===//
88
9#include <atomic>
910#include <cstddef>
1011#include <memory>
1112#include <memory_resource>
1213
13#if _LIBCPP_HAS_ATOMIC_HEADER
14# include <atomic>
15#elif _LIBCPP_HAS_THREADS
16# include <mutex>
17# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
18# pragma comment(lib, "pthread")
19# endif
20#endif
21
2214_LIBCPP_BEGIN_NAMESPACE_STD
15_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2316
2417namespace pmr {
2518
......@@ -94,7 +87,6 @@ memory_resource* null_memory_resource() noexcept { return &res_init.resources.nu
9487// default_memory_resource()
9588
9689static memory_resource* __default_memory_resource(bool set = false, memory_resource* new_res = nullptr) noexcept {
97#if _LIBCPP_HAS_ATOMIC_HEADER
9890 static constinit atomic<memory_resource*> __res{&res_init.resources.new_delete_res};
9991 if (set) {
10092 new_res = new_res ? new_res : new_delete_resource();
......@@ -103,30 +95,6 @@ static memory_resource* __default_memory_resource(bool set = false, memory_resou
10395 } else {
10496 return std::atomic_load_explicit(&__res, memory_order_acquire);
10597 }
106#elif _LIBCPP_HAS_THREADS
107 static constinit memory_resource* res = &res_init.resources.new_delete_res;
108 static mutex res_lock;
109 if (set) {
110 new_res = new_res ? new_res : new_delete_resource();
111 lock_guard<mutex> guard(res_lock);
112 memory_resource* old_res = res;
113 res = new_res;
114 return old_res;
115 } else {
116 lock_guard<mutex> guard(res_lock);
117 return res;
118 }
119#else
120 static constinit memory_resource* res = &res_init.resources.new_delete_res;
121 if (set) {
122 new_res = new_res ? new_res : new_delete_resource();
123 memory_resource* old_res = res;
124 res = new_res;
125 return old_res;
126 } else {
127 return res;
128 }
129#endif
13098}
13199
132100memory_resource* get_default_resource() noexcept { return __default_memory_resource(); }
......@@ -497,4 +465,5 @@ void* monotonic_buffer_resource::do_allocate(size_t bytes, size_t align) {
497465
498466} // namespace pmr
499467
468_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
500469_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/mutex.cpp+2
......@@ -23,6 +23,7 @@ _LIBCPP_PUSH_MACROS
2323#include <__undef_macros>
2424
2525_LIBCPP_BEGIN_NAMESPACE_STD
26_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2627
2728// ~mutex is defined elsewhere
2829
......@@ -141,6 +142,7 @@ void recursive_timed_mutex::unlock() noexcept {
141142 }
142143}
143144
145_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
144146_LIBCPP_END_NAMESPACE_STD
145147
146148_LIBCPP_POP_MACROS
lib/libcxx/src/mutex_destructor.cpp+2
......@@ -24,6 +24,7 @@
2424#endif
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728
2829#ifdef NEEDS_MUTEX_DESTRUCTOR
2930class _LIBCPP_EXPORTED_FROM_ABI mutex {
......@@ -39,4 +40,5 @@ public:
3940mutex::~mutex() noexcept { __libcpp_mutex_destroy(&__m_); }
4041#endif // !NEEDS_MUTEX_DESTRUCTOR
4142
43_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4244_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/new.cpp+16-16
......@@ -50,7 +50,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
5050 return p;
5151}
5252
53_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
53[[gnu::weak]] void* operator new(size_t size, const std::nothrow_t&) noexcept {
5454# if !_LIBCPP_HAS_EXCEPTIONS
5555# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
5656 _LIBCPP_ASSERT_SHIM(
......@@ -76,7 +76,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
7676
7777OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
7878
79_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
79[[gnu::weak]] void* operator new[](size_t size, const std::nothrow_t&) noexcept {
8080# if !_LIBCPP_HAS_EXCEPTIONS
8181# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
8282 _LIBCPP_ASSERT_SHIM(
......@@ -100,17 +100,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
100100# endif
101101}
102102
103_LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); }
103[[gnu::weak]] void operator delete(void* ptr) noexcept { std::free(ptr); }
104104
105_LIBCPP_WEAK void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }
105[[gnu::weak]] void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }
106106
107_LIBCPP_WEAK void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }
107[[gnu::weak]] void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }
108108
109_LIBCPP_WEAK void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }
109[[gnu::weak]] void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }
110110
111_LIBCPP_WEAK void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }
111[[gnu::weak]] void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }
112112
113_LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
113[[gnu::weak]] void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
114114
115115# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
116116
......@@ -141,7 +141,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align
141141 return p;
142142}
143143
144_LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
144[[gnu::weak]] void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
145145# if !_LIBCPP_HAS_EXCEPTIONS
146146# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
147147 _LIBCPP_ASSERT_SHIM(
......@@ -169,7 +169,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
169169 return ::operator new(size, alignment);
170170}
171171
172_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
172[[gnu::weak]] void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
173173# if !_LIBCPP_HAS_EXCEPTIONS
174174# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
175175 _LIBCPP_ASSERT_SHIM(
......@@ -193,25 +193,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const
193193# endif
194194}
195195
196_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
196[[gnu::weak]] void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
197197
198_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
198[[gnu::weak]] void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
199199 ::operator delete(ptr, alignment);
200200}
201201
202_LIBCPP_WEAK void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {
202[[gnu::weak]] void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {
203203 ::operator delete(ptr, alignment);
204204}
205205
206_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment) noexcept {
206[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment) noexcept {
207207 ::operator delete(ptr, alignment);
208208}
209209
210_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
210[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
211211 ::operator delete[](ptr, alignment);
212212}
213213
214_LIBCPP_WEAK void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
214[[gnu::weak]] void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
215215 ::operator delete[](ptr, alignment);
216216}
217217
lib/libcxx/src/optional.cpp+2
......@@ -24,6 +24,7 @@ const char* bad_optional_access::what() const noexcept { return "bad_optional_ac
2424// Preserve std::experimental::bad_optional_access for ABI compatibility
2525// Even though it no longer exists in a header file
2626_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728
2829class _LIBCPP_EXPORTED_FROM_ABI bad_optional_access : public std::logic_error {
2930public:
......@@ -35,6 +36,7 @@ public:
3536
3637bad_optional_access::~bad_optional_access() noexcept = default;
3738
39_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3840_LIBCPP_END_NAMESPACE_EXPERIMENTAL
3941
4042#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 7
lib/libcxx/src/ostream.cpp+2
......@@ -15,6 +15,7 @@
1515#include "std_stream.h"
1616
1717_LIBCPP_BEGIN_NAMESPACE_STD
18_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1819
1920_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
2021 // dynamic_cast requires RTTI, this only affects users whose vendor builds
......@@ -38,4 +39,5 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
3839 return nullptr;
3940}
4041
42_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4143_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/print.cpp+6-1
......@@ -33,6 +33,7 @@
3333#endif
3434
3535_LIBCPP_BEGIN_NAMESPACE_STD
36_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3637
3738#if defined(_LIBCPP_WIN32API)
3839
......@@ -64,9 +65,13 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst
6465}
6566# endif // _LIBCPP_HAS_WIDE_CHARACTERS
6667
67#elif defined(HAS_FILENO_AND_ISATTY) // !_LIBCPP_WIN32API
68#elif defined(HAS_FILENO_AND_ISATTY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 23 // !_LIBCPP_WIN32API
6869
70_LIBCPP_DIAGNOSTIC_PUSH
71_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-prototypes")
6972_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); }
73_LIBCPP_DIAGNOSTIC_POP
7074#endif
7175
76_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
7277_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/pstl/libdispatch.cpp+2
......@@ -12,6 +12,7 @@
1212#include <dispatch/dispatch.h>
1313
1414_LIBCPP_BEGIN_NAMESPACE_STD
15_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1516namespace __pstl::__libdispatch {
1617
1718void __dispatch_apply(size_t chunk_count, void* context, void (*func)(void* context, size_t chunk)) noexcept {
......@@ -29,4 +30,5 @@ __chunk_partitions __partition_chunks(ptrdiff_t element_count) noexcept {
2930}
3031
3132} // namespace __pstl::__libdispatch
33_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3234_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/random.cpp+2
......@@ -36,6 +36,7 @@
3636#endif
3737
3838_LIBCPP_BEGIN_NAMESPACE_STD
39_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3940
4041#if defined(_LIBCPP_USING_GETENTROPY)
4142
......@@ -153,4 +154,5 @@ double random_device::entropy() const noexcept {
153154#endif
154155}
155156
157_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
156158_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/random_shuffle.cpp+2
......@@ -17,6 +17,7 @@
1717#endif
1818
1919_LIBCPP_BEGIN_NAMESPACE_STD
20_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2021
2122#if _LIBCPP_HAS_THREADS
2223static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER;
......@@ -48,4 +49,5 @@ __rs_default::result_type __rs_default::operator()() {
4849
4950__rs_default __rs_get() { return __rs_default(); }
5051
52_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
5153_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/regex.cpp+2
......@@ -11,6 +11,7 @@
1111#include <regex>
1212
1313_LIBCPP_BEGIN_NAMESPACE_STD
14_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1415
1516static const char* make_error_type_string(regex_constants::error_type ecode) {
1617 switch (ecode) {
......@@ -396,4 +397,5 @@ void __match_any_but_newline<wchar_t>::__exec(__state& __s) const {
396397 }
397398}
398399
400_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
399401_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/ryu/d2s.cpp+2-13
......@@ -41,6 +41,7 @@
4141
4242#include <__assert>
4343#include <__config>
44#include <bit>
4445#include <charconv>
4546#include <cstddef>
4647
......@@ -478,19 +479,7 @@ struct __floating_decimal_64 {
478479 2882303761517u, 576460752303u, 115292150460u, 23058430092u, 4611686018u, 922337203u, 184467440u,
479480 36893488u, 7378697u, 1475739u, 295147u, 59029u, 11805u, 2361u, 472u, 94u, 18u, 3u };
480481
481 unsigned long _Trailing_zero_bits;
482#if _LIBCPP_HAS_BITSCAN64
483 (void) _BitScanForward64(&_Trailing_zero_bits, __v.__mantissa); // __v.__mantissa is guaranteed nonzero
484#else // ^^^ 64-bit ^^^ / vvv 32-bit vvv
485 const uint32_t _Low_mantissa = static_cast<uint32_t>(__v.__mantissa);
486 if (_Low_mantissa != 0) {
487 (void) _BitScanForward(&_Trailing_zero_bits, _Low_mantissa);
488 } else {
489 const uint32_t _High_mantissa = static_cast<uint32_t>(__v.__mantissa >> 32); // nonzero here
490 (void) _BitScanForward(&_Trailing_zero_bits, _High_mantissa);
491 _Trailing_zero_bits += 32;
492 }
493#endif // ^^^ 32-bit ^^^
482 unsigned long _Trailing_zero_bits = std::countr_zero(__v.__mantissa);
494483 const uint64_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits;
495484 _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent];
496485 }
lib/libcxx/src/ryu/f2s.cpp+2-2
......@@ -41,6 +41,7 @@
4141
4242#include <__assert>
4343#include <__config>
44#include <bit>
4445#include <charconv>
4546#include <cstdint>
4647#include <cstddef>
......@@ -535,8 +536,7 @@ struct __floating_decimal_32 {
535536 static constexpr uint32_t _Max_shifted_mantissa[11] = {
536537 16777215, 3355443, 671088, 134217, 26843, 5368, 1073, 214, 42, 8, 1 };
537538
538 unsigned long _Trailing_zero_bits;
539 (void) _BitScanForward(&_Trailing_zero_bits, __v.__mantissa); // __v.__mantissa is guaranteed nonzero
539 unsigned long _Trailing_zero_bits = std::countr_zero(__v.__mantissa); // __v.__mantissa is guaranteed nonzero
540540 const uint32_t _Shifted_mantissa = __v.__mantissa >> _Trailing_zero_bits;
541541 _Can_use_ryu = _Shifted_mantissa <= _Max_shifted_mantissa[_Ryu_exponent];
542542 }
lib/libcxx/src/shared_mutex.cpp+2
......@@ -13,6 +13,7 @@
1313#endif
1414
1515_LIBCPP_BEGIN_NAMESPACE_STD
16_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1617
1718// Shared Mutex Base
1819__shared_mutex_base::__shared_mutex_base() : __state_(0) {}
......@@ -96,4 +97,5 @@ void shared_timed_mutex::lock_shared() { return __base_.lock_shared(); }
9697bool shared_timed_mutex::try_lock_shared() { return __base_.try_lock_shared(); }
9798void shared_timed_mutex::unlock_shared() { return __base_.unlock_shared(); }
9899
100_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
99101_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/std_stream.h+2
......@@ -24,6 +24,7 @@ _LIBCPP_PUSH_MACROS
2424#include <__undef_macros>
2525
2626_LIBCPP_BEGIN_NAMESPACE_STD
27_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2728
2829static const int __limit = 8;
2930
......@@ -380,6 +381,7 @@ void __stdoutbuf<_CharT>::imbue(const locale& __loc) {
380381 __always_noconv_ = __cv_->always_noconv();
381382}
382383
384_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
383385_LIBCPP_END_NAMESPACE_STD
384386
385387_LIBCPP_POP_MACROS
lib/libcxx/src/stdexcept.cpp+2
......@@ -18,6 +18,7 @@
1818#endif
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
21_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2122
2223void __throw_runtime_error(const char* msg) {
2324#if _LIBCPP_HAS_EXCEPTIONS
......@@ -27,4 +28,5 @@ void __throw_runtime_error(const char* msg) {
2728#endif
2829}
2930
31_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3032_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/string.cpp+2
......@@ -19,6 +19,7 @@
1919#endif
2020
2121_LIBCPP_BEGIN_NAMESPACE_STD
22_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2223
2324#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 14
2425
......@@ -367,4 +368,5 @@ wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string
367368wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }
368369#endif
369370
371_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
370372_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/strstream.cpp+2
......@@ -18,6 +18,7 @@ _LIBCPP_PUSH_MACROS
1818#include <__undef_macros>
1919
2020_LIBCPP_BEGIN_NAMESPACE_STD
21_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2122
2223strstreambuf::strstreambuf(streamsize __alsize)
2324 : __strmode_(__dynamic), __alsize_(__alsize), __palloc_(nullptr), __pfree_(nullptr) {}
......@@ -253,6 +254,7 @@ ostrstream::~ostrstream() {}
253254
254255strstream::~strstream() {}
255256
257_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
256258_LIBCPP_END_NAMESPACE_STD
257259
258260_LIBCPP_POP_MACROS
lib/libcxx/src/support/runtime/exception_pointer_msvc.ipp+425-34
......@@ -7,62 +7,453 @@
77//
88//===----------------------------------------------------------------------===//
99
10#include <exception>
11#include <stdio.h>
12#include <stdlib.h>
13
14_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCreate(void*);
15_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrDestroy(void*);
16_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopy(void*, const void*);
17_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrAssign(void*, const void*);
18_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrCompare(const void*, const void*);
19_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrToBool(const void*);
20_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrSwap(void*, void*);
21_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCurrentException(void*);
22[[noreturn]] _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrRethrow(const void*);
23_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopyException(void*, const void*, const void*);
10_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmultichar")
2411
25namespace std {
12#include <__exception/exception_ptr.h>
13#include <__memory/shared_count.h>
14#include <cstdlib>
15#include <cstring>
2616
27exception_ptr::exception_ptr() noexcept { __ExceptionPtrCreate(this); }
28exception_ptr::exception_ptr(nullptr_t) noexcept { __ExceptionPtrCreate(this); }
17#include <unknwn.h>
18#include <windows.h>
19struct _ThrowInfo;
20#include <eh.h>
21#include <ehdata.h>
22#include <malloc.h> // alloca
2923
30exception_ptr::exception_ptr(const exception_ptr& __other) noexcept { __ExceptionPtrCopy(this, &__other); }
31exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept {
32 __ExceptionPtrAssign(this, &__other);
33 return *this;
24// Pre-V4 managed exception code
25#define MANAGED_EXCEPTION_CODE 0XE0434F4D
26
27// V4 and later managed exception code
28#define MANAGED_EXCEPTION_CODE_V4 0XE0434352
29
30extern "C" _LIBCPP_CRT_FUNC void* __cdecl __AdjustPointer(void*, const PMD&);
31extern "C" _LIBCPP_CRT_FUNC void** __cdecl __current_exception();
32
33namespace {
34
35typedef void(__stdcall* __prepare_for_throw_t)(void*);
36
37struct __winrt_exception_info {
38 void* __description;
39 void* __restricted_error_string;
40 void* __restricted_error_reference;
41 void* __capability_sid;
42 long __hr;
43 void* __restricted_info;
44 ThrowInfo* __throw_info;
45 unsigned int __size;
46 __prepare_for_throw_t __prepare_throw;
47};
48
49inline EHExceptionRecord* __get_current_exception() noexcept {
50 return *reinterpret_cast<EHExceptionRecord**>(__current_exception());
3451}
3552
36exception_ptr& exception_ptr::operator=(nullptr_t) noexcept {
37 exception_ptr dummy;
38 __ExceptionPtrAssign(this, &dummy);
39 return *this;
53inline void __call_member_function_0(void* __this, void* __mfn) {
54 auto __fn = reinterpret_cast<void(__thiscall*)(void*)>(__mfn);
55 __fn(__this);
56}
57
58inline void __call_member_function_1(void* __this, void* __mfn, void* __arg) {
59 auto __fn = reinterpret_cast<void(__thiscall*)(void*, void*)>(__mfn);
60 __fn(__this, __arg);
61}
62
63inline void __call_member_function_2(void* __this, void* __mfn, void* __arg1, int __arg2) {
64 auto __fn = reinterpret_cast<void(__thiscall*)(void*, void*, int)>(__mfn);
65 __fn(__this, __arg1, __arg2);
4066}
4167
42exception_ptr::~exception_ptr() noexcept { __ExceptionPtrDestroy(this); }
68void __populate_cpp_exception_record(
69 _EXCEPTION_RECORD& __record, const void* const __except_obj, ThrowInfo* __throw_info) noexcept {
70 __record.ExceptionCode = EH_EXCEPTION_NUMBER;
71 __record.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
72 __record.ExceptionRecord = nullptr; // No SEH to chain.
73 __record.ExceptionAddress = nullptr; // Address of exception. This will be overwritten by OS.
74 __record.NumberParameters = EH_EXCEPTION_PARAMETERS;
75 __record.ExceptionInformation[0] = EH_MAGIC_NUMBER1;
76 __record.ExceptionInformation[1] = reinterpret_cast<ULONG_PTR>(__except_obj);
77
78 if (__throw_info && (__throw_info->attributes & TI_IsWinRT)) {
79 // The pointer to the ExceptionInfo structure is stored sizeof(void*) in front of each WinRT Exception Info.
80 const auto __wei = (*static_cast<__winrt_exception_info** const*>(const_cast<void*>(__except_obj)))[-1];
81 __throw_info = __wei->__throw_info;
82 }
83
84 __record.ExceptionInformation[2] = reinterpret_cast<ULONG_PTR>(__throw_info);
85
86#if _EH_RELATIVE_TYPEINFO
87 void* __throw_image_base =
88 __throw_info ? RtlPcToFileHeader(const_cast<void*>(static_cast<const void*>(__throw_info)), &__throw_image_base)
89 : nullptr;
90 __record.ExceptionInformation[3] = reinterpret_cast<ULONG_PTR>(__throw_image_base);
91#endif // _EH_RELATIVE_TYPEINFO
92
93 // If the throw info indicates this throw is from a pure region, set the magic number to the Pure one, so only a
94 // pure-region catch will see it.
95 //
96 // Also use the Pure magic number on 64-bit platforms if we were unable to determine an image base, since that was the
97 // old way to determine a pure throw, before the TI_IsPure bit was added to the FuncInfo attributes field.
98 if (__throw_info && ((__throw_info->attributes & TI_IsPure)
99#if _EH_RELATIVE_TYPEINFO
100 || !__throw_image_base
101#endif // _EH_RELATIVE_TYPEINFO
102 ))
103 __record.ExceptionInformation[0] = EH_PURE_MAGIC_NUMBER1;
104}
105
106void __copy_exception_record(_EXCEPTION_RECORD& __dest, const _EXCEPTION_RECORD& __src) noexcept {
107 __dest.ExceptionCode = __src.ExceptionCode;
108 // We force EXCEPTION_NONCONTINUABLE because rethrow_exception is [[noreturn]].
109 __dest.ExceptionFlags = __src.ExceptionFlags | EXCEPTION_NONCONTINUABLE;
110 __dest.ExceptionRecord = nullptr; // We don't chain SEH exceptions.
111 __dest.ExceptionAddress = nullptr; // Useless field to copy. It will be overwritten by RaiseException().
112 const auto __parameters = __src.NumberParameters;
113 __dest.NumberParameters = __parameters;
114
115 // Copy the number of parameters in use.
116 constexpr auto __max_parameters = static_cast<DWORD>(EXCEPTION_MAXIMUM_PARAMETERS);
117 const auto __in_use = (__parameters < __max_parameters) ? __parameters : __max_parameters;
118 std::memcpy(__dest.ExceptionInformation, __src.ExceptionInformation, __in_use * sizeof(ULONG_PTR));
119 std::memset(&__dest.ExceptionInformation[__in_use], 0, (__max_parameters - __in_use) * sizeof(ULONG_PTR));
120}
121
122void __copy_exception_object(void* __dest, const void* __src, const CatchableType* const __type
123#if _EH_RELATIVE_TYPEINFO
124 ,
125 uintptr_t __throw_image_base
126#endif // _EH_RELATIVE_TYPEINFO
127) {
128 // Copy an object of type denoted by *_PType from __src to __dDest; throws whatever the copy ctor of the type denoted
129 // by *_PType throws.
130 if ((__type->properties & CT_IsSimpleType) || __type->copyFunction == 0) {
131 std::memcpy(__dest, __src, __type->sizeOrOffset);
132
133 if (__type->properties & CT_IsWinRTHandle) {
134 const auto __unknown = *static_cast<IUnknown* const*>(const_cast<void*>(__src));
135 if (__unknown)
136 __unknown->AddRef();
137 }
138 return;
139 }
140
141#if _EH_RELATIVE_TYPEINFO
142 const auto __copy_func = reinterpret_cast<void*>(__throw_image_base + __type->copyFunction);
143#else // _EH_RELATIVE_TYPEINFO
144 const auto __copy_func = reinterpret_cast<void*>(__type->copyFunction);
145#endif // _EH_RELATIVE_TYPEINFO
146
147 const auto __adjusted = __AdjustPointer(const_cast<void*>(__src), __type->thisDisplacement);
148 if (__type->properties & CT_HasVirtualBase)
149 __call_member_function_2(__dest, __copy_func, __adjusted, 1);
150 else
151 __call_member_function_1(__dest, __copy_func, __adjusted);
152}
153
154struct __exception_ptr_storage : public std::__shared_count {
155 _EXCEPTION_RECORD __record_;
156 explicit __exception_ptr_storage(long __refs = 0) noexcept : std::__shared_count(__refs) {}
157};
158
159template <class _StaticEx>
160struct __exception_ptr_static final : public __exception_ptr_storage {
161 _StaticEx __ex_;
162
163 __exception_ptr_static() noexcept : __exception_ptr_storage(0) {
164 __populate_cpp_exception_record(__record_, &__ex_, static_cast<ThrowInfo*>(__GetExceptionInfo(__ex_)));
165 }
166
167 void __on_zero_shared() noexcept override {}
168
169 static __exception_ptr_storage* __get() noexcept {
170 struct __container {
171 union {
172 __exception_ptr_static __instance_;
173 };
174 __container() noexcept : __instance_() {}
175 ~__container() {}
176 };
177 static __container __storage;
178 return &__storage.__instance_;
179 }
180};
181
182struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) __exception_ptr_normal final : public __exception_ptr_storage {
183 explicit __exception_ptr_normal(const _EXCEPTION_RECORD& __record) noexcept : __exception_ptr_storage(0) {
184 __copy_exception_record(__record_, __record);
185 }
186
187 void __on_zero_shared() noexcept override {
188 const auto& __cpp_eh_record = reinterpret_cast<EHExceptionRecord&>(__record_);
189 if (PER_IS_MSVC_PURE_OR_NATIVE_EH(&__cpp_eh_record)) {
190 const auto* __throw_info = __cpp_eh_record.params.pThrowInfo;
191 if (__throw_info && __cpp_eh_record.params.pExceptionObject) {
192#if _EH_RELATIVE_TYPEINFO
193 const auto __throw_image_base = reinterpret_cast<uintptr_t>(__cpp_eh_record.params.pThrowImageBase);
194 const auto* __catchable_type_array = reinterpret_cast<const CatchableTypeArray*>(
195 static_cast<uintptr_t>(__throw_info->pCatchableTypeArray) + __throw_image_base);
196 const auto* __type = reinterpret_cast<CatchableType*>(
197 static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base);
198#else // _EH_RELATIVE_TYPEINFO
199 const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0];
200#endif // _EH_RELATIVE_TYPEINFO
201 if (__throw_info->pmfnUnwind) {
202 // The exception was a user defined type with a nontrivial destructor, call it.
203#if _EH_RELATIVE_TYPEINFO
204 __call_member_function_0(__cpp_eh_record.params.pExceptionObject,
205 reinterpret_cast<void*>(__throw_info->pmfnUnwind + __throw_image_base));
206#else // _EH_RELATIVE_TYPEINFO
207 __call_member_function_0(__cpp_eh_record.params.pExceptionObject,
208 reinterpret_cast<void*>(__throw_info->pmfnUnwind));
209#endif // _EH_RELATIVE_TYPEINFO
210 } else if (__type->properties & CT_IsWinRTHandle) {
211 const auto* __unknown = *static_cast<IUnknown* const*>(__cpp_eh_record.params.pExceptionObject);
212 if (__unknown)
213 const_cast<IUnknown*>(__unknown)->Release();
214 }
215 }
216 }
217 std::free(this);
218 }
219};
220
221static_assert(sizeof(__exception_ptr_normal) % __STDCPP_DEFAULT_NEW_ALIGNMENT__ == 0,
222 "Exception in exception_ptr would be constructed with the wrong alignment");
43223
44exception_ptr::operator bool() const noexcept { return __ExceptionPtrToBool(this); }
224void __assign_seh_exception_ptr_from_record(
225 void*& __dest, const _EXCEPTION_RECORD& __record, void* const __rx_raw) noexcept {
226 if (!__rx_raw) {
227 __dest = __exception_ptr_static<std::bad_alloc>::__get();
228 return;
229 }
45230
46bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept {
47 return __ExceptionPtrCompare(&__x, &__y);
231 __dest = ::new (__rx_raw) __exception_ptr_normal(__record);
48232}
49233
50void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept { __ExceptionPtrSwap(&rhs, &lhs); }
234void __assign_cpp_exception_ptr_from_record(void*& __dest, const EHExceptionRecord& __record) noexcept {
235 // Construct a reference count control block for the C++ exception recorded by __record, and bind it to __dest.
236 //
237 // * If allocating memory for the reference count control block fails, sets __dest to bad_alloc.
238 // * If copying the exception object referred to __record throws, constructs a reference count control block for that
239 // exception instead.
240 // * If copying the exception object thrown by copying the original exception object throws, sets __dest to
241 // bad_exception.
242 const auto* __throw_info = __record.params.pThrowInfo;
243#if _EH_RELATIVE_TYPEINFO
244 const auto __throw_image_base = reinterpret_cast<uintptr_t>(__record.params.pThrowImageBase);
245 const auto* __catchable_type_array = reinterpret_cast<const CatchableTypeArray*>(
246 static_cast<uintptr_t>(__throw_info->pCatchableTypeArray) + __throw_image_base);
247 const auto* __type = reinterpret_cast<CatchableType*>(
248 static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base);
249#else // _EH_RELATIVE_TYPEINFO
250 const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0];
251#endif // _EH_RELATIVE_TYPEINFO
252
253 const auto __except_obj_size = static_cast<size_t>(__type->sizeOrOffset);
254 const auto __alloc_size = sizeof(__exception_ptr_normal) + __except_obj_size;
255 auto* __rx_raw = std::malloc(__alloc_size);
256 if (!__rx_raw) {
257 __dest = __exception_ptr_static<std::bad_alloc>::__get();
258 return;
259 }
260
261 try {
262 __copy_exception_object(static_cast<__exception_ptr_normal*>(__rx_raw) + 1,
263 __record.params.pExceptionObject,
264 __type
265#if _EH_RELATIVE_TYPEINFO
266 ,
267 __throw_image_base
268#endif // _EH_RELATIVE_TYPEINFO
269 );
270
271 const auto* __rx = ::new (__rx_raw) __exception_ptr_normal(reinterpret_cast<const _EXCEPTION_RECORD&>(__record));
272 reinterpret_cast<EHExceptionRecord&>(const_cast<__exception_ptr_normal*>(__rx)->__record_).params.pExceptionObject =
273 static_cast<__exception_ptr_normal*>(__rx_raw) + 1;
274 __dest = const_cast<__exception_ptr_normal*>(__rx);
275 } catch (...) { // Copying the exception object threw an exception.
276 // Exception thrown by the original exception's copy ctor.
277 const auto* __inner_record_ptr = __get_current_exception();
278 if (!__inner_record_ptr) {
279 std::free(__rx_raw);
280 __dest = __exception_ptr_static<std::bad_exception>::__get();
281 return;
282 }
283 const auto& __inner_record = *__inner_record_ptr;
284 if (__inner_record.ExceptionCode == MANAGED_EXCEPTION_CODE ||
285 __inner_record.ExceptionCode == MANAGED_EXCEPTION_CODE_V4) {
286 // We don't support managed exceptions and don't want to say there's no active exception, so give up and say
287 // bad_exception.
288 std::free(__rx_raw);
289 __dest = __exception_ptr_static<std::bad_exception>::__get();
290 return;
291 }
292
293 if (!PER_IS_MSVC_PURE_OR_NATIVE_EH(&__inner_record)) { // Catching a non-C++ exception depends on /EHa.
294 __assign_seh_exception_ptr_from_record(
295 __dest, reinterpret_cast<const _EXCEPTION_RECORD&>(__inner_record), __rx_raw);
296 return;
297 }
298
299 const auto* __inner_throw = __inner_record.params.pThrowInfo;
300#if _EH_RELATIVE_TYPEINFO
301 const auto __inner_throw_image_base = reinterpret_cast<uintptr_t>(__inner_record.params.pThrowImageBase);
302 const auto* __inner_catchable_type_array = reinterpret_cast<const CatchableTypeArray*>(
303 static_cast<uintptr_t>(__inner_throw->pCatchableTypeArray) + __inner_throw_image_base);
304 const auto* __inner_type = reinterpret_cast<CatchableType*>(
305 static_cast<uintptr_t>(__inner_catchable_type_array->arrayOfCatchableTypes[0]) + __inner_throw_image_base);
306#else // _EH_RELATIVE_TYPEINFO
307 const auto* __inner_type = __inner_throw->pCatchableTypeArray->arrayOfCatchableTypes[0];
308#endif // _EH_RELATIVE_TYPEINFO
309
310 const auto __inner_except_size = static_cast<size_t>(__inner_type->sizeOrOffset);
311 const auto __inner_alloc_size = sizeof(__exception_ptr_normal) + __inner_except_size;
312 if (__inner_alloc_size > __alloc_size) {
313 std::free(__rx_raw);
314 __rx_raw = std::malloc(__inner_alloc_size);
315 if (!__rx_raw) {
316 __dest = __exception_ptr_static<std::bad_alloc>::__get();
317 return;
318 }
319 }
320
321 try {
322 __copy_exception_object(static_cast<__exception_ptr_normal*>(__rx_raw) + 1,
323 __inner_record.params.pExceptionObject,
324 __inner_type
325#if _EH_RELATIVE_TYPEINFO
326 ,
327 __inner_throw_image_base
328#endif // _EH_RELATIVE_TYPEINFO
329 );
330 } catch (...) { // Copying the exception emitted while copying the original exception also threw, give up.
331 std::free(__rx_raw);
332 __dest = __exception_ptr_static<std::bad_exception>::__get();
333 return;
334 }
335
336 // This next block must be duplicated inside the catch (even though it looks identical to the block in the try) so
337 // that __inner_record is held alive; exiting the catch will destroy it.
338 const auto* __rx =
339 ::new (__rx_raw) __exception_ptr_normal(reinterpret_cast<const _EXCEPTION_RECORD&>(__inner_record));
340 reinterpret_cast<EHExceptionRecord&>(const_cast<__exception_ptr_normal*>(__rx)->__record_).params.pExceptionObject =
341 static_cast<__exception_ptr_normal*>(__rx_raw) + 1;
342 __dest = const_cast<__exception_ptr_normal*>(__rx);
343 }
344}
345
346} // namespace
347
348namespace std {
349
350exception_ptr::~exception_ptr() noexcept {
351 if (__ptr_)
352 static_cast<__shared_count*>(__ptr_)->__release_shared();
353}
354
355exception_ptr::exception_ptr(const exception_ptr& __other) noexcept : __ptr_(__other.__ptr_) {
356 if (__ptr_)
357 static_cast<__shared_count*>(__ptr_)->__add_shared();
358}
359
360exception_ptr& exception_ptr::operator=(const exception_ptr& __other) noexcept {
361 if (__ptr_ != __other.__ptr_) {
362 if (__other.__ptr_)
363 static_cast<__shared_count*>(__other.__ptr_)->__add_shared();
364 if (__ptr_)
365 static_cast<__shared_count*>(__ptr_)->__release_shared();
366 __ptr_ = __other.__ptr_;
367 }
368 return *this;
369}
370
371exception_ptr exception_ptr::__from_native_exception_pointer(void* __p) noexcept {
372 exception_ptr __ret;
373 __ret.__ptr_ = __p;
374 if (__ret.__ptr_)
375 static_cast<__shared_count*>(__ret.__ptr_)->__add_shared();
376 return __ret;
377}
51378
52379exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) {
53380 exception_ptr __ret = nullptr;
54 if (__ptr)
55 __ExceptionPtrCopyException(&__ret, __except, __ptr);
381 if (!__ptr)
382 return __ret;
383
384 _EXCEPTION_RECORD __record;
385 __populate_cpp_exception_record(__record, __except, static_cast<ThrowInfo*>(const_cast<void*>(__ptr)));
386 __assign_cpp_exception_ptr_from_record(__ret.__ptr_, reinterpret_cast<const EHExceptionRecord&>(__record));
56387 return __ret;
57388}
58389
59390exception_ptr current_exception() noexcept {
60391 exception_ptr __ret;
61 __ExceptionPtrCurrentException(&__ret);
392 const auto* __record = __get_current_exception();
393 if (!__record || __record->ExceptionCode == MANAGED_EXCEPTION_CODE ||
394 __record->ExceptionCode == MANAGED_EXCEPTION_CODE_V4)
395 return __ret;
396
397 if (PER_IS_MSVC_PURE_OR_NATIVE_EH(__record))
398 __assign_cpp_exception_ptr_from_record(__ret.__ptr_, *__record);
399 else
400 __assign_seh_exception_ptr_from_record(
401 __ret.__ptr_, reinterpret_cast<const _EXCEPTION_RECORD&>(*__record), std::malloc(sizeof(__exception_ptr_normal)));
62402 return __ret;
63403}
64404
65[[noreturn]] void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
405[[noreturn]] void rethrow_exception(exception_ptr __p) {
406 if (!__p)
407 throw bad_exception();
408
409 auto* __rep = static_cast<__exception_ptr_storage*>(__p.__ptr_);
410 auto __record_copy = __rep->__record_;
411 auto& __cpp_record = reinterpret_cast<EHExceptionRecord&>(__record_copy);
412 if (PER_IS_MSVC_PURE_OR_NATIVE_EH(&__cpp_record)) {
413 const auto* __throw_info = __cpp_record.params.pThrowInfo;
414 if (!__cpp_record.params.pExceptionObject || !__throw_info || !__throw_info->pCatchableTypeArray)
415 terminate();
416
417#if _EH_RELATIVE_TYPEINFO
418 const auto __throw_image_base = reinterpret_cast<uintptr_t>(__cpp_record.params.pThrowImageBase);
419 const auto* __catchable_type_array =
420 reinterpret_cast<const CatchableTypeArray*>(__throw_image_base + __throw_info->pCatchableTypeArray);
421#else // _EH_RELATIVE_TYPEINFO
422 const auto* __catchable_type_array = __throw_info->pCatchableTypeArray;
423#endif // _EH_RELATIVE_TYPEINFO
424
425 if (__catchable_type_array->nCatchableTypes <= 0)
426 terminate();
427
428#if _EH_RELATIVE_TYPEINFO
429 const auto* __type = reinterpret_cast<CatchableType*>(
430 static_cast<uintptr_t>(__catchable_type_array->arrayOfCatchableTypes[0]) + __throw_image_base);
431#else // _EH_RELATIVE_TYPEINFO
432 const auto* __type = __throw_info->pCatchableTypeArray->arrayOfCatchableTypes[0];
433#endif // _EH_RELATIVE_TYPEINFO
434
435#pragma warning(suppress : 6255)
436 void* __exception_buffer = alloca(__type->sizeOrOffset);
437 __copy_exception_object(__exception_buffer, __cpp_record.params.pExceptionObject, __type
438#if _EH_RELATIVE_TYPEINFO
439 ,
440 __throw_image_base
441#endif // _EH_RELATIVE_TYPEINFO
442 );
443
444 __cpp_record.params.pExceptionObject = __exception_buffer;
445 }
446
447 // Under MSVC C++ exception handling (/EHsc), C Win32 API functions like RaiseException
448 // are assumed not to throw synchronous C++ exceptions. As a result, stack unwinding
449 // initiated by RaiseException does not execute local destructors in this frame.
450 // We must explicitly reset __p here so that the reference count on the stored
451 // exception record is properly decremented before unwinding begins.
452 __p = nullptr;
453 RaiseException(__record_copy.ExceptionCode, __record_copy.ExceptionFlags, __record_copy.NumberParameters,
454 __record_copy.ExceptionInformation);
455 terminate();
456}
66457
67458nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
68459
lib/libcxx/src/support/win32/locale_win32.cpp+262
......@@ -7,6 +7,8 @@
77//===----------------------------------------------------------------------===//
88
99#include <__locale_dir/support/windows.h>
10#include <cctype>
11#include <charconv>
1012#include <clocale> // std::localeconv() & friends
1113#include <cstdarg> // va_start & friends
1214#include <cstddef>
......@@ -14,8 +16,11 @@
1416#include <cstdlib> // std::strtof & friends
1517#include <ctime> // std::strftime
1618#include <cwchar> // wide char manipulation
19#include <string_view>
20#include <windows.h>
1721
1822_LIBCPP_BEGIN_NAMESPACE_STD
23_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1924namespace __locale {
2025
2126//
......@@ -34,6 +39,262 @@ __lconv_t* __localeconv(__locale_t& loc) {
3439 return loc.__store_lconv(lc);
3540}
3641
42namespace {
43const char* __codepage_name(unsigned int __codepage) {
44 switch (__codepage) {
45 case 0:
46 // If no ANSI code page is available, only Unicode can be used for the locale.
47 // In this case, the value is CP_ACP (0).
48 // Such a locale cannot be set as the system locale.
49 // Applications that do not support Unicode do not work correctly with locales
50 // marked as "Unicode only".
51 return nullptr;
52 case 037:
53 return "IBM037";
54 case 437:
55 return "IBM437";
56 case 500:
57 return "IBM500";
58 case 708:
59 return "ASMO-708";
60 case 709:
61 return "ASMO_449";
62 case 775:
63 return "IBM775";
64 case 850:
65 return "IBM850";
66 case 852:
67 return "IBM852";
68 case 855:
69 return "IBM855";
70 case 857:
71 return "IBM857";
72 case 858:
73 return "IBM00858";
74 case 860:
75 return "IBM860";
76 case 861:
77 return "IBM861";
78 case 862:
79 return "IBM862";
80 case 863:
81 return "IBM863";
82 case 864:
83 return "IBM864";
84 case 865:
85 return "IBM865";
86 case 866:
87 return "IBM866";
88 case 869:
89 return "IBM869";
90 case 870:
91 return "IBM870";
92 case 874:
93 return "windows-874";
94 case 932:
95 return "Shift_JIS";
96 case 936:
97 return "GB2312";
98 case 949:
99 return "KS_C_5601-1989";
100 case 950:
101 return "Big5";
102 case 1026:
103 return "IBM1026";
104 case 1047:
105 return "IBM1047";
106 case 1140:
107 return "IBM01140";
108 case 1141:
109 return "IBM01141";
110 case 1142:
111 return "IBM01142";
112 case 1143:
113 return "IBM01143";
114 case 1144:
115 return "IBM01144";
116 case 1145:
117 return "IBM01145";
118 case 1146:
119 return "IBM01146";
120 case 1147:
121 return "IBM01147";
122 case 1148:
123 return "IBM01148";
124 case 1149:
125 return "IBM01149";
126 case 1200:
127 return "UTF-16LE";
128 case 1201:
129 return "UTF-16BE";
130 case 1250:
131 return "windows-1250";
132 case 1251:
133 return "windows-1251";
134 case 1252:
135 return "windows-1252";
136 case 1253:
137 return "windows-1253";
138 case 1254:
139 return "windows-1254";
140 case 1255:
141 return "windows-1255";
142 case 1256:
143 return "windows-1256";
144 case 1257:
145 return "windows-1257";
146 case 1258:
147 return "windows-1258";
148 case 10000:
149 return "macintosh";
150 case 12000:
151 return "UTF-32LE";
152 case 12001:
153 return "UTF-32BE";
154 case 20127:
155 return "US-ASCII";
156 case 20273:
157 return "IBM273";
158 case 20277:
159 return "IBM277";
160 case 20278:
161 return "IBM278";
162 case 20280:
163 return "IBM280";
164 case 20284:
165 return "IBM284";
166 case 20285:
167 return "IBM285";
168 case 20290:
169 return "IBM290";
170 case 20297:
171 return "IBM297";
172 case 20420:
173 return "IBM420";
174 case 20423:
175 return "IBM423";
176 case 20424:
177 return "IBM424";
178 case 20838:
179 return "IBM-Thai";
180 case 20866:
181 return "KOI8-R";
182 case 20871:
183 return "IBM871";
184 case 20880:
185 return "IBM880";
186 case 20905:
187 return "IBM905";
188 case 20924:
189 return "IBM00924";
190 case 20932:
191 return "EUC-JP";
192 case 21866:
193 return "KOI8-U";
194 case 28591:
195 return "ISO-8859-1";
196 case 28592:
197 return "ISO-8859-2";
198 case 28593:
199 return "ISO-8859-3";
200 case 28594:
201 return "ISO-8859-4";
202 case 28595:
203 return "ISO-8859-9";
204 case 28596:
205 return "ISO-8859-10";
206 case 28597:
207 return "ISO-8859-7";
208 case 28598:
209 return "ISO-8859-8";
210 case 28599:
211 return "ISO-8859-9-Windows-Latin-5";
212 case 28603:
213 return "ISO-8859-13";
214 case 28605:
215 return "ISO-8859-15";
216 case 38598:
217 return "ISO-8859-8-I";
218 case 50220:
219 case 50221:
220 case 50222:
221 return "ISO-2022-JP";
222 case 51932:
223 return "EUC-JP";
224 case 51936:
225 return "GB2312";
226 case 51949:
227 return "EUC-KR";
228 case 52936:
229 return "HZ-GB-2312";
230 case 54936:
231 return "GB18030";
232 case 65000:
233 return "UTF-7";
234 case 65001:
235 return "UTF-8";
236 default:
237 return nullptr;
238 }
239}
240} // namespace
241
242const char* __get_locale_encoding(__locale_t loc) {
243 const char* locale_name = loc.__get_locale();
244 if (locale_name == nullptr) {
245 return __codepage_name(::GetACP());
246 }
247
248 std::string_view __sv(locale_name);
249
250 // locale :: "locale-name"
251 // | "language"[_country-region[.code-page]]
252 // | ".code-page"
253 // GetLocaleInfoEx doesn't accept anything other than BCP-47 locale names, e.g. "en_US",
254 // so do a best-attempt to derive the text encoding from the name.
255 if (__sv == "C" || __sv == "") {
256 // "A locale argument value of C specifies the minimal ANSI conforming environment for C translation."
257 // TODO: Figure out what to do for an empty string:
258 // "If locale points to an empty string, the locale is the implementation-defined native environment."
259 return __codepage_name(::GetACP());
260 } else if (auto dot = __sv.find('.'); dot != std::string_view::npos) {
261 std::string_view __code_page(locale_name + dot + 1);
262
263 // Windows allows the codepage number as part of the name,
264 // e.g. "en_US.1252" for English US, Windows-1252.
265 if (std::isdigit(__code_page[0])) {
266 unsigned int __cpage{};
267 auto __res = std::from_chars(__code_page.data(), __code_page.data() + __code_page.size(), __cpage);
268 if (__res) {
269 return __codepage_name(__cpage);
270 }
271 } else { // POSIX-style name
272 return locale_name + dot + 1;
273 }
274 }
275
276 wchar_t locale_wbuffer[LOCALE_NAME_MAX_LENGTH + 1]{};
277 wchar_t number_buffer[11]{};
278
279 bool is_ansi = ::AreFileApisANSI();
280 auto codepage = is_ansi ? CP_ACP : CP_OEMCP;
281 int ret = ::MultiByteToWideChar(
282 codepage, MB_ERR_INVALID_CHARS, locale_name, __sv.size(), locale_wbuffer, LOCALE_NAME_MAX_LENGTH);
283
284 if (ret <= 0)
285 return nullptr;
286
287 // The below function fills the string with the number in text.
288 auto lctype = is_ansi ? LOCALE_IDEFAULTANSICODEPAGE : LOCALE_IDEFAULTCODEPAGE;
289 int result = ::GetLocaleInfoEx(locale_wbuffer, lctype, number_buffer, 10);
290
291 if (result <= 0)
292 return nullptr;
293
294 unsigned int acp = std::wcstoul(number_buffer, nullptr, 10);
295 return __codepage_name(acp);
296}
297
37298//
38299// Strtonum functions
39300//
......@@ -182,4 +443,5 @@ int __asprintf(char** ret, __locale_t loc, const char* format, ...) {
182443}
183444
184445} // namespace __locale
446_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
185447_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/support/win32/thread_win32.cpp+2
......@@ -16,6 +16,7 @@
1616#include <fibersapi.h>
1717
1818_LIBCPP_BEGIN_NAMESPACE_STD
19_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1920
2021static_assert(sizeof(__libcpp_mutex_t) == sizeof(SRWLOCK), "");
2122static_assert(alignof(__libcpp_mutex_t) == alignof(SRWLOCK), "");
......@@ -211,4 +212,5 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) {
211212 return 0;
212213}
213214
215_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
214216_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/system_error.cpp+2
......@@ -27,6 +27,7 @@
2727#endif
2828
2929_LIBCPP_BEGIN_NAMESPACE_STD
30_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3031
3132#if defined(_LIBCPP_WIN32API)
3233
......@@ -368,4 +369,5 @@ void __throw_system_error(int ev, const char* what_arg) {
368369#endif
369370}
370371
372_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
371373_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/text_encoding.cpp created+54
......@@ -0,0 +1,54 @@
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <__config>
10#include <__locale_dir/locale_base_api.h>
11#include <__utility/scope_guard.h>
12#include <text_encoding>
13
14_LIBCPP_BEGIN_NAMESPACE_STD
15_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
16
17#if defined(__ANDROID__)
18// UTF-8 is the always the environment encoding on Android.
19std::text_encoding __get_locale_encoding([[maybe_unused]] const char* __name) { return std::text_encoding::id::UTF8; }
20#else
21static text_encoding __make_text_encoding(const char* __name) {
22 if (__name == nullptr)
23 return text_encoding{};
24
25 string_view __name_view(__name);
26 if (__name_view.size() > text_encoding::max_name_length)
27 return text_encoding{};
28
29 return text_encoding(__name_view);
30}
31
32std::text_encoding __get_locale_encoding(const char* __name) {
33 if (__name == nullptr)
34 return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(0)));
35
36 __locale::__locale_t __l = __locale::__newlocale(_LIBCPP_CTYPE_MASK, __name, static_cast<__locale::__locale_t>(0));
37
38 __scope_guard __locale_guard([&__l] {
39 if (__l) {
40 __locale::__freelocale(__l);
41 }
42 });
43
44 if (!__l) {
45 return text_encoding{};
46 }
47
48 return __make_text_encoding(__locale::__get_locale_encoding(__l));
49}
50
51#endif // __ANDROID__
52
53_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
54_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/thread.cpp+2
......@@ -33,6 +33,7 @@
3333#endif
3434
3535_LIBCPP_BEGIN_NAMESPACE_STD
36_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
3637
3738thread::~thread() {
3839 if (!__libcpp_thread_isnull(&__t_))
......@@ -170,4 +171,5 @@ void __thread_struct::notify_all_at_thread_exit(condition_variable* cv, mutex* m
170171
171172void __thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s) { __p_->__make_ready_at_thread_exit(__s); }
172173
174_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
173175_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/valarray.cpp+2
......@@ -9,6 +9,7 @@
99#include <valarray>
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
12_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1213
1314#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 9
1415template _LIBCPP_EXPORTED_FROM_ABI valarray<size_t>::valarray(size_t);
......@@ -45,4 +46,5 @@ void gslice::__init(size_t __start) {
4546 }
4647}
4748
49_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
4850_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/variant.cpp+2
......@@ -12,4 +12,6 @@ namespace std {
1212
1313const char* bad_variant_access::what() const noexcept { return "bad_variant_access"; }
1414
15const char* __bad_variant_access_with_msg::what() const noexcept { return __msg_; }
16
1517} // namespace std
lib/libcxx/src/vector.cpp+2
......@@ -9,6 +9,7 @@
99#include <vector>
1010
1111_LIBCPP_BEGIN_NAMESPACE_STD
12_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
1213
1314#if _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
1415
......@@ -27,4 +28,5 @@ void __vector_base_common<true>::__throw_out_of_range() const { std::__throw_out
2728
2829#endif // _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 15
2930
31_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
3032_LIBCPP_END_NAMESPACE_STD
lib/libcxx/src/verbose_abort.cpp+3-1
......@@ -22,8 +22,9 @@ extern "C" void android_set_abort_message(const char* msg);
2222#endif
2323
2424_LIBCPP_BEGIN_NAMESPACE_STD
25_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
2526
26_LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept {
27[[gnu::weak]] void __libcpp_verbose_abort(char const* format, ...) noexcept {
2728 // Write message to stderr. We do this before formatting into a
2829 // buffer so that we still get some information out if that fails.
2930 {
......@@ -62,4 +63,5 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) noexcept {
6263 std::abort();
6364}
6465
66_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
6567_LIBCPP_END_NAMESPACE_STD
lib/libcxxabi/include/__cxxabi_config.h+6
......@@ -128,4 +128,10 @@
128128# define _LIBCXXABI_NOEXCEPT noexcept
129129#endif
130130
131#if defined(__POINTER_FIELD_PROTECTION_ABI__)
132# define _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION [[_Clang::__no_field_protection__]]
133#else
134# define _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION
135#endif
136
131137#endif // ____CXXABI_CONFIG_H
lib/libcxxabi/include/cxxabi.h+13-12
......@@ -19,8 +19,7 @@
1919
2020#include <__cxxabi_config.h>
2121
22#define _LIBCPPABI_VERSION 15000
23#define _LIBCXXABI_NORETURN __attribute__((noreturn))
22#define _LIBCPPABI_VERSION 230000
2423#define _LIBCXXABI_ALWAYS_COLD __attribute__((cold))
2524
2625#ifdef __cplusplus
......@@ -31,7 +30,7 @@ class _LIBCXXABI_TYPE_VIS type_info; // forward declaration
3130#else
3231class type_info; // forward declaration
3332#endif
34}
33} // namespace std
3534
3635
3736// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
......@@ -56,7 +55,7 @@ __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXAB
5655#endif
5756
5857// 2.4.3 Throwing the Exception Object
59extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
58[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void
6059__cxa_throw(void *thrown_exception, std::type_info *tinfo,
6160#ifdef __wasm__
6261 void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
......@@ -80,22 +79,22 @@ extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type();
8079// GNU extension
8180// Calls `terminate` with the current exception being caught. This function is used by GCC when a `noexcept` function
8281// throws an exception inside a try/catch block and doesn't catch it.
83extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT;
82[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_call_terminate(void*) _LIBCXXABI_NOEXCEPT;
8483
8584// 2.5.4 Rethrowing Exceptions
86extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_rethrow();
85[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_rethrow();
8786
8887// 2.6 Auxiliary Runtime APIs
89extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void);
90extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
91extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
88[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_bad_cast(void);
89[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_bad_typeid(void);
90[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void
9291__cxa_throw_bad_array_new_length(void);
9392
9493// 3.2.6 Pure Virtual Function API
95extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
94[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_pure_virtual(void);
9695
9796// 3.2.7 Deleted Virtual Function API
98extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
97[[__noreturn__]] extern _LIBCXXABI_FUNC_VIS void __cxa_deleted_virtual(void);
9998
10099// 3.3.2 One-time Construction API
101100#if defined(_LIBCXXABI_GUARD_ABI_ARM)
......@@ -180,7 +179,9 @@ __cxa_decrement_exception_refcount(void *primary_exception) _LIBCXXABI_NOEXCEPT;
180179extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() _LIBCXXABI_NOEXCEPT;
181180extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() _LIBCXXABI_NOEXCEPT;
182181
183#if defined(__linux__) || defined(__Fuchsia__)
182// zig patch: haiku support
183// zig patch: serenity support
184#if defined(__linux__) || defined(__Fuchsia__) || defined(__HAIKU__) || defined(__serenity__)
184185// Linux and Fuchsia TLS support. Not yet an official part of the Itanium ABI.
185186// https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
186187extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *,
lib/libcxxabi/src/abort_message.h+1-1
......@@ -11,7 +11,7 @@
1111
1212#include "cxxabi.h"
1313
14extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void
14extern "C" [[noreturn]] _LIBCXXABI_HIDDEN void
1515__abort_message(const char *format, ...) __attribute__((format(printf, 1, 2)));
1616
1717#ifndef _LIBCXXABI_ASSERT
lib/libcxxabi/src/cxa_aux_runtime.cpp+3-3
......@@ -16,7 +16,7 @@
1616
1717namespace __cxxabiv1 {
1818extern "C" {
19_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
19[[noreturn]] _LIBCXXABI_FUNC_VIS void __cxa_bad_cast(void) {
2020#ifndef _LIBCXXABI_NO_EXCEPTIONS
2121 throw std::bad_cast();
2222#else
......@@ -24,7 +24,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
2424#endif
2525}
2626
27_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
27[[noreturn]] _LIBCXXABI_FUNC_VIS void __cxa_bad_typeid(void) {
2828#ifndef _LIBCXXABI_NO_EXCEPTIONS
2929 throw std::bad_typeid();
3030#else
......@@ -32,7 +32,7 @@ _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
3232#endif
3333}
3434
35_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
35[[noreturn]] _LIBCXXABI_FUNC_VIS void
3636__cxa_throw_bad_array_new_length(void) {
3737#ifndef _LIBCXXABI_NO_EXCEPTIONS
3838 throw std::bad_array_new_length();
lib/libcxxabi/src/cxa_default_handlers.cpp+4-6
......@@ -24,8 +24,7 @@
2424static constinit const char* cause = "uncaught";
2525
2626# ifndef _LIBCXXABI_NO_EXCEPTIONS
27__attribute__((noreturn))
28static void demangling_terminate_handler()
27[[noreturn]] static void demangling_terminate_handler()
2928{
3029 using namespace __cxxabiv1;
3130 __cxa_eh_globals* globals = __cxa_get_globals_fast();
......@@ -78,15 +77,14 @@ static void demangling_terminate_handler()
7877 }
7978}
8079#else // !_LIBCXXABI_NO_EXCEPTIONS
81__attribute__((noreturn))
82static void demangling_terminate_handler()
80[[noreturn]] static void demangling_terminate_handler()
8381{
82 (void)cause;
8483 __abort_message("terminating");
8584}
8685#endif // !_LIBCXXABI_NO_EXCEPTIONS
8786
88__attribute__((noreturn))
89static void demangling_unexpected_handler()
87[[noreturn]] static void demangling_unexpected_handler()
9088{
9189 cause = "unexpected";
9290 std::terminate();
lib/libcxxabi/src/cxa_exception.cpp+1-1
......@@ -140,7 +140,7 @@ exception_cleanup_func(_Unwind_Reason_Code reason, _Unwind_Exception* unwind_exc
140140 __cxa_decrement_exception_refcount(unwind_exception + 1);
141141}
142142
143static _LIBCXXABI_NORETURN void failed_throw(__cxa_exception* exception_header) {
143[[noreturn]] static void failed_throw(__cxa_exception* exception_header) {
144144// Section 2.5.3 says:
145145// * For purposes of this ABI, several things are considered exception handlers:
146146// ** A terminate() call due to a throw.
lib/libcxxabi/src/cxa_guard_impl.h+1-1
......@@ -637,7 +637,7 @@ struct GlobalStatic {
637637 static T instance;
638638};
639639template <class T>
640_LIBCPP_CONSTINIT T GlobalStatic<T>::instance = {};
640constinit T GlobalStatic<T>::instance = {};
641641
642642enum class Implementation { NoThreads, GlobalMutex, Futex };
643643
lib/libcxxabi/src/cxa_handlers.cpp+2-4
......@@ -36,8 +36,7 @@ __unexpected(unexpected_handler func)
3636 __abort_message("unexpected_handler unexpectedly returned");
3737}
3838
39__attribute__((noreturn))
40void
39[[noreturn]] void
4140unexpected()
4241{
4342 __unexpected(get_unexpected());
......@@ -69,8 +68,7 @@ __terminate(terminate_handler func) noexcept
6968#endif // _LIBCXXABI_NO_EXCEPTIONS
7069}
7170
72__attribute__((noreturn))
73void
71[[noreturn]] void
7472terminate() noexcept
7573{
7674#ifndef _LIBCXXABI_NO_EXCEPTIONS
lib/libcxxabi/src/cxa_handlers.h+2-2
......@@ -19,11 +19,11 @@
1919namespace std
2020{
2121
22_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
22[[noreturn]] _LIBCXXABI_HIDDEN
2323void
2424__unexpected(unexpected_handler func);
2525
26_LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN
26[[noreturn]] _LIBCXXABI_HIDDEN
2727void
2828__terminate(terminate_handler func) noexcept;
2929
lib/libcxxabi/src/cxa_personality.cpp+3-15
......@@ -23,7 +23,7 @@
2323
2424#if __has_feature(ptrauth_calls)
2525
26// CXXABI depends on defintions in libunwind as pointer auth couples the
26// CXXABI depends on definitions in libunwind as pointer auth couples the
2727// definitions
2828# include "libunwind.h"
2929
......@@ -67,15 +67,6 @@
6767# pragma clang diagnostic ignored "-Wmissing-prototypes"
6868#endif
6969
70// TODO: This is a temporary workaround for libc++abi to recognize that it's being
71// built against LLVM's libunwind. LLVM's libunwind started reporting _LIBUNWIND_VERSION
72// in LLVM 15 -- we can remove this workaround after shipping LLVM 17. Once we remove
73// this workaround, it won't be possible to build libc++abi against libunwind headers
74// from LLVM 14 and before anymore.
75#if defined(____LIBUNWIND_CONFIG_H__) && !defined(_LIBUNWIND_VERSION)
76# define _LIBUNWIND_VERSION
77#endif
78
7970#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
8071#include <windows.h>
8172#include <winnt.h>
......@@ -1125,9 +1116,7 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
11251116
11261117#else
11271118
1128// zig patch: https://github.com/llvm/llvm-project/issues/194232
1129extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,
1130 _Unwind_Context*);
1119extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, _Unwind_Context*);
11311120
11321121// Helper function to unwind one frame.
11331122// ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the
......@@ -1283,8 +1272,7 @@ __gxx_personality_v0(_Unwind_State state,
12831272#endif
12841273
12851274
1286__attribute__((noreturn))
1287_LIBCXXABI_FUNC_VIS void
1275[[noreturn]] _LIBCXXABI_FUNC_VIS void
12881276__cxa_call_unexpected(void* arg)
12891277{
12901278 _Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(arg);
lib/libcxxabi/src/cxa_thread_atexit.cpp+3-1
......@@ -106,7 +106,9 @@ namespace {
106106
107107#endif // HAVE___CXA_THREAD_ATEXIT_IMPL
108108
109#if defined(__linux__) || defined(__Fuchsia__)
109// zig patch: haiku support
110// zig patch: serenity support
111#if defined(__linux__) || defined(__Fuchsia__) || defined(__HAIKU__) || defined(__serenity__)
110112extern "C" {
111113
112114 _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(Dtor dtor, void* obj, void* dso_symbol) throw() {
lib/libcxxabi/src/cxa_vector.cpp+1-2
......@@ -116,8 +116,7 @@ namespace {
116116//
117117
118118namespace {
119_LIBCXXABI_NORETURN
120void throw_bad_array_new_length() {
119[[noreturn]] void throw_bad_array_new_length() {
121120#ifndef _LIBCXXABI_NO_EXCEPTIONS
122121 throw std::bad_array_new_length();
123122#else
lib/libcxxabi/src/cxa_virtual.cpp+2-2
......@@ -11,12 +11,12 @@
1111
1212namespace __cxxabiv1 {
1313extern "C" {
14_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
14[[noreturn]] _LIBCXXABI_FUNC_VIS
1515void __cxa_pure_virtual(void) {
1616 __abort_message("Pure virtual function called!");
1717}
1818
19_LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN
19[[noreturn]] _LIBCXXABI_FUNC_VIS
2020void __cxa_deleted_virtual(void) {
2121 __abort_message("Deleted virtual function called!");
2222}
lib/libcxxabi/src/demangle/ItaniumDemangle.h+54
......@@ -1537,6 +1537,27 @@ public:
15371537 }
15381538};
15391539
1540class PackIndexing final : public Node {
1541 const Node *Pattern;
1542 const Node *Index;
1543
1544public:
1545 PackIndexing(const Node *Pattern_, const Node *Index_)
1546 : Node(KPackIndexing), Pattern(Pattern_), Index(Index_) {}
1547
1548 template <typename Fn> void match(Fn F) const { F(Pattern, Index); }
1549
1550 void printLeft(OutputBuffer &OB) const override {
1551 OB.printOpen('(');
1552 ParameterPackExpansion PPE(Pattern);
1553 PPE.printLeft(OB);
1554 OB.printClose(')');
1555 OB.printOpen('[');
1556 OB.printLeft(*Index);
1557 OB.printClose(']');
1558 }
1559};
1560
15401561class TemplateArgs final : public Node {
15411562 NodeArray Params;
15421563 Node *Requires;
......@@ -4531,6 +4552,18 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
45314552 Result = make<ParameterPackExpansion>(Child);
45324553 break;
45334554 }
4555 // ::= Dy <type> <expression> # pack indexing (C++26)
4556 case 'y': {
4557 First += 2;
4558 Node *Pattern = getDerived().parseType();
4559 if (!Pattern)
4560 return nullptr;
4561 Node *Index = getDerived().parseExpr();
4562 if (!Index)
4563 return nullptr;
4564 Result = make<PackIndexing>(Pattern, Index);
4565 break;
4566 }
45344567 // Exception specifier on a function type.
45354568 case 'o':
45364569 case 'O':
......@@ -5375,6 +5408,16 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExpr() {
53755408 return nullptr;
53765409 return make<ParameterPackExpansion>(Child);
53775410 }
5411 if (consumeIf("sy")) {
5412 Node *Pattern = look() == 'T' ? getDerived().parseTemplateParam()
5413 : getDerived().parseFunctionParam();
5414 if (Pattern == nullptr)
5415 return nullptr;
5416 Node *Index = getDerived().parseExpr();
5417 if (Index == nullptr)
5418 return nullptr;
5419 return make<PackIndexing>(Pattern, Index);
5420 }
53785421 if (consumeIf("sZ")) {
53795422 if (look() == 'T') {
53805423 Node *R = getDerived().parseTemplateParam();
......@@ -6157,8 +6200,17 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
61576200// extension ::= ___Z <encoding> _block_invoke
61586201// extension ::= ___Z <encoding> _block_invoke<decimal-digit>+
61596202// extension ::= ___Z <encoding> _block_invoke_<decimal-digit>+
6203// extension ::= __alloc_token__Z <encoding>
6204// extension ::= __alloc_token_<decimal-digit>+__Z <encoding>
61606205template <typename Derived, typename Alloc>
61616206Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
6207 bool AllocToken = consumeIf("__alloc_token_");
6208 if (AllocToken) {
6209 const char *Saved = First;
6210 if (parseNumber().empty() || !consumeIf('_'))
6211 First = Saved;
6212 }
6213
61626214 if (consumeIf("_Z") || consumeIf("__Z")) {
61636215 Node *Encoding = getDerived().parseEncoding(ParseParams);
61646216 if (Encoding == nullptr)
......@@ -6168,6 +6220,8 @@ Node *AbstractManglingParser<Derived, Alloc>::parse(bool ParseParams) {
61686220 make<DotSuffix>(Encoding, std::string_view(First, Last - First));
61696221 First = Last;
61706222 }
6223 if (AllocToken)
6224 Encoding = make<DotSuffix>(Encoding, ".alloc_token");
61716225 if (numLeft() != 0)
61726226 return nullptr;
61736227 return Encoding;
lib/libcxxabi/src/demangle/ItaniumNodes.def+1-1
......@@ -100,5 +100,5 @@ NODE(ExprRequirement)
100100NODE(TypeRequirement)
101101NODE(NestedRequirement)
102102NODE(ExplicitObjectParameter)
103
103NODE(PackIndexing)
104104#undef NODE
lib/libcxxabi/src/demangle/Utility.h+1-1
......@@ -31,7 +31,7 @@ class Node;
3131
3232// Stream that AST nodes write their string representation into after the AST
3333// has been parsed.
34class OutputBuffer {
34class DEMANGLE_ABI OutputBuffer {
3535 char *Buffer = nullptr;
3636 size_t CurrentPosition = 0;
3737 size_t BufferCapacity = 0;
lib/libcxxabi/src/fallback_malloc.cpp+2-2
......@@ -35,9 +35,9 @@ namespace {
3535
3636// When POSIX threads are not available, make the mutex operations a nop
3737#ifndef _LIBCXXABI_HAS_NO_THREADS
38static _LIBCPP_CONSTINIT std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;
38static constinit std::__libcpp_mutex_t heap_mutex = _LIBCPP_MUTEX_INITIALIZER;
3939#else
40static _LIBCPP_CONSTINIT void* heap_mutex = 0;
40static constinit void* heap_mutex = 0;
4141#endif
4242
4343class mutexor {
lib/libcxxabi/src/private_typeinfo.cpp+18-20
......@@ -99,28 +99,27 @@ struct derived_object_info {
9999};
100100
101101/// A helper function that gets (dynamic_ptr, dynamic_type, offset_to_derived) from static_ptr.
102void dyn_cast_get_derived_info(derived_object_info* info, const void* static_ptr)
103{
102derived_object_info dyn_cast_get_derived_info(const void* static_ptr) {
103 derived_object_info info;
104104#if __has_feature(cxx_abi_relative_vtable)
105 // The vtable address will point to the first virtual function, which is 8
106 // bytes after the start of the vtable (4 for the offset from top + 4 for
107 // the typeinfo component).
108 const int32_t* vtable =
109 *reinterpret_cast<const int32_t* const*>(static_ptr);
110 info->offset_to_derived = static_cast<std::ptrdiff_t>(vtable[-2]);
111 info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived;
112
113 // The typeinfo component is now a relative offset to a proxy.
114 int32_t offset_to_ti_proxy = vtable[-1];
115 const uint8_t* ptr_to_ti_proxy =
116 reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy;
117 info->dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy));
105 // The vtable address will point to the first virtual function, which is 8
106 // bytes after the start of the vtable (4 for the offset from top + 4 for
107 // the typeinfo component).
108 const int32_t* vtable = *reinterpret_cast<const int32_t* const*>(static_ptr);
109 info.offset_to_derived = static_cast<std::ptrdiff_t>(vtable[-2]);
110 info.dynamic_ptr = static_cast<const char*>(static_ptr) + info.offset_to_derived;
111
112 // The typeinfo component is now a relative offset to a proxy.
113 int32_t offset_to_ti_proxy = vtable[-1];
114 const uint8_t* ptr_to_ti_proxy = reinterpret_cast<const uint8_t*>(vtable) + offset_to_ti_proxy;
115 info.dynamic_type = *(reinterpret_cast<const __class_type_info* const*>(ptr_to_ti_proxy));
118116#else
119117 void** vtable = strip_vtable(*static_cast<void** const*>(static_ptr));
120 info->offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);
121 info->dynamic_ptr = static_cast<const char*>(static_ptr) + info->offset_to_derived;
122 info->dynamic_type = static_cast<const __class_type_info*>(vtable[-1]);
118 info.offset_to_derived = reinterpret_cast<ptrdiff_t>(vtable[-2]);
119 info.dynamic_ptr = static_cast<const char*>(static_ptr) + info.offset_to_derived;
120 info.dynamic_type = static_cast<const __class_type_info*>(vtable[-1]);
123121#endif
122 return info;
124123}
125124
126125/// A helper function for __dynamic_cast that casts a base sub-object pointer
......@@ -915,8 +914,7 @@ __dynamic_cast(const void *static_ptr, const __class_type_info *static_type,
915914 const __class_type_info *dst_type,
916915 std::ptrdiff_t src2dst_offset) {
917916 // Get (dynamic_ptr, dynamic_type) from static_ptr
918 derived_object_info derived_info;
919 dyn_cast_get_derived_info(&derived_info, static_ptr);
917 derived_object_info derived_info = dyn_cast_get_derived_info(static_ptr);
920918
921919 // Initialize answer to nullptr. This will be changed from the search
922920 // results if a non-null answer is found. Regardless, this is what will
lib/libcxxabi/src/private_typeinfo.h+3-3
......@@ -145,7 +145,7 @@ public:
145145// Has one non-virtual public base class at offset zero
146146class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info {
147147public:
148 const __class_type_info *__base_type;
148 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __class_type_info* __base_type;
149149
150150 _LIBCXXABI_HIDDEN virtual ~__si_class_type_info();
151151
......@@ -204,7 +204,7 @@ public:
204204class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info {
205205public:
206206 unsigned int __flags;
207 const __shim_type_info *__pointee;
207 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __shim_type_info* __pointee;
208208
209209 enum __masks {
210210 __const_mask = 0x1,
......@@ -245,7 +245,7 @@ public:
245245class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info
246246 : public __pbase_type_info {
247247public:
248 const __class_type_info *__context;
248 _LIBCXXABI_DISABLE_POINTER_FIELD_PROTECTION const __class_type_info* __context;
249249
250250 _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info();
251251 _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *,
lib/libcxxabi/src/stdlib_new_delete.cpp+16-20
......@@ -20,10 +20,6 @@
2020# error The _THROW_BAD_ALLOC macro should be already defined by libc++
2121#endif
2222
23#ifndef _LIBCPP_WEAK
24# error The _LIBCPP_WEAK macro should be already defined by libc++
25#endif
26
2723#if defined(_LIBCXXABI_NO_EXCEPTIONS) != !_LIBCPP_HAS_EXCEPTIONS
2824# error libc++ and libc++abi seem to disagree on whether exceptions are enabled
2925#endif
......@@ -70,7 +66,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size) _THROW_BAD_ALLOC {
7066 return p;
7167}
7268
73_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
69[[gnu::weak]] void* operator new(size_t size, const std::nothrow_t&) noexcept {
7470#if !_LIBCPP_HAS_EXCEPTIONS
7571# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
7672 _LIBCPP_ASSERT_SHIM(
......@@ -96,7 +92,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
9692
9793OVERRIDABLE_FUNCTION void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
9894
99_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
95[[gnu::weak]] void* operator new[](size_t size, const std::nothrow_t&) noexcept {
10096#if !_LIBCPP_HAS_EXCEPTIONS
10197# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
10298 _LIBCPP_ASSERT_SHIM(
......@@ -120,17 +116,17 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
120116#endif
121117}
122118
123_LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); }
119[[gnu::weak]] void operator delete(void* ptr) noexcept { std::free(ptr); }
124120
125_LIBCPP_WEAK void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }
121[[gnu::weak]] void operator delete(void* ptr, const std::nothrow_t&) noexcept { ::operator delete(ptr); }
126122
127_LIBCPP_WEAK void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }
123[[gnu::weak]] void operator delete(void* ptr, size_t) noexcept { ::operator delete(ptr); }
128124
129_LIBCPP_WEAK void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }
125[[gnu::weak]] void operator delete[](void* ptr) noexcept { ::operator delete(ptr); }
130126
131_LIBCPP_WEAK void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }
127[[gnu::weak]] void operator delete[](void* ptr, const std::nothrow_t&) noexcept { ::operator delete[](ptr); }
132128
133_LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
129[[gnu::weak]] void operator delete[](void* ptr, size_t) noexcept { ::operator delete[](ptr); }
134130
135131#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
136132
......@@ -161,7 +157,7 @@ OVERRIDABLE_FUNCTION void* operator new(std::size_t size, std::align_val_t align
161157 return p;
162158}
163159
164_LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
160[[gnu::weak]] void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
165161# if !_LIBCPP_HAS_EXCEPTIONS
166162# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
167163 _LIBCPP_ASSERT_SHIM(
......@@ -189,7 +185,7 @@ OVERRIDABLE_FUNCTION void* operator new[](size_t size, std::align_val_t alignmen
189185 return ::operator new(size, alignment);
190186}
191187
192_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
188[[gnu::weak]] void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
193189# if !_LIBCPP_HAS_EXCEPTIONS
194190# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
195191 _LIBCPP_ASSERT_SHIM(
......@@ -213,25 +209,25 @@ _LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const
213209# endif
214210}
215211
216_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
212[[gnu::weak]] void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
217213
218_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
214[[gnu::weak]] void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
219215 ::operator delete(ptr, alignment);
220216}
221217
222_LIBCPP_WEAK void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {
218[[gnu::weak]] void operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept {
223219 ::operator delete(ptr, alignment);
224220}
225221
226_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment) noexcept {
222[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment) noexcept {
227223 ::operator delete(ptr, alignment);
228224}
229225
230_LIBCPP_WEAK void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
226[[gnu::weak]] void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept {
231227 ::operator delete[](ptr, alignment);
232228}
233229
234_LIBCPP_WEAK void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
230[[gnu::weak]] void operator delete[](void* ptr, size_t, std::align_val_t alignment) noexcept {
235231 ::operator delete[](ptr, alignment);
236232}
237233
lib/libtsan/interception/interception.h+10
......@@ -362,6 +362,16 @@ const interpose_substitution substitution_##func_name[] \
362362// so we use casts via uintptr_t (the local __sanitizer::uptr equivalent).
363363namespace __interception {
364364
365// Dynamic library loading helpers (dlopen/LoadLibrary, dlsym/GetProcAddress).
366// Implemented in interception_linux.cpp on non-Windows targets and
367// interception_win.cpp on Windows.
368bool DynamicLoaderAvailable();
369void* OpenLibrary(const char* name);
370void* LookupSymbol(void* handle, const char* symbol);
371void* LookupSymbolDefault(const char* symbol);
372void* LookupSymbolNext(const char* symbol);
373void* LookupSymbolNextVersioned(const char* symbol, const char* version);
374
365375#if defined(__ELF__) && !SANITIZER_FUCHSIA
366376// The use of interceptors makes many sanitizers unusable for static linking.
367377// Define a function, if called, will cause a linker error (undefined _DYNAMIC).
lib/libtsan/interception/interception_linux.cpp+58-5
......@@ -9,15 +9,68 @@
99// This file is a part of AddressSanitizer, an address sanity checker.
1010//
1111// Linux-specific interception methods.
12//
13// POSIX dynamic-library helpers (dlopen / dlsym) live here for every
14// non-Windows interception target (Linux, *BSD, Darwin, AIX, Fuchsia, ...).
15// macOS/AIX/Fuchsia compile this TU for RTInterception but do not use the
16// Linux-specific InterceptFunction helpers below.
1217//===----------------------------------------------------------------------===//
1318
1419#include "interception.h"
1520
21#if !SANITIZER_WINDOWS
22
23# include <dlfcn.h>
24
25# pragma weak dlopen
26# pragma weak dlsym
27#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
28# pragma weak dlvsym
29#endif
30
31namespace __interception {
32
33bool DynamicLoaderAvailable() { return dlopen != nullptr && dlsym != nullptr; }
34
35void* OpenLibrary(const char* name) {
36 if (!DynamicLoaderAvailable())
37 return nullptr;
38 return dlopen(name, RTLD_LAZY | RTLD_LOCAL);
39}
40
41void* LookupSymbol(void* handle, const char* symbol) {
42 if (!DynamicLoaderAvailable())
43 return nullptr;
44 return dlsym(handle, symbol);
45}
46
47void* LookupSymbolDefault(const char* symbol) {
48 if (!DynamicLoaderAvailable())
49 return nullptr;
50 return dlsym(RTLD_DEFAULT, symbol);
51}
52
53void* LookupSymbolNext(const char* symbol) {
54 if (!DynamicLoaderAvailable())
55 return nullptr;
56 return dlsym(RTLD_NEXT, symbol);
57}
58
59#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
60void* LookupSymbolNextVersioned(const char* symbol, const char* version) {
61 if (!DynamicLoaderAvailable() || dlvsym == nullptr)
62 return nullptr;
63 return dlvsym(RTLD_NEXT, symbol, version);
64}
65#endif // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
66
67} // namespace __interception
68
69#endif // !SANITIZER_WINDOWS
70
1671#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \
1772 SANITIZER_SOLARIS || SANITIZER_HAIKU
1873
19#include <dlfcn.h> // for dlsym() and dlvsym()
20
2174namespace __interception {
2275
2376#if SANITIZER_NETBSD
......@@ -39,14 +92,14 @@ static void *GetFuncAddr(const char *name, uptr trampoline) {
3992 if (StrCmp(name, "sigaction"))
4093 name = "__sigaction14";
4194#endif
42 void *addr = dlsym(RTLD_NEXT, name);
95 void* addr = LookupSymbolNext(name);
4396 if (!addr) {
4497 // If the lookup using RTLD_NEXT failed, the sanitizer runtime library is
4598 // later in the library search order than the DSO that we are trying to
4699 // intercept, which means that we cannot intercept this function. We still
47100 // want the address of the real definition, though, so look it up using
48101 // RTLD_DEFAULT.
49 addr = dlsym(RTLD_DEFAULT, name);
102 addr = LookupSymbolDefault(name);
50103
51104 // In case `name' is not loaded, dlsym ends up finding the actual wrapper.
52105 // We don't want to intercept the wrapper and have it point to itself.
......@@ -66,7 +119,7 @@ bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func,
66119// dlvsym is a GNU extension supported by some other platforms.
67120#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
68121static void *GetFuncAddr(const char *name, const char *ver) {
69 return dlvsym(RTLD_NEXT, name, ver);
122 return LookupSymbolNextVersioned(name, ver);
70123}
71124
72125bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
lib/libtsan/interception/interception_win.cpp+25
......@@ -134,6 +134,30 @@
134134
135135namespace __interception {
136136
137bool DynamicLoaderAvailable() { return true; }
138
139void* OpenLibrary(const char* name) {
140 if (!name)
141 return reinterpret_cast<void*>(GetModuleHandleA(nullptr));
142 return reinterpret_cast<void*>(LoadLibraryA(name));
143}
144
145void* LookupSymbol(void* handle, const char* symbol) {
146 if (!handle)
147 return nullptr;
148 return reinterpret_cast<void*>(reinterpret_cast<__sanitizer::uptr>(
149 GetProcAddress(reinterpret_cast<HMODULE>(handle), symbol)));
150}
151
152void* LookupSymbolDefault(const char* symbol) {
153 return LookupSymbol(reinterpret_cast<void*>(GetModuleHandleA(nullptr)),
154 symbol);
155}
156
157void* LookupSymbolNext(const char*) { return nullptr; }
158
159void* LookupSymbolNextVersioned(const char*, const char*) { return nullptr; }
160
137161static const int kAddressLength = FIRST_32_SECOND_64(4, 8);
138162static const int kJumpInstructionLength = 5;
139163static const int kShortJumpInstructionLength = 2;
......@@ -655,6 +679,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
655679 return 2;
656680
657681 case 0x3980: // 80 39 XX : cmp BYTE PTR [rcx], XX
682 case 0x3a80: // 80 3A XX : cmp BYTE PTR [rdx], XX
658683 case 0x4D8B: // 8B 4D XX : mov XX(%ebp), ecx
659684 case 0x558B: // 8B 55 XX : mov XX(%ebp), edx
660685 case 0x758B: // 8B 75 XX : mov XX(%ebp), esp
lib/libtsan/sanitizer_common/sanitizer_allocator.cpp+3-2
......@@ -109,14 +109,15 @@ void *InternalReallocArray(void *addr, uptr count, uptr size,
109109 return InternalRealloc(addr, count * size, cache);
110110}
111111
112void *InternalCalloc(uptr count, uptr size, InternalAllocatorCache *cache) {
112void* InternalCalloc(uptr count, uptr size, InternalAllocatorCache* cache,
113 uptr alignment) {
113114 if (UNLIKELY(CheckForCallocOverflow(count, size))) {
114115 Report("FATAL: %s: calloc parameters overflow: count * size (%zd * %zd) "
115116 "cannot be represented in type size_t\n", SanitizerToolName, count,
116117 size);
117118 Die();
118119 }
119 void *p = InternalAlloc(count * size, cache);
120 void* p = InternalAlloc(count * size, cache, alignment);
120121 if (LIKELY(p))
121122 internal_memset(p, 0, count * size);
122123 return p;
lib/libtsan/sanitizer_common/sanitizer_allocator.h-6
......@@ -47,12 +47,6 @@ void PrintHintAllocatorCannotReturnNull();
4747// Callback type for iterating over chunks.
4848typedef void (*ForEachChunkCallback)(uptr chunk, void *arg);
4949
50inline u32 Rand(u32 *state) { // ANSI C linear congruential PRNG.
51 return (*state = *state * 1103515245 + 12345) >> 16;
52}
53
54inline u32 RandN(u32 *state, u32 n) { return Rand(state) % n; } // [0, n)
55
5650template<typename T>
5751inline void RandomShuffle(T *a, u32 n, u32 *rand_state) {
5852 if (n <= 1) return;
lib/libtsan/sanitizer_common/sanitizer_allocator_dlsym.h+5-5
......@@ -40,8 +40,8 @@ struct DlSymAllocator {
4040 return ptr;
4141 }
4242
43 static void *Callocate(usize nmemb, usize size) {
44 void *ptr = InternalCalloc(nmemb, size);
43 static void* Callocate(usize nmemb, usize size, uptr align = kWordSize) {
44 void* ptr = InternalCalloc(nmemb, size, nullptr, align);
4545 CHECK(internal_allocator()->FromPrimary(ptr));
4646 Details::OnAllocate(ptr, GetSize(ptr));
4747 return ptr;
......@@ -53,9 +53,9 @@ struct DlSymAllocator {
5353 InternalFree(ptr);
5454 }
5555
56 static void *Realloc(void *ptr, uptr new_size) {
56 static void* Realloc(void* ptr, uptr new_size, uptr align = kWordSize) {
5757 if (!ptr)
58 return Allocate(new_size);
58 return Allocate(new_size, align);
5959 CHECK(internal_allocator()->FromPrimary(ptr));
6060 if (!new_size) {
6161 Free(ptr);
......@@ -63,7 +63,7 @@ struct DlSymAllocator {
6363 }
6464 uptr size = GetSize(ptr);
6565 uptr memcpy_size = Min(new_size, size);
66 void *new_ptr = Allocate(new_size);
66 void* new_ptr = Allocate(new_size, align);
6767 if (new_ptr)
6868 internal_memcpy(new_ptr, ptr, memcpy_size);
6969 Free(ptr);
lib/libtsan/sanitizer_common/sanitizer_allocator_internal.h+3-2
......@@ -45,8 +45,9 @@ void *InternalRealloc(void *p, uptr size,
4545 InternalAllocatorCache *cache = nullptr);
4646void *InternalReallocArray(void *p, uptr count, uptr size,
4747 InternalAllocatorCache *cache = nullptr);
48void *InternalCalloc(uptr count, uptr size,
49 InternalAllocatorCache *cache = nullptr);
48void* InternalCalloc(uptr count, uptr size,
49 InternalAllocatorCache* cache = nullptr,
50 uptr alignment = 0);
5051void InternalFree(void *p, InternalAllocatorCache *cache = nullptr);
5152void InternalAllocatorLock();
5253void InternalAllocatorUnlock();
lib/libtsan/sanitizer_common/sanitizer_asm.h+4-2
......@@ -61,6 +61,8 @@
6161# define ASM_TAIL_CALL jg
6262#elif defined(__riscv)
6363# define ASM_TAIL_CALL tail
64#elif defined(__hexagon__)
65# define ASM_TAIL_CALL jump
6466#endif
6567
6668// Currently, almost all of the shared libraries rely on the value of
......@@ -103,8 +105,8 @@
103105# define ASM_SIZE(symbol) .size symbol, .-symbol
104106# define ASM_SYMBOL(symbol) symbol
105107# define ASM_SYMBOL_INTERCEPTOR(symbol) symbol
106# if defined(__i386__) || defined(__powerpc__) || defined(__s390__) || \
107 defined(__sparc__)
108# if defined(__i386__) || defined(__powerpc__) || defined(__s390__) || \
109 defined(__sparc__) || defined(__alpha__)
108110// For details, see interception.h
109111# define ASM_WRAPPER_NAME(symbol) __interceptor_##symbol
110112# define ASM_TRAMPOLINE_ALIAS(symbol, name) \
lib/libtsan/sanitizer_common/sanitizer_common.h+19-4
......@@ -387,8 +387,8 @@ void ReportDeadlySignal(const SignalContext &sig, u32 tid,
387387 const void *unwind_context);
388388
389389// Alternative signal stack (POSIX-only).
390void SetAlternateSignalStack();
391void UnsetAlternateSignalStack();
390void* SetAlternateSignalStack();
391void UnsetAlternateSignalStack(void* altstack_base);
392392
393393bool IsSignalHandlerFromSanitizer(int signum);
394394bool SetSignalHandlerFromSanitizer(int signum, bool new_state);
......@@ -906,7 +906,14 @@ class LoadedModule {
906906class ListOfModules {
907907 public:
908908 ListOfModules() : initialized(false) {}
909 ~ListOfModules() { clear(); }
909 ~ListOfModules() {
910 clear();
911 if (initialized)
912 modules_.Destroy();
913 }
914 ListOfModules(const ListOfModules&) = delete;
915 ListOfModules& operator=(const ListOfModules&) = delete;
916
910917 void init();
911918 void fallbackInit(); // Uses fallback init if available, otherwise clears
912919 const LoadedModule *begin() const { return modules_.begin(); }
......@@ -1085,7 +1092,9 @@ struct StackDepotStats {
10851092// indicate that sanitizer allocator should not attempt to release memory to OS.
10861093const s32 kReleaseToOSIntervalNever = -1;
10871094
1088void CheckNoDeepBind(const char *filename, int flag);
1095// Platform hook invoked before dlopen. Performs platform-specific dlopen flag
1096// checks (e.g. RTLD_DEEPBIND on Linux).
1097void OnDlOpen(const char* filename, int flag);
10891098
10901099// Returns the requested amount of random data (up to 256 bytes) that can then
10911100// be used to seed a PRNG. Defaults to blocking like the underlying syscall.
......@@ -1100,6 +1109,12 @@ inline u32 GetNumberOfCPUsCached() {
11001109 return NumberOfCPUsCached;
11011110}
11021111
1112inline u32 Rand(u32* state) { // ANSI C linear congruential PRNG.
1113 return (*state = *state * 1103515245 + 12345) >> 16;
1114}
1115
1116inline u32 RandN(u32* state, u32 n) { return Rand(state) % n; } // [0, n)
1117
11031118} // namespace __sanitizer
11041119
11051120inline void *operator new(__sanitizer::usize size,
lib/libtsan/sanitizer_common/sanitizer_common_interceptors.inc+65-2
......@@ -277,8 +277,11 @@ extern const short *_tolower_tab_;
277277 common_flags()->strict_string_checks ? (internal_strlen(s)) + 1 : (n) )
278278
279279#ifndef COMMON_INTERCEPTOR_DLOPEN
280#define COMMON_INTERCEPTOR_DLOPEN(filename, flag) \
281 ({ CheckNoDeepBind(filename, flag); REAL(dlopen)(filename, flag); })
280# define COMMON_INTERCEPTOR_DLOPEN(filename, flag) \
281 ({ \
282 OnDlOpen(filename, flag); \
283 REAL(dlopen)(filename, flag); \
284 })
282285#endif
283286
284287#ifndef COMMON_INTERCEPTOR_GET_TLS_RANGE
......@@ -1023,6 +1026,25 @@ INTERCEPTOR(SSIZE_T, read, int fd, void *ptr, SIZE_T count) {
10231026#define INIT_READ
10241027#endif
10251028
1029#if SANITIZER_INTERCEPT___READ_CHK
1030INTERCEPTOR(SSIZE_T, __read_chk, int fd, void* ptr, SIZE_T count,
1031 SIZE_T buflen) {
1032 void* ctx;
1033 COMMON_INTERCEPTOR_ENTER(ctx, __read_chk, fd, ptr, count, buflen);
1034 COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
1035 SSIZE_T res =
1036 COMMON_INTERCEPTOR_BLOCK_REAL(__read_chk)(fd, ptr, count, buflen);
1037 if (res > 0)
1038 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1039 if (res >= 0 && fd >= 0)
1040 COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1041 return res;
1042}
1043# define INIT___READ_CHK COMMON_INTERCEPT_FUNCTION(__read_chk)
1044#else
1045# define INIT___READ_CHK
1046#endif
1047
10261048#if SANITIZER_INTERCEPT_FREAD
10271049INTERCEPTOR(SIZE_T, fread, void *ptr, SIZE_T size, SIZE_T nmemb, void *file) {
10281050 // libc file streams can call user-supplied functions, see fopencookie.
......@@ -1058,6 +1080,25 @@ INTERCEPTOR(SSIZE_T, pread, int fd, void *ptr, SIZE_T count, OFF_T offset) {
10581080#define INIT_PREAD
10591081#endif
10601082
1083#if SANITIZER_INTERCEPT___PREAD_CHK
1084INTERCEPTOR(SSIZE_T, __pread_chk, int fd, void* ptr, SIZE_T count, OFF_T offset,
1085 SIZE_T buflen) {
1086 void* ctx;
1087 COMMON_INTERCEPTOR_ENTER(ctx, __pread_chk, fd, ptr, count, offset, buflen);
1088 COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
1089 SSIZE_T res = COMMON_INTERCEPTOR_BLOCK_REAL(__pread_chk)(fd, ptr, count,
1090 offset, buflen);
1091 if (res > 0)
1092 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1093 if (res >= 0 && fd >= 0)
1094 COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1095 return res;
1096}
1097# define INIT___PREAD_CHK COMMON_INTERCEPT_FUNCTION(__pread_chk)
1098#else
1099# define INIT___PREAD_CHK
1100#endif
1101
10611102#if SANITIZER_INTERCEPT_PREAD64
10621103INTERCEPTOR(SSIZE_T, pread64, int fd, void *ptr, SIZE_T count, OFF64_T offset) {
10631104 void *ctx;
......@@ -1076,6 +1117,25 @@ INTERCEPTOR(SSIZE_T, pread64, int fd, void *ptr, SIZE_T count, OFF64_T offset) {
10761117#define INIT_PREAD64
10771118#endif
10781119
1120#if SANITIZER_INTERCEPT___PREAD64_CHK
1121INTERCEPTOR(SSIZE_T, __pread64_chk, int fd, void* ptr, SIZE_T count,
1122 OFF64_T offset, SIZE_T buflen) {
1123 void* ctx;
1124 COMMON_INTERCEPTOR_ENTER(ctx, __pread64_chk, fd, ptr, count, offset, buflen);
1125 COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
1126 SSIZE_T res = COMMON_INTERCEPTOR_BLOCK_REAL(__pread64_chk)(fd, ptr, count,
1127 offset, buflen);
1128 if (res > 0)
1129 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1130 if (res >= 0 && fd >= 0)
1131 COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1132 return res;
1133}
1134# define INIT___PREAD64_CHK COMMON_INTERCEPT_FUNCTION(__pread64_chk)
1135#else
1136# define INIT___PREAD64_CHK
1137#endif
1138
10791139#if SANITIZER_INTERCEPT_READV
10801140INTERCEPTOR_WITH_SUFFIX(SSIZE_T, readv, int fd, __sanitizer_iovec *iov,
10811141 int iovcnt) {
......@@ -10428,9 +10488,12 @@ static void InitializeCommonInterceptors() {
1042810488 INIT_MEMRCHR;
1042910489 INIT_MEMMEM;
1043010490 INIT_READ;
10491 INIT___READ_CHK;
1043110492 INIT_FREAD;
1043210493 INIT_PREAD;
10494 INIT___PREAD_CHK;
1043310495 INIT_PREAD64;
10496 INIT___PREAD64_CHK;
1043410497 INIT_READV;
1043510498 INIT_PREADV;
1043610499 INIT_PREADV64;
lib/libtsan/sanitizer_common/sanitizer_common_interface.inc-1
......@@ -10,7 +10,6 @@
1010INTERFACE_FUNCTION(__sanitizer_acquire_crash_state)
1111INTERFACE_FUNCTION(__sanitizer_annotate_contiguous_container)
1212INTERFACE_FUNCTION(__sanitizer_annotate_double_ended_contiguous_container)
13INTERFACE_FUNCTION(__sanitizer_copy_contiguous_container_annotations)
1413INTERFACE_FUNCTION(__sanitizer_contiguous_container_find_bad_address)
1514INTERFACE_FUNCTION(
1615 __sanitizer_double_ended_contiguous_container_find_bad_address)
lib/libtsan/sanitizer_common/sanitizer_dense_map.h+57-95
......@@ -44,10 +44,10 @@ class DenseMapBase {
4444 }
4545
4646 void clear() {
47 if (getNumEntries() == 0 && getNumTombstones() == 0)
47 if (getNumEntries() == 0)
4848 return;
4949
50 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
50 const KeyT EmptyKey = getEmptyKey();
5151 if (__sanitizer::is_trivially_destructible<ValueT>::value) {
5252 // Use a simpler loop when values don't need destruction.
5353 for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P)
......@@ -56,17 +56,14 @@ class DenseMapBase {
5656 unsigned NumEntries = getNumEntries();
5757 for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
5858 if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey)) {
59 if (!KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) {
60 P->getSecond().~ValueT();
61 --NumEntries;
62 }
59 P->getSecond().~ValueT();
60 --NumEntries;
6361 P->getFirst() = EmptyKey;
6462 }
6563 }
6664 CHECK_EQ(NumEntries, 0);
6765 }
6866 setNumEntries(0);
69 setNumTombstones(0);
7067 }
7168
7269 /// Return true if the specified key is in the map, false otherwise.
......@@ -171,20 +168,13 @@ class DenseMapBase {
171168 if (!TheBucket)
172169 return false; // not in map.
173170
174 TheBucket->getSecond().~ValueT();
175 TheBucket->getFirst() = getTombstoneKey();
176 decrementNumEntries();
177 incrementNumTombstones();
171 eraseFromFilledBucket(TheBucket);
178172 return true;
179173 }
180174
181175 void erase(value_type *I) {
182176 CHECK_NE(I, nullptr);
183 BucketT *TheBucket = &*I;
184 TheBucket->getSecond().~ValueT();
185 TheBucket->getFirst() = getTombstoneKey();
186 decrementNumEntries();
187 incrementNumTombstones();
177 eraseFromFilledBucket(I);
188178 }
189179
190180 value_type &FindAndConstruct(const KeyT &Key) {
......@@ -214,11 +204,10 @@ class DenseMapBase {
214204 /// Function can return fast to stop the process.
215205 template <class Fn>
216206 void forEach(Fn fn) {
217 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
207 const KeyT EmptyKey = getEmptyKey();
218208 for (auto *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
219209 const KeyT K = P->getFirst();
220 if (!KeyInfoT::isEqual(K, EmptyKey) &&
221 !KeyInfoT::isEqual(K, TombstoneKey)) {
210 if (!KeyInfoT::isEqual(K, EmptyKey)) {
222211 if (!fn(*P))
223212 return;
224213 }
......@@ -238,10 +227,9 @@ class DenseMapBase {
238227 if (getNumBuckets() == 0) // Nothing to do.
239228 return;
240229
241 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
230 const KeyT EmptyKey = getEmptyKey();
242231 for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) {
243 if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey) &&
244 !KeyInfoT::isEqual(P->getFirst(), TombstoneKey))
232 if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey))
245233 P->getSecond().~ValueT();
246234 P->getFirst().~KeyT();
247235 }
......@@ -249,7 +237,6 @@ class DenseMapBase {
249237
250238 void initEmpty() {
251239 setNumEntries(0);
252 setNumTombstones(0);
253240
254241 CHECK_EQ((getNumBuckets() & (getNumBuckets() - 1)), 0);
255242 const KeyT EmptyKey = getEmptyKey();
......@@ -273,10 +260,8 @@ class DenseMapBase {
273260
274261 // Insert all the old elements.
275262 const KeyT EmptyKey = getEmptyKey();
276 const KeyT TombstoneKey = getTombstoneKey();
277263 for (BucketT *B = OldBucketsBegin, *E = OldBucketsEnd; B != E; ++B) {
278 if (!KeyInfoT::isEqual(B->getFirst(), EmptyKey) &&
279 !KeyInfoT::isEqual(B->getFirst(), TombstoneKey)) {
264 if (!KeyInfoT::isEqual(B->getFirst(), EmptyKey)) {
280265 // Insert the key/value into the new table.
281266 BucketT *DestBucket;
282267 bool FoundVal = LookupBucketFor(B->getFirst(), DestBucket);
......@@ -301,7 +286,6 @@ class DenseMapBase {
301286 CHECK_EQ(getNumBuckets(), other.getNumBuckets());
302287
303288 setNumEntries(other.getNumEntries());
304 setNumTombstones(other.getNumTombstones());
305289
306290 if (__sanitizer::is_trivially_copyable<KeyT>::value &&
307291 __sanitizer::is_trivially_copyable<ValueT>::value)
......@@ -311,8 +295,7 @@ class DenseMapBase {
311295 for (uptr i = 0; i < getNumBuckets(); ++i) {
312296 ::new (&getBuckets()[i].getFirst())
313297 KeyT(other.getBuckets()[i].getFirst());
314 if (!KeyInfoT::isEqual(getBuckets()[i].getFirst(), getEmptyKey()) &&
315 !KeyInfoT::isEqual(getBuckets()[i].getFirst(), getTombstoneKey()))
298 if (!KeyInfoT::isEqual(getBuckets()[i].getFirst(), getEmptyKey()))
316299 ::new (&getBuckets()[i].getSecond())
317300 ValueT(other.getBuckets()[i].getSecond());
318301 }
......@@ -329,9 +312,40 @@ class DenseMapBase {
329312
330313 static const KeyT getEmptyKey() { return KeyInfoT::getEmptyKey(); }
331314
332 static const KeyT getTombstoneKey() { return KeyInfoT::getTombstoneKey(); }
333
334315 private:
316 /// Erase the entry at \p TheBucket and close the resulting hole via Knuth
317 /// TAOCP 6.4 Algorithm R: walk forward over the cluster, shifting back any
318 /// entry whose linear-probe chain from its home bucket passes through the
319 /// hole, until an empty bucket terminates the cluster.
320 void eraseFromFilledBucket(BucketT* TheBucket) {
321 TheBucket->getSecond().~ValueT();
322 decrementNumEntries();
323
324 BucketT* BucketsPtr = getBuckets();
325 const unsigned NumBuckets = getNumBuckets();
326 const unsigned Mask = NumBuckets - 1;
327 const KeyT EmptyKey = getEmptyKey();
328 unsigned I = static_cast<unsigned>(TheBucket - BucketsPtr);
329 unsigned J = I;
330 while (true) {
331 J = (J + 1) & Mask;
332 BucketT& BJ = BucketsPtr[J];
333 if (KeyInfoT::isEqual(BJ.getFirst(), EmptyKey))
334 break;
335 unsigned Ideal = getHashValue(BJ.getFirst()) & Mask;
336 // If the hole (I) lies on the linear-probe chain from the home bucket
337 // (Ideal) to J, shift J into the hole and make J the new hole.
338 if (((I - Ideal) & Mask) < ((J - Ideal) & Mask)) {
339 BucketT& BI = BucketsPtr[I];
340 BI.getFirst() = __sanitizer::move(BJ.getFirst());
341 ::new (&BI.getSecond()) ValueT(__sanitizer::move(BJ.getSecond()));
342 BJ.getSecond().~ValueT();
343 I = J;
344 }
345 }
346 BucketsPtr[I].getFirst() = EmptyKey;
347 }
348
335349 unsigned getNumEntries() const {
336350 return static_cast<const DerivedT *>(this)->getNumEntries();
337351 }
......@@ -344,18 +358,6 @@ class DenseMapBase {
344358
345359 void decrementNumEntries() { setNumEntries(getNumEntries() - 1); }
346360
347 unsigned getNumTombstones() const {
348 return static_cast<const DerivedT *>(this)->getNumTombstones();
349 }
350
351 void setNumTombstones(unsigned Num) {
352 static_cast<DerivedT *>(this)->setNumTombstones(Num);
353 }
354
355 void incrementNumTombstones() { setNumTombstones(getNumTombstones() + 1); }
356
357 void decrementNumTombstones() { setNumTombstones(getNumTombstones() - 1); }
358
359361 const BucketT *getBuckets() const {
360362 return static_cast<const DerivedT *>(this)->getBuckets();
361363 }
......@@ -398,25 +400,16 @@ class DenseMapBase {
398400 template <typename LookupKeyT>
399401 BucketT *InsertIntoBucketImpl(const KeyT &Key, const LookupKeyT &Lookup,
400402 BucketT *TheBucket) {
401 // If the load of the hash table is more than 3/4, or if fewer than 1/8 of
402 // the buckets are empty (meaning that many are filled with tombstones),
403 // grow the table.
404 //
405 // The later case is tricky. For example, if we had one empty bucket with
406 // tons of tombstones, failing lookups (e.g. for insertion) would have to
407 // probe almost the entire table until it found the empty bucket. If the
408 // table completely filled with tombstones, no lookup would ever succeed,
409 // causing infinite loops in lookup.
403 // Grow the table if the load factor would exceed 3/4 after insertion.
404 // Linear probing with gap-closing deletion (Knuth Algorithm R) keeps every
405 // chain compact and bounded by the table's empty-bucket count, so no
406 // tombstone-driven resize is needed.
410407 unsigned NewNumEntries = getNumEntries() + 1;
411408 unsigned NumBuckets = getNumBuckets();
412409 if (UNLIKELY(NewNumEntries * 4 >= NumBuckets * 3)) {
413410 this->grow(NumBuckets * 2);
414411 LookupBucketFor(Lookup, TheBucket);
415412 NumBuckets = getNumBuckets();
416 } else if (UNLIKELY(NumBuckets - (NewNumEntries + getNumTombstones()) <=
417 NumBuckets / 8)) {
418 this->grow(NumBuckets);
419 LookupBucketFor(Lookup, TheBucket);
420413 }
421414 CHECK(TheBucket);
422415
......@@ -424,11 +417,6 @@ class DenseMapBase {
424417 // so that when growing buckets we have self-consistent entry count.
425418 incrementNumEntries();
426419
427 // If we are writing over a tombstone, remember this.
428 const KeyT EmptyKey = getEmptyKey();
429 if (!KeyInfoT::isEqual(TheBucket->getFirst(), EmptyKey))
430 decrementNumTombstones();
431
432420 return TheBucket;
433421 }
434422
......@@ -441,7 +429,6 @@ class DenseMapBase {
441429
442430 const KeyT EmptyKey = getEmptyKey();
443431 unsigned BucketNo = getHashValue(Val) & (NumBuckets - 1);
444 unsigned ProbeAmt = 1;
445432 while (true) {
446433 BucketT *Bucket = BucketsPtr + BucketNo;
447434 if (LIKELY(KeyInfoT::isEqual(Val, Bucket->getFirst())))
......@@ -449,10 +436,8 @@ class DenseMapBase {
449436 if (LIKELY(KeyInfoT::isEqual(Bucket->getFirst(), EmptyKey)))
450437 return nullptr;
451438
452 // Otherwise, it's a hash collision or a tombstone, continue quadratic
453 // probing.
454 BucketNo += ProbeAmt++;
455 BucketNo &= NumBuckets - 1;
439 // Hash collision: continue linear probing.
440 BucketNo = (BucketNo + 1) & (NumBuckets - 1);
456441 }
457442 }
458443
......@@ -463,8 +448,8 @@ class DenseMapBase {
463448
464449 /// LookupBucketFor - Lookup the appropriate bucket for Val, returning it in
465450 /// FoundBucket. If the bucket contains the key and a value, this returns
466 /// true, otherwise it returns a bucket with an empty marker or tombstone and
467 /// returns false.
451 /// true, otherwise it returns a bucket with an empty marker and returns
452 /// false.
468453 template <typename LookupKeyT>
469454 bool LookupBucketFor(const LookupKeyT &Val,
470455 const BucketT *&FoundBucket) const {
......@@ -476,15 +461,10 @@ class DenseMapBase {
476461 return false;
477462 }
478463
479 // FoundTombstone - Keep track of whether we find a tombstone while probing.
480 const BucketT *FoundTombstone = nullptr;
481464 const KeyT EmptyKey = getEmptyKey();
482 const KeyT TombstoneKey = getTombstoneKey();
483465 CHECK(!KeyInfoT::isEqual(Val, EmptyKey));
484 CHECK(!KeyInfoT::isEqual(Val, TombstoneKey));
485466
486467 unsigned BucketNo = getHashValue(Val) & (NumBuckets - 1);
487 unsigned ProbeAmt = 1;
488468 while (true) {
489469 const BucketT *ThisBucket = BucketsPtr + BucketNo;
490470 // Found Val's bucket? If so, return it.
......@@ -494,24 +474,14 @@ class DenseMapBase {
494474 }
495475
496476 // If we found an empty bucket, the key doesn't exist in the set.
497 // Insert it and return the default value.
477 // Return it as the insertion point.
498478 if (LIKELY(KeyInfoT::isEqual(ThisBucket->getFirst(), EmptyKey))) {
499 // If we've already seen a tombstone while probing, fill it in instead
500 // of the empty bucket we eventually probed to.
501 FoundBucket = FoundTombstone ? FoundTombstone : ThisBucket;
479 FoundBucket = ThisBucket;
502480 return false;
503481 }
504482
505 // If this is a tombstone, remember it. If Val ends up not in the map, we
506 // prefer to return it than something that would require more probing.
507 if (KeyInfoT::isEqual(ThisBucket->getFirst(), TombstoneKey) &&
508 !FoundTombstone)
509 FoundTombstone = ThisBucket; // Remember the first tombstone found.
510
511 // Otherwise, it's a hash collision or a tombstone, continue quadratic
512 // probing.
513 BucketNo += ProbeAmt++;
514 BucketNo &= (NumBuckets - 1);
483 // Hash collision: continue linear probing.
484 BucketNo = (BucketNo + 1) & (NumBuckets - 1);
515485 }
516486 }
517487
......@@ -587,7 +557,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
587557
588558 BucketT *Buckets = nullptr;
589559 unsigned NumEntries = 0;
590 unsigned NumTombstones = 0;
591560 unsigned NumBuckets = 0;
592561
593562 public:
......@@ -614,7 +583,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
614583 void swap(DenseMap &RHS) {
615584 Swap(Buckets, RHS.Buckets);
616585 Swap(NumEntries, RHS.NumEntries);
617 Swap(NumTombstones, RHS.NumTombstones);
618586 Swap(NumBuckets, RHS.NumBuckets);
619587 }
620588
......@@ -639,7 +607,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
639607 this->BaseT::copyFrom(other);
640608 } else {
641609 NumEntries = 0;
642 NumTombstones = 0;
643610 }
644611 }
645612
......@@ -649,7 +616,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
649616 this->BaseT::initEmpty();
650617 } else {
651618 NumEntries = 0;
652 NumTombstones = 0;
653619 }
654620 }
655621
......@@ -675,10 +641,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
675641
676642 void setNumEntries(unsigned Num) { NumEntries = Num; }
677643
678 unsigned getNumTombstones() const { return NumTombstones; }
679
680 void setNumTombstones(unsigned Num) { NumTombstones = Num; }
681
682644 BucketT *getBuckets() const { return Buckets; }
683645
684646 unsigned getNumBuckets() const { return NumBuckets; }
lib/libtsan/sanitizer_common/sanitizer_dense_map_info.h-25
......@@ -62,7 +62,6 @@ struct DenseMapPair {
6262template <typename T>
6363struct DenseMapInfo {
6464 // static T getEmptyKey();
65 // static T getTombstoneKey();
6665 // static unsigned getHashValue(const T &Val);
6766 // static bool isEqual(const T &LHS, const T &RHS);
6867};
......@@ -86,12 +85,6 @@ struct DenseMapInfo<T *> {
8685 return reinterpret_cast<T *>(Val);
8786 }
8887
89 static constexpr T *getTombstoneKey() {
90 uptr Val = static_cast<uptr>(-2);
91 Val <<= Log2MaxAlign;
92 return reinterpret_cast<T *>(Val);
93 }
94
9588 static constexpr unsigned getHashValue(const T *PtrVal) {
9689 return (unsigned((uptr)PtrVal) >> 4) ^ (unsigned((uptr)PtrVal) >> 9);
9790 }
......@@ -105,7 +98,6 @@ struct DenseMapInfo<T *> {
10598template <>
10699struct DenseMapInfo<char> {
107100 static constexpr char getEmptyKey() { return ~0; }
108 static constexpr char getTombstoneKey() { return ~0 - 1; }
109101 static constexpr unsigned getHashValue(const char &Val) { return Val * 37U; }
110102
111103 static constexpr bool isEqual(const char &LHS, const char &RHS) {
......@@ -117,7 +109,6 @@ struct DenseMapInfo<char> {
117109template <>
118110struct DenseMapInfo<unsigned char> {
119111 static constexpr unsigned char getEmptyKey() { return ~0; }
120 static constexpr unsigned char getTombstoneKey() { return ~0 - 1; }
121112 static constexpr unsigned getHashValue(const unsigned char &Val) {
122113 return Val * 37U;
123114 }
......@@ -132,7 +123,6 @@ struct DenseMapInfo<unsigned char> {
132123template <>
133124struct DenseMapInfo<unsigned short> {
134125 static constexpr unsigned short getEmptyKey() { return 0xFFFF; }
135 static constexpr unsigned short getTombstoneKey() { return 0xFFFF - 1; }
136126 static constexpr unsigned getHashValue(const unsigned short &Val) {
137127 return Val * 37U;
138128 }
......@@ -147,7 +137,6 @@ struct DenseMapInfo<unsigned short> {
147137template <>
148138struct DenseMapInfo<unsigned> {
149139 static constexpr unsigned getEmptyKey() { return ~0U; }
150 static constexpr unsigned getTombstoneKey() { return ~0U - 1; }
151140 static constexpr unsigned getHashValue(const unsigned &Val) {
152141 return Val * 37U;
153142 }
......@@ -161,7 +150,6 @@ struct DenseMapInfo<unsigned> {
161150template <>
162151struct DenseMapInfo<unsigned long> {
163152 static constexpr unsigned long getEmptyKey() { return ~0UL; }
164 static constexpr unsigned long getTombstoneKey() { return ~0UL - 1L; }
165153
166154 static constexpr unsigned getHashValue(const unsigned long &Val) {
167155 return (unsigned)(Val * 37UL);
......@@ -177,7 +165,6 @@ struct DenseMapInfo<unsigned long> {
177165template <>
178166struct DenseMapInfo<unsigned long long> {
179167 static constexpr unsigned long long getEmptyKey() { return ~0ULL; }
180 static constexpr unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; }
181168
182169 static constexpr unsigned getHashValue(const unsigned long long &Val) {
183170 return (unsigned)(Val * 37ULL);
......@@ -193,7 +180,6 @@ struct DenseMapInfo<unsigned long long> {
193180template <>
194181struct DenseMapInfo<short> {
195182 static constexpr short getEmptyKey() { return 0x7FFF; }
196 static constexpr short getTombstoneKey() { return -0x7FFF - 1; }
197183 static constexpr unsigned getHashValue(const short &Val) { return Val * 37U; }
198184 static constexpr bool isEqual(const short &LHS, const short &RHS) {
199185 return LHS == RHS;
......@@ -204,7 +190,6 @@ struct DenseMapInfo<short> {
204190template <>
205191struct DenseMapInfo<int> {
206192 static constexpr int getEmptyKey() { return 0x7fffffff; }
207 static constexpr int getTombstoneKey() { return -0x7fffffff - 1; }
208193 static constexpr unsigned getHashValue(const int &Val) {
209194 return (unsigned)(Val * 37U);
210195 }
......@@ -221,8 +206,6 @@ struct DenseMapInfo<long> {
221206 return (1UL << (sizeof(long) * 8 - 1)) - 1UL;
222207 }
223208
224 static constexpr long getTombstoneKey() { return getEmptyKey() - 1L; }
225
226209 static constexpr unsigned getHashValue(const long &Val) {
227210 return (unsigned)(Val * 37UL);
228211 }
......@@ -236,9 +219,6 @@ struct DenseMapInfo<long> {
236219template <>
237220struct DenseMapInfo<long long> {
238221 static constexpr long long getEmptyKey() { return 0x7fffffffffffffffLL; }
239 static constexpr long long getTombstoneKey() {
240 return -0x7fffffffffffffffLL - 1;
241 }
242222
243223 static constexpr unsigned getHashValue(const long long &Val) {
244224 return (unsigned)(Val * 37ULL);
......@@ -261,11 +241,6 @@ struct DenseMapInfo<detail::DenseMapPair<T, U>> {
261241 SecondInfo::getEmptyKey());
262242 }
263243
264 static constexpr Pair getTombstoneKey() {
265 return detail::DenseMapPair<T, U>(FirstInfo::getTombstoneKey(),
266 SecondInfo::getTombstoneKey());
267 }
268
269244 static constexpr unsigned getHashValue(const Pair &PairVal) {
270245 return detail::combineHashValue(FirstInfo::getHashValue(PairVal.first),
271246 SecondInfo::getHashValue(PairVal.second));
lib/libtsan/sanitizer_common/sanitizer_errno.h+2
......@@ -31,6 +31,8 @@
3131# define __errno_location _errno
3232#elif SANITIZER_HAIKU
3333# define __errno_location _errnop
34#elif SANITIZER_AIX
35# define __errno_location _Errno
3436#endif
3537
3638extern "C" int *__errno_location();
lib/libtsan/sanitizer_common/sanitizer_flag_parser.h+2-2
......@@ -189,8 +189,8 @@ class FlagParser {
189189};
190190
191191template <typename T>
192static void RegisterFlag(FlagParser *parser, const char *name, const char *desc,
193 T *var) {
192void RegisterFlag(FlagParser* parser, const char* name, const char* desc,
193 T* var) {
194194 FlagHandler<T> *fh = new (GetGlobalLowLevelAllocator()) FlagHandler<T>(var);
195195 parser->RegisterHandler(name, fh, desc);
196196}
lib/libtsan/sanitizer_common/sanitizer_fuchsia.cpp+2-2
......@@ -93,8 +93,8 @@ void CheckMPROTECT() {}
9393void PlatformPrepareForSandboxing(void *args) {}
9494void DisableCoreDumperIfNecessary() {}
9595void InstallDeadlySignalHandlers(SignalHandlerType handler) {}
96void SetAlternateSignalStack() {}
97void UnsetAlternateSignalStack() {}
96void* SetAlternateSignalStack() { return nullptr; }
97void UnsetAlternateSignalStack(void* altstack_base) {}
9898
9999bool SignalContext::IsStackOverflow() const { return false; }
100100void SignalContext::DumpAllRegisters(void *context) { UNIMPLEMENTED(); }
lib/libtsan/sanitizer_common/sanitizer_haiku.cpp+4
......@@ -128,6 +128,10 @@ uptr internal_close(fd_t fd) {
128128 RETURN_AND_SET_ERRNO(_kern_close(fd));
129129}
130130
131uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags) {
132 return -1; // Not supported.
133}
134
131135uptr internal_open(const char *filename, int flags) {
132136 CHECK(&_kern_open);
133137 RETURN_AND_SET_ERRNO(_kern_open(-1, filename, flags, 0));
lib/libtsan/sanitizer_common/sanitizer_interface_internal.h-5
......@@ -76,11 +76,6 @@ void __sanitizer_annotate_double_ended_contiguous_container(
7676 const void *old_container_beg, const void *old_container_end,
7777 const void *new_container_beg, const void *new_container_end);
7878SANITIZER_INTERFACE_ATTRIBUTE
79void __sanitizer_copy_contiguous_container_annotations(const void *src_begin,
80 const void *src_end,
81 const void *dst_begin,
82 const void *dst_end);
83SANITIZER_INTERFACE_ATTRIBUTE
8479int __sanitizer_verify_contiguous_container(const void *beg, const void *mid,
8580 const void *end);
8681SANITIZER_INTERFACE_ATTRIBUTE
lib/libtsan/sanitizer_common/sanitizer_internal_defs.h+16-12
......@@ -29,20 +29,24 @@
2929
3030// Only use SANITIZER_*ATTRIBUTE* before the function return type!
3131#if SANITIZER_WINDOWS
32#if SANITIZER_IMPORT_INTERFACE
33# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllimport)
34#else
35# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)
36#endif
37# define SANITIZER_WEAK_ATTRIBUTE
38# define SANITIZER_WEAK_IMPORT
39#elif SANITIZER_GO
40# define SANITIZER_INTERFACE_ATTRIBUTE
41# define SANITIZER_WEAK_ATTRIBUTE
32# if SANITIZER_IMPORT_INTERFACE
33# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllimport)
34# else
35# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)
36# endif
37# define SANITIZER_WEAK_ATTRIBUTE
4238# define SANITIZER_WEAK_IMPORT
4339#else
44# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
45# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
40# if SANITIZER_GO
41# define SANITIZER_INTERFACE_ATTRIBUTE
42# define SANITIZER_WEAK_ATTRIBUTE
43# elif SANITIZER_AMDGPU || SANITIZER_NVPTX
44# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("hidden")))
45# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
46# else
47# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
48# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
49# endif // SANITIZER_GO
4650# if SANITIZER_APPLE
4751# define SANITIZER_WEAK_IMPORT extern "C" __attribute((weak_import))
4852# else
lib/libtsan/sanitizer_common/sanitizer_linux.cpp+81-12
......@@ -90,10 +90,18 @@
9090extern "C" SANITIZER_WEAK_ATTRIBUTE const char *strerrorname_np(int);
9191# endif
9292
93# if SANITIZER_LINUX && defined(__loongarch__)
93# if SANITIZER_LINUX && \
94 (defined(__loongarch__) || defined(__hexagon__) || defined(__alpha__))
9495# include <sys/sysmacros.h>
9596# endif
9697
98// Hexagon uses statx() instead of stat64(). glibc provides struct statx
99// through <sys/stat.h>, but musl does not — pull it from <linux/stat.h>.
100// On this musl/hexagon combination the two headers coexist without conflict.
101# if SANITIZER_LINUX && defined(__hexagon__)
102# include <linux/stat.h>
103# endif
104
97105# if SANITIZER_LINUX && defined(__powerpc64__)
98106# include <asm/ptrace.h>
99107# endif
......@@ -254,6 +262,8 @@ ScopedBlockSignals::~ScopedBlockSignals() { SetSigProcMask(&saved_, nullptr); }
254262# include "sanitizer_syscall_linux_hexagon.inc"
255263# elif SANITIZER_LINUX && SANITIZER_LOONGARCH64
256264# include "sanitizer_syscall_linux_loongarch64.inc"
265# elif SANITIZER_LINUX && SANITIZER_ALPHA
266# include "sanitizer_syscall_linux_alpha.inc"
257267# else
258268# include "sanitizer_syscall_generic.inc"
259269# endif
......@@ -296,11 +306,13 @@ int internal_madvise(uptr addr, uptr length, int advice) {
296306 return internal_syscall(SYSCALL(madvise), addr, length, advice);
297307}
298308
299# if SANITIZER_FREEBSD
300309uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags) {
310# if SANITIZER_FREEBSD || (SANITIZER_LINUX && defined(__NR_close_range))
301311 return internal_syscall(SYSCALL(close_range), lowfd, highfd, flags);
302}
303312# endif
313 return -1; // Not supported.
314}
315
304316uptr internal_close(fd_t fd) { return internal_syscall(SYSCALL(close), fd); }
305317
306318uptr internal_open(const char *filename, int flags) {
......@@ -341,7 +353,8 @@ uptr internal_ftruncate(fd_t fd, uptr size) {
341353 return res;
342354}
343355
344# if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && SANITIZER_LINUX
356# if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && SANITIZER_LINUX && \
357 !defined(__hexagon__)
345358static void stat64_to_stat(struct stat64 *in, struct stat *out) {
346359 internal_memset(out, 0, sizeof(*out));
347360 out->st_dev = in->st_dev;
......@@ -360,7 +373,8 @@ static void stat64_to_stat(struct stat64 *in, struct stat *out) {
360373}
361374# endif
362375
363# if SANITIZER_LINUX && defined(__loongarch__)
376# if SANITIZER_LINUX && \
377 (defined(__loongarch__) || defined(__hexagon__) || defined(__alpha__))
364378static void statx_to_stat(struct statx *in, struct stat *out) {
365379 internal_memset(out, 0, sizeof(*out));
366380 out->st_dev = makedev(in->stx_dev_major, in->stx_dev_minor);
......@@ -440,7 +454,7 @@ uptr internal_stat(const char *path, void *buf) {
440454# if SANITIZER_FREEBSD
441455 return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf, 0);
442456# elif SANITIZER_LINUX
443# if defined(__loongarch__)
457# if defined(__loongarch__) || defined(__hexagon__) || defined(__alpha__)
444458 struct statx bufx;
445459 int res = internal_syscall(SYSCALL(statx), AT_FDCWD, (uptr)path,
446460 AT_NO_AUTOMOUNT, STATX_BASIC_STATS, (uptr)&bufx);
......@@ -478,7 +492,7 @@ uptr internal_lstat(const char *path, void *buf) {
478492 return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
479493 AT_SYMLINK_NOFOLLOW);
480494# elif SANITIZER_LINUX
481# if defined(__loongarch__)
495# if defined(__loongarch__) || defined(__hexagon__) || defined(__alpha__)
482496 struct statx bufx;
483497 int res = internal_syscall(SYSCALL(statx), AT_FDCWD, (uptr)path,
484498 AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT,
......@@ -526,7 +540,7 @@ uptr internal_fstat(fd_t fd, void *buf) {
526540 int res = internal_syscall(SYSCALL(fstat64), fd, &kbuf);
527541 kernel_stat_to_stat(&kbuf, (struct stat *)buf);
528542 return res;
529# elif SANITIZER_LINUX && defined(__loongarch__)
543# elif SANITIZER_LINUX && (defined(__loongarch__) || defined(__alpha__))
530544 struct statx bufx;
531545 int res = internal_syscall(SYSCALL(statx), fd, "", AT_EMPTY_PATH,
532546 STATX_BASIC_STATS, (uptr)&bufx);
......@@ -535,6 +549,13 @@ uptr internal_fstat(fd_t fd, void *buf) {
535549# else
536550 return internal_syscall(SYSCALL(fstat), fd, (uptr)buf);
537551# endif
552# elif SANITIZER_LINUX && defined(__hexagon__)
553 // Hexagon musl lacks struct stat64; use statx() instead.
554 struct statx bufx;
555 int res = internal_syscall(SYSCALL(statx), fd, "", AT_EMPTY_PATH,
556 STATX_BASIC_STATS, (uptr)&bufx);
557 statx_to_stat(&bufx, (struct stat*)buf);
558 return res;
538559# else
539560 struct stat64 buf64;
540561 int res = internal_syscall(SYSCALL(fstat64), fd, &buf64);
......@@ -1003,7 +1024,7 @@ int internal_sigaction_norestorer(int signum, const void *act, void *oldact) {
10031024 // rt_sigaction, so we need to do the same (we'll need to reimplement the
10041025 // restorers; for x86_64 the restorer address can be obtained from
10051026 // oldact->sa_restorer upon a call to sigaction(xxx, NULL, oldact).
1006# if !SANITIZER_ANDROID || !SANITIZER_MIPS32
1027# if (!SANITIZER_ANDROID || !SANITIZER_MIPS32) && !defined(__alpha__)
10071028 k_act.sa_restorer = u_act->sa_restorer;
10081029# endif
10091030 }
......@@ -1019,7 +1040,7 @@ int internal_sigaction_norestorer(int signum, const void *act, void *oldact) {
10191040 internal_memcpy(&u_oldact->sa_mask, &k_oldact.sa_mask,
10201041 sizeof(__sanitizer_kernel_sigset_t));
10211042 u_oldact->sa_flags = k_oldact.sa_flags;
1022# if !SANITIZER_ANDROID || !SANITIZER_MIPS32
1043# if (!SANITIZER_ANDROID || !SANITIZER_MIPS32) && !defined(__alpha__)
10231044 u_oldact->sa_restorer = k_oldact.sa_restorer;
10241045# endif
10251046 }
......@@ -1228,6 +1249,16 @@ uptr GetMaxVirtualAddress() {
12281249 // loongarch64 also has multiple address space layouts: default is 47-bit.
12291250 // RISC-V 64 also has multiple address space layouts: 39, 48 and 57-bit.
12301251 return (1ULL << (MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1)) - 1;
1252# elif SANITIZER_ALPHA
1253 // Linux/Alpha uses a 42-bit user VAS (TASK_SIZE = 0x40000000000). With
1254 // fixed shadow offset 0x10000000000 (1 TiB) the layout is:
1255 // LowMem: [0x000000000000, 0x00ffffffffff] (1 TiB)
1256 // LowShadow: [0x010000000000, 0x011fffffffff] (128 GiB)
1257 // ShadowGap: [0x012000000000, 0x012fffffffff]
1258 // HighShadow:[0x013000000000, 0x017fffffffff] (256 GiB)
1259 // HighMem: [0x018000000000, 0x03ffffffffff] (2.5 TiB, stack near top)
1260 // Capping at TASK_SIZE - 1 avoids treating kernel addresses as HighMem.
1261 return (1ULL << 42) - 1; // TASK_SIZE - 1
12311262# elif SANITIZER_MIPS64
12321263 return (1ULL << 40) - 1; // 0x000000ffffffffffUL;
12331264# elif defined(__s390x__)
......@@ -1894,6 +1925,39 @@ uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
18941925 : "memory");
18951926 return res;
18961927}
1928# elif defined(__hexagon__)
1929uptr internal_clone(int (*fn)(void*), void* child_stack, int flags, void* arg,
1930 int* parent_tidptr, void* newtls, int* child_tidptr) {
1931 if (!fn || !child_stack)
1932 return -EINVAL;
1933 child_stack = (char*)child_stack - 2 * sizeof(unsigned int);
1934 ((unsigned int*)child_stack)[0] = (uptr)fn;
1935 ((unsigned int*)child_stack)[1] = (uptr)arg;
1936
1937 // Hexagon clone syscall uses the generic argument order (no
1938 // CONFIG_CLONE_BACKWARDS): flags, stack, ptid, ctid, tls.
1939 register int r0 __asm__("r0") = flags;
1940 register void* r1 __asm__("r1") = child_stack;
1941 register int* r2 __asm__("r2") = parent_tidptr;
1942 register int* r3 __asm__("r3") = child_tidptr;
1943 register void* r4 __asm__("r4") = newtls;
1944 register int r6 __asm__("r6") = __NR_clone;
1945
1946 __asm__ __volatile__(
1947 "trap0(#1)\n" /* syscall */
1948 "{ p0 = cmp.eq(r0, #0)\n" /* child? */
1949 " if (!p0.new) jump:nt 1f }\n"
1950 "r1 = memw(r29 + #0)\n" /* r1 = fn */
1951 "r0 = memw(r29 + #4)\n" /* r0 = arg */
1952 "callr r1\n" /* fn(arg) */
1953 "r6 = #%7\n" /* __NR_exit */
1954 "trap0(#1)\n"
1955 "1:\n"
1956 : "=r"(r0)
1957 : "0"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r6), "i"(__NR_exit)
1958 : "memory", "p0", "r1", "lr");
1959 return (uptr)r0;
1960}
18971961# endif
18981962# endif // SANITIZER_LINUX
18991963
......@@ -2427,7 +2491,7 @@ static void DumpSingleReg(ucontext_t *ctx, int RegNum) {
24272491# if SANITIZER_LINUX
24282492 ctx->uc_mcontext.gregs[RegNum]
24292493# elif SANITIZER_NETBSD
2430 ctx->uc_mcontext.__gregs[RegNum]
2494 (unsigned long long)ctx->uc_mcontext.__gregs[RegNum]
24312495# endif
24322496 );
24332497# elif defined(__i386__)
......@@ -2729,6 +2793,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
27292793 *pc = ucontext->uc_mcontext.__pc;
27302794 *bp = ucontext->uc_mcontext.__gregs[22];
27312795 *sp = ucontext->uc_mcontext.__gregs[3];
2796# elif defined(__alpha__)
2797 ucontext_t* ucontext = (ucontext_t*)context;
2798 *pc = ucontext->uc_mcontext.sc_pc;
2799 *bp = ucontext->uc_mcontext.sc_regs[15]; // $fp / $s6
2800 *sp = ucontext->uc_mcontext.sc_regs[30]; // $sp
27322801# else
27332802# error "Unsupported arch"
27342803# endif
......@@ -2819,7 +2888,7 @@ void CheckMPROTECT() {
28192888# endif
28202889}
28212890
2822void CheckNoDeepBind(const char *filename, int flag) {
2891void OnDlOpen(const char* filename, int flag) {
28232892# ifdef RTLD_DEEPBIND
28242893 if (flag & RTLD_DEEPBIND) {
28252894 Report(
lib/libtsan/sanitizer_common/sanitizer_linux.h+2-1
......@@ -86,7 +86,8 @@ int internal_sigaction_norestorer(int signum, const void *act, void *oldact);
8686void internal_sigdelset(__sanitizer_sigset_t *set, int signum);
8787# if defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) || \
8888 defined(__powerpc64__) || defined(__s390__) || defined(__i386__) || \
89 defined(__arm__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64
89 defined(__arm__) || defined(__hexagon__) || SANITIZER_RISCV64 || \
90 SANITIZER_LOONGARCH64
9091uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
9192 int *parent_tidptr, void *newtls, int *child_tidptr);
9293# endif
lib/libtsan/sanitizer_common/sanitizer_linux_libcdep.cpp+6-2
......@@ -284,6 +284,10 @@ static uptr ThreadDescriptorSizeFallback() {
284284# if defined(__powerpc64__)
285285 return 1776; // from glibc.ppc64le 2.20-8.fc21
286286# endif
287
288# if defined(__alpha__)
289 return 1824; // from glibc 2.43
290# endif
287291}
288292# endif // SANITIZER_GLIBC && !SANITIZER_GO
289293
......@@ -494,10 +498,10 @@ __attribute__((unused)) static void GetStaticTlsBoundary(uptr *addr, uptr *size,
494498 // loader places static TLS blocks this way not to waste space.
495499 uptr l = one;
496500 *align = ranges[l].align;
497 while (l != 0 && ranges[l].begin < ranges[l - 1].end + ranges[l].align)
501 while (l != 0 && ranges[l].begin <= ranges[l - 1].end + ranges[l].align)
498502 *align = Max(*align, ranges[--l].align);
499503 uptr r = one + 1;
500 while (r != len && ranges[r].begin < ranges[r - 1].end + ranges[r].align)
504 while (r != len && ranges[r].begin <= ranges[r - 1].end + ranges[r].align)
501505 *align = Max(*align, ranges[r++].align);
502506 *addr = ranges[l].begin;
503507 *size = ranges[r - 1].end - ranges[l].begin;
lib/libtsan/sanitizer_common/sanitizer_lzw.h+1-3
......@@ -26,9 +26,7 @@ ItOut LzwEncode(ItIn begin, ItIn end, ItOut out) {
2626
2727 // Sentinel value for substrings of len 1.
2828 static constexpr LzwCodeType kNoPrefix =
29 Min(DenseMapInfo<Substring>::getEmptyKey().first,
30 DenseMapInfo<Substring>::getTombstoneKey().first) -
31 1;
29 DenseMapInfo<Substring>::getEmptyKey().first - 1;
3230 DenseMap<Substring, LzwCodeType> prefix_to_code;
3331 {
3432 // Add all substring of len 1 as initial dictionary.
lib/libtsan/sanitizer_common/sanitizer_mac.cpp+30-2
......@@ -170,6 +170,10 @@ uptr internal_close(fd_t fd) {
170170 return close(fd);
171171}
172172
173uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags) {
174 return -1; // Not supported.
175}
176
173177uptr internal_open(const char *filename, int flags) {
174178 return open(filename, flags);
175179}
......@@ -609,7 +613,13 @@ static uptr ApproximateOSVersionViaKernelVersion(VersStr vers) {
609613 u16 os_major = kernel_major - offset;
610614
611615 const char *format = "%d.0";
612 if (TARGET_OS_OSX) {
616 if (kernel_major >= 27) {
617 // with kernel major 27 <=> OSes 27.0, OS versions are aligned with kernel
618 os_major = kernel_major;
619 } else if (kernel_major >= 25) {
620 // with kernel_major 25 <=> OSes 26.0, OS versions are aligned
621 os_major = kernel_major + 1;
622 } else if (TARGET_OS_OSX) {
613623 if (os_major >= 16) { // macOS 11+
614624 os_major -= 5;
615625 } else { // macOS 10.15 and below
......@@ -666,6 +676,24 @@ static void MapToMacos(u16 *major, u16 *minor) {
666676 if (TARGET_OS_OSX)
667677 return;
668678
679 // All supported platforms (including DriverKit) have
680 // aligned version numbers in macOS 27+
681 if (*major >= 27)
682 return;
683
684# if TARGET_OS_DRIVERKIT
685 // Driverkit 25.0+ aligns with macOS 26+
686 if (*major >= 25) {
687 *major += 1;
688 return;
689 }
690# else
691 // macOS 26 and later have aligned version strings.
692 if (*major >= 26)
693 return;
694# endif
695
696 // Below are mappings for pre-macOS-25-aligned releases
669697 if (TARGET_OS_IOS || TARGET_OS_TV)
670698 *major += 2;
671699 else if (TARGET_OS_WATCH)
......@@ -1529,7 +1557,7 @@ void DumpProcessMap() {
15291557 Printf("End of module map.\n");
15301558}
15311559
1532void CheckNoDeepBind(const char *filename, int flag) {
1560void OnDlOpen(const char* filename, int flag) {
15331561 // Do nothing.
15341562}
15351563
lib/libtsan/sanitizer_common/sanitizer_netbsd.cpp+4
......@@ -126,6 +126,10 @@ uptr internal_close(fd_t fd) {
126126 return _sys_close(fd);
127127}
128128
129uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags) {
130 return -1; // Not supported.
131}
132
129133uptr internal_open(const char *filename, int flags) {
130134 CHECK(&_sys_open);
131135 return _sys_open(filename, flags);
lib/libtsan/sanitizer_common/sanitizer_platform.h+33-2
......@@ -15,7 +15,8 @@
1515#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \
1616 !defined(__APPLE__) && !defined(_WIN32) && !defined(__Fuchsia__) && \
1717 !(defined(__sun__) && defined(__svr4__)) && !defined(__HAIKU__) && \
18 !defined(__wasi__)
18 !defined(__wasi__) && !defined(__NVPTX__) && !defined(__AMDGPU__) && \
19 !defined(__SPIRV__) && !defined(_AIX)
1920# error "This operating system is not supported"
2021#endif
2122
......@@ -32,6 +33,12 @@
3233# define SANITIZER_LINUX 0
3334#endif
3435
36#if defined(_AIX)
37# define SANITIZER_AIX 1
38#else
39# define SANITIZER_AIX 0
40#endif
41
3542#if defined(__GLIBC__)
3643# define SANITIZER_GLIBC 1
3744#else
......@@ -151,7 +158,7 @@
151158
152159#define SANITIZER_POSIX \
153160 (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_APPLE || \
154 SANITIZER_NETBSD || SANITIZER_SOLARIS || SANITIZER_HAIKU)
161 SANITIZER_NETBSD || SANITIZER_SOLARIS || SANITIZER_HAIKU || SANITIZER_AIX)
155162
156163#if __LP64__ || defined(_WIN64)
157164# define SANITIZER_WORDSIZE 64
......@@ -302,6 +309,30 @@
302309# define SANITIZER_LOONGARCH64 0
303310#endif
304311
312#if defined(__alpha__)
313# define SANITIZER_ALPHA 1
314#else
315# define SANITIZER_ALPHA 0
316#endif
317
318#if defined(__AMDGPU__)
319# define SANITIZER_AMDGPU 1
320#else
321# define SANITIZER_AMDGPU 0
322#endif
323
324#if defined(__NVPTX__)
325# define SANITIZER_NVPTX 1
326#else
327# define SANITIZER_NVPTX 0
328#endif
329
330#if defined(__SPIRV__)
331# define SANITIZER_SPIRV 1
332#else
333# define SANITIZER_SPIRV 0
334#endif
335
305336// By default we allow to use SizeClassAllocator64 on 64-bit platform.
306337// But in some cases SizeClassAllocator64 does not work well and we need to
307338// fallback to SizeClassAllocator32.
lib/libtsan/sanitizer_common/sanitizer_platform_interceptors.h+6-1
......@@ -201,6 +201,9 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
201201
202202#define SANITIZER_INTERCEPT_READ SI_POSIX
203203#define SANITIZER_INTERCEPT_PREAD SI_POSIX
204#define SANITIZER_INTERCEPT___READ_CHK SI_GLIBC
205#define SANITIZER_INTERCEPT___PREAD_CHK SI_GLIBC
206#define SANITIZER_INTERCEPT___PREAD64_CHK SI_GLIBC
204207#define SANITIZER_INTERCEPT_WRITE SI_POSIX
205208#define SANITIZER_INTERCEPT_PWRITE SI_POSIX
206209
......@@ -393,6 +396,8 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
393396#define SANITIZER_INTERCEPT_SHMCTL \
394397 (((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64) || \
395398 SI_NETBSD || SI_SOLARIS)
399// shmat calls REAL(shmctl), so it requires shmctl interception.
400#define SANITIZER_INTERCEPT_SHMAT SANITIZER_INTERCEPT_SHMCTL
396401#define SANITIZER_INTERCEPT_RANDOM_R SI_GLIBC
397402#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
398403#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
......@@ -545,7 +550,7 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
545550#define SANITIZER_INTERCEPT___LIBC_MEMALIGN SI_GLIBC
546551#define SANITIZER_INTERCEPT_PVALLOC (SI_GLIBC || SI_ANDROID)
547552#define SANITIZER_INTERCEPT_CFREE (SI_GLIBC && !SANITIZER_RISCV64)
548#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
553#define SANITIZER_INTERCEPT_REALLOCARRAY (SI_POSIX || SI_FUCHSIA)
549554#define SANITIZER_INTERCEPT_ALIGNED_ALLOC \
550555 (!SI_MAC || SI_MAC_SDK_10_15_AVAILABLE)
551556#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
lib/libtsan/sanitizer_common/sanitizer_platform_limits_linux.cpp+1-1
......@@ -60,7 +60,7 @@ using namespace __sanitizer;
6060# if !defined(__powerpc64__) && !defined(__x86_64__) && \
6161 !defined(__aarch64__) && !defined(__mips__) && !defined(__s390__) && \
6262 !defined(__sparc__) && !defined(__riscv) && !defined(__hexagon__) && \
63 !defined(__loongarch__)
63 !defined(__loongarch__) && !defined(__alpha__)
6464COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
6565#endif
6666
lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp+57-25
......@@ -24,7 +24,7 @@
2424// Must go after undef _FILE_OFFSET_BITS.
2525#include "sanitizer_platform.h"
2626
27#if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU
27#if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU || SANITIZER_AIX
2828// Must go after undef _FILE_OFFSET_BITS.
2929#include "sanitizer_glibc_version.h"
3030
......@@ -61,11 +61,11 @@
6161#endif
6262
6363#if !SANITIZER_ANDROID
64#if !SANITIZER_HAIKU
65#include <sys/mount.h>
66#endif
67#include <sys/timeb.h>
68#include <utmpx.h>
64# if !SANITIZER_HAIKU && !SANITIZER_AIX
65# include <sys/mount.h>
66# endif
67# include <sys/timeb.h>
68# include <utmpx.h>
6969#endif
7070
7171#if SANITIZER_LINUX
......@@ -113,11 +113,15 @@ typedef struct user_fpregs elf_fpregset_t;
113113#endif
114114
115115#if !SANITIZER_ANDROID
116#include <ifaddrs.h>
117#if !SANITIZER_HAIKU
118#include <sys/ucontext.h>
119#include <wordexp.h>
120#endif
116# if !SANITIZER_AIX
117# include <ifaddrs.h>
118# else
119# include <netinet/in.h>
120# endif
121# if !SANITIZER_HAIKU
122# include <sys/ucontext.h>
123# include <wordexp.h>
124# endif
121125#endif
122126
123127#if SANITIZER_LINUX
......@@ -182,6 +186,17 @@ typedef struct user_fpregs elf_fpregset_t;
182186#include <sys/ioctl.h>
183187#endif
184188
189# if SANITIZER_AIX
190# include <netinet/ip_mroute.h>
191# include <stropts.h>
192# include <sys/ioctl.h>
193# include <sys/statfs.h>
194# include <unistd.h>
195# if HAVE_RPC_XDR_H
196# include <tirpc/rpc/xdr.h>
197# endif
198# endif
199
185200// Include these after system headers to avoid name clashes and ambiguities.
186201# include "sanitizer_common.h"
187202# include "sanitizer_internal_defs.h"
......@@ -293,7 +308,7 @@ namespace __sanitizer {
293308#define SIZEOF_STRUCT_USTAT 32
294309# elif defined(__arm__) || defined(__i386__) || defined(__mips__) || \
295310 defined(__powerpc__) || defined(__s390__) || defined(__sparc__) || \
296 defined(__hexagon__)
311 defined(__hexagon__) || defined(__alpha__)
297312# define SIZEOF_STRUCT_USTAT 20
298313# elif defined(__loongarch__)
299314 // Not used. The minimum Glibc version available for LoongArch is 2.36
......@@ -305,9 +320,12 @@ namespace __sanitizer {
305320 unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
306321 unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
307322 unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
308#endif // SANITIZER_GLIBC
323# elif SANITIZER_MUSL
324 // On musl, rlimit64 is an alias for rlimit.
325 unsigned struct_rlimit64_sz = sizeof(struct rlimit);
326# endif // SANITIZER_GLIBC
309327
310#if SANITIZER_LINUX && !SANITIZER_ANDROID
328# if SANITIZER_LINUX && !SANITIZER_ANDROID
311329 unsigned struct_timex_sz = sizeof(struct timex);
312330 unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
313331 unsigned struct_mq_attr_sz = sizeof(struct mq_attr);
......@@ -556,13 +574,13 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
556574 const unsigned IOCTL_NOT_PRESENT = 0;
557575
558576 unsigned IOCTL_FIONBIO = FIONBIO;
559#if !SANITIZER_HAIKU
577# if !SANITIZER_HAIKU
560578 unsigned IOCTL_FIOASYNC = FIOASYNC;
561579 unsigned IOCTL_FIOCLEX = FIOCLEX;
562580 unsigned IOCTL_FIOGETOWN = FIOGETOWN;
563581 unsigned IOCTL_FIONCLEX = FIONCLEX;
564582 unsigned IOCTL_FIOSETOWN = FIOSETOWN;
565#endif
583# endif
566584 unsigned IOCTL_SIOCADDMULTI = SIOCADDMULTI;
567585 unsigned IOCTL_SIOCATMARK = SIOCATMARK;
568586 unsigned IOCTL_SIOCDELMULTI = SIOCDELMULTI;
......@@ -584,14 +602,14 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
584602 unsigned IOCTL_SIOCSIFNETMASK = SIOCSIFNETMASK;
585603 unsigned IOCTL_SIOCSPGRP = SIOCSPGRP;
586604
587#if !SANITIZER_HAIKU
605# if !SANITIZER_HAIKU
588606 unsigned IOCTL_TIOCCONS = TIOCCONS;
589607 unsigned IOCTL_TIOCGETD = TIOCGETD;
590608 unsigned IOCTL_TIOCNOTTY = TIOCNOTTY;
591609 unsigned IOCTL_TIOCPKT = TIOCPKT;
592610 unsigned IOCTL_TIOCSETD = TIOCSETD;
593611 unsigned IOCTL_TIOCSTI = TIOCSTI;
594#endif
612# endif
595613
596614 unsigned IOCTL_TIOCEXCL = TIOCEXCL;
597615 unsigned IOCTL_TIOCGPGRP = TIOCGPGRP;
......@@ -602,10 +620,12 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
602620 unsigned IOCTL_TIOCMSET = TIOCMSET;
603621 unsigned IOCTL_TIOCNXCL = TIOCNXCL;
604622 unsigned IOCTL_TIOCOUTQ = TIOCOUTQ;
623# if !SANITIZER_AIX
605624 unsigned IOCTL_TIOCSCTTY = TIOCSCTTY;
625# endif
606626 unsigned IOCTL_TIOCSPGRP = TIOCSPGRP;
607627 unsigned IOCTL_TIOCSWINSZ = TIOCSWINSZ;
608#if SANITIZER_LINUX && !SANITIZER_ANDROID
628# if SANITIZER_LINUX && !SANITIZER_ANDROID
609629 unsigned IOCTL_SIOCGETSGCNT = SIOCGETSGCNT;
610630 unsigned IOCTL_SIOCGETVIFCNT = SIOCGETVIFCNT;
611631#endif
......@@ -1067,6 +1087,9 @@ CHECK_SIZE_AND_OFFSET(addrinfo, ai_protocol);
10671087CHECK_SIZE_AND_OFFSET(addrinfo, ai_addrlen);
10681088CHECK_SIZE_AND_OFFSET(addrinfo, ai_canonname);
10691089CHECK_SIZE_AND_OFFSET(addrinfo, ai_addr);
1090# if SANITIZER_AIX
1091CHECK_SIZE_AND_OFFSET(addrinfo, ai_eflags);
1092# endif
10701093
10711094CHECK_TYPE_SIZE(hostent);
10721095CHECK_SIZE_AND_OFFSET(hostent, h_name);
......@@ -1113,11 +1136,13 @@ COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
11131136CHECK_SIZE_AND_OFFSET(dirent, d_ino);
11141137#if SANITIZER_APPLE
11151138CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
1116#elif SANITIZER_FREEBSD || SANITIZER_HAIKU
1139# elif SANITIZER_AIX
1140CHECK_SIZE_AND_OFFSET(dirent, d_offset);
1141# elif SANITIZER_FREEBSD || SANITIZER_HAIKU
11171142// There is no 'd_off' field on FreeBSD.
1118#else
1143# else
11191144CHECK_SIZE_AND_OFFSET(dirent, d_off);
1120#endif
1145# endif
11211146CHECK_SIZE_AND_OFFSET(dirent, d_reclen);
11221147
11231148#if SANITIZER_GLIBC
......@@ -1151,7 +1176,8 @@ CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
11511176// didn't exist.
11521177CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_flags);
11531178#endif
1154#if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32)
1179# if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32) && \
1180 !defined(__alpha__)
11551181CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_restorer);
11561182#endif
11571183
......@@ -1192,6 +1218,10 @@ CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordc);
11921218CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordv);
11931219CHECK_SIZE_AND_OFFSET(wordexp_t, we_offs);
11941220#endif
1221# if SANITIZER_AIX
1222CHECK_SIZE_AND_OFFSET(wordexp_t, we_sflags);
1223CHECK_SIZE_AND_OFFSET(wordexp_t, we_soffs);
1224# endif
11951225
11961226CHECK_TYPE_SIZE(tm);
11971227CHECK_SIZE_AND_OFFSET(tm, tm_sec);
......@@ -1203,10 +1233,12 @@ CHECK_SIZE_AND_OFFSET(tm, tm_year);
12031233CHECK_SIZE_AND_OFFSET(tm, tm_wday);
12041234CHECK_SIZE_AND_OFFSET(tm, tm_yday);
12051235CHECK_SIZE_AND_OFFSET(tm, tm_isdst);
1236# if !SANITIZER_AIX
12061237CHECK_SIZE_AND_OFFSET(tm, tm_gmtoff);
12071238CHECK_SIZE_AND_OFFSET(tm, tm_zone);
1239# endif
12081240
1209#if SANITIZER_LINUX
1241# if SANITIZER_LINUX
12101242CHECK_TYPE_SIZE(mntent);
12111243CHECK_SIZE_AND_OFFSET(mntent, mnt_fsname);
12121244CHECK_SIZE_AND_OFFSET(mntent, mnt_dir);
......@@ -1256,7 +1288,7 @@ CHECK_TYPE_SIZE(clock_t);
12561288CHECK_TYPE_SIZE(clockid_t);
12571289#endif
12581290
1259#if !SANITIZER_ANDROID && !SANITIZER_HAIKU
1291# if !SANITIZER_ANDROID && !SANITIZER_HAIKU && !SANITIZER_AIX
12601292CHECK_TYPE_SIZE(ifaddrs);
12611293CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next);
12621294CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name);
lib/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h+69-13
......@@ -14,7 +14,7 @@
1414#ifndef SANITIZER_PLATFORM_LIMITS_POSIX_H
1515#define SANITIZER_PLATFORM_LIMITS_POSIX_H
1616
17#if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU
17#if SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU || SANITIZER_AIX
1818
1919# include "sanitizer_internal_defs.h"
2020# include "sanitizer_mallinfo.h"
......@@ -29,7 +29,7 @@
2929# define SANITIZER_HAS_STAT64 0
3030# define SANITIZER_HAS_STATFS64 0
3131# endif
32# elif SANITIZER_GLIBC || SANITIZER_ANDROID
32# elif SANITIZER_GLIBC || SANITIZER_ANDROID || SANITIZER_AIX
3333# define SANITIZER_HAS_STAT64 1
3434# define SANITIZER_HAS_STATFS64 1
3535# elif SANITIZER_HAIKU
......@@ -103,9 +103,15 @@ const unsigned struct_kernel_stat64_sz = 104;
103103const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
104104 ? FIRST_32_SECOND_64(104, 128)
105105# if defined(_ABIN32) && _MIPS_SIM == _ABIN32
106# if defined(_TIME_BITS) && _TIME_BITS == 64
107 : FIRST_32_SECOND_64(112, 216);
108# else
106109 : FIRST_32_SECOND_64(176, 216);
110# endif
107111# elif SANITIZER_MUSL
108112 : FIRST_32_SECOND_64(160, 208);
113# elif defined(_TIME_BITS) && _TIME_BITS == 64
114 : FIRST_32_SECOND_64(112, 216);
109115# else
110116 : FIRST_32_SECOND_64(160, 216);
111117# endif
......@@ -133,6 +139,9 @@ const unsigned struct_kernel_stat64_sz = 0;
133139# elif defined(__loongarch__)
134140const unsigned struct_kernel_stat_sz = 128;
135141const unsigned struct_kernel_stat64_sz = 0;
142# elif defined(__alpha__)
143const unsigned struct_kernel_stat_sz = 80;
144const unsigned struct_kernel_stat64_sz = 136;
136145# endif
137146struct __sanitizer_perf_event_attr {
138147 unsigned type;
......@@ -323,7 +332,7 @@ struct __sanitizer_iovec {
323332 usize iov_len;
324333};
325334
326# if !SANITIZER_ANDROID
335# if !SANITIZER_ANDROID && !SANITIZER_AIX
327336struct __sanitizer_ifaddrs {
328337 struct __sanitizer_ifaddrs *ifa_next;
329338 char *ifa_name;
......@@ -337,7 +346,7 @@ struct __sanitizer_ifaddrs {
337346 void *ifa_dstaddr; // (struct sockaddr *)
338347 void *ifa_data;
339348};
340# endif // !SANITIZER_ANDROID
349# endif // !SANITIZER_ANDROID && !SANITIZER_AIX
341350
342351# if SANITIZER_APPLE
343352typedef unsigned long __sanitizer_pthread_key_t;
......@@ -345,7 +354,7 @@ typedef unsigned long __sanitizer_pthread_key_t;
345354typedef unsigned __sanitizer_pthread_key_t;
346355# endif
347356
348# if SANITIZER_LINUX && !SANITIZER_ANDROID
357# if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_AIX
349358
350359struct __sanitizer_XDR {
351360 int x_op;
......@@ -440,12 +449,14 @@ struct __sanitizer_tm {
440449 int tm_wday;
441450 int tm_yday;
442451 int tm_isdst;
443# if SANITIZER_HAIKU
452# if !SANITIZER_AIX
453# if SANITIZER_HAIKU
444454 int tm_gmtoff;
445455# else
446456 long int tm_gmtoff;
447457# endif
448458 const char *tm_zone;
459# endif
449460};
450461
451462# if SANITIZER_LINUX
......@@ -513,11 +524,19 @@ struct __sanitizer_msghdr {
513524 struct __sanitizer_iovec *msg_iov;
514525 uptr msg_iovlen;
515526 void *msg_control;
527# if !SANITIZER_AIX
516528 uptr msg_controllen;
529# else
530 unsigned msg_controllen;
531# endif
517532 int msg_flags;
518533};
519534struct __sanitizer_cmsghdr {
535# if !SANITIZER_AIX
520536 uptr cmsg_len;
537# else
538 unsigned cmsg_len;
539# endif
521540 int cmsg_level;
522541 int cmsg_type;
523542};
......@@ -554,10 +573,23 @@ struct __sanitizer_dirent {
554573 unsigned short d_reclen;
555574 // more fields that we don't care about
556575};
576# elif defined(__alpha__)
577struct __sanitizer_dirent {
578 unsigned int d_ino; // ino_t is 32-bit on Alpha
579 int __pad; // explicit padding before d_off
580 unsigned long d_off;
581 unsigned short d_reclen;
582 // more fields that we don't care about
583};
557584# else
558585struct __sanitizer_dirent {
586# if SANITIZER_AIX
587 uptr d_offset;
588 uptr d_ino;
589# else
559590 uptr d_ino;
560591 uptr d_off;
592# endif
561593 unsigned short d_reclen;
562594 // more fields that we don't care about
563595};
......@@ -573,7 +605,7 @@ struct __sanitizer_dirent64 {
573605extern unsigned struct_sock_fprog_sz;
574606# endif
575607
576# if SANITIZER_HAIKU
608# if SANITIZER_HAIKU || SANITIZER_AIX
577609typedef int __sanitizer_clock_t;
578610# elif defined(__x86_64__) && !defined(_LP64)
579611typedef long long __sanitizer_clock_t;
......@@ -581,8 +613,10 @@ typedef long long __sanitizer_clock_t;
581613typedef long __sanitizer_clock_t;
582614# endif
583615
584# if SANITIZER_LINUX || SANITIZER_HAIKU
616# if SANITIZER_LINUX || SANITIZER_HAIKU || SANITIZER_AIX
585617typedef int __sanitizer_clockid_t;
618# endif
619# if SANITIZER_LINUX || SANITIZER_HAIKU
586620typedef unsigned long long __sanitizer_eventfd_t;
587621# endif
588622
......@@ -637,6 +671,14 @@ struct __sanitizer_sigset_t {
637671 // The size is determined by looking at sizeof of real sigset_t on linux.
638672 uptr val[128 / sizeof(uptr)];
639673};
674# elif SANITIZER_AIX
675struct __sanitizer_sigset_t {
676# if SANITIZER_WORDSIZE == 64
677 uptr val[4];
678# else
679 uptr val[2];
680# endif
681};
640682# endif
641683
642684struct __sanitizer_siginfo_pad {
......@@ -741,7 +783,7 @@ struct __sanitizer_sigaction {
741783# endif
742784# endif
743785# endif
744# if SANITIZER_LINUX || SANITIZER_HAIKU
786# if (SANITIZER_LINUX || SANITIZER_HAIKU) && !defined(__alpha__)
745787 void (*sa_restorer)();
746788# endif
747789# if defined(__mips__) && (SANITIZER_WORDSIZE == 32) && !SANITIZER_MUSL
......@@ -828,8 +870,12 @@ struct __sanitizer_addrinfo {
828870 int ai_family;
829871 int ai_socktype;
830872 int ai_protocol;
831# if SANITIZER_ANDROID || SANITIZER_APPLE || SANITIZER_HAIKU
873# if SANITIZER_ANDROID || SANITIZER_APPLE || SANITIZER_HAIKU || SANITIZER_AIX
874# if SANITIZER_AIX // AIX ai_addrlen type is size_t
875 uptr ai_addrlen;
876# else
832877 unsigned ai_addrlen;
878# endif
833879 char *ai_canonname;
834880 void *ai_addr;
835881# else // LINUX
......@@ -838,6 +884,9 @@ struct __sanitizer_addrinfo {
838884 char *ai_canonname;
839885# endif
840886 struct __sanitizer_addrinfo *ai_next;
887# if SANITIZER_AIX
888 int ai_eflags;
889# endif
841890};
842891
843892struct __sanitizer_hostent {
......@@ -854,7 +903,7 @@ struct __sanitizer_pollfd {
854903 short revents;
855904};
856905
857# if SANITIZER_ANDROID || SANITIZER_APPLE
906# if SANITIZER_ANDROID || SANITIZER_APPLE || SANITIZER_AIX
858907typedef unsigned __sanitizer_nfds_t;
859908# else
860909typedef unsigned long __sanitizer_nfds_t;
......@@ -892,6 +941,10 @@ struct __sanitizer_wordexp_t {
892941 uptr we_wordc;
893942 char **we_wordv;
894943 uptr we_offs;
944# if SANITIZER_AIX
945 int we_sflags;
946 uptr we_soffs;
947# endif
895948};
896949
897950# if SANITIZER_LINUX && !SANITIZER_ANDROID
......@@ -1023,7 +1076,7 @@ struct __sanitizer_cookie_io_functions_t {
10231076# define IOC_NRBITS 8
10241077# define IOC_TYPEBITS 8
10251078# if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || \
1026 defined(__sparc__)
1079 defined(__sparc__) || defined(__alpha__)
10271080# define IOC_SIZEBITS 13
10281081# define IOC_DIRBITS 3
10291082# define IOC_NONE 1U
......@@ -1193,7 +1246,9 @@ extern unsigned IOCTL_TIOCMGET;
11931246extern unsigned IOCTL_TIOCMSET;
11941247extern unsigned IOCTL_TIOCNXCL;
11951248extern unsigned IOCTL_TIOCOUTQ;
1249# if !SANITIZER_AIX
11961250extern unsigned IOCTL_TIOCSCTTY;
1251# endif
11971252extern unsigned IOCTL_TIOCSPGRP;
11981253extern unsigned IOCTL_TIOCSWINSZ;
11991254# if SANITIZER_LINUX && !SANITIZER_ANDROID
......@@ -1593,6 +1648,7 @@ extern const int si_SEGV_ACCERR;
15931648typedef void *__sanitizer_timer_t;
15941649# endif
15951650
1596#endif // SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU
1651#endif // SANITIZER_LINUX || SANITIZER_APPLE || SANITIZER_HAIKU ||
1652 // SANITIZER_AIX
15971653
15981654#endif
lib/libtsan/sanitizer_common/sanitizer_platform_limits_solaris.cpp+1
......@@ -51,6 +51,7 @@
5151#include <sys/timeb.h>
5252#include <sys/times.h>
5353#include <sys/types.h>
54#include <sys/ucontext.h>
5455#include <sys/utsname.h>
5556#include <termios.h>
5657#include <time.h>
lib/libtsan/sanitizer_common/sanitizer_posix.cpp+9-7
......@@ -27,12 +27,13 @@
2727#include <signal.h>
2828#include <sys/mman.h>
2929
30#if SANITIZER_FREEBSD
30# if SANITIZER_FREEBSD || SANITIZER_AIX
3131// The MAP_NORESERVE define has been removed in FreeBSD 11.x, and even before
3232// that, it was never implemented. So just define it to zero.
33#undef MAP_NORESERVE
34#define MAP_NORESERVE 0
35#endif
33// Similarly, AIX does not define MAP_NORESERVE.
34# undef MAP_NORESERVE
35# define MAP_NORESERVE 0
36# endif
3637
3738namespace __sanitizer {
3839
......@@ -357,9 +358,10 @@ int GetNamedMappingFd(const char *name, uptr size, int *flags) {
357358 if (!common_flags()->decorate_proc_maps || !name)
358359 return -1;
359360 char shmname[200];
360 CHECK(internal_strlen(name) < sizeof(shmname) - 10);
361 internal_snprintf(shmname, sizeof(shmname), "/dev/shm/%zu [%s]",
362 internal_getpid(), name);
361 int len =
362 internal_snprintf(shmname, sizeof(shmname), "/dev/shm/%zu.%llu [%s]",
363 internal_getpid(), GetTid(), name);
364 CHECK_LT(len, sizeof(shmname));
363365 int o_cloexec = 0;
364366#if defined(O_CLOEXEC)
365367 o_cloexec = O_CLOEXEC;
lib/libtsan/sanitizer_common/sanitizer_posix.h+2-2
......@@ -28,9 +28,9 @@ namespace __sanitizer {
2828// Don't use directly, use __sanitizer::OpenFile() instead.
2929uptr internal_open(const char *filename, int flags);
3030uptr internal_open(const char *filename, int flags, u32 mode);
31# if SANITIZER_FREEBSD
31// Closes all file descriptors from lowfd to highfd (inclusive).
32// Returns 0 on success or non-zero if not supported on this platform.
3233uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags);
33# endif
3434uptr internal_close(fd_t fd);
3535
3636uptr internal_read(fd_t fd, void *buf, uptr count);
lib/libtsan/sanitizer_common/sanitizer_posix_libcdep.cpp+12-9
......@@ -188,12 +188,13 @@ static uptr GetAltStackSize() {
188188 return SIGSTKSZ * 4;
189189}
190190
191void SetAlternateSignalStack() {
191void* SetAlternateSignalStack() {
192192 stack_t altstack, oldstack;
193193 CHECK_EQ(0, sigaltstack(nullptr, &oldstack));
194194 // If the alternate stack is already in place, do nothing.
195195 // Android always sets an alternate stack, but it's too small for us.
196 if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE)) return;
196 if (!SANITIZER_ANDROID && !(oldstack.ss_flags & SS_DISABLE))
197 return nullptr;
197198 // TODO(glider): the mapped stack should have the MAP_STACK flag in the
198199 // future. It is not required by man 2 sigaltstack now (they're using
199200 // malloc()).
......@@ -201,15 +202,18 @@ void SetAlternateSignalStack() {
201202 altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__);
202203 altstack.ss_flags = 0;
203204 CHECK_EQ(0, sigaltstack(&altstack, nullptr));
205 return altstack.ss_sp;
204206}
205207
206void UnsetAlternateSignalStack() {
208void UnsetAlternateSignalStack(void* altstack_base) {
207209 stack_t altstack, oldstack;
208210 altstack.ss_sp = nullptr;
209211 altstack.ss_flags = SS_DISABLE;
210212 altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin.
211213 CHECK_EQ(0, sigaltstack(&altstack, &oldstack));
212 UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
214 if (altstack_base && altstack_base == oldstack.ss_sp) {
215 UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
216 }
213217}
214218
215219bool IsSignalHandlerFromSanitizer(int signum) {
......@@ -562,11 +566,10 @@ pid_t StartSubprocess(const char *program, const char *const argv[],
562566 internal_close(stderr_fd);
563567 }
564568
565# if SANITIZER_FREEBSD
566 internal_close_range(3, ~static_cast<fd_t>(0), 0);
567# else
568 for (int fd = sysconf(_SC_OPEN_MAX); fd > 2; fd--) internal_close(fd);
569# endif
569 // Close all fds except stdin/stdout/stderr before exec.
570 // Fallback to the loop if close_range is not supported.
571 if (internal_close_range(3, ~static_cast<fd_t>(0), 0) != 0)
572 for (int fd = sysconf(_SC_OPEN_MAX); fd > 2; fd--) internal_close(fd);
570573
571574 internal_execve(program, const_cast<char **>(&argv[0]),
572575 const_cast<char *const *>(envp));
lib/libtsan/sanitizer_common/sanitizer_redefine_builtins.h+17-5
......@@ -17,11 +17,23 @@
1717// The asm hack only works with GCC and Clang.
1818# if !defined(_WIN32) && !defined(_AIX) && !defined(__APPLE__)
1919
20asm(R"(
21 .set memcpy, __sanitizer_internal_memcpy
22 .set memmove, __sanitizer_internal_memmove
23 .set memset, __sanitizer_internal_memset
24 )");
20# if defined(__hexagon__)
21
22# define SANITIZER_REDEFINE_BUILTIN_ASM(name) \
23 asm(".set " #name ", __sanitizer_internal_" #name)
24
25# else
26
27# define SANITIZER_REDEFINE_BUILTIN_ASM(name) \
28 asm(#name " = __sanitizer_internal_" #name)
29
30# endif
31
32SANITIZER_REDEFINE_BUILTIN_ASM(memcpy);
33SANITIZER_REDEFINE_BUILTIN_ASM(memmove);
34SANITIZER_REDEFINE_BUILTIN_ASM(memset);
35
36# undef SANITIZER_REDEFINE_BUILTIN_ASM
2537
2638# if defined(__cplusplus) && \
2739 !defined(SANITIZER_COMMON_REDEFINE_BUILTINS_IN_STD)
lib/libtsan/sanitizer_common/sanitizer_solaris.cpp+4
......@@ -102,6 +102,10 @@ uptr internal_open(const char *filename, int flags, u32 mode) {
102102 return _REAL64(open)(filename, flags, mode);
103103}
104104
105uptr internal_close_range(fd_t lowfd, fd_t highfd, int flags) {
106 return -1; // Not supported.
107}
108
105109DECLARE__REAL_AND_INTERNAL(uptr, read, fd_t fd, void *buf, uptr count) {
106110 return _REAL(read)(fd, buf, count);
107111}
lib/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp+11-3
......@@ -16,7 +16,8 @@
1616#if SANITIZER_LINUX && \
1717 (defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) || \
1818 defined(__powerpc64__) || defined(__s390__) || defined(__i386__) || \
19 defined(__arm__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64)
19 defined(__arm__) || defined(__hexagon__) || SANITIZER_RISCV64 || \
20 SANITIZER_LOONGARCH64)
2021
2122#include "sanitizer_stoptheworld.h"
2223
......@@ -32,8 +33,8 @@
3233#include <sys/uio.h> // for iovec
3334#include <elf.h> // for NT_PRSTATUS
3435#if (defined(__aarch64__) || defined(__powerpc64__) || \
35 SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \
36 !SANITIZER_ANDROID
36 defined(__hexagon__) || SANITIZER_RISCV64 || \
37 SANITIZER_LOONGARCH64) && !SANITIZER_ANDROID
3738// GLIBC 2.20+ sys/user does not include asm/ptrace.h
3839# include <asm/ptrace.h>
3940#endif
......@@ -613,6 +614,13 @@ typedef _user_regs_struct regs_struct;
613614static constexpr uptr kExtraRegs[] = {0};
614615#define ARCH_IOVEC_FOR_GETREGSET
615616
617#elif defined(__hexagon__)
618#include <asm/user.h>
619typedef struct user_regs_struct regs_struct;
620#define REG_SP r29
621static constexpr uptr kExtraRegs[] = {0};
622#define ARCH_IOVEC_FOR_GETREGSET
623
616624#else
617625#error "Unsupported architecture"
618626#endif // SANITIZER_ANDROID && defined(__arm__)
lib/libtsan/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp+7-7
......@@ -475,6 +475,13 @@ static SymbolizerTool *ChooseExternalSymbolizer(LowLevelAllocator *allocator) {
475475 return new (*allocator) Addr2LinePool(found_path, allocator);
476476 }
477477 }
478
479# if SANITIZER_APPLE
480 Report(
481 "WARN: No external symbolizers found. Symbols may be missing or "
482 "unreliable.\n");
483 Report("HINT: Is PATH set? Does sandbox allow file-read of /usr/bin/atos?\n");
484# endif
478485 return nullptr;
479486# endif // SANITIZER_DISABLE_SYMBOLIZER_PATH_SEARCH
480487}
......@@ -509,13 +516,6 @@ static void ChooseSymbolizerTools(IntrusiveList<SymbolizerTool> *list,
509516 }
510517
511518# if SANITIZER_APPLE
512 if (list->empty()) {
513 Report(
514 "WARN: No external symbolizers found. Symbols may be missing or "
515 "unreliable.\n");
516 Report(
517 "HINT: Is PATH set? Does sandbox allow file-read of /usr/bin/atos?\n");
518 }
519519 VReport(2, "Using dladdr symbolizer.\n");
520520 list->push_back(new (*allocator) DlAddrSymbolizer());
521521# endif // SANITIZER_APPLE
lib/libtsan/sanitizer_common/sanitizer_symbolizer_report.cpp+7-6
......@@ -184,7 +184,7 @@ static void MaybeReportNonExecRegion(uptr pc) {
184184 MemoryMappedSegment segment;
185185 while (proc_maps.Next(&segment)) {
186186 if (pc >= segment.start && pc < segment.end && !segment.IsExecutable())
187 Report("Hint: PC is at a non-executable region. Maybe a wild jump?\n");
187 Report("HINT: PC is at a non-executable region. Maybe a wild jump?\n");
188188 }
189189#endif
190190}
......@@ -254,7 +254,7 @@ static void ReportDeadlySignalImpl(const SignalContext &sig, u32 tid,
254254 (void *)sig.bp, (void *)sig.sp, tid);
255255 Printf("%s", d.Default());
256256 if (sig.pc < GetPageSizeCached())
257 Report("Hint: pc points to the zero page.\n");
257 Report("HINT: pc points to the zero page.\n");
258258 if (sig.is_memory_access) {
259259 const char *access_type =
260260 sig.write_flag == SignalContext::Write
......@@ -262,11 +262,12 @@ static void ReportDeadlySignalImpl(const SignalContext &sig, u32 tid,
262262 : (sig.write_flag == SignalContext::Read ? "READ" : "UNKNOWN");
263263 Report("The signal is caused by a %s memory access.\n", access_type);
264264 if (!sig.is_true_faulting_addr)
265 Report("Hint: this fault was caused by a dereference of a high value "
266 "address (see register values below). Disassemble the provided "
267 "pc to learn which register was used.\n");
265 Report(
266 "HINT: this fault was caused by a dereference of a high value "
267 "address (see register values below). Disassemble the provided "
268 "pc to learn which register was used.\n");
268269 else if (sig.addr < GetPageSizeCached())
269 Report("Hint: address points to the zero page.\n");
270 Report("HINT: address points to the zero page.\n");
270271 }
271272 MaybeReportNonExecRegion(sig.pc);
272273 InternalMmapVector<BufferedStackTrace> stack_buffer(1);
lib/libtsan/sanitizer_common/sanitizer_unwind_win.cpp+43-6
......@@ -43,10 +43,47 @@ void BufferedStackTrace::UnwindSlow(uptr pc, u32 max_depth) {
4343 trace_buffer[0] = pc;
4444}
4545
46#ifdef __clang__
47#pragma clang diagnostic push
48#pragma clang diagnostic ignored "-Wframe-larger-than="
49#endif
46PVOID CALLBACK FallbackFunctionTableAccess(HANDLE hProcess,
47 DWORD64 dwAddrBase) {
48 // First try DbgHelp's function.
49 if (PVOID pResult =
50 __sanitizer::SymFunctionTableAccess64(hProcess, dwAddrBase)) {
51 return pResult;
52 }
53
54 // Fall back to RtlLookupFunctionEntry for dynamic code.
55 // Function registered with RtlAddFunctionTable is not necessarily registered
56 // with DbgHelp, so this is required to cover some edge cases (e.g. JIT
57 // compilers can use Rtl* functions).
58# if SANITIZER_WINDOWS64
59 DWORD64 dw64ImageBase = 0;
60 return RtlLookupFunctionEntry(dwAddrBase, &dw64ImageBase, nullptr);
61# else
62 return nullptr;
63# endif
64}
65
66DWORD64 CALLBACK FallbackGetModuleBase(HANDLE hProcess, DWORD64 dwAddr) {
67 if (DWORD64 dwResult = __sanitizer::SymGetModuleBase64(hProcess, dwAddr)) {
68 return dwResult;
69 }
70
71 // Both GetModuleBase and FunctionTableAccess must provide this fallback,
72 // otherwise dynamic functions won't be properly unwound.
73# if SANITIZER_WINDOWS64
74 DWORD64 dw64ImageBase = 0;
75 if (RtlLookupFunctionEntry(dwAddr, &dw64ImageBase, nullptr)) {
76 return dw64ImageBase;
77 }
78# endif
79
80 return 0;
81}
82
83# ifdef __clang__
84# pragma clang diagnostic push
85# pragma clang diagnostic ignored "-Wframe-larger-than="
86# endif
5087void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) {
5188 CHECK(context);
5289 CHECK_GE(max_depth, 2);
......@@ -91,8 +128,8 @@ void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) {
91128 stack_frame.AddrFrame.Mode = AddrModeFlat;
92129 stack_frame.AddrStack.Mode = AddrModeFlat;
93130 while (StackWalk64(machine_type, GetCurrentProcess(), GetCurrentThread(),
94 &stack_frame, &ctx, NULL, SymFunctionTableAccess64,
95 SymGetModuleBase64, NULL) &&
131 &stack_frame, &ctx, NULL, FallbackFunctionTableAccess,
132 FallbackGetModuleBase, NULL) &&
96133 size < Min(max_depth, kStackTraceMax)) {
97134 trace_buffer[size++] = (uptr)stack_frame.AddrPC.Offset;
98135 }
lib/libtsan/sanitizer_common/sanitizer_win.cpp+4-3
......@@ -913,11 +913,12 @@ void ReportFile::Write(const char *buffer, uptr length) {
913913 }
914914}
915915
916void SetAlternateSignalStack() {
916void* SetAlternateSignalStack() {
917917 // FIXME: Decide what to do on Windows.
918 return nullptr;
918919}
919920
920void UnsetAlternateSignalStack() {
921void UnsetAlternateSignalStack(void* altstack_base) {
921922 // FIXME: Decide what to do on Windows.
922923}
923924
......@@ -1222,7 +1223,7 @@ int WaitForProcess(pid_t pid) { return -1; }
12221223// FIXME implement on this platform.
12231224void GetMemoryProfile(fill_profile_f cb, uptr *stats) {}
12241225
1225void CheckNoDeepBind(const char *filename, int flag) {
1226void OnDlOpen(const char* filename, int flag) {
12261227 // Do nothing.
12271228}
12281229
lib/libtsan/tsan_adaptive_delay.cpp created+433
......@@ -0,0 +1,433 @@
1//===-- tsan_adaptive_delay.h -----------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is a part of ThreadSanitizer (TSan), a race detector.
10//
11//===----------------------------------------------------------------------===//
12
13#include "tsan_adaptive_delay.h"
14
15#include "interception/interception.h"
16#include "sanitizer_common/sanitizer_allocator_internal.h"
17#include "sanitizer_common/sanitizer_common.h"
18#include "sanitizer_common/sanitizer_errno_codes.h"
19#include "tsan_interface.h"
20#include "tsan_rtl.h"
21
22namespace __tsan {
23
24namespace {
25
26// =============================================================================
27// DelaySpec: Represents a delay configuration parsed from flag strings
28// =============================================================================
29//
30// Delay can be specified as:
31// - "spin=N" : Spin for up to N cycles (very short delays)
32// - "yield" : Call sched_yield() once
33// - "sleep_us=N" : Sleep for up to N microseconds
34
35enum class DelayType { Spin, Yield, SleepUs };
36
37struct DelaySpec {
38 DelayType type;
39 int value; // spin cycles or sleep_us value; ignored for yield
40
41 // Both estimates below are used internally as a very rough estimate for
42 // delay overhead calculation, to cap the overall delay to the
43 // adaptive_delay_aggressiveness option. They're not intended to be 100%
44 // accurate on any or all architectures/operating systems, or for use in any
45 // other contexts.
46 //
47 // Estimated nanoseconds per spin cycle (volatile loop iteration).
48 static constexpr u64 kNsPerSpinCycle = 1;
49 // Estimated nanoseconds for a yield (context switch overhead)
50 static constexpr u64 kNsPerYield = 500;
51
52 static DelaySpec Parse(const char* str) {
53 DelaySpec spec;
54 if (internal_strncmp(str, "spin=", 5) == 0) {
55 spec.type = DelayType::Spin;
56 spec.value = internal_atoll(str + 5);
57 if (spec.value <= 0 || spec.value > 10000) {
58 Printf(
59 "FATAL: Invalid TSAN_OPTIONS spin value '%s'; value must be "
60 "between 1 and 10000\n",
61 str);
62 Die();
63 }
64 } else if (internal_strcmp(str, "yield") == 0) {
65 spec.type = DelayType::Yield;
66 spec.value = 0;
67 } else if (internal_strncmp(str, "sleep_us=", 9) == 0) {
68 spec.type = DelayType::SleepUs;
69 spec.value = internal_atoll(str + 9);
70 if (spec.value <= 0) {
71 Printf(
72 "FATAL: Invalid TSAN_OPTIONS sleep_us value '%s'; value must be a "
73 "positive integer\n",
74 str);
75 Die();
76 }
77 } else {
78 Printf("FATAL: Unrecognized delay spec '%s', check TSAN_OPTIONS\n", str);
79 Die();
80 }
81 return spec;
82 }
83
84 const char* TypeName() const {
85 switch (type) {
86 case DelayType::Spin:
87 return "spin";
88 case DelayType::Yield:
89 return "yield";
90 case DelayType::SleepUs:
91 return "sleep_us";
92 }
93 return "unknown";
94 }
95};
96
97} // namespace
98
99// =============================================================================
100// AdaptiveDelayImpl: Time-budget aware delay injection for race exposure
101// =============================================================================
102//
103// This implementation injects delays to expose data races while maintaining a
104// configurable overhead target. It uses several strategies:
105//
106// 1. Time-Budget Controller: Tracks cumulative delays vs wall-clock time
107// and adjusts delay probability to maintain target overhead.
108//
109// 2. Tiered Delays: Different delay strategies for different op types:
110// - Relaxed atomics: Very rare sampling, tiny spin delays
111// - Sync atomics (acq/rel/seq_cst): Moderate sampling, small usleep
112// - Mutex/CV ops: Higher sampling, larger delays
113// - Thread create/join: Always delay (rare but high value)
114//
115// 3. Address-based Sampling: Exponential backoff per address to avoid
116// repeatedly delaying hot atomics.
117
118struct AdaptiveDelayImpl {
119 ALWAYS_INLINE static AdaptiveDelayState* TLS() {
120 return &cur_thread()->adaptive_delay_state;
121 }
122 ALWAYS_INLINE static unsigned int* GetRandomSeed() {
123 return &TLS()->tls_random_seed_;
124 }
125 ALWAYS_INLINE static void SetRandomSeed(unsigned int seed) {
126 TLS()->tls_random_seed_ = seed;
127 }
128
129 // The public facing option is adaptive_delay_aggressiveness, which is an
130 // opaque value for the user to tune the amount of delay injected into the
131 // program. Internally, the implementation maps the aggressiveness to a target
132 // percent delay for the overall program runtime. It's not easy to implement
133 // a true wall clock delay target (e.g., 25% program wall time slowdown)
134 // because 1) spin loops and yield are hard to calculate actual wall time
135 // slowness and 2) usleep(N) is often slower than advertised. Thus, we keep
136 // the user facing parameter opaque to not under deliver on a promise of
137 // percent wall time slowdown.
138 struct TimeBudget {
139 int target_overhead_pct_;
140 Percent target_low_;
141 Percent target_high_;
142
143 void Init(int target_pct) {
144 target_overhead_pct_ = target_pct;
145 target_low_ = Percent::FromPct(
146 target_overhead_pct_ >= 5 ? target_overhead_pct_ - 5 : 0);
147 target_high_ = Percent::FromPct(target_overhead_pct_ + 5);
148 }
149
150 static constexpr u64 BucketDurationNs = 30'000'000'000ULL;
151
152 void RecordDelay(u64 delay_ns) {
153 u64 now = NanoTime();
154 u64 elapsed_ns = now - TLS()->bucket_start_ns_;
155
156 if (elapsed_ns >= BucketDurationNs) {
157 // Shift: old bucket is discarded, new becomes old, start fresh new
158 TLS()->delay_buckets_ns_[0] = TLS()->delay_buckets_ns_[1];
159 TLS()->delay_buckets_ns_[1] = 0;
160 TLS()->bucket_start_ns_ = now;
161 TLS()->bucket0_window_ns = BucketDurationNs;
162 }
163
164 TLS()->delay_buckets_ns_[1] += delay_ns;
165 }
166
167 Percent GetOverheadPercent() {
168 u64 now = NanoTime();
169 u64 elapsed_ns = now - TLS()->bucket_start_ns_;
170
171 // Need at least 1ms to calculate
172 if (elapsed_ns < 1'000'000ULL)
173 return Percent::FromPct(0);
174
175 if (elapsed_ns > BucketDurationNs * 2) {
176 // Both buckets are stale
177 return Percent::FromPct(0);
178 } else if (elapsed_ns > BucketDurationNs) {
179 // bucket[0] is stale, use only bucket[1] (current bucket)
180 u64 total_delay_ns = TLS()->delay_buckets_ns_[1];
181 return Percent::FromRatio(total_delay_ns, elapsed_ns);
182 } else {
183 u64 total_delay_ns =
184 TLS()->delay_buckets_ns_[0] + TLS()->delay_buckets_ns_[1];
185 u64 window_ns = TLS()->bucket0_window_ns + elapsed_ns;
186 return Percent::FromRatio(total_delay_ns, window_ns);
187 }
188 }
189
190 bool ShouldDelay() {
191 Percent ratio = GetOverheadPercent();
192
193 if (ratio < target_low_)
194 return true;
195 if (ratio > target_high_)
196 return false;
197
198 // Linear interpolation: at target_low -> 100%, at target_high -> 0%
199 Percent prob = (target_high_ - ratio) / (target_high_ - target_low_);
200 return prob.RandomCheck(GetRandomSeed());
201 }
202 };
203
204 // Address Sampler with Exponential Backoff
205 struct AddressSampler {
206 static constexpr u64 TABLE_SIZE = 2048;
207 struct Entry {
208 atomic_uintptr_t addr_;
209 atomic_uint32_t count_;
210 };
211 Entry table_[TABLE_SIZE];
212 static constexpr u32 ExponentialBackoffCap = 64;
213
214 void Init() {
215 for (u64 i = 0; i < TABLE_SIZE; ++i) {
216 atomic_store(&table_[i].addr_, 0, memory_order_relaxed);
217 atomic_store(&table_[i].count_, 0, memory_order_relaxed);
218 }
219 }
220
221 static ALWAYS_INLINE u64 splitmix64(u64 x) {
222 x = (x ^ (x >> 30)) * 0xBF58476D1CE4E5B9ULL;
223 x = (x ^ (x >> 27)) * 0x94D049BB133111EBULL;
224 x = x ^ (x >> 31);
225 return x;
226 }
227
228 // Uses exponential backoff: delay on 1st, 2nd, 4th, 8th, 16th, ...
229 bool ShouldDelayAddr(uptr addr) {
230 u64 idx = splitmix64(addr >> 3) & (TABLE_SIZE - 1);
231 Entry& e = table_[idx];
232
233 // This function is not thread safe.
234 // If two threads access the same hashed entry in parallel,
235 // worst case, we may end up returning true too often. This is
236 // acceptable...instead of full locking.
237
238 uptr stored_addr = atomic_load(&e.addr_, memory_order_relaxed);
239 if (stored_addr != addr) {
240 // Hash Collision - reset
241 atomic_store(&e.addr_, addr, memory_order_relaxed);
242 atomic_store(&e.count_, 1, memory_order_relaxed);
243 return true;
244 }
245
246 u32 count = atomic_fetch_add(&e.count_, 1, memory_order_relaxed) + 1;
247
248 if ((count & (count - 1)) == 0 && count <= ExponentialBackoffCap)
249 return true;
250 return false;
251 }
252 };
253
254 TimeBudget budget_;
255 AddressSampler sampler_;
256
257 int relaxed_sample_rate_;
258 int sync_atomic_sample_rate_;
259 int mutex_sample_rate_;
260 DelaySpec atomic_delay_;
261 DelaySpec sync_delay_;
262
263 void Init() { InitTls(); }
264
265 void InitTls() {
266 TLS()->bucket_start_ns_ = NanoTime();
267 TLS()->delay_buckets_ns_[0] = 0;
268 TLS()->delay_buckets_ns_[1] = 0;
269 TLS()->bucket0_window_ns = 0;
270
271 SetRandomSeed(NanoTime());
272 TLS()->tls_initialized_ = true;
273 }
274
275 bool IsTlsInitialized() const { return TLS()->tls_initialized_; }
276
277 AdaptiveDelayImpl() {
278 relaxed_sample_rate_ = flags()->adaptive_delay_relaxed_sample_rate;
279 sync_atomic_sample_rate_ = flags()->adaptive_delay_sync_atomic_sample_rate;
280 mutex_sample_rate_ = flags()->adaptive_delay_mutex_sample_rate;
281 atomic_delay_ = DelaySpec::Parse(flags()->adaptive_delay_max_atomic);
282 sync_delay_ = DelaySpec::Parse(flags()->adaptive_delay_max_sync);
283
284 int delay_aggressiveness = flags()->adaptive_delay_aggressiveness;
285 if (delay_aggressiveness < 1)
286 delay_aggressiveness = 1;
287
288 budget_.Init(delay_aggressiveness);
289 sampler_.Init();
290
291 VPrintf(1, "INFO: ThreadSanitizer AdaptiveDelay initialized\n");
292 VPrintf(1, " Delay aggressiveness: %d\n", delay_aggressiveness);
293 VPrintf(1, " Relaxed atomic sample rate: 1/%d\n", relaxed_sample_rate_);
294 VPrintf(1, " Sync atomic sample rate: 1/%d\n", sync_atomic_sample_rate_);
295 VPrintf(1, " Mutex sample rate: 1/%d\n", mutex_sample_rate_);
296 VPrintf(1, " Atomic delay: %s=%d\n", atomic_delay_.TypeName(),
297 atomic_delay_.value);
298 VPrintf(1, " Sync delay: %s=%d\n", sync_delay_.TypeName(),
299 sync_delay_.value);
300 }
301
302 void DoSpinDelay(int iters) {
303 volatile int v = 0;
304 for (int i = 0; i < iters; ++i) v = i;
305 (void)v;
306 budget_.RecordDelay(iters * DelaySpec::kNsPerSpinCycle);
307 }
308
309 void DoYieldDelay() {
310 internal_sched_yield();
311 budget_.RecordDelay(DelaySpec::kNsPerYield);
312 }
313
314 void DoSleepUsDelay(int max_us) {
315 // Use two Rand() calls to get full 32-bit range for larger sleep values
316 u32 rnd = ((u32)Rand(GetRandomSeed()) << 16) | Rand(GetRandomSeed());
317 int delay_us = 1 + (rnd % max_us);
318 internal_usleep(delay_us);
319 budget_.RecordDelay(delay_us * 1000ULL);
320 }
321
322 void ExecuteDelay(const DelaySpec& spec) {
323 switch (spec.type) {
324 case DelayType::Spin: {
325 int iters = 1 + (Rand(GetRandomSeed()) % spec.value);
326 DoSpinDelay(iters);
327 break;
328 }
329 case DelayType::Yield:
330 DoYieldDelay();
331 break;
332 case DelayType::SleepUs:
333 DoSleepUsDelay(spec.value);
334 break;
335 }
336 }
337
338 void AtomicRelaxedOpDelay() {
339 if ((Rand(GetRandomSeed()) % relaxed_sample_rate_) != 0)
340 return;
341 if (!budget_.ShouldDelay())
342 return;
343
344 int iters = 10 + (Rand(GetRandomSeed()) % 10);
345 DoSpinDelay(iters);
346 }
347
348 void AtomicSyncOpDelay(uptr* addr) {
349 if ((Rand(GetRandomSeed()) % sync_atomic_sample_rate_) != 0)
350 return;
351 if (!budget_.ShouldDelay())
352 return;
353
354 if (addr && !sampler_.ShouldDelayAddr(*addr))
355 return;
356
357 ExecuteDelay(atomic_delay_);
358 }
359
360 void AtomicOpFence(int mo) {
361 CHECK(IsTlsInitialized());
362
363 if (mo < mo_acquire)
364 AtomicRelaxedOpDelay();
365 else
366 AtomicSyncOpDelay(nullptr);
367 }
368
369 void AtomicOpAddr(uptr addr, int mo) {
370 CHECK(IsTlsInitialized());
371
372 if (mo < mo_acquire)
373 AtomicRelaxedOpDelay();
374 else
375 AtomicSyncOpDelay(&addr);
376 }
377
378 void UnsampledDelay() {
379 CHECK(IsTlsInitialized());
380
381 if (!budget_.ShouldDelay())
382 return;
383
384 ExecuteDelay(sync_delay_);
385 }
386
387 void SyncOp() {
388 CHECK(IsTlsInitialized());
389
390 if ((Rand(GetRandomSeed()) % mutex_sample_rate_) != 0)
391 return;
392 if (!budget_.ShouldDelay())
393 return;
394
395 ExecuteDelay(sync_delay_);
396 }
397
398 void BeforeChildThreadRuns() {
399 InitTls();
400 UnsampledDelay();
401 }
402
403 void AfterThreadCreation() { UnsampledDelay(); }
404};
405
406AdaptiveDelayImpl& GetImpl() {
407 static AdaptiveDelayImpl impl;
408 return impl;
409}
410
411bool AdaptiveDelay::is_adaptive_delay_enabled;
412
413void AdaptiveDelay::InitImpl() {
414 AdaptiveDelay::is_adaptive_delay_enabled = flags()->enable_adaptive_delay;
415 if (!AdaptiveDelay::is_adaptive_delay_enabled)
416 return;
417
418 GetImpl().Init();
419}
420
421void AdaptiveDelay::SyncOpImpl() { GetImpl().SyncOp(); }
422void AdaptiveDelay::AtomicOpFenceImpl(int mo) { GetImpl().AtomicOpFence(mo); }
423void AdaptiveDelay::AtomicOpAddrImpl(__sanitizer::uptr addr, int mo) {
424 GetImpl().AtomicOpAddr(addr, mo);
425}
426void AdaptiveDelay::AfterThreadCreationImpl() {
427 GetImpl().AfterThreadCreation();
428}
429void AdaptiveDelay::BeforeChildThreadRunsImpl() {
430 GetImpl().BeforeChildThreadRuns();
431}
432
433} // namespace __tsan
lib/libtsan/tsan_adaptive_delay.h created+173
......@@ -0,0 +1,173 @@
1//===-- tsan_adaptive_delay.h -----------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is a part of ThreadSanitizer (TSan), a race detector.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef TSAN_ADAPTIVE_DELAY_H
14#define TSAN_ADAPTIVE_DELAY_H
15
16#include "sanitizer_common/sanitizer_common.h"
17#include "sanitizer_common/sanitizer_internal_defs.h"
18
19namespace __tsan {
20
21// AdaptiveDelay injects delays at synchronization points, atomic operations,
22// and thread lifecycle events to increase the likelihood of exposing data
23// races. The delay injection is controlled by an approximate time budget to
24// maintain a configurable overhead target.
25//
26// SyncOp() delays non-atomic synchronization points (those with clear
27// happens-before relationships):
28// - Acquire operations like locking a mutex delays before the mutex is locked.
29// - Release operations like unlocking a mutex delays after the mutex is
30// unlocked
31// These are more likely to expose interesting (rare) thread interleavings.
32// For example, delaying a thread that unlocks a mutex from running to allow
33// newly woken thread to execute before the unlocking thread would normally
34// execute.
35//
36// TODO:
37// - Move the adaptive delay implementation into sanitizer_common so that
38// ASAN can also leverage it in pthread_* interceptors
39// - Integrate into other interceptors like libdispatch.
40struct AdaptiveDelay {
41 ALWAYS_INLINE static void Init() { InitImpl(); }
42
43 ALWAYS_INLINE static void SyncOp() {
44 if (!is_adaptive_delay_enabled)
45 return;
46 SyncOpImpl();
47 }
48
49 ALWAYS_INLINE static void AtomicOpFence(int mo) {
50 if (!is_adaptive_delay_enabled)
51 return;
52 AtomicOpFenceImpl(mo);
53 }
54
55 ALWAYS_INLINE static void AtomicOpAddr(__sanitizer::uptr addr, int mo) {
56 if (!is_adaptive_delay_enabled)
57 return;
58 AtomicOpAddrImpl(addr, mo);
59 }
60
61 ALWAYS_INLINE static void AfterThreadCreation() {
62 if (!is_adaptive_delay_enabled)
63 return;
64 AfterThreadCreationImpl();
65 }
66
67 ALWAYS_INLINE static void BeforeChildThreadRuns() {
68 if (!is_adaptive_delay_enabled)
69 return;
70 BeforeChildThreadRunsImpl();
71 }
72
73 private:
74 static void InitImpl();
75
76 static void SyncOpImpl();
77
78 static void AtomicOpFenceImpl(int mo);
79 static void AtomicOpAddrImpl(__sanitizer::uptr addr, int mo);
80
81 static void AfterThreadCreationImpl();
82 static void BeforeChildThreadRunsImpl();
83
84 static bool is_adaptive_delay_enabled;
85};
86
87// The runtime defines cur_thread() to retrieve TLS thread state, and it
88// takes care of platform specific implementation details. The AdaptiveDelay
89// implementation stores per-thread data in this struct, which is embedded
90// in cur_thread().
91struct AdaptiveDelayState {
92 // For the adaptive delay implementation
93 // Sliding window delay tracking: 2 buckets of 30 seconds each
94 u64 delay_buckets_ns_[2]; // [0] = older 30s, [1] = newer 30s
95 u64 bucket_start_ns_; // When current bucket (index 1) started
96 u64 bucket0_window_ns; // 0ns before the first bucket has rolled, and set to
97 // the bucket window time after This handles the case
98 // where, before the program has ran one bucket window
99 // duration, we should not include the previous bucket
100 // duration in the overhead percent calculation.
101 unsigned int tls_random_seed_;
102 bool tls_initialized_;
103};
104
105// Fixed-point arithmetic type that mimics floating point operations
106class Percent {
107 using u32 = __sanitizer::u32;
108 using u64 = __sanitizer::u64;
109
110 u32 bp_{}; // basis points (0-10000 represents 0.0-1.0)
111 bool is_valid_{};
112
113 static constexpr u32 kBasisPointsPerUnit = 10000;
114
115 Percent(u32 bp, bool is_valid) : bp_(bp), is_valid_(is_valid) {}
116
117 public:
118 Percent() = default;
119 Percent(const Percent&) = default;
120 Percent& operator=(const Percent&) = default;
121 Percent(Percent&&) = default;
122 Percent& operator=(Percent&&) = default;
123
124 static Percent FromPct(u32 pct) { return Percent{pct * 100, true}; }
125 static Percent FromRatio(u64 numerator, u64 denominator) {
126 if (denominator == 0)
127 return Percent{0, false};
128 // Avoid overflow: scale down if needed
129 if (numerator > UINT64_MAX / kBasisPointsPerUnit) {
130 return Percent{(u32)((numerator / denominator) * kBasisPointsPerUnit),
131 true};
132 }
133 return Percent{(u32)((numerator * kBasisPointsPerUnit) / denominator),
134 true};
135 }
136
137 bool IsValid() const { return is_valid_; }
138
139 // Returns true with probability equal to the percentage.
140 bool RandomCheck(u32* seed) const {
141 return (Rand(seed) % kBasisPointsPerUnit) < bp_;
142 }
143
144 int GetPct() const { return bp_ / 100; }
145 int GetBasisPoints() const { return bp_; }
146
147 bool operator==(const Percent& other) const { return bp_ == other.bp_; }
148 bool operator!=(const Percent& other) const { return bp_ != other.bp_; }
149 bool operator<(const Percent& other) const { return bp_ < other.bp_; }
150 bool operator>(const Percent& other) const { return bp_ > other.bp_; }
151 bool operator<=(const Percent& other) const { return bp_ <= other.bp_; }
152 bool operator>=(const Percent& other) const { return bp_ >= other.bp_; }
153
154 Percent operator-(const Percent& other) const {
155 if (!is_valid_ || !other.is_valid_)
156 return Percent{0, false};
157 if (bp_ < other.bp_)
158 return Percent{0, false};
159 return Percent{bp_ - other.bp_, true};
160 }
161
162 Percent operator/(const Percent& other) const {
163 if (!is_valid_ || !other.is_valid_)
164 return Percent{0, false};
165 if (other.bp_ == 0)
166 return Percent{0, false};
167 return Percent{(bp_ * kBasisPointsPerUnit) / other.bp_, true};
168 }
169};
170
171} // namespace __tsan
172
173#endif // TSAN_ADAPTIVE_DELAY_H
lib/libtsan/tsan_flags.cpp+1-1
......@@ -37,7 +37,7 @@ inline bool FlagHandler<LockDuringWriteSetting>::Parse(const char *value) {
3737 *t_ = kNoLockDuringWritesAllProcesses;
3838 return true;
3939 }
40 Printf("ERROR: Invalid value for signal handler option: '%s'\n", value);
40 Printf("ERROR: Invalid value for lock_during_write option: '%s'\n", value);
4141 return false;
4242}
4343
lib/libtsan/tsan_flags.inc+27
......@@ -92,3 +92,30 @@ TSAN_FLAG(LockDuringWriteSetting, lock_during_write, kLockDuringAllWrites,
9292 "\"disable_for_all_processes\" - don't lock during all writes in "
9393 "the current process and it's children processes.")
9494#endif
95
96TSAN_FLAG(bool, enable_adaptive_delay, false,
97 "Enable adaptive delay injection to expose data races. When "
98 "enabled, delays are strategically injected at synchronization "
99 "points, atomic operations, and thread lifecycle events to increase "
100 "the likelihood of exposing races while maintaining a configurable "
101 "overhead budget.")
102
103TSAN_FLAG(
104 int, adaptive_delay_aggressiveness, 25,
105 "Controls delay injection intensity for race detection. Higher values "
106 "inject more delays to expose races. Suggested values: 10 (minimal delay), "
107 "50 (moderate delay), 200 (aggressive). "
108 "This is a tuning parameter; actual overhead varies by workload and "
109 "platform.")
110TSAN_FLAG(int, adaptive_delay_relaxed_sample_rate, 10000,
111 "Sample 1 in N relaxed atomic operations for delay")
112TSAN_FLAG(int, adaptive_delay_sync_atomic_sample_rate, 100,
113 "Sample 1 in N acquire/release/seq_cst atomic operations for delay")
114TSAN_FLAG(int, adaptive_delay_mutex_sample_rate, 10,
115 "Sample 1 in N mutex/cv operations for delay")
116TSAN_FLAG(const char*, adaptive_delay_max_atomic, "sleep_us=50",
117 "Delay for atomic operations: 'spin=N' (max N spins), 'yield', or "
118 "'sleep_us=N' (max N>0 us sleep)")
119TSAN_FLAG(const char*, adaptive_delay_max_sync, "sleep_us=500",
120 "Delay for sync operations: 'spin=N' (max N spins), 'yield', or "
121 "'sleep_us=N' (max N>0 us sleep)")
lib/libtsan/tsan_interceptors_posix.cpp+24-2
......@@ -34,6 +34,7 @@
3434#if SANITIZER_APPLE && !SANITIZER_GO
3535# include "tsan_flags.h"
3636#endif
37#include "tsan_adaptive_delay.h"
3738#include "tsan_interceptors.h"
3839#include "tsan_interface.h"
3940#include "tsan_mman.h"
......@@ -1065,6 +1066,9 @@ extern "C" void *__tsan_thread_start_func(void *arg) {
10651066 ThreadStart(thr, p->tid, GetTid(), ThreadType::Regular);
10661067 p->started.Post();
10671068 }
1069
1070 AdaptiveDelay::BeforeChildThreadRuns();
1071
10681072 void *res = callback(param);
10691073 // Prevent the callback from being tail called,
10701074 // it mixes up stack traces.
......@@ -1128,6 +1132,7 @@ TSAN_INTERCEPTOR(int, pthread_create,
11281132 }
11291133 if (attr == &myattr)
11301134 pthread_attr_destroy(&myattr);
1135 AdaptiveDelay::AfterThreadCreation();
11311136 return res;
11321137}
11331138
......@@ -1423,6 +1428,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_destroy, void *m) {
14231428TSAN_INTERCEPTOR(int, pthread_mutex_lock, void *m) {
14241429 SCOPED_TSAN_INTERCEPTOR(pthread_mutex_lock, m);
14251430 MutexPreLock(thr, pc, (uptr)m);
1431 AdaptiveDelay::SyncOp();
14261432 int res = BLOCK_REAL(pthread_mutex_lock)(m);
14271433 if (res == errno_EOWNERDEAD)
14281434 MutexRepair(thr, pc, (uptr)m);
......@@ -1435,6 +1441,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_lock, void *m) {
14351441
14361442TSAN_INTERCEPTOR(int, pthread_mutex_trylock, void *m) {
14371443 SCOPED_TSAN_INTERCEPTOR(pthread_mutex_trylock, m);
1444 AdaptiveDelay::SyncOp();
14381445 int res = REAL(pthread_mutex_trylock)(m);
14391446 if (res == errno_EOWNERDEAD)
14401447 MutexRepair(thr, pc, (uptr)m);
......@@ -1446,6 +1453,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_trylock, void *m) {
14461453#if !SANITIZER_APPLE
14471454TSAN_INTERCEPTOR(int, pthread_mutex_timedlock, void *m, void *abstime) {
14481455 SCOPED_TSAN_INTERCEPTOR(pthread_mutex_timedlock, m, abstime);
1456 AdaptiveDelay::SyncOp();
14491457 int res = REAL(pthread_mutex_timedlock)(m, abstime);
14501458 if (res == 0) {
14511459 MutexPostLock(thr, pc, (uptr)m, MutexFlagTryLock);
......@@ -1458,6 +1466,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_unlock, void *m) {
14581466 SCOPED_TSAN_INTERCEPTOR(pthread_mutex_unlock, m);
14591467 MutexUnlock(thr, pc, (uptr)m);
14601468 int res = REAL(pthread_mutex_unlock)(m);
1469 AdaptiveDelay::SyncOp();
14611470 if (res == errno_EINVAL)
14621471 MutexInvalidAccess(thr, pc, (uptr)m);
14631472 return res;
......@@ -1468,6 +1477,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_clocklock, void *m,
14681477 __sanitizer_clockid_t clock, void *abstime) {
14691478 SCOPED_TSAN_INTERCEPTOR(pthread_mutex_clocklock, m, clock, abstime);
14701479 MutexPreLock(thr, pc, (uptr)m);
1480 AdaptiveDelay::SyncOp();
14711481 int res = BLOCK_REAL(pthread_mutex_clocklock)(m, clock, abstime);
14721482 if (res == errno_EOWNERDEAD)
14731483 MutexRepair(thr, pc, (uptr)m);
......@@ -1486,6 +1496,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_clocklock, void *m,
14861496TSAN_INTERCEPTOR(int, __pthread_mutex_lock, void *m) {
14871497 SCOPED_TSAN_INTERCEPTOR(__pthread_mutex_lock, m);
14881498 MutexPreLock(thr, pc, (uptr)m);
1499 AdaptiveDelay::SyncOp();
14891500 int res = BLOCK_REAL(__pthread_mutex_lock)(m);
14901501 if (res == errno_EOWNERDEAD)
14911502 MutexRepair(thr, pc, (uptr)m);
......@@ -1500,6 +1511,7 @@ TSAN_INTERCEPTOR(int, __pthread_mutex_unlock, void *m) {
15001511 SCOPED_TSAN_INTERCEPTOR(__pthread_mutex_unlock, m);
15011512 MutexUnlock(thr, pc, (uptr)m);
15021513 int res = REAL(__pthread_mutex_unlock)(m);
1514 AdaptiveDelay::SyncOp();
15031515 if (res == errno_EINVAL)
15041516 MutexInvalidAccess(thr, pc, (uptr)m);
15051517 return res;
......@@ -1529,6 +1541,7 @@ TSAN_INTERCEPTOR(int, pthread_spin_destroy, void *m) {
15291541TSAN_INTERCEPTOR(int, pthread_spin_lock, void *m) {
15301542 SCOPED_TSAN_INTERCEPTOR(pthread_spin_lock, m);
15311543 MutexPreLock(thr, pc, (uptr)m);
1544 AdaptiveDelay::SyncOp();
15321545 int res = BLOCK_REAL(pthread_spin_lock)(m);
15331546 if (res == 0) {
15341547 MutexPostLock(thr, pc, (uptr)m);
......@@ -1538,6 +1551,7 @@ TSAN_INTERCEPTOR(int, pthread_spin_lock, void *m) {
15381551
15391552TSAN_INTERCEPTOR(int, pthread_spin_trylock, void *m) {
15401553 SCOPED_TSAN_INTERCEPTOR(pthread_spin_trylock, m);
1554 AdaptiveDelay::SyncOp();
15411555 int res = REAL(pthread_spin_trylock)(m);
15421556 if (res == 0) {
15431557 MutexPostLock(thr, pc, (uptr)m, MutexFlagTryLock);
......@@ -1549,6 +1563,7 @@ TSAN_INTERCEPTOR(int, pthread_spin_unlock, void *m) {
15491563 SCOPED_TSAN_INTERCEPTOR(pthread_spin_unlock, m);
15501564 MutexUnlock(thr, pc, (uptr)m);
15511565 int res = REAL(pthread_spin_unlock)(m);
1566 AdaptiveDelay::SyncOp();
15521567 return res;
15531568}
15541569#endif
......@@ -1574,6 +1589,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_destroy, void *m) {
15741589TSAN_INTERCEPTOR(int, pthread_rwlock_rdlock, void *m) {
15751590 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_rdlock, m);
15761591 MutexPreReadLock(thr, pc, (uptr)m);
1592 AdaptiveDelay::SyncOp();
15771593 int res = REAL(pthread_rwlock_rdlock)(m);
15781594 if (res == 0) {
15791595 MutexPostReadLock(thr, pc, (uptr)m);
......@@ -1583,6 +1599,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_rdlock, void *m) {
15831599
15841600TSAN_INTERCEPTOR(int, pthread_rwlock_tryrdlock, void *m) {
15851601 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_tryrdlock, m);
1602 AdaptiveDelay::SyncOp();
15861603 int res = REAL(pthread_rwlock_tryrdlock)(m);
15871604 if (res == 0) {
15881605 MutexPostReadLock(thr, pc, (uptr)m, MutexFlagTryLock);
......@@ -1593,6 +1610,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_tryrdlock, void *m) {
15931610#if !SANITIZER_APPLE
15941611TSAN_INTERCEPTOR(int, pthread_rwlock_timedrdlock, void *m, void *abstime) {
15951612 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_timedrdlock, m, abstime);
1613 AdaptiveDelay::SyncOp();
15961614 int res = REAL(pthread_rwlock_timedrdlock)(m, abstime);
15971615 if (res == 0) {
15981616 MutexPostReadLock(thr, pc, (uptr)m);
......@@ -1604,6 +1622,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_timedrdlock, void *m, void *abstime) {
16041622TSAN_INTERCEPTOR(int, pthread_rwlock_wrlock, void *m) {
16051623 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_wrlock, m);
16061624 MutexPreLock(thr, pc, (uptr)m);
1625 AdaptiveDelay::SyncOp();
16071626 int res = BLOCK_REAL(pthread_rwlock_wrlock)(m);
16081627 if (res == 0) {
16091628 MutexPostLock(thr, pc, (uptr)m);
......@@ -1613,6 +1632,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_wrlock, void *m) {
16131632
16141633TSAN_INTERCEPTOR(int, pthread_rwlock_trywrlock, void *m) {
16151634 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_trywrlock, m);
1635 AdaptiveDelay::SyncOp();
16161636 int res = REAL(pthread_rwlock_trywrlock)(m);
16171637 if (res == 0) {
16181638 MutexPostLock(thr, pc, (uptr)m, MutexFlagTryLock);
......@@ -1623,6 +1643,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_trywrlock, void *m) {
16231643#if !SANITIZER_APPLE
16241644TSAN_INTERCEPTOR(int, pthread_rwlock_timedwrlock, void *m, void *abstime) {
16251645 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_timedwrlock, m, abstime);
1646 AdaptiveDelay::SyncOp();
16261647 int res = REAL(pthread_rwlock_timedwrlock)(m, abstime);
16271648 if (res == 0) {
16281649 MutexPostLock(thr, pc, (uptr)m, MutexFlagTryLock);
......@@ -1635,6 +1656,7 @@ TSAN_INTERCEPTOR(int, pthread_rwlock_unlock, void *m) {
16351656 SCOPED_TSAN_INTERCEPTOR(pthread_rwlock_unlock, m);
16361657 MutexReadOrWriteUnlock(thr, pc, (uptr)m);
16371658 int res = REAL(pthread_rwlock_unlock)(m);
1659 AdaptiveDelay::SyncOp();
16381660 return res;
16391661}
16401662
......@@ -2574,9 +2596,9 @@ static void HandleRecvmsg(ThreadState *thr, uptr pc,
25742596
25752597#define COMMON_INTERCEPTOR_DLOPEN(filename, flag) \
25762598 ({ \
2577 CheckNoDeepBind(filename, flag); \
2599 OnDlOpen(filename, flag); \
25782600 ThreadIgnoreBegin(thr, 0); \
2579 void *res = REAL(dlopen)(filename, flag); \
2601 void* res = REAL(dlopen)(filename, flag); \
25802602 ThreadIgnoreEnd(thr); \
25812603 res; \
25822604 })
lib/libtsan/tsan_interface_ann.cpp+9-5
......@@ -9,17 +9,19 @@
99// This file is a part of ThreadSanitizer (TSan), a race detector.
1010//
1111//===----------------------------------------------------------------------===//
12#include "sanitizer_common/sanitizer_libc.h"
12#include "tsan_interface_ann.h"
13
1314#include "sanitizer_common/sanitizer_internal_defs.h"
15#include "sanitizer_common/sanitizer_libc.h"
1416#include "sanitizer_common/sanitizer_placement_new.h"
1517#include "sanitizer_common/sanitizer_stacktrace.h"
1618#include "sanitizer_common/sanitizer_vector.h"
17#include "tsan_interface_ann.h"
18#include "tsan_report.h"
19#include "tsan_rtl.h"
20#include "tsan_mman.h"
19#include "tsan_adaptive_delay.h"
2120#include "tsan_flags.h"
21#include "tsan_mman.h"
2222#include "tsan_platform.h"
23#include "tsan_report.h"
24#include "tsan_rtl.h"
2325
2426#define CALLERPC ((uptr)__builtin_return_address(0))
2527
......@@ -370,6 +372,7 @@ void __tsan_mutex_pre_lock(void *m, unsigned flagz) {
370372 }
371373 ThreadIgnoreBegin(thr, 0);
372374 ThreadIgnoreSyncBegin(thr, 0);
375 AdaptiveDelay::SyncOp();
373376}
374377
375378INTERFACE_ATTRIBUTE
......@@ -402,6 +405,7 @@ int __tsan_mutex_pre_unlock(void *m, unsigned flagz) {
402405
403406INTERFACE_ATTRIBUTE
404407void __tsan_mutex_post_unlock(void *m, unsigned flagz) {
408 AdaptiveDelay::SyncOp();
405409 SCOPED_ANNOTATION(__tsan_mutex_post_unlock);
406410 ThreadIgnoreSyncEnd(thr);
407411 ThreadIgnoreEnd(thr);
lib/libtsan/tsan_interface_atomic.cpp+12
......@@ -21,6 +21,7 @@
2121#include "sanitizer_common/sanitizer_mutex.h"
2222#include "sanitizer_common/sanitizer_placement_new.h"
2323#include "sanitizer_common/sanitizer_stacktrace.h"
24#include "tsan_adaptive_delay.h"
2425#include "tsan_flags.h"
2526#include "tsan_interface.h"
2627#include "tsan_rtl.h"
......@@ -520,8 +521,19 @@ static morder to_morder(int mo) {
520521 return res;
521522}
522523
524template <class... Types>
525ALWAYS_INLINE auto AtomicDelayImpl(morder mo, Types... args) {
526 AdaptiveDelay::AtomicOpFence(mo);
527}
528
529template <class AddrType, class... Types>
530ALWAYS_INLINE auto AtomicDelayImpl(morder mo, AddrType addr, Types... args) {
531 AdaptiveDelay::AtomicOpAddr((uptr)addr, (int)mo);
532}
533
523534template <class Op, class... Types>
524535ALWAYS_INLINE auto AtomicImpl(morder mo, Types... args) {
536 AtomicDelayImpl(mo, args...);
525537 ThreadState *const thr = cur_thread();
526538 ProcessPendingSignals(thr);
527539 if (UNLIKELY(thr->ignore_sync || thr->ignore_interceptors))
lib/libtsan/tsan_platform.h+10-7
......@@ -404,7 +404,7 @@ struct MappingRiscv64_39 {
404404 static const uptr kHeapMemBeg = 0x2c00000000ull;
405405 static const uptr kHeapMemEnd = 0x2c00000000ull;
406406 static const uptr kHiAppMemBeg = 0x3c00000000ull;
407 static const uptr kHiAppMemEnd = 0x3fffffffffull;
407 static const uptr kHiAppMemEnd = 0x4000000000ull;
408408 static const uptr kShadowMsk = 0x3800000000ull;
409409 static const uptr kShadowXor = 0x0800000000ull;
410410 static const uptr kShadowAdd = 0x0000000000ull;
......@@ -434,7 +434,7 @@ struct MappingRiscv64_48 {
434434 static const uptr kHeapMemBeg = 0x5a0000000000ull;
435435 static const uptr kHeapMemEnd = 0x5a0000000000ull;
436436 static const uptr kHiAppMemBeg = 0x7a0000000000ull;
437 static const uptr kHiAppMemEnd = 0x7fffffffffffull;
437 static const uptr kHiAppMemEnd = 0x800000000000ull;
438438 static const uptr kShadowMsk = 0x700000000000ull;
439439 static const uptr kShadowXor = 0x100000000000ull;
440440 static const uptr kShadowAdd = 0x000000000000ull;
......@@ -738,13 +738,16 @@ struct MappingGoRiscv64_48 {
738738Go on linux/s390x
7397390000 0000 1000 - 1000 0000 0000: executable and heap - 16 TiB
7407401000 0000 0000 - 4000 0000 0000: -
7414000 0000 0000 - 6000 0000 0000: shadow - 64TiB (4 * app)
7426000 0000 0000 - 9000 0000 0000: -
7439000 0000 0000 - 9800 0000 0000: metainfo - 8TiB (0.5 * app)
7414000 0000 0000 - 6000 0000 0000: shadow - 32 TiB (2 * app)
7426000 0000 0000 - 7000 0000 0000: -
7437000 0000 0000 - 7800 0000 0000: metainfo - 8 TiB (0.5 * app)
7447800 0000 0000 - 8000 0000 0000: -
744745*/
745746struct MappingGoS390x {
746 static const uptr kMetaShadowBeg = 0x900000000000ull;
747 static const uptr kMetaShadowEnd = 0x980000000000ull;
747 // Keep the mapping below 2^47 for QEMU linux-user on x86-64 hosts with
748 // four-level page tables.
749 static const uptr kMetaShadowBeg = 0x700000000000ull;
750 static const uptr kMetaShadowEnd = 0x780000000000ull;
748751 static const uptr kShadowBeg = 0x400000000000ull;
749752 static const uptr kShadowEnd = 0x600000000000ull;
750753 static const uptr kLoAppMemBeg = 0x000000001000ull;
lib/libtsan/tsan_platform_linux.cpp+12
......@@ -27,6 +27,18 @@
2727#include "tsan_platform.h"
2828#include "tsan_rtl.h"
2929
30#if SANITIZER_NETBSD
31# // for __lwp_gettcb_fast() / __lwp_getprivate_fast()
32# define _RTLD_SOURCE
33# include <sys/types.h>
34# include <machine/mcontext.h>
35# undef _RTLD_SOURCE
36# include <sys/param.h>
37# if __NetBSD_Version__ >= 1099001200
38# include <machine/lwp_private.h>
39# endif
40#endif
41
3042#include <fcntl.h>
3143#include <pthread.h>
3244#include <signal.h>
lib/libtsan/tsan_report.cpp+3-2
......@@ -317,8 +317,9 @@ void PrintReport(const ReportDesc *rep) {
317317 } else {
318318 PrintStack(rep->stacks[i]);
319319 if (i == 0)
320 Printf(" Hint: use TSAN_OPTIONS=second_deadlock_stack=1 "
321 "to get more informative warning message\n\n");
320 Printf(
321 " HINT: use TSAN_OPTIONS=second_deadlock_stack=1 "
322 "to get more informative warning message\n\n");
322323 }
323324 }
324325 } else {
lib/libtsan/tsan_rtl.cpp+5
......@@ -21,6 +21,7 @@
2121#include "sanitizer_common/sanitizer_placement_new.h"
2222#include "sanitizer_common/sanitizer_stackdepot.h"
2323#include "sanitizer_common/sanitizer_symbolizer.h"
24#include "tsan_adaptive_delay.h"
2425#include "tsan_defs.h"
2526#include "tsan_interface.h"
2627#include "tsan_mman.h"
......@@ -775,6 +776,10 @@ void Initialize(ThreadState *thr) {
775776 while (__tsan_resumed == 0) {}
776777 }
777778
779#if !SANITIZER_GO
780 AdaptiveDelay::Init();
781#endif
782
778783 OnInitialize();
779784}
780785
lib/libtsan/tsan_rtl.h+3
......@@ -34,6 +34,7 @@
3434#include "sanitizer_common/sanitizer_suppressions.h"
3535#include "sanitizer_common/sanitizer_thread_registry.h"
3636#include "sanitizer_common/sanitizer_vector.h"
37#include "tsan_adaptive_delay.h"
3738#include "tsan_defs.h"
3839#include "tsan_flags.h"
3940#include "tsan_ignoreset.h"
......@@ -240,6 +241,8 @@ struct alignas(SANITIZER_CACHE_LINE_SIZE) ThreadState {
240241 bool in_internal_write_call;
241242#endif
242243
244 AdaptiveDelayState adaptive_delay_state;
245
243246 explicit ThreadState(Tid tid);
244247};
245248
lib/libtsan/ubsan/ubsan_flags.h+4
......@@ -41,6 +41,10 @@ extern "C" {
4141// override the default flag values.
4242SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
4343const char *__ubsan_default_options();
44// Users may provide their own implementation of __ubsan_default_suppressions to
45// override the default suppression values.
46SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE const char *
47__ubsan_default_suppressions();
4448} // extern "C"
4549
4650#endif // UBSAN_FLAGS_H
lib/libunwind/include/__libunwind_config.h+1-1
......@@ -9,7 +9,7 @@
99#ifndef ____LIBUNWIND_CONFIG_H__
1010#define ____LIBUNWIND_CONFIG_H__
1111
12#define _LIBUNWIND_VERSION 15000
12#define _LIBUNWIND_VERSION 230000
1313
1414#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
1515 !defined(__ARM_DWARF_EH__) && !defined(__SEH__)
lib/libunwind/include/libunwind.h+1-1
......@@ -122,7 +122,7 @@
122122 __unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer, 1, \
123123 __ptrauth_unwind_cie_info_personality_disc)
124124
125 // ptrauth_string_discriminator("personality") == 0x7EAD)
125 // ptrauth_string_discriminator("personality") == 0x7EAD
126126 #define __ptrauth_unwind_pauthtest_personality_disc 0x7EAD
127127
128128#else
lib/libunwind/include/mach-o/compact_unwind_encoding.h+1-1
......@@ -443,7 +443,7 @@ struct unwind_info_section_header_lsda_index_entry
443443
444444struct unwind_info_regular_second_level_entry
445445{
446 uint32_t functionOffset;
446 uint32_t functionOffset;
447447 compact_unwind_encoding_t encoding;
448448};
449449
lib/libunwind/include/unwind_itanium.h+1-1
......@@ -32,7 +32,7 @@ struct _Unwind_Exception {
3232 // The implementation of _Unwind_Exception uses an attribute mode on the
3333 // above fields which has the side effect of causing this whole struct to
3434 // round up to 32 bytes in size (48 with SEH). To be more explicit, we add
35 // pad fields added for binary compatibility.
35 // pad fields for binary compatibility.
3636 uint32_t reserved[3];
3737#endif
3838 // The Itanium ABI requires that _Unwind_Exception objects are "double-word
lib/libunwind/src/AddressSpace.hpp-1
......@@ -666,7 +666,6 @@ inline bool LocalAddressSpace::findUnwindSections(
666666 return true;
667667 }
668668#endif
669 // zig patch: https://github.com/llvm/llvm-project/issues/194228
670669 dl_iterate_cb_data cb_data = {this, &info, static_cast<pint_t>(targetAddr)};
671670 int found = dl_iterate_phdr(findUnwindSectionsByPhdr, &cb_data);
672671 return static_cast<bool>(found);
lib/libunwind/src/CompactUnwinder.hpp+5-4
......@@ -12,6 +12,7 @@
1212#ifndef __COMPACT_UNWINDER_HPP__
1313#define __COMPACT_UNWINDER_HPP__
1414
15#include <inttypes.h>
1516#include <stdint.h>
1617#include <stdlib.h>
1718
......@@ -335,8 +336,8 @@ int CompactUnwinder_x86_64<A>::stepWithCompactEncodingRBPFrame(
335336 default:
336337 (void)functionStart;
337338 _LIBUNWIND_DEBUG_LOG("bad register for RBP frame, encoding=%08X for "
338 "function starting at 0x%llX",
339 compactEncoding, functionStart);
339 "function starting at 0x%" PRIu64 "X",
340 compactEncoding, functionStart);
340341 _LIBUNWIND_ABORT("invalid compact unwind encoding");
341342 }
342343 savedRegisters += 8;
......@@ -454,8 +455,8 @@ int CompactUnwinder_x86_64<A>::stepWithCompactEncodingFrameless(
454455 break;
455456 default:
456457 _LIBUNWIND_DEBUG_LOG("bad register for frameless, encoding=%08X for "
457 "function starting at 0x%llX",
458 encoding, functionStart);
458 "function starting at 0x%" PRIu64 "X",
459 encoding, functionStart);
459460 _LIBUNWIND_ABORT("invalid compact unwind encoding");
460461 }
461462 savedRegisters += 8;
lib/libunwind/src/DwarfInstructions.hpp+17-26
......@@ -76,10 +76,14 @@ private:
7676 __builtin_unreachable();
7777 }
7878#if defined(_LIBUNWIND_TARGET_AARCH64)
79 static bool isReturnAddressSigned(A &addressSpace, R registers, pint_t cfa,
80 PrologInfo &prolog);
81 static bool isReturnAddressSignedWithPC(A &addressSpace, R registers,
82 pint_t cfa, PrologInfo &prolog);
79 enum RASignStatus {
80 RANotSigned = 0,
81 RASigned = 1,
82 RASignedWithPC = 2,
83 };
84 static RASignStatus getReturnAddressSignStatus(A &addressSpace, R registers,
85 pint_t cfa,
86 PrologInfo &prolog);
8387#endif
8488};
8589
......@@ -177,7 +181,8 @@ v128 DwarfInstructions<A, R>::getSavedVectorRegister(
177181}
178182#if defined(_LIBUNWIND_TARGET_AARCH64)
179183template <typename A, typename R>
180bool DwarfInstructions<A, R>::isReturnAddressSigned(A &addressSpace,
184typename DwarfInstructions<A, R>::RASignStatus
185DwarfInstructions<A, R>::getReturnAddressSignStatus(A &addressSpace,
181186 R registers, pint_t cfa,
182187 PrologInfo &prolog) {
183188 pint_t raSignState;
......@@ -187,24 +192,9 @@ bool DwarfInstructions<A, R>::isReturnAddressSigned(A &addressSpace,
187192 else
188193 raSignState = getSavedRegister(addressSpace, registers, cfa, regloc);
189194
190 // Only bit[0] is meaningful.
191 return raSignState & 0x01;
192}
193
194template <typename A, typename R>
195bool DwarfInstructions<A, R>::isReturnAddressSignedWithPC(A &addressSpace,
196 R registers,
197 pint_t cfa,
198 PrologInfo &prolog) {
199 pint_t raSignState;
200 auto regloc = prolog.savedRegisters[UNW_AARCH64_RA_SIGN_STATE];
201 if (regloc.location == CFI_Parser<A>::kRegisterUnused)
202 raSignState = static_cast<pint_t>(regloc.value);
203 else
204 raSignState = getSavedRegister(addressSpace, registers, cfa, regloc);
205
206 // Only bit[1] is meaningful.
207 return raSignState & 0x02;
195 // bits[1:0] describe how RA is signed.
196 assert((raSignState & 0x3) != 3 && "unexpected RA sign state");
197 return static_cast<RASignStatus>(raSignState & 0x3);
208198}
209199#endif
210200
......@@ -317,8 +307,9 @@ int DwarfInstructions<A, R>::stepWithDwarf(
317307 // return address needs to be authenticated before the return address is
318308 // restored. autia1716 is used instead of autia as autia1716 assembles
319309 // to a NOP on pre-v8.3a architectures.
320 if ((R::getArch() == REGISTERS_ARM64) &&
321 isReturnAddressSigned(addressSpace, registers, cfa, prolog) &&
310 RASignStatus RAState =
311 getReturnAddressSignStatus(addressSpace, registers, cfa, prolog);
312 if ((R::getArch() == REGISTERS_ARM64) && RAState != RANotSigned &&
322313 returnAddress != 0) {
323314#if !defined(_LIBUNWIND_IS_NATIVE_ONLY)
324315 return UNW_ECROSSRASIGNING;
......@@ -329,7 +320,7 @@ int DwarfInstructions<A, R>::stepWithDwarf(
329320 // We use the hint versions of the authentication instructions below to
330321 // ensure they're assembled by the compiler even for targets with no
331322 // FEAT_PAuth/FEAT_PAuth_LR support.
332 if (isReturnAddressSignedWithPC(addressSpace, registers, cfa, prolog)) {
323 if (RAState == RASignedWithPC) {
333324 register unsigned long long x15 __asm("x15") =
334325 prolog.ptrAuthDiversifier;
335326 if (cieInfo.addressesSignedWithBKey) {
lib/libunwind/src/DwarfParser.hpp-1
......@@ -473,7 +473,6 @@ bool CFI_Parser<A>::parseFDEInstructions(
473473 pint_t pcoffset;
474474 };
475475
476 // zig patch: https://github.com/llvm/llvm-project/issues/194228
477476 ParseInfo parseInfoArray[] = {
478477 {cieInfo.cieInstructions, cieInfo.cieStart + cieInfo.cieLength,
479478 (pint_t)(-1)},
lib/libunwind/src/FrameHeaderCache.hpp+1-1
......@@ -24,7 +24,7 @@
2424#define _LIBUNWIND_FRAMEHEADERCACHE_TRACE(msg, ...)
2525#endif
2626
27// This cache should only be be used from within a dl_iterate_phdr callback.
27// This cache should only be used from within a dl_iterate_phdr callback.
2828// dl_iterate_phdr does the necessary synchronization to prevent problems
2929// with concurrent access via the libc load lock. Adding synchronization
3030// for other uses is possible, but not currently done.
lib/libunwind/src/Registers.hpp+17-6
......@@ -20,6 +20,9 @@
2020#include "libunwind_ext.h"
2121#include "shadow_stack_unwind.h"
2222
23#if defined(__APPLE__)
24#include <sys/sysctl.h>
25#endif
2326#if defined(_LIBUNWIND_HAVE_GETAUXVAL) || defined(_LIBUNWIND_HAVE_ELF_AUX_INFO)
2427#include <sys/auxv.h>
2528#endif
......@@ -1892,7 +1895,7 @@ public:
18921895 uint64_t value = _registers.__pc;
18931896#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
18941897 // Note the value of the PC was signed to its address in the register state
1895 // but everyone else expects it to be sign by the SP, so convert on return.
1898 // but everyone else expects it to be signed by the SP, so convert on return.
18961899 value = (uint64_t)ptrauth_auth_and_resign((void *)_registers.__pc,
18971900 ptrauth_key_return_address,
18981901 &_registers.__pc,
......@@ -1940,7 +1943,15 @@ private:
19401943 _LIBUNWIND_ABORT("SME ZA disable failed");
19411944 }
19421945
1943#if defined(_LIBUNWIND_HAVE_GETAUXVAL)
1946#if defined(__APPLE__)
1947 static bool checkHasSME() {
1948 int has_sme = 0;
1949 size_t size = sizeof(has_sme);
1950 if (sysctlbyname("hw.optional.arm.FEAT_SME", &has_sme, &size, NULL, 0))
1951 return false;
1952 return has_sme != 0;
1953 }
1954#elif defined(_LIBUNWIND_HAVE_GETAUXVAL)
19441955 static bool checkHasSME() {
19451956 constexpr int hwcap2_sme = (1 << 23);
19461957 unsigned long hwcap2 = getauxval(AT_HWCAP2);
......@@ -3724,21 +3735,21 @@ inline void Registers_sparc::setRegister(int regNum, uint32_t value) {
37243735inline bool Registers_sparc::validFloatRegister(int) const { return false; }
37253736
37263737inline double Registers_sparc::getFloatRegister(int) const {
3727 _LIBUNWIND_ABORT("no Sparc float registers");
3738 _LIBUNWIND_ABORT("no sparc float registers");
37283739}
37293740
37303741inline void Registers_sparc::setFloatRegister(int, double) {
3731 _LIBUNWIND_ABORT("no Sparc float registers");
3742 _LIBUNWIND_ABORT("no sparc float registers");
37323743}
37333744
37343745inline bool Registers_sparc::validVectorRegister(int) const { return false; }
37353746
37363747inline v128 Registers_sparc::getVectorRegister(int) const {
3737 _LIBUNWIND_ABORT("no Sparc vector registers");
3748 _LIBUNWIND_ABORT("no sparc vector registers");
37383749}
37393750
37403751inline void Registers_sparc::setVectorRegister(int, v128) {
3741 _LIBUNWIND_ABORT("no Sparc vector registers");
3752 _LIBUNWIND_ABORT("no sparc vector registers");
37423753}
37433754
37443755inline const char *Registers_sparc::getRegisterName(int regNum) {
lib/libunwind/src/Unwind-wasm.c+20-3
......@@ -54,7 +54,7 @@ _Unwind_Reason_Code _Unwind_CallPersonality(void *exception_ptr) {
5454 __wasm_lpad_context.selector = 0;
5555
5656 // Call personality function. Wasm does not have two-phase unwinding, so we
57 // only do the cleanup phase.
57 // only do the search phase.
5858 return __gxx_personality_wasm0(
5959 1, _UA_SEARCH_PHASE, exception_object->exception_class, exception_object,
6060 (struct _Unwind_Context *)&__wasm_lpad_context);
......@@ -69,6 +69,21 @@ _Unwind_RaiseException(_Unwind_Exception *exception_object) {
6969 __builtin_wasm_throw(0, exception_object);
7070}
7171
72// Define the `__cpp_exception` symbol which `__builtin_wasm_throw` above will
73// reference. This is defined here in `libunwind` as the single canonical
74// definition for this API and it's required for users to ensure that there's
75// only one copy of `libunwind` within a wasm module to ensure this is only
76// defined once and exactly once.
77__asm__(".globl __cpp_exception\n"
78#if defined(__wasm32__)
79 ".tagtype __cpp_exception i32\n"
80#elif defined(__wasm64__)
81 ".tagtype __cpp_exception i64\n"
82#else
83#error "Unsupported Wasm architecture"
84#endif
85 "__cpp_exception:\n");
86
7287/// Called by __cxa_end_catch.
7388_LIBUNWIND_EXPORT void
7489_Unwind_DeleteException(_Unwind_Exception *exception_object) {
......@@ -102,7 +117,8 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
102117}
103118
104119/// Not used in Wasm.
105_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t) {}
120_LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context,
121 uintptr_t value) {}
106122
107123/// Called by personality handler to get LSDA for current frame.
108124_LIBUNWIND_EXPORT uintptr_t
......@@ -114,7 +130,8 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
114130}
115131
116132/// Not used in Wasm.
117_LIBUNWIND_EXPORT uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *) {
133_LIBUNWIND_EXPORT uintptr_t
134_Unwind_GetRegionStart(struct _Unwind_Context *context) {
118135 return 0;
119136}
120137
lib/libunwind/src/UnwindCursor.hpp+119-7
......@@ -963,7 +963,7 @@ template <typename A, typename R> bool UnwindCursor<A, R>::isSignalFrame() {
963963/// UnwindCursor contains all state (including all register values) during
964964/// an unwind. This is normally stack allocated inside a unw_cursor_t.
965965template <typename A, typename R>
966class UnwindCursor : public AbstractUnwindCursor{
966class UnwindCursor : public AbstractUnwindCursor {
967967 typedef typename A::pint_t pint_t;
968968public:
969969 UnwindCursor(unw_context_t *context, A &as);
......@@ -1363,6 +1363,10 @@ private:
13631363 reinterpret_cast<tbtable *>(_info.unwind_info),
13641364 _registers, _isSignalFrame);
13651365 }
1366 bool isKnownVapiNotActive() const { return _isKnownVapiNotActive; }
1367 void setIsKnownVapiNotActive(bool val) { _isKnownVapiNotActive = val; }
1368 static pint_t getVAPILR();
1369
13661370#endif // defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
13671371
13681372 A &_addressSpace;
......@@ -1377,13 +1381,23 @@ private:
13771381#ifdef _LIBUNWIND_TRACE_RET_INJECT
13781382 uint32_t _walkedFrames;
13791383#endif
1384#if defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
1385 // TODO: this will need to be recorded in the unw_context_t by unw_getcontext
1386 // to support cases where the cursor is retrieved prior to invocation of the
1387 // Virtual API.
1388 bool _isKnownVapiNotActive;
1389#endif
13801390};
13811391
1382
13831392template <typename A, typename R>
13841393UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
13851394 : _addressSpace(as), _registers(context), _unwindInfoMissing(false),
1386 _isSignalFrame(false) {
1395 _isSignalFrame(false)
1396#if defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
1397 ,
1398 _isKnownVapiNotActive(false)
1399#endif
1400{
13871401 static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit),
13881402 "UnwindCursor<> does not fit in unw_cursor_t");
13891403 static_assert((alignof(UnwindCursor<A, R>) <= alignof(unw_cursor_t)),
......@@ -1393,13 +1407,17 @@ UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
13931407
13941408template <typename A, typename R>
13951409UnwindCursor<A, R>::UnwindCursor(A &as, void *)
1396 : _addressSpace(as), _unwindInfoMissing(false), _isSignalFrame(false) {
1410 : _addressSpace(as), _unwindInfoMissing(false), _isSignalFrame(false)
1411#if defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
1412 ,
1413 _isKnownVapiNotActive(false)
1414#endif
1415{
13971416 memset(static_cast<void *>(&_info), 0, sizeof(_info));
13981417 // FIXME
13991418 // fill in _registers from thread arg
14001419}
14011420
1402
14031421template <typename A, typename R>
14041422bool UnwindCursor<A, R>::validReg(int regNum) {
14051423 return _registers.validRegister(regNum);
......@@ -1469,6 +1487,30 @@ template <typename A, typename R> void UnwindCursor<A, R>::jumpto() {
14691487 static constexpr size_t _EXTRA_LIBUNWIND_FRAMES_WALKED = 5 - 1;
14701488 _registers.returnto(_walkedFrames + _EXTRA_LIBUNWIND_FRAMES_WALKED);
14711489#else
1490#if defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
1491 if (isKnownVapiNotActive()) {
1492 // If the current frame is known VAPI not active, execute the VAPI return
1493 // glue to clear the VAPI control block. The VAPI return glue is used by
1494 // AIX longjmp based on the VAPI active status recorded by setjmp in the
1495 // jmp_buf, which means that the VAPI return glue can be called solely on
1496 // the basis of the VAPI active status of the target context.
1497
1498 // VAPI return glue address is the VAPI glue address - 4.
1499#ifdef __64BIT__
1500 constexpr pint_t VAPIReturnGlue = 0x8e40 - 4;
1501#else
1502 constexpr pint_t VAPIReturnGlue = 0x8c40 - 4;
1503#endif
1504
1505 _LIBUNWIND_TRACE_UNWINDING("VAPI: executing return glue %p\n",
1506 reinterpret_cast<void *>(VAPIReturnGlue));
1507 register auto *registers __asm__("r30") = &_registers;
1508 __asm__ __volatile__("bla %[retglue]"
1509 : "+r"(registers)
1510 : [retglue] "i"(VAPIReturnGlue));
1511 registers->jumpto();
1512 }
1513#endif // defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
14721514 _registers.jumpto();
14731515#endif
14741516}
......@@ -2037,7 +2079,7 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(
20372079 if (personalityIndex != 0) {
20382080 --personalityIndex; // change 1-based to zero-based index
20392081 if (personalityIndex >= sectionHeader.personalityArrayCount()) {
2040 _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, "
2082 _LIBUNWIND_DEBUG_LOG("found encoding 0x%08X with personality index %d, "
20412083 "but personality table has only %d entries",
20422084 encoding, personalityIndex,
20432085 sectionHeader.personalityArrayCount());
......@@ -2459,6 +2501,45 @@ bool UnwindCursor<A, R>::getInfoFromTBTable(pint_t pc, R &registers) {
24592501 return true;
24602502}
24612503
2504// VAPI glue addresses
2505constexpr uintptr_t vapi_glue_addr_ext_32 = 0x8b80;
2506constexpr uintptr_t vapi_addr_64 = 0x8e00;
2507constexpr size_t vapi_size_64 = 0x0200;
2508constexpr uintptr_t vapi_glue_addr_begin =
2509 vapi_glue_addr_ext_32; // Start address in 32-bit
2510constexpr uintptr_t vapi_glue_addr_end =
2511 vapi_addr_64 + vapi_size_64; // End address in 64-bit
2512
2513#ifdef __64BIT__
2514constexpr size_t VAPI_CB_SIZE = 256;
2515constexpr ptrdiff_t TLS_POINTER_OFFSET = 30 * 1024;
2516constexpr size_t TLSCB_BASE_SIZE = 256;
2517
2518static __inline__ __attribute__((__always_inline__)) char *tptr(void) {
2519 char *result;
2520 __asm__("mr %0, 13" : "=r"(result));
2521 return result;
2522}
2523#else // 32-bit
2524constexpr size_t VAPI_CB_SIZE = 128;
2525constexpr ptrdiff_t TLS_POINTER_OFFSET = 31 * 1024;
2526constexpr size_t TLSCB_BASE_SIZE = 128;
2527
2528static __inline__ __attribute__((__always_inline__)) char *tptr(void) {
2529 char *result;
2530 __asm__("mfspr %0, 259" : "=r"(result));
2531 return result;
2532}
2533#endif
2534
2535constexpr ptrdiff_t VAPI_CB_OFFSET =
2536 TLS_POINTER_OFFSET + VAPI_CB_SIZE + TLSCB_BASE_SIZE;
2537
2538template <typename A, typename R>
2539typename UnwindCursor<A, R>::pint_t UnwindCursor<A, R>::getVAPILR() {
2540 return *reinterpret_cast<pint_t *>(tptr() - VAPI_CB_OFFSET + 8);
2541}
2542
24622543// Step back up the stack following the frame back link.
24632544template <typename A, typename R>
24642545int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
......@@ -2511,6 +2592,16 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
25112592 _LIBUNWIND_TRACE_UNWINDING("Possible signal handler frame: lastStack=%p",
25122593 reinterpret_cast<void *>(lastStack));
25132594
2595 pint_t returnAddressInStack = reinterpret_cast<pint_t *>(lastStack)[2];
2596 if (vapi_glue_addr_begin <= returnAddressInStack &&
2597 returnAddressInStack < vapi_glue_addr_end) {
2598 _LIBUNWIND_TRACE_UNWINDING(
2599 "The return address in stack %p is within the range of VAPI address;"
2600 " set isKnownVapiNotActive to true\n",
2601 reinterpret_cast<void *>(returnAddressInStack));
2602 setIsKnownVapiNotActive(true);
2603 }
2604
25142605 sigcontext *sigContext = reinterpret_cast<sigcontext *>(
25152606 reinterpret_cast<char *>(lastStack) + STKMINALIGN);
25162607 returnAddress = sigContext->sc_jmpbuf.jmp_context.iar;
......@@ -2579,6 +2670,17 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
25792670 } else {
25802671 // Otherwise, use the LR value in the stack link area.
25812672 returnAddress = reinterpret_cast<pint_t *>(lastStack)[2];
2673
2674 if (vapi_glue_addr_begin <= returnAddress &&
2675 returnAddress < vapi_glue_addr_end) {
2676 _LIBUNWIND_TRACE_UNWINDING(
2677 "The return address=%p is within the range of VAPI address;",
2678 reinterpret_cast<void *>(returnAddress));
2679 setIsKnownVapiNotActive(true);
2680 returnAddress = getVAPILR();
2681 _LIBUNWIND_TRACE_UNWINDING("return address=%p from VAPI\n",
2682 reinterpret_cast<void *>(returnAddress));
2683 }
25822684 }
25832685
25842686 // Reset LR in the current context.
......@@ -2709,6 +2811,16 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
27092811 // Return address is the address after call site instruction.
27102812 pint_t nextReturnAddress = reinterpret_cast<pint_t *>(nextStack)[2];
27112813
2814 if (vapi_glue_addr_begin <= nextReturnAddress &&
2815 nextReturnAddress < vapi_glue_addr_end) {
2816 _LIBUNWIND_TRACE_UNWINDING(
2817 "The next return address=%p is within the range of VAPI address;",
2818 reinterpret_cast<void *>(nextReturnAddress));
2819 nextReturnAddress = getVAPILR();
2820 _LIBUNWIND_TRACE_UNWINDING("the next return address=%p from VAPI\n",
2821 reinterpret_cast<void *>(nextReturnAddress));
2822 }
2823
27122824 if (nextReturnAddress > 0x01 && nextReturnAddress < 0x10000) {
27132825 _LIBUNWIND_TRACE_UNWINDING("The next is a signal handler frame: "
27142826 "nextStack=%p, next return address=%p\n",
......@@ -3256,7 +3368,7 @@ int UnwindCursor<A, R>::stepThroughSigReturn() {
32563368
32573369template <typename A, typename R> int UnwindCursor<A, R>::step(bool stage2) {
32583370 (void)stage2;
3259 // Bottom of stack is defined is when unwind info cannot be found.
3371 // Bottom of stack is defined when unwind info cannot be found.
32603372 if (_unwindInfoMissing)
32613373 return UNW_STEP_END;
32623374
lib/libunwind/src/UnwindLevel1-gcc-ext.c+1-1
......@@ -284,7 +284,7 @@ _LIBUNWIND_EXPORT void __deregister_frame(const void *fde) {
284284// before 10.6 used keymgr to track known FDEs, but these functions
285285// never got updated to use keymgr.
286286// For now, we implement these as do-nothing functions to keep any existing
287// applications working. We also add the not in 10.6 symbol so that nwe
287// applications working. We also add the not in 10.6 symbol so that new
288288// application won't be able to use them.
289289
290290#if defined(_LIBUNWIND_SUPPORT_FRAME_APIS)
lib/libunwind/src/UnwindLevel1.c+1-1
......@@ -14,7 +14,7 @@
1414// ARM EHABI does not specify _Unwind_{Get,Set}{GR,IP}(). Thus, we are
1515// defining inline functions to delegate the function calls to
1616// _Unwind_VRS_{Get,Set}(). However, some applications might declare the
17// function protetype directly (instead of including <unwind.h>), thus we need
17// function prototype directly (instead of including <unwind.h>), thus we need
1818// to export these functions from libunwind.so as well.
1919#define _LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE 1
2020
lib/libunwind/src/UnwindRegistersRestore.S+18-1
......@@ -678,9 +678,15 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
678678 ldp x18,x19, [x0, #0x090]
679679 ldp x20,x21, [x0, #0x0A0]
680680 ldp x22,x23, [x0, #0x0B0]
681#if defined(__LFI__)
682 ldr x24, [x0, #0x0C0]
683 // Skip reloading x25-x28; reserved by LFI ABI.
684 ldr x29, [x0, #0x0E8]
685#else
681686 ldp x24,x25, [x0, #0x0C0]
682687 ldp x26,x27, [x0, #0x0D0]
683688 ldp x28,x29, [x0, #0x0E0]
689#endif
684690
685691#if defined(__ARM_FP) && __ARM_FP != 0
686692 ldp d0, d1, [x0, #0x110]
......@@ -941,11 +947,22 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind14Registers_or1k6jumptoEv)
941947
942948#elif defined(__hexagon__)
943949# On entry:
944# thread_state pointer is in r2
950# thread_state pointer is in r0
945951DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind17Registers_hexagon6jumptoEv)
946952#
947953# void libunwind::Registers_hexagon::jumpto()
948954#
955# The context layout is hexagon_thread_state_t: unsigned int __r[35]
956# __r[0..31] = r0..r31, __r[32] = predicates, __r[33] = PC.
957# Offsets: __r[n] is at byte offset n*4. r0 is the context pointer, so
958# it is restored last; r31 is loaded with the saved PC as the jumpr target.
959 r2 = memw(r0+#8)
960 r3 = memw(r0+#12)
961 r4 = memw(r0+#16)
962 r5 = memw(r0+#20)
963 r6 = memw(r0+#24)
964 r7 = memw(r0+#28)
965
949966 r8 = memw(r0+#32)
950967 r9 = memw(r0+#36)
951968 r10 = memw(r0+#40)
lib/libunwind/src/UnwindRegistersSave.S+28-3
......@@ -794,13 +794,20 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
794794 stp x18,x19, [x0, #0x090]
795795 stp x20,x21, [x0, #0x0A0]
796796 stp x22,x23, [x0, #0x0B0]
797#if defined(__LFI__)
798 str x24, [x0, #0x0C0]
799 // Skip spilling x25-x28; reserved by LFI ABI.
800 str x29, [x0, #0x0E8]
801#else
797802 stp x24,x25, [x0, #0x0C0]
798803 stp x26,x27, [x0, #0x0D0]
799804 stp x28,x29, [x0, #0x0E0]
805#endif
800806 str x30, [x0, #0x0F0]
801807 mov x1,sp
802808 str x1, [x0, #0x0F8]
803809 str x30, [x0, #0x100] // store return address as pc
810 str xzr, [x0, #0x108] // zero __ra_sign_state
804811 // skip cpsr
805812#if defined(__ARM_FP) && __ARM_FP != 0
806813 stp d0, d1, [x0, #0x110]
......@@ -1096,8 +1103,21 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
10961103# On entry:
10971104# thread_state pointer is in r0
10981105#
1106# The context layout is hexagon_thread_state_t: unsigned int __r[35]
1107# __r[0..31] = r0..r31, __r[32] = predicates, __r[33] = PC, __r[34] = unused
1108# Offsets: __r[n] is at byte offset n*4.
1109#
10991110#define OFFSET(offset) (offset/4)
11001111DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
1112 // Save r1-r7 first (r0 is the context pointer, saved last)
1113 memw(r0+#4) = r1
1114 memw(r0+#8) = r2
1115 memw(r0+#12) = r3
1116 memw(r0+#16) = r4
1117 memw(r0+#20) = r5
1118 memw(r0+#24) = r6
1119 memw(r0+#28) = r7
1120
11011121 memw(r0+#32) = r8
11021122 memw(r0+#36) = r9
11031123 memw(r0+#40) = r10
......@@ -1127,12 +1147,17 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
11271147 memw(r0+#116) = r29
11281148 memw(r0+#120) = r30
11291149 memw(r0+#124) = r31
1130 r1 = c4 // Predicate register
1150
1151 r1 = c4 // Predicate register
11311152 memw(r0+#128) = r1
1132 r1 = memw(r30) // *FP == Saved FP
1133 r1 = r31
1153
1154 r1 = r31 // Store return address as PC
11341155 memw(r0+#132) = r1
11351156
1157 // Save r0 (the context pointer itself) last
1158 memw(r0+#0) = r0
1159
1160 r0 = #0 // return UNW_ESUCCESS
11361161 jumpr r31
11371162
11381163#elif defined(__sparc__) && defined(__arch64__)
lib/libunwind/src/libunwind.cpp+15-19
......@@ -32,7 +32,7 @@
3232
3333using namespace libunwind;
3434
35/// internal object to represent this processes address space
35/// internal object to represent this process's address space
3636LocalAddressSpace LocalAddressSpace::sThisAddressSpace;
3737
3838_LIBUNWIND_EXPORT unw_addr_space_t unw_local_addr_space =
......@@ -131,23 +131,19 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
131131 {
132132 // It is only valid to set the IP within the current function. This is
133133 // important for ptrauth, otherwise the IP cannot be correctly signed.
134 // The current signature of `value` is via the schema:
135 // __ptrauth(ptrauth_key_return_address, <<sp>>, 0)
136 // For this to be generally usable we manually re-sign it to the
137 // directly supported schema:
138 // __ptrauth(ptrauth_key_return_address, 1, 0)
139 unw_word_t
140 __unwind_ptrauth_restricted_intptr(ptrauth_key_return_address, 1,
141 0) authenticated_value;
142 unw_word_t opaque_value = (uint64_t)ptrauth_auth_and_resign(
143 (void *)value, ptrauth_key_return_address, sp,
144 ptrauth_key_return_address, &authenticated_value);
145 memmove(reinterpret_cast<void *>(&authenticated_value),
146 reinterpret_cast<void *>(&opaque_value),
147 sizeof(authenticated_value));
148 if (authenticated_value < info.start_ip ||
149 authenticated_value > info.end_ip)
150 _LIBUNWIND_ABORT("PC vs frame info mismatch");
134 //
135 // However many JITs do not configure CFI frames, so we cannot actually
136 // enforce this - at least not without an extremely expensive syscall.
137 //
138 // For the forseeable future this will need to be a debug only assertion
139 // so we just strip and assert to avoid the unnecessary auths in release
140 // builds.
141 unw_word_t stripped_value = (unw_word_t)ptrauth_strip(
142 (void *)value, ptrauth_key_return_address);
143 if (stripped_value < info.start_ip && stripped_value > info.end_ip)
144 _LIBUNWIND_LOG("Badly behaved use of unw_set_reg: moving IP(0x%zX) "
145 "outside of CFI bounds function (0x%zX, 0x%zX)",
146 stripped_value, info.start_ip, info.end_ip);
151147
152148 // PC should have been signed with the sp, so we verify that
153149 // roundtripping does not fail. The `ptrauth_auth_and_resign` is
......@@ -306,7 +302,7 @@ _LIBUNWIND_HIDDEN int __unw_is_fpreg(unw_cursor_t *cursor,
306302}
307303_LIBUNWIND_WEAK_ALIAS(__unw_is_fpreg, unw_is_fpreg)
308304
309/// Checks if a register is a floating-point register.
305/// Get name of specified register at cursor position in stack frame.
310306_LIBUNWIND_HIDDEN const char *__unw_regname(unw_cursor_t *cursor,
311307 unw_regnum_t regNum) {
312308 _LIBUNWIND_TRACE_API("__unw_regname(cursor=%p, regNum=%d)",
lib/libunwind/src/libunwind_ext.h+2-2
......@@ -120,10 +120,10 @@ typedef int (*unw_find_dynamic_unwind_sections)(
120120extern int __unw_add_find_dynamic_unwind_sections(
121121 unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
122122
123// Deregister a dynacim unwind-info lookup callback.
123// Deregister a dynamic unwind-info lookup callback.
124124//
125125// Returns UNW_ESUCCESS for successful deregistrations. If the given callback
126// has already been registered then UNW_EINVAL will be returned.
126// is not present then UNW_EINVAL will be returned.
127127extern int __unw_remove_find_dynamic_unwind_sections(
128128 unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
129129
lib/std/Target.zig+6-2
......@@ -1247,7 +1247,7 @@ pub const Cpu = struct {
12471247 pub const Set = struct {
12481248 ints: [usize_count]usize,
12491249
1250 pub const needed_bit_count = 347;
1250 pub const needed_bit_count = 378;
12511251 pub const byte_count = @divCeil(needed_bit_count, 8);
12521252 pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
12531253 pub const Index = std.math.Log2Int(@Int(.unsigned, usize_count * @bitSizeOf(usize)));
......@@ -1961,9 +1961,11 @@ pub const Cpu = struct {
19611961 => &.{.lanai},
19621962
19631963 .loongarch64_lp64,
1964 .loongarch64_preserve_none,
19641965 => &.{.loongarch64},
19651966
19661967 .loongarch32_ilp32,
1968 .loongarch32_preserve_none,
19671969 => &.{.loongarch32},
19681970
19691971 .m68k_sysv,
......@@ -2401,7 +2403,6 @@ pub fn supportsAddressSpace(
24012403 .param => is_nvptx,
24022404 .input, .output, .uniform, .push_constant, .storage_buffer => is_spirv,
24032405 .physical_storage_buffer => arch == .spirv64,
2404 .externref, .funcref => target.cpu.has(.wasm, .reference_types),
24052406 };
24062407}
24072408
......@@ -2566,6 +2567,9 @@ pub const DynamicLinker = struct {
25662567 .aarch64_be,
25672568 => |arch| if (abi == .gnu) initFmt("/lib/ld-{s}.so.1", .{@tagName(arch)}) else none,
25682569
2570 .riscv64,
2571 => if (abi == .gnu) init("/lib/ld-riscv64-lp64.so.1") else none,
2572
25692573 .x86 => if (abi == .gnu) init("/lib/ld.so.1") else none,
25702574 .x86_64 => initFmt("/lib/ld-{s}.so.1", .{switch (abi) {
25712575 .gnu => "x86-64",
lib/std/Target/aarch64.zig+191-33
......@@ -10,6 +10,7 @@ pub const Feature = enum {
1010 aes,
1111 aggressive_fma,
1212 aggressive_interleaving,
13 align_cmp_csel_pairs,
1314 alternate_sextload_cvt_f32_pattern,
1415 altnzcv,
1516 alu_lsl_fast,
......@@ -38,7 +39,6 @@ pub const Feature = enum {
3839 ccpp,
3940 chk,
4041 clrbhb,
41 cmh,
4242 cmp_bcc_fusion,
4343 cmpbr,
4444 complxnum,
......@@ -48,6 +48,7 @@ pub const Feature = enum {
4848 crypto,
4949 cssc,
5050 d128,
51 disable_distinct_predicate_dst_reg,
5152 disable_fast_inc_vl,
5253 disable_latency_sched_heuristic,
5354 disable_ldp,
......@@ -71,8 +72,10 @@ pub const Feature = enum {
7172 f8f16mm,
7273 f8f32mm,
7374 faminmax,
75 fast_ld1_single,
7476 fgt,
7577 fix_cortex_a53_835769,
78 fixed_load_latency_4,
7679 flagm,
7780 fmv,
7881 force_32bit_jump_tables,
......@@ -95,14 +98,16 @@ pub const Feature = enum {
9598 fuse_crypto_eor,
9699 fuse_csel,
97100 fuse_cset,
101 fuse_fcsel,
98102 fuse_literals,
99103 gcie,
100104 gcs,
101105 harden_sls_blr,
102106 harden_sls_nocomdat,
103107 harden_sls_retbr,
108 has_limited_64bit_vector_mul_bandwidth,
104109 hbc,
105 hcx,
110 hinte,
106111 i8mm,
107112 ite,
108113 jsconv,
......@@ -121,12 +126,13 @@ pub const Feature = enum {
121126 mops,
122127 mops_go,
123128 mpam,
124 mpamv2,
125129 mte,
126130 mtetc,
127131 neon,
128132 nmi,
129133 no_bti_at_return_twice,
134 no_lfi_loads,
135 no_lfi_stores,
130136 no_neg_immediates,
131137 no_sve_fp_ld1r,
132138 no_zcz_fpr64,
......@@ -138,7 +144,6 @@ pub const Feature = enum {
138144 pan_rwv,
139145 pauth,
140146 pauth_lr,
141 pcdphint,
142147 perfmon,
143148 poe2,
144149 pops,
......@@ -328,6 +333,11 @@ pub const all_features = blk: {
328333 .description = "Make use of aggressive interleaving during vectorization",
329334 .dependencies = featureSet(&[_]Feature{}),
330335 };
336 result[@backingInt(Feature.align_cmp_csel_pairs)] = .{
337 .llvm_name = "align-cmp-csel-pairs",
338 .description = "Align certain CMP/FCMP and CSEL/FCSEL instruction pairs",
339 .dependencies = featureSet(&[_]Feature{}),
340 };
331341 result[@backingInt(Feature.alternate_sextload_cvt_f32_pattern)] = .{
332342 .llvm_name = "alternate-sextload-cvt-f32-pattern",
333343 .description = "Use alternative pattern for sextload convert to f32",
......@@ -476,11 +486,6 @@ pub const all_features = blk: {
476486 .description = "Enable Clear BHB instruction",
477487 .dependencies = featureSet(&[_]Feature{}),
478488 };
479 result[@backingInt(Feature.cmh)] = .{
480 .llvm_name = "cmh",
481 .description = "Enable Armv9.7-A Contention Management Hints",
482 .dependencies = featureSet(&[_]Feature{}),
483 };
484489 result[@backingInt(Feature.cmp_bcc_fusion)] = .{
485490 .llvm_name = "cmp-bcc-fusion",
486491 .description = "CPU fuses cmp+bcc operations",
......@@ -533,6 +538,11 @@ pub const all_features = blk: {
533538 .lse128,
534539 }),
535540 };
541 result[@backingInt(Feature.disable_distinct_predicate_dst_reg)] = .{
542 .llvm_name = "disable-distinct-predicate-dst-reg",
543 .description = "Disabling selecting a distinct predicate register for the destination operand of instructions that take a governing predicate",
544 .dependencies = featureSet(&[_]Feature{}),
545 };
536546 result[@backingInt(Feature.disable_fast_inc_vl)] = .{
537547 .llvm_name = "disable-fast-inc-vl",
538548 .description = "Do not prefer INC/DEC, ALL, { 1, 2, 4 } over ADDVL",
......@@ -545,7 +555,7 @@ pub const all_features = blk: {
545555 };
546556 result[@backingInt(Feature.disable_ldp)] = .{
547557 .llvm_name = "disable-ldp",
548 .description = "Do not emit ldp",
558 .description = "Prefer not to emit ldp",
549559 .dependencies = featureSet(&[_]Feature{}),
550560 };
551561 result[@backingInt(Feature.disable_maximize_scalable_bandwidth)] = .{
......@@ -555,7 +565,7 @@ pub const all_features = blk: {
555565 };
556566 result[@backingInt(Feature.disable_stp)] = .{
557567 .llvm_name = "disable-stp",
558 .description = "Do not emit stp",
568 .description = "Prefer not to emit stp",
559569 .dependencies = featureSet(&[_]Feature{}),
560570 };
561571 result[@backingInt(Feature.disable_unpredicated_ld_st_lower)] = .{
......@@ -671,6 +681,11 @@ pub const all_features = blk: {
671681 .neon,
672682 }),
673683 };
684 result[@backingInt(Feature.fast_ld1_single)] = .{
685 .llvm_name = "fast-ld1-single",
686 .description = "Single-element LD1 to vector lane has same performance as regular load",
687 .dependencies = featureSet(&[_]Feature{}),
688 };
674689 result[@backingInt(Feature.fgt)] = .{
675690 .llvm_name = "fgt",
676691 .description = "Enable fine grained virtualization traps extension",
......@@ -681,6 +696,11 @@ pub const all_features = blk: {
681696 .description = "Mitigate Cortex-A53 Erratum 835769",
682697 .dependencies = featureSet(&[_]Feature{}),
683698 };
699 result[@backingInt(Feature.fixed_load_latency_4)] = .{
700 .llvm_name = "fixed-load-latency-4",
701 .description = "Use a fixed latency of 4 for loads instead of querying the scheduling model",
702 .dependencies = featureSet(&[_]Feature{}),
703 };
684704 result[@backingInt(Feature.flagm)] = .{
685705 .llvm_name = "flagm",
686706 .description = "Enable Armv8.4-A Flag Manipulation instructions",
......@@ -813,6 +833,11 @@ pub const all_features = blk: {
813833 .description = "CPU can fuse CMP and CSET operations",
814834 .dependencies = featureSet(&[_]Feature{}),
815835 };
836 result[@backingInt(Feature.fuse_fcsel)] = .{
837 .llvm_name = "fuse-fcsel",
838 .description = "CPU can fuse FCMP and FCSEL operations",
839 .dependencies = featureSet(&[_]Feature{}),
840 };
816841 result[@backingInt(Feature.fuse_literals)] = .{
817842 .llvm_name = "fuse-literals",
818843 .description = "CPU fuses literal generation operations",
......@@ -845,14 +870,19 @@ pub const all_features = blk: {
845870 .description = "Harden against straight line speculation across RET and BR instructions",
846871 .dependencies = featureSet(&[_]Feature{}),
847872 };
873 result[@backingInt(Feature.has_limited_64bit_vector_mul_bandwidth)] = .{
874 .llvm_name = "has-limited-64bit-vector-mul-bandwidth",
875 .description = "Has limited 64bit vector multiply bandwidth compared to scalar multiply",
876 .dependencies = featureSet(&[_]Feature{}),
877 };
848878 result[@backingInt(Feature.hbc)] = .{
849879 .llvm_name = "hbc",
850880 .description = "Enable Armv8.8-A Hinted Conditional Branches Extension",
851881 .dependencies = featureSet(&[_]Feature{}),
852882 };
853 result[@backingInt(Feature.hcx)] = .{
854 .llvm_name = "hcx",
855 .description = "Enable Armv8.7-A HCRX_EL2 system register",
883 result[@backingInt(Feature.hinte)] = .{
884 .llvm_name = "hinte",
885 .description = "Enable extended A64 hint instruction space",
856886 .dependencies = featureSet(&[_]Feature{}),
857887 };
858888 result[@backingInt(Feature.i8mm)] = .{
......@@ -962,11 +992,6 @@ pub const all_features = blk: {
962992 .description = "Enable Armv8.4-A Memory system Partitioning and Monitoring extension",
963993 .dependencies = featureSet(&[_]Feature{}),
964994 };
965 result[@backingInt(Feature.mpamv2)] = .{
966 .llvm_name = "mpamv2",
967 .description = "Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions",
968 .dependencies = featureSet(&[_]Feature{}),
969 };
970995 result[@backingInt(Feature.mte)] = .{
971996 .llvm_name = "mte",
972997 .description = "Enable Memory Tagging Extension",
......@@ -996,6 +1021,16 @@ pub const all_features = blk: {
9961021 .description = "Don't place a BTI instruction after a return-twice",
9971022 .dependencies = featureSet(&[_]Feature{}),
9981023 };
1024 result[@backingInt(Feature.no_lfi_loads)] = .{
1025 .llvm_name = "no-lfi-loads",
1026 .description = "Disable LFI sandboxing for load instructions",
1027 .dependencies = featureSet(&[_]Feature{}),
1028 };
1029 result[@backingInt(Feature.no_lfi_stores)] = .{
1030 .llvm_name = "no-lfi-stores",
1031 .description = "Disable LFI sandboxing for store instructions",
1032 .dependencies = featureSet(&[_]Feature{}),
1033 };
9991034 result[@backingInt(Feature.no_neg_immediates)] = .{
10001035 .llvm_name = "no-neg-immediates",
10011036 .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.",
......@@ -1063,11 +1098,6 @@ pub const all_features = blk: {
10631098 .description = "Enable Armv9.5-A PAC enhancements",
10641099 .dependencies = featureSet(&[_]Feature{}),
10651100 };
1066 result[@backingInt(Feature.pcdphint)] = .{
1067 .llvm_name = "pcdphint",
1068 .description = "Enable Armv9.6-A Producer Consumer Data Placement hints",
1069 .dependencies = featureSet(&[_]Feature{}),
1070 };
10711101 result[@backingInt(Feature.perfmon)] = .{
10721102 .llvm_name = "perfmon",
10731103 .description = "Enable Armv8.0-A PMUv3 Performance Monitors extension",
......@@ -1813,7 +1843,6 @@ pub const all_features = blk: {
18131843 .llvm_name = "v8.7a",
18141844 .description = "Support ARM v8.7a architecture",
18151845 .dependencies = featureSet(&[_]Feature{
1816 .hcx,
18171846 .spe_eef,
18181847 .v8_6a,
18191848 .wfxt,
......@@ -1931,6 +1960,7 @@ pub const all_features = blk: {
19311960 .description = "Support ARM v9.6a architecture",
19321961 .dependencies = featureSet(&[_]Feature{
19331962 .cmpbr,
1963 .hinte,
19341964 .lsui,
19351965 .occmo,
19361966 .v9_5a,
......@@ -2265,12 +2295,14 @@ pub const cpu = struct {
22652295 .features = featureSet(&[_]Feature{
22662296 .aes,
22672297 .aggressive_fma,
2298 .align_cmp_csel_pairs,
22682299 .alternate_sextload_cvt_f32_pattern,
22692300 .altnzcv,
22702301 .arith_bcc_fusion,
22712302 .arith_cbz_fusion,
22722303 .ccdp,
22732304 .disable_latency_sched_heuristic,
2305 .fast_ld1_single,
22742306 .fp16fml,
22752307 .fptoint,
22762308 .fuse_address,
......@@ -2301,10 +2333,12 @@ pub const cpu = struct {
23012333 .llvm_name = "apple-a15",
23022334 .features = featureSet(&[_]Feature{
23032335 .aes,
2336 .align_cmp_csel_pairs,
23042337 .alternate_sextload_cvt_f32_pattern,
23052338 .arith_bcc_fusion,
23062339 .arith_cbz_fusion,
23072340 .disable_latency_sched_heuristic,
2341 .fast_ld1_single,
23082342 .fp16fml,
23092343 .fpac,
23102344 .fuse_address,
......@@ -2332,10 +2366,12 @@ pub const cpu = struct {
23322366 .llvm_name = "apple-a16",
23332367 .features = featureSet(&[_]Feature{
23342368 .aes,
2369 .align_cmp_csel_pairs,
23352370 .alternate_sextload_cvt_f32_pattern,
23362371 .arith_bcc_fusion,
23372372 .arith_cbz_fusion,
23382373 .disable_latency_sched_heuristic,
2374 .fast_ld1_single,
23392375 .fp16fml,
23402376 .fpac,
23412377 .fuse_address,
......@@ -2344,8 +2380,8 @@ pub const cpu = struct {
23442380 .fuse_arith_logic,
23452381 .fuse_crypto_eor,
23462382 .fuse_csel,
2383 .fuse_fcsel,
23472384 .fuse_literals,
2348 .hcx,
23492385 .max_interleave_factor_4,
23502386 .no_zcz_fpr64,
23512387 .perfmon,
......@@ -2364,10 +2400,12 @@ pub const cpu = struct {
23642400 .llvm_name = "apple-a17",
23652401 .features = featureSet(&[_]Feature{
23662402 .aes,
2403 .align_cmp_csel_pairs,
23672404 .alternate_sextload_cvt_f32_pattern,
23682405 .arith_bcc_fusion,
23692406 .arith_cbz_fusion,
23702407 .disable_latency_sched_heuristic,
2408 .fast_ld1_single,
23712409 .fp16fml,
23722410 .fpac,
23732411 .fuse_address,
......@@ -2376,8 +2414,8 @@ pub const cpu = struct {
23762414 .fuse_arith_logic,
23772415 .fuse_crypto_eor,
23782416 .fuse_csel,
2417 .fuse_fcsel,
23792418 .fuse_literals,
2380 .hcx,
23812419 .max_interleave_factor_4,
23822420 .no_zcz_fpr64,
23832421 .perfmon,
......@@ -2396,10 +2434,12 @@ pub const cpu = struct {
23962434 .llvm_name = "apple-a18",
23972435 .features = featureSet(&[_]Feature{
23982436 .aes,
2437 .align_cmp_csel_pairs,
23992438 .alternate_sextload_cvt_f32_pattern,
24002439 .arith_bcc_fusion,
24012440 .arith_cbz_fusion,
24022441 .disable_latency_sched_heuristic,
2442 .fast_ld1_single,
24032443 .fp16fml,
24042444 .fpac,
24052445 .fuse_address,
......@@ -2408,6 +2448,7 @@ pub const cpu = struct {
24082448 .fuse_arith_logic,
24092449 .fuse_crypto_eor,
24102450 .fuse_csel,
2451 .fuse_fcsel,
24112452 .fuse_literals,
24122453 .max_interleave_factor_4,
24132454 .no_zcz_fpr64,
......@@ -2429,11 +2470,13 @@ pub const cpu = struct {
24292470 .llvm_name = "apple-a19",
24302471 .features = featureSet(&[_]Feature{
24312472 .aes,
2473 .align_cmp_csel_pairs,
24322474 .alternate_sextload_cvt_f32_pattern,
24332475 .arith_bcc_fusion,
24342476 .arith_cbz_fusion,
24352477 .cssc,
24362478 .disable_latency_sched_heuristic,
2479 .fast_ld1_single,
24372480 .fp16fml,
24382481 .fpac,
24392482 .fuse_address,
......@@ -2442,6 +2485,7 @@ pub const cpu = struct {
24422485 .fuse_arith_logic,
24432486 .fuse_crypto_eor,
24442487 .fuse_csel,
2488 .fuse_fcsel,
24452489 .fuse_literals,
24462490 .hbc,
24472491 .max_interleave_factor_4,
......@@ -2541,12 +2585,14 @@ pub const cpu = struct {
25412585 .features = featureSet(&[_]Feature{
25422586 .aes,
25432587 .aggressive_fma,
2588 .align_cmp_csel_pairs,
25442589 .alternate_sextload_cvt_f32_pattern,
25452590 .altnzcv,
25462591 .arith_bcc_fusion,
25472592 .arith_cbz_fusion,
25482593 .ccdp,
25492594 .disable_latency_sched_heuristic,
2595 .fast_ld1_single,
25502596 .fp16fml,
25512597 .fptoint,
25522598 .fuse_address,
......@@ -2577,10 +2623,12 @@ pub const cpu = struct {
25772623 .llvm_name = "apple-m2",
25782624 .features = featureSet(&[_]Feature{
25792625 .aes,
2626 .align_cmp_csel_pairs,
25802627 .alternate_sextload_cvt_f32_pattern,
25812628 .arith_bcc_fusion,
25822629 .arith_cbz_fusion,
25832630 .disable_latency_sched_heuristic,
2631 .fast_ld1_single,
25842632 .fp16fml,
25852633 .fpac,
25862634 .fuse_address,
......@@ -2608,10 +2656,12 @@ pub const cpu = struct {
26082656 .llvm_name = "apple-m3",
26092657 .features = featureSet(&[_]Feature{
26102658 .aes,
2659 .align_cmp_csel_pairs,
26112660 .alternate_sextload_cvt_f32_pattern,
26122661 .arith_bcc_fusion,
26132662 .arith_cbz_fusion,
26142663 .disable_latency_sched_heuristic,
2664 .fast_ld1_single,
26152665 .fp16fml,
26162666 .fpac,
26172667 .fuse_address,
......@@ -2620,8 +2670,8 @@ pub const cpu = struct {
26202670 .fuse_arith_logic,
26212671 .fuse_crypto_eor,
26222672 .fuse_csel,
2673 .fuse_fcsel,
26232674 .fuse_literals,
2624 .hcx,
26252675 .max_interleave_factor_4,
26262676 .no_zcz_fpr64,
26272677 .perfmon,
......@@ -2640,10 +2690,12 @@ pub const cpu = struct {
26402690 .llvm_name = "apple-m4",
26412691 .features = featureSet(&[_]Feature{
26422692 .aes,
2693 .align_cmp_csel_pairs,
26432694 .alternate_sextload_cvt_f32_pattern,
26442695 .arith_bcc_fusion,
26452696 .arith_cbz_fusion,
26462697 .disable_latency_sched_heuristic,
2698 .fast_ld1_single,
26472699 .fp16fml,
26482700 .fpac,
26492701 .fuse_address,
......@@ -2652,6 +2704,7 @@ pub const cpu = struct {
26522704 .fuse_arith_logic,
26532705 .fuse_crypto_eor,
26542706 .fuse_csel,
2707 .fuse_fcsel,
26552708 .fuse_literals,
26562709 .max_interleave_factor_4,
26572710 .no_zcz_fpr64,
......@@ -2673,11 +2726,13 @@ pub const cpu = struct {
26732726 .llvm_name = "apple-m5",
26742727 .features = featureSet(&[_]Feature{
26752728 .aes,
2729 .align_cmp_csel_pairs,
26762730 .alternate_sextload_cvt_f32_pattern,
26772731 .arith_bcc_fusion,
26782732 .arith_cbz_fusion,
26792733 .cssc,
26802734 .disable_latency_sched_heuristic,
2735 .fast_ld1_single,
26812736 .fp16fml,
26822737 .fpac,
26832738 .fuse_address,
......@@ -2686,6 +2741,7 @@ pub const cpu = struct {
26862741 .fuse_arith_logic,
26872742 .fuse_crypto_eor,
26882743 .fuse_csel,
2744 .fuse_fcsel,
26892745 .fuse_literals,
26902746 .hbc,
26912747 .max_interleave_factor_4,
......@@ -2712,10 +2768,12 @@ pub const cpu = struct {
27122768 .llvm_name = "apple-s10",
27132769 .features = featureSet(&[_]Feature{
27142770 .aes,
2771 .align_cmp_csel_pairs,
27152772 .alternate_sextload_cvt_f32_pattern,
27162773 .arith_bcc_fusion,
27172774 .arith_cbz_fusion,
27182775 .disable_latency_sched_heuristic,
2776 .fast_ld1_single,
27192777 .fp16fml,
27202778 .fpac,
27212779 .fuse_address,
......@@ -2724,8 +2782,8 @@ pub const cpu = struct {
27242782 .fuse_arith_logic,
27252783 .fuse_crypto_eor,
27262784 .fuse_csel,
2785 .fuse_fcsel,
27272786 .fuse_literals,
2728 .hcx,
27292787 .max_interleave_factor_4,
27302788 .no_zcz_fpr64,
27312789 .perfmon,
......@@ -2864,10 +2922,12 @@ pub const cpu = struct {
28642922 .llvm_name = "apple-s9",
28652923 .features = featureSet(&[_]Feature{
28662924 .aes,
2925 .align_cmp_csel_pairs,
28672926 .alternate_sextload_cvt_f32_pattern,
28682927 .arith_bcc_fusion,
28692928 .arith_cbz_fusion,
28702929 .disable_latency_sched_heuristic,
2930 .fast_ld1_single,
28712931 .fp16fml,
28722932 .fpac,
28732933 .fuse_address,
......@@ -2876,8 +2936,8 @@ pub const cpu = struct {
28762936 .fuse_arith_logic,
28772937 .fuse_crypto_eor,
28782938 .fuse_csel,
2939 .fuse_fcsel,
28792940 .fuse_literals,
2880 .hcx,
28812941 .max_interleave_factor_4,
28822942 .no_zcz_fpr64,
28832943 .perfmon,
......@@ -2891,6 +2951,34 @@ pub const cpu = struct {
28912951 .zcz_gpr64,
28922952 }),
28932953 };
2954 pub const armagicpu: CpuModel = .{
2955 .name = "armagicpu",
2956 .llvm_name = "armagicpu",
2957 .features = featureSet(&[_]Feature{
2958 .alu_lsl_fast,
2959 .avoid_ldapur,
2960 .brbe,
2961 .enable_select_opt,
2962 .ete,
2963 .fp16fml,
2964 .fpac,
2965 .fuse_adrp_add,
2966 .fuse_aes,
2967 .fuse_csel,
2968 .fuse_cset,
2969 .has_limited_64bit_vector_mul_bandwidth,
2970 .ls64,
2971 .mte,
2972 .perfmon,
2973 .predictable_select_expensive,
2974 .rand,
2975 .spe,
2976 .sve_bitperm,
2977 .use_fixed_over_scalable_if_equal_cost,
2978 .use_postra_scheduler,
2979 .v9_2a,
2980 }),
2981 };
28942982 pub const c1_nano: CpuModel = .{
28952983 .name = "c1_nano",
28962984 .llvm_name = "c1-nano",
......@@ -2987,6 +3075,7 @@ pub const cpu = struct {
29873075 .fuse_aes,
29883076 .fuse_csel,
29893077 .fuse_cset,
3078 .max_interleave_factor_4,
29903079 .mte,
29913080 .perfmon,
29923081 .predictable_select_expensive,
......@@ -3016,7 +3105,6 @@ pub const cpu = struct {
30163105 .features = featureSet(&[_]Feature{
30173106 .alu_lsl_fast,
30183107 .bf16,
3019 .disable_maximize_scalable_bandwidth,
30203108 .enable_select_opt,
30213109 .ete,
30223110 .fp16fml,
......@@ -3025,11 +3113,13 @@ pub const cpu = struct {
30253113 .fuse_aes,
30263114 .fuse_csel,
30273115 .fuse_cset,
3116 .has_limited_64bit_vector_mul_bandwidth,
30283117 .i8mm,
30293118 .mte,
30303119 .perfmon,
30313120 .predictable_select_expensive,
30323121 .sve_bitperm,
3122 .use_fixed_over_scalable_if_equal_cost,
30333123 .use_postra_scheduler,
30343124 .v9a,
30353125 }),
......@@ -3562,6 +3652,7 @@ pub const cpu = struct {
35623652 .fullfp16,
35633653 .fuse_adrp_add,
35643654 .fuse_aes,
3655 .max_interleave_factor_4,
35653656 .perfmon,
35663657 .predictable_select_expensive,
35673658 .rcpc,
......@@ -3587,6 +3678,7 @@ pub const cpu = struct {
35873678 .fuse_adrp_add,
35883679 .fuse_aes,
35893680 .lse2,
3681 .max_interleave_factor_4,
35903682 .pauth,
35913683 .perfmon,
35923684 .predictable_select_expensive,
......@@ -3612,6 +3704,7 @@ pub const cpu = struct {
36123704 .fuse_adrp_add,
36133705 .fuse_aes,
36143706 .i8mm,
3707 .max_interleave_factor_4,
36153708 .mte,
36163709 .perfmon,
36173710 .predictable_select_expensive,
......@@ -3635,6 +3728,7 @@ pub const cpu = struct {
36353728 .fuse_adrp_add,
36363729 .fuse_aes,
36373730 .i8mm,
3731 .max_interleave_factor_4,
36383732 .mte,
36393733 .perfmon,
36403734 .predictable_select_expensive,
......@@ -3659,6 +3753,7 @@ pub const cpu = struct {
36593753 .fuse_aes,
36603754 .fuse_csel,
36613755 .fuse_cset,
3756 .max_interleave_factor_4,
36623757 .mte,
36633758 .perfmon,
36643759 .predictable_select_expensive,
......@@ -3683,6 +3778,7 @@ pub const cpu = struct {
36833778 .fuse_aes,
36843779 .fuse_csel,
36853780 .fuse_cset,
3781 .max_interleave_factor_4,
36863782 .mte,
36873783 .perfmon,
36883784 .predictable_select_expensive,
......@@ -3898,6 +3994,7 @@ pub const cpu = struct {
38983994 .fuse_aes,
38993995 .fuse_csel,
39003996 .fuse_cset,
3997 .max_interleave_factor_4,
39013998 .mte,
39023999 .perfmon,
39034000 .predictable_select_expensive,
......@@ -3917,6 +4014,7 @@ pub const cpu = struct {
39174014 .features = featureSet(&[_]Feature{
39184015 .enable_select_opt,
39194016 .ete,
4017 .fixed_load_latency_4,
39204018 .fuse_adrp_add,
39214019 .fuse_aes,
39224020 .neon,
......@@ -3955,6 +4053,36 @@ pub const cpu = struct {
39554053 .v9a,
39564054 }),
39574055 };
4056 pub const hip12: CpuModel = .{
4057 .name = "hip12",
4058 .llvm_name = "hip12",
4059 .features = featureSet(&[_]Feature{
4060 .addr_lsl_slow_14,
4061 .alu_lsl_fast,
4062 .brbe,
4063 .cmp_bcc_fusion,
4064 .ete,
4065 .fp16fml,
4066 .fpac,
4067 .fuse_aes,
4068 .hbc,
4069 .ls64,
4070 .nmi,
4071 .perfmon,
4072 .rand,
4073 .rcpc3,
4074 .rme,
4075 .spe,
4076 .store_pair_suppress,
4077 .sve2,
4078 .sve_aes,
4079 .sve_bitperm,
4080 .sve_sha3,
4081 .sve_sm4,
4082 .use_postra_scheduler,
4083 .v8_7a,
4084 }),
4085 };
39584086 pub const kryo: CpuModel = .{
39594087 .name = "kryo",
39604088 .llvm_name = "kryo",
......@@ -4045,7 +4173,6 @@ pub const cpu = struct {
40454173 .features = featureSet(&[_]Feature{
40464174 .alu_lsl_fast,
40474175 .bf16,
4048 .disable_maximize_scalable_bandwidth,
40494176 .enable_select_opt,
40504177 .ete,
40514178 .fp16fml,
......@@ -4054,11 +4181,13 @@ pub const cpu = struct {
40544181 .fuse_aes,
40554182 .fuse_csel,
40564183 .fuse_cset,
4184 .has_limited_64bit_vector_mul_bandwidth,
40574185 .i8mm,
40584186 .mte,
40594187 .perfmon,
40604188 .predictable_select_expensive,
40614189 .sve_bitperm,
4190 .use_fixed_over_scalable_if_equal_cost,
40624191 .use_postra_scheduler,
40634192 .v9a,
40644193 }),
......@@ -4169,6 +4298,7 @@ pub const cpu = struct {
41694298 .rand,
41704299 .spe,
41714300 .sve_bitperm,
4301 .use_fixed_over_scalable_if_equal_cost,
41724302 .use_postra_scheduler,
41734303 .v9_2a,
41744304 }),
......@@ -4188,14 +4318,15 @@ pub const cpu = struct {
41884318 .fuse_aes,
41894319 .fuse_csel,
41904320 .fuse_cset,
4321 .has_limited_64bit_vector_mul_bandwidth,
41914322 .ls64,
4192 .max_interleave_factor_4,
41934323 .mte,
41944324 .perfmon,
41954325 .predictable_select_expensive,
41964326 .rand,
41974327 .spe,
41984328 .sve_bitperm,
4329 .use_fixed_over_scalable_if_equal_cost,
41994330 .use_postra_scheduler,
42004331 .v9_2a,
42014332 }),
......@@ -4248,6 +4379,33 @@ pub const cpu = struct {
42484379 .v8_6a,
42494380 }),
42504381 };
4382 pub const rigel: CpuModel = .{
4383 .name = "rigel",
4384 .llvm_name = "rigel",
4385 .features = featureSet(&[_]Feature{
4386 .brbe,
4387 .chk,
4388 .ete,
4389 .faminmax,
4390 .fp16fml,
4391 .fp8dot2,
4392 .fp8dot4,
4393 .fp8fma,
4394 .fpac,
4395 .ls64,
4396 .lut,
4397 .mte,
4398 .olympus,
4399 .perfmon,
4400 .rand,
4401 .spe,
4402 .sve_aes,
4403 .sve_bitperm,
4404 .sve_sha3,
4405 .sve_sm4,
4406 .v9_2a,
4407 }),
4408 };
42514409 pub const saphira: CpuModel = .{
42524410 .name = "saphira",
42534411 .llvm_name = "saphira",
lib/std/Target/amdgcn.zig+998-133
......@@ -6,6 +6,7 @@ const CpuModel = std.Target.Cpu.Model;
66
77pub const Feature = enum {
88 @"1024_addressable_vgprs",
9 @"1536_physical_vgprs",
910 @"16_bit_insts",
1011 @"45_bit_num_records_buffer_resource",
1112 @"64_bit_literals",
......@@ -18,12 +19,12 @@ pub const Feature = enum {
1819 addressablelocalmemorysize327680,
1920 addressablelocalmemorysize65536,
2021 agent_scope_fine_grained_remote_memory_atomics,
21 allocate1_5xvgprs,
2222 aperture_regs,
2323 architected_flat_scratch,
2424 architected_sgprs,
2525 ashr_pk_insts,
2626 assembler_permissive_wavesize,
27 asynccnt,
2728 atomic_buffer_global_pk_add_f16_insts,
2829 atomic_buffer_global_pk_add_f16_no_rtn_insts,
2930 atomic_buffer_pk_add_bf16_inst,
......@@ -75,9 +76,12 @@ pub const Feature = enum {
7576 dpp,
7677 dpp8,
7778 dpp_64bit,
79 dpp_row_bcast,
7880 dpp_src1_sgpr,
81 dpp_wavefront_shifts,
7982 ds128,
8083 ds_src2_insts,
84 dx10_clamp_and_ieee_mode,
8185 emulated_system_scope_atomics,
8286 extended_image_insts,
8387 f16bf16_to_fp6bf6_cvt_scale_insts,
......@@ -91,13 +95,17 @@ pub const Feature = enum {
9195 flat_global_insts,
9296 flat_gvs_mode,
9397 flat_inst_offsets,
98 flat_offset_bits_12,
99 flat_offset_bits_24,
94100 flat_scratch,
95101 flat_scratch_insts,
96102 flat_segment_offset_bug,
103 flat_signed_offset,
97104 fma_mix_bf16_insts,
98105 fma_mix_insts,
99106 fmacf64_inst,
100107 fmaf,
108 formatted_mubuf_insts,
101109 fp4_cvt_scale_insts,
102110 fp64,
103111 fp6bf6_cvt_scale_insts,
......@@ -116,10 +124,15 @@ pub const Feature = enum {
116124 gfx10_b_encoding,
117125 gfx10_insts,
118126 gfx11,
127 gfx11_7_insts,
119128 gfx11_insts,
120129 gfx12,
121130 gfx1250_insts,
131 gfx1251_gemm_insts,
132 gfx125x_lowest_rate_wmma,
122133 gfx12_insts,
134 gfx13,
135 gfx13_insts,
123136 gfx7_gfx8_gfx9_insts,
124137 gfx8_insts,
125138 gfx9,
......@@ -135,6 +148,8 @@ pub const Feature = enum {
135148 image_insts,
136149 image_store_d16_bug,
137150 inst_fwd_prefetch_bug,
151 instcachelinesize128,
152 instcachelinesize64,
138153 int_clamp_insts,
139154 inv_2pi_inline_imm,
140155 kernarg_preload,
......@@ -149,6 +164,7 @@ pub const Feature = enum {
149164 mad_intra_fwd_bug,
150165 mad_mac_f32_insts,
151166 mad_mix_insts,
167 mad_nc_64_32_insts,
152168 mad_u32_inst,
153169 mai_insts,
154170 max_hard_clause_length_32,
......@@ -161,22 +177,31 @@ pub const Feature = enum {
161177 mfma_inline_literal_bug,
162178 mimg_r128,
163179 min3_max3_pkf16,
180 min_max_i64_insts,
164181 minimum3_maximum3_f16,
165182 minimum3_maximum3_f32,
166183 minimum3_maximum3_pkf16,
167184 movrel,
185 mqsad_insts,
186 mqsad_pk_insts,
168187 msaa_load_dst_sel_bug,
188 msad_insts,
189 mtbuf_insts,
169190 negative_scratch_offset_bug,
170191 negative_unaligned_scratch_offset_bug,
171192 no_data_dep_hazard,
193 no_f16_pseudo_scalar_trans_inline_constants,
172194 no_sdst_cmpx,
173195 nsa_clause_bug,
174196 nsa_encoding,
175197 nsa_to_vmem_bug,
176198 offset_3f_bug,
177199 packed_fp32_ops,
200 packed_fp64_ops,
178201 packed_tid,
202 packed_u64_ops,
179203 partial_nsa_encoding,
204 permlane16_insts,
180205 permlane16_swap,
181206 permlane32_swap,
182207 pk_add_min_max_insts,
......@@ -185,23 +210,25 @@ pub const Feature = enum {
185210 precise_memory,
186211 priv_enabled_trap2_nop_bug,
187212 prng_inst,
188 promote_alloca,
189213 prt_strict_null,
190214 pseudo_scalar_trans,
191215 qsad_insts,
192216 r128_a16,
193217 real_true16,
194 relaxed_buffer_oob_mode,
195218 required_export_priority,
196219 requires_cov6,
220 requires_initial_unclause_vmem,
197221 restricted_soffset,
222 s_barrier_leave_imm,
198223 s_memrealtime,
199224 s_memtime_inst,
200225 s_wakeup_barrier_inst,
226 s_wakeup_imm,
201227 sad_insts,
202228 safe_cu_prefetch,
203229 safe_smem_prefetch,
204230 salu_float,
231 salu_minimum_maximum_insts,
205232 scalar_atomics,
206233 scalar_dwordx3_loads,
207234 scalar_flat_scratch_insts,
......@@ -219,13 +246,17 @@ pub const Feature = enum {
219246 shader_cycles_hi_lo_registers,
220247 shader_cycles_register,
221248 si_scheduler,
249 smem_prefetch_insts,
222250 smem_to_vector_write_hazard,
223251 southern_islands,
224252 sramecc,
225253 sramecc_support,
254 swmmac_gfx1200_insts,
255 swmmac_gfx1250_insts,
226256 tanh_insts,
227257 tensor_cvt_lut_insts,
228 tgsplit,
258 tgsplit_support,
259 trans_coexecution_hazard,
229260 transpose_load_f4f6_insts,
230261 trap_handler,
231262 trig_reduced_range,
......@@ -236,7 +267,10 @@ pub const Feature = enum {
236267 unaligned_scratch_access,
237268 unpacked_d16_vmem,
238269 unsafe_ds_offset_folding,
270 use_add_pc64_inst,
239271 user_sgpr_init16_bug,
272 v_mov_b64_inst,
273 v_mul_u64_inst,
240274 valu_trans_use_hazard,
241275 vcmpx_exec_war_hazard,
242276 vcmpx_permlane_hazard,
......@@ -249,6 +283,7 @@ pub const Feature = enum {
249283 volcanic_islands,
250284 vop3_literal,
251285 vop3p,
286 vop3px2_increments_va_vdst_twice,
252287 vopd,
253288 vscnt,
254289 wait_xcnt,
......@@ -256,8 +291,12 @@ pub const Feature = enum {
256291 wavefrontsize16,
257292 wavefrontsize32,
258293 wavefrontsize64,
294 wmma_128b_insts,
295 wmma_256b_insts,
296 wmma_coexecution_hazards,
259297 xf32_insts,
260298 xnack,
299 xnack_on_off_modes,
261300 xnack_support,
262301};
263302
......@@ -276,6 +315,11 @@ pub const all_features = blk: {
276315 .description = "Has 1024 addressable VGPRs",
277316 .dependencies = featureSet(&[_]Feature{}),
278317 };
318 result[@backingInt(Feature.@"1536_physical_vgprs")] = .{
319 .llvm_name = "1536-physical-vgprs",
320 .description = "Has 1536 physical VGPRs per SIMD",
321 .dependencies = featureSet(&[_]Feature{}),
322 };
279323 result[@backingInt(Feature.@"16_bit_insts")] = .{
280324 .llvm_name = "16-bit-insts",
281325 .description = "Has i16/f16 instructions",
......@@ -336,11 +380,6 @@ pub const all_features = blk: {
336380 .description = "Agent (device) scoped atomic operations, excluding those directly supported by PCIe (i.e. integer atomic add, exchange, and compare-and-swap), are functional for allocations in host or peer device memory.",
337381 .dependencies = featureSet(&[_]Feature{}),
338382 };
339 result[@backingInt(Feature.allocate1_5xvgprs)] = .{
340 .llvm_name = "allocate1_5xvgprs",
341 .description = "Has 50% more physical VGPRs and 50% larger allocation granule",
342 .dependencies = featureSet(&[_]Feature{}),
343 };
344383 result[@backingInt(Feature.aperture_regs)] = .{
345384 .llvm_name = "aperture-regs",
346385 .description = "Has Memory Aperture Base and Size Registers",
......@@ -363,7 +402,12 @@ pub const all_features = blk: {
363402 };
364403 result[@backingInt(Feature.assembler_permissive_wavesize)] = .{
365404 .llvm_name = "assembler-permissive-wavesize",
366 .description = "allow parsing wave32 and wave64 variants of instructions",
405 .description = "Allow parsing wave32 and wave64 variants of instructions",
406 .dependencies = featureSet(&[_]Feature{}),
407 };
408 result[@backingInt(Feature.asynccnt)] = .{
409 .llvm_name = "asynccnt",
410 .description = "Has separate asynccnt counter",
367411 .dependencies = featureSet(&[_]Feature{}),
368412 };
369413 result[@backingInt(Feature.atomic_buffer_global_pk_add_f16_insts)] = .{
......@@ -637,11 +681,21 @@ pub const all_features = blk: {
637681 .description = "Support DPP (Data Parallel Primitives) extension in DP ALU",
638682 .dependencies = featureSet(&[_]Feature{}),
639683 };
684 result[@backingInt(Feature.dpp_row_bcast)] = .{
685 .llvm_name = "dpp-row-bcast",
686 .description = "Support DPP row_bcast15/row_bcast31",
687 .dependencies = featureSet(&[_]Feature{}),
688 };
640689 result[@backingInt(Feature.dpp_src1_sgpr)] = .{
641690 .llvm_name = "dpp-src1-sgpr",
642691 .description = "Support SGPR for Src1 of DPP instructions",
643692 .dependencies = featureSet(&[_]Feature{}),
644693 };
694 result[@backingInt(Feature.dpp_wavefront_shifts)] = .{
695 .llvm_name = "dpp-wavefront-shifts",
696 .description = "Support DPP wave_shl/wave_rol/wave_shr/wave_ror",
697 .dependencies = featureSet(&[_]Feature{}),
698 };
645699 result[@backingInt(Feature.ds128)] = .{
646700 .llvm_name = "enable-ds128",
647701 .description = "Use ds_{read|write}_b128",
......@@ -652,6 +706,11 @@ pub const all_features = blk: {
652706 .description = "Has ds_*_src2 instructions",
653707 .dependencies = featureSet(&[_]Feature{}),
654708 };
709 result[@backingInt(Feature.dx10_clamp_and_ieee_mode)] = .{
710 .llvm_name = "dx10-clamp-and-ieee-mode",
711 .description = "Target has DX10_CLAMP and IEEE_MODE kernel descriptor bits",
712 .dependencies = featureSet(&[_]Feature{}),
713 };
655714 result[@backingInt(Feature.emulated_system_scope_atomics)] = .{
656715 .llvm_name = "emulated-system-scope-atomics",
657716 .description = "System scope atomics unsupported by the PCI-e are emulated in HW via CAS loop and functional.",
......@@ -723,6 +782,16 @@ pub const all_features = blk: {
723782 .description = "Flat instructions have immediate offset addressing mode",
724783 .dependencies = featureSet(&[_]Feature{}),
725784 };
785 result[@backingInt(Feature.flat_offset_bits_12)] = .{
786 .llvm_name = "flat-offset-bits-12",
787 .description = "Number of bits for flat offset encoding",
788 .dependencies = featureSet(&[_]Feature{}),
789 };
790 result[@backingInt(Feature.flat_offset_bits_24)] = .{
791 .llvm_name = "flat-offset-bits-24",
792 .description = "Number of bits for flat offset encoding",
793 .dependencies = featureSet(&[_]Feature{}),
794 };
726795 result[@backingInt(Feature.flat_scratch)] = .{
727796 .llvm_name = "enable-flat-scratch",
728797 .description = "Use scratch_* flat memory instructions to access scratch",
......@@ -740,6 +809,11 @@ pub const all_features = blk: {
740809 .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory",
741810 .dependencies = featureSet(&[_]Feature{}),
742811 };
812 result[@backingInt(Feature.flat_signed_offset)] = .{
813 .llvm_name = "flat-signed-offset",
814 .description = "Immediate offset of FLAT instructions are always signed",
815 .dependencies = featureSet(&[_]Feature{}),
816 };
743817 result[@backingInt(Feature.fma_mix_bf16_insts)] = .{
744818 .llvm_name = "fma-mix-bf16-insts",
745819 .description = "Has v_fma_mix_f32_bf16, v_fma_mixlo_bf16, v_fma_mixhi_bf16 instructions",
......@@ -760,6 +834,11 @@ pub const all_features = blk: {
760834 .description = "Enable single precision FMA (not as fast as mul+add, but fused)",
761835 .dependencies = featureSet(&[_]Feature{}),
762836 };
837 result[@backingInt(Feature.formatted_mubuf_insts)] = .{
838 .llvm_name = "formatted-mubuf-insts",
839 .description = "Has formatted memory untyped buffer instructions.",
840 .dependencies = featureSet(&[_]Feature{}),
841 };
763842 result[@backingInt(Feature.fp4_cvt_scale_insts)] = .{
764843 .llvm_name = "fp4-cvt-scale-insts",
765844 .description = "Has fp4 conversion scale instructions",
......@@ -841,13 +920,16 @@ pub const all_features = blk: {
841920 .default_component_zero,
842921 .dpp,
843922 .dpp8,
923 .dx10_clamp_and_ieee_mode,
844924 .extended_image_insts,
845925 .fast_denormal_f32,
846926 .fast_fmaf,
847927 .flat_global_insts,
848928 .flat_inst_offsets,
929 .flat_offset_bits_12,
849930 .flat_scratch_insts,
850931 .fma_mix_insts,
932 .formatted_mubuf_insts,
851933 .fp64,
852934 .g16,
853935 .gds,
......@@ -856,14 +938,20 @@ pub const all_features = blk: {
856938 .gfx9_insts,
857939 .gws,
858940 .image_insts,
941 .instcachelinesize64,
859942 .int_clamp_insts,
860943 .inv_2pi_inline_imm,
861944 .lerp_inst,
862945 .max_hard_clause_length_63,
863946 .mimg_r128,
864947 .movrel,
948 .mqsad_insts,
949 .mqsad_pk_insts,
950 .msad_insts,
951 .mtbuf_insts,
865952 .no_data_dep_hazard,
866953 .no_sdst_cmpx,
954 .permlane16_insts,
867955 .pk_fmac_f16_inst,
868956 .qsad_insts,
869957 .s_memrealtime,
......@@ -929,6 +1017,7 @@ pub const all_features = blk: {
9291017 .flat_inst_offsets,
9301018 .flat_scratch_insts,
9311019 .fma_mix_insts,
1020 .formatted_mubuf_insts,
9321021 .fp64,
9331022 .g16,
9341023 .gds,
......@@ -940,14 +1029,20 @@ pub const all_features = blk: {
9401029 .gfx8_insts,
9411030 .gfx9_insts,
9421031 .gws,
1032 .instcachelinesize128,
9431033 .int_clamp_insts,
9441034 .inv_2pi_inline_imm,
9451035 .lerp_inst,
9461036 .max_hard_clause_length_32,
9471037 .mimg_r128,
9481038 .movrel,
1039 .mqsad_insts,
1040 .mqsad_pk_insts,
1041 .msad_insts,
1042 .mtbuf_insts,
9491043 .no_data_dep_hazard,
9501044 .no_sdst_cmpx,
1045 .permlane16_insts,
9511046 .pk_fmac_f16_inst,
9521047 .qsad_insts,
9531048 .sad_insts,
......@@ -962,6 +1057,11 @@ pub const all_features = blk: {
9621057 .vscnt,
9631058 }),
9641059 };
1060 result[@backingInt(Feature.gfx11_7_insts)] = .{
1061 .llvm_name = "gfx11-7-insts",
1062 .description = "Additional instructions for GFX11.7",
1063 .dependencies = featureSet(&[_]Feature{}),
1064 };
9651065 result[@backingInt(Feature.gfx11_insts)] = .{
9661066 .llvm_name = "gfx11-insts",
9671067 .description = "Additional instructions for GFX11+",
......@@ -986,7 +1086,9 @@ pub const all_features = blk: {
9861086 .fast_fmaf,
9871087 .flat_global_insts,
9881088 .flat_inst_offsets,
1089 .flat_offset_bits_24,
9891090 .flat_scratch_insts,
1091 .flat_signed_offset,
9901092 .fma_mix_insts,
9911093 .fp64,
9921094 .g16,
......@@ -999,6 +1101,7 @@ pub const all_features = blk: {
9991101 .gfx8_insts,
10001102 .gfx9_insts,
10011103 .ieee_minimum_maximum_insts,
1104 .instcachelinesize128,
10021105 .int_clamp_insts,
10031106 .inv_2pi_inline_imm,
10041107 .max_hard_clause_length_32,
......@@ -1008,7 +1111,9 @@ pub const all_features = blk: {
10081111 .movrel,
10091112 .no_data_dep_hazard,
10101113 .no_sdst_cmpx,
1114 .permlane16_insts,
10111115 .pk_fmac_f16_inst,
1116 .salu_minimum_maximum_insts,
10121117 .true16,
10131118 .unaligned_buffer_access,
10141119 .unaligned_ds_access,
......@@ -1024,11 +1129,91 @@ pub const all_features = blk: {
10241129 .description = "Additional instructions for GFX1250+",
10251130 .dependencies = featureSet(&[_]Feature{}),
10261131 };
1132 result[@backingInt(Feature.gfx1251_gemm_insts)] = .{
1133 .llvm_name = "gfx1251-gemm-insts",
1134 .description = "Has additional gfx1251 DGEMM instructions",
1135 .dependencies = featureSet(&[_]Feature{}),
1136 };
1137 result[@backingInt(Feature.gfx125x_lowest_rate_wmma)] = .{
1138 .llvm_name = "gfx125x-lowest-rate-wmma",
1139 .description = "Has the lowest rate wmma in the gfx125x family, mainly for the gfx12-5-generic",
1140 .dependencies = featureSet(&[_]Feature{}),
1141 };
10271142 result[@backingInt(Feature.gfx12_insts)] = .{
10281143 .llvm_name = "gfx12-insts",
10291144 .description = "Additional instructions for GFX12+",
10301145 .dependencies = featureSet(&[_]Feature{}),
10311146 };
1147 result[@backingInt(Feature.gfx13)] = .{
1148 .llvm_name = "gfx13",
1149 .description = "GFX13 GPU generation",
1150 .dependencies = featureSet(&[_]Feature{
1151 .@"16_bit_insts",
1152 .a16,
1153 .add_no_carry_insts,
1154 .agent_scope_fine_grained_remote_memory_atomics,
1155 .aperture_regs,
1156 .atomic_fmin_fmax_flat_f32,
1157 .atomic_fmin_fmax_global_f32,
1158 .ci_insts,
1159 .default_component_broadcast,
1160 .dpp,
1161 .dpp8,
1162 .extended_image_insts,
1163 .fast_denormal_f32,
1164 .fast_fmaf,
1165 .flat_global_insts,
1166 .flat_inst_offsets,
1167 .flat_offset_bits_24,
1168 .flat_scratch_insts,
1169 .flat_signed_offset,
1170 .fma_mix_insts,
1171 .formatted_mubuf_insts,
1172 .fp64,
1173 .g16,
1174 .gfx10_3_insts,
1175 .gfx10_a_encoding,
1176 .gfx10_b_encoding,
1177 .gfx10_insts,
1178 .gfx11_insts,
1179 .gfx12_insts,
1180 .gfx13_insts,
1181 .gfx8_insts,
1182 .gfx9_insts,
1183 .ieee_minimum_maximum_insts,
1184 .image_insts,
1185 .instcachelinesize128,
1186 .int_clamp_insts,
1187 .inv_2pi_inline_imm,
1188 .max_hard_clause_length_32,
1189 .mimg_r128,
1190 .minimum3_maximum3_f16,
1191 .minimum3_maximum3_f32,
1192 .movrel,
1193 .mtbuf_insts,
1194 .no_data_dep_hazard,
1195 .no_sdst_cmpx,
1196 .permlane16_insts,
1197 .pk_fmac_f16_inst,
1198 .salu_minimum_maximum_insts,
1199 .true16,
1200 .unaligned_buffer_access,
1201 .unaligned_ds_access,
1202 .unaligned_scratch_access,
1203 .vop3_literal,
1204 .vop3p,
1205 .vopd,
1206 .vscnt,
1207 }),
1208 };
1209 result[@backingInt(Feature.gfx13_insts)] = .{
1210 .llvm_name = "gfx13-insts",
1211 .description = "Additional instructions for GFX13+",
1212 .dependencies = featureSet(&[_]Feature{
1213 .s_barrier_leave_imm,
1214 .s_wakeup_imm,
1215 }),
1216 };
10321217 result[@backingInt(Feature.gfx7_gfx8_gfx9_insts)] = .{
10331218 .llvm_name = "gfx7-gfx8-gfx9-insts",
10341219 .description = "Instructions shared in GFX7, GFX8, GFX9",
......@@ -1054,20 +1239,29 @@ pub const all_features = blk: {
10541239 .cvt_pknorm_vop3_insts,
10551240 .default_component_zero,
10561241 .dpp,
1242 .dpp_row_bcast,
1243 .dpp_wavefront_shifts,
1244 .dx10_clamp_and_ieee_mode,
10571245 .fast_denormal_f32,
10581246 .fast_fmaf,
10591247 .flat_global_insts,
10601248 .flat_inst_offsets,
10611249 .flat_scratch_insts,
1250 .formatted_mubuf_insts,
10621251 .fp64,
10631252 .gcn3_encoding,
10641253 .gfx7_gfx8_gfx9_insts,
10651254 .gfx8_insts,
10661255 .gfx9_insts,
10671256 .gws,
1257 .instcachelinesize64,
10681258 .int_clamp_insts,
10691259 .inv_2pi_inline_imm,
10701260 .lerp_inst,
1261 .mqsad_insts,
1262 .mqsad_pk_insts,
1263 .msad_insts,
1264 .mtbuf_insts,
10711265 .negative_scratch_offset_bug,
10721266 .qsad_insts,
10731267 .r128_a16,
......@@ -1089,7 +1283,7 @@ pub const all_features = blk: {
10891283 .vmem_write_vgpr_in_order,
10901284 .vop3p,
10911285 .wavefrontsize64,
1092 .xnack_support,
1286 .xnack_on_off_modes,
10931287 }),
10941288 };
10951289 result[@backingInt(Feature.gfx90a_insts)] = .{
......@@ -1142,7 +1336,7 @@ pub const all_features = blk: {
11421336 };
11431337 result[@backingInt(Feature.ieee_minimum_maximum_insts)] = .{
11441338 .llvm_name = "ieee-minimum-maximum-insts",
1145 .description = "Has v_minimum/maximum_f16/f32/f64, v_minimummaximum/maximumminimum_f16/f32 and v_pk_minimum/maximum_f16 instructions",
1339 .description = "Has v_minimum/maximum_f16/f32/f64, v_minimummaximum/maximumminimum_f16/f32 andv_pk_minimum/maximum_f16 instructions",
11461340 .dependencies = featureSet(&[_]Feature{}),
11471341 };
11481342 result[@backingInt(Feature.image_gather4_d16_bug)] = .{
......@@ -1165,6 +1359,16 @@ pub const all_features = blk: {
11651359 .description = "S_INST_PREFETCH instruction causes shader to hang",
11661360 .dependencies = featureSet(&[_]Feature{}),
11671361 };
1362 result[@backingInt(Feature.instcachelinesize128)] = .{
1363 .llvm_name = "instcachelinesize128",
1364 .description = "Instruction cache line size in bytes.",
1365 .dependencies = featureSet(&[_]Feature{}),
1366 };
1367 result[@backingInt(Feature.instcachelinesize64)] = .{
1368 .llvm_name = "instcachelinesize64",
1369 .description = "Instruction cache line size in bytes.",
1370 .dependencies = featureSet(&[_]Feature{}),
1371 };
11681372 result[@backingInt(Feature.int_clamp_insts)] = .{
11691373 .llvm_name = "int-clamp-insts",
11701374 .description = "Support clamp for integer destination",
......@@ -1235,6 +1439,11 @@ pub const all_features = blk: {
12351439 .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions",
12361440 .dependencies = featureSet(&[_]Feature{}),
12371441 };
1442 result[@backingInt(Feature.mad_nc_64_32_insts)] = .{
1443 .llvm_name = "mad-nc-64-32-insts",
1444 .description = "Has v_mad_nc_{u64_u32|i64_i32} instructions",
1445 .dependencies = featureSet(&[_]Feature{}),
1446 };
12381447 result[@backingInt(Feature.mad_u32_inst)] = .{
12391448 .llvm_name = "mad-u32-inst",
12401449 .description = "Has v_mad_u32 instruction",
......@@ -1295,6 +1504,11 @@ pub const all_features = blk: {
12951504 .description = "Has v_pk_min3_num_f16 and v_pk_max3_num_f16 instructions",
12961505 .dependencies = featureSet(&[_]Feature{}),
12971506 };
1507 result[@backingInt(Feature.min_max_i64_insts)] = .{
1508 .llvm_name = "min-max-i64-insts",
1509 .description = "Has v_{min|max}_{i|u}64 instructions",
1510 .dependencies = featureSet(&[_]Feature{}),
1511 };
12981512 result[@backingInt(Feature.minimum3_maximum3_f16)] = .{
12991513 .llvm_name = "minimum3-maximum3-f16",
13001514 .description = "Has v_minimum3_f16 and v_maximum3_f16 instructions",
......@@ -1315,11 +1529,31 @@ pub const all_features = blk: {
13151529 .description = "Has v_movrel*_b32 instructions",
13161530 .dependencies = featureSet(&[_]Feature{}),
13171531 };
1532 result[@backingInt(Feature.mqsad_insts)] = .{
1533 .llvm_name = "mqsad-insts",
1534 .description = "Has v_mqsad_u32_u8 instruction",
1535 .dependencies = featureSet(&[_]Feature{}),
1536 };
1537 result[@backingInt(Feature.mqsad_pk_insts)] = .{
1538 .llvm_name = "mqsad-pk-insts",
1539 .description = "Has v_mqsad_pk_u16_u8 instruction",
1540 .dependencies = featureSet(&[_]Feature{}),
1541 };
13181542 result[@backingInt(Feature.msaa_load_dst_sel_bug)] = .{
13191543 .llvm_name = "msaa-load-dst-sel-bug",
13201544 .description = "MSAA loads not honoring dst_sel bug",
13211545 .dependencies = featureSet(&[_]Feature{}),
13221546 };
1547 result[@backingInt(Feature.msad_insts)] = .{
1548 .llvm_name = "msad-insts",
1549 .description = "Has v_msad_u8 instruction",
1550 .dependencies = featureSet(&[_]Feature{}),
1551 };
1552 result[@backingInt(Feature.mtbuf_insts)] = .{
1553 .llvm_name = "mtbuf-insts",
1554 .description = "Has memory typed buffer instructions.",
1555 .dependencies = featureSet(&[_]Feature{}),
1556 };
13231557 result[@backingInt(Feature.negative_scratch_offset_bug)] = .{
13241558 .llvm_name = "negative-scratch-offset-bug",
13251559 .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9",
......@@ -1327,7 +1561,7 @@ pub const all_features = blk: {
13271561 };
13281562 result[@backingInt(Feature.negative_unaligned_scratch_offset_bug)] = .{
13291563 .llvm_name = "negative-unaligned-scratch-offset-bug",
1330 .description = "Scratch instructions with a VGPR offset and a negative immediate offset that is not a multiple of 4 read wrong memory on GFX10",
1564 .description = "Scratch instructions with a VGPR offset and a negative immediate offset thatis not a multiple of 4 read wrong memory on GFX10",
13311565 .dependencies = featureSet(&[_]Feature{}),
13321566 };
13331567 result[@backingInt(Feature.no_data_dep_hazard)] = .{
......@@ -1335,6 +1569,11 @@ pub const all_features = blk: {
13351569 .description = "Does not need SW waitstates",
13361570 .dependencies = featureSet(&[_]Feature{}),
13371571 };
1572 result[@backingInt(Feature.no_f16_pseudo_scalar_trans_inline_constants)] = .{
1573 .llvm_name = "no-f16-pseudo-scalar-trans-inline-constants",
1574 .description = "Inline constants are not supported for F16 pseudo scalar transcendentals",
1575 .dependencies = featureSet(&[_]Feature{}),
1576 };
13381577 result[@backingInt(Feature.no_sdst_cmpx)] = .{
13391578 .llvm_name = "no-sdst-cmpx",
13401579 .description = "V_CMPX does not write VCC/SGPR in addition to EXEC",
......@@ -1365,16 +1604,31 @@ pub const all_features = blk: {
13651604 .description = "Support packed fp32 instructions",
13661605 .dependencies = featureSet(&[_]Feature{}),
13671606 };
1607 result[@backingInt(Feature.packed_fp64_ops)] = .{
1608 .llvm_name = "packed-fp64-ops",
1609 .description = "Support packed fp64 instructions",
1610 .dependencies = featureSet(&[_]Feature{}),
1611 };
13681612 result[@backingInt(Feature.packed_tid)] = .{
13691613 .llvm_name = "packed-tid",
13701614 .description = "Workitem IDs are packed into v0 at kernel launch",
13711615 .dependencies = featureSet(&[_]Feature{}),
13721616 };
1617 result[@backingInt(Feature.packed_u64_ops)] = .{
1618 .llvm_name = "packed-u64-ops",
1619 .description = "Support packed uint64 instructions",
1620 .dependencies = featureSet(&[_]Feature{}),
1621 };
13731622 result[@backingInt(Feature.partial_nsa_encoding)] = .{
13741623 .llvm_name = "partial-nsa-encoding",
13751624 .description = "Support partial NSA encoding for image instructions",
13761625 .dependencies = featureSet(&[_]Feature{}),
13771626 };
1627 result[@backingInt(Feature.permlane16_insts)] = .{
1628 .llvm_name = "permlane16-insts",
1629 .description = "Has v_permlane16_b32/v_permlanex16_b32 instructions",
1630 .dependencies = featureSet(&[_]Feature{}),
1631 };
13781632 result[@backingInt(Feature.permlane16_swap)] = .{
13791633 .llvm_name = "permlane16-swap",
13801634 .description = "Has v_permlane16_swap_b32 instructions",
......@@ -1415,11 +1669,6 @@ pub const all_features = blk: {
14151669 .description = "Has v_prng_b32 instruction",
14161670 .dependencies = featureSet(&[_]Feature{}),
14171671 };
1418 result[@backingInt(Feature.promote_alloca)] = .{
1419 .llvm_name = "promote-alloca",
1420 .description = "Enable promote alloca pass",
1421 .dependencies = featureSet(&[_]Feature{}),
1422 };
14231672 result[@backingInt(Feature.prt_strict_null)] = .{
14241673 .llvm_name = "enable-prt-strict-null",
14251674 .description = "Enable zeroing of result registers for sparse texture fetches",
......@@ -1445,11 +1694,6 @@ pub const all_features = blk: {
14451694 .description = "Use true 16-bit registers",
14461695 .dependencies = featureSet(&[_]Feature{}),
14471696 };
1448 result[@backingInt(Feature.relaxed_buffer_oob_mode)] = .{
1449 .llvm_name = "relaxed-buffer-oob-mode",
1450 .description = "Disable strict out-of-bounds buffer guarantees. An OOB access may potentially cause an adjacent access to be treated as if it were also OOB",
1451 .dependencies = featureSet(&[_]Feature{}),
1452 };
14531697 result[@backingInt(Feature.required_export_priority)] = .{
14541698 .llvm_name = "required-export-priority",
14551699 .description = "Export priority must be explicitly manipulated on GFX11.5",
......@@ -1460,11 +1704,21 @@ pub const all_features = blk: {
14601704 .description = "Target Requires Code Object V6",
14611705 .dependencies = featureSet(&[_]Feature{}),
14621706 };
1707 result[@backingInt(Feature.requires_initial_unclause_vmem)] = .{
1708 .llvm_name = "requires-initial-unclause-vmem",
1709 .description = "Hardware entrypoints require first VMEM instruction to be unclaused",
1710 .dependencies = featureSet(&[_]Feature{}),
1711 };
14631712 result[@backingInt(Feature.restricted_soffset)] = .{
14641713 .llvm_name = "restricted-soffset",
14651714 .description = "Has restricted SOffset (immediate not supported).",
14661715 .dependencies = featureSet(&[_]Feature{}),
14671716 };
1717 result[@backingInt(Feature.s_barrier_leave_imm)] = .{
1718 .llvm_name = "s-barrier-leave-imm",
1719 .description = "s_barrier_leave takes an immediate operand",
1720 .dependencies = featureSet(&[_]Feature{}),
1721 };
14681722 result[@backingInt(Feature.s_memrealtime)] = .{
14691723 .llvm_name = "s-memrealtime",
14701724 .description = "Has s_memrealtime instruction",
......@@ -1480,6 +1734,11 @@ pub const all_features = blk: {
14801734 .description = "Has s_wakeup_barrier instruction.",
14811735 .dependencies = featureSet(&[_]Feature{}),
14821736 };
1737 result[@backingInt(Feature.s_wakeup_imm)] = .{
1738 .llvm_name = "s-wakeup-imm",
1739 .description = "s_wakeup takes an immediate operand",
1740 .dependencies = featureSet(&[_]Feature{}),
1741 };
14831742 result[@backingInt(Feature.sad_insts)] = .{
14841743 .llvm_name = "sad-insts",
14851744 .description = "Has v_sad* instructions",
......@@ -1500,6 +1759,11 @@ pub const all_features = blk: {
15001759 .description = "Has SALU floating point instructions",
15011760 .dependencies = featureSet(&[_]Feature{}),
15021761 };
1762 result[@backingInt(Feature.salu_minimum_maximum_insts)] = .{
1763 .llvm_name = "salu-minimum-maximum-insts",
1764 .description = "Has s_minimum/maximum_f16/f32 instructions",
1765 .dependencies = featureSet(&[_]Feature{}),
1766 };
15031767 result[@backingInt(Feature.scalar_atomics)] = .{
15041768 .llvm_name = "scalar-atomics",
15051769 .description = "Has atomic scalar memory instructions",
......@@ -1564,16 +1828,23 @@ pub const all_features = blk: {
15641828 .cvt_pknorm_vop2_insts,
15651829 .default_component_zero,
15661830 .ds_src2_insts,
1831 .dx10_clamp_and_ieee_mode,
15671832 .extended_image_insts,
1833 .formatted_mubuf_insts,
15681834 .fp64,
15691835 .gds,
15701836 .gfx7_gfx8_gfx9_insts,
15711837 .gws,
15721838 .image_insts,
1839 .instcachelinesize64,
15731840 .lerp_inst,
15741841 .mad_mac_f32_insts,
15751842 .mimg_r128,
15761843 .movrel,
1844 .mqsad_insts,
1845 .mqsad_pk_insts,
1846 .msad_insts,
1847 .mtbuf_insts,
15771848 .qsad_insts,
15781849 .s_memtime_inst,
15791850 .sad_insts,
......@@ -1613,6 +1884,11 @@ pub const all_features = blk: {
16131884 .description = "Enable SI Machine Scheduler",
16141885 .dependencies = featureSet(&[_]Feature{}),
16151886 };
1887 result[@backingInt(Feature.smem_prefetch_insts)] = .{
1888 .llvm_name = "smem-prefetch-insts",
1889 .description = "Has s_prefetch_inst, s_prefetch_inst_pc_rel, s_prefetch_data and s_prefetch_data_pc_rel instructions",
1890 .dependencies = featureSet(&[_]Feature{}),
1891 };
16161892 result[@backingInt(Feature.smem_to_vector_write_hazard)] = .{
16171893 .llvm_name = "smem-to-vector-write-hazard",
16181894 .description = "s_load_dword followed by v_cmp page faults",
......@@ -1629,16 +1905,22 @@ pub const all_features = blk: {
16291905 .cvt_pknorm_vop2_insts,
16301906 .default_component_zero,
16311907 .ds_src2_insts,
1908 .dx10_clamp_and_ieee_mode,
16321909 .extended_image_insts,
1910 .formatted_mubuf_insts,
16331911 .fp64,
16341912 .gds,
16351913 .gws,
16361914 .image_insts,
1915 .instcachelinesize64,
16371916 .ldsbankcount32,
16381917 .lerp_inst,
16391918 .mad_mac_f32_insts,
16401919 .mimg_r128,
16411920 .movrel,
1921 .mqsad_pk_insts,
1922 .msad_insts,
1923 .mtbuf_insts,
16421924 .s_memtime_inst,
16431925 .sad_insts,
16441926 .trig_reduced_range,
......@@ -1656,6 +1938,16 @@ pub const all_features = blk: {
16561938 .description = "Hardware supports SRAMECC",
16571939 .dependencies = featureSet(&[_]Feature{}),
16581940 };
1941 result[@backingInt(Feature.swmmac_gfx1200_insts)] = .{
1942 .llvm_name = "swmmac-gfx1200-insts",
1943 .description = "Has GFX1200 SWMMAC instructions",
1944 .dependencies = featureSet(&[_]Feature{}),
1945 };
1946 result[@backingInt(Feature.swmmac_gfx1250_insts)] = .{
1947 .llvm_name = "swmmac-gfx1250-insts",
1948 .description = "Has GFX1250 SWMMAC instructions",
1949 .dependencies = featureSet(&[_]Feature{}),
1950 };
16591951 result[@backingInt(Feature.tanh_insts)] = .{
16601952 .llvm_name = "tanh-insts",
16611953 .description = "Has v_tanh_f32/f16 instructions",
......@@ -1666,9 +1958,14 @@ pub const all_features = blk: {
16661958 .description = "Has v_perm_pk16* instructions",
16671959 .dependencies = featureSet(&[_]Feature{}),
16681960 };
1669 result[@backingInt(Feature.tgsplit)] = .{
1670 .llvm_name = "tgsplit",
1671 .description = "Enable threadgroup split execution",
1961 result[@backingInt(Feature.tgsplit_support)] = .{
1962 .llvm_name = "tgsplit-support",
1963 .description = "Hardware support for threadgroup split execution mode",
1964 .dependencies = featureSet(&[_]Feature{}),
1965 };
1966 result[@backingInt(Feature.trans_coexecution_hazard)] = .{
1967 .llvm_name = "trans-coexecution-hazard",
1968 .description = "Hazard when TRANS co-executes with other VALU instruction",
16721969 .dependencies = featureSet(&[_]Feature{}),
16731970 };
16741971 result[@backingInt(Feature.transpose_load_f4f6_insts)] = .{
......@@ -1721,11 +2018,26 @@ pub const all_features = blk: {
17212018 .description = "Force using DS instruction immediate offsets on SI",
17222019 .dependencies = featureSet(&[_]Feature{}),
17232020 };
2021 result[@backingInt(Feature.use_add_pc64_inst)] = .{
2022 .llvm_name = "use-add-pc64-inst",
2023 .description = "Use s_add_pc_i64 instruction.",
2024 .dependencies = featureSet(&[_]Feature{}),
2025 };
17242026 result[@backingInt(Feature.user_sgpr_init16_bug)] = .{
17252027 .llvm_name = "user-sgpr-init16-bug",
17262028 .description = "Bug requiring at least 16 user+system SGPRs to be enabled",
17272029 .dependencies = featureSet(&[_]Feature{}),
17282030 };
2031 result[@backingInt(Feature.v_mov_b64_inst)] = .{
2032 .llvm_name = "v-mov-b64-inst",
2033 .description = "Has v_mov_b64 instruction",
2034 .dependencies = featureSet(&[_]Feature{}),
2035 };
2036 result[@backingInt(Feature.v_mul_u64_inst)] = .{
2037 .llvm_name = "v-mul-u64-inst",
2038 .description = "Has v_mul_u64 instruction.",
2039 .dependencies = featureSet(&[_]Feature{}),
2040 };
17292041 result[@backingInt(Feature.valu_trans_use_hazard)] = .{
17302042 .llvm_name = "valu-trans-use-hazard",
17312043 .description = "Hazard when TRANS instructions are closely followed by a use of the result",
......@@ -1758,7 +2070,7 @@ pub const all_features = blk: {
17582070 };
17592071 result[@backingInt(Feature.vmem_to_lds_load_insts)] = .{
17602072 .llvm_name = "vmem-to-lds-load-insts",
1761 .description = "The platform has memory to lds instructions (global_load w/lds bit set, buffer_load w/lds bit set or global_load_lds. This does not include scratch_load_lds.",
2073 .description = "The platform has memory to lds instructions (global_load w/lds bit set, buffer_loadw/lds bit set or global_load_lds. This does not include scratch_load_lds.",
17622074 .dependencies = featureSet(&[_]Feature{}),
17632075 };
17642076 result[@backingInt(Feature.vmem_to_scalar_write_hazard)] = .{
......@@ -1782,10 +2094,14 @@ pub const all_features = blk: {
17822094 .cvt_pknorm_vop2_insts,
17832095 .default_component_zero,
17842096 .dpp,
2097 .dpp_row_bcast,
2098 .dpp_wavefront_shifts,
17852099 .ds_src2_insts,
2100 .dx10_clamp_and_ieee_mode,
17862101 .extended_image_insts,
17872102 .fast_denormal_f32,
17882103 .flat_address_space,
2104 .formatted_mubuf_insts,
17892105 .fp64,
17902106 .gcn3_encoding,
17912107 .gds,
......@@ -1793,12 +2109,17 @@ pub const all_features = blk: {
17932109 .gfx8_insts,
17942110 .gws,
17952111 .image_insts,
2112 .instcachelinesize64,
17962113 .int_clamp_insts,
17972114 .inv_2pi_inline_imm,
17982115 .lerp_inst,
17992116 .mad_mac_f32_insts,
18002117 .mimg_r128,
18012118 .movrel,
2119 .mqsad_insts,
2120 .mqsad_pk_insts,
2121 .msad_insts,
2122 .mtbuf_insts,
18022123 .qsad_insts,
18032124 .s_memrealtime,
18042125 .s_memtime_inst,
......@@ -1824,6 +2145,11 @@ pub const all_features = blk: {
18242145 .description = "Has VOP3P packed instructions",
18252146 .dependencies = featureSet(&[_]Feature{}),
18262147 };
2148 result[@backingInt(Feature.vop3px2_increments_va_vdst_twice)] = .{
2149 .llvm_name = "vop3px2-increments-va-vdst-twice",
2150 .description = "VOP3PX2 encoded instructions increment the VaVdst counter twice",
2151 .dependencies = featureSet(&[_]Feature{}),
2152 };
18272153 result[@backingInt(Feature.vopd)] = .{
18282154 .llvm_name = "vopd",
18292155 .description = "Has VOPD dual issue wave32 instructions",
......@@ -1859,6 +2185,21 @@ pub const all_features = blk: {
18592185 .description = "The number of threads per wavefront",
18602186 .dependencies = featureSet(&[_]Feature{}),
18612187 };
2188 result[@backingInt(Feature.wmma_128b_insts)] = .{
2189 .llvm_name = "wmma-128b-insts",
2190 .description = "Has WMMA instructions where A and B matrices do not have duplicated data",
2191 .dependencies = featureSet(&[_]Feature{}),
2192 };
2193 result[@backingInt(Feature.wmma_256b_insts)] = .{
2194 .llvm_name = "wmma-256b-insts",
2195 .description = "Has WMMA instructions where A and B matrices have duplicated data",
2196 .dependencies = featureSet(&[_]Feature{}),
2197 };
2198 result[@backingInt(Feature.wmma_coexecution_hazards)] = .{
2199 .llvm_name = "wmma-coexecution-hazards",
2200 .description = "Hazards when WMMA co-executes with other WMMA/VALU instruction",
2201 .dependencies = featureSet(&[_]Feature{}),
2202 };
18622203 result[@backingInt(Feature.xf32_insts)] = .{
18632204 .llvm_name = "xf32-insts",
18642205 .description = "Has instructions that support xf32 format, such as v_mfma_f32_16x16x8_xf32 and v_mfma_f32_32x32x4_xf32",
......@@ -1867,7 +2208,16 @@ pub const all_features = blk: {
18672208 result[@backingInt(Feature.xnack)] = .{
18682209 .llvm_name = "xnack",
18692210 .description = "Enable XNACK support",
1870 .dependencies = featureSet(&[_]Feature{}),
2211 .dependencies = featureSet(&[_]Feature{
2212 .xnack_support,
2213 }),
2214 };
2215 result[@backingInt(Feature.xnack_on_off_modes)] = .{
2216 .llvm_name = "xnack-on-off-modes",
2217 .description = "Target supports XNACK on/off modes",
2218 .dependencies = featureSet(&[_]Feature{
2219 .xnack_support,
2220 }),
18712221 };
18722222 result[@backingInt(Feature.xnack_support)] = .{
18732223 .llvm_name = "xnack-support",
......@@ -1900,7 +2250,7 @@ pub const cpu = struct {
19002250 .ldsbankcount32,
19012251 .unpacked_d16_vmem,
19022252 .volcanic_islands,
1903 .xnack_support,
2253 .xnack_on_off_modes,
19042254 }),
19052255 };
19062256 pub const fiji: CpuModel = .{
......@@ -1951,7 +2301,7 @@ pub const cpu = struct {
19512301 .vcmpx_exec_war_hazard,
19522302 .vcmpx_permlane_hazard,
19532303 .vmem_to_scalar_write_hazard,
1954 .xnack_support,
2304 .xnack_on_off_modes,
19552305 }),
19562306 };
19572307 pub const gfx1011: CpuModel = .{
......@@ -1987,7 +2337,7 @@ pub const cpu = struct {
19872337 .vcmpx_exec_war_hazard,
19882338 .vcmpx_permlane_hazard,
19892339 .vmem_to_scalar_write_hazard,
1990 .xnack_support,
2340 .xnack_on_off_modes,
19912341 }),
19922342 };
19932343 pub const gfx1012: CpuModel = .{
......@@ -2023,7 +2373,7 @@ pub const cpu = struct {
20232373 .vcmpx_exec_war_hazard,
20242374 .vcmpx_permlane_hazard,
20252375 .vmem_to_scalar_write_hazard,
2026 .xnack_support,
2376 .xnack_on_off_modes,
20272377 }),
20282378 };
20292379 pub const gfx1013: CpuModel = .{
......@@ -2054,7 +2404,7 @@ pub const cpu = struct {
20542404 .vcmpx_exec_war_hazard,
20552405 .vcmpx_permlane_hazard,
20562406 .vmem_to_scalar_write_hazard,
2057 .xnack_support,
2407 .xnack_on_off_modes,
20582408 }),
20592409 };
20602410 pub const gfx1030: CpuModel = .{
......@@ -2232,7 +2582,7 @@ pub const cpu = struct {
22322582 .vcmpx_exec_war_hazard,
22332583 .vcmpx_permlane_hazard,
22342584 .vmem_to_scalar_write_hazard,
2235 .xnack_support,
2585 .xnack_on_off_modes,
22362586 }),
22372587 };
22382588 pub const gfx10_3_generic: CpuModel = .{
......@@ -2261,7 +2611,7 @@ pub const cpu = struct {
22612611 .name = "gfx1100",
22622612 .llvm_name = "gfx1100",
22632613 .features = featureSet(&[_]Feature{
2264 .allocate1_5xvgprs,
2614 .@"1536_physical_vgprs",
22652615 .architected_flat_scratch,
22662616 .atomic_fadd_no_rtn_insts,
22672617 .atomic_fadd_rtn_insts,
......@@ -2274,6 +2624,7 @@ pub const cpu = struct {
22742624 .dot7_insts,
22752625 .dot8_insts,
22762626 .dot9_insts,
2627 .dx10_clamp_and_ieee_mode,
22772628 .flat_atomic_fadd_f32_inst,
22782629 .gfx11,
22792630 .image_insts,
......@@ -2290,13 +2641,14 @@ pub const cpu = struct {
22902641 .user_sgpr_init16_bug,
22912642 .valu_trans_use_hazard,
22922643 .vcmpx_permlane_hazard,
2644 .wmma_256b_insts,
22932645 }),
22942646 };
22952647 pub const gfx1101: CpuModel = .{
22962648 .name = "gfx1101",
22972649 .llvm_name = "gfx1101",
22982650 .features = featureSet(&[_]Feature{
2299 .allocate1_5xvgprs,
2651 .@"1536_physical_vgprs",
23002652 .architected_flat_scratch,
23012653 .atomic_fadd_no_rtn_insts,
23022654 .atomic_fadd_rtn_insts,
......@@ -2309,6 +2661,7 @@ pub const cpu = struct {
23092661 .dot7_insts,
23102662 .dot8_insts,
23112663 .dot9_insts,
2664 .dx10_clamp_and_ieee_mode,
23122665 .flat_atomic_fadd_f32_inst,
23132666 .gfx11,
23142667 .image_insts,
......@@ -2324,6 +2677,7 @@ pub const cpu = struct {
23242677 .shader_cycles_register,
23252678 .valu_trans_use_hazard,
23262679 .vcmpx_permlane_hazard,
2680 .wmma_256b_insts,
23272681 }),
23282682 };
23292683 pub const gfx1102: CpuModel = .{
......@@ -2342,6 +2696,7 @@ pub const cpu = struct {
23422696 .dot7_insts,
23432697 .dot8_insts,
23442698 .dot9_insts,
2699 .dx10_clamp_and_ieee_mode,
23452700 .flat_atomic_fadd_f32_inst,
23462701 .gfx11,
23472702 .image_insts,
......@@ -2358,6 +2713,7 @@ pub const cpu = struct {
23582713 .user_sgpr_init16_bug,
23592714 .valu_trans_use_hazard,
23602715 .vcmpx_permlane_hazard,
2716 .wmma_256b_insts,
23612717 }),
23622718 };
23632719 pub const gfx1103: CpuModel = .{
......@@ -2376,6 +2732,7 @@ pub const cpu = struct {
23762732 .dot7_insts,
23772733 .dot8_insts,
23782734 .dot9_insts,
2735 .dx10_clamp_and_ieee_mode,
23792736 .flat_atomic_fadd_f32_inst,
23802737 .gfx11,
23812738 .image_insts,
......@@ -2391,6 +2748,7 @@ pub const cpu = struct {
23912748 .shader_cycles_register,
23922749 .valu_trans_use_hazard,
23932750 .vcmpx_permlane_hazard,
2751 .wmma_256b_insts,
23942752 }),
23952753 };
23962754 pub const gfx1150: CpuModel = .{
......@@ -2410,6 +2768,7 @@ pub const cpu = struct {
24102768 .dot8_insts,
24112769 .dot9_insts,
24122770 .dpp_src1_sgpr,
2771 .dx10_clamp_and_ieee_mode,
24132772 .flat_atomic_fadd_f32_inst,
24142773 .gfx11,
24152774 .image_insts,
......@@ -2424,13 +2783,14 @@ pub const cpu = struct {
24242783 .salu_float,
24252784 .shader_cycles_register,
24262785 .vcmpx_permlane_hazard,
2786 .wmma_256b_insts,
24272787 }),
24282788 };
24292789 pub const gfx1151: CpuModel = .{
24302790 .name = "gfx1151",
24312791 .llvm_name = "gfx1151",
24322792 .features = featureSet(&[_]Feature{
2433 .allocate1_5xvgprs,
2793 .@"1536_physical_vgprs",
24342794 .architected_flat_scratch,
24352795 .atomic_fadd_no_rtn_insts,
24362796 .atomic_fadd_rtn_insts,
......@@ -2444,6 +2804,7 @@ pub const cpu = struct {
24442804 .dot8_insts,
24452805 .dot9_insts,
24462806 .dpp_src1_sgpr,
2807 .dx10_clamp_and_ieee_mode,
24472808 .flat_atomic_fadd_f32_inst,
24482809 .gfx11,
24492810 .image_insts,
......@@ -2458,6 +2819,7 @@ pub const cpu = struct {
24582819 .salu_float,
24592820 .shader_cycles_register,
24602821 .vcmpx_permlane_hazard,
2822 .wmma_256b_insts,
24612823 }),
24622824 };
24632825 pub const gfx1152: CpuModel = .{
......@@ -2477,6 +2839,7 @@ pub const cpu = struct {
24772839 .dot8_insts,
24782840 .dot9_insts,
24792841 .dpp_src1_sgpr,
2842 .dx10_clamp_and_ieee_mode,
24802843 .flat_atomic_fadd_f32_inst,
24812844 .gfx11,
24822845 .image_insts,
......@@ -2491,6 +2854,7 @@ pub const cpu = struct {
24912854 .salu_float,
24922855 .shader_cycles_register,
24932856 .vcmpx_permlane_hazard,
2857 .wmma_256b_insts,
24942858 }),
24952859 };
24962860 pub const gfx1153: CpuModel = .{
......@@ -2510,6 +2874,7 @@ pub const cpu = struct {
25102874 .dot8_insts,
25112875 .dot9_insts,
25122876 .dpp_src1_sgpr,
2877 .dx10_clamp_and_ieee_mode,
25132878 .flat_atomic_fadd_f32_inst,
25142879 .gfx11,
25152880 .image_insts,
......@@ -2523,11 +2888,12 @@ pub const cpu = struct {
25232888 .salu_float,
25242889 .shader_cycles_register,
25252890 .vcmpx_permlane_hazard,
2891 .wmma_256b_insts,
25262892 }),
25272893 };
2528 pub const gfx11_generic: CpuModel = .{
2529 .name = "gfx11_generic",
2530 .llvm_name = "gfx11-generic",
2894 pub const gfx1154: CpuModel = .{
2895 .name = "gfx1154",
2896 .llvm_name = "gfx1154",
25312897 .features = featureSet(&[_]Feature{
25322898 .architected_flat_scratch,
25332899 .atomic_fadd_no_rtn_insts,
......@@ -2541,47 +2907,32 @@ pub const cpu = struct {
25412907 .dot7_insts,
25422908 .dot8_insts,
25432909 .dot9_insts,
2910 .dpp_src1_sgpr,
2911 .dx10_clamp_and_ieee_mode,
25442912 .flat_atomic_fadd_f32_inst,
25452913 .gfx11,
25462914 .image_insts,
25472915 .ldsbankcount32,
2548 .mad_intra_fwd_bug,
25492916 .memory_atomic_fadd_f32_denormal_support,
2550 .msaa_load_dst_sel_bug,
25512917 .nsa_encoding,
25522918 .packed_tid,
25532919 .partial_nsa_encoding,
2554 .priv_enabled_trap2_nop_bug,
25552920 .real_true16,
25562921 .required_export_priority,
2557 .requires_cov6,
2922 .salu_float,
25582923 .shader_cycles_register,
2559 .user_sgpr_init16_bug,
2560 .valu_trans_use_hazard,
25612924 .vcmpx_permlane_hazard,
2925 .wmma_256b_insts,
25622926 }),
25632927 };
2564 pub const gfx1200: CpuModel = .{
2565 .name = "gfx1200",
2566 .llvm_name = "gfx1200",
2928 pub const gfx1170: CpuModel = .{
2929 .name = "gfx1170",
2930 .llvm_name = "gfx1170",
25672931 .features = featureSet(&[_]Feature{
2568 .addressablelocalmemorysize65536,
2569 .allocate1_5xvgprs,
25702932 .architected_flat_scratch,
2571 .architected_sgprs,
2572 .atomic_buffer_global_pk_add_f16_insts,
2573 .atomic_buffer_pk_add_bf16_inst,
2574 .atomic_ds_pk_add_16_insts,
25752933 .atomic_fadd_no_rtn_insts,
25762934 .atomic_fadd_rtn_insts,
2577 .atomic_flat_pk_add_16_insts,
2578 .atomic_global_pk_add_bf16_inst,
25792935 .back_off_barrier,
2580 .bvh_dual_bvh_8_insts,
2581 .cube_insts,
2582 .cvt_norm_insts,
2583 .cvt_pknorm_vop2_insts,
2584 .cvt_pknorm_vop3_insts,
25852936 .d16_write_vgpr32,
25862937 .dl_insts,
25872938 .dot10_insts,
......@@ -2591,49 +2942,36 @@ pub const cpu = struct {
25912942 .dot8_insts,
25922943 .dot9_insts,
25932944 .dpp_src1_sgpr,
2594 .extended_image_insts,
25952945 .flat_atomic_fadd_f32_inst,
25962946 .fp8_conversion_insts,
2597 .gfx12,
2947 .gfx11,
2948 .gfx11_7_insts,
2949 .ieee_minimum_maximum_insts,
25982950 .image_insts,
25992951 .ldsbankcount32,
2600 .lerp_inst,
26012952 .memory_atomic_fadd_f32_denormal_support,
2953 .minimum3_maximum3_f16,
2954 .minimum3_maximum3_f32,
2955 .no_f16_pseudo_scalar_trans_inline_constants,
26022956 .nsa_encoding,
26032957 .packed_tid,
26042958 .partial_nsa_encoding,
2605 .pseudo_scalar_trans,
2606 .qsad_insts,
2607 .restricted_soffset,
2608 .sad_insts,
2959 .real_true16,
26092960 .salu_float,
2610 .scalar_dwordx3_loads,
2611 .shader_cycles_hi_lo_registers,
2961 .shader_cycles_register,
2962 .swmmac_gfx1200_insts,
26122963 .vcmpx_permlane_hazard,
2613 .waits_before_system_scope_stores,
2964 .wmma_128b_insts,
26142965 }),
26152966 };
2616 pub const gfx1201: CpuModel = .{
2617 .name = "gfx1201",
2618 .llvm_name = "gfx1201",
2967 pub const gfx1171: CpuModel = .{
2968 .name = "gfx1171",
2969 .llvm_name = "gfx1171",
26192970 .features = featureSet(&[_]Feature{
2620 .addressablelocalmemorysize65536,
2621 .allocate1_5xvgprs,
26222971 .architected_flat_scratch,
2623 .architected_sgprs,
2624 .atomic_buffer_global_pk_add_f16_insts,
2625 .atomic_buffer_pk_add_bf16_inst,
2626 .atomic_ds_pk_add_16_insts,
26272972 .atomic_fadd_no_rtn_insts,
26282973 .atomic_fadd_rtn_insts,
2629 .atomic_flat_pk_add_16_insts,
2630 .atomic_global_pk_add_bf16_inst,
26312974 .back_off_barrier,
2632 .bvh_dual_bvh_8_insts,
2633 .cube_insts,
2634 .cvt_norm_insts,
2635 .cvt_pknorm_vop2_insts,
2636 .cvt_pknorm_vop3_insts,
26372975 .d16_write_vgpr32,
26382976 .dl_insts,
26392977 .dot10_insts,
......@@ -2643,61 +2981,304 @@ pub const cpu = struct {
26432981 .dot8_insts,
26442982 .dot9_insts,
26452983 .dpp_src1_sgpr,
2646 .extended_image_insts,
26472984 .flat_atomic_fadd_f32_inst,
26482985 .fp8_conversion_insts,
2649 .gfx12,
2986 .gfx11,
2987 .gfx11_7_insts,
2988 .ieee_minimum_maximum_insts,
26502989 .image_insts,
26512990 .ldsbankcount32,
2652 .lerp_inst,
26532991 .memory_atomic_fadd_f32_denormal_support,
2992 .minimum3_maximum3_f16,
2993 .minimum3_maximum3_f32,
2994 .no_f16_pseudo_scalar_trans_inline_constants,
26542995 .nsa_encoding,
26552996 .packed_tid,
26562997 .partial_nsa_encoding,
2657 .pseudo_scalar_trans,
2658 .qsad_insts,
2659 .restricted_soffset,
2660 .sad_insts,
2998 .real_true16,
26612999 .salu_float,
2662 .scalar_dwordx3_loads,
2663 .shader_cycles_hi_lo_registers,
3000 .shader_cycles_register,
3001 .swmmac_gfx1200_insts,
26643002 .vcmpx_permlane_hazard,
2665 .waits_before_system_scope_stores,
3003 .wmma_128b_insts,
26663004 }),
26673005 };
2668 pub const gfx1250: CpuModel = .{
2669 .name = "gfx1250",
2670 .llvm_name = "gfx1250",
3006 pub const gfx1172: CpuModel = .{
3007 .name = "gfx1172",
3008 .llvm_name = "gfx1172",
26713009 .features = featureSet(&[_]Feature{
2672 .@"1024_addressable_vgprs",
2673 .@"45_bit_num_records_buffer_resource",
2674 .@"64_bit_literals",
2675 .add_min_max_insts,
2676 .add_sub_u64_insts,
2677 .addressablelocalmemorysize327680,
26783010 .architected_flat_scratch,
2679 .architected_sgprs,
2680 .ashr_pk_insts,
2681 .atomic_buffer_global_pk_add_f16_insts,
2682 .atomic_buffer_pk_add_bf16_inst,
2683 .atomic_ds_pk_add_16_insts,
26843011 .atomic_fadd_no_rtn_insts,
26853012 .atomic_fadd_rtn_insts,
2686 .atomic_flat_pk_add_16_insts,
2687 .atomic_fmin_fmax_flat_f64,
2688 .atomic_fmin_fmax_global_f64,
2689 .atomic_global_pk_add_bf16_inst,
2690 .bf16_cvt_insts,
2691 .bf16_pk_insts,
2692 .bf16_trans_insts,
2693 .bitop3_insts,
2694 .clusters,
2695 .cube_insts,
2696 .cumode,
2697 .cvt_norm_insts,
2698 .cvt_pk_f16_f32_inst,
2699 .cvt_pknorm_vop2_insts,
2700 .cvt_pknorm_vop3_insts,
3013 .back_off_barrier,
3014 .d16_write_vgpr32,
3015 .dl_insts,
3016 .dot10_insts,
3017 .dot11_insts,
3018 .dot12_insts,
3019 .dot7_insts,
3020 .dot8_insts,
3021 .dot9_insts,
3022 .dpp_src1_sgpr,
3023 .flat_atomic_fadd_f32_inst,
3024 .fp8_conversion_insts,
3025 .gfx11,
3026 .gfx11_7_insts,
3027 .ieee_minimum_maximum_insts,
3028 .image_insts,
3029 .ldsbankcount32,
3030 .memory_atomic_fadd_f32_denormal_support,
3031 .minimum3_maximum3_f16,
3032 .minimum3_maximum3_f32,
3033 .no_f16_pseudo_scalar_trans_inline_constants,
3034 .nsa_encoding,
3035 .packed_tid,
3036 .partial_nsa_encoding,
3037 .real_true16,
3038 .salu_float,
3039 .shader_cycles_register,
3040 .swmmac_gfx1200_insts,
3041 .vcmpx_permlane_hazard,
3042 .wmma_128b_insts,
3043 }),
3044 };
3045 pub const gfx11_7_generic: CpuModel = .{
3046 .name = "gfx11_7_generic",
3047 .llvm_name = "gfx11-7-generic",
3048 .features = featureSet(&[_]Feature{
3049 .architected_flat_scratch,
3050 .atomic_fadd_no_rtn_insts,
3051 .atomic_fadd_rtn_insts,
3052 .back_off_barrier,
3053 .d16_write_vgpr32,
3054 .dl_insts,
3055 .dot10_insts,
3056 .dot11_insts,
3057 .dot12_insts,
3058 .dot7_insts,
3059 .dot8_insts,
3060 .dot9_insts,
3061 .dpp_src1_sgpr,
3062 .flat_atomic_fadd_f32_inst,
3063 .fp8_conversion_insts,
3064 .gfx11,
3065 .gfx11_7_insts,
3066 .ieee_minimum_maximum_insts,
3067 .image_insts,
3068 .ldsbankcount32,
3069 .memory_atomic_fadd_f32_denormal_support,
3070 .minimum3_maximum3_f16,
3071 .minimum3_maximum3_f32,
3072 .no_f16_pseudo_scalar_trans_inline_constants,
3073 .nsa_encoding,
3074 .packed_tid,
3075 .partial_nsa_encoding,
3076 .real_true16,
3077 .requires_cov6,
3078 .salu_float,
3079 .shader_cycles_register,
3080 .swmmac_gfx1200_insts,
3081 .vcmpx_permlane_hazard,
3082 .wmma_128b_insts,
3083 }),
3084 };
3085 pub const gfx11_generic: CpuModel = .{
3086 .name = "gfx11_generic",
3087 .llvm_name = "gfx11-generic",
3088 .features = featureSet(&[_]Feature{
3089 .architected_flat_scratch,
3090 .atomic_fadd_no_rtn_insts,
3091 .atomic_fadd_rtn_insts,
3092 .back_off_barrier,
3093 .d16_write_vgpr32,
3094 .dl_insts,
3095 .dot10_insts,
3096 .dot12_insts,
3097 .dot5_insts,
3098 .dot7_insts,
3099 .dot8_insts,
3100 .dot9_insts,
3101 .dx10_clamp_and_ieee_mode,
3102 .flat_atomic_fadd_f32_inst,
3103 .gfx11,
3104 .image_insts,
3105 .ldsbankcount32,
3106 .mad_intra_fwd_bug,
3107 .memory_atomic_fadd_f32_denormal_support,
3108 .msaa_load_dst_sel_bug,
3109 .nsa_encoding,
3110 .packed_tid,
3111 .partial_nsa_encoding,
3112 .priv_enabled_trap2_nop_bug,
3113 .real_true16,
3114 .required_export_priority,
3115 .requires_cov6,
3116 .shader_cycles_register,
3117 .user_sgpr_init16_bug,
3118 .valu_trans_use_hazard,
3119 .vcmpx_permlane_hazard,
3120 .wmma_256b_insts,
3121 }),
3122 };
3123 pub const gfx1200: CpuModel = .{
3124 .name = "gfx1200",
3125 .llvm_name = "gfx1200",
3126 .features = featureSet(&[_]Feature{
3127 .@"1536_physical_vgprs",
3128 .addressablelocalmemorysize65536,
3129 .architected_flat_scratch,
3130 .architected_sgprs,
3131 .atomic_buffer_global_pk_add_f16_insts,
3132 .atomic_buffer_pk_add_bf16_inst,
3133 .atomic_ds_pk_add_16_insts,
3134 .atomic_fadd_no_rtn_insts,
3135 .atomic_fadd_rtn_insts,
3136 .atomic_flat_pk_add_16_insts,
3137 .atomic_global_pk_add_bf16_inst,
3138 .back_off_barrier,
3139 .bvh_dual_bvh_8_insts,
3140 .cube_insts,
3141 .cvt_norm_insts,
3142 .cvt_pknorm_vop2_insts,
3143 .cvt_pknorm_vop3_insts,
3144 .d16_write_vgpr32,
3145 .dl_insts,
3146 .dot10_insts,
3147 .dot11_insts,
3148 .dot12_insts,
3149 .dot7_insts,
3150 .dot8_insts,
3151 .dot9_insts,
3152 .dpp_src1_sgpr,
3153 .extended_image_insts,
3154 .flat_atomic_fadd_f32_inst,
3155 .formatted_mubuf_insts,
3156 .fp8_conversion_insts,
3157 .gfx12,
3158 .image_insts,
3159 .ldsbankcount32,
3160 .lerp_inst,
3161 .memory_atomic_fadd_f32_denormal_support,
3162 .mqsad_insts,
3163 .mqsad_pk_insts,
3164 .msad_insts,
3165 .mtbuf_insts,
3166 .no_f16_pseudo_scalar_trans_inline_constants,
3167 .nsa_encoding,
3168 .packed_tid,
3169 .partial_nsa_encoding,
3170 .pseudo_scalar_trans,
3171 .qsad_insts,
3172 .real_true16,
3173 .restricted_soffset,
3174 .sad_insts,
3175 .salu_float,
3176 .scalar_dwordx3_loads,
3177 .shader_cycles_hi_lo_registers,
3178 .smem_prefetch_insts,
3179 .swmmac_gfx1200_insts,
3180 .vcmpx_permlane_hazard,
3181 .waits_before_system_scope_stores,
3182 .wmma_128b_insts,
3183 }),
3184 };
3185 pub const gfx1201: CpuModel = .{
3186 .name = "gfx1201",
3187 .llvm_name = "gfx1201",
3188 .features = featureSet(&[_]Feature{
3189 .@"1536_physical_vgprs",
3190 .addressablelocalmemorysize65536,
3191 .architected_flat_scratch,
3192 .architected_sgprs,
3193 .atomic_buffer_global_pk_add_f16_insts,
3194 .atomic_buffer_pk_add_bf16_inst,
3195 .atomic_ds_pk_add_16_insts,
3196 .atomic_fadd_no_rtn_insts,
3197 .atomic_fadd_rtn_insts,
3198 .atomic_flat_pk_add_16_insts,
3199 .atomic_global_pk_add_bf16_inst,
3200 .back_off_barrier,
3201 .bvh_dual_bvh_8_insts,
3202 .cube_insts,
3203 .cvt_norm_insts,
3204 .cvt_pknorm_vop2_insts,
3205 .cvt_pknorm_vop3_insts,
3206 .d16_write_vgpr32,
3207 .dl_insts,
3208 .dot10_insts,
3209 .dot11_insts,
3210 .dot12_insts,
3211 .dot7_insts,
3212 .dot8_insts,
3213 .dot9_insts,
3214 .dpp_src1_sgpr,
3215 .extended_image_insts,
3216 .flat_atomic_fadd_f32_inst,
3217 .formatted_mubuf_insts,
3218 .fp8_conversion_insts,
3219 .gfx12,
3220 .image_insts,
3221 .ldsbankcount32,
3222 .lerp_inst,
3223 .memory_atomic_fadd_f32_denormal_support,
3224 .mqsad_insts,
3225 .mqsad_pk_insts,
3226 .msad_insts,
3227 .mtbuf_insts,
3228 .no_f16_pseudo_scalar_trans_inline_constants,
3229 .nsa_encoding,
3230 .packed_tid,
3231 .partial_nsa_encoding,
3232 .pseudo_scalar_trans,
3233 .qsad_insts,
3234 .real_true16,
3235 .restricted_soffset,
3236 .sad_insts,
3237 .salu_float,
3238 .scalar_dwordx3_loads,
3239 .shader_cycles_hi_lo_registers,
3240 .smem_prefetch_insts,
3241 .swmmac_gfx1200_insts,
3242 .vcmpx_permlane_hazard,
3243 .waits_before_system_scope_stores,
3244 .wmma_128b_insts,
3245 }),
3246 };
3247 pub const gfx1250: CpuModel = .{
3248 .name = "gfx1250",
3249 .llvm_name = "gfx1250",
3250 .features = featureSet(&[_]Feature{
3251 .@"1024_addressable_vgprs",
3252 .@"45_bit_num_records_buffer_resource",
3253 .@"64_bit_literals",
3254 .add_min_max_insts,
3255 .add_sub_u64_insts,
3256 .addressablelocalmemorysize327680,
3257 .architected_flat_scratch,
3258 .architected_sgprs,
3259 .ashr_pk_insts,
3260 .asynccnt,
3261 .atomic_buffer_global_pk_add_f16_insts,
3262 .atomic_buffer_pk_add_bf16_inst,
3263 .atomic_ds_pk_add_16_insts,
3264 .atomic_fadd_no_rtn_insts,
3265 .atomic_fadd_rtn_insts,
3266 .atomic_flat_pk_add_16_insts,
3267 .atomic_fmin_fmax_flat_f64,
3268 .atomic_fmin_fmax_global_f64,
3269 .atomic_global_pk_add_bf16_inst,
3270 .back_off_barrier,
3271 .bf16_cvt_insts,
3272 .bf16_pk_insts,
3273 .bf16_trans_insts,
3274 .bitop3_insts,
3275 .clusters,
3276 .cube_insts,
3277 .cumode,
3278 .cvt_norm_insts,
3279 .cvt_pk_f16_f32_inst,
3280 .cvt_pknorm_vop2_insts,
3281 .cvt_pknorm_vop3_insts,
27013282 .d16_write_vgpr32,
27023283 .dl_insts,
27033284 .dot7_insts,
......@@ -2719,12 +3300,18 @@ pub const cpu = struct {
27193300 .ldsbankcount32,
27203301 .lerp_inst,
27213302 .lshl_add_u64_inst,
3303 .mad_nc_64_32_insts,
27223304 .mad_u32_inst,
27233305 .max_hard_clause_length_63,
27243306 .mcast_load_insts,
27253307 .memory_atomic_fadd_f32_denormal_support,
27263308 .min3_max3_pkf16,
3309 .min_max_i64_insts,
27273310 .minimum3_maximum3_pkf16,
3311 .mqsad_insts,
3312 .mqsad_pk_insts,
3313 .msad_insts,
3314 .no_f16_pseudo_scalar_trans_inline_constants,
27283315 .packed_fp32_ops,
27293316 .packed_tid,
27303317 .permlane16_swap,
......@@ -2732,6 +3319,8 @@ pub const cpu = struct {
27323319 .prng_inst,
27333320 .pseudo_scalar_trans,
27343321 .qsad_insts,
3322 .real_true16,
3323 .requires_initial_unclause_vmem,
27353324 .restricted_soffset,
27363325 .s_wakeup_barrier_inst,
27373326 .sad_insts,
......@@ -2740,17 +3329,24 @@ pub const cpu = struct {
27403329 .setprio_inc_wg_inst,
27413330 .setreg_vgpr_msb_fixup,
27423331 .shader_cycles_hi_lo_registers,
3332 .smem_prefetch_insts,
27433333 .sramecc_support,
3334 .swmmac_gfx1200_insts,
3335 .swmmac_gfx1250_insts,
27443336 .tanh_insts,
27453337 .tensor_cvt_lut_insts,
3338 .trans_coexecution_hazard,
27463339 .transpose_load_f4f6_insts,
3340 .v_mov_b64_inst,
3341 .v_mul_u64_inst,
27473342 .vcmpx_permlane_hazard,
27483343 .vgpr_align2,
27493344 .vmem_pref_insts,
3345 .vop3px2_increments_va_vdst_twice,
27503346 .wait_xcnt,
27513347 .wavefrontsize32,
3348 .wmma_coexecution_hazards,
27523349 .xnack,
2753 .xnack_support,
27543350 }),
27553351 };
27563352 pub const gfx1251: CpuModel = .{
......@@ -2766,6 +3362,7 @@ pub const cpu = struct {
27663362 .architected_flat_scratch,
27673363 .architected_sgprs,
27683364 .ashr_pk_insts,
3365 .asynccnt,
27693366 .atomic_buffer_global_pk_add_f16_insts,
27703367 .atomic_buffer_pk_add_bf16_inst,
27713368 .atomic_ds_pk_add_16_insts,
......@@ -2775,6 +3372,7 @@ pub const cpu = struct {
27753372 .atomic_fmin_fmax_flat_f64,
27763373 .atomic_fmin_fmax_global_f64,
27773374 .atomic_global_pk_add_bf16_inst,
3375 .back_off_barrier,
27783376 .bf16_cvt_insts,
27793377 .bf16_pk_insts,
27803378 .bf16_trans_insts,
......@@ -2800,27 +3398,40 @@ pub const cpu = struct {
28003398 .fmacf64_inst,
28013399 .fp8_conversion_insts,
28023400 .fp8e5m3_insts,
3401 .full_rate_64_ops,
28033402 .gfx12,
28043403 .gfx1250_insts,
3404 .gfx1251_gemm_insts,
3405 .gfx125x_lowest_rate_wmma,
28053406 .globally_addressable_scratch,
28063407 .kernarg_preload,
28073408 .lds_barrier_arrive_atomic,
28083409 .ldsbankcount32,
28093410 .lerp_inst,
28103411 .lshl_add_u64_inst,
3412 .mad_nc_64_32_insts,
28113413 .mad_u32_inst,
28123414 .max_hard_clause_length_63,
28133415 .mcast_load_insts,
28143416 .memory_atomic_fadd_f32_denormal_support,
28153417 .min3_max3_pkf16,
3418 .min_max_i64_insts,
28163419 .minimum3_maximum3_pkf16,
3420 .mqsad_insts,
3421 .mqsad_pk_insts,
3422 .msad_insts,
3423 .no_f16_pseudo_scalar_trans_inline_constants,
28173424 .packed_fp32_ops,
3425 .packed_fp64_ops,
28183426 .packed_tid,
3427 .packed_u64_ops,
28193428 .permlane16_swap,
28203429 .pk_add_min_max_insts,
28213430 .prng_inst,
28223431 .pseudo_scalar_trans,
28233432 .qsad_insts,
3433 .real_true16,
3434 .requires_initial_unclause_vmem,
28243435 .restricted_soffset,
28253436 .s_wakeup_barrier_inst,
28263437 .sad_insts,
......@@ -2828,25 +3439,127 @@ pub const cpu = struct {
28283439 .scalar_dwordx3_loads,
28293440 .setprio_inc_wg_inst,
28303441 .shader_cycles_hi_lo_registers,
3442 .smem_prefetch_insts,
28313443 .sramecc_support,
3444 .swmmac_gfx1200_insts,
3445 .swmmac_gfx1250_insts,
28323446 .tanh_insts,
28333447 .tensor_cvt_lut_insts,
3448 .trans_coexecution_hazard,
28343449 .transpose_load_f4f6_insts,
3450 .use_add_pc64_inst,
3451 .v_mov_b64_inst,
3452 .v_mul_u64_inst,
28353453 .vcmpx_permlane_hazard,
28363454 .vgpr_align2,
28373455 .vmem_pref_insts,
3456 .vop3px2_increments_va_vdst_twice,
28383457 .wait_xcnt,
28393458 .wavefrontsize32,
3459 .wmma_coexecution_hazards,
3460 .xnack,
3461 }),
3462 };
3463 pub const gfx12_5_generic: CpuModel = .{
3464 .name = "gfx12_5_generic",
3465 .llvm_name = "gfx12-5-generic",
3466 .features = featureSet(&[_]Feature{
3467 .@"1024_addressable_vgprs",
3468 .@"45_bit_num_records_buffer_resource",
3469 .@"64_bit_literals",
3470 .add_min_max_insts,
3471 .add_sub_u64_insts,
3472 .addressablelocalmemorysize327680,
3473 .architected_flat_scratch,
3474 .architected_sgprs,
3475 .ashr_pk_insts,
3476 .asynccnt,
3477 .atomic_buffer_global_pk_add_f16_insts,
3478 .atomic_buffer_pk_add_bf16_inst,
3479 .atomic_ds_pk_add_16_insts,
3480 .atomic_fadd_no_rtn_insts,
3481 .atomic_fadd_rtn_insts,
3482 .atomic_flat_pk_add_16_insts,
3483 .atomic_fmin_fmax_flat_f64,
3484 .atomic_fmin_fmax_global_f64,
3485 .atomic_global_pk_add_bf16_inst,
3486 .back_off_barrier,
3487 .bf16_cvt_insts,
3488 .bf16_pk_insts,
3489 .bf16_trans_insts,
3490 .bitop3_insts,
3491 .clusters,
3492 .cumode,
3493 .cvt_pk_f16_f32_inst,
3494 .d16_write_vgpr32,
3495 .dl_insts,
3496 .dot7_insts,
3497 .dot8_insts,
3498 .dpp_src1_sgpr,
3499 .emulated_system_scope_atomics,
3500 .flat_atomic_fadd_f32_inst,
3501 .flat_buffer_global_fadd_f64_inst,
3502 .flat_gvs_mode,
3503 .fma_mix_bf16_insts,
3504 .fmacf64_inst,
3505 .fp8_conversion_insts,
3506 .fp8e5m3_insts,
3507 .gfx12,
3508 .gfx1250_insts,
3509 .gfx125x_lowest_rate_wmma,
3510 .globally_addressable_scratch,
3511 .kernarg_preload,
3512 .lds_barrier_arrive_atomic,
3513 .ldsbankcount32,
3514 .lshl_add_u64_inst,
3515 .mad_nc_64_32_insts,
3516 .mad_u32_inst,
3517 .max_hard_clause_length_63,
3518 .mcast_load_insts,
3519 .memory_atomic_fadd_f32_denormal_support,
3520 .min3_max3_pkf16,
3521 .min_max_i64_insts,
3522 .minimum3_maximum3_pkf16,
3523 .no_f16_pseudo_scalar_trans_inline_constants,
3524 .packed_fp32_ops,
3525 .packed_tid,
3526 .permlane16_swap,
3527 .pk_add_min_max_insts,
3528 .prng_inst,
3529 .pseudo_scalar_trans,
3530 .real_true16,
3531 .requires_cov6,
3532 .requires_initial_unclause_vmem,
3533 .restricted_soffset,
3534 .s_wakeup_barrier_inst,
3535 .salu_float,
3536 .scalar_dwordx3_loads,
3537 .setprio_inc_wg_inst,
3538 .setreg_vgpr_msb_fixup,
3539 .shader_cycles_hi_lo_registers,
3540 .smem_prefetch_insts,
3541 .sramecc_support,
3542 .tanh_insts,
3543 .tensor_cvt_lut_insts,
3544 .trans_coexecution_hazard,
3545 .transpose_load_f4f6_insts,
3546 .v_mov_b64_inst,
3547 .v_mul_u64_inst,
3548 .vcmpx_permlane_hazard,
3549 .vgpr_align2,
3550 .vmem_pref_insts,
3551 .wait_xcnt,
3552 .wavefrontsize32,
3553 .wmma_coexecution_hazards,
28403554 .xnack,
2841 .xnack_support,
28423555 }),
28433556 };
28443557 pub const gfx12_generic: CpuModel = .{
28453558 .name = "gfx12_generic",
28463559 .llvm_name = "gfx12-generic",
28473560 .features = featureSet(&[_]Feature{
3561 .@"1536_physical_vgprs",
28483562 .addressablelocalmemorysize65536,
2849 .allocate1_5xvgprs,
28503563 .architected_flat_scratch,
28513564 .architected_sgprs,
28523565 .atomic_buffer_global_pk_add_f16_insts,
......@@ -2873,25 +3586,170 @@ pub const cpu = struct {
28733586 .dpp_src1_sgpr,
28743587 .extended_image_insts,
28753588 .flat_atomic_fadd_f32_inst,
3589 .formatted_mubuf_insts,
28763590 .fp8_conversion_insts,
28773591 .gfx12,
28783592 .image_insts,
28793593 .ldsbankcount32,
28803594 .lerp_inst,
28813595 .memory_atomic_fadd_f32_denormal_support,
3596 .mqsad_insts,
3597 .mqsad_pk_insts,
3598 .msad_insts,
3599 .mtbuf_insts,
3600 .no_f16_pseudo_scalar_trans_inline_constants,
28823601 .nsa_encoding,
28833602 .packed_tid,
28843603 .partial_nsa_encoding,
28853604 .pseudo_scalar_trans,
28863605 .qsad_insts,
3606 .real_true16,
28873607 .requires_cov6,
28883608 .restricted_soffset,
28893609 .sad_insts,
28903610 .salu_float,
28913611 .scalar_dwordx3_loads,
28923612 .shader_cycles_hi_lo_registers,
3613 .smem_prefetch_insts,
3614 .swmmac_gfx1200_insts,
28933615 .vcmpx_permlane_hazard,
28943616 .waits_before_system_scope_stores,
3617 .wmma_128b_insts,
3618 }),
3619 };
3620 pub const gfx1310: CpuModel = .{
3621 .name = "gfx1310",
3622 .llvm_name = "gfx1310",
3623 .features = featureSet(&[_]Feature{
3624 .@"1536_physical_vgprs",
3625 .@"64_bit_literals",
3626 .addressablelocalmemorysize65536,
3627 .architected_flat_scratch,
3628 .architected_sgprs,
3629 .ashr_pk_insts,
3630 .atomic_buffer_global_pk_add_f16_insts,
3631 .atomic_buffer_pk_add_bf16_inst,
3632 .atomic_ds_pk_add_16_insts,
3633 .atomic_fadd_no_rtn_insts,
3634 .atomic_fadd_rtn_insts,
3635 .atomic_flat_pk_add_16_insts,
3636 .atomic_fmin_fmax_flat_f64,
3637 .atomic_fmin_fmax_global_f64,
3638 .atomic_global_pk_add_bf16_inst,
3639 .bf16_cvt_insts,
3640 .bf16_pk_insts,
3641 .bf16_trans_insts,
3642 .bitop3_insts,
3643 .clusters,
3644 .cube_insts,
3645 .cvt_norm_insts,
3646 .cvt_pk_f16_f32_inst,
3647 .cvt_pknorm_vop2_insts,
3648 .cvt_pknorm_vop3_insts,
3649 .dl_insts,
3650 .dot7_insts,
3651 .dot8_insts,
3652 .dpp_src1_sgpr,
3653 .f16bf16_to_fp6bf6_cvt_scale_insts,
3654 .flat_atomic_fadd_f32_inst,
3655 .flat_gvs_mode,
3656 .fma_mix_bf16_insts,
3657 .fmacf64_inst,
3658 .fp8_conversion_insts,
3659 .gfx1250_insts,
3660 .gfx13,
3661 .globally_addressable_scratch,
3662 .ldsbankcount32,
3663 .lerp_inst,
3664 .mqsad_insts,
3665 .mqsad_pk_insts,
3666 .msad_insts,
3667 .nsa_encoding,
3668 .packed_tid,
3669 .partial_nsa_encoding,
3670 .permlane16_swap,
3671 .prng_inst,
3672 .pseudo_scalar_trans,
3673 .qsad_insts,
3674 .restricted_soffset,
3675 .s_wakeup_barrier_inst,
3676 .sad_insts,
3677 .salu_float,
3678 .scalar_dwordx3_loads,
3679 .shader_cycles_register,
3680 .smem_prefetch_insts,
3681 .tanh_insts,
3682 .tensor_cvt_lut_insts,
3683 .transpose_load_f4f6_insts,
3684 .vcmpx_permlane_hazard,
3685 }),
3686 };
3687 pub const gfx13_generic: CpuModel = .{
3688 .name = "gfx13_generic",
3689 .llvm_name = "gfx13-generic",
3690 .features = featureSet(&[_]Feature{
3691 .@"1536_physical_vgprs",
3692 .@"64_bit_literals",
3693 .addressablelocalmemorysize65536,
3694 .architected_flat_scratch,
3695 .architected_sgprs,
3696 .ashr_pk_insts,
3697 .atomic_buffer_global_pk_add_f16_insts,
3698 .atomic_buffer_pk_add_bf16_inst,
3699 .atomic_ds_pk_add_16_insts,
3700 .atomic_fadd_no_rtn_insts,
3701 .atomic_fadd_rtn_insts,
3702 .atomic_flat_pk_add_16_insts,
3703 .atomic_fmin_fmax_flat_f64,
3704 .atomic_fmin_fmax_global_f64,
3705 .atomic_global_pk_add_bf16_inst,
3706 .bf16_cvt_insts,
3707 .bf16_pk_insts,
3708 .bf16_trans_insts,
3709 .bitop3_insts,
3710 .clusters,
3711 .cube_insts,
3712 .cvt_norm_insts,
3713 .cvt_pk_f16_f32_inst,
3714 .cvt_pknorm_vop2_insts,
3715 .cvt_pknorm_vop3_insts,
3716 .dl_insts,
3717 .dot7_insts,
3718 .dot8_insts,
3719 .dpp_src1_sgpr,
3720 .f16bf16_to_fp6bf6_cvt_scale_insts,
3721 .flat_atomic_fadd_f32_inst,
3722 .flat_gvs_mode,
3723 .fma_mix_bf16_insts,
3724 .fmacf64_inst,
3725 .fp8_conversion_insts,
3726 .gfx1250_insts,
3727 .gfx13,
3728 .globally_addressable_scratch,
3729 .ldsbankcount32,
3730 .lerp_inst,
3731 .mqsad_insts,
3732 .mqsad_pk_insts,
3733 .msad_insts,
3734 .nsa_encoding,
3735 .packed_tid,
3736 .partial_nsa_encoding,
3737 .permlane16_swap,
3738 .prng_inst,
3739 .pseudo_scalar_trans,
3740 .qsad_insts,
3741 .requires_cov6,
3742 .restricted_soffset,
3743 .s_wakeup_barrier_inst,
3744 .sad_insts,
3745 .salu_float,
3746 .scalar_dwordx3_loads,
3747 .shader_cycles_register,
3748 .smem_prefetch_insts,
3749 .tanh_insts,
3750 .tensor_cvt_lut_insts,
3751 .transpose_load_f4f6_insts,
3752 .vcmpx_permlane_hazard,
28953753 }),
28963754 };
28973755 pub const gfx600: CpuModel = .{
......@@ -2977,7 +3835,7 @@ pub const cpu = struct {
29773835 .ldsbankcount32,
29783836 .unpacked_d16_vmem,
29793837 .volcanic_islands,
2980 .xnack_support,
3838 .xnack_on_off_modes,
29813839 }),
29823840 };
29833841 pub const gfx802: CpuModel = .{
......@@ -3017,7 +3875,7 @@ pub const cpu = struct {
30173875 .image_store_d16_bug,
30183876 .ldsbankcount16,
30193877 .volcanic_islands,
3020 .xnack_support,
3878 .xnack_on_off_modes,
30213879 }),
30223880 };
30233881 pub const gfx900: CpuModel = .{
......@@ -3175,6 +4033,7 @@ pub const cpu = struct {
31754033 .packed_tid,
31764034 .pk_fmac_f16_inst,
31774035 .sramecc_support,
4036 .tgsplit_support,
31784037 .vgpr_align2,
31794038 }),
31804039 };
......@@ -3239,6 +4098,8 @@ pub const cpu = struct {
32394098 .packed_tid,
32404099 .pk_fmac_f16_inst,
32414100 .sramecc_support,
4101 .tgsplit_support,
4102 .v_mov_b64_inst,
32424103 .vgpr_align2,
32434104 .xf32_insts,
32444105 }),
......@@ -3295,6 +4156,8 @@ pub const cpu = struct {
32954156 .pk_fmac_f16_inst,
32964157 .prng_inst,
32974158 .sramecc_support,
4159 .tgsplit_support,
4160 .v_mov_b64_inst,
32984161 .vgpr_align2,
32994162 }),
33004163 };
......@@ -3342,6 +4205,8 @@ pub const cpu = struct {
33424205 .pk_fmac_f16_inst,
33434206 .requires_cov6,
33444207 .sramecc_support,
4208 .tgsplit_support,
4209 .v_mov_b64_inst,
33454210 .vgpr_align2,
33464211 }),
33474212 };
......@@ -3452,7 +4317,7 @@ pub const cpu = struct {
34524317 .image_store_d16_bug,
34534318 .ldsbankcount16,
34544319 .volcanic_islands,
3455 .xnack_support,
4320 .xnack_on_off_modes,
34564321 }),
34574322 };
34584323 pub const tahiti: CpuModel = .{
lib/std/Target/hexagon.zig+204
......@@ -34,7 +34,41 @@ pub const Feature = enum {
3434 nvs,
3535 packets,
3636 prev65,
37 reserved_r10,
38 reserved_r11,
39 reserved_r12,
40 reserved_r13,
41 reserved_r14,
42 reserved_r15,
43 reserved_r16,
44 reserved_r17,
45 reserved_r18,
3746 reserved_r19,
47 reserved_r20,
48 reserved_r21,
49 reserved_r22,
50 reserved_r23,
51 reserved_r24,
52 reserved_r25,
53 reserved_r26,
54 reserved_r27,
55 reserved_r28,
56 reserved_r6,
57 reserved_r7,
58 reserved_r8,
59 reserved_r9,
60 scs_reg_r16,
61 scs_reg_r17,
62 scs_reg_r18,
63 scs_reg_r19,
64 scs_reg_r20,
65 scs_reg_r21,
66 scs_reg_r22,
67 scs_reg_r23,
68 scs_reg_r24,
69 scs_reg_r25,
70 scs_reg_r26,
71 scs_reg_r27,
3872 small_data,
3973 tinycore,
4074 v5,
......@@ -241,11 +275,181 @@ pub const all_features = blk: {
241275 .description = "Support features deprecated in v65",
242276 .dependencies = featureSet(&[_]Feature{}),
243277 };
278 result[@backingInt(Feature.reserved_r10)] = .{
279 .llvm_name = "reserved-r10",
280 .description = "Reserve register R10",
281 .dependencies = featureSet(&[_]Feature{}),
282 };
283 result[@backingInt(Feature.reserved_r11)] = .{
284 .llvm_name = "reserved-r11",
285 .description = "Reserve register R11",
286 .dependencies = featureSet(&[_]Feature{}),
287 };
288 result[@backingInt(Feature.reserved_r12)] = .{
289 .llvm_name = "reserved-r12",
290 .description = "Reserve register R12",
291 .dependencies = featureSet(&[_]Feature{}),
292 };
293 result[@backingInt(Feature.reserved_r13)] = .{
294 .llvm_name = "reserved-r13",
295 .description = "Reserve register R13",
296 .dependencies = featureSet(&[_]Feature{}),
297 };
298 result[@backingInt(Feature.reserved_r14)] = .{
299 .llvm_name = "reserved-r14",
300 .description = "Reserve register R14",
301 .dependencies = featureSet(&[_]Feature{}),
302 };
303 result[@backingInt(Feature.reserved_r15)] = .{
304 .llvm_name = "reserved-r15",
305 .description = "Reserve register R15",
306 .dependencies = featureSet(&[_]Feature{}),
307 };
308 result[@backingInt(Feature.reserved_r16)] = .{
309 .llvm_name = "reserved-r16",
310 .description = "Reserve register R16",
311 .dependencies = featureSet(&[_]Feature{}),
312 };
313 result[@backingInt(Feature.reserved_r17)] = .{
314 .llvm_name = "reserved-r17",
315 .description = "Reserve register R17",
316 .dependencies = featureSet(&[_]Feature{}),
317 };
318 result[@backingInt(Feature.reserved_r18)] = .{
319 .llvm_name = "reserved-r18",
320 .description = "Reserve register R18",
321 .dependencies = featureSet(&[_]Feature{}),
322 };
244323 result[@backingInt(Feature.reserved_r19)] = .{
245324 .llvm_name = "reserved-r19",
246325 .description = "Reserve register R19",
247326 .dependencies = featureSet(&[_]Feature{}),
248327 };
328 result[@backingInt(Feature.reserved_r20)] = .{
329 .llvm_name = "reserved-r20",
330 .description = "Reserve register R20",
331 .dependencies = featureSet(&[_]Feature{}),
332 };
333 result[@backingInt(Feature.reserved_r21)] = .{
334 .llvm_name = "reserved-r21",
335 .description = "Reserve register R21",
336 .dependencies = featureSet(&[_]Feature{}),
337 };
338 result[@backingInt(Feature.reserved_r22)] = .{
339 .llvm_name = "reserved-r22",
340 .description = "Reserve register R22",
341 .dependencies = featureSet(&[_]Feature{}),
342 };
343 result[@backingInt(Feature.reserved_r23)] = .{
344 .llvm_name = "reserved-r23",
345 .description = "Reserve register R23",
346 .dependencies = featureSet(&[_]Feature{}),
347 };
348 result[@backingInt(Feature.reserved_r24)] = .{
349 .llvm_name = "reserved-r24",
350 .description = "Reserve register R24",
351 .dependencies = featureSet(&[_]Feature{}),
352 };
353 result[@backingInt(Feature.reserved_r25)] = .{
354 .llvm_name = "reserved-r25",
355 .description = "Reserve register R25",
356 .dependencies = featureSet(&[_]Feature{}),
357 };
358 result[@backingInt(Feature.reserved_r26)] = .{
359 .llvm_name = "reserved-r26",
360 .description = "Reserve register R26",
361 .dependencies = featureSet(&[_]Feature{}),
362 };
363 result[@backingInt(Feature.reserved_r27)] = .{
364 .llvm_name = "reserved-r27",
365 .description = "Reserve register R27",
366 .dependencies = featureSet(&[_]Feature{}),
367 };
368 result[@backingInt(Feature.reserved_r28)] = .{
369 .llvm_name = "reserved-r28",
370 .description = "Reserve register R28",
371 .dependencies = featureSet(&[_]Feature{}),
372 };
373 result[@backingInt(Feature.reserved_r6)] = .{
374 .llvm_name = "reserved-r6",
375 .description = "Reserve register R6",
376 .dependencies = featureSet(&[_]Feature{}),
377 };
378 result[@backingInt(Feature.reserved_r7)] = .{
379 .llvm_name = "reserved-r7",
380 .description = "Reserve register R7",
381 .dependencies = featureSet(&[_]Feature{}),
382 };
383 result[@backingInt(Feature.reserved_r8)] = .{
384 .llvm_name = "reserved-r8",
385 .description = "Reserve register R8",
386 .dependencies = featureSet(&[_]Feature{}),
387 };
388 result[@backingInt(Feature.reserved_r9)] = .{
389 .llvm_name = "reserved-r9",
390 .description = "Reserve register R9",
391 .dependencies = featureSet(&[_]Feature{}),
392 };
393 result[@backingInt(Feature.scs_reg_r16)] = .{
394 .llvm_name = "scs-reg-r16",
395 .description = "Use register R16 as the shadow call stack pointer",
396 .dependencies = featureSet(&[_]Feature{}),
397 };
398 result[@backingInt(Feature.scs_reg_r17)] = .{
399 .llvm_name = "scs-reg-r17",
400 .description = "Use register R17 as the shadow call stack pointer",
401 .dependencies = featureSet(&[_]Feature{}),
402 };
403 result[@backingInt(Feature.scs_reg_r18)] = .{
404 .llvm_name = "scs-reg-r18",
405 .description = "Use register R18 as the shadow call stack pointer",
406 .dependencies = featureSet(&[_]Feature{}),
407 };
408 result[@backingInt(Feature.scs_reg_r19)] = .{
409 .llvm_name = "scs-reg-r19",
410 .description = "Use register R19 as the shadow call stack pointer",
411 .dependencies = featureSet(&[_]Feature{}),
412 };
413 result[@backingInt(Feature.scs_reg_r20)] = .{
414 .llvm_name = "scs-reg-r20",
415 .description = "Use register R20 as the shadow call stack pointer",
416 .dependencies = featureSet(&[_]Feature{}),
417 };
418 result[@backingInt(Feature.scs_reg_r21)] = .{
419 .llvm_name = "scs-reg-r21",
420 .description = "Use register R21 as the shadow call stack pointer",
421 .dependencies = featureSet(&[_]Feature{}),
422 };
423 result[@backingInt(Feature.scs_reg_r22)] = .{
424 .llvm_name = "scs-reg-r22",
425 .description = "Use register R22 as the shadow call stack pointer",
426 .dependencies = featureSet(&[_]Feature{}),
427 };
428 result[@backingInt(Feature.scs_reg_r23)] = .{
429 .llvm_name = "scs-reg-r23",
430 .description = "Use register R23 as the shadow call stack pointer",
431 .dependencies = featureSet(&[_]Feature{}),
432 };
433 result[@backingInt(Feature.scs_reg_r24)] = .{
434 .llvm_name = "scs-reg-r24",
435 .description = "Use register R24 as the shadow call stack pointer",
436 .dependencies = featureSet(&[_]Feature{}),
437 };
438 result[@backingInt(Feature.scs_reg_r25)] = .{
439 .llvm_name = "scs-reg-r25",
440 .description = "Use register R25 as the shadow call stack pointer",
441 .dependencies = featureSet(&[_]Feature{}),
442 };
443 result[@backingInt(Feature.scs_reg_r26)] = .{
444 .llvm_name = "scs-reg-r26",
445 .description = "Use register R26 as the shadow call stack pointer",
446 .dependencies = featureSet(&[_]Feature{}),
447 };
448 result[@backingInt(Feature.scs_reg_r27)] = .{
449 .llvm_name = "scs-reg-r27",
450 .description = "Use register R27 as the shadow call stack pointer",
451 .dependencies = featureSet(&[_]Feature{}),
452 };
249453 result[@backingInt(Feature.small_data)] = .{
250454 .llvm_name = "small-data",
251455 .description = "Allow GP-relative addressing of global variables",
lib/std/Target/mips.zig+23
......@@ -13,6 +13,7 @@ pub const Feature = enum {
1313 dspr2,
1414 dspr3,
1515 eva,
16 fix_r5900,
1617 fp64,
1718 fpxx,
1819 ginv,
......@@ -52,6 +53,7 @@ pub const Feature = enum {
5253 notraps,
5354 p5600,
5455 ptr64,
56 r5900,
5557 single_float,
5658 soft_float,
5759 strict_align,
......@@ -121,6 +123,11 @@ pub const all_features = blk: {
121123 .description = "Mips EVA ASE",
122124 .dependencies = featureSet(&[_]Feature{}),
123125 };
126 result[@backingInt(Feature.fix_r5900)] = .{
127 .llvm_name = "fix-r5900",
128 .description = "Enable R5900 short loop erratum fix",
129 .dependencies = featureSet(&[_]Feature{}),
130 };
124131 result[@backingInt(Feature.fp64)] = .{
125132 .llvm_name = "fp64",
126133 .description = "Support 64-bit FP registers",
......@@ -372,6 +379,15 @@ pub const all_features = blk: {
372379 .description = "Pointers are 64-bit wide",
373380 .dependencies = featureSet(&[_]Feature{}),
374381 };
382 result[@backingInt(Feature.r5900)] = .{
383 .llvm_name = "r5900",
384 .description = "R5900 (PS2 Emotion Engine) Support",
385 .dependencies = featureSet(&[_]Feature{
386 .fix_r5900,
387 .mips3,
388 .single_float,
389 }),
390 };
375391 result[@backingInt(Feature.single_float)] = .{
376392 .llvm_name = "single-float",
377393 .description = "Only supports single precision float",
......@@ -596,4 +612,11 @@ pub const cpu = struct {
596612 .soft_float,
597613 }),
598614 };
615 pub const r5900: CpuModel = .{
616 .name = "r5900",
617 .llvm_name = "r5900",
618 .features = featureSet(&[_]Feature{
619 .r5900,
620 }),
621 };
599622};
lib/std/Target/nvptx.zig+18
......@@ -36,6 +36,9 @@ pub const Feature = enum {
3636 ptx87,
3737 ptx88,
3838 ptx90,
39 ptx91,
40 ptx92,
41 ptx93,
3942 sm_100,
4043 sm_100a,
4144 sm_100f,
......@@ -242,6 +245,21 @@ pub const all_features = blk: {
242245 .description = "Use PTX version 90",
243246 .dependencies = featureSet(&[_]Feature{}),
244247 };
248 result[@backingInt(Feature.ptx91)] = .{
249 .llvm_name = "ptx91",
250 .description = "Use PTX version 91",
251 .dependencies = featureSet(&[_]Feature{}),
252 };
253 result[@backingInt(Feature.ptx92)] = .{
254 .llvm_name = "ptx92",
255 .description = "Use PTX version 92",
256 .dependencies = featureSet(&[_]Feature{}),
257 };
258 result[@backingInt(Feature.ptx93)] = .{
259 .llvm_name = "ptx93",
260 .description = "Use PTX version 93",
261 .dependencies = featureSet(&[_]Feature{}),
262 };
245263 result[@backingInt(Feature.sm_100)] = .{
246264 .llvm_name = "sm_100",
247265 .description = "Target SM 100",
lib/std/Target/powerpc.zig+51-2
......@@ -43,6 +43,7 @@ pub const Feature = enum {
4343 fuse_wideimm,
4444 fuse_zeromove,
4545 fusion,
46 future_vector,
4647 hard_float,
4748 htm,
4849 icbt,
......@@ -83,6 +84,7 @@ pub const Feature = enum {
8384 spe,
8485 stfiwx,
8586 two_const_nr,
87 use_ptrgl_helper,
8688 vectors_use_two_units,
8789 vsx,
8890};
......@@ -342,6 +344,14 @@ pub const all_features = blk: {
342344 .description = "Target supports instruction fusion",
343345 .dependencies = featureSet(&[_]Feature{}),
344346 };
347 result[@backingInt(Feature.future_vector)] = .{
348 .llvm_name = "future-vector",
349 .description = "Enable Future vector instructions",
350 .dependencies = featureSet(&[_]Feature{
351 .isa_future_instructions,
352 .power10_vector,
353 }),
354 };
345355 result[@backingInt(Feature.hard_float)] = .{
346356 .llvm_name = "hard-float",
347357 .description = "Enable floating-point instructions",
......@@ -441,6 +451,7 @@ pub const all_features = blk: {
441451 .description = "32Byte load and store instructions",
442452 .dependencies = featureSet(&[_]Feature{
443453 .isa_v30_instructions,
454 .vsx,
444455 }),
445456 };
446457 result[@backingInt(Feature.partword_atomics)] = .{
......@@ -580,6 +591,11 @@ pub const all_features = blk: {
580591 .description = "Requires two constant Newton-Raphson computation",
581592 .dependencies = featureSet(&[_]Feature{}),
582593 };
594 result[@backingInt(Feature.use_ptrgl_helper)] = .{
595 .llvm_name = "use-ptrgl-helper",
596 .description = "Use ._ptrgl for indirect calls",
597 .dependencies = featureSet(&[_]Feature{}),
598 };
583599 result[@backingInt(Feature.vectors_use_two_units)] = .{
584600 .llvm_name = "vectors-use-two-units",
585601 .description = "Vectors use two units",
......@@ -747,6 +763,19 @@ pub const cpu = struct {
747763 .stfiwx,
748764 }),
749765 };
766 pub const cell: CpuModel = .{
767 .name = "cell",
768 .llvm_name = null,
769 .features = featureSet(&[_]Feature{
770 .@"64bit_support",
771 .altivec,
772 .fres,
773 .frsqrte,
774 .fsqrt,
775 .mfocrf,
776 .stfiwx,
777 }),
778 };
750779 pub const e500: CpuModel = .{
751780 .name = "e500",
752781 .llvm_name = "e500",
......@@ -765,6 +794,15 @@ pub const cpu = struct {
765794 .stfiwx,
766795 }),
767796 };
797 pub const e500v2: CpuModel = .{
798 .name = "e500v2",
799 .llvm_name = null,
800 .features = featureSet(&[_]Feature{
801 .efpu2,
802 .isel,
803 .msync,
804 }),
805 };
768806 pub const e5500: CpuModel = .{
769807 .name = "e5500",
770808 .llvm_name = "e5500",
......@@ -776,6 +814,18 @@ pub const cpu = struct {
776814 .stfiwx,
777815 }),
778816 };
817 pub const e6500: CpuModel = .{
818 .name = "e6500",
819 .llvm_name = null,
820 .features = featureSet(&[_]Feature{
821 .@"64bit_support",
822 .altivec,
823 .booke,
824 .isel,
825 .mfocrf,
826 .stfiwx,
827 }),
828 };
779829 pub const future: CpuModel = .{
780830 .name = "future",
781831 .llvm_name = "future",
......@@ -803,8 +853,8 @@ pub const cpu = struct {
803853 .fuse_logical_add,
804854 .fuse_sha3,
805855 .fuse_store,
856 .future_vector,
806857 .icbt,
807 .isa_future_instructions,
808858 .isa_v206_instructions,
809859 .isel,
810860 .ldbrx,
......@@ -814,7 +864,6 @@ pub const cpu = struct {
814864 .partword_atomics,
815865 .pcrelative_memops,
816866 .popcntd,
817 .power10_vector,
818867 .ppc_postra_sched,
819868 .ppc_prera_sched,
820869 .predictable_select_expensive,
lib/std/Target/riscv.zig+673-134
......@@ -8,13 +8,8 @@ pub const Feature = enum {
88 @"32bit",
99 @"64bit",
1010 a,
11 add_load_fusion,
12 addi_load_fusion,
1311 andes45,
14 auipc_addi_fusion,
15 auipc_load_fusion,
1612 b,
17 bfext_fusion,
1813 c,
1914 conditional_cmv_fusion,
2015 d,
......@@ -25,6 +20,7 @@ pub const Feature = enum {
2520 disable_postmisched_store_clustering,
2621 dlen_factor_2,
2722 e,
23 enable_select_opt,
2824 enable_vsetvli_sched_heuristic,
2925 exact_asm,
3026 experimental,
......@@ -32,26 +28,57 @@ pub const Feature = enum {
3228 experimental_rvm23u32,
3329 experimental_smpmpmt,
3430 experimental_svukte,
35 experimental_xrivosvisni,
36 experimental_xrivosvizip,
31 experimental_xqccmt,
3732 experimental_xsfmclic,
3833 experimental_xsfsclic,
34 experimental_y,
3935 experimental_zibi,
4036 experimental_zicfilp,
4137 experimental_zicfiss,
38 experimental_zvabd,
4239 experimental_zvbc32e,
40 experimental_zvdot4a8i,
41 experimental_zvfbdota32f,
4342 experimental_zvfbfa,
4443 experimental_zvfofp8min,
44 experimental_zvfqwbdota8f,
45 experimental_zvfqwdota8f,
46 experimental_zvfwbdota16bf,
47 experimental_zvfwdota16bf,
4548 experimental_zvkgs,
46 experimental_zvqdotq,
49 experimental_zvqwbdota16i,
50 experimental_zvqwbdota8i,
51 experimental_zvqwdota16i,
52 experimental_zvqwdota8i,
53 experimental_zvvfmm,
54 experimental_zvvmm,
55 experimental_zvvmtls,
56 experimental_zvvmttls,
57 experimental_zvzip,
4758 f,
4859 forced_atomics,
60 fusion_add_load,
61 fusion_add_mem,
62 fusion_addi_load,
63 fusion_auipc_addi,
64 fusion_auipc_load,
65 fusion_bfext,
66 fusion_ld_add,
67 fusion_logic_imm_reg,
68 fusion_logic_reg_imm,
69 fusion_logic_reg_reg,
70 fusion_lui_addi,
71 fusion_lui_load,
72 fusion_mul_add,
73 fusion_qc_e_li_load_store,
74 fusion_shift_bit_extract,
75 fusion_shifted_zextw,
76 fusion_shxadd_load,
77 fusion_zexth,
78 fusion_zextw,
4979 h,
5080 i,
51 ld_add_fusion,
5281 log_vrgather,
53 lui_addi_fusion,
54 lui_load_fusion,
5582 m,
5683 mips_p8700,
5784 no_default_unroll,
......@@ -67,6 +94,7 @@ pub const Feature = enum {
6794 optimized_zero_stride_load,
6895 permissive_zalrsc,
6996 predictable_select_expensive,
97 prefer_ascending_load_store,
7098 prefer_vsetvli_over_read_vlenb,
7199 prefer_w_inst,
72100 q,
......@@ -118,17 +146,16 @@ pub const Feature = enum {
118146 sha,
119147 shcounterenw,
120148 shgatpa,
121 shifted_zextw_fusion,
122149 shlcofideleg,
123150 short_forward_branch_ialu,
124151 short_forward_branch_iload,
125152 short_forward_branch_iminmax,
153 short_forward_branch_imm,
126154 short_forward_branch_imul,
127155 shtvala,
128156 shvsatpa,
129157 shvstvala,
130158 shvstvecd,
131 shxadd_load_fusion,
132159 single_element_vec_fp64,
133160 smaia,
134161 smcdeleg,
......@@ -165,6 +192,7 @@ pub const Feature = enum {
165192 svinval,
166193 svnapot,
167194 svpbmt,
195 svrsw60t59b,
168196 svvptc,
169197 tagged_globals,
170198 unaligned_scalar_mem,
......@@ -174,6 +202,7 @@ pub const Feature = enum {
174202 ventana_veyron,
175203 vl_dependent_latency,
176204 vxrm_pipeline_flush,
205 xaifet,
177206 xandesbfhcvt,
178207 xandesperf,
179208 xandesvbfhcvt,
......@@ -181,6 +210,7 @@ pub const Feature = enum {
181210 xandesvpackfph,
182211 xandesvsinth,
183212 xandesvsintload,
213 xcheriot,
184214 xcvalu,
185215 xcvbi,
186216 xcvbitmanip,
......@@ -215,6 +245,7 @@ pub const Feature = enum {
215245 xsfcease,
216246 xsfmm128t,
217247 xsfmm16t,
248 xsfmm32a,
218249 xsfmm32a16f,
219250 xsfmm32a32f,
220251 xsfmm32a8f,
......@@ -236,6 +267,7 @@ pub const Feature = enum {
236267 xsifivecdiscarddlone,
237268 xsifivecflushdlone,
238269 xsmtvdot,
270 xsmtvdotii,
239271 xtheadba,
240272 xtheadbb,
241273 xtheadbs,
......@@ -275,8 +307,6 @@ pub const Feature = enum {
275307 zcmp,
276308 zcmt,
277309 zdinx,
278 zexth_fusion,
279 zextw_fusion,
280310 zfa,
281311 zfbfmin,
282312 zfh,
......@@ -290,6 +320,7 @@ pub const Feature = enum {
290320 zicboz,
291321 ziccamoa,
292322 ziccamoc,
323 ziccid,
293324 ziccif,
294325 zicclsm,
295326 ziccrse,
......@@ -301,7 +332,7 @@ pub const Feature = enum {
301332 zihintpause,
302333 zihpm,
303334 zilsd,
304 zilsd_4byte_align,
335 zilsd_word_align,
305336 zimop,
306337 zk,
307338 zkn,
......@@ -382,31 +413,11 @@ pub const all_features = blk: {
382413 .zalrsc,
383414 }),
384415 };
385 result[@backingInt(Feature.add_load_fusion)] = .{
386 .llvm_name = "add-load-fusion",
387 .description = "Enable ADD(.UW) + load macrofusion",
388 .dependencies = featureSet(&[_]Feature{}),
389 };
390 result[@backingInt(Feature.addi_load_fusion)] = .{
391 .llvm_name = "addi-load-fusion",
392 .description = "Enable ADDI + load macrofusion",
393 .dependencies = featureSet(&[_]Feature{}),
394 };
395416 result[@backingInt(Feature.andes45)] = .{
396417 .llvm_name = "andes45",
397418 .description = "Andes 45-Series processors",
398419 .dependencies = featureSet(&[_]Feature{}),
399420 };
400 result[@backingInt(Feature.auipc_addi_fusion)] = .{
401 .llvm_name = "auipc-addi-fusion",
402 .description = "Enable AUIPC+ADDI macrofusion",
403 .dependencies = featureSet(&[_]Feature{}),
404 };
405 result[@backingInt(Feature.auipc_load_fusion)] = .{
406 .llvm_name = "auipc-load-fusion",
407 .description = "Enable AUIPC + load macrofusion",
408 .dependencies = featureSet(&[_]Feature{}),
409 };
410421 result[@backingInt(Feature.b)] = .{
411422 .llvm_name = "b",
412423 .description = "'B' (the collection of the Zba, Zbb, Zbs extensions)",
......@@ -416,11 +427,6 @@ pub const all_features = blk: {
416427 .zbs,
417428 }),
418429 };
419 result[@backingInt(Feature.bfext_fusion)] = .{
420 .llvm_name = "bfext-fusion",
421 .description = "Enable SLLI+SRLI (bitfield extract) macrofusion",
422 .dependencies = featureSet(&[_]Feature{}),
423 };
424430 result[@backingInt(Feature.c)] = .{
425431 .llvm_name = "c",
426432 .description = "'C' (Compressed Instructions)",
......@@ -475,6 +481,11 @@ pub const all_features = blk: {
475481 .description = "'E' (Embedded Instruction Set with 16 GPRs)",
476482 .dependencies = featureSet(&[_]Feature{}),
477483 };
484 result[@backingInt(Feature.enable_select_opt)] = .{
485 .llvm_name = "enable-select-opt",
486 .description = "Enable the select optimize pass for select loop heuristics",
487 .dependencies = featureSet(&[_]Feature{}),
488 };
478489 result[@backingInt(Feature.enable_vsetvli_sched_heuristic)] = .{
479490 .llvm_name = "enable-vsetvli-sched-heuristic",
480491 .description = "Enable vsetvli-based scheduling heuristic",
......@@ -493,7 +504,12 @@ pub const all_features = blk: {
493504 result[@backingInt(Feature.experimental_p)] = .{
494505 .llvm_name = "experimental-p",
495506 .description = "'P' ('Base P' (Packed SIMD))",
496 .dependencies = featureSet(&[_]Feature{}),
507 .dependencies = featureSet(&[_]Feature{
508 .zba,
509 .zbb,
510 .zicsr,
511 .zmmul,
512 }),
497513 };
498514 result[@backingInt(Feature.experimental_rvm23u32)] = .{
499515 .llvm_name = "experimental-rvm23u32",
......@@ -522,15 +538,13 @@ pub const all_features = blk: {
522538 .description = "'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)",
523539 .dependencies = featureSet(&[_]Feature{}),
524540 };
525 result[@backingInt(Feature.experimental_xrivosvisni)] = .{
526 .llvm_name = "experimental-xrivosvisni",
527 .description = "'XRivosVisni' (Rivos Vector Integer Small New)",
528 .dependencies = featureSet(&[_]Feature{}),
529 };
530 result[@backingInt(Feature.experimental_xrivosvizip)] = .{
531 .llvm_name = "experimental-xrivosvizip",
532 .description = "'XRivosVizip' (Rivos Vector Register Zips)",
533 .dependencies = featureSet(&[_]Feature{}),
541 result[@backingInt(Feature.experimental_xqccmt)] = .{
542 .llvm_name = "experimental-xqccmt",
543 .description = "'Xqccmt' (Qualcomm 16-bit Table Jump)",
544 .dependencies = featureSet(&[_]Feature{
545 .zca,
546 .zicsr,
547 }),
534548 };
535549 result[@backingInt(Feature.experimental_xsfmclic)] = .{
536550 .llvm_name = "experimental-xsfmclic",
......@@ -542,6 +556,11 @@ pub const all_features = blk: {
542556 .description = "'XSfsclic' (SiFive CLIC Supervisor-mode CSRs)",
543557 .dependencies = featureSet(&[_]Feature{}),
544558 };
559 result[@backingInt(Feature.experimental_y)] = .{
560 .llvm_name = "experimental-y",
561 .description = "'Y' ('Base Y' (CHERI))",
562 .dependencies = featureSet(&[_]Feature{}),
563 };
545564 result[@backingInt(Feature.experimental_zibi)] = .{
546565 .llvm_name = "experimental-zibi",
547566 .description = "'Zibi' (Branch with Immediate)",
......@@ -562,6 +581,11 @@ pub const all_features = blk: {
562581 .zimop,
563582 }),
564583 };
584 result[@backingInt(Feature.experimental_zvabd)] = .{
585 .llvm_name = "experimental-zvabd",
586 .description = "'Zvabd' (Vector Absolute Difference)",
587 .dependencies = featureSet(&[_]Feature{}),
588 };
565589 result[@backingInt(Feature.experimental_zvbc32e)] = .{
566590 .llvm_name = "experimental-zvbc32e",
567591 .description = "'Zvbc32e' (Vector Carryless Multiplication with 32-bits elements)",
......@@ -569,6 +593,20 @@ pub const all_features = blk: {
569593 .zve32x,
570594 }),
571595 };
596 result[@backingInt(Feature.experimental_zvdot4a8i)] = .{
597 .llvm_name = "experimental-zvdot4a8i",
598 .description = "'Zvdot4a8i' (Vector 4-element Dot Product of packed 8-bit Integers)",
599 .dependencies = featureSet(&[_]Feature{
600 .zve32x,
601 }),
602 };
603 result[@backingInt(Feature.experimental_zvfbdota32f)] = .{
604 .llvm_name = "experimental-zvfbdota32f",
605 .description = "'Zvfbdota32f' (FP32 batched dot-product extension)",
606 .dependencies = featureSet(&[_]Feature{
607 .zve32f,
608 }),
609 };
572610 result[@backingInt(Feature.experimental_zvfbfa)] = .{
573611 .llvm_name = "experimental-zvfbfa",
574612 .description = "'Zvfbfa' (Additional BF16 vector compute support)",
......@@ -584,6 +622,34 @@ pub const all_features = blk: {
584622 .zve32f,
585623 }),
586624 };
625 result[@backingInt(Feature.experimental_zvfqwbdota8f)] = .{
626 .llvm_name = "experimental-zvfqwbdota8f",
627 .description = "'Zvfqwbdota8f' (OCP FP8 batched dot-product extension)",
628 .dependencies = featureSet(&[_]Feature{
629 .zve32f,
630 }),
631 };
632 result[@backingInt(Feature.experimental_zvfqwdota8f)] = .{
633 .llvm_name = "experimental-zvfqwdota8f",
634 .description = "'Zvfqwdota8f' (OCP FP8 Dot-Product)",
635 .dependencies = featureSet(&[_]Feature{
636 .zve32f,
637 }),
638 };
639 result[@backingInt(Feature.experimental_zvfwbdota16bf)] = .{
640 .llvm_name = "experimental-zvfwbdota16bf",
641 .description = "'Zvfwbdota16bf' (BF16 batched dot-product extension)",
642 .dependencies = featureSet(&[_]Feature{
643 .zve32f,
644 }),
645 };
646 result[@backingInt(Feature.experimental_zvfwdota16bf)] = .{
647 .llvm_name = "experimental-zvfwdota16bf",
648 .description = "'Zvfwdota16bf' (BF16 Dot-Product)",
649 .dependencies = featureSet(&[_]Feature{
650 .zve32f,
651 }),
652 };
587653 result[@backingInt(Feature.experimental_zvkgs)] = .{
588654 .llvm_name = "experimental-zvkgs",
589655 .description = "'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)",
......@@ -591,9 +657,65 @@ pub const all_features = blk: {
591657 .zvkg,
592658 }),
593659 };
594 result[@backingInt(Feature.experimental_zvqdotq)] = .{
595 .llvm_name = "experimental-zvqdotq",
596 .description = "'Zvqdotq' (Vector quad widening 4D Dot Product)",
660 result[@backingInt(Feature.experimental_zvqwbdota16i)] = .{
661 .llvm_name = "experimental-zvqwbdota16i",
662 .description = "'Zvqwbdota16i' (16-bit integer batched dot-product extension)",
663 .dependencies = featureSet(&[_]Feature{
664 .zve64x,
665 }),
666 };
667 result[@backingInt(Feature.experimental_zvqwbdota8i)] = .{
668 .llvm_name = "experimental-zvqwbdota8i",
669 .description = "'Zvqwbdota8i' (8-bit integer batched dot-product extension)",
670 .dependencies = featureSet(&[_]Feature{
671 .zve32x,
672 }),
673 };
674 result[@backingInt(Feature.experimental_zvqwdota16i)] = .{
675 .llvm_name = "experimental-zvqwdota16i",
676 .description = "'Zvqwdota16i' (16-bit Integer Dot-Product)",
677 .dependencies = featureSet(&[_]Feature{
678 .zve64x,
679 }),
680 };
681 result[@backingInt(Feature.experimental_zvqwdota8i)] = .{
682 .llvm_name = "experimental-zvqwdota8i",
683 .description = "'Zvqwdota8i' (8-bit Integer Dot-Product)",
684 .dependencies = featureSet(&[_]Feature{
685 .zve32x,
686 }),
687 };
688 result[@backingInt(Feature.experimental_zvvfmm)] = .{
689 .llvm_name = "experimental-zvvfmm",
690 .description = "'Zvvfmm' (Floating-Point Matrix Multiply-Accumulate)",
691 .dependencies = featureSet(&[_]Feature{
692 .zve32f,
693 }),
694 };
695 result[@backingInt(Feature.experimental_zvvmm)] = .{
696 .llvm_name = "experimental-zvvmm",
697 .description = "'Zvvmm' (Integer Matrix Multiply-Accumulate)",
698 .dependencies = featureSet(&[_]Feature{
699 .zve32x,
700 }),
701 };
702 result[@backingInt(Feature.experimental_zvvmtls)] = .{
703 .llvm_name = "experimental-zvvmtls",
704 .description = "'Zvvmtls' (Matrix Tile Load/Store)",
705 .dependencies = featureSet(&[_]Feature{
706 .zve32x,
707 }),
708 };
709 result[@backingInt(Feature.experimental_zvvmttls)] = .{
710 .llvm_name = "experimental-zvvmttls",
711 .description = "'Zvvmttls' (Transposing Matrix Tile Load/Store)",
712 .dependencies = featureSet(&[_]Feature{
713 .zve32x,
714 }),
715 };
716 result[@backingInt(Feature.experimental_zvzip)] = .{
717 .llvm_name = "experimental-zvzip",
718 .description = "'Zvzip' (Vector Reordering Structured Data)",
597719 .dependencies = featureSet(&[_]Feature{
598720 .zve32x,
599721 }),
......@@ -610,36 +732,116 @@ pub const all_features = blk: {
610732 .description = "Assume that lock-free native-width atomics are available",
611733 .dependencies = featureSet(&[_]Feature{}),
612734 };
613 result[@backingInt(Feature.h)] = .{
614 .llvm_name = "h",
615 .description = "'H' (Hypervisor)",
735 result[@backingInt(Feature.fusion_add_load)] = .{
736 .llvm_name = "fusion-add-load",
737 .description = "Enable ADD(.UW) + load macrofusion",
616738 .dependencies = featureSet(&[_]Feature{}),
617739 };
618 result[@backingInt(Feature.i)] = .{
619 .llvm_name = "i",
620 .description = "'I' (Base Integer Instruction Set)",
740 result[@backingInt(Feature.fusion_add_mem)] = .{
741 .llvm_name = "fusion-add-mem",
742 .description = "Enable ADD+LOAD/STORE macrofusion",
743 .dependencies = featureSet(&[_]Feature{}),
744 };
745 result[@backingInt(Feature.fusion_addi_load)] = .{
746 .llvm_name = "fusion-addi-load",
747 .description = "Enable ADDI + load macrofusion",
748 .dependencies = featureSet(&[_]Feature{}),
749 };
750 result[@backingInt(Feature.fusion_auipc_addi)] = .{
751 .llvm_name = "fusion-auipc-addi",
752 .description = "Enable AUIPC+ADDI macrofusion",
753 .dependencies = featureSet(&[_]Feature{}),
754 };
755 result[@backingInt(Feature.fusion_auipc_load)] = .{
756 .llvm_name = "fusion-auipc-load",
757 .description = "Enable AUIPC + load macrofusion",
758 .dependencies = featureSet(&[_]Feature{}),
759 };
760 result[@backingInt(Feature.fusion_bfext)] = .{
761 .llvm_name = "fusion-bfext",
762 .description = "Enable SLLI+SRLI (bitfield extract) macrofusion",
621763 .dependencies = featureSet(&[_]Feature{}),
622764 };
623 result[@backingInt(Feature.ld_add_fusion)] = .{
624 .llvm_name = "ld-add-fusion",
765 result[@backingInt(Feature.fusion_ld_add)] = .{
766 .llvm_name = "fusion-ld-add",
625767 .description = "Enable LD+ADD macrofusion",
626768 .dependencies = featureSet(&[_]Feature{}),
627769 };
628 result[@backingInt(Feature.log_vrgather)] = .{
629 .llvm_name = "log-vrgather",
630 .description = "Has vrgather.vv with LMUL*log2(LMUL) latency",
770 result[@backingInt(Feature.fusion_logic_imm_reg)] = .{
771 .llvm_name = "fusion-logic-imm-reg",
772 .description = "Enable ANDI/ORI/XORI+AND/OR/XOR macrofusion",
773 .dependencies = featureSet(&[_]Feature{}),
774 };
775 result[@backingInt(Feature.fusion_logic_reg_imm)] = .{
776 .llvm_name = "fusion-logic-reg-imm",
777 .description = "Enable AND/OR/XOR+ANDI/ORI/XORI macrofusion",
778 .dependencies = featureSet(&[_]Feature{}),
779 };
780 result[@backingInt(Feature.fusion_logic_reg_reg)] = .{
781 .llvm_name = "fusion-logic-reg-reg",
782 .description = "Enable AND/OR/XOR+AND/OR/XOR macrofusion",
631783 .dependencies = featureSet(&[_]Feature{}),
632784 };
633 result[@backingInt(Feature.lui_addi_fusion)] = .{
634 .llvm_name = "lui-addi-fusion",
785 result[@backingInt(Feature.fusion_lui_addi)] = .{
786 .llvm_name = "fusion-lui-addi",
635787 .description = "Enable LUI+ADDI macro fusion",
636788 .dependencies = featureSet(&[_]Feature{}),
637789 };
638 result[@backingInt(Feature.lui_load_fusion)] = .{
639 .llvm_name = "lui-load-fusion",
790 result[@backingInt(Feature.fusion_lui_load)] = .{
791 .llvm_name = "fusion-lui-load",
640792 .description = "Enable LUI + load macrofusion",
641793 .dependencies = featureSet(&[_]Feature{}),
642794 };
795 result[@backingInt(Feature.fusion_mul_add)] = .{
796 .llvm_name = "fusion-mul-add",
797 .description = "Enable MUL+ADD macrofusion",
798 .dependencies = featureSet(&[_]Feature{}),
799 };
800 result[@backingInt(Feature.fusion_qc_e_li_load_store)] = .{
801 .llvm_name = "fusion-qc-e-li-load-store",
802 .description = "Enable QC.E.LI + Load/Store macrofusion",
803 .dependencies = featureSet(&[_]Feature{}),
804 };
805 result[@backingInt(Feature.fusion_shift_bit_extract)] = .{
806 .llvm_name = "fusion-shift-bit-extract",
807 .description = "Enable SLLI+SRLI/SRAI macrofusion",
808 .dependencies = featureSet(&[_]Feature{}),
809 };
810 result[@backingInt(Feature.fusion_shifted_zextw)] = .{
811 .llvm_name = "fusion-shifted-zextw",
812 .description = "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension",
813 .dependencies = featureSet(&[_]Feature{}),
814 };
815 result[@backingInt(Feature.fusion_shxadd_load)] = .{
816 .llvm_name = "fusion-shxadd-load",
817 .description = "Enable SH(1|2|3)ADD(.UW) + load macrofusion",
818 .dependencies = featureSet(&[_]Feature{}),
819 };
820 result[@backingInt(Feature.fusion_zexth)] = .{
821 .llvm_name = "fusion-zexth",
822 .description = "Enable SLLI+SRLI to be fused to zero extension of halfword",
823 .dependencies = featureSet(&[_]Feature{}),
824 };
825 result[@backingInt(Feature.fusion_zextw)] = .{
826 .llvm_name = "fusion-zextw",
827 .description = "Enable SLLI+SRLI to be fused to zero extension of word",
828 .dependencies = featureSet(&[_]Feature{}),
829 };
830 result[@backingInt(Feature.h)] = .{
831 .llvm_name = "h",
832 .description = "'H' (Hypervisor)",
833 .dependencies = featureSet(&[_]Feature{}),
834 };
835 result[@backingInt(Feature.i)] = .{
836 .llvm_name = "i",
837 .description = "'I' (Base Integer Instruction Set)",
838 .dependencies = featureSet(&[_]Feature{}),
839 };
840 result[@backingInt(Feature.log_vrgather)] = .{
841 .llvm_name = "log-vrgather",
842 .description = "Has vrgather.vv with LMUL*log2(LMUL) latency",
843 .dependencies = featureSet(&[_]Feature{}),
844 };
643845 result[@backingInt(Feature.m)] = .{
644846 .llvm_name = "m",
645847 .description = "'M' (Integer Multiplication and Division)",
......@@ -654,7 +856,7 @@ pub const all_features = blk: {
654856 };
655857 result[@backingInt(Feature.no_default_unroll)] = .{
656858 .llvm_name = "no-default-unroll",
657 .description = "Disable default unroll preference.",
859 .description = "Disable default unroll preference",
658860 .dependencies = featureSet(&[_]Feature{}),
659861 };
660862 result[@backingInt(Feature.no_sink_splat_operands)] = .{
......@@ -664,7 +866,7 @@ pub const all_features = blk: {
664866 };
665867 result[@backingInt(Feature.no_trailing_seq_cst_fence)] = .{
666868 .llvm_name = "no-trailing-seq-cst-fence",
667 .description = "Disable trailing fence for seq-cst store.",
869 .description = "Disable trailing fence for seq-cst store",
668870 .dependencies = featureSet(&[_]Feature{}),
669871 };
670872 result[@backingInt(Feature.optimized_nf2_segment_load_store)] = .{
......@@ -717,6 +919,11 @@ pub const all_features = blk: {
717919 .description = "Prefer likely predicted branches over selects",
718920 .dependencies = featureSet(&[_]Feature{}),
719921 };
922 result[@backingInt(Feature.prefer_ascending_load_store)] = .{
923 .llvm_name = "prefer-ascending-load-store",
924 .description = "Prefer ascending load/store order for better clustering and performance",
925 .dependencies = featureSet(&[_]Feature{}),
926 };
720927 result[@backingInt(Feature.prefer_vsetvli_over_read_vlenb)] = .{
721928 .llvm_name = "prefer-vsetvli-over-read-vlenb",
722929 .description = "Prefer vsetvli over read vlenb CSR to calculate VLEN",
......@@ -736,7 +943,7 @@ pub const all_features = blk: {
736943 };
737944 result[@backingInt(Feature.relax)] = .{
738945 .llvm_name = "relax",
739 .description = "Enable Linker relaxation.",
946 .description = "Enable Linker relaxation",
740947 .dependencies = featureSet(&[_]Feature{}),
741948 };
742949 result[@backingInt(Feature.reserve_x1)] = .{
......@@ -1187,7 +1394,7 @@ pub const all_features = blk: {
11871394 };
11881395 result[@backingInt(Feature.save_restore)] = .{
11891396 .llvm_name = "save-restore",
1190 .description = "Enable save/restore.",
1397 .description = "Enable save/restore",
11911398 .dependencies = featureSet(&[_]Feature{}),
11921399 };
11931400 result[@backingInt(Feature.sdext)] = .{
......@@ -1224,11 +1431,6 @@ pub const all_features = blk: {
12241431 .description = "'Shgatpa' (SvNNx4 mode supported for all modes supported by satp, as well as Bare)",
12251432 .dependencies = featureSet(&[_]Feature{}),
12261433 };
1227 result[@backingInt(Feature.shifted_zextw_fusion)] = .{
1228 .llvm_name = "shifted-zextw-fusion",
1229 .description = "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension",
1230 .dependencies = featureSet(&[_]Feature{}),
1231 };
12321434 result[@backingInt(Feature.shlcofideleg)] = .{
12331435 .llvm_name = "shlcofideleg",
12341436 .description = "'Shlcofideleg' (Delegating LCOFI Interrupts to VS-mode)",
......@@ -1253,6 +1455,13 @@ pub const all_features = blk: {
12531455 .short_forward_branch_ialu,
12541456 }),
12551457 };
1458 result[@backingInt(Feature.short_forward_branch_imm)] = .{
1459 .llvm_name = "short-forward-branch-imm",
1460 .description = "Enable short forward branch optimization for branches with immediates",
1461 .dependencies = featureSet(&[_]Feature{
1462 .short_forward_branch_ialu,
1463 }),
1464 };
12561465 result[@backingInt(Feature.short_forward_branch_imul)] = .{
12571466 .llvm_name = "short-forward-branch-imul",
12581467 .description = "Enable short forward branch optimization for MUL instruction",
......@@ -1280,11 +1489,6 @@ pub const all_features = blk: {
12801489 .description = "'Shvstvecd' (vstvec supports Direct mode)",
12811490 .dependencies = featureSet(&[_]Feature{}),
12821491 };
1283 result[@backingInt(Feature.shxadd_load_fusion)] = .{
1284 .llvm_name = "shxadd-load-fusion",
1285 .description = "Enable SH(1|2|3)ADD(.UW) + load macrofusion",
1286 .dependencies = featureSet(&[_]Feature{}),
1287 };
12881492 result[@backingInt(Feature.single_element_vec_fp64)] = .{
12891493 .llvm_name = "single-element-vec-fp64",
12901494 .description = "Certain vector FP64 operations produce a single result element per cycle",
......@@ -1473,6 +1677,11 @@ pub const all_features = blk: {
14731677 .description = "'Svpbmt' (Page-Based Memory Types)",
14741678 .dependencies = featureSet(&[_]Feature{}),
14751679 };
1680 result[@backingInt(Feature.svrsw60t59b)] = .{
1681 .llvm_name = "svrsw60t59b",
1682 .description = "'Svrsw60t59b' (PTE Reserved-for-Software Bits 60-59)",
1683 .dependencies = featureSet(&[_]Feature{}),
1684 };
14761685 result[@backingInt(Feature.svvptc)] = .{
14771686 .llvm_name = "svvptc",
14781687 .description = "'Svvptc' (Obviating Memory-Management Instructions after Marking PTEs Valid)",
......@@ -1521,6 +1730,13 @@ pub const all_features = blk: {
15211730 .description = "VXRM writes causes pipeline flush",
15221731 .dependencies = featureSet(&[_]Feature{}),
15231732 };
1733 result[@backingInt(Feature.xaifet)] = .{
1734 .llvm_name = "xaifet",
1735 .description = "'XAIFET' (AI Foundry ET Extension)",
1736 .dependencies = featureSet(&[_]Feature{
1737 .f,
1738 }),
1739 };
15241740 result[@backingInt(Feature.xandesbfhcvt)] = .{
15251741 .llvm_name = "xandesbfhcvt",
15261742 .description = "'XAndesBFHCvt' (Andes Scalar BFLOAT16 Conversion Extension)",
......@@ -1568,6 +1784,15 @@ pub const all_features = blk: {
15681784 .zve32x,
15691785 }),
15701786 };
1787 result[@backingInt(Feature.xcheriot)] = .{
1788 .llvm_name = "xcheriot",
1789 .description = "'XCheriot' (CHERIoT extension)",
1790 .dependencies = featureSet(&[_]Feature{
1791 .e,
1792 .m,
1793 .zca,
1794 }),
1795 };
15711796 result[@backingInt(Feature.xcvalu)] = .{
15721797 .llvm_name = "xcvalu",
15731798 .description = "'XCValu' (CORE-V ALU Operations)",
......@@ -1787,6 +2012,15 @@ pub const all_features = blk: {
17872012 .zvl64b,
17882013 }),
17892014 };
2015 result[@backingInt(Feature.xsfmm32a)] = .{
2016 .llvm_name = "xsfmm32a",
2017 .description = "'XSfmm32a' (TEW=32-bit accumulation operands - int: 8b; float: fp16, bf16, fp32)",
2018 .dependencies = featureSet(&[_]Feature{
2019 .xsfmm32a16f,
2020 .xsfmm32a32f,
2021 .xsfmm32a8i,
2022 }),
2023 };
17902024 result[@backingInt(Feature.xsfmm32a16f)] = .{
17912025 .llvm_name = "xsfmm32a16f",
17922026 .description = "'XSfmm32a16f' (TEW=32-bit accumulation, operands - float: 16b, widen=2 (IEEE, BF))",
......@@ -1938,6 +2172,13 @@ pub const all_features = blk: {
19382172 .zve32f,
19392173 }),
19402174 };
2175 result[@backingInt(Feature.xsmtvdotii)] = .{
2176 .llvm_name = "xsmtvdotii",
2177 .description = "'XSMTVDotII' (SpacemiT Vector Extension for Matrix 2.0)",
2178 .dependencies = featureSet(&[_]Feature{
2179 .zve32f,
2180 }),
2181 };
19412182 result[@backingInt(Feature.xtheadba)] = .{
19422183 .llvm_name = "xtheadba",
19432184 .description = "'XTHeadBa' (T-Head address calculation instructions)",
......@@ -2069,7 +2310,9 @@ pub const all_features = blk: {
20692310 result[@backingInt(Feature.zbc)] = .{
20702311 .llvm_name = "zbc",
20712312 .description = "'Zbc' (Carry-Less Multiplication)",
2072 .dependencies = featureSet(&[_]Feature{}),
2313 .dependencies = featureSet(&[_]Feature{
2314 .zbkc,
2315 }),
20732316 };
20742317 result[@backingInt(Feature.zbkb)] = .{
20752318 .llvm_name = "zbkb",
......@@ -2165,16 +2408,6 @@ pub const all_features = blk: {
21652408 .zfinx,
21662409 }),
21672410 };
2168 result[@backingInt(Feature.zexth_fusion)] = .{
2169 .llvm_name = "zexth-fusion",
2170 .description = "Enable SLLI+SRLI to be fused to zero extension of halfword",
2171 .dependencies = featureSet(&[_]Feature{}),
2172 };
2173 result[@backingInt(Feature.zextw_fusion)] = .{
2174 .llvm_name = "zextw-fusion",
2175 .description = "Enable SLLI+SRLI to be fused to zero extension of word",
2176 .dependencies = featureSet(&[_]Feature{}),
2177 };
21782411 result[@backingInt(Feature.zfa)] = .{
21792412 .llvm_name = "zfa",
21802413 .description = "'Zfa' (Additional Floating-Point)",
......@@ -2254,6 +2487,13 @@ pub const all_features = blk: {
22542487 .description = "'Ziccamoc' (Main Memory Supports Atomics in Zacas)",
22552488 .dependencies = featureSet(&[_]Feature{}),
22562489 };
2490 result[@backingInt(Feature.ziccid)] = .{
2491 .llvm_name = "ziccid",
2492 .description = "'Ziccid' (Instruction/Data Coherence and Consistency)",
2493 .dependencies = featureSet(&[_]Feature{
2494 .ziccif,
2495 }),
2496 };
22572497 result[@backingInt(Feature.ziccif)] = .{
22582498 .llvm_name = "ziccif",
22592499 .description = "'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)",
......@@ -2313,8 +2553,8 @@ pub const all_features = blk: {
23132553 .description = "'Zilsd' (Load/Store Pair Instructions)",
23142554 .dependencies = featureSet(&[_]Feature{}),
23152555 };
2316 result[@backingInt(Feature.zilsd_4byte_align)] = .{
2317 .llvm_name = "zilsd-4byte-align",
2556 result[@backingInt(Feature.zilsd_word_align)] = .{
2557 .llvm_name = "zilsd-word-align",
23182558 .description = "Allow 4-byte alignment for Zilsd LD/SD instructions",
23192559 .dependencies = featureSet(&[_]Feature{}),
23202560 };
......@@ -2543,6 +2783,7 @@ pub const all_features = blk: {
25432783 .description = "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))",
25442784 .dependencies = featureSet(&[_]Feature{
25452785 .zve64x,
2786 .zvknha,
25462787 }),
25472788 };
25482789 result[@backingInt(Feature.zvks)] = .{
......@@ -2681,6 +2922,16 @@ pub const all_features = blk: {
26812922};
26822923
26832924pub const cpu = struct {
2925 pub const an_erbium: CpuModel = .{
2926 .name = "an_erbium",
2927 .llvm_name = "an-erbium",
2928 .features = featureSet(&[_]Feature{
2929 .@"64bit",
2930 .c,
2931 .m,
2932 .xaifet,
2933 }),
2934 };
26842935 pub const andes_45_series: CpuModel = .{
26852936 .name = "andes_45_series",
26862937 .llvm_name = "andes-45-series",
......@@ -2833,6 +3084,16 @@ pub const cpu = struct {
28333084 .m,
28343085 }),
28353086 };
3087 pub const et_soc1: CpuModel = .{
3088 .name = "et_soc1",
3089 .llvm_name = "et-soc1",
3090 .features = featureSet(&[_]Feature{
3091 .@"64bit",
3092 .c,
3093 .m,
3094 .xaifet,
3095 }),
3096 };
28363097 pub const generic: CpuModel = .{
28373098 .name = "generic",
28383099 .llvm_name = "generic",
......@@ -2848,6 +3109,7 @@ pub const cpu = struct {
28483109 .llvm_name = "generic-rv32",
28493110 .features = featureSet(&[_]Feature{
28503111 .@"32bit",
3112 .enable_select_opt,
28513113 .i,
28523114 .optimized_nf2_segment_load_store,
28533115 }),
......@@ -2857,6 +3119,7 @@ pub const cpu = struct {
28573119 .llvm_name = "generic-rv64",
28583120 .features = featureSet(&[_]Feature{
28593121 .@"64bit",
3122 .enable_select_opt,
28603123 .i,
28613124 .optimized_nf2_segment_load_store,
28623125 }),
......@@ -3020,13 +3283,13 @@ pub const cpu = struct {
30203283 .features = featureSet(&[_]Feature{
30213284 .@"64bit",
30223285 .a,
3023 .auipc_addi_fusion,
30243286 .b,
30253287 .c,
30263288 .conditional_cmv_fusion,
30273289 .d,
3290 .fusion_auipc_addi,
3291 .fusion_lui_addi,
30283292 .i,
3029 .lui_addi_fusion,
30303293 .m,
30313294 .no_default_unroll,
30323295 .unaligned_scalar_mem,
......@@ -3055,12 +3318,12 @@ pub const cpu = struct {
30553318 .features = featureSet(&[_]Feature{
30563319 .@"64bit",
30573320 .a,
3058 .auipc_addi_fusion,
30593321 .b,
30603322 .c,
30613323 .conditional_cmv_fusion,
3324 .fusion_auipc_addi,
3325 .fusion_lui_addi,
30623326 .i,
3063 .lui_addi_fusion,
30643327 .m,
30653328 .no_default_unroll,
30663329 .no_sink_splat_operands,
......@@ -3099,12 +3362,13 @@ pub const cpu = struct {
30993362 .features = featureSet(&[_]Feature{
31003363 .@"64bit",
31013364 .a,
3102 .auipc_addi_fusion,
31033365 .c,
31043366 .conditional_cmv_fusion,
31053367 .d,
3368 .enable_select_opt,
3369 .fusion_auipc_addi,
3370 .fusion_lui_addi,
31063371 .i,
3107 .lui_addi_fusion,
31083372 .m,
31093373 .no_default_unroll,
31103374 .use_postra_scheduler,
......@@ -3119,12 +3383,12 @@ pub const cpu = struct {
31193383 .features = featureSet(&[_]Feature{
31203384 .@"64bit",
31213385 .a,
3122 .auipc_addi_fusion,
31233386 .b,
31243387 .c,
31253388 .conditional_cmv_fusion,
3389 .fusion_auipc_addi,
3390 .fusion_lui_addi,
31263391 .i,
3127 .lui_addi_fusion,
31283392 .m,
31293393 .no_default_unroll,
31303394 .no_sink_splat_operands,
......@@ -3155,18 +3419,18 @@ pub const cpu = struct {
31553419 .zvksg,
31563420 }),
31573421 };
3158 pub const sifive_p870: CpuModel = .{
3159 .name = "sifive_p870",
3160 .llvm_name = "sifive-p870",
3422 pub const sifive_p870_d: CpuModel = .{
3423 .name = "sifive_p870_d",
3424 .llvm_name = "sifive-p870-d",
31613425 .features = featureSet(&[_]Feature{
31623426 .@"64bit",
31633427 .a,
3164 .auipc_addi_fusion,
31653428 .b,
31663429 .c,
31673430 .conditional_cmv_fusion,
3431 .fusion_auipc_addi,
3432 .fusion_lui_addi,
31683433 .i,
3169 .lui_addi_fusion,
31703434 .m,
31713435 .no_default_unroll,
31723436 .no_sink_splat_operands,
......@@ -3294,6 +3558,103 @@ pub const cpu = struct {
32943558 .zifencei,
32953559 }),
32963560 };
3561 pub const sifive_x160: CpuModel = .{
3562 .name = "sifive_x160",
3563 .llvm_name = "sifive-x160",
3564 .features = featureSet(&[_]Feature{
3565 .@"32bit",
3566 .a,
3567 .b,
3568 .c,
3569 .dlen_factor_2,
3570 .experimental_zicfilp,
3571 .experimental_zvdot4a8i,
3572 .experimental_zvfbfa,
3573 .i,
3574 .m,
3575 .no_default_unroll,
3576 .optimized_nf2_segment_load_store,
3577 .optimized_zero_stride_load,
3578 .short_forward_branch_ialu,
3579 .use_postra_scheduler,
3580 .vl_dependent_latency,
3581 .xsfcease,
3582 .zawrs,
3583 .zce,
3584 .zcf,
3585 .zcmop,
3586 .zfa,
3587 .zfh,
3588 .zicbom,
3589 .zicbop,
3590 .zicboz,
3591 .zicond,
3592 .zifencei,
3593 .zihintntl,
3594 .zihintpause,
3595 .zihpm,
3596 .zimop,
3597 .zkt,
3598 .zvbb,
3599 .zvfbfwma,
3600 .zvfh,
3601 .zvkt,
3602 .zvl128b,
3603 }),
3604 };
3605 pub const sifive_x180: CpuModel = .{
3606 .name = "sifive_x180",
3607 .llvm_name = "sifive-x180",
3608 .features = featureSet(&[_]Feature{
3609 .@"64bit",
3610 .a,
3611 .b,
3612 .c,
3613 .dlen_factor_2,
3614 .experimental_zicfilp,
3615 .experimental_zvdot4a8i,
3616 .experimental_zvfbfa,
3617 .i,
3618 .m,
3619 .no_default_unroll,
3620 .optimized_nf2_segment_load_store,
3621 .optimized_zero_stride_load,
3622 .short_forward_branch_ialu,
3623 .use_postra_scheduler,
3624 .v,
3625 .vl_dependent_latency,
3626 .xsfcease,
3627 .xsfvfbfexp16e,
3628 .xsfvfexp16e,
3629 .xsfvfexp32e,
3630 .xsfvfexpa,
3631 .xsifivecflushdlone,
3632 .za64rs,
3633 .zawrs,
3634 .zcb,
3635 .zcd,
3636 .zcmop,
3637 .zfa,
3638 .zfh,
3639 .zic64b,
3640 .zicbom,
3641 .zicbop,
3642 .zicboz,
3643 .ziccamoa,
3644 .ziccif,
3645 .ziccrse,
3646 .zicond,
3647 .zifencei,
3648 .zihintntl,
3649 .zihintpause,
3650 .zihpm,
3651 .zimop,
3652 .zkt,
3653 .zvbb,
3654 .zvfbfwma,
3655 .zvkt,
3656 }),
3657 };
32973658 pub const sifive_x280: CpuModel = .{
32983659 .name = "sifive_x280",
32993660 .llvm_name = "sifive-x280",
......@@ -3372,7 +3733,7 @@ pub const cpu = struct {
33723733 };
33733734 pub const spacemit_a100: CpuModel = .{
33743735 .name = "spacemit_a100",
3375 .llvm_name = null,
3736 .llvm_name = "spacemit-a100",
33763737 .features = featureSet(&[_]Feature{
33773738 .@"64bit",
33783739 .a,
......@@ -3405,10 +3766,10 @@ pub const cpu = struct {
34053766 .unaligned_scalar_mem,
34063767 .v,
34073768 .vxrm_pipeline_flush,
3769 .xsmtvdotii,
34083770 .za64rs,
34093771 .zawrs,
34103772 .zbc,
3411 .zbkc,
34123773 .zcb,
34133774 .zcmop,
34143775 .zfa,
......@@ -3433,7 +3794,6 @@ pub const cpu = struct {
34333794 .zvfbfwma,
34343795 .zvfh,
34353796 .zvkng,
3436 .zvknha,
34373797 .zvksc,
34383798 .zvksg,
34393799 .zvl1024b,
......@@ -3441,27 +3801,75 @@ pub const cpu = struct {
34413801 };
34423802 pub const spacemit_x100: CpuModel = .{
34433803 .name = "spacemit_x100",
3444 .llvm_name = null,
3804 .llvm_name = "spacemit-x100",
34453805 .features = featureSet(&[_]Feature{
3806 .@"64bit",
3807 .a,
3808 .b,
3809 .c,
34463810 .dlen_factor_2,
3811 .fusion_add_mem,
3812 .fusion_logic_imm_reg,
3813 .fusion_logic_reg_imm,
3814 .fusion_logic_reg_reg,
3815 .fusion_mul_add,
3816 .fusion_shift_bit_extract,
3817 .i,
3818 .m,
3819 .no_default_unroll,
34473820 .optimized_nf2_segment_load_store,
34483821 .optimized_nf3_segment_load_store,
34493822 .optimized_nf4_segment_load_store,
3450 .rva23s64,
3823 .sha,
34513824 .smepmp,
34523825 .smnpm,
34533826 .smstateen,
3827 .ssccptr,
3828 .sscofpmf,
3829 .sscounterenw,
3830 .ssnpm,
34543831 .sspm,
3832 .sstc,
3833 .sstvala,
3834 .sstvecd,
3835 .ssu64xl,
3836 .supm,
3837 .svade,
3838 .svbare,
3839 .svinval,
3840 .svnapot,
3841 .svpbmt,
34553842 .unaligned_scalar_mem,
3843 .v,
34563844 .vxrm_pipeline_flush,
34573845 .xsmtvdot,
3846 .za64rs,
3847 .zawrs,
34583848 .zbc,
3459 .zbkc,
3849 .zcb,
3850 .zcmop,
3851 .zfa,
34603852 .zfh,
3853 .zic64b,
3854 .zicbom,
3855 .zicbop,
3856 .zicboz,
3857 .ziccamoa,
3858 .ziccif,
3859 .zicclsm,
3860 .ziccrse,
3861 .zicntr,
3862 .zicond,
3863 .zifencei,
3864 .zihintntl,
3865 .zihintpause,
3866 .zihpm,
3867 .zimop,
3868 .zkt,
3869 .zvbb,
34613870 .zvfbfwma,
34623871 .zvfh,
34633872 .zvkng,
3464 .zvknha,
34653873 .zvksc,
34663874 .zvksg,
34673875 .zvl256b,
......@@ -3476,11 +3884,13 @@ pub const cpu = struct {
34763884 .b,
34773885 .c,
34783886 .dlen_factor_2,
3887 .enable_select_opt,
34793888 .i,
34803889 .m,
34813890 .optimized_nf2_segment_load_store,
34823891 .optimized_nf3_segment_load_store,
34833892 .optimized_nf4_segment_load_store,
3893 .prefer_ascending_load_store,
34843894 .ssccptr,
34853895 .sscofpmf,
34863896 .sscounterenw,
......@@ -3498,7 +3908,6 @@ pub const cpu = struct {
34983908 .xsmtvdot,
34993909 .za64rs,
35003910 .zbc,
3501 .zbkc,
35023911 .zfh,
35033912 .zic64b,
35043913 .zicbom,
......@@ -3652,9 +4061,9 @@ pub const cpu = struct {
36524061 .zkn,
36534062 }),
36544063 };
3655 pub const tt_ascalon_d8: CpuModel = .{
3656 .name = "tt_ascalon_d8",
3657 .llvm_name = "tt-ascalon-d8",
4064 pub const tt_ascalon_x: CpuModel = .{
4065 .name = "tt_ascalon_x",
4066 .llvm_name = "tt-ascalon-x",
36584067 .features = featureSet(&[_]Feature{
36594068 .@"64bit",
36604069 .a,
......@@ -3674,6 +4083,10 @@ pub const cpu = struct {
36744083 .optimized_zero_stride_load,
36754084 .sha,
36764085 .smaia,
4086 .smmpm,
4087 .smnpm,
4088 .smrnmi,
4089 .smstateen,
36774090 .ssaia,
36784091 .ssccptr,
36794092 .sscofpmf,
......@@ -3715,6 +4128,7 @@ pub const cpu = struct {
37154128 .zihintpause,
37164129 .zihpm,
37174130 .zimop,
4131 .zkr,
37184132 .zkt,
37194133 .zvbb,
37204134 .zvbc,
......@@ -3730,27 +4144,27 @@ pub const cpu = struct {
37304144 .features = featureSet(&[_]Feature{
37314145 .@"64bit",
37324146 .a,
3733 .add_load_fusion,
3734 .auipc_addi_fusion,
3735 .auipc_load_fusion,
37364147 .c,
37374148 .d,
37384149 .disable_misched_load_clustering,
37394150 .disable_postmisched_load_clustering,
37404151 .disable_postmisched_store_clustering,
4152 .fusion_add_load,
4153 .fusion_auipc_addi,
4154 .fusion_auipc_load,
4155 .fusion_lui_addi,
4156 .fusion_lui_load,
4157 .fusion_shifted_zextw,
4158 .fusion_zexth,
4159 .fusion_zextw,
37414160 .i,
3742 .lui_addi_fusion,
3743 .lui_load_fusion,
37444161 .m,
3745 .shifted_zextw_fusion,
37464162 .ventana_veyron,
37474163 .xventanacondops,
37484164 .zba,
37494165 .zbb,
37504166 .zbc,
37514167 .zbs,
3752 .zexth_fusion,
3753 .zextw_fusion,
37544168 .zicbom,
37554169 .zicbop,
37564170 .zicboz,
......@@ -3768,11 +4182,13 @@ pub const cpu = struct {
37684182 .a,
37694183 .b,
37704184 .c,
4185 .fusion_shifted_zextw,
4186 .fusion_zexth,
4187 .fusion_zextw,
37714188 .i,
37724189 .m,
37734190 .no_default_unroll,
37744191 .sha,
3775 .shifted_zextw_fusion,
37764192 .smaia,
37774193 .smcsrind,
37784194 .smdbltrp,
......@@ -3806,8 +4222,6 @@ pub const cpu = struct {
38064222 .zbc,
38074223 .zcb,
38084224 .zcmop,
3809 .zexth_fusion,
3810 .zextw_fusion,
38114225 .zfa,
38124226 .zfh,
38134227 .zic64b,
......@@ -3841,17 +4255,17 @@ pub const cpu = struct {
38414255 .a,
38424256 .c,
38434257 .d,
4258 .fusion_shifted_zextw,
4259 .fusion_zexth,
4260 .fusion_zextw,
38444261 .i,
38454262 .m,
38464263 .no_default_unroll,
3847 .shifted_zextw_fusion,
38484264 .svinval,
38494265 .zba,
38504266 .zbb,
38514267 .zbc,
38524268 .zbs,
3853 .zexth_fusion,
3854 .zextw_fusion,
38554269 .zicbom,
38564270 .zicboz,
38574271 .zifencei,
......@@ -3860,4 +4274,129 @@ pub const cpu = struct {
38604274 .zksh,
38614275 }),
38624276 };
4277 pub const xt_c910v2: CpuModel = .{
4278 .name = "xt_c910v2",
4279 .llvm_name = "xt-c910v2",
4280 .features = featureSet(&[_]Feature{
4281 .@"64bit",
4282 .a,
4283 .b,
4284 .c,
4285 .i,
4286 .m,
4287 .ssccptr,
4288 .sscofpmf,
4289 .sscounterenw,
4290 .sstc,
4291 .sstvala,
4292 .sstvecd,
4293 .ssu64xl,
4294 .svade,
4295 .svbare,
4296 .svinval,
4297 .svnapot,
4298 .svpbmt,
4299 .unaligned_scalar_mem,
4300 .use_postra_scheduler,
4301 .vxrm_pipeline_flush,
4302 .xtheadba,
4303 .xtheadbb,
4304 .xtheadbs,
4305 .xtheadcmo,
4306 .xtheadcondmov,
4307 .xtheadfmemidx,
4308 .xtheadmac,
4309 .xtheadmemidx,
4310 .xtheadmempair,
4311 .xtheadsync,
4312 .za64rs,
4313 .zawrs,
4314 .zbc,
4315 .zcb,
4316 .zcd,
4317 .zcmop,
4318 .zfa,
4319 .zfbfmin,
4320 .zfh,
4321 .zic64b,
4322 .zicbom,
4323 .zicbop,
4324 .zicboz,
4325 .ziccamoa,
4326 .ziccif,
4327 .zicclsm,
4328 .ziccrse,
4329 .zicntr,
4330 .zicond,
4331 .zifencei,
4332 .zihintntl,
4333 .zihintpause,
4334 .zihpm,
4335 .zimop,
4336 .zkt,
4337 }),
4338 };
4339 pub const xt_c920v2: CpuModel = .{
4340 .name = "xt_c920v2",
4341 .llvm_name = "xt-c920v2",
4342 .features = featureSet(&[_]Feature{
4343 .@"64bit",
4344 .a,
4345 .b,
4346 .c,
4347 .i,
4348 .m,
4349 .ssccptr,
4350 .sscofpmf,
4351 .sscounterenw,
4352 .sstc,
4353 .sstvala,
4354 .sstvecd,
4355 .ssu64xl,
4356 .svade,
4357 .svbare,
4358 .svinval,
4359 .svnapot,
4360 .svpbmt,
4361 .unaligned_scalar_mem,
4362 .use_postra_scheduler,
4363 .vxrm_pipeline_flush,
4364 .xtheadba,
4365 .xtheadbb,
4366 .xtheadbs,
4367 .xtheadcmo,
4368 .xtheadcondmov,
4369 .xtheadfmemidx,
4370 .xtheadmac,
4371 .xtheadmemidx,
4372 .xtheadmempair,
4373 .xtheadsync,
4374 .xtheadvdot,
4375 .za64rs,
4376 .zawrs,
4377 .zbc,
4378 .zcb,
4379 .zcd,
4380 .zcmop,
4381 .zfa,
4382 .zfh,
4383 .zic64b,
4384 .zicbom,
4385 .zicbop,
4386 .zicboz,
4387 .ziccamoa,
4388 .ziccif,
4389 .ziccrse,
4390 .zicntr,
4391 .zicond,
4392 .zifencei,
4393 .zihintntl,
4394 .zihintpause,
4395 .zihpm,
4396 .zimop,
4397 .zkt,
4398 .zvfbfwma,
4399 .zvfh,
4400 }),
4401 };
38634402};
lib/std/Target/sparc.zig+1
......@@ -462,6 +462,7 @@ pub const cpu = struct {
462462 .name = "leon3",
463463 .llvm_name = "leon3",
464464 .features = featureSet(&[_]Feature{
465 .hasleoncasa,
465466 .hasumacsmac,
466467 .leon,
467468 }),
lib/std/Target/wasm.zig+13-4
......@@ -19,6 +19,7 @@ pub const Feature = enum {
1919 nontrapping_bulk_memory_len0,
2020 nontrapping_fptoint,
2121 reference_types,
22 relaxed_atomics,
2223 relaxed_simd,
2324 sign_ext,
2425 simd128,
......@@ -60,7 +61,10 @@ pub const all_features = blk: {
6061 result[@backingInt(Feature.exception_handling)] = .{
6162 .llvm_name = "exception-handling",
6263 .description = "Enable Wasm exception handling",
63 .dependencies = featureSet(&[_]Feature{}),
64 .dependencies = featureSet(&[_]Feature{
65 .multivalue,
66 .reference_types,
67 }),
6468 };
6569 result[@backingInt(Feature.extended_const)] = .{
6670 .llvm_name = "extended-const",
......@@ -75,7 +79,9 @@ pub const all_features = blk: {
7579 result[@backingInt(Feature.gc)] = .{
7680 .llvm_name = "gc",
7781 .description = "Enable wasm gc",
78 .dependencies = featureSet(&[_]Feature{}),
82 .dependencies = featureSet(&[_]Feature{
83 .reference_types,
84 }),
7985 };
8086 result[@backingInt(Feature.multimemory)] = .{
8187 .llvm_name = "multimemory",
......@@ -111,6 +117,11 @@ pub const all_features = blk: {
111117 .call_indirect_overlong,
112118 }),
113119 };
120 result[@backingInt(Feature.relaxed_atomics)] = .{
121 .llvm_name = "relaxed-atomics",
122 .description = "Enable relaxed-atomics proposal",
123 .dependencies = featureSet(&[_]Feature{}),
124 };
114125 result[@backingInt(Feature.relaxed_simd)] = .{
115126 .llvm_name = "relaxed-simd",
116127 .description = "Enable relaxed-simd instructions",
......@@ -156,10 +167,8 @@ pub const cpu = struct {
156167 .fp16,
157168 .gc,
158169 .multimemory,
159 .multivalue,
160170 .mutable_globals,
161171 .nontrapping_fptoint,
162 .reference_types,
163172 .relaxed_simd,
164173 .sign_ext,
165174 .simd128,
lib/std/Target/x86.zig+533-16
......@@ -20,7 +20,6 @@ pub const Feature = enum {
2020 amx_fp8,
2121 amx_int8,
2222 amx_movrs,
23 amx_tf32,
2423 amx_tile,
2524 avx,
2625 avx10_1,
......@@ -28,6 +27,7 @@ pub const Feature = enum {
2827 avx2,
2928 avx512bf16,
3029 avx512bitalg,
30 avx512bmm,
3131 avx512bw,
3232 avx512cd,
3333 avx512dq,
......@@ -67,13 +67,17 @@ pub const Feature = enum {
6767 enqcmd,
6868 ermsb,
6969 f16c,
70 false_deps_bls,
71 false_deps_compress,
72 false_deps_expand,
7073 false_deps_getmant,
71 false_deps_lzcnt_tzcnt,
74 false_deps_lzcnt,
7275 false_deps_mulc,
7376 false_deps_mullq,
7477 false_deps_perm,
7578 false_deps_popcnt,
7679 false_deps_range,
80 false_deps_tzcnt,
7781 fast_11bytenop,
7882 fast_15bytenop,
7983 fast_7bytenop,
......@@ -105,6 +109,7 @@ pub const Feature = enum {
105109 idivq_to_divl,
106110 inline_asm_use_gpr32,
107111 invpcid,
112 jmpabs,
108113 kl,
109114 lea_sp,
110115 lea_uses_ag,
......@@ -137,6 +142,7 @@ pub const Feature = enum {
137142 prefer_legacy_setcc,
138143 prefer_mask_registers,
139144 prefer_movmsk_over_vtest,
145 prefer_ndd_mem,
140146 prefer_no_gather,
141147 prefer_no_scatter,
142148 prefetchi,
......@@ -149,6 +155,31 @@ pub const Feature = enum {
149155 rdpru,
150156 rdrnd,
151157 rdseed,
158 reserve_edi,
159 reserve_r10,
160 reserve_r11,
161 reserve_r12,
162 reserve_r13,
163 reserve_r14,
164 reserve_r15,
165 reserve_r16,
166 reserve_r17,
167 reserve_r18,
168 reserve_r19,
169 reserve_r20,
170 reserve_r21,
171 reserve_r22,
172 reserve_r23,
173 reserve_r24,
174 reserve_r25,
175 reserve_r26,
176 reserve_r27,
177 reserve_r28,
178 reserve_r29,
179 reserve_r30,
180 reserve_r31,
181 reserve_r8,
182 reserve_r9,
152183 retpoline,
153184 retpoline_external_thunk,
154185 retpoline_indirect_branches,
......@@ -164,6 +195,7 @@ pub const Feature = enum {
164195 shstk,
165196 slow_3ops_lea,
166197 slow_incdec,
198 slow_indirect_call,
167199 slow_lea,
168200 slow_pmaddwd,
169201 slow_pmulld,
......@@ -313,13 +345,6 @@ pub const all_features = blk: {
313345 .amx_tile,
314346 }),
315347 };
316 result[@backingInt(Feature.amx_tf32)] = .{
317 .llvm_name = "amx-tf32",
318 .description = "Support AMX-TF32 instructions",
319 .dependencies = featureSet(&[_]Feature{
320 .amx_tile,
321 }),
322 };
323348 result[@backingInt(Feature.amx_tile)] = .{
324349 .llvm_name = "amx-tile",
325350 .description = "Support AMX-TILE instructions",
......@@ -377,6 +402,13 @@ pub const all_features = blk: {
377402 .avx512bw,
378403 }),
379404 };
405 result[@backingInt(Feature.avx512bmm)] = .{
406 .llvm_name = "avx512bmm",
407 .description = "Enable AVX512 Bit Matrix Multiply",
408 .dependencies = featureSet(&[_]Feature{
409 .avx512bw,
410 }),
411 };
380412 result[@backingInt(Feature.avx512bw)] = .{
381413 .llvm_name = "avx512bw",
382414 .description = "Enable AVX-512 Byte and Word Instructions",
......@@ -616,14 +648,29 @@ pub const all_features = blk: {
616648 .avx,
617649 }),
618650 };
651 result[@backingInt(Feature.false_deps_bls)] = .{
652 .llvm_name = "false-deps-bls",
653 .description = "BLSR/BLSI/BLSMSK have a false dependency on dest register",
654 .dependencies = featureSet(&[_]Feature{}),
655 };
656 result[@backingInt(Feature.false_deps_compress)] = .{
657 .llvm_name = "false-deps-compress",
658 .description = "V[P]COMPRESSPD/PS/Q/D/W/B with zero-masking has a false dependency on dest register",
659 .dependencies = featureSet(&[_]Feature{}),
660 };
661 result[@backingInt(Feature.false_deps_expand)] = .{
662 .llvm_name = "false-deps-expand",
663 .description = "V[P]EXPANDPD/PS/Q/D/W/B with zero-masking has a false dependency on dest register",
664 .dependencies = featureSet(&[_]Feature{}),
665 };
619666 result[@backingInt(Feature.false_deps_getmant)] = .{
620667 .llvm_name = "false-deps-getmant",
621668 .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register",
622669 .dependencies = featureSet(&[_]Feature{}),
623670 };
624 result[@backingInt(Feature.false_deps_lzcnt_tzcnt)] = .{
625 .llvm_name = "false-deps-lzcnt-tzcnt",
626 .description = "LZCNT/TZCNT have a false dependency on dest register",
671 result[@backingInt(Feature.false_deps_lzcnt)] = .{
672 .llvm_name = "false-deps-lzcnt",
673 .description = "LZCNT has a false dependency on dest register",
627674 .dependencies = featureSet(&[_]Feature{}),
628675 };
629676 result[@backingInt(Feature.false_deps_mulc)] = .{
......@@ -651,6 +698,11 @@ pub const all_features = blk: {
651698 .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register",
652699 .dependencies = featureSet(&[_]Feature{}),
653700 };
701 result[@backingInt(Feature.false_deps_tzcnt)] = .{
702 .llvm_name = "false-deps-tzcnt",
703 .description = "TZCNT has a false dependency on dest register",
704 .dependencies = featureSet(&[_]Feature{}),
705 };
654706 result[@backingInt(Feature.fast_11bytenop)] = .{
655707 .llvm_name = "fast-11bytenop",
656708 .description = "Target can quickly decode up to 11 byte NOPs",
......@@ -813,6 +865,11 @@ pub const all_features = blk: {
813865 .description = "Invalidate Process-Context Identifier",
814866 .dependencies = featureSet(&[_]Feature{}),
815867 };
868 result[@backingInt(Feature.jmpabs)] = .{
869 .llvm_name = "jmpabs",
870 .description = "Support 64-bit absolute JMP",
871 .dependencies = featureSet(&[_]Feature{}),
872 };
816873 result[@backingInt(Feature.kl)] = .{
817874 .llvm_name = "kl",
818875 .description = "Support Key Locker kl Instructions",
......@@ -977,6 +1034,11 @@ pub const all_features = blk: {
9771034 .description = "Prefer movmsk over vtest instruction",
9781035 .dependencies = featureSet(&[_]Feature{}),
9791036 };
1037 result[@backingInt(Feature.prefer_ndd_mem)] = .{
1038 .llvm_name = "prefer-ndd-mem",
1039 .description = "Prefer NDD memory addressing",
1040 .dependencies = featureSet(&[_]Feature{}),
1041 };
9801042 result[@backingInt(Feature.prefer_no_gather)] = .{
9811043 .llvm_name = "prefer-no-gather",
9821044 .description = "Prefer no gather instructions",
......@@ -1037,6 +1099,131 @@ pub const all_features = blk: {
10371099 .description = "Support RDSEED instruction",
10381100 .dependencies = featureSet(&[_]Feature{}),
10391101 };
1102 result[@backingInt(Feature.reserve_edi)] = .{
1103 .llvm_name = "reserve-edi",
1104 .description = "Reserve EDI, making it unavailable as a GPR",
1105 .dependencies = featureSet(&[_]Feature{}),
1106 };
1107 result[@backingInt(Feature.reserve_r10)] = .{
1108 .llvm_name = "reserve-r10",
1109 .description = "Reserve R10, making it unavailable as a GPR",
1110 .dependencies = featureSet(&[_]Feature{}),
1111 };
1112 result[@backingInt(Feature.reserve_r11)] = .{
1113 .llvm_name = "reserve-r11",
1114 .description = "Reserve R11, making it unavailable as a GPR",
1115 .dependencies = featureSet(&[_]Feature{}),
1116 };
1117 result[@backingInt(Feature.reserve_r12)] = .{
1118 .llvm_name = "reserve-r12",
1119 .description = "Reserve R12, making it unavailable as a GPR",
1120 .dependencies = featureSet(&[_]Feature{}),
1121 };
1122 result[@backingInt(Feature.reserve_r13)] = .{
1123 .llvm_name = "reserve-r13",
1124 .description = "Reserve R13, making it unavailable as a GPR",
1125 .dependencies = featureSet(&[_]Feature{}),
1126 };
1127 result[@backingInt(Feature.reserve_r14)] = .{
1128 .llvm_name = "reserve-r14",
1129 .description = "Reserve R14, making it unavailable as a GPR",
1130 .dependencies = featureSet(&[_]Feature{}),
1131 };
1132 result[@backingInt(Feature.reserve_r15)] = .{
1133 .llvm_name = "reserve-r15",
1134 .description = "Reserve R15, making it unavailable as a GPR",
1135 .dependencies = featureSet(&[_]Feature{}),
1136 };
1137 result[@backingInt(Feature.reserve_r16)] = .{
1138 .llvm_name = "reserve-r16",
1139 .description = "Reserve R16, making it unavailable as a GPR",
1140 .dependencies = featureSet(&[_]Feature{}),
1141 };
1142 result[@backingInt(Feature.reserve_r17)] = .{
1143 .llvm_name = "reserve-r17",
1144 .description = "Reserve R17, making it unavailable as a GPR",
1145 .dependencies = featureSet(&[_]Feature{}),
1146 };
1147 result[@backingInt(Feature.reserve_r18)] = .{
1148 .llvm_name = "reserve-r18",
1149 .description = "Reserve R18, making it unavailable as a GPR",
1150 .dependencies = featureSet(&[_]Feature{}),
1151 };
1152 result[@backingInt(Feature.reserve_r19)] = .{
1153 .llvm_name = "reserve-r19",
1154 .description = "Reserve R19, making it unavailable as a GPR",
1155 .dependencies = featureSet(&[_]Feature{}),
1156 };
1157 result[@backingInt(Feature.reserve_r20)] = .{
1158 .llvm_name = "reserve-r20",
1159 .description = "Reserve R20, making it unavailable as a GPR",
1160 .dependencies = featureSet(&[_]Feature{}),
1161 };
1162 result[@backingInt(Feature.reserve_r21)] = .{
1163 .llvm_name = "reserve-r21",
1164 .description = "Reserve R21, making it unavailable as a GPR",
1165 .dependencies = featureSet(&[_]Feature{}),
1166 };
1167 result[@backingInt(Feature.reserve_r22)] = .{
1168 .llvm_name = "reserve-r22",
1169 .description = "Reserve R22, making it unavailable as a GPR",
1170 .dependencies = featureSet(&[_]Feature{}),
1171 };
1172 result[@backingInt(Feature.reserve_r23)] = .{
1173 .llvm_name = "reserve-r23",
1174 .description = "Reserve R23, making it unavailable as a GPR",
1175 .dependencies = featureSet(&[_]Feature{}),
1176 };
1177 result[@backingInt(Feature.reserve_r24)] = .{
1178 .llvm_name = "reserve-r24",
1179 .description = "Reserve R24, making it unavailable as a GPR",
1180 .dependencies = featureSet(&[_]Feature{}),
1181 };
1182 result[@backingInt(Feature.reserve_r25)] = .{
1183 .llvm_name = "reserve-r25",
1184 .description = "Reserve R25, making it unavailable as a GPR",
1185 .dependencies = featureSet(&[_]Feature{}),
1186 };
1187 result[@backingInt(Feature.reserve_r26)] = .{
1188 .llvm_name = "reserve-r26",
1189 .description = "Reserve R26, making it unavailable as a GPR",
1190 .dependencies = featureSet(&[_]Feature{}),
1191 };
1192 result[@backingInt(Feature.reserve_r27)] = .{
1193 .llvm_name = "reserve-r27",
1194 .description = "Reserve R27, making it unavailable as a GPR",
1195 .dependencies = featureSet(&[_]Feature{}),
1196 };
1197 result[@backingInt(Feature.reserve_r28)] = .{
1198 .llvm_name = "reserve-r28",
1199 .description = "Reserve R28, making it unavailable as a GPR",
1200 .dependencies = featureSet(&[_]Feature{}),
1201 };
1202 result[@backingInt(Feature.reserve_r29)] = .{
1203 .llvm_name = "reserve-r29",
1204 .description = "Reserve R29, making it unavailable as a GPR",
1205 .dependencies = featureSet(&[_]Feature{}),
1206 };
1207 result[@backingInt(Feature.reserve_r30)] = .{
1208 .llvm_name = "reserve-r30",
1209 .description = "Reserve R30, making it unavailable as a GPR",
1210 .dependencies = featureSet(&[_]Feature{}),
1211 };
1212 result[@backingInt(Feature.reserve_r31)] = .{
1213 .llvm_name = "reserve-r31",
1214 .description = "Reserve R31, making it unavailable as a GPR",
1215 .dependencies = featureSet(&[_]Feature{}),
1216 };
1217 result[@backingInt(Feature.reserve_r8)] = .{
1218 .llvm_name = "reserve-r8",
1219 .description = "Reserve R8, making it unavailable as a GPR",
1220 .dependencies = featureSet(&[_]Feature{}),
1221 };
1222 result[@backingInt(Feature.reserve_r9)] = .{
1223 .llvm_name = "reserve-r9",
1224 .description = "Reserve R9, making it unavailable as a GPR",
1225 .dependencies = featureSet(&[_]Feature{}),
1226 };
10401227 result[@backingInt(Feature.retpoline)] = .{
10411228 .llvm_name = "retpoline",
10421229 .description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct",
......@@ -1123,6 +1310,11 @@ pub const all_features = blk: {
11231310 .description = "INC and DEC instructions are slower than ADD and SUB",
11241311 .dependencies = featureSet(&[_]Feature{}),
11251312 };
1313 result[@backingInt(Feature.slow_indirect_call)] = .{
1314 .llvm_name = "slow-indirect-call",
1315 .description = "Indirect calls from memory are slow",
1316 .dependencies = featureSet(&[_]Feature{}),
1317 };
11261318 result[@backingInt(Feature.slow_lea)] = .{
11271319 .llvm_name = "slow-lea",
11281320 .description = "LEA instruction with certain arguments is slow",
......@@ -2039,8 +2231,9 @@ pub const cpu = struct {
20392231 .cx16,
20402232 .ermsb,
20412233 .f16c,
2042 .false_deps_lzcnt_tzcnt,
2234 .false_deps_lzcnt,
20432235 .false_deps_popcnt,
2236 .false_deps_tzcnt,
20442237 .fast_15bytenop,
20452238 .fast_scalar_fsqrt,
20462239 .fast_shld_rotate,
......@@ -2159,6 +2352,239 @@ pub const cpu = struct {
21592352 .x87,
21602353 }),
21612354 };
2355 pub const c86_4g_m4: CpuModel = .{
2356 .name = "c86_4g_m4",
2357 .llvm_name = "c86-4g-m4",
2358 .features = featureSet(&[_]Feature{
2359 .@"64bit",
2360 .adx,
2361 .aes,
2362 .allow_light_256_bit,
2363 .avx2,
2364 .bmi,
2365 .bmi2,
2366 .clflushopt,
2367 .clzero,
2368 .cmov,
2369 .cx16,
2370 .f16c,
2371 .fast_15bytenop,
2372 .fast_bextr,
2373 .fast_imm16,
2374 .fast_lzcnt,
2375 .fast_movbe,
2376 .fast_scalar_fsqrt,
2377 .fast_scalar_shift_masks,
2378 .fast_variable_perlane_shuffle,
2379 .fast_vector_fsqrt,
2380 .fma,
2381 .fsgsbase,
2382 .fxsr,
2383 .idivq_to_divl,
2384 .lzcnt,
2385 .mmx,
2386 .movbe,
2387 .mwaitx,
2388 .nopl,
2389 .pclmul,
2390 .popcnt,
2391 .prfchw,
2392 .rdrnd,
2393 .rdseed,
2394 .sahf,
2395 .sbb_dep_breaking,
2396 .sha,
2397 .slow_shld,
2398 .sse4a,
2399 .vzeroupper,
2400 .x87,
2401 .xsavec,
2402 .xsaveopt,
2403 .xsaves,
2404 }),
2405 };
2406 pub const c86_4g_m6: CpuModel = .{
2407 .name = "c86_4g_m6",
2408 .llvm_name = "c86-4g-m6",
2409 .features = featureSet(&[_]Feature{
2410 .@"64bit",
2411 .adx,
2412 .aes,
2413 .allow_light_256_bit,
2414 .avx2,
2415 .bmi,
2416 .bmi2,
2417 .clflushopt,
2418 .clzero,
2419 .cmov,
2420 .cx16,
2421 .f16c,
2422 .fast_15bytenop,
2423 .fast_bextr,
2424 .fast_imm16,
2425 .fast_lzcnt,
2426 .fast_movbe,
2427 .fast_scalar_fsqrt,
2428 .fast_scalar_shift_masks,
2429 .fast_variable_perlane_shuffle,
2430 .fast_vector_fsqrt,
2431 .fma,
2432 .fsgsbase,
2433 .fxsr,
2434 .idivq_to_divl,
2435 .lzcnt,
2436 .mmx,
2437 .movbe,
2438 .mwaitx,
2439 .nopl,
2440 .pclmul,
2441 .popcnt,
2442 .prfchw,
2443 .rdrnd,
2444 .rdseed,
2445 .sahf,
2446 .sbb_dep_breaking,
2447 .sha,
2448 .slow_shld,
2449 .sse4a,
2450 .vzeroupper,
2451 .x87,
2452 .xsavec,
2453 .xsaveopt,
2454 .xsaves,
2455 }),
2456 };
2457 pub const c86_4g_m7: CpuModel = .{
2458 .name = "c86_4g_m7",
2459 .llvm_name = "c86-4g-m7",
2460 .features = featureSet(&[_]Feature{
2461 .@"64bit",
2462 .adx,
2463 .allow_light_256_bit,
2464 .avx512bf16,
2465 .avx512bitalg,
2466 .avx512cd,
2467 .avx512dq,
2468 .avx512ifma,
2469 .avx512vbmi,
2470 .avx512vbmi2,
2471 .avx512vl,
2472 .avx512vnni,
2473 .avx512vpopcntdq,
2474 .bmi,
2475 .bmi2,
2476 .branchfusion,
2477 .clflushopt,
2478 .clwb,
2479 .clzero,
2480 .cmov,
2481 .cx16,
2482 .fast_15bytenop,
2483 .fast_bextr,
2484 .fast_imm16,
2485 .fast_lzcnt,
2486 .fast_movbe,
2487 .fast_scalar_fsqrt,
2488 .fast_scalar_shift_masks,
2489 .fast_variable_perlane_shuffle,
2490 .fast_vector_fsqrt,
2491 .fsgsbase,
2492 .fxsr,
2493 .gfni,
2494 .idivq_to_divl,
2495 .lzcnt,
2496 .mmx,
2497 .movbe,
2498 .mwaitx,
2499 .nopl,
2500 .popcnt,
2501 .prefer_256_bit,
2502 .prefer_no_gather,
2503 .prefer_no_scatter,
2504 .prfchw,
2505 .rdrnd,
2506 .rdseed,
2507 .sahf,
2508 .sbb_dep_breaking,
2509 .sha,
2510 .slow_shld,
2511 .sse4a,
2512 .vaes,
2513 .vpclmulqdq,
2514 .vzeroupper,
2515 .wbnoinvd,
2516 .x87,
2517 .xsavec,
2518 .xsaveopt,
2519 .xsaves,
2520 }),
2521 };
2522 pub const c86_4g_m8: CpuModel = .{
2523 .name = "c86_4g_m8",
2524 .llvm_name = "c86-4g-m8",
2525 .features = featureSet(&[_]Feature{
2526 .@"64bit",
2527 .adx,
2528 .allow_light_256_bit,
2529 .avx512bf16,
2530 .avx512bitalg,
2531 .avx512cd,
2532 .avx512dq,
2533 .avx512ifma,
2534 .avx512vbmi,
2535 .avx512vbmi2,
2536 .avx512vl,
2537 .avx512vnni,
2538 .avx512vpopcntdq,
2539 .bmi,
2540 .bmi2,
2541 .branchfusion,
2542 .clflushopt,
2543 .clwb,
2544 .clzero,
2545 .cmov,
2546 .cx16,
2547 .fast_15bytenop,
2548 .fast_bextr,
2549 .fast_imm16,
2550 .fast_lzcnt,
2551 .fast_movbe,
2552 .fast_scalar_fsqrt,
2553 .fast_scalar_shift_masks,
2554 .fast_variable_perlane_shuffle,
2555 .fast_vector_fsqrt,
2556 .fsgsbase,
2557 .fxsr,
2558 .gfni,
2559 .idivq_to_divl,
2560 .lzcnt,
2561 .mmx,
2562 .movbe,
2563 .mwaitx,
2564 .nopl,
2565 .popcnt,
2566 .prefer_256_bit,
2567 .prefer_no_gather,
2568 .prefer_no_scatter,
2569 .prfchw,
2570 .rdrnd,
2571 .rdseed,
2572 .sahf,
2573 .sbb_dep_breaking,
2574 .sha,
2575 .shstk,
2576 .slow_shld,
2577 .sse4a,
2578 .vaes,
2579 .vpclmulqdq,
2580 .vzeroupper,
2581 .wbnoinvd,
2582 .x87,
2583 .xsavec,
2584 .xsaveopt,
2585 .xsaves,
2586 }),
2587 };
21622588 pub const cannonlake: CpuModel = .{
21632589 .name = "cannonlake",
21642590 .llvm_name = "cannonlake",
......@@ -2467,7 +2893,6 @@ pub const cpu = struct {
24672893 .amx_fp8,
24682894 .amx_int8,
24692895 .amx_movrs,
2470 .amx_tf32,
24712896 .avx10_2,
24722897 .avxifma,
24732898 .avxneconvert,
......@@ -2505,6 +2930,7 @@ pub const cpu = struct {
25052930 .gfni,
25062931 .idivq_to_divl,
25072932 .invpcid,
2933 .jmpabs,
25082934 .lzcnt,
25092935 .macrofusion,
25102936 .mmx,
......@@ -2523,6 +2949,7 @@ pub const cpu = struct {
25232949 .popcnt,
25242950 .ppx,
25252951 .prefer_256_bit,
2952 .prefer_legacy_setcc,
25262953 .prefetchi,
25272954 .prfchw,
25282955 .ptwrite,
......@@ -3056,8 +3483,9 @@ pub const cpu = struct {
30563483 .cx16,
30573484 .ermsb,
30583485 .f16c,
3059 .false_deps_lzcnt_tzcnt,
3486 .false_deps_lzcnt,
30603487 .false_deps_popcnt,
3488 .false_deps_tzcnt,
30613489 .fast_15bytenop,
30623490 .fast_scalar_fsqrt,
30633491 .fast_shld_rotate,
......@@ -3679,6 +4107,7 @@ pub const cpu = struct {
36794107 .hreset,
36804108 .idivq_to_divl,
36814109 .invpcid,
4110 .jmpabs,
36824111 .lzcnt,
36834112 .macrofusion,
36844113 .mmx,
......@@ -3696,6 +4125,7 @@ pub const cpu = struct {
36964125 .pku,
36974126 .popcnt,
36984127 .ppx,
4128 .prefer_legacy_setcc,
36994129 .prefer_movmsk_over_vtest,
37004130 .prefetchi,
37014131 .prfchw,
......@@ -4813,8 +5243,9 @@ pub const cpu = struct {
48135243 .cmov,
48145244 .cx16,
48155245 .f16c,
4816 .false_deps_lzcnt_tzcnt,
5246 .false_deps_lzcnt,
48175247 .false_deps_popcnt,
5248 .false_deps_tzcnt,
48185249 .fast_15bytenop,
48195250 .fast_scalar_fsqrt,
48205251 .fast_shld_rotate,
......@@ -5086,6 +5517,8 @@ pub const cpu = struct {
50865517 .clzero,
50875518 .cmov,
50885519 .cx16,
5520 .false_deps_compress,
5521 .false_deps_expand,
50895522 .fast_15bytenop,
50905523 .fast_bextr,
50915524 .fast_dpwssd,
......@@ -5159,6 +5592,10 @@ pub const cpu = struct {
51595592 .clzero,
51605593 .cmov,
51615594 .cx16,
5595 .false_deps_bls,
5596 .false_deps_compress,
5597 .false_deps_expand,
5598 .false_deps_tzcnt,
51625599 .fast_15bytenop,
51635600 .fast_bextr,
51645601 .fast_dpwssd,
......@@ -5195,6 +5632,7 @@ pub const cpu = struct {
51955632 .sbb_dep_breaking,
51965633 .sha,
51975634 .shstk,
5635 .slow_indirect_call,
51985636 .smap,
51995637 .smep,
52005638 .sse4a,
......@@ -5208,4 +5646,83 @@ pub const cpu = struct {
52085646 .xsaves,
52095647 }),
52105648 };
5649 pub const znver6: CpuModel = .{
5650 .name = "znver6",
5651 .llvm_name = "znver6",
5652 .features = featureSet(&[_]Feature{
5653 .@"64bit",
5654 .adx,
5655 .allow_light_256_bit,
5656 .avx512bf16,
5657 .avx512bitalg,
5658 .avx512bmm,
5659 .avx512cd,
5660 .avx512dq,
5661 .avx512fp16,
5662 .avx512ifma,
5663 .avx512vbmi,
5664 .avx512vbmi2,
5665 .avx512vl,
5666 .avx512vnni,
5667 .avx512vp2intersect,
5668 .avx512vpopcntdq,
5669 .avxifma,
5670 .avxneconvert,
5671 .avxvnni,
5672 .avxvnniint8,
5673 .bmi,
5674 .bmi2,
5675 .branchfusion,
5676 .clflushopt,
5677 .clwb,
5678 .clzero,
5679 .cmov,
5680 .cx16,
5681 .fast_15bytenop,
5682 .fast_bextr,
5683 .fast_dpwssd,
5684 .fast_imm16,
5685 .fast_lzcnt,
5686 .fast_movbe,
5687 .fast_scalar_fsqrt,
5688 .fast_scalar_shift_masks,
5689 .fast_variable_perlane_shuffle,
5690 .fast_vector_fsqrt,
5691 .fsgsbase,
5692 .fsrm,
5693 .fxsr,
5694 .gfni,
5695 .idivq_to_divl,
5696 .invpcid,
5697 .lzcnt,
5698 .macrofusion,
5699 .mmx,
5700 .movbe,
5701 .movdir64b,
5702 .movdiri,
5703 .mwaitx,
5704 .nopl,
5705 .pku,
5706 .popcnt,
5707 .prefetchi,
5708 .prfchw,
5709 .rdpid,
5710 .rdpru,
5711 .rdrnd,
5712 .rdseed,
5713 .sahf,
5714 .sbb_dep_breaking,
5715 .sha,
5716 .shstk,
5717 .sse4a,
5718 .vaes,
5719 .vpclmulqdq,
5720 .vzeroupper,
5721 .wbnoinvd,
5722 .x87,
5723 .xsavec,
5724 .xsaveopt,
5725 .xsaves,
5726 }),
5727 };
52115728};
lib/std/Target/xtensa.zig+35
......@@ -13,6 +13,7 @@ pub const Feature = enum {
1313 density,
1414 dfpaccel,
1515 div32,
16 esp32s2ops,
1617 exception,
1718 extendedl32r,
1819 forced_atomics,
......@@ -93,6 +94,11 @@ pub const all_features = blk: {
9394 .description = "Enable Xtensa Div32 option",
9495 .dependencies = featureSet(&[_]Feature{}),
9596 };
97 result[@backingInt(Feature.esp32s2ops)] = .{
98 .llvm_name = "esp32s2ops",
99 .description = "Support Xtensa esp32-s2 ISA extension",
100 .dependencies = featureSet(&[_]Feature{}),
101 };
96102 result[@backingInt(Feature.exception)] = .{
97103 .llvm_name = "exception",
98104 .description = "Enable Xtensa Exception option",
......@@ -291,6 +297,35 @@ pub const cpu = struct {
291297 .windowed,
292298 }),
293299 };
300 pub const esp32s2: CpuModel = .{
301 .name = "esp32s2",
302 .llvm_name = "esp32s2",
303 .features = featureSet(&[_]Feature{
304 .clamps,
305 .coprocessor,
306 .dcache,
307 .debug,
308 .density,
309 .div32,
310 .esp32s2ops,
311 .exception,
312 .highpriinterrupts_level7,
313 .interrupt,
314 .minmax,
315 .miscsr,
316 .mul16,
317 .mul32,
318 .mul32high,
319 .nsa,
320 .prid,
321 .regprotect,
322 .rvector,
323 .sext,
324 .threadptr,
325 .timers3,
326 .windowed,
327 }),
328 };
294329 pub const esp8266: CpuModel = .{
295330 .name = "esp8266",
296331 .llvm_name = "esp8266",
lib/std/c.zig+2
......@@ -11389,6 +11389,8 @@ pub extern "c" fn div(a: c_int, b: c_int) div_t;
1138911389pub extern "c" fn ldiv(a: c_long, b: c_long) ldiv_t;
1139011390pub extern "c" fn lldiv(a: c_longlong, b: c_longlong) lldiv_t;
1139111391
11392pub extern "c" fn wcslen(s: [*:0]const wchar_t) usize;
11393
1139211394pub extern "c" fn atoi(str: [*:0]const c_char) c_int;
1139311395pub extern "c" fn atol(str: [*:0]const c_char) c_long;
1139411396pub extern "c" fn atoll(str: [*:0]const c_char) c_longlong;
lib/std/crypto/ecdsa.zig+3
......@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
12const std = @import("std");
23const crypto = std.crypto;
34const fmt = std.fmt;
......@@ -439,6 +440,8 @@ test "Basic operations over EcdsaP384Sha384" {
439440}
440441
441442test "Basic operations over Secp256k1" {
443 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
444
442445 const io = testing.io;
443446 const Scheme = EcdsaSecp256k1Sha256oSha256;
444447 const kp = Scheme.KeyPair.generate(io);
lib/std/crypto/ml_dsa.zig+6
......@@ -2497,6 +2497,8 @@ test "polyPackT1 / polyUnpackT1 roundtrip" {
24972497}
24982498
24992499test "polyPackT0 / polyUnpackT0 roundtrip" {
2500 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/229620
2501
25002502 // Create a test polynomial with coefficients in (Q-2^12, Q+2^12]
25012503 // This is the range (-2^12, 2^12] represented as unsigned around Q
25022504 const bound = 1 << 12; // 2^(D-1) where D=13
......@@ -2846,6 +2848,8 @@ fn testKeyGenerationBasic(comptime MlDsa: type, seed: [32]u8) !void {
28462848}
28472849
28482850test "Key generation basic - all variants" {
2851 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/229620
2852
28492853 inline for (.{
28502854 .{ .variant = MLDSA44, .seed_byte = 0x44 },
28512855 .{ .variant = MLDSA65, .seed_byte = 0x65 },
......@@ -2857,6 +2861,8 @@ test "Key generation basic - all variants" {
28572861}
28582862
28592863test "Key generation determinism" {
2864 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/229620
2865
28602866 const seed = [_]u8{ 0x12, 0x34, 0x56, 0x78 } ++ @as([28]u8, @splat(0xAB));
28612867
28622868 // Generate two key pairs from the same seed
lib/std/crypto/pcurves/tests/secp256k1.zig+19
......@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
12const std = @import("std");
23const fmt = std.fmt;
34const testing = std.testing;
......@@ -7,6 +8,8 @@ const Secp256k1 = @import("../secp256k1.zig").Secp256k1;
78const lambda: u256 = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72;
89
910test "secp256k1 ECDH key exchange" {
11 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
12
1013 const io = testing.io;
1114 const dha = Secp256k1.scalar.random(io, .little);
1215 const dhb = Secp256k1.scalar.random(io, .little);
......@@ -18,6 +21,8 @@ test "secp256k1 ECDH key exchange" {
1821}
1922
2023test "secp256k1 ECDH key exchange including public multiplication" {
24 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
25
2126 const io = testing.io;
2227 const dha = Secp256k1.scalar.random(io, .little);
2328 const dhb = Secp256k1.scalar.random(io, .little);
......@@ -29,6 +34,8 @@ test "secp256k1 ECDH key exchange including public multiplication" {
2934}
3035
3136test "secp256k1 point from affine coordinates" {
37 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
38
3239 const xh = "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798";
3340 const yh = "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8";
3441 var xs: [32]u8 = undefined;
......@@ -40,6 +47,8 @@ test "secp256k1 point from affine coordinates" {
4047}
4148
4249test "secp256k1 test vectors" {
50 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
51
4352 const expected = [_][]const u8{
4453 "0000000000000000000000000000000000000000000000000000000000000000",
4554 "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
......@@ -81,6 +90,8 @@ test "secp256k1 test vectors - doubling" {
8190}
8291
8392test "secp256k1 compressed sec1 encoding/decoding" {
93 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
94
8495 const io = testing.io;
8596 const p = Secp256k1.random(io);
8697 const s = p.toCompressedSec1();
......@@ -89,6 +100,8 @@ test "secp256k1 compressed sec1 encoding/decoding" {
89100}
90101
91102test "secp256k1 uncompressed sec1 encoding/decoding" {
103 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
104
92105 const io = testing.io;
93106 const p = Secp256k1.random(io);
94107 const s = p.toUncompressedSec1();
......@@ -104,6 +117,8 @@ test "secp256k1 public key is the neutral element" {
104117}
105118
106119test "secp256k1 public key is the neutral element (public verification)" {
120 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
121
107122 const io = testing.io;
108123 const n = Secp256k1.scalar.Scalar.zero.toBytes(.little);
109124 const p = Secp256k1.random(io);
......@@ -131,6 +146,8 @@ test "secp256k1 uncompressed SEC1 must not accept infinity" {
131146}
132147
133148test "secp256k1 double base multiplication" {
149 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
150
134151 const p1 = Secp256k1.basePoint;
135152 const p2 = Secp256k1.basePoint.dbl();
136153 const s1: [32]u8 = @splat(0x01);
......@@ -141,6 +158,8 @@ test "secp256k1 double base multiplication" {
141158}
142159
143160test "secp256k1 public multiplication" {
161 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
162
144163 const io = testing.io;
145164 const n = Secp256k1.scalar.field_order;
146165 const p = Secp256k1.random(io);
lib/std/debug.zig-3
......@@ -271,9 +271,6 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
271271 .bpfeb,
272272 => false,
273273
274 // https://codeberg.org/ziglang/zig/issues/31127
275 .avr => false,
276
277274 else => true,
278275};
279276
lib/std/debug/Dwarf.zig-1
......@@ -1597,7 +1597,6 @@ pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 {
15971597/// library has a working implementation of unwinding for the current target.
15981598pub fn supportsUnwinding(target: *const std.Target) bool {
15991599 return switch (target.cpu.arch) {
1600 .amdgcn,
16011600 .nvptx,
16021601 .nvptx64,
16031602 .spirv32,
lib/std/lang.zig+2-4
......@@ -322,9 +322,11 @@ pub const CallingConvention = union(enum(u8)) {
322322
323323 /// The standard `loongarch64` calling convention.
324324 loongarch64_lp64: CommonOptions,
325 loongarch64_preserve_none: CommonOptions,
325326
326327 /// The standard `loongarch32` calling convention.
327328 loongarch32_ilp32: CommonOptions,
329 loongarch32_preserve_none: CommonOptions,
328330
329331 // Calling conventions for the `m68k` architecture.
330332 m68k_sysv: CommonOptions,
......@@ -615,10 +617,6 @@ pub const AddressSpace = enum(u5) {
615617
616618 /// This address space only addresses the "lookup" ram
617619 lut,
618
619 // Web Assembly
620 externref,
621 funcref,
622620};
623621
624622/// This data structure is used by the Zig language code generation and
lib/std/pdb.zig+1
......@@ -310,6 +310,7 @@ pub const SymbolKind = enum(u16) {
310310 gmandata = 4381,
311311 lthread32 = 4370,
312312 gthread32 = 4371,
313 _,
313314};
314315
315316pub const TypeIndex = u32;
lib/std/zig/llvm/Builder.zig+26-8
......@@ -508,7 +508,7 @@ pub const DataLayout = struct {
508508 "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128",
509509 .sparc => "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64",
510510 .sparc64 => "E-m:e-i64:64-i128:128-n32:64-S128",
511 .s390x => "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
511 .s390x => "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
512512 .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {
513513 .gnu => if (target.ofmt == .coff)
514514 "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32"
......@@ -2840,7 +2840,6 @@ pub const AddrSpace = enum(u24) {
28402840 pub const gs: AddrSpace = @fromBackingInt(256);
28412841 pub const fs: AddrSpace = @fromBackingInt(257);
28422842 pub const ss: AddrSpace = @fromBackingInt(258);
2843
28442843 pub const ptr32_sptr: AddrSpace = @fromBackingInt(270);
28452844 pub const ptr32_uptr: AddrSpace = @fromBackingInt(271);
28462845 pub const ptr64: AddrSpace = @fromBackingInt(272);
......@@ -2858,17 +2857,19 @@ pub const AddrSpace = enum(u24) {
28582857 pub const program5: AddrSpace = @fromBackingInt(6);
28592858 };
28602859
2861 // See llvm/lib/Target/NVPTX/NVPTX.h
2860 // See llvm/include/llvm/Support/NVPTXAddrSpace.h
28622861 pub const nvptx = struct {
28632862 pub const generic: AddrSpace = @fromBackingInt(0);
28642863 pub const global: AddrSpace = @fromBackingInt(1);
2865 pub const constant: AddrSpace = @fromBackingInt(2);
28662864 pub const shared: AddrSpace = @fromBackingInt(3);
2867 pub const param: AddrSpace = @fromBackingInt(4);
2865 pub const constant: AddrSpace = @fromBackingInt(4);
28682866 pub const local: AddrSpace = @fromBackingInt(5);
2867 pub const tensor: AddrSpace = @fromBackingInt(6);
2868 pub const shared_cluster: AddrSpace = @fromBackingInt(7);
2869 pub const entry_param: AddrSpace = @fromBackingInt(101);
28692870 };
28702871
2871 // See llvm/lib/Target/AMDGPU/AMDGPU.h
2872 // See llvm/include/llvm/Support/AMDGPUAddrSpace.h
28722873 pub const amdgpu = struct {
28732874 pub const flat: AddrSpace = @fromBackingInt(0);
28742875 pub const global: AddrSpace = @fromBackingInt(1);
......@@ -2901,6 +2902,7 @@ pub const AddrSpace = enum(u24) {
29012902 pub const streamout_register: AddrSpace = @fromBackingInt(128);
29022903 };
29032904
2905 // See llvm/lib/Target/SPIRV/SPIRVUtils.h
29042906 pub const spirv = struct {
29052907 pub const function: AddrSpace = @fromBackingInt(0);
29062908 pub const cross_workgroup: AddrSpace = @fromBackingInt(1);
......@@ -2910,14 +2912,30 @@ pub const AddrSpace = enum(u24) {
29102912 pub const device_only_intel: AddrSpace = @fromBackingInt(5);
29112913 pub const host_only_intel: AddrSpace = @fromBackingInt(6);
29122914 pub const input: AddrSpace = @fromBackingInt(7);
2915 pub const output: AddrSpace = @fromBackingInt(8);
2916 pub const code_section_intel: AddrSpace = @fromBackingInt(9);
2917 pub const private: AddrSpace = @fromBackingInt(10);
2918 pub const storage_buffer: AddrSpace = @fromBackingInt(11);
2919 pub const uniform: AddrSpace = @fromBackingInt(12);
2920 pub const push_constant: AddrSpace = @fromBackingInt(13);
29132921 };
29142922
29152923 // See llvm/include/llvm/CodeGen/WasmAddressSpaces.h
29162924 pub const wasm = struct {
29172925 pub const default: AddrSpace = @fromBackingInt(0);
29182926 pub const variable: AddrSpace = @fromBackingInt(1);
2919 pub const externref: AddrSpace = @fromBackingInt(10);
2920 pub const funcref: AddrSpace = @fromBackingInt(20);
2927 };
2928
2929 // See llvm/lib/TargetParser/TargetDataLayout.cpp
2930 pub const riscv = struct {
2931 pub const purecap: AddrSpace = @fromBackingInt(200);
2932 };
2933
2934 // See llvm/lib/Target/AArch64/AArch64ISelLowering.h
2935 pub const aarch64 = struct {
2936 pub const ptr32_sptr: AddrSpace = @fromBackingInt(270);
2937 pub const ptr32_uptr: AddrSpace = @fromBackingInt(271);
2938 pub const ptr64: AddrSpace = @fromBackingInt(272);
29212939 };
29222940
29232941 pub fn format(addr_space: AddrSpace, w: *Writer) Writer.Error!void {
lib/std/zig/system/arm.zig+2
......@@ -121,11 +121,13 @@ pub const cpu_models = struct {
121121 // implementer = 0x48
122122 const HiSilicon = [_]E{
123123 E{ .part = 0xd01, .m64 = &A64.tsv110 },
124 E{ .part = 0xd06, .m64 = &A64.hip12 },
124125 };
125126 // implementer = 0x4e
126127 const Nvidia = [_]E{
127128 E{ .part = 0x004, .m64 = &A64.carmel },
128129 E{ .part = 0x010, .m64 = &A64.olympus },
130 E{ .part = 0x011, .m64 = &A64.rigel },
129131 };
130132 // implementer = 0x50
131133 const Ampere = [_]E{
lib/std/zig/system/freebsd.zig+3-3
......@@ -80,11 +80,11 @@ const arm = struct {
8080const powerpc = struct {
8181 const models = .{
8282 .{ "Freescale e500v1 core", &std.Target.powerpc.cpu.e500 },
83 .{ "Freescale e500v2 core", &std.Target.powerpc.cpu.e500 }, // TODO: This should have efpu2.
83 .{ "Freescale e500v2 core", &std.Target.powerpc.cpu.e500v2 },
8484 .{ "Freescale e500mc core", &std.Target.powerpc.cpu.e500mc },
8585 .{ "Freescale e5500 core", &std.Target.powerpc.cpu.e5500 },
86 .{ "Freescale e6500 core", &std.Target.powerpc.cpu.e5500 }, // TODO: This should have altivec.
87 .{ "IBM Cell Broadband Engine", &std.Target.powerpc.cpu.ppc64 },
86 .{ "Freescale e6500 core", &std.Target.powerpc.cpu.e6500 },
87 .{ "IBM Cell Broadband Engine", &std.Target.powerpc.cpu.cell },
8888 .{ "IBM PowerPC 750FX", &std.Target.powerpc.cpu.@"750" },
8989 .{ "IBM PowerPC 970", &std.Target.powerpc.cpu.@"970" },
9090 .{ "IBM PowerPC 970FX", &std.Target.powerpc.cpu.@"970" },
lib/std/zig/system/linux.zig+3-3
......@@ -442,16 +442,16 @@ const powerpc = struct {
442442 .{ "750GX", &Target.powerpc.cpu.@"750" },
443443 .{ "82xx", &Target.powerpc.cpu.@"603e" },
444444 .{ "APM821XX", &Target.powerpc.cpu.@"440" },
445 .{ "Cell", &Target.powerpc.cpu.ppc64 }, // TODO: Change with LLVM 23.
445 .{ "Cell", &Target.powerpc.cpu.cell },
446446 .{ "e300c1", &Target.powerpc.cpu.@"603e" },
447447 .{ "e300c2", &Target.powerpc.cpu.@"603e" },
448448 .{ "e300c3", &Target.powerpc.cpu.@"603e" },
449449 .{ "e300c4", &Target.powerpc.cpu.@"603e" },
450450 .{ "e500mc", &Target.powerpc.cpu.e500mc },
451 .{ "e500v2", &Target.powerpc.cpu.e500 }, // TODO: Change with LLVM 23.
451 .{ "e500v2", &Target.powerpc.cpu.e500v2 },
452452 .{ "e500", &Target.powerpc.cpu.e500 },
453453 .{ "e5500", &Target.powerpc.cpu.e5500 },
454 .{ "e6500", &Target.powerpc.cpu.e5500 }, // TODO: Change with LLVM 23.
454 .{ "e6500", &Target.powerpc.cpu.e6500 },
455455 .{ "G2_LE", &Target.powerpc.cpu.@"603e" },
456456 .{ "HX-C2000", &Target.powerpc.cpu.pwr8 },
457457 .{ "POWER5+", &Target.powerpc.cpu.pwr5x },
lib/std/zig/system/openbsd.zig+4-5
......@@ -38,11 +38,10 @@ const aarch64 = struct {
3838 .{ "Apple Avalanche Pro", &std.Target.aarch64.cpu.apple_m2 },
3939 .{ "Apple Avalanche", &std.Target.aarch64.cpu.apple_m2 },
4040 .{ "Applied Micro X-Gene", &std.Target.aarch64.cpu.xgene1 },
41 // TODO: Add these with LLVM 23.
42 // .{ "ARM C1-Nano", &std.Target.aarch64.cpu.c1_nano },
43 // .{ "ARM C1-Pro", &std.Target.aarch64.cpu.c1_pro },
44 // .{ "ARM C1-Ultra", &std.Target.aarch64.cpu.c1_ultra },
45 // .{ "ARM C1-Premium", &std.Target.aarch64.cpu.c1_premium },
41 .{ "ARM C1-Nano", &std.Target.aarch64.cpu.c1_nano },
42 .{ "ARM C1-Pro", &std.Target.aarch64.cpu.c1_pro },
43 .{ "ARM C1-Ultra", &std.Target.aarch64.cpu.c1_ultra },
44 .{ "ARM C1-Premium", &std.Target.aarch64.cpu.c1_premium },
4645 .{ "ARM Cortex-A320", &std.Target.aarch64.cpu.cortex_a320 },
4746 .{ "ARM Cortex-A34", &std.Target.aarch64.cpu.cortex_a34 },
4847 .{ "ARM Cortex-A35", &std.Target.aarch64.cpu.cortex_a35 },
lib/std/zig/system/x86.zig+23-1
......@@ -74,6 +74,7 @@ pub fn detectNativeCpuAndFeatures(arch: Target.Cpu.Arch) Target.Cpu {
7474 if (switch (vendor) {
7575 0x756e6547 => detectIntelProcessor(&cpu, family, model, brand_id),
7676 0x68747541 => detectAmdProcessor(&cpu, family, model),
77 0x6f677948 => detectHygonProcessor(family, model),
7778 else => null,
7879 }) |m| b: {
7980 // Some hypervisors are evil liars and will operate in long mode while identifying as a
......@@ -209,7 +210,23 @@ fn detectAmdProcessor(cpu: *const Target.Cpu, family: u32, model: u32) ?*const T
209210 0x10...0x1f, 0x60...0x6f, 0x70...0x7f, 0xa0...0xaf => &Target.x86.cpu.znver4,
210211 else => &Target.x86.cpu.znver3,
211212 },
212 26 => &Target.x86.cpu.znver5,
213 26 => switch (model) {
214 0x50...0x5f, 0x80...0xcf, 0xd8...0xe7 => &Target.x86.cpu.znver6,
215 else => &Target.x86.cpu.znver5,
216 },
217 else => null,
218 };
219}
220
221fn detectHygonProcessor(family: u32, model: u32) ?*const Target.Cpu.Model {
222 return switch (family) {
223 24 => switch (model) {
224 4 => &Target.x86.cpu.c86_4g_m4,
225 6 => &Target.x86.cpu.c86_4g_m6,
226 7 => &Target.x86.cpu.c86_4g_m7,
227 8 => &Target.x86.cpu.c86_4g_m8,
228 else => null,
229 },
213230 else => null,
214231 };
215232}
......@@ -340,9 +357,11 @@ fn detectNativeFeatures(cpu: *Target.Cpu) void {
340357
341358 // AMD uses a different bit for prefetchi.
342359 setFeature(cpu, .prefetchi, bit(leaf.eax, 20));
360 setFeature(cpu, .avx512bmm, bit(leaf.eax, 23) and has_avx512_save);
343361 } else {
344362 for ([_]Target.x86.Feature{
345363 .prefetchi,
364 .avx512bmm,
346365 }) |feat| {
347366 setFeature(cpu, feat, false);
348367 }
......@@ -445,6 +464,7 @@ fn detectNativeFeatures(cpu: *Target.Cpu) void {
445464 setFeature(cpu, .nf, bit(leaf.edx, 21) and has_apx_save);
446465 setFeature(cpu, .cf, bit(leaf.edx, 21) and has_apx_save);
447466 setFeature(cpu, .zu, bit(leaf.edx, 21) and has_apx_save);
467 setFeature(cpu, .jmpabs, bit(leaf.edx, 21) and has_apx_save);
448468
449469 break :has_avx10 bit(leaf.edx, 19);
450470 } else {
......@@ -474,6 +494,7 @@ fn detectNativeFeatures(cpu: *Target.Cpu) void {
474494 .nf,
475495 .cf,
476496 .zu,
497 .jmpabs,
477498 }) |feat| {
478499 setFeature(cpu, feat, false);
479500 }
......@@ -559,6 +580,7 @@ fn detectNativeFeatures(cpu: *Target.Cpu) void {
559580 .nf,
560581 .cf,
561582 .zu,
583 .jmpabs,
562584 }) |feat| {
563585 setFeature(cpu, feat, false);
564586 }
lib/zig.h-25
......@@ -5880,27 +5880,12 @@ typedef __float128 zig_f128;
58805880#define zig_make_special_f128(sign, name, arg, repr) sign __builtin_##name##f128(arg)
58815881#else
58825882#undef zig_has_f128
5883#if defined(zig_x86_64) && defined(ZIG_TARGET_ABI_MSVC)
5884#if defined(zig_msvc) && !defined(__clang__)
5885#include <emmintrin.h>
5886typedef __m128i zig_f128;
5887#define zig_init_repr_f128(hi, lo) { .m128i_u64 = { lo, hi } }
5888#define zig_lo_repr_f128(arg) (arg).m128i_u64[0]
5889#define zig_hi_repr_f128(arg) (arg).m128i_u64[1]
5890#else
5891typedef __attribute__((__vector_size__(2 * sizeof(uint64_t)))) uint64_t zig_f128;
5892#define zig_init_repr_f128(hi, lo) { lo, hi }
5893#define zig_lo_repr_f128(arg) (arg)[0]
5894#define zig_hi_repr_f128(arg) (arg)[1]
5895#endif
5896#else
58975883typedef zig_u128 zig_f128;
58985884#define zig_init_repr_f128(hi, lo) zig_init_u128(hi, lo)
58995885#define zig_make_repr_f128(hi, lo) zig_make_u128(hi, lo)
59005886#define zig_lo_repr_f128(arg) zig_lo_u128(arg)
59015887#define zig_hi_repr_f128(arg) zig_hi_u128(arg)
59025888#endif
5903#endif
59045889#ifndef zig_has_f128
59055890#define zig_has_f128 0
59065891#define zig_make_f128(fp, repr) repr
......@@ -6188,16 +6173,6 @@ static inline zig_f128 zig_floatuntitf(zig_u128 arg) {
61886173 extern zig_f128 __floatuntitf(zig_f128 arg);
61896174 return __floatuntitf(zig_f128_bitCast_u128(arg));
61906175}
6191#elif defined(zig_x86_64) && defined(zig_windows)
6192zig_common_float_builtins(128)
6193static inline zig_f128 zig_floattitf(zig_i128 arg) {
6194 extern zig_f128 __floattitf(zig_i128 arg);
6195 return __floattitf(arg);
6196}
6197static inline zig_f128 zig_floatuntitf(zig_u128 arg) {
6198 extern zig_f128 __floatuntitf(uint64_t arg_lo, uint64_t arg_hi);
6199 return __floatuntitf(zig_lo_u128(arg), zig_hi_u128(arg));
6200}
62016176#else
62026177zig_float_builtins(128)
62036178#endif
src/Compilation.zig-2
......@@ -6358,8 +6358,6 @@ fn addCommonCCArgs(
63586358 // LLVM doesn't distinguish between Solaris and illumos, but the illumos GCC fork
63596359 // defines this macro.
63606360 .illumos => try argv.append("-D__illumos__"),
6361 // This macro has not yet been upstreamed by SerenityOS to Clang.
6362 .serenity => try argv.append("-D__serenity__"),
63636361 // Homebrew targets without LLVM support; use communities's preferred macros.
63646362 .@"3ds" => try argv.append("-D__3DS__"),
63656363 .wiiu => try argv.append("-D__WIIU__"),
src/Zcu.zig+2
......@@ -4711,6 +4711,8 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.lang.CallingConvention) union(enum)
47114711 .avr_interrupt,
47124712 .avr_signal,
47134713 .ez80_tiflags,
4714 .loongarch32_preserve_none,
4715 .loongarch64_preserve_none,
47144716 .naked,
47154717 => true, // incoming stack alignment supported
47164718
src/clang_options.zon+246-19
......@@ -218,11 +218,16 @@
218218 .psl = true,
219219},
220220.{ .name = "d1PP", .psl = true },
221.{ .name = "d1nodatetime", .psl = true },
222.{ .name = "d1nodatetime-", .psl = true },
221223.{ .name = "d1reportAllClassLayout", .psl = true },
222224.{ .name = "d2FastFail", .psl = true },
223225.{ .name = "d2Zi+", .psl = true },
224226.{ .name = "d2epilogunwind", .psl = true },
225227.{ .name = "d2epilogunwindrequirev2", .psl = true },
228.{ .name = "d2guardcfgdispatch", .psl = true },
229.{ .name = "d2guardcfgdispatch-", .psl = true },
230.{ .name = "d2guardnochecks", .psl = true },
226231.{ .name = "diagnostics:caret", .psl = true },
227232.{ .name = "diagnostics:classic", .psl = true },
228233.{ .name = "diagnostics:column", .psl = true },
......@@ -343,6 +348,12 @@
343348 .pd1 = false,
344349 .pd2 = true,
345350},
351.{
352 .name = "cstdlib",
353 .syntax = .separate,
354 .pd1 = false,
355 .pd2 = true,
356},
346357.{
347358 .name = "debug",
348359 .ze = .debug,
......@@ -523,6 +534,11 @@
523534 .pd1 = false,
524535 .pd2 = true,
525536},
537.{
538 .name = "precompile-reduced-bmi",
539 .pd1 = false,
540 .pd2 = true,
541},
526542.{
527543 .name = "prefix",
528544 .syntax = .separate,
......@@ -586,6 +602,21 @@
586602 .pd1 = false,
587603 .pd2 = true,
588604},
605.{
606 .name = "ssaf-include-local-entities",
607 .pd1 = false,
608 .pd2 = true,
609},
610.{
611 .name = "ssaf-list-extractors",
612 .pd1 = false,
613 .pd2 = true,
614},
615.{
616 .name = "ssaf-list-formats",
617 .pd1 = false,
618 .pd2 = true,
619},
589620.{
590621 .name = "std",
591622 .syntax = .separate,
......@@ -845,6 +876,8 @@
845876.{ .name = "cl-unsafe-math-optimizations" },
846877.{ .name = "clangir-disable-passes" },
847878.{ .name = "clangir-disable-verifier" },
879.{ .name = "clangir-enable-idiom-recognizer" },
880.{ .name = "clangir-lib-opt" },
848881.{ .name = "clear-ast-before-backend" },
849882.{ .name = "code-completion-at", .syntax = .separate },
850883.{ .name = "code-completion-brief-comments" },
......@@ -938,11 +971,15 @@
938971.{ .name = "dwarf-debug-producer", .syntax = .separate },
939972.{ .name = "dwarf-explicit-import" },
940973.{ .name = "dwarf-ext-refs" },
974.{ .name = "Zsb", .psl = true },
975.{ .name = "Zss", .psl = true },
941976.{ .name = "all-resources-bound", .psl = true },
942977.{ .name = "Zpc", .psl = true },
943978.{ .name = "Vd", .psl = true },
944979.{ .name = "Gis", .psl = true },
980.{ .name = "fdx-no-source-metadata" },
945981.{ .name = "hlsl-no-stdinc", .psl = true },
982.{ .name = "fdx-record-command-line", .syntax = .separate },
946983.{ .name = "rootsig-define", .syntax = .separate },
947984.{
948985 .name = "force-rootsig-ver",
......@@ -1107,6 +1144,9 @@
11071144.{ .name = "fcomplete-member-pointers" },
11081145.{ .name = "fconst-strings" },
11091146.{ .name = "fconstant-cfstrings" },
1147.{ .name = "fconstant-nsarray-literals" },
1148.{ .name = "fconstant-nsdictionary-literals" },
1149.{ .name = "fconstant-nsnumber-literals" },
11101150.{ .name = "fconstant-string-class", .syntax = .separate },
11111151.{ .name = "fconvergent-functions" },
11121152.{ .name = "fcoro-aligned-allocation" },
......@@ -1146,6 +1186,8 @@
11461186.{ .name = "fdebug-pass-structure" },
11471187.{ .name = "fdebug-pre-fir-tree" },
11481188.{ .name = "fdebug-ranges-base-address" },
1189.{ .name = "fdebug-record-sysroot" },
1190.{ .name = "fdebug-run-lifetime-safety" },
11491191.{ .name = "fdebug-types-section" },
11501192.{ .name = "fdebug-unparse" },
11511193.{ .name = "fdebug-unparse-no-sema" },
......@@ -1176,6 +1218,7 @@
11761218.{ .name = "fdiagnostics-print-source-range-info" },
11771219.{ .name = "fdiagnostics-show-category", .syntax = .separate },
11781220.{ .name = "fdiagnostics-show-hotness" },
1221.{ .name = "fdiagnostics-show-inlining-chain" },
11791222.{ .name = "fdiagnostics-show-line-numbers" },
11801223.{ .name = "fdiagnostics-show-note-include-stack" },
11811224.{ .name = "fdiagnostics-show-option" },
......@@ -1214,17 +1257,27 @@
12141257.{ .name = "femit-compact-unwind-non-canonical" },
12151258.{ .name = "femulated-tls" },
12161259.{ .name = "fenable-matrix" },
1260.{ .name = "fenable-new-pm-codegen" },
12171261.{ .name = "fencode-extended-block-signature" },
1262.{ .name = "fenumeration-type" },
12181263.{ .name = "ferror-limit", .syntax = .separate },
12191264.{ .name = "fescaping-block-tail-calls" },
12201265.{ .name = "fexceptions" },
1266.{ .name = "fexec-charset", .syntax = .separate },
1267.{ .name = "fexperimental-abi-lowering" },
1268.{ .name = "fexperimental-allow-pointer-field-protection-attr" },
12211269.{ .name = "fexperimental-call-graph-section" },
12221270.{ .name = "fexperimental-isel" },
12231271.{ .name = "fexperimental-late-parse-attributes" },
12241272.{ .name = "fexperimental-library" },
1273.{ .name = "fexperimental-lifetime-safety-c" },
1274.{ .name = "fexperimental-logical-pointer" },
12251275.{ .name = "fexperimental-loop-fusion" },
12261276.{ .name = "fexperimental-new-constant-interpreter" },
12271277.{ .name = "fexperimental-omit-vtable-rtti" },
1278.{ .name = "fexperimental-overflow-behavior-types" },
1279.{ .name = "fexperimental-pointer-field-protection-abi" },
1280.{ .name = "fexperimental-pointer-field-protection-tagged" },
12281281.{ .name = "fexperimental-relative-c++-abi-vtables" },
12291282.{ .name = "fexperimental-sanitize-metadata=atomics" },
12301283.{ .name = "fexperimental-sanitize-metadata=covered" },
......@@ -1259,6 +1312,7 @@
12591312.{ .name = "ffixed-d5" },
12601313.{ .name = "ffixed-d6" },
12611314.{ .name = "ffixed-d7" },
1315.{ .name = "ffixed-edi" },
12621316.{ .name = "ffixed-form" },
12631317.{ .name = "ffixed-g1" },
12641318.{ .name = "ffixed-g2" },
......@@ -1288,7 +1342,31 @@
12881342.{ .name = "ffixed-o4" },
12891343.{ .name = "ffixed-o5" },
12901344.{ .name = "ffixed-point" },
1345.{ .name = "ffixed-r10" },
1346.{ .name = "ffixed-r11" },
1347.{ .name = "ffixed-r12" },
1348.{ .name = "ffixed-r13" },
1349.{ .name = "ffixed-r14" },
1350.{ .name = "ffixed-r15" },
1351.{ .name = "ffixed-r16" },
1352.{ .name = "ffixed-r17" },
1353.{ .name = "ffixed-r18" },
12911354.{ .name = "ffixed-r19" },
1355.{ .name = "ffixed-r20" },
1356.{ .name = "ffixed-r21" },
1357.{ .name = "ffixed-r22" },
1358.{ .name = "ffixed-r23" },
1359.{ .name = "ffixed-r24" },
1360.{ .name = "ffixed-r25" },
1361.{ .name = "ffixed-r26" },
1362.{ .name = "ffixed-r27" },
1363.{ .name = "ffixed-r28" },
1364.{ .name = "ffixed-r29" },
1365.{ .name = "ffixed-r30" },
1366.{ .name = "ffixed-r31" },
1367.{ .name = "ffixed-r6" },
1368.{ .name = "ffixed-r7" },
1369.{ .name = "ffixed-r8" },
12921370.{ .name = "ffixed-r9" },
12931371.{ .name = "ffixed-x1" },
12941372.{ .name = "ffixed-x10" },
......@@ -1362,6 +1440,7 @@
13621440.{ .name = "fhip-kernel-arg-name" },
13631441.{ .name = "fhip-new-launch-api" },
13641442.{ .name = "fspv-enable-maximal-reconvergence" },
1443.{ .name = "fspv-preserve-interface" },
13651444.{ .name = "fspv-use-unknown-image-format" },
13661445.{ .name = "fhlsl-strict-availability" },
13671446.{ .name = "fhonor-infinities" },
......@@ -1405,13 +1484,12 @@
14051484.{ .name = "fkeep-persistent-storage-variables" },
14061485.{ .name = "fkeep-static-consts" },
14071486.{ .name = "fkeep-system-includes" },
1408.{ .name = "flang-deprecated-no-hlfir" },
1409.{ .name = "flang-experimental-hlfir" },
14101487.{ .name = "flarge-sizes" },
14111488.{ .name = "flat_namespace" },
14121489.{ .name = "flax-vector-conversions" },
1413.{ .name = "fexperimental-lifetime-safety" },
1414.{ .name = "fexperimental-lifetime-safety-inference" },
1490.{ .name = "flifetime-dse" },
1491.{ .name = "flifetime-safety-inference" },
1492.{ .name = "fexperimental-lifetime-safety-tu-analysis" },
14151493.{ .name = "flimit-debug-info" },
14161494.{ .name = "flogical-abbreviations" },
14171495.{ .name = "floop-interchange" },
......@@ -1444,8 +1522,10 @@
14441522.{ .name = "fmodules-debuginfo" },
14451523.{ .name = "fmodules-decluse" },
14461524.{ .name = "fmodules-disable-diagnostic-validation" },
1525.{ .name = "fmodules-driver" },
14471526.{ .name = "fmodules-force-validate-user-headers" },
14481527.{ .name = "fmodules-hash-content" },
1528.{ .name = "fmodules-lazy-load-module-maps" },
14491529.{ .name = "fmodules-local-submodule-visibility" },
14501530.{ .name = "fmodules-reduced-bmi" },
14511531.{ .name = "fmodules-search-all" },
......@@ -1460,6 +1540,7 @@
14601540.{ .name = "fmodules-validate-system-headers" },
14611541.{ .name = "fmodulo-sched" },
14621542.{ .name = "fmodulo-sched-allow-regmoves" },
1543.{ .name = "fms-anonymous-structs" },
14631544.{ .name = "fms-compatibility" },
14641545.{ .name = "fms-define-stdc" },
14651546.{ .name = "fms-extensions" },
......@@ -1539,6 +1620,9 @@
15391620.{ .name = "fno-complete-member-pointers" },
15401621.{ .name = "fno-const-strings" },
15411622.{ .name = "fno-constant-cfstrings" },
1623.{ .name = "fno-constant-nsarray-literals" },
1624.{ .name = "fno-constant-nsdictionary-literals" },
1625.{ .name = "fno-constant-nsnumber-literals" },
15421626.{ .name = "fno-convergent-functions" },
15431627.{ .name = "fno-coro-aligned-allocation" },
15441628.{ .name = "fno-coroutines" },
......@@ -1559,6 +1643,8 @@
15591643.{ .name = "fno-debug-macro" },
15601644.{ .name = "fno-debug-pass-manager" },
15611645.{ .name = "fno-debug-ranges-base-address" },
1646.{ .name = "fno-debug-record-sysroot" },
1647.{ .name = "fno-debug-run-lifetime-safety" },
15621648.{ .name = "fno-debug-types-section" },
15631649.{ .name = "fno-declspec" },
15641650.{ .name = "fno-default-inline" },
......@@ -1571,6 +1657,7 @@
15711657.{ .name = "fno-devirtualize-speculatively" },
15721658.{ .name = "fno-diagnostics-fixit-info" },
15731659.{ .name = "fno-diagnostics-show-hotness" },
1660.{ .name = "fno-diagnostics-show-inlining-chain" },
15741661.{ .name = "fno-diagnostics-show-line-numbers" },
15751662.{ .name = "fno-diagnostics-show-note-include-stack" },
15761663.{ .name = "fno-diagnostics-show-option" },
......@@ -1595,14 +1682,22 @@
15951682.{ .name = "fno-eliminate-unused-debug-types" },
15961683.{ .name = "fno-emit-compact-unwind-non-canonical" },
15971684.{ .name = "fno-emulated-tls" },
1685.{ .name = "fno-enable-new-pm-codegen" },
1686.{ .name = "fno-enumeration-type" },
15981687.{ .name = "fno-escaping-block-tail-calls" },
15991688.{ .name = "fno-exceptions" },
1689.{ .name = "fno-experimental-allow-pointer-field-protection-attr" },
16001690.{ .name = "fno-experimental-call-graph-section" },
16011691.{ .name = "fno-experimental-isel" },
16021692.{ .name = "fno-experimental-late-parse-attributes" },
16031693.{ .name = "fno-experimental-library" },
1694.{ .name = "fno-experimental-lifetime-safety-c" },
16041695.{ .name = "fno-experimental-loop-fusion" },
1696.{ .name = "fno-experimental-new-constant-interpreter" },
16051697.{ .name = "fno-experimental-omit-vtable-rtti" },
1698.{ .name = "fno-experimental-overflow-behavior-types" },
1699.{ .name = "fno-experimental-pointer-field-protection-abi" },
1700.{ .name = "fno-experimental-pointer-field-protection-tagged" },
16061701.{ .name = "fno-experimental-relative-c++-abi-vtables" },
16071702.{ .name = "fno-external-blas" },
16081703.{ .name = "fno-f2c" },
......@@ -1672,8 +1767,9 @@
16721767.{ .name = "fno-keep-system-includes" },
16731768.{ .name = "fno-knr-functions" },
16741769.{ .name = "fno-lax-vector-conversions" },
1675.{ .name = "fno-experimental-lifetime-safety" },
1676.{ .name = "fno-experimental-lifetime-safety-inference" },
1770.{ .name = "fno-lifetime-dse" },
1771.{ .name = "fno-lifetime-safety-inference" },
1772.{ .name = "fno-experimental-lifetime-safety-tu-analysis" },
16771773.{ .name = "fno-limit-debug-info" },
16781774.{ .name = "fno-logical-abbreviations" },
16791775.{ .name = "fno-loop-interchange" },
......@@ -1695,6 +1791,7 @@
16951791.{ .name = "fno-modulemap-allow-subdirectory-search" },
16961792.{ .name = "fno-modules" },
16971793.{ .name = "fno-modules-decluse" },
1794.{ .name = "fno-modules-driver" },
16981795.{ .name = "fno-modules-error-recovery" },
16991796.{ .name = "fno-modules-force-validate-user-headers" },
17001797.{ .name = "fno-modules-global-index" },
......@@ -1710,6 +1807,7 @@
17101807.{ .name = "fno-modules-validate-textual-header-includes" },
17111808.{ .name = "fno-modulo-sched" },
17121809.{ .name = "fno-modulo-sched-allow-regmoves" },
1810.{ .name = "fno-ms-anonymous-structs" },
17131811.{ .name = "fno-ms-compatibility" },
17141812.{ .name = "fno-ms-extensions" },
17151813.{ .name = "fno-ms-tls-guards" },
......@@ -1720,12 +1818,15 @@
17201818.{ .name = "fno-objc-arc" },
17211819.{ .name = "fno-objc-arc-exceptions" },
17221820.{ .name = "fno-objc-avoid-heapify-local-blocks" },
1821.{ .name = "fno-objc-constant-literals" },
17231822.{ .name = "fno-objc-convert-messages-to-runtime-calls" },
17241823.{ .name = "fno-objc-direct-precondition-thunk" },
17251824.{ .name = "fno-objc-encode-cxx-class-template-spec" },
17261825.{ .name = "fno-objc-exceptions" },
17271826.{ .name = "fno-objc-infer-related-result-type" },
17281827.{ .name = "fno-objc-legacy-dispatch" },
1828.{ .name = "fno-objc-msgsend-class-selector-stubs" },
1829.{ .name = "fno-objc-msgsend-selector-stubs" },
17291830.{ .name = "fno-objc-nonfragile-abi" },
17301831.{ .name = "fno-objc-weak" },
17311832.{ .name = "fno-offload-implicit-host-device-templates" },
......@@ -1733,7 +1834,11 @@
17331834.{ .name = "fno-offload-uniform-block" },
17341835.{ .name = "fno-offload-via-llvm" },
17351836.{ .name = "fno-omit-frame-pointer", .ze = .no_omit_frame_pointer },
1837.{ .name = "fno-openacc-default-none-scalars-strict" },
1838.{ .name = "fno-openacc-multiple-names-in-routine" },
17361839.{ .name = "fno-openmp" },
1840.{ .name = "fno-openmp-assume-no-nested-parallelism" },
1841.{ .name = "fno-openmp-assume-no-thread-state" },
17371842.{ .name = "fno-openmp-assume-teams-oversubscription" },
17381843.{ .name = "fno-openmp-assume-threads-oversubscription" },
17391844.{ .name = "fno-openmp-cuda-mode" },
......@@ -1742,6 +1847,7 @@
17421847.{ .name = "fno-openmp-optimistic-collapse" },
17431848.{ .name = "fno-openmp-simd" },
17441849.{ .name = "fno-openmp-target-debug" },
1850.{ .name = "fno-openmp-target-fast" },
17451851.{ .name = "fno-openmp-target-jit" },
17461852.{ .name = "fno-openmp-target-new-runtime" },
17471853.{ .name = "fno-operator-names" },
......@@ -1805,12 +1911,14 @@
18051911.{ .name = "fno-real-8-real-10" },
18061912.{ .name = "fno-real-8-real-16" },
18071913.{ .name = "fno-real-8-real-4" },
1914.{ .name = "fno-real-sum-reassociation" },
18081915.{ .name = "fno-realloc-lhs" },
18091916.{ .name = "fno-reciprocal-math" },
18101917.{ .name = "fno-record-command-line" },
18111918.{ .name = "fno-recovery-ast" },
18121919.{ .name = "fno-recovery-ast-type" },
18131920.{ .name = "fno-recursive" },
1921.{ .name = "fno-reflection" },
18141922.{ .name = "fno-reformat" },
18151923.{ .name = "fno-register-global-dtors-with-atexit" },
18161924.{ .name = "fno-regs-graph" },
......@@ -1828,6 +1936,7 @@
18281936.{ .name = "fno-rtti-data" },
18291937.{ .name = "fno-rwpi" },
18301938.{ .name = "fno-safe-buffer-usage-suggestions" },
1939.{ .name = "fno-safe-trampoline" },
18311940.{ .name = "fno-sample-profile-use-profi" },
18321941.{ .name = "fno-sanitize-address-globals-dead-stripping" },
18331942.{ .name = "fno-sanitize-address-outline-instrumentation" },
......@@ -1857,6 +1966,7 @@
18571966.{ .name = "fno-sanitize-thread-func-entry-exit" },
18581967.{ .name = "fno-sanitize-thread-memory-access" },
18591968.{ .name = "fno-sanitize-trap", .ze = .no_sanitize_trap },
1969.{ .name = "fno-sanitize-trap-loop" },
18601970.{ .name = "fno-sanitize-type-outline-instrumentation" },
18611971.{ .name = "fno-sanitize-undefined-trap-on-error" },
18621972.{ .name = "fno-save-main-program" },
......@@ -1896,6 +2006,7 @@
18962006.{ .name = "fno-standalone-debug" },
18972007.{ .name = "fno-strength-reduce" },
18982008.{ .name = "fno-strict-aliasing" },
2009.{ .name = "fno-strict-bool" },
18992010.{ .name = "fno-strict-enums" },
19002011.{ .name = "fno-strict-float-cast-overflow" },
19012012.{ .name = "fno-strict-overflow" },
......@@ -1975,6 +2086,7 @@
19752086.{ .name = "fobjc-atdefs" },
19762087.{ .name = "fobjc-avoid-heapify-local-blocks" },
19772088.{ .name = "fobjc-call-cxx-cdtors" },
2089.{ .name = "fobjc-constant-literals" },
19782090.{ .name = "fobjc-convert-messages-to-runtime-calls" },
19792091.{ .name = "fobjc-direct-precondition-thunk" },
19802092.{ .name = "fobjc-disable-direct-methods-for-testing" },
......@@ -1985,18 +2097,23 @@
19852097.{ .name = "fobjc-infer-related-result-type" },
19862098.{ .name = "fobjc-legacy-dispatch" },
19872099.{ .name = "fobjc-link-runtime" },
2100.{ .name = "fobjc-msgsend-class-selector-stubs" },
2101.{ .name = "fobjc-msgsend-selector-stubs" },
19882102.{ .name = "fobjc-new-property" },
19892103.{ .name = "fobjc-nonfragile-abi" },
19902104.{ .name = "fobjc-runtime-has-weak" },
19912105.{ .name = "fobjc-sender-dependent-dispatch" },
19922106.{ .name = "fobjc-subscripting-legacy-runtime" },
19932107.{ .name = "fobjc-weak" },
2108.{ .name = "foffload-device" },
19942109.{ .name = "foffload-implicit-host-device-templates" },
19952110.{ .name = "foffload-lto" },
19962111.{ .name = "foffload-uniform-block" },
19972112.{ .name = "foffload-via-llvm" },
19982113.{ .name = "fomit-frame-pointer", .ze = .omit_frame_pointer },
19992114.{ .name = "fopenacc" },
2115.{ .name = "fopenacc-default-none-scalars-strict" },
2116.{ .name = "fopenacc-multiple-names-in-routine" },
20002117.{ .name = "fopenmp" },
20012118.{ .name = "fopenmp-assume-no-nested-parallelism" },
20022119.{ .name = "fopenmp-assume-no-thread-state" },
......@@ -2014,6 +2131,7 @@
20142131.{ .name = "fopenmp-relocatable-target" },
20152132.{ .name = "fopenmp-simd" },
20162133.{ .name = "fopenmp-target-debug" },
2134.{ .name = "fopenmp-target-fast" },
20172135.{ .name = "fopenmp-target-jit" },
20182136.{ .name = "fopenmp-target-new-runtime" },
20192137.{ .name = "fopenmp-use-tls" },
......@@ -2091,12 +2209,14 @@
20912209.{ .name = "freal-8-real-10" },
20922210.{ .name = "freal-8-real-16" },
20932211.{ .name = "freal-8-real-4" },
2212.{ .name = "freal-sum-reassociation" },
20942213.{ .name = "frealloc-lhs" },
20952214.{ .name = "freciprocal-math" },
20962215.{ .name = "frecord-command-line" },
20972216.{ .name = "frecovery-ast" },
20982217.{ .name = "frecovery-ast-type" },
20992218.{ .name = "frecursive" },
2219.{ .name = "freflection" },
21002220.{ .name = "freg-struct-return" },
21012221.{ .name = "fregister-global-dtors-with-atexit" },
21022222.{ .name = "fregs-graph" },
......@@ -2115,6 +2235,7 @@
21152235.{ .name = "frtti-data" },
21162236.{ .name = "frwpi" },
21172237.{ .name = "fsafe-buffer-usage-suggestions" },
2238.{ .name = "fsafe-trampoline" },
21182239.{ .name = "fsample-profile-use-profi" },
21192240.{ .name = "fsanitize-address-globals-dead-stripping" },
21202241.{ .name = "fsanitize-address-outline-instrumentation" },
......@@ -2142,6 +2263,7 @@
21422263.{ .name = "fsanitize-coverage-trace-gep" },
21432264.{ .name = "fsanitize-coverage-trace-loads" },
21442265.{ .name = "fsanitize-coverage-trace-pc" },
2266.{ .name = "fsanitize-coverage-trace-pc-entry-exit" },
21452267.{ .name = "fsanitize-coverage-trace-pc-guard", .ze = .san_cov_trace_pc_guard },
21462268.{ .name = "fsanitize-coverage-trace-stores" },
21472269.{ .name = "fsanitize-debug-trap-reasons" },
......@@ -2162,6 +2284,7 @@
21622284.{ .name = "fsanitize-thread-func-entry-exit" },
21632285.{ .name = "fsanitize-thread-memory-access" },
21642286.{ .name = "fsanitize-trap", .ze = .sanitize_trap },
2287.{ .name = "fsanitize-trap-loop" },
21652288.{ .name = "fsanitize-type-outline-instrumentation" },
21662289.{ .name = "fsanitize-undefined-trap-on-error" },
21672290.{ .name = "fsave-main-program" },
......@@ -2208,6 +2331,7 @@
22082331.{ .name = "fstandalone-debug" },
22092332.{ .name = "fstrength-reduce" },
22102333.{ .name = "fstrict-aliasing" },
2334.{ .name = "fstrict-bool" },
22112335.{ .name = "fstrict-enums" },
22122336.{ .name = "fstrict-float-cast-overflow" },
22132337.{ .name = "fstrict-overflow" },
......@@ -2216,6 +2340,7 @@
22162340.{ .name = "fstruct-path-tbaa" },
22172341.{ .name = "fswift-version-independent-apinotes" },
22182342.{ .name = "fsycl" },
2343.{ .name = "fsycl-device-image-split" },
22192344.{ .name = "fsycl-device-only" },
22202345.{ .name = "fsycl-host-only" },
22212346.{ .name = "fsycl-is-device" },
......@@ -2452,6 +2577,7 @@
24522577.{ .name = "maix-small-local-dynamic-tls" },
24532578.{ .name = "maix-small-local-exec-tls" },
24542579.{ .name = "maix-struct-return" },
2580.{ .name = "maix-use-ptrgl" },
24552581.{ .name = "malign-double" },
24562582.{ .name = "maltivec", .ze = .m },
24572583.{ .name = "mamdgpu-expand-waitcnt-profiling" },
......@@ -2464,7 +2590,6 @@
24642590.{ .name = "mamx-fp8", .ze = .m },
24652591.{ .name = "mamx-int8", .ze = .m },
24662592.{ .name = "mamx-movrs", .ze = .m },
2467.{ .name = "mamx-tf32", .ze = .m },
24682593.{ .name = "mamx-tile", .ze = .m },
24692594.{ .name = "mannotate-tablejump" },
24702595.{ .name = "mapx-inline-asm-use-gpr32" },
......@@ -2474,11 +2599,12 @@
24742599.{ .name = "massembler-no-warn" },
24752600.{ .name = "matomics", .ze = .m },
24762601.{ .name = "mavx", .ze = .m },
2477.{ .name = "mavx10.1" },
2478.{ .name = "mavx10.2" },
2602.{ .name = "mavx10.1", .ze = .m },
2603.{ .name = "mavx10.2", .ze = .m },
24792604.{ .name = "mavx2", .ze = .m },
24802605.{ .name = "mavx512bf16", .ze = .m },
24812606.{ .name = "mavx512bitalg", .ze = .m },
2607.{ .name = "mavx512bmm", .ze = .m },
24822608.{ .name = "mavx512bw", .ze = .m },
24832609.{ .name = "mavx512cd", .ze = .m },
24842610.{ .name = "mavx512dq", .ze = .m },
......@@ -2516,6 +2642,7 @@
25162642.{ .name = "mcmpb", .ze = .m },
25172643.{ .name = "mcmpccxadd", .ze = .m },
25182644.{ .name = "mcmse" },
2645.{ .name = "mcompact-imports" },
25192646.{ .name = "mconstant-cfstrings" },
25202647.{ .name = "mconstructor-aliases" },
25212648.{ .name = "mcrbits", .ze = .m },
......@@ -2540,6 +2667,7 @@
25402667.{ .name = "metal", .psl = true },
25412668.{ .name = "mexception-handling", .ze = .m },
25422669.{ .name = "mexecute-only", .ze = .m },
2670.{ .name = "mexperimental-mtune-syntax" },
25432671.{ .name = "mextended-const", .ze = .m },
25442672.{ .name = "mextern-sdata" },
25452673.{ .name = "mf16c", .ze = .m },
......@@ -2553,6 +2681,7 @@
25532681.{ .name = "mfix-cortex-a57-aes-1742098", .ze = .m },
25542682.{ .name = "mfix-cortex-a72-aes-1655431" },
25552683.{ .name = "mfix-gr712rc" },
2684.{ .name = "mfix-r5900", .ze = .m },
25562685.{ .name = "mfix-ut700" },
25572686.{ .name = "mfloat128", .ze = .m },
25582687.{ .name = "mfloat-abi", .syntax = .separate },
......@@ -2569,7 +2698,7 @@
25692698.{ .name = "mfsgsbase", .ze = .m },
25702699.{ .name = "mfsmuld" },
25712700.{ .name = "mfxsr", .ze = .m },
2572.{ .name = "mgc" },
2701.{ .name = "mgc", .ze = .m },
25732702.{ .name = "mgeneral-regs-only" },
25742703.{ .name = "mgfni", .ze = .m },
25752704.{ .name = "mginv", .ze = .m },
......@@ -2677,17 +2806,17 @@
26772806.{ .name = "mno-amx-fp8", .ze = .m },
26782807.{ .name = "mno-amx-int8", .ze = .m },
26792808.{ .name = "mno-amx-movrs", .ze = .m },
2680.{ .name = "mno-amx-tf32", .ze = .m },
26812809.{ .name = "mno-amx-tile", .ze = .m },
26822810.{ .name = "mno-annotate-tablejump" },
26832811.{ .name = "mno-apxf" },
26842812.{ .name = "mno-atomics", .ze = .m },
26852813.{ .name = "mno-avx", .ze = .m },
2686.{ .name = "mno-avx10.1" },
2687.{ .name = "mno-avx10.2" },
2814.{ .name = "mno-avx10.1", .ze = .m },
2815.{ .name = "mno-avx10.2", .ze = .m },
26882816.{ .name = "mno-avx2", .ze = .m },
26892817.{ .name = "mno-avx512bf16", .ze = .m },
26902818.{ .name = "mno-avx512bitalg", .ze = .m },
2819.{ .name = "mno-avx512bmm", .ze = .m },
26912820.{ .name = "mno-avx512bw", .ze = .m },
26922821.{ .name = "mno-avx512cd", .ze = .m },
26932822.{ .name = "mno-avx512dq", .ze = .m },
......@@ -2720,6 +2849,7 @@
27202849.{ .name = "mno-clzero", .ze = .m },
27212850.{ .name = "mno-cmpb", .ze = .m },
27222851.{ .name = "mno-cmpccxadd", .ze = .m },
2852.{ .name = "mno-compact-imports" },
27232853.{ .name = "mno-constant-cfstrings" },
27242854.{ .name = "mno-constructor-aliases" },
27252855.{ .name = "mno-crbits", .ze = .m },
......@@ -2736,6 +2866,7 @@
27362866.{ .name = "mno-exception-handling", .ze = .m },
27372867.{ .name = "mnoexecstack" },
27382868.{ .name = "mno-execute-only", .ze = .m },
2869.{ .name = "mno-experimental-mtune-syntax" },
27392870.{ .name = "mno-extended-const", .ze = .m },
27402871.{ .name = "mno-extern-sdata" },
27412872.{ .name = "mno-f16c", .ze = .m },
......@@ -2744,6 +2875,7 @@
27442875.{ .name = "mno-fix-cortex-a53-843419" },
27452876.{ .name = "mno-fix-cortex-a57-aes-1742098", .ze = .m },
27462877.{ .name = "mno-fix-cortex-a72-aes-1655431" },
2878.{ .name = "mno-fix-r5900", .ze = .m },
27472879.{ .name = "mno-float128", .ze = .m },
27482880.{ .name = "mno-fma", .ze = .m },
27492881.{ .name = "mno-fma4", .ze = .m },
......@@ -2757,7 +2889,7 @@
27572889.{ .name = "mno-fsmuld", .ze = .m },
27582890.{ .name = "mno-fxsr", .ze = .m },
27592891.{ .name = "mno-gather" },
2760.{ .name = "mno-gc" },
2892.{ .name = "mno-gc", .ze = .m },
27612893.{ .name = "mno-gfni", .ze = .m },
27622894.{ .name = "mno-ginv", .ze = .m },
27632895.{ .name = "mno-global-merge" },
......@@ -2848,6 +2980,7 @@
28482980.{ .name = "mno-relax", .ze = .m },
28492981.{ .name = "mno-relax-all" },
28502982.{ .name = "mno-relax-pic-calls" },
2983.{ .name = "mno-relaxed-atomics", .ze = .m },
28512984.{ .name = "mno-relaxed-simd", .ze = .m },
28522985.{ .name = "mno-reserve-frame-pointer-reg" },
28532986.{ .name = "mno-restrict-it" },
......@@ -2874,6 +3007,7 @@
28743007.{ .name = "mno-soft-float", .ze = .m },
28753008.{ .name = "mno-spe", .ze = .m },
28763009.{ .name = "mno-speculative-load-hardening" },
3010.{ .name = "mno-sramecc", .ze = .m },
28773011.{ .name = "mno-sse", .ze = .m },
28783012.{ .name = "mno-sse2", .ze = .m },
28793013.{ .name = "mno-sse3", .ze = .m },
......@@ -2887,7 +3021,7 @@
28873021.{ .name = "mno-strict-align", .ze = .m },
28883022.{ .name = "mno-tail-call", .ze = .m },
28893023.{ .name = "mno-tbm", .ze = .m },
2890.{ .name = "mno-tgsplit", .ze = .m },
3024.{ .name = "mno-tgsplit" },
28913025.{ .name = "mno-thumb" },
28923026.{ .name = "mno-tls-direct-seg-refs" },
28933027.{ .name = "mno-tocdata" },
......@@ -2919,12 +3053,15 @@
29193053.{ .name = "mno-x87", .ze = .m },
29203054.{ .name = "mno-xcoff-roptr" },
29213055.{ .name = "mno-xgot", .ze = .m },
3056.{ .name = "mno-xnack", .ze = .m },
29223057.{ .name = "mno-xop", .ze = .m },
29233058.{ .name = "mno-xsave", .ze = .m },
29243059.{ .name = "mno-xsavec", .ze = .m },
29253060.{ .name = "mno-xsaveopt", .ze = .m },
29263061.{ .name = "mno-xsaves", .ze = .m },
3062.{ .name = "mno-zos-ppa1-name" },
29273063.{ .name = "mno-zvector" },
3064.{ .name = "mno-aix-use-ptrgl" },
29283065.{ .name = "mnocrc" },
29293066.{ .name = "mno-direct-move", .ze = .m },
29303067.{ .name = "mnontrapping-fptoint", .ze = .m },
......@@ -2935,7 +3072,6 @@
29353072.{ .name = "mnvs", .ze = .m },
29363073.{ .name = "modd-spreg" },
29373074.{ .name = "module-dependency-dir", .syntax = .separate },
2938.{ .name = "module-file-deps" },
29393075.{ .name = "module-file-info" },
29403076.{ .name = "module-suffix", .syntax = .separate },
29413077.{ .name = "momit-leaf-frame-pointer" },
......@@ -2980,6 +3116,7 @@
29803116.{ .name = "mrelax-all" },
29813117.{ .name = "mrelax-pic-calls" },
29823118.{ .name = "mrelax-relocations=no" },
3119.{ .name = "mrelaxed-atomics", .ze = .m },
29833120.{ .name = "mrelaxed-simd", .ze = .m },
29843121.{ .name = "mrelocation-model", .syntax = .separate },
29853122.{ .name = "mreserve-frame-pointer-reg" },
......@@ -3013,6 +3150,7 @@
30133150.{ .name = "msoft-quad-float" },
30143151.{ .name = "mspe", .ze = .m },
30153152.{ .name = "mspeculative-load-hardening" },
3153.{ .name = "msramecc", .ze = .m },
30163154.{ .name = "msse", .ze = .m },
30173155.{ .name = "msse2", .ze = .m },
30183156.{ .name = "msse2avx" },
......@@ -3023,12 +3161,13 @@
30233161.{ .name = "msse4a", .ze = .m },
30243162.{ .name = "mssse3", .ze = .m },
30253163.{ .name = "mstack-arg-probe" },
3164.{ .name = "mstack-protector-guard-record" },
30263165.{ .name = "mstackrealign" },
30273166.{ .name = "mstrict-align", .ze = .m },
30283167.{ .name = "msvr4-struct-return" },
30293168.{ .name = "mtail-call", .ze = .m },
30303169.{ .name = "mtbm", .ze = .m },
3031.{ .name = "mtgsplit", .ze = .m },
3170.{ .name = "mtgsplit" },
30323171.{ .name = "mthread-model", .syntax = .separate },
30333172.{ .name = "mthumb" },
30343173.{ .name = "mtls-direct-seg-refs" },
......@@ -3059,7 +3198,7 @@
30593198.{ .name = "mv73", .ze = .m },
30603199.{ .name = "mv75", .ze = .m },
30613200.{ .name = "mv79", .ze = .m },
3062.{ .name = "mv81" },
3201.{ .name = "mv81", .ze = .m },
30633202.{ .name = "mv8plus", .ze = .m },
30643203.{ .name = "mvaes", .ze = .m },
30653204.{ .name = "mvector-strict-align" },
......@@ -3078,15 +3217,19 @@
30783217.{ .name = "mwbnoinvd", .ze = .m },
30793218.{ .name = "mwide-arithmetic", .ze = .m },
30803219.{ .name = "mwidekl", .ze = .m },
3081.{ .name = "mx32" },
3220.{ .name = "mx32", .ze = .m },
30823221.{ .name = "mx87", .ze = .m },
30833222.{ .name = "mxcoff-roptr" },
30843223.{ .name = "mxgot", .ze = .m },
3224.{ .name = "mxnack", .ze = .m },
30853225.{ .name = "mxop", .ze = .m },
30863226.{ .name = "mxsave", .ze = .m },
30873227.{ .name = "mxsavec", .ze = .m },
30883228.{ .name = "mxsaveopt", .ze = .m },
30893229.{ .name = "mxsaves", .ze = .m },
3230.{ .name = "mzilsd-strict-align" },
3231.{ .name = "mzilsd-word-align", .ze = .m },
3232.{ .name = "mzos-ppa1-name" },
30903233.{ .name = "mzvector" },
30913234.{ .name = "n" },
30923235.{ .name = "new-struct-path-tbaa" },
......@@ -3160,6 +3303,11 @@
31603303 .pd1 = false,
31613304 .pd2 = true,
31623305},
3306.{
3307 .name = "no-xcselect",
3308 .pd1 = false,
3309 .pd2 = true,
3310},
31633311.{ .name = "nobuiltininc" },
31643312.{ .name = "nocpp" },
31653313.{ .name = "nodefaultlibs" },
......@@ -3168,6 +3316,7 @@
31683316.{ .name = "nogpulibc" },
31693317.{ .name = "nohipwrapperinc" },
31703318.{ .name = "nolibc", .ze = .nostdlib },
3319.{ .name = "nolibsycl" },
31713320.{ .name = "nomultidefs" },
31723321.{ .name = "nopie", .ze = .no_pie },
31733322.{ .name = "noprebind" },
......@@ -3284,6 +3433,7 @@
32843433.{ .name = "reexport_framework", .syntax = .separate },
32853434.{ .name = "regcall4" },
32863435.{ .name = "relaxed-aliasing" },
3436.{ .name = "frelaxed-c-loc-checks" },
32873437.{ .name = "relocatable-pch", .pd2 = true },
32883438.{ .name = "remap" },
32893439.{ .name = "remap-file", .syntax = .separate },
......@@ -3433,6 +3583,7 @@
34333583 .pd1 = false,
34343584 .pd2 = true,
34353585},
3586.{ .name = "verify-directives" },
34363587.{ .name = "verify-ignore-unexpected" },
34373588.{ .name = "verify-pch" },
34383589.{ .name = "version", .ze = .version },
......@@ -3472,11 +3623,14 @@
34723623.{ .name = "fvisibility-externs-nodllstorageclass=", .syntax = .joined },
34733624.{ .name = "fallow-runtime-check-skip-hot-cutoff=", .syntax = .joined },
34743625.{ .name = "fexperimental-openacc-macro-override=", .syntax = .joined },
3626.{ .name = "lifetime-safety-lifetimebound-macro=", .syntax = .joined },
34753627.{ .name = "analyzer-config-compatibility-mode=", .syntax = .joined },
34763628.{ .name = "fms-secure-hotpatch-functions-file=", .syntax = .joined },
34773629.{ .name = "fms-secure-hotpatch-functions-list=", .syntax = .comma_joined },
34783630.{ .name = "fno-experimental-sanitize-metadata=", .syntax = .comma_joined },
3631.{ .name = "fsanitize-ignore-for-ubsan-feature=", .syntax = .comma_joined },
34793632.{ .name = "mdefault-visibility-export-mapping=", .syntax = .joined },
3633.{ .name = "mstack-protector-guard-value-width=", .syntax = .joined },
34803634.{ .name = "fsanitize-address-use-after-return=", .syntax = .joined },
34813635.{
34823636 .name = "fsanitize-address-use-after-return",
......@@ -3501,11 +3655,16 @@
35013655 .syntax = .joined,
35023656 .psl = true,
35033657},
3658.{ .name = "fconstant-integer-number-class=", .syntax = .joined },
35043659.{ .name = "fdiagnostics-hotness-threshold=", .syntax = .joined },
35053660.{ .name = "fexperimental-max-bitint-width=", .syntax = .joined },
3661.{ .name = "fimplicit-modules-lock-timeout=", .syntax = .joined },
35063662.{ .name = "fsanitize-memory-track-origins=", .syntax = .joined },
3663.{ .name = "lifetime-safety-max-cfg-blocks=", .syntax = .joined },
35073664.{ .name = "mwatchos-simulator-version-min=", .syntax = .joined },
35083665.{ .name = "funique-source-file-identifier=", .syntax = .joined },
3666.{ .name = "fconstant-double-number-class=", .syntax = .joined },
3667.{ .name = "fpreferred-function-alignment=", .syntax = .joined },
35093668.{ .name = "fsanitize-annotate-debug-info=", .syntax = .comma_joined },
35103669.{ .name = "fsanitize-coverage-ignorelist=", .syntax = .joined },
35113670.{ .name = "fvisibility-externs-dllimport=", .syntax = .joined },
......@@ -3522,6 +3681,7 @@
35223681},
35233682.{ .name = "miphonesimulator-version-min=", .syntax = .joined },
35243683.{ .name = "fcaret-diagnostics-max-lines=", .syntax = .joined },
3684.{ .name = "fconstant-float-number-class=", .syntax = .joined },
35253685.{ .name = "fobjc-nonfragile-abi-version=", .syntax = .joined },
35263686.{ .name = "fprofile-instrument-use-path=", .syntax = .joined },
35273687.{ .name = "fsanitize-coverage-allowlist=", .syntax = .joined },
......@@ -3564,6 +3724,7 @@
35643724},
35653725.{ .name = "error-on-deserialized-decl=", .syntax = .joined },
35663726.{ .name = "fbfloat16-excess-precision=", .syntax = .joined },
3727.{ .name = "fconstant-dictionary-class=", .syntax = .joined },
35673728.{ .name = "fconstexpr-backtrace-limit=", .syntax = .joined },
35683729.{ .name = "fdiagnostics-show-category=", .syntax = .joined },
35693730.{ .name = "fdiagnostics-show-location=", .syntax = .joined },
......@@ -3590,6 +3751,11 @@
35903751.{ .name = "mstack-protector-guard-reg=", .syntax = .joined },
35913752.{ .name = "msve-streaming-vector-bits=", .syntax = .joined },
35923753.{ .name = "Wsystem-headers-in-module=", .syntax = .joined },
3754.{
3755 .name = "experimental:deterministic",
3756 .syntax = .joined,
3757 .psl = true,
3758},
35933759.{
35943760 .name = "include-with-prefix-after=",
35953761 .syntax = .joined,
......@@ -3625,6 +3791,12 @@
36253791 .pd2 = true,
36263792},
36273793.{ .name = "Wno-nonportable-cfstrings", .syntax = .joined },
3794.{
3795 .name = "ssaf-compilation-unit-id=",
3796 .syntax = .joined,
3797 .pd1 = false,
3798 .pd2 = true,
3799},
36283800.{ .name = "analyzer-disable-checker=", .syntax = .joined },
36293801.{ .name = "fbuild-session-timestamp=", .syntax = .joined },
36303802.{ .name = "fdo-concurrent-to-openmp=", .syntax = .joined },
......@@ -3632,6 +3804,7 @@
36323804.{ .name = "fms-layout-compatibility=", .syntax = .joined },
36333805.{ .name = "fprofile-function-groups=", .syntax = .joined },
36343806.{ .name = "fprofile-instrument-path=", .syntax = .joined },
3807.{ .name = "fsycl-device-image-split=", .syntax = .joined },
36353808.{ .name = "header-include-filtering=", .syntax = .joined },
36363809.{ .name = "mdefault-build-attributes", .syntax = .joined },
36373810.{ .name = "msign-return-address-key=", .syntax = .joined },
......@@ -3677,10 +3850,17 @@
36773850 .pd1 = false,
36783851 .pd2 = true,
36793852},
3853.{
3854 .name = "ssaf-extract-summaries=",
3855 .syntax = .comma_joined,
3856 .pd1 = false,
3857 .pd2 = true,
3858},
36803859.{ .name = "analyzer-inlining-mode=", .syntax = .joined },
36813860.{ .name = "fcodegen-data-generate=", .syntax = .joined },
36823861.{ .name = "fconstant-string-class=", .syntax = .joined },
36833862.{ .name = "fcrash-diagnostics-dir=", .syntax = .joined },
3863.{ .name = "fcrash-diagnostics-tar=", .syntax = .joined },
36843864.{ .name = "fdebug-compilation-dir=", .syntax = .joined },
36853865.{ .name = "fdebug-default-version=", .syntax = .joined },
36863866.{ .name = "ffp-exception-behavior=", .syntax = .joined },
......@@ -3700,6 +3880,7 @@
37003880.{ .name = "Wnonportable-cfstrings", .syntax = .joined },
37013881.{ .name = "miphoneos-version-min=", .syntax = .joined },
37023882.{ .name = "fbasic-block-sections=", .syntax = .joined },
3883.{ .name = "fconstant-array-class=", .syntax = .joined },
37033884.{ .name = "fdefault-calling-conv=", .syntax = .joined },
37043885.{ .name = "fdenormal-fp-math-f32=", .syntax = .joined },
37053886.{ .name = "fembed-offload-object=", .syntax = .joined },
......@@ -3735,6 +3916,12 @@
37353916.{ .name = "mvscale-streaming-min=", .syntax = .joined },
37363917.{ .name = "Wlarge-by-value-copy=", .syntax = .joined },
37373918.{ .name = "Xthinlto-distributor=", .syntax = .comma_joined },
3919.{
3920 .name = "ssaf-tu-summary-file=",
3921 .syntax = .joined,
3922 .pd1 = false,
3923 .pd2 = true,
3924},
37383925.{ .name = "analyzer-constraints=", .syntax = .joined },
37393926.{ .name = "analyzer-dump-egraph=", .syntax = .joined },
37403927.{ .name = "compatibility_version", .syntax = .joined_or_separate },
......@@ -3749,6 +3936,7 @@
37493936.{ .name = "fthinlto-distributor=", .syntax = .joined },
37503937.{ .name = "fzero-call-used-regs=", .syntax = .joined },
37513938.{ .name = "iframeworkwithsysroot", .syntax = .joined_or_separate },
3939.{ .name = "init-datetime-macros=", .syntax = .joined },
37523940.{ .name = "mcode-object-version=", .syntax = .joined },
37533941.{ .name = "mpad-max-prefix-size=", .syntax = .joined },
37543942.{ .name = "mprefer-vector-width=", .syntax = .joined },
......@@ -3791,6 +3979,7 @@
37913979.{ .name = "fbuild-session-file=", .syntax = .joined },
37923980.{ .name = "fcomplex-arithmetic=", .syntax = .joined },
37933981.{ .name = "fdiagnostics-format=", .syntax = .joined },
3982.{ .name = "ffp-maxmin-behavior=", .syntax = .joined },
37943983.{ .name = "fgpu-default-stream=", .syntax = .joined },
37953984.{ .name = "fmax-stack-var-size=", .syntax = .joined },
37963985.{ .name = "fmemory-profile-use=", .syntax = .joined },
......@@ -3846,6 +4035,7 @@
38464035 .pd1 = false,
38474036 .pd2 = true,
38484037},
4038.{ .name = "load-bool-from-mem=", .syntax = .joined },
38494039.{ .name = "mbranch-protection=", .syntax = .joined },
38504040.{ .name = "mmacos-version-min=", .syntax = .joined },
38514041.{
......@@ -3856,6 +4046,7 @@
38564046},
38574047.{ .name = "pch-through-header=", .syntax = .joined },
38584048.{ .name = "target-sdk-version=", .syntax = .joined },
4049.{ .name = "fwin-cfg-mechanism=", .syntax = .joined },
38594050.{
38604051 .name = "execution-charset:",
38614052 .syntax = .joined,
......@@ -3896,6 +4087,7 @@
38964087.{ .name = "fextend-arguments=", .syntax = .joined },
38974088.{ .name = "ffree-line-length-", .syntax = .joined },
38984089.{ .name = "fmacro-prefix-map=", .syntax = .joined },
4090.{ .name = "fmodule-file-deps=", .syntax = .joined },
38994091.{
39004092 .name = "fno-sanitize-trap=",
39014093 .ze = .no_sanitize_trap,
......@@ -3917,7 +4109,15 @@
39174109 .pd1 = false,
39184110 .pd2 = true,
39194111},
4112.{
4113 .name = "reloc-section-sym=",
4114 .syntax = .joined,
4115 .pd1 = false,
4116 .pd2 = true,
4117},
4118.{ .name = "fwinx64-eh-unwind=", .syntax = .joined },
39204119.{ .name = "working-directory=", .syntax = .joined },
4120.{ .name = "Xoffload-compiler", .syntax = .joined_and_separate },
39214121.{
39224122 .name = "amdgpu-arch-tool=",
39234123 .syntax = .joined,
......@@ -3949,6 +4149,7 @@
39494149.{ .name = "mfunction-return=", .syntax = .joined },
39504150.{ .name = "mios-version-min=", .syntax = .joined },
39514151.{ .name = "mno-apx-features=", .syntax = .comma_joined },
4152.{ .name = "module-file-deps=", .syntax = .joined },
39524153.{ .name = "mrvv-vector-bits=", .syntax = .joined },
39534154.{ .name = "mstack-alignment=", .syntax = .joined },
39544155.{ .name = "msve-vector-bits=", .syntax = .joined },
......@@ -3984,6 +4185,7 @@
39844185.{ .name = "analyzer-output=", .syntax = .joined },
39854186.{ .name = "ftemplate-depth-", .syntax = .joined },
39864187.{ .name = "ast-dump-filter=", .syntax = .joined },
4188.{ .name = "clangir-lib-opt=", .syntax = .joined },
39874189.{
39884190 .name = "config-user-dir=",
39894191 .syntax = .joined,
......@@ -4001,6 +4203,7 @@
40014203.{ .name = "fmemory-profile=", .syntax = .joined },
40024204.{ .name = "fmessage-length=", .syntax = .joined },
40034205.{ .name = "fms-runtime-lib=", .syntax = .joined },
4206.{ .name = "fno-strict-bool=", .syntax = .joined },
40044207.{ .name = "fopenmp-targets=", .syntax = .comma_joined },
40054208.{ .name = "fopenmp-version=", .syntax = .joined },
40064209.{ .name = "fprofile-update=", .syntax = .joined },
......@@ -4126,6 +4329,12 @@
41264329.{ .name = "mindirect-jump=", .syntax = .joined },
41274330.{ .name = "mzos-hlq-clang=", .syntax = .joined },
41284331.{ .name = "preamble-bytes=", .syntax = .joined },
4332.{
4333 .name = "spirv-val-path=",
4334 .syntax = .joined,
4335 .pd1 = false,
4336 .pd2 = true,
4337},
41294338.{ .name = "Wundef-prefix=", .syntax = .comma_joined },
41304339.{
41314340 .name = "vctoolsversion",
......@@ -4305,6 +4514,7 @@
43054514},
43064515.{ .name = "mharden-sls=", .syntax = .joined },
43074516.{ .name = "mhvx-length=", .syntax = .joined },
4517.{ .name = "mhvx-qfloat=", .syntax = .joined },
43084518.{ .name = "mno-tocdata=", .syntax = .comma_joined },
43094519.{ .name = "mvscale-max=", .syntax = .joined },
43104520.{ .name = "mvscale-min=", .syntax = .joined },
......@@ -4544,6 +4754,7 @@
45444754 .pd2 = true,
45454755},
45464756.{ .name = "idirafter", .syntax = .joined_or_separate },
4757.{ .name = "mscs-reg=", .syntax = .joined },
45474758.{ .name = "mregparm=", .syntax = .joined },
45484759.{ .name = "mtocdata=", .syntax = .comma_joined },
45494760.{ .name = "sycl-std=", .syntax = .joined },
......@@ -4552,6 +4763,11 @@
45524763 .ze = .undefined,
45534764 .syntax = .joined_or_separate,
45544765},
4766.{
4767 .name = "pathmap:",
4768 .syntax = .joined,
4769 .psl = true,
4770},
45554771.{
45564772 .name = "extdirs=",
45574773 .syntax = .joined,
......@@ -4577,6 +4793,12 @@
45774793 .pd1 = false,
45784794 .pd2 = true,
45794795},
4796.{
4797 .name = "cstdlib=",
4798 .syntax = .joined,
4799 .pd1 = false,
4800 .pd2 = true,
4801},
45804802.{ .name = "dsym-dir", .syntax = .joined_or_separate },
45814803.{ .name = "fopenmp=", .syntax = .joined },
45824804.{ .name = "fplugin=", .syntax = .joined },
......@@ -4857,6 +5079,11 @@
48575079 .syntax = .joined,
48585080 .psl = true,
48595081},
5082.{
5083 .name = "Fre",
5084 .syntax = .joined_or_separate,
5085 .psl = true,
5086},
48605087.{
48615088 .name = "Frs",
48625089 .syntax = .joined_or_separate,
src/codegen/c/type.zig+2
......@@ -142,6 +142,8 @@ pub const CType = union(enum) {
142142
143143 .x86_64_preserve_none,
144144 .aarch64_preserve_none,
145 .loongarch32_preserve_none,
146 .loongarch64_preserve_none,
145147 => .preserve_none,
146148
147149 .aarch64_vfabi => .aarch64_vector_pcs,
src/codegen/llvm.zig+36-83
......@@ -1000,11 +1000,6 @@ pub const Object = struct {
10001000 try o.flushTypePool(pt);
10011001 }
10021002
1003 fn workaroundPrivateSymbolBugs(target: *const std.Target, resolved: *const InternPool.Nav.Resolved) bool {
1004 // https://codeberg.org/ziglang/zig/issues/31865
1005 return target.cpu.arch.isAARCH64() and target.ofmt == .coff and resolved.@"threadlocal";
1006 }
1007
10081003 pub fn updateNav(o: *Object, pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) !void {
10091004 const zcu = o.zcu;
10101005 const ip = &zcu.intern_pool;
......@@ -1082,7 +1077,7 @@ pub const Object = struct {
10821077 };
10831078 llvm_global.ptr(&o.builder).visibility = .fromSymbolVisibility(@"extern".visibility);
10841079 } else {
1085 llvm_global.ptr(&o.builder).linkage = if (o.builder.strip and !workaroundPrivateSymbolBugs(zcu.getTarget(), &resolved)) .private else .internal;
1080 llvm_global.ptr(&o.builder).linkage = if (o.builder.strip) .private else .internal;
10861081 llvm_global.ptr(&o.builder).visibility = .default;
10871082 llvm_global.ptr(&o.builder).dll_storage_class = .default;
10881083 llvm_global.ptr(&o.builder).unnamed_addr = .unnamed_addr;
......@@ -4346,6 +4341,8 @@ pub fn toLlvmCallConvTag(cc_tag: std.lang.CallingConvention.Tag, target: *const
43464341 .amdgcn_cs => .amdgpu_cs,
43474342 .nvptx_device => .ptx_device,
43484343 .nvptx_kernel => .ptx_kernel,
4344 .loongarch32_preserve_none => .preserve_nonecc,
4345 .loongarch64_preserve_none => .preserve_nonecc,
43494346
43504347 // Calling conventions which LLVM uses function attributes for.
43514348 .riscv64_interrupt,
......@@ -4434,88 +4431,44 @@ pub fn toLlvmCallConvTag(cc_tag: std.lang.CallingConvention.Tag, target: *const
44344431
44354432/// Convert a zig-address space to an llvm address space.
44364433pub fn toLlvmAddressSpace(address_space: std.lang.AddressSpace, target: *const std.Target) Builder.AddrSpace {
4437 for (llvmAddrSpaceInfo(target)) |info| if (info.zig == address_space) return info.llvm;
4438 unreachable;
4439}
4440
4441const AddrSpaceInfo = struct {
4442 zig: ?std.lang.AddressSpace,
4443 llvm: Builder.AddrSpace,
4444 non_integral: bool = false,
4445 size: ?u16 = null,
4446 abi: ?u16 = null,
4447 pref: ?u16 = null,
4448 idx: ?u16 = null,
4449 force_in_data_layout: bool = false,
4450};
4451fn llvmAddrSpaceInfo(target: *const std.Target) []const AddrSpaceInfo {
44524434 return switch (target.cpu.arch) {
4453 .x86, .x86_64 => &.{
4454 .{ .zig = .generic, .llvm = .default },
4455 .{ .zig = .gs, .llvm = Builder.AddrSpace.x86.gs },
4456 .{ .zig = .fs, .llvm = Builder.AddrSpace.x86.fs },
4457 .{ .zig = .ss, .llvm = Builder.AddrSpace.x86.ss },
4458 .{ .zig = null, .llvm = Builder.AddrSpace.x86.ptr32_sptr, .size = 32, .abi = 32, .force_in_data_layout = true },
4459 .{ .zig = null, .llvm = Builder.AddrSpace.x86.ptr32_uptr, .size = 32, .abi = 32, .force_in_data_layout = true },
4460 .{ .zig = null, .llvm = Builder.AddrSpace.x86.ptr64, .size = 64, .abi = 64, .force_in_data_layout = true },
4461 },
4462 .nvptx, .nvptx64 => &.{
4463 .{ .zig = .generic, .llvm = Builder.AddrSpace.nvptx.generic },
4464 .{ .zig = .global, .llvm = Builder.AddrSpace.nvptx.global },
4465 .{ .zig = .constant, .llvm = Builder.AddrSpace.nvptx.constant },
4466 .{ .zig = .param, .llvm = Builder.AddrSpace.nvptx.param },
4467 .{ .zig = .shared, .llvm = Builder.AddrSpace.nvptx.shared },
4468 .{ .zig = .local, .llvm = Builder.AddrSpace.nvptx.local },
4469 },
4470 .amdgcn => &.{
4471 .{ .zig = .generic, .llvm = Builder.AddrSpace.amdgpu.flat, .force_in_data_layout = true },
4472 .{ .zig = .global, .llvm = Builder.AddrSpace.amdgpu.global, .force_in_data_layout = true },
4473 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.region, .size = 32, .abi = 32 },
4474 .{ .zig = .shared, .llvm = Builder.AddrSpace.amdgpu.local, .size = 32, .abi = 32 },
4475 .{ .zig = .constant, .llvm = Builder.AddrSpace.amdgpu.constant, .force_in_data_layout = true },
4476 .{ .zig = .local, .llvm = Builder.AddrSpace.amdgpu.private, .size = 32, .abi = 32 },
4477 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_32bit, .size = 32, .abi = 32 },
4478 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.buffer_fat_pointer, .non_integral = true, .size = 160, .abi = 256, .idx = 32 },
4479 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.buffer_resource, .non_integral = true, .size = 128, .abi = 128 },
4480 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.buffer_strided_pointer, .non_integral = true, .size = 192, .abi = 256, .idx = 32 },
4481 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_0 },
4482 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_1 },
4483 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_2 },
4484 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_3 },
4485 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_4 },
4486 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_5 },
4487 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_6 },
4488 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_7 },
4489 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_8 },
4490 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_9 },
4491 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_10 },
4492 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_11 },
4493 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_12 },
4494 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_13 },
4495 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_14 },
4496 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.constant_buffer_15 },
4497 .{ .zig = null, .llvm = Builder.AddrSpace.amdgpu.streamout_register },
4435 .amdgcn => switch (address_space) {
4436 .generic => Builder.AddrSpace.amdgpu.flat,
4437 .global => Builder.AddrSpace.amdgpu.global,
4438 .shared => Builder.AddrSpace.amdgpu.local,
4439 .constant => Builder.AddrSpace.amdgpu.constant,
4440 .local => Builder.AddrSpace.amdgpu.private,
4441 else => unreachable,
44984442 },
4499 .avr => &.{
4500 .{ .zig = .generic, .llvm = Builder.AddrSpace.avr.data, .abi = 8 },
4501 .{ .zig = .flash, .llvm = Builder.AddrSpace.avr.program, .abi = 8 },
4502 .{ .zig = .flash1, .llvm = Builder.AddrSpace.avr.program1, .abi = 8 },
4503 .{ .zig = .flash2, .llvm = Builder.AddrSpace.avr.program2, .abi = 8 },
4504 .{ .zig = .flash3, .llvm = Builder.AddrSpace.avr.program3, .abi = 8 },
4505 .{ .zig = .flash4, .llvm = Builder.AddrSpace.avr.program4, .abi = 8 },
4506 .{ .zig = .flash5, .llvm = Builder.AddrSpace.avr.program5, .abi = 8 },
4443 .avr => switch (address_space) {
4444 .generic => Builder.AddrSpace.avr.data,
4445 .flash => Builder.AddrSpace.avr.program,
4446 .flash1 => Builder.AddrSpace.avr.program1,
4447 .flash2 => Builder.AddrSpace.avr.program2,
4448 .flash3 => Builder.AddrSpace.avr.program3,
4449 .flash4 => Builder.AddrSpace.avr.program4,
4450 .flash5 => Builder.AddrSpace.avr.program5,
4451 else => unreachable,
45074452 },
4508 .wasm32, .wasm64 => &.{
4509 .{ .zig = .generic, .llvm = Builder.AddrSpace.wasm.default, .force_in_data_layout = true },
4510 .{ .zig = null, .llvm = Builder.AddrSpace.wasm.variable, .non_integral = true },
4511 .{ .zig = .externref, .llvm = Builder.AddrSpace.wasm.externref, .non_integral = true, .size = 8, .abi = 8 },
4512 .{ .zig = .funcref, .llvm = Builder.AddrSpace.wasm.funcref, .non_integral = true, .size = 8, .abi = 8 },
4453 .nvptx, .nvptx64 => switch (address_space) {
4454 .generic => Builder.AddrSpace.nvptx.generic,
4455 .global => Builder.AddrSpace.nvptx.global,
4456 .constant => Builder.AddrSpace.nvptx.constant,
4457 .param => Builder.AddrSpace.nvptx.entry_param,
4458 .shared => Builder.AddrSpace.nvptx.shared,
4459 .local => Builder.AddrSpace.nvptx.local,
4460 else => unreachable,
45134461 },
4514 .m68k => &.{
4515 .{ .zig = .generic, .llvm = .default, .abi = 16, .pref = 32 },
4462 .x86, .x86_64 => switch (address_space) {
4463 .generic => .default,
4464 .gs => Builder.AddrSpace.x86.gs,
4465 .fs => Builder.AddrSpace.x86.fs,
4466 .ss => Builder.AddrSpace.x86.ss,
4467 else => unreachable,
45164468 },
4517 else => &.{
4518 .{ .zig = .generic, .llvm = .default },
4469 else => switch (address_space) {
4470 .generic => .default,
4471 else => unreachable,
45194472 },
45204473 };
45214474}
src/codegen/llvm/FuncGen.zig+6-50
......@@ -1071,7 +1071,7 @@ fn airRet(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!vo
10711071 const val_is_undef = if (un_op.toInterned()) |i| Value.fromInterned(i).isUndef(zcu) else false;
10721072 const ret_ty_align = ret_ty.abiAlignment(zcu);
10731073
1074 if (val_is_undef and safety and !self.needMemsetWorkaround(ret_ty.abiSize(zcu))) {
1074 if (val_is_undef and safety) {
10751075 const rp = switch (self.ret_ptr) {
10761076 .none => try self.buildZigAlloca(ret_ty, .none),
10771077 else => |rp| rp,
......@@ -5069,7 +5069,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu
50695069 };
50705070
50715071 const val_is_undef = if (bin_op.rhs.toInterned()) |i| Value.fromInterned(i).isUndef(zcu) else false;
5072 if (val_is_undef and !fg.needMemsetWorkaround(elem_ty.abiSize(zcu))) {
5072 if (val_is_undef) {
50735073 const owner_mod = fg.ownerModule();
50745074
50755075 // Even if safety is disabled, we still emit a memset to undefined since it conveys
......@@ -5585,11 +5585,6 @@ fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error
55855585
55865586 self.maybeMarkAllowZeroAccess(ptr_ty.ptrInfo(zcu));
55875587
5588 const allow_byte_memset = !self.needMemsetWorkaround(switch (ptr_ty.ptrSize(zcu)) {
5589 .one => ptr_ty.childType(zcu).abiSize(zcu),
5590 .slice => null,
5591 .many, .c => unreachable,
5592 });
55935588 const len_bytes = try self.sliceOrArrayLenInBytes(dest_slice, ptr_ty);
55945589
55955590 try self.lowerMemset(
......@@ -5600,7 +5595,6 @@ fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error
56005595 len_bytes,
56015596 access_kind,
56025597 safety,
5603 allow_byte_memset,
56045598 );
56055599 return .none;
56065600}
......@@ -5614,12 +5608,11 @@ fn lowerMemset(
56145608 len_bytes: Builder.Value,
56155609 access_kind: Builder.MemoryAccessKind,
56165610 safety: bool,
5617 allow_byte_memset: bool,
56185611) Allocator.Error!void {
56195612 const o = self.object;
56205613 const zcu = o.zcu;
56215614
5622 if (allow_byte_memset) if (elem_ref.toInterned()) |elem_ip_index| {
5615 if (elem_ref.toInterned()) |elem_ip_index| {
56235616 const elem_val: Value = .fromInterned(elem_ip_index);
56245617 if (elem_val.isUndef(zcu)) {
56255618 // Even if safety is disabled, we still emit a memset to undefined since it conveys
......@@ -5660,13 +5653,12 @@ fn lowerMemset(
56605653 );
56615654 return;
56625655 }
5663 };
5656 }
56645657
56655658 const value = try self.resolveInst(elem_ref);
56665659 const elem_abi_size = elem_ty.abiSize(zcu);
56675660
56685661 intrinsic: {
5669 if (!allow_byte_memset) break :intrinsic;
56705662 if (elem_abi_size != 1) break :intrinsic;
56715663 // To use LLVM's intrinsic, we need to convert the operand to a raw 8-bit integer value.
56725664 const fill_byte: Builder.Value = byte: {
......@@ -6023,7 +6015,6 @@ fn airSplat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value
60236015 len_bytes_llvm,
60246016 .normal,
60256017 false,
6026 !self.needMemsetWorkaround(len_bytes),
60276018 );
60286019
60296020 if (array_info.sentinel) |sent_val| {
......@@ -6551,28 +6542,19 @@ fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val
65516542 comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.instruction) == 0);
65526543 comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.data) == 1);
65536544
6554 // LLVM fails during codegen of instruction cache prefetchs for these architectures.
6555 // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported
6556 // by the target.
6557 // To work around this, don't emit llvm.prefetch in this case.
6558 // See https://bugs.llvm.org/show_bug.cgi?id=21037
65596545 const zcu = self.object.zcu;
65606546 const target = zcu.getTarget();
65616547 switch (prefetch.cache) {
65626548 .instruction => switch (target.cpu.arch) {
6549 // https://github.com/llvm/llvm-project/issues/218236
65636550 .x86_64,
65646551 .x86,
6552 // https://github.com/llvm/llvm-project/issues/218239
65656553 .powerpc,
65666554 .powerpcle,
65676555 .powerpc64,
65686556 .powerpc64le,
65696557 => return .none,
6570 .arm, .armeb, .thumb, .thumbeb => {
6571 switch (prefetch.rw) {
6572 .write => return .none,
6573 else => {},
6574 }
6575 },
65766558 else => {},
65776559 },
65786560 .data => {},
......@@ -8144,32 +8126,6 @@ fn llvmAllocaAddressSpace(target: *const std.Target) Builder.AddrSpace {
81448126 };
81458127}
81468128
8147/// Due to an LLVM bug, calls to `@llvm.memset.inline.*` with large constant length arguments cause
8148/// LLVM to crash. As a mitigation, this function returns `true` if we should avoid emitting a
8149/// memset call of the given length.
8150///
8151/// Most of our call sites are just setting memory to `undefined`, so can simply skip the memset
8152/// call if we return `true`.
8153///
8154/// Upstream issue: https://github.com/llvm/llvm-project/issues/189161
8155/// Zig issue: https://codeberg.org/ziglang/zig/issues/31701
8156fn needMemsetWorkaround(fg: *const FuncGen, maybe_len: ?u64) bool {
8157 if (!fg.disable_intrinsics) {
8158 // The bug is limited to `@llvm.memset.inline.*`: normal memset calls are fine.
8159 return false;
8160 }
8161 const len = maybe_len orelse {
8162 // We don't think the length is constant, but a trivial optimization on LLVM's side could
8163 // turn it into one and potentially trigger the bug. Therefore, always apply the workaround
8164 // if the length is not a known constant.
8165 return true;
8166 };
8167 // Empirically, the crash first happens at 1048561 bytes, which is 1 MiB less 15 bytes. To be
8168 // safe (just in case the limit is target-specific or something like that), let's just set the
8169 // cap at half of that, i.e. 512 KiB.
8170 return len > 1024 * 512;
8171}
8172
81738129const mips_clobber_overrides = std.StaticStringMap(enum {
81748130 @"$msair",
81758131 @"$msacsr",
src/codegen/spirv/CodeGen.zig-2
......@@ -845,8 +845,6 @@ pub fn storageClass(cg: *const CodeGen, as: std.lang.AddressSpace) spec.StorageC
845845 .cog,
846846 .lut,
847847 .hub,
848 .externref,
849 .funcref,
850848 => unreachable,
851849 };
852850}
src/codegen/x86_64/CodeGen.zig+1763-2683
......@@ -4287,7 +4287,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
42874287 } },
42884288 }, .{
42894289 .required_cc_abi = .win64,
4290 .required_features = .{ .sse, null, null, null },
42914290 .src_constraints = .{
42924291 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
42934292 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -4300,6 +4299,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
43004299 .extra_temps = .{
43014300 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
43024301 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
4302 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
43034303 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
43044304 .unused,
43054305 .unused,
......@@ -4308,14 +4308,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
43084308 .unused,
43094309 .unused,
43104310 .unused,
4311 .unused,
43124311 },
4313 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4312 .dst_temps = .{ .mem, .unused },
43144313 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
43154314 .each = .{ .once = &.{
4316 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
4317 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
4318 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
4315 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
4316 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
4317 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
4318 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
43194319 } },
43204320 }, .{
43214321 .required_cc_abi = .sysv64,
......@@ -4427,79 +4427,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
44274427 } },
44284428 }, .{
44294429 .required_cc_abi = .win64,
4430 .required_features = .{ .avx, null, null, null },
4431 .src_constraints = .{
4432 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4433 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4434 .any,
4435 },
4436 .patterns = &.{
4437 .{ .src = .{ .to_mem, .to_mem, .none } },
4438 },
4439 .call_frame = .{ .alignment = .@"16" },
4440 .extra_temps = .{
4441 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
4442 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4443 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
4444 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
4445 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4446 .unused,
4447 .unused,
4448 .unused,
4449 .unused,
4450 .unused,
4451 .unused,
4452 },
4453 .dst_temps = .{ .mem, .unused },
4454 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4455 .each = .{ .once = &.{
4456 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
4457 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
4458 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
4459 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
4460 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
4461 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4462 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4463 } },
4464 }, .{
4465 .required_cc_abi = .win64,
4466 .required_features = .{ .sse2, null, null, null },
4467 .src_constraints = .{
4468 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4469 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4470 .any,
4471 },
4472 .patterns = &.{
4473 .{ .src = .{ .to_mem, .to_mem, .none } },
4474 },
4475 .call_frame = .{ .alignment = .@"16" },
4476 .extra_temps = .{
4477 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
4478 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4479 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
4480 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
4481 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4482 .unused,
4483 .unused,
4484 .unused,
4485 .unused,
4486 .unused,
4487 .unused,
4488 },
4489 .dst_temps = .{ .mem, .unused },
4490 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4491 .each = .{ .once = &.{
4492 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
4493 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
4494 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
4495 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
4496 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
4497 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4498 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4499 } },
4500 }, .{
4501 .required_cc_abi = .win64,
4502 .required_features = .{ .sse, null, null, null },
45034430 .src_constraints = .{
45044431 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
45054432 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -4513,8 +4440,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
45134440 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
45144441 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
45154442 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
4443 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
45164444 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
4517 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
45184445 .unused,
45194446 .unused,
45204447 .unused,
......@@ -4526,10 +4453,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
45264453 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
45274454 .each = .{ .once = &.{
45284455 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
4529 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
4530 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
4531 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
4532 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
4456 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
4457 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
4458 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
4459 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
45334460 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
45344461 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
45354462 } },
......@@ -15038,7 +14965,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1503814965 } },
1503914966 }, .{
1504014967 .required_cc_abi = .win64,
15041 .required_features = .{ .sse, null, null, null },
1504214968 .src_constraints = .{
1504314969 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
1504414970 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -15051,6 +14977,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1505114977 .extra_temps = .{
1505214978 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
1505314979 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
14980 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
1505414981 .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } },
1505514982 .unused,
1505614983 .unused,
......@@ -15059,14 +14986,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1505914986 .unused,
1506014987 .unused,
1506114988 .unused,
15062 .unused,
1506314989 },
15064 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
14990 .dst_temps = .{ .mem, .unused },
1506514991 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
1506614992 .each = .{ .once = &.{
15067 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
15068 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
15069 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
14993 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
14994 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
14995 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
14996 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
1507014997 } },
1507114998 }, .{
1507214999 .required_cc_abi = .sysv64,
......@@ -15178,79 +15105,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1517815105 } },
1517915106 }, .{
1518015107 .required_cc_abi = .win64,
15181 .required_features = .{ .avx, null, null, null },
15182 .src_constraints = .{
15183 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
15184 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
15185 .any,
15186 },
15187 .patterns = &.{
15188 .{ .src = .{ .to_mem, .to_mem, .none } },
15189 },
15190 .call_frame = .{ .alignment = .@"16" },
15191 .extra_temps = .{
15192 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
15193 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
15194 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
15195 .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } },
15196 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
15197 .unused,
15198 .unused,
15199 .unused,
15200 .unused,
15201 .unused,
15202 .unused,
15203 },
15204 .dst_temps = .{ .mem, .unused },
15205 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
15206 .each = .{ .once = &.{
15207 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
15208 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
15209 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
15210 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
15211 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
15212 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
15213 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
15214 } },
15215 }, .{
15216 .required_cc_abi = .win64,
15217 .required_features = .{ .sse2, null, null, null },
15218 .src_constraints = .{
15219 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
15220 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
15221 .any,
15222 },
15223 .patterns = &.{
15224 .{ .src = .{ .to_mem, .to_mem, .none } },
15225 },
15226 .call_frame = .{ .alignment = .@"16" },
15227 .extra_temps = .{
15228 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
15229 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
15230 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
15231 .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } },
15232 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
15233 .unused,
15234 .unused,
15235 .unused,
15236 .unused,
15237 .unused,
15238 .unused,
15239 },
15240 .dst_temps = .{ .mem, .unused },
15241 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
15242 .each = .{ .once = &.{
15243 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
15244 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
15245 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
15246 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
15247 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
15248 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
15249 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
15250 } },
15251 }, .{
15252 .required_cc_abi = .win64,
15253 .required_features = .{ .sse, null, null, null },
1525415108 .src_constraints = .{
1525515109 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
1525615110 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -15264,8 +15118,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1526415118 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
1526515119 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
1526615120 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
15121 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
1526715122 .{ .type = .usize, .kind = .{ .extern_func = "__subtf3" } },
15268 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
1526915123 .unused,
1527015124 .unused,
1527115125 .unused,
......@@ -15277,10 +15131,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
1527715131 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
1527815132 .each = .{ .once = &.{
1527915133 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
15280 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
15281 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
15282 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
15283 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
15134 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
15135 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
15136 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
15137 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
1528415138 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
1528515139 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
1528615140 } },
......@@ -24822,7 +24676,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2482224676 } },
2482324677 }, .{
2482424678 .required_cc_abi = .win64,
24825 .required_features = .{ .sse, null, null, null },
2482624679 .src_constraints = .{
2482724680 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
2482824681 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -24835,6 +24688,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2483524688 .extra_temps = .{
2483624689 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
2483724690 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
24691 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
2483824692 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
2483924693 .unused,
2484024694 .unused,
......@@ -24843,14 +24697,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2484324697 .unused,
2484424698 .unused,
2484524699 .unused,
24846 .unused,
2484724700 },
24848 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
24701 .dst_temps = .{ .mem, .unused },
2484924702 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
2485024703 .each = .{ .once = &.{
24851 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
24852 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
24853 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
24704 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
24705 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
24706 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
24707 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
2485424708 } },
2485524709 }, .{
2485624710 .required_cc_abi = .sysv64,
......@@ -24962,79 +24816,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2496224816 } },
2496324817 }, .{
2496424818 .required_cc_abi = .win64,
24965 .required_features = .{ .avx, null, null, null },
24966 .src_constraints = .{
24967 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
24968 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
24969 .any,
24970 },
24971 .patterns = &.{
24972 .{ .src = .{ .to_mem, .to_mem, .none } },
24973 },
24974 .call_frame = .{ .alignment = .@"16" },
24975 .extra_temps = .{
24976 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
24977 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
24978 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
24979 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
24980 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
24981 .unused,
24982 .unused,
24983 .unused,
24984 .unused,
24985 .unused,
24986 .unused,
24987 },
24988 .dst_temps = .{ .mem, .unused },
24989 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
24990 .each = .{ .once = &.{
24991 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
24992 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
24993 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
24994 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
24995 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
24996 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
24997 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
24998 } },
24999 }, .{
25000 .required_cc_abi = .win64,
25001 .required_features = .{ .sse2, null, null, null },
25002 .src_constraints = .{
25003 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
25004 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
25005 .any,
25006 },
25007 .patterns = &.{
25008 .{ .src = .{ .to_mem, .to_mem, .none } },
25009 },
25010 .call_frame = .{ .alignment = .@"16" },
25011 .extra_temps = .{
25012 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
25013 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
25014 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
25015 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
25016 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
25017 .unused,
25018 .unused,
25019 .unused,
25020 .unused,
25021 .unused,
25022 .unused,
25023 },
25024 .dst_temps = .{ .mem, .unused },
25025 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
25026 .each = .{ .once = &.{
25027 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
25028 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
25029 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
25030 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
25031 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
25032 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
25033 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
25034 } },
25035 }, .{
25036 .required_cc_abi = .win64,
25037 .required_features = .{ .sse, null, null, null },
2503824819 .src_constraints = .{
2503924820 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
2504024821 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -25048,8 +24829,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2504824829 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
2504924830 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
2505024831 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
24832 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
2505124833 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
25052 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
2505324834 .unused,
2505424835 .unused,
2505524836 .unused,
......@@ -25061,10 +24842,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2506124842 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
2506224843 .each = .{ .once = &.{
2506324844 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
25064 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
25065 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
25066 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
25067 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
24845 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
24846 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
24847 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
24848 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
2506824849 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
2506924850 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
2507024851 } },
......@@ -27770,10 +27551,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2777027551 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2777127552 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2777227553 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
27773 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
27774 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
27554 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
27555 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2777527556 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
27776 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
27557 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2777727558 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2777827559 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2777927560 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -27890,10 +27671,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2789027671 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2789127672 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2789227673 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
27893 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
27894 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
27674 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
27675 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2789527676 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
27896 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
27677 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2789727678 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2789827679 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2789927680 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28010,10 +27791,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2801027791 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2801127792 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2801227793 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28013 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
27794 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2801427795 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2801527796 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
28016 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
27797 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2801727798 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2801827799 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2801927800 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28130,10 +27911,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2813027911 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2813127912 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2813227913 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28133 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
27914 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2813427915 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2813527916 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
28136 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
27917 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2813727918 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2813827919 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2813927920 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28248,10 +28029,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2824828029 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2824928030 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2825028031 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28251 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28252 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
28032 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
28033 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2825328034 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
28254 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
28035 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2825528036 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2825628037 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2825728038 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28373,10 +28154,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2837328154 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2837428155 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2837528156 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28376 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28377 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
28157 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
28158 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2837828159 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
28379 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
28160 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2838028161 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2838128162 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2838228163 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28498,10 +28279,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2849828279 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2849928280 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2850028281 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28501 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28282 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2850228283 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2850328284 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
28504 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
28285 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2850528286 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2850628287 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2850728288 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28623,10 +28404,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2862328404 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2862428405 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2862528406 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28626 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28407 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2862728408 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2862828409 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
28629 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
28410 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2863028411 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2863128412 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2863228413 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28748,10 +28529,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2874828529 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2874928530 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2875028531 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28751 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28752 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
28532 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
28533 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2875328534 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
28754 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
28535 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2875528536 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2875628537 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2875728538 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -28878,10 +28659,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2887828659 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2887928660 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2888028661 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
28881 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28882 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
28662 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
28663 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2888328664 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
28884 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
28665 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2888528666 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2888628667 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2888728668 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29008,10 +28789,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2900828789 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2900928790 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2901028791 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29011 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28792 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2901228793 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2901328794 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
29014 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
28795 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2901528796 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2901628797 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2901728798 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29138,10 +28919,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2913828919 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2913928920 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2914028921 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29141 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
28922 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2914228923 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2914328924 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
29144 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
28925 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2914528926 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2914628927 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2914728928 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29268,10 +29049,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2926829049 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2926929050 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2927029051 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29271 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29272 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
29052 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
29053 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2927329054 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
29274 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
29055 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2927529056 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2927629057 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2927729058 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29399,10 +29180,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2939929180 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2940029181 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2940129182 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29402 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29403 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
29183 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
29184 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2940429185 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
29405 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
29186 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2940629187 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2940729188 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2940829189 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29530,10 +29311,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2953029311 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2953129312 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2953229313 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29533 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29314 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2953429315 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2953529316 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
29536 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
29317 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2953729318 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2953829319 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2953929320 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29661,10 +29442,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2966129442 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2966229443 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2966329444 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29664 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29445 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
2966529446 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
2966629447 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
29667 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
29448 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
2966829449 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2966929450 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2967029451 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29794,10 +29575,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2979429575 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2979529576 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2979629577 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29797 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29798 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
29578 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
29579 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2979929580 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
29800 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
29581 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2980129582 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2980229583 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2980329584 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -29920,10 +29701,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2992029701 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
2992129702 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
2992229703 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
29923 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29924 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
29704 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
29705 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
2992529706 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
29926 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
29707 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
2992729708 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
2992829709 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
2992929710 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30046,10 +29827,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3004629827 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3004729828 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3004829829 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30049 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29830 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
3005029831 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
3005129832 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
30052 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
29833 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
3005329834 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3005429835 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3005529836 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30172,10 +29953,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3017229953 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3017329954 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3017429955 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30175 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
29956 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
3017629957 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
3017729958 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
30178 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
29959 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
3017929960 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3018029961 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3018129962 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30298,10 +30079,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3029830079 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3029930080 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3030030081 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30301 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
30302 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
30082 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
30083 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
3030330084 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
30304 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
30085 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
3030530086 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3030630087 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3030730088 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30425,10 +30206,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3042530206 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3042630207 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3042730208 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30428 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
30429 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
30209 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
30210 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
3043030211 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
30431 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
30212 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
3043230213 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3043330214 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3043430215 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30552,10 +30333,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3055230333 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3055330334 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3055430335 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30555 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
30336 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
3055630337 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
3055730338 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
30558 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
30339 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
3055930340 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3056030341 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3056130342 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -30679,10 +30460,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3067930460 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
3068030461 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
3068130462 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
30682 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
30463 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
3068330464 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
3068430465 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
30685 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
30466 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
3068630467 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
3068730468 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
3068830469 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -33080,7 +32861,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3308032861 } },
3308132862 }, .{
3308232863 .required_cc_abi = .win64,
33083 .required_features = .{ .sse, null, null, null },
3308432864 .src_constraints = .{
3308532865 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
3308632866 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -33093,6 +32873,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3309332873 .extra_temps = .{
3309432874 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3309532875 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
32876 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3309632877 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3309732878 .unused,
3309832879 .unused,
......@@ -33101,14 +32882,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3310132882 .unused,
3310232883 .unused,
3310332884 .unused,
33104 .unused,
3310532885 },
33106 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
32886 .dst_temps = .{ .mem, .unused },
3310732887 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3310832888 .each = .{ .once = &.{
33109 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
33110 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
33111 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
32889 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
32890 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
32891 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
32892 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
3311232893 } },
3311332894 }, .{
3311432895 .required_cc_abi = .sysv64,
......@@ -33220,79 +33001,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3322033001 } },
3322133002 }, .{
3322233003 .required_cc_abi = .win64,
33223 .required_features = .{ .avx, null, null, null },
33224 .src_constraints = .{
33225 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
33226 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
33227 .any,
33228 },
33229 .patterns = &.{
33230 .{ .src = .{ .to_mem, .to_mem, .none } },
33231 },
33232 .call_frame = .{ .alignment = .@"16" },
33233 .extra_temps = .{
33234 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
33235 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
33236 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
33237 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
33238 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
33239 .unused,
33240 .unused,
33241 .unused,
33242 .unused,
33243 .unused,
33244 .unused,
33245 },
33246 .dst_temps = .{ .mem, .unused },
33247 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
33248 .each = .{ .once = &.{
33249 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
33250 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
33251 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
33252 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
33253 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
33254 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
33255 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
33256 } },
33257 }, .{
33258 .required_cc_abi = .win64,
33259 .required_features = .{ .sse2, null, null, null },
33260 .src_constraints = .{
33261 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
33262 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
33263 .any,
33264 },
33265 .patterns = &.{
33266 .{ .src = .{ .to_mem, .to_mem, .none } },
33267 },
33268 .call_frame = .{ .alignment = .@"16" },
33269 .extra_temps = .{
33270 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
33271 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
33272 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
33273 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
33274 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
33275 .unused,
33276 .unused,
33277 .unused,
33278 .unused,
33279 .unused,
33280 .unused,
33281 },
33282 .dst_temps = .{ .mem, .unused },
33283 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
33284 .each = .{ .once = &.{
33285 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
33286 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
33287 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
33288 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
33289 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
33290 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
33291 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
33292 } },
33293 }, .{
33294 .required_cc_abi = .win64,
33295 .required_features = .{ .sse, null, null, null },
3329633004 .src_constraints = .{
3329733005 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3329833006 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -33306,8 +33014,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3330633014 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
3330733015 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3330833016 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
33017 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3330933018 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
33310 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3331133019 .unused,
3331233020 .unused,
3331333021 .unused,
......@@ -33319,10 +33027,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3331933027 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3332033028 .each = .{ .once = &.{
3332133029 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
33322 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
33323 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
33324 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
33325 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
33030 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
33031 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
33032 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
33033 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
3332633034 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
3332733035 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3332833036 } },
......@@ -34453,7 +34161,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3445334161 } },
3445434162 }, .{
3445534163 .required_cc_abi = .win64,
34456 .required_features = .{ .avx, null, null, null },
3445734164 .src_constraints = .{
3445834165 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
3445934166 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -34464,97 +34171,28 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3446434171 },
3446534172 .call_frame = .{ .alignment = .@"16" },
3446634173 .extra_temps = .{
34467 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34468 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34469 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3447034174 .{ .type = .f128, .kind = .mem },
34471 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
34472 .unused,
34473 .unused,
34474 .unused,
34475 .unused,
34476 .unused,
34477 .unused,
34478 },
34479 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
34480 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
34481 .each = .{ .once = &.{
34482 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
34483 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
34484 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
34485 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
34486 .{ ._, .v_dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
34487 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
34488 } },
34489 }, .{
34490 .required_cc_abi = .win64,
34491 .required_features = .{ .sse2, null, null, null },
34492 .src_constraints = .{
34493 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
34494 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
34495 .any,
34496 },
34497 .patterns = &.{
34498 .{ .src = .{ .to_mem, .to_mem, .none } },
34499 },
34500 .call_frame = .{ .alignment = .@"16" },
34501 .extra_temps = .{
34502 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34503 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34504 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
34505 .{ .type = .f128, .kind = .mem },
34506 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
34507 .unused,
34508 .unused,
34509 .unused,
34510 .unused,
34511 .unused,
34512 .unused,
34513 },
34514 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
34515 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
34516 .each = .{ .once = &.{
34517 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
34518 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
34519 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
34520 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
34521 .{ ._, ._dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
34522 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
34523 } },
34524 }, .{
34525 .required_cc_abi = .win64,
34526 .required_features = .{ .sse, null, null, null },
34527 .src_constraints = .{
34528 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
34529 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
34530 .any,
34531 },
34532 .patterns = &.{
34533 .{ .src = .{ .to_mem, .to_mem, .none } },
34534 },
34535 .call_frame = .{ .alignment = .@"16" },
34536 .extra_temps = .{
3453734175 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3453834176 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34177 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3453934178 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
34540 .{ .type = .f128, .kind = .mem },
3454134179 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
3454234180 .unused,
3454334181 .unused,
3454434182 .unused,
3454534183 .unused,
3454634184 .unused,
34547 .unused,
3454834185 },
34549 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
34186 .dst_temps = .{ .mem, .unused },
3455034187 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3455134188 .each = .{ .once = &.{
34552 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
34553 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
34554 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
34555 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
34556 .{ ._, ._ps, .mova, .lea(.tmp0x), .dst0x, ._, ._ },
34189 .{ ._, ._, .lea, .tmp1p, .mem(.tmp0), ._, ._ },
34190 .{ ._, ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
34191 .{ ._, ._, .lea, .tmp3p, .mem(.src1), ._, ._ },
3455734192 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
34193 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
34194 .{ ._, ._, .lea, .tmp2p, .mem(.tmp0), ._, ._ },
34195 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
3455834196 } },
3455934197 }, .{
3456034198 .required_cc_abi = .sysv64,
......@@ -34669,7 +34307,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3466934307 } },
3467034308 }, .{
3467134309 .required_cc_abi = .win64,
34672 .required_features = .{ .avx, null, null, null },
3467334310 .src_constraints = .{
3467434311 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3467534312 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -34681,89 +34318,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3468134318 .call_frame = .{ .alignment = .@"16" },
3468234319 .extra_temps = .{
3468334320 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
34684 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34685 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34686 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3468734321 .{ .type = .f128, .kind = .mem },
34688 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34689 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
34690 .unused,
34691 .unused,
34692 .unused,
34693 .unused,
34694 },
34695 .dst_temps = .{ .mem, .unused },
34696 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
34697 .each = .{ .once = &.{
34698 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
34699 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
34700 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
34701 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
34702 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
34703 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
34704 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
34705 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
34706 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
34707 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
34708 } },
34709 }, .{
34710 .required_cc_abi = .win64,
34711 .required_features = .{ .sse2, null, null, null },
34712 .src_constraints = .{
34713 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
34714 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
34715 .any,
34716 },
34717 .patterns = &.{
34718 .{ .src = .{ .to_mem, .to_mem, .none } },
34719 },
34720 .call_frame = .{ .alignment = .@"16" },
34721 .extra_temps = .{
34722 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
34723 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34724 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34725 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
34726 .{ .type = .f128, .kind = .mem },
34727 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
34728 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
34729 .unused,
34730 .unused,
34731 .unused,
34732 .unused,
34733 },
34734 .dst_temps = .{ .mem, .unused },
34735 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
34736 .each = .{ .once = &.{
34737 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
34738 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
34739 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
34740 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
34741 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
34742 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
34743 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
34744 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
34745 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
34746 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
34747 } },
34748 }, .{
34749 .required_cc_abi = .win64,
34750 .required_features = .{ .sse, null, null, null },
34751 .src_constraints = .{
34752 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
34753 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
34754 .any,
34755 },
34756 .patterns = &.{
34757 .{ .src = .{ .to_mem, .to_mem, .none } },
34758 },
34759 .call_frame = .{ .alignment = .@"16" },
34760 .extra_temps = .{
34761 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
3476234322 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3476334323 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
34324 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3476434325 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
34765 .{ .type = .f128, .kind = .mem },
34766 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3476734326 .{ .type = .usize, .kind = .{ .extern_func = "truncf128" } },
3476834327 .unused,
3476934328 .unused,
......@@ -34774,13 +34333,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3477434333 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3477534334 .each = .{ .once = &.{
3477634335 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
34777 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
34778 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
34779 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
34780 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
34781 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp5x, ._, ._ },
34336 .{ .@"0:", ._, .lea, .tmp2p, .mem(.tmp1), ._, ._ },
34337 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
34338 .{ ._, ._, .lea, .tmp4p, .memi(.src1, .tmp0), ._, ._ },
34339 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
34340 .{ ._, ._, .lea, .tmp2p, .memi(.dst0, .tmp0), ._, ._ },
34341 .{ ._, ._, .lea, .tmp3p, .mem(.tmp1), ._, ._ },
3478234342 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
34783 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
3478434343 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
3478534344 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3478634345 } },
......@@ -35979,7 +35538,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3597935538 } },
3598035539 }, .{
3598135540 .required_cc_abi = .win64,
35982 .required_features = .{ .avx, null, null, null },
3598335541 .src_constraints = .{
3598435542 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
3598535543 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -35990,10 +35548,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3599035548 },
3599135549 .call_frame = .{ .alignment = .@"16" },
3599235550 .extra_temps = .{
35551 .{ .type = .f128, .kind = .mem },
3599335552 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3599435553 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
35554 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3599535555 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
35996 .{ .type = .f128, .kind = .mem },
3599735556 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
3599835557 else => unreachable,
3599935558 .zero => "truncf128",
......@@ -36004,24 +35563,24 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3600435563 .unused,
3600535564 .unused,
3600635565 .unused,
36007 .unused,
3600835566 },
36009 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
35567 .dst_temps = .{ .mem, .unused },
3601035568 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3601135569 .each = .{ .once = &.{
36012 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
36013 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
36014 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
36015 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
36016 .{ ._, .v_dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
35570 .{ ._, ._, .lea, .tmp1p, .mem(.tmp0), ._, ._ },
35571 .{ ._, ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
35572 .{ ._, ._, .lea, .tmp3p, .mem(.src1), ._, ._ },
3601735573 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
35574 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
35575 .{ ._, ._, .lea, .tmp2p, .mem(.tmp0), ._, ._ },
35576 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
3601835577 } },
3601935578 }, .{
36020 .required_cc_abi = .win64,
36021 .required_features = .{ .sse2, null, null, null },
35579 .required_cc_abi = .sysv64,
35580 .required_features = .{ .avx, null, null, null },
3602235581 .src_constraints = .{
36023 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
36024 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
35582 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
35583 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3602535584 .any,
3602635585 },
3602735586 .patterns = &.{
......@@ -36029,10 +35588,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3602935588 },
3603035589 .call_frame = .{ .alignment = .@"16" },
3603135590 .extra_temps = .{
36032 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36033 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
35591 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
35592 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
35593 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
3603435594 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36035 .{ .type = .f128, .kind = .mem },
3603635595 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
3603735596 else => unreachable,
3603835597 .zero => "truncf128",
......@@ -36045,22 +35604,24 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3604535604 .unused,
3604635605 .unused,
3604735606 },
36048 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
35607 .dst_temps = .{ .mem, .unused },
3604935608 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3605035609 .each = .{ .once = &.{
36051 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
36052 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
36053 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
36054 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
36055 .{ ._, ._dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
35610 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
35611 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
35612 .{ ._, .v_dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
35613 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
3605635614 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
35615 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
35616 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
35617 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3605735618 } },
3605835619 }, .{
36059 .required_cc_abi = .win64,
36060 .required_features = .{ .sse, null, null, null },
35620 .required_cc_abi = .sysv64,
35621 .required_features = .{ .sse2, null, null, null },
3606135622 .src_constraints = .{
36062 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
36063 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
35623 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
35624 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3606435625 .any,
3606535626 },
3606635627 .patterns = &.{
......@@ -36068,10 +35629,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3606835629 },
3606935630 .call_frame = .{ .alignment = .@"16" },
3607035631 .extra_temps = .{
36071 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36072 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
35632 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
35633 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
35634 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
3607335635 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36074 .{ .type = .f128, .kind = .mem },
3607535636 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
3607635637 else => unreachable,
3607735638 .zero => "truncf128",
......@@ -36084,101 +35645,21 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3608435645 .unused,
3608535646 .unused,
3608635647 },
36087 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
35648 .dst_temps = .{ .mem, .unused },
3608835649 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3608935650 .each = .{ .once = &.{
36090 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
36091 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
36092 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
36093 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
36094 .{ ._, ._ps, .mova, .lea(.tmp0x), .dst0x, ._, ._ },
35651 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
35652 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
35653 .{ ._, ._dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
35654 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
3609535655 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
35656 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
35657 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
35658 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3609635659 } },
3609735660 }, .{
3609835661 .required_cc_abi = .sysv64,
36099 .required_features = .{ .avx, null, null, null },
36100 .src_constraints = .{
36101 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36102 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36103 .any,
36104 },
36105 .patterns = &.{
36106 .{ .src = .{ .to_mem, .to_mem, .none } },
36107 },
36108 .call_frame = .{ .alignment = .@"16" },
36109 .extra_temps = .{
36110 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
36111 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36112 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
36113 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36114 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
36115 else => unreachable,
36116 .zero => "truncf128",
36117 .down => "floorf128",
36118 } } },
36119 .unused,
36120 .unused,
36121 .unused,
36122 .unused,
36123 .unused,
36124 .unused,
36125 },
36126 .dst_temps = .{ .mem, .unused },
36127 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
36128 .each = .{ .once = &.{
36129 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
36130 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
36131 .{ ._, .v_dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
36132 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
36133 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
36134 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
36135 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
36136 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
36137 } },
36138 }, .{
36139 .required_cc_abi = .sysv64,
36140 .required_features = .{ .sse2, null, null, null },
36141 .src_constraints = .{
36142 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36143 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36144 .any,
36145 },
36146 .patterns = &.{
36147 .{ .src = .{ .to_mem, .to_mem, .none } },
36148 },
36149 .call_frame = .{ .alignment = .@"16" },
36150 .extra_temps = .{
36151 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
36152 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36153 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
36154 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36155 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
36156 else => unreachable,
36157 .zero => "truncf128",
36158 .down => "floorf128",
36159 } } },
36160 .unused,
36161 .unused,
36162 .unused,
36163 .unused,
36164 .unused,
36165 .unused,
36166 },
36167 .dst_temps = .{ .mem, .unused },
36168 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
36169 .each = .{ .once = &.{
36170 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
36171 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
36172 .{ ._, ._dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
36173 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
36174 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
36175 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
36176 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
36177 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
36178 } },
36179 }, .{
36180 .required_cc_abi = .sysv64,
36181 .required_features = .{ .sse, null, null, null },
35662 .required_features = .{ .sse, null, null, null },
3618235663 .src_constraints = .{
3618335664 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3618435665 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -36219,7 +35700,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3621935700 } },
3622035701 }, .{
3622135702 .required_cc_abi = .win64,
36222 .required_features = .{ .avx, null, null, null },
3622335703 .src_constraints = .{
3622435704 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3622535705 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -36231,97 +35711,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3623135711 .call_frame = .{ .alignment = .@"16" },
3623235712 .extra_temps = .{
3623335713 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
36234 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36235 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
36236 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3623735714 .{ .type = .f128, .kind = .mem },
36238 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36239 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
36240 else => unreachable,
36241 .zero => "truncf128",
36242 .down => "floorf128",
36243 } } },
36244 .unused,
36245 .unused,
36246 .unused,
36247 .unused,
36248 },
36249 .dst_temps = .{ .mem, .unused },
36250 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
36251 .each = .{ .once = &.{
36252 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
36253 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
36254 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
36255 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
36256 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
36257 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
36258 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
36259 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
36260 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
36261 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
36262 } },
36263 }, .{
36264 .required_cc_abi = .win64,
36265 .required_features = .{ .sse2, null, null, null },
36266 .src_constraints = .{
36267 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36268 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36269 .any,
36270 },
36271 .patterns = &.{
36272 .{ .src = .{ .to_mem, .to_mem, .none } },
36273 },
36274 .call_frame = .{ .alignment = .@"16" },
36275 .extra_temps = .{
36276 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
36277 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36278 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
36279 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36280 .{ .type = .f128, .kind = .mem },
36281 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
36282 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
36283 else => unreachable,
36284 .zero => "truncf128",
36285 .down => "floorf128",
36286 } } },
36287 .unused,
36288 .unused,
36289 .unused,
36290 .unused,
36291 },
36292 .dst_temps = .{ .mem, .unused },
36293 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
36294 .each = .{ .once = &.{
36295 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
36296 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
36297 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
36298 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
36299 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
36300 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
36301 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
36302 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
36303 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
36304 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
36305 } },
36306 }, .{
36307 .required_cc_abi = .win64,
36308 .required_features = .{ .sse, null, null, null },
36309 .src_constraints = .{
36310 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36311 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
36312 .any,
36313 },
36314 .patterns = &.{
36315 .{ .src = .{ .to_mem, .to_mem, .none } },
36316 },
36317 .call_frame = .{ .alignment = .@"16" },
36318 .extra_temps = .{
36319 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
3632035715 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3632135716 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
35717 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3632235718 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
36323 .{ .type = .f128, .kind = .mem },
36324 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3632535719 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
3632635720 else => unreachable,
3632735721 .zero => "truncf128",
......@@ -36336,13 +35730,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3633635730 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3633735731 .each = .{ .once = &.{
3633835732 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
36339 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
36340 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
36341 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
36342 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
36343 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp5x, ._, ._ },
35733 .{ .@"0:", ._, .lea, .tmp2p, .mem(.tmp1), ._, ._ },
35734 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
35735 .{ ._, ._, .lea, .tmp4p, .memi(.src1, .tmp0), ._, ._ },
35736 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
35737 .{ ._, ._, .lea, .tmp2p, .memi(.dst0, .tmp0), ._, ._ },
35738 .{ ._, ._, .lea, .tmp3p, .mem(.tmp1), ._, ._ },
3634435739 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
36345 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
3634635740 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
3634735741 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3634835742 } },
......@@ -37708,7 +37102,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3770837102 } },
3770937103 }, .{
3771037104 .required_cc_abi = .win64,
37711 .required_features = .{ .avx, null, null, null },
3771237105 .src_constraints = .{
3771337106 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
3771437107 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -37719,97 +37112,28 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3771937112 },
3772037113 .call_frame = .{ .alignment = .@"16" },
3772137114 .extra_temps = .{
37722 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37723 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37724 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3772537115 .{ .type = .f128, .kind = .mem },
37726 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
37727 .unused,
37728 .unused,
37729 .unused,
37730 .unused,
37731 .unused,
37732 .unused,
37733 },
37734 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
37735 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
37736 .each = .{ .once = &.{
37737 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
37738 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
37739 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
37740 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
37741 .{ ._, .v_dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
37742 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
37743 } },
37744 }, .{
37745 .required_cc_abi = .win64,
37746 .required_features = .{ .sse2, null, null, null },
37747 .src_constraints = .{
37748 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
37749 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
37750 .any,
37751 },
37752 .patterns = &.{
37753 .{ .src = .{ .to_mem, .to_mem, .none } },
37754 },
37755 .call_frame = .{ .alignment = .@"16" },
37756 .extra_temps = .{
37757 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37758 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37759 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
37760 .{ .type = .f128, .kind = .mem },
37761 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
37762 .unused,
37763 .unused,
37764 .unused,
37765 .unused,
37766 .unused,
37767 .unused,
37768 },
37769 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
37770 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
37771 .each = .{ .once = &.{
37772 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
37773 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
37774 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
37775 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
37776 .{ ._, ._dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
37777 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
37778 } },
37779 }, .{
37780 .required_cc_abi = .win64,
37781 .required_features = .{ .sse, null, null, null },
37782 .src_constraints = .{
37783 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
37784 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
37785 .any,
37786 },
37787 .patterns = &.{
37788 .{ .src = .{ .to_mem, .to_mem, .none } },
37789 },
37790 .call_frame = .{ .alignment = .@"16" },
37791 .extra_temps = .{
3779237116 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3779337117 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37118 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3779437119 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
37795 .{ .type = .f128, .kind = .mem },
3779637120 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
3779737121 .unused,
3779837122 .unused,
3779937123 .unused,
3780037124 .unused,
3780137125 .unused,
37802 .unused,
3780337126 },
37804 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
37127 .dst_temps = .{ .mem, .unused },
3780537128 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3780637129 .each = .{ .once = &.{
37807 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
37808 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
37809 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
37810 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
37811 .{ ._, ._ps, .mova, .lea(.tmp0x), .dst0x, ._, ._ },
37130 .{ ._, ._, .lea, .tmp1p, .mem(.tmp0), ._, ._ },
37131 .{ ._, ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
37132 .{ ._, ._, .lea, .tmp3p, .mem(.src1), ._, ._ },
3781237133 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
37134 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
37135 .{ ._, ._, .lea, .tmp2p, .mem(.tmp0), ._, ._ },
37136 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
3781337137 } },
3781437138 }, .{
3781537139 .required_cc_abi = .sysv64,
......@@ -37924,7 +37248,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3792437248 } },
3792537249 }, .{
3792637250 .required_cc_abi = .win64,
37927 .required_features = .{ .avx, null, null, null },
3792837251 .src_constraints = .{
3792937252 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3793037253 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -37936,89 +37259,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3793637259 .call_frame = .{ .alignment = .@"16" },
3793737260 .extra_temps = .{
3793837261 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
37939 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37940 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37941 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
3794237262 .{ .type = .f128, .kind = .mem },
37943 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37944 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
37945 .unused,
37946 .unused,
37947 .unused,
37948 .unused,
37949 },
37950 .dst_temps = .{ .mem, .unused },
37951 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
37952 .each = .{ .once = &.{
37953 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
37954 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
37955 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
37956 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
37957 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
37958 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
37959 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
37960 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
37961 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
37962 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
37963 } },
37964 }, .{
37965 .required_cc_abi = .win64,
37966 .required_features = .{ .sse2, null, null, null },
37967 .src_constraints = .{
37968 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
37969 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
37970 .any,
37971 },
37972 .patterns = &.{
37973 .{ .src = .{ .to_mem, .to_mem, .none } },
37974 },
37975 .call_frame = .{ .alignment = .@"16" },
37976 .extra_temps = .{
37977 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
37978 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37979 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37980 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
37981 .{ .type = .f128, .kind = .mem },
37982 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
37983 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
37984 .unused,
37985 .unused,
37986 .unused,
37987 .unused,
37988 },
37989 .dst_temps = .{ .mem, .unused },
37990 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
37991 .each = .{ .once = &.{
37992 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
37993 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
37994 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
37995 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
37996 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
37997 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp5x, ._, ._ },
37998 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
37999 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
38000 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
38001 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
38002 } },
38003 }, .{
38004 .required_cc_abi = .win64,
38005 .required_features = .{ .sse, null, null, null },
38006 .src_constraints = .{
38007 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
38008 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
38009 .any,
38010 },
38011 .patterns = &.{
38012 .{ .src = .{ .to_mem, .to_mem, .none } },
38013 },
38014 .call_frame = .{ .alignment = .@"16" },
38015 .extra_temps = .{
38016 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
3801737263 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3801837264 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
37265 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3801937266 .{ .type = .usize, .kind = .{ .extern_func = "__divtf3" } },
38020 .{ .type = .f128, .kind = .mem },
38021 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3802237267 .{ .type = .usize, .kind = .{ .extern_func = "floorf128" } },
3802337268 .unused,
3802437269 .unused,
......@@ -38029,13 +37274,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3802937274 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3803037275 .each = .{ .once = &.{
3803137276 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
38032 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0x, .tmp0), ._, ._ },
38033 .{ ._, ._, .lea, .tmp2p, .memi(.src1x, .tmp0), ._, ._ },
38034 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
38035 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
38036 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp5x, ._, ._ },
37277 .{ .@"0:", ._, .lea, .tmp2p, .mem(.tmp1), ._, ._ },
37278 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
37279 .{ ._, ._, .lea, .tmp4p, .memi(.src1, .tmp0), ._, ._ },
37280 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
37281 .{ ._, ._, .lea, .tmp2p, .memi(.dst0, .tmp0), ._, ._ },
37282 .{ ._, ._, .lea, .tmp3p, .mem(.tmp1), ._, ._ },
3803737283 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
38038 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
3803937284 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
3804037285 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3804137286 } },
......@@ -39575,7 +38820,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3957538820 } },
3957638821 }, .{
3957738822 .required_cc_abi = .win64,
39578 .required_features = .{ .sse, null, null, null },
3957938823 .src_constraints = .{
3958038824 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
3958138825 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -39588,6 +38832,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3958838832 .extra_temps = .{
3958938833 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3959038834 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
38835 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3959138836 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
3959238837 .unused,
3959338838 .unused,
......@@ -39596,14 +38841,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3959638841 .unused,
3959738842 .unused,
3959838843 .unused,
39599 .unused,
3960038844 },
39601 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
38845 .dst_temps = .{ .mem, .unused },
3960238846 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3960338847 .each = .{ .once = &.{
39604 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
39605 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
39606 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
38848 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
38849 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
38850 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
38851 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
3960738852 } },
3960838853 }, .{
3960938854 .required_cc_abi = .sysv64,
......@@ -39715,79 +38960,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3971538960 } },
3971638961 }, .{
3971738962 .required_cc_abi = .win64,
39718 .required_features = .{ .avx, null, null, null },
39719 .src_constraints = .{
39720 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
39721 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
39722 .any,
39723 },
39724 .patterns = &.{
39725 .{ .src = .{ .to_mem, .to_mem, .none } },
39726 },
39727 .call_frame = .{ .alignment = .@"16" },
39728 .extra_temps = .{
39729 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
39730 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
39731 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
39732 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
39733 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
39734 .unused,
39735 .unused,
39736 .unused,
39737 .unused,
39738 .unused,
39739 .unused,
39740 },
39741 .dst_temps = .{ .mem, .unused },
39742 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
39743 .each = .{ .once = &.{
39744 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
39745 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
39746 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
39747 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
39748 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
39749 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
39750 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
39751 } },
39752 }, .{
39753 .required_cc_abi = .win64,
39754 .required_features = .{ .sse2, null, null, null },
39755 .src_constraints = .{
39756 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
39757 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
39758 .any,
39759 },
39760 .patterns = &.{
39761 .{ .src = .{ .to_mem, .to_mem, .none } },
39762 },
39763 .call_frame = .{ .alignment = .@"16" },
39764 .extra_temps = .{
39765 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
39766 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
39767 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
39768 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
39769 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
39770 .unused,
39771 .unused,
39772 .unused,
39773 .unused,
39774 .unused,
39775 .unused,
39776 },
39777 .dst_temps = .{ .mem, .unused },
39778 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
39779 .each = .{ .once = &.{
39780 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
39781 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
39782 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
39783 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
39784 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
39785 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
39786 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
39787 } },
39788 }, .{
39789 .required_cc_abi = .win64,
39790 .required_features = .{ .sse, null, null, null },
3979138963 .src_constraints = .{
3979238964 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
3979338965 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -39801,8 +38973,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3980138973 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
3980238974 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3980338975 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
38976 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
3980438977 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
39805 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
3980638978 .unused,
3980738979 .unused,
3980838980 .unused,
......@@ -39814,10 +38986,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
3981438986 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
3981538987 .each = .{ .once = &.{
3981638988 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
39817 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
39818 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
39819 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
39820 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
38989 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
38990 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
38991 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
38992 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
3982138993 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
3982238994 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
3982338995 } },
......@@ -40229,8 +39401,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4022939401 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4023039402 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4023139403 .each = .{ .once = &.{
40232 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40233 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39404 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39405 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4023439406 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4023539407 .{ ._, .v_q, .mov, .dst0q0, .tmp1x, ._, ._ },
4023639408 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40271,8 +39443,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4027139443 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4027239444 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4027339445 .each = .{ .once = &.{
40274 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40275 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39446 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39447 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4027639448 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4027739449 .{ ._, ._q, .mov, .dst0q0, .tmp1x, ._, ._ },
4027839450 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40313,8 +39485,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4031339485 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4031439486 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4031539487 .each = .{ .once = &.{
40316 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40317 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39488 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39489 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4031839490 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4031939491 .{ ._, ._q, .mov, .dst0q0, .tmp1x, ._, ._ },
4032039492 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40356,8 +39528,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4035639528 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4035739529 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4035839530 .each = .{ .once = &.{
40359 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40360 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39531 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39532 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4036139533 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4036239534 .{ ._, ._ps, .mova, .mem(.tmp2x), .tmp1x, ._, ._ },
4036339535 .{ ._, ._, .mov, .tmp3q, .memd(.src1q, 8), ._, ._ },
......@@ -40399,8 +39571,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4039939571 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4040039572 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4040139573 .each = .{ .once = &.{
40402 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40403 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39574 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39575 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4040439576 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4040539577 .{ ._, .v_q, .mov, .dst0q0, .tmp1x, ._, ._ },
4040639578 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40439,8 +39611,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4043939611 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4044039612 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4044139613 .each = .{ .once = &.{
40442 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40443 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39614 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39615 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4044439616 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4044539617 .{ ._, ._q, .mov, .dst0q0, .tmp1x, ._, ._ },
4044639618 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40479,8 +39651,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4047939651 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4048039652 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4048139653 .each = .{ .once = &.{
40482 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40483 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39654 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39655 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4048439656 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4048539657 .{ ._, ._q, .mov, .dst0q0, .tmp1x, ._, ._ },
4048639658 .{ ._, ._, .mov, .tmp2q, .memd(.src1q, 8), ._, ._ },
......@@ -40520,8 +39692,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4052039692 .dst_temps = .{ .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
4052139693 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4052239694 .each = .{ .once = &.{
40523 .{ ._, ._, .lea, .dst0q0, .mem(.src0), ._, ._ },
40524 .{ ._, ._, .lea, .dst0q1, .mem(.src1), ._, ._ },
39695 .{ ._, ._, .lea, .dst0p0, .mem(.src0), ._, ._ },
39696 .{ ._, ._, .lea, .dst0p1, .mem(.src1), ._, ._ },
4052539697 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
4052639698 .{ ._, ._ps, .mova, .mem(.tmp2x), .tmp1x, ._, ._ },
4052739699 .{ ._, ._, .mov, .tmp3q, .memd(.src1q, 8), ._, ._ },
......@@ -42969,52 +42141,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4296942141 } },
4297042142 }, .{
4297142143 .required_cc_abi = .win64,
42972 .required_features = .{ .@"64bit", .avx, null, null },
42973 .src_constraints = .{
42974 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
42975 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
42976 .any,
42977 },
42978 .patterns = &.{
42979 .{ .src = .{ .to_mem, .to_mem, .none } },
42980 },
42981 .call_frame = .{ .alignment = .@"16" },
42982 .extra_temps = .{
42983 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
42984 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
42985 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
42986 .{ .type = .f128, .kind = .mem },
42987 .{ .type = .f128, .kind = .{ .reg = .xmm1 } },
42988 .{ .type = .u64, .kind = .{ .reg = .rax } },
42989 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
42990 .unused,
42991 .unused,
42992 .unused,
42993 .unused,
42994 },
42995 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
42996 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
42997 .each = .{ .once = &.{
42998 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
42999 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43000 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
43001 .{ ._, ._, .mov, .tmp0q, .ua(.src0, .add_smin), ._, ._ },
43002 .{ ._, .vp_q, .extr, .tmp1q, .dst0x, .ui(1), ._ },
43003 .{ ._, ._, .mov, .tmp5q, .tmp0q, ._, ._ },
43004 .{ ._, ._, .@"and", .tmp5q, .memd(.src1q, 8), ._, ._ },
43005 .{ ._, ._, .xor, .tmp5q, .tmp1q, ._, ._ },
43006 .{ ._, .v_q, .mov, .tmp1q, .dst0x, ._, ._ },
43007 .{ ._, ._, .cmp, .tmp1q, .si(1), ._, ._ },
43008 .{ ._, ._, .sbb, .tmp5q, .tmp0q, ._, ._ },
43009 .{ ._, ._nae, .j, .@"0f", ._, ._, ._ },
43010 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
43011 .{ ._, .v_dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
43012 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43013 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
43014 } },
43015 }, .{
43016 .required_cc_abi = .win64,
43017 .required_features = .{ .@"64bit", .sse4_1, null, null },
42144 .required_features = .{ .@"64bit", null, null, null },
4301842145 .src_constraints = .{
4301942146 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
4302042147 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -43027,125 +42154,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4302742154 .extra_temps = .{
4302842155 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4302942156 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
42157 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
4303042158 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
43031 .{ .type = .f128, .kind = .mem },
43032 .{ .type = .f128, .kind = .{ .reg = .xmm1 } },
4303342159 .{ .type = .u64, .kind = .{ .reg = .rax } },
43034 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
43035 .unused,
43036 .unused,
43037 .unused,
43038 .unused,
43039 },
43040 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
43041 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
43042 .each = .{ .once = &.{
43043 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
43044 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43045 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
43046 .{ ._, ._, .mov, .tmp0q, .ua(.src0, .add_smin), ._, ._ },
43047 .{ ._, .p_q, .extr, .tmp1q, .dst0x, .ui(1), ._ },
43048 .{ ._, ._, .mov, .tmp5q, .tmp0q, ._, ._ },
43049 .{ ._, ._, .@"and", .tmp5q, .memd(.src1q, 8), ._, ._ },
43050 .{ ._, ._, .xor, .tmp5q, .tmp1q, ._, ._ },
43051 .{ ._, ._q, .mov, .tmp1q, .dst0x, ._, ._ },
43052 .{ ._, ._, .cmp, .tmp1q, .si(1), ._, ._ },
43053 .{ ._, ._, .sbb, .tmp5q, .tmp0q, ._, ._ },
43054 .{ ._, ._nae, .j, .@"0f", ._, ._, ._ },
43055 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
43056 .{ ._, ._dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
43057 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43058 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
43059 } },
43060 }, .{
43061 .required_cc_abi = .win64,
43062 .required_features = .{ .@"64bit", .sse2, null, null },
43063 .src_constraints = .{
43064 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
43065 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
43066 .any,
43067 },
43068 .patterns = &.{
43069 .{ .src = .{ .to_mem, .to_mem, .none } },
43070 },
43071 .call_frame = .{ .alignment = .@"16" },
43072 .extra_temps = .{
43073 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
43074 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
43075 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
4307642160 .{ .type = .f128, .kind = .mem },
43077 .{ .type = .f128, .kind = .{ .reg = .xmm1 } },
43078 .{ .type = .u64, .kind = .{ .reg = .rax } },
4307942161 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
4308042162 .unused,
4308142163 .unused,
4308242164 .unused,
4308342165 .unused,
4308442166 },
43085 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
42167 .dst_temps = .{ .mem, .unused },
4308642168 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4308742169 .each = .{ .once = &.{
43088 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
43089 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43090 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
43091 .{ ._, .p_d, .shuf, .tmp4x, .dst0x, .ui(0b11_10_11_10), ._ },
42170 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
42171 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
42172 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
42173 .{ ._, ._, .call, .tmp3p, ._, ._, ._ },
4309242174 .{ ._, ._, .mov, .tmp0q, .ua(.src0, .add_smin), ._, ._ },
43093 .{ ._, ._q, .mov, .tmp1q, .tmp4x, ._, ._ },
43094 .{ ._, ._, .mov, .tmp5q, .tmp0q, ._, ._ },
43095 .{ ._, ._, .@"and", .tmp5q, .memd(.src1q, 8), ._, ._ },
43096 .{ ._, ._, .xor, .tmp5q, .tmp1q, ._, ._ },
43097 .{ ._, ._q, .mov, .tmp1q, .dst0x, ._, ._ },
43098 .{ ._, ._, .cmp, .tmp1q, .si(1), ._, ._ },
43099 .{ ._, ._, .sbb, .tmp5q, .tmp0q, ._, ._ },
42175 .{ ._, ._, .mov, .tmp1q, .tmp0q, ._, ._ },
42176 .{ ._, ._, .@"and", .tmp1q, .memd(.src1q, 8), ._, ._ },
42177 .{ ._, ._, .mov, .tmp2q, .memd(.dst0q, 8), ._, ._ },
42178 .{ ._, ._, .xor, .tmp1q, .tmp2q, ._, ._ },
42179 .{ ._, ._, .mov, .tmp4q, .mem(.dst0q), ._, ._ },
42180 .{ ._, ._, .cmp, .tmp4q, .si(1), ._, ._ },
42181 .{ ._, ._, .sbb, .tmp1q, .tmp0q, ._, ._ },
4310042182 .{ ._, ._nae, .j, .@"0f", ._, ._, ._ },
43101 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
43102 .{ ._, ._dqa, .mov, .lea(.tmp0x), .dst0x, ._, ._ },
43103 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
42183 .{ ._, ._, .mov, .mem(.tmp5q), .tmp4q, ._, ._ },
42184 .{ ._, ._, .mov, .memd(.tmp5q, 8), .tmp2q, ._, ._ },
42185 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
42186 .{ ._, ._, .lea, .tmp1p, .mem(.tmp5), ._, ._ },
4310442187 .{ ._, ._, .call, .tmp6d, ._, ._, ._ },
4310542188 } },
43106 }, .{
43107 .required_cc_abi = .win64,
43108 .required_features = .{ .@"64bit", .sse, null, null },
43109 .src_constraints = .{
43110 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
43111 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
43112 .any,
43113 },
43114 .patterns = &.{
43115 .{ .src = .{ .to_mem, .to_mem, .none } },
43116 },
43117 .call_frame = .{ .alignment = .@"16" },
43118 .extra_temps = .{
43119 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
43120 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
43121 .{ .type = .usize, .kind = .{ .extern_func = "fmodf128" } },
43122 .{ .type = .f128, .kind = .mem },
43123 .{ .type = .usize, .kind = .{ .reg = .rax } },
43124 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
43125 .unused,
43126 .unused,
43127 .unused,
43128 .unused,
43129 .unused,
43130 },
43131 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
43132 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
43133 .each = .{ .once = &.{
43134 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
43135 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43136 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
43137 .{ ._, ._, .lea, .tmp0p, .mem(.tmp3), ._, ._ },
43138 .{ ._, ._, .mov, .tmp1q, .ua(.src0, .add_smin), ._, ._ },
43139 .{ ._, ._ps, .mova, .lea(.tmp0x), .dst0x, ._, ._ },
43140 .{ ._, ._, .mov, .tmp4q, .tmp1q, ._, ._ },
43141 .{ ._, ._, .@"and", .tmp4q, .memd(.src1q, 8), ._, ._ },
43142 .{ ._, ._, .xor, .tmp4q, .lead(.tmp0q, 8), ._, ._ },
43143 .{ ._, ._, .cmp, .lea(.tmp0q), .si(1), ._, ._ },
43144 .{ ._, ._, .sbb, .tmp4q, .tmp1q, ._, ._ },
43145 .{ ._, ._nae, .j, .@"0f", ._, ._, ._ },
43146 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
43147 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
43148 } },
4314942189 }, .{
4315042190 .required_cc_abi = .sysv64,
4315142191 .required_features = .{ .@"64bit", .avx, null, null },
......@@ -47640,7 +46680,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4764046680 } },
4764146681 }, .{
4764246682 .required_cc_abi = .win64,
47643 .required_features = .{ .sse, null, null, null },
4764446683 .src_constraints = .{
4764546684 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
4764646685 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -47653,39 +46692,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4765346692 .extra_temps = .{
4765446693 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4765546694 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
47656 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
47657 .unused,
47658 .unused,
47659 .unused,
47660 .unused,
47661 .unused,
47662 .unused,
47663 .unused,
47664 .unused,
47665 },
47666 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
47667 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
47668 .each = .{ .once = &.{
47669 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
47670 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
47671 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
47672 } },
47673 }, .{
47674 .required_cc_abi = .sysv64,
47675 .required_features = .{ .avx, null, null, null },
47676 .src_constraints = .{
47677 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
47678 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
47679 .any,
47680 },
47681 .patterns = &.{
47682 .{ .src = .{ .to_mem, .to_mem, .none } },
47683 },
47684 .call_frame = .{ .alignment = .@"16" },
47685 .extra_temps = .{
47686 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
47687 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
47688 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
46695 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
4768946696 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
4769046697 .unused,
4769146698 .unused,
......@@ -47698,17 +46705,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4769846705 .dst_temps = .{ .mem, .unused },
4769946706 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4770046707 .each = .{ .once = &.{
47701 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47702 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
47703 .{ ._, .v_dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
46708 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
46709 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
46710 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
4770446711 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47705 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
47706 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
47707 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4770846712 } },
4770946713 }, .{
4771046714 .required_cc_abi = .sysv64,
47711 .required_features = .{ .sse2, null, null, null },
46715 .required_features = .{ .avx, null, null, null },
4771246716 .src_constraints = .{
4771346717 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4771446718 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -47735,16 +46739,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4773546739 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4773646740 .each = .{ .once = &.{
4773746741 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47738 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
47739 .{ ._, ._dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
46742 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
46743 .{ ._, .v_dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
4774046744 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47741 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
46745 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
4774246746 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4774346747 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4774446748 } },
4774546749 }, .{
4774646750 .required_cc_abi = .sysv64,
47747 .required_features = .{ .sse, null, null, null },
46751 .required_features = .{ .sse2, null, null, null },
4774846752 .src_constraints = .{
4774946753 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4775046754 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -47771,16 +46775,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4777146775 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4777246776 .each = .{ .once = &.{
4777346777 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47774 .{ .@"0:", ._ps, .mova, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
47775 .{ ._, ._ps, .mova, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
46778 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
46779 .{ ._, ._dqa, .mov, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
4777646780 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47777 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
46781 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
4777846782 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4777946783 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4778046784 } },
4778146785 }, .{
47782 .required_cc_abi = .win64,
47783 .required_features = .{ .avx, null, null, null },
46786 .required_cc_abi = .sysv64,
46787 .required_features = .{ .sse, null, null, null },
4778446788 .src_constraints = .{
4778546789 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4778646790 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -47792,67 +46796,30 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4779246796 .call_frame = .{ .alignment = .@"16" },
4779346797 .extra_temps = .{
4779446798 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
47795 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
47796 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
46799 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
46800 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
4779746801 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
47798 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4779946802 .unused,
4780046803 .unused,
4780146804 .unused,
4780246805 .unused,
4780346806 .unused,
4780446807 .unused,
47805 },
47806 .dst_temps = .{ .mem, .unused },
47807 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
47808 .each = .{ .once = &.{
47809 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47810 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
47811 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
47812 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47813 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
47814 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
47815 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
47816 } },
47817 }, .{
47818 .required_cc_abi = .win64,
47819 .required_features = .{ .sse2, null, null, null },
47820 .src_constraints = .{
47821 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
47822 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
47823 .any,
47824 },
47825 .patterns = &.{
47826 .{ .src = .{ .to_mem, .to_mem, .none } },
47827 },
47828 .call_frame = .{ .alignment = .@"16" },
47829 .extra_temps = .{
47830 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
47831 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
47832 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
47833 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
47834 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
47835 .unused,
47836 .unused,
47837 .unused,
47838 .unused,
47839 .unused,
4784046808 .unused,
4784146809 },
4784246810 .dst_temps = .{ .mem, .unused },
4784346811 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4784446812 .each = .{ .once = &.{
4784546813 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47846 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
47847 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
46814 .{ .@"0:", ._ps, .mova, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
46815 .{ ._, ._ps, .mova, .tmp2x, .memi(.src1x, .tmp0), ._, ._ },
4784846816 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47849 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
46817 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp1x, ._, ._ },
4785046818 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4785146819 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4785246820 } },
4785346821 }, .{
4785446822 .required_cc_abi = .win64,
47855 .required_features = .{ .sse, null, null, null },
4785646823 .src_constraints = .{
4785746824 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
4785846825 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -47866,8 +46833,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4786646833 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
4786746834 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4786846835 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
46836 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
4786946837 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
47870 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
4787146838 .unused,
4787246839 .unused,
4787346840 .unused,
......@@ -47879,10 +46846,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
4787946846 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
4788046847 .each = .{ .once = &.{
4788146848 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
47882 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
47883 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
47884 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
47885 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
46849 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
46850 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
46851 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
46852 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
4788646853 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
4788746854 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
4788846855 } },
......@@ -51943,7 +50910,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5194350910 } },
5194450911 }, .{
5194550912 .required_cc_abi = .win64,
51946 .required_features = .{ .sse, null, null, null },
5194750913 .src_constraints = .{
5194850914 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
5194950915 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -51956,6 +50922,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5195650922 .extra_temps = .{
5195750923 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
5195850924 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
50925 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
5195950926 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
5196050927 .unused,
5196150928 .unused,
......@@ -51964,14 +50931,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5196450931 .unused,
5196550932 .unused,
5196650933 .unused,
51967 .unused,
5196850934 },
51969 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
50935 .dst_temps = .{ .mem, .unused },
5197050936 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
5197150937 .each = .{ .once = &.{
51972 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
51973 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
51974 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
50938 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
50939 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
50940 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
50941 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
5197550942 } },
5197650943 }, .{
5197750944 .required_cc_abi = .sysv64,
......@@ -52083,79 +51050,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5208351050 } },
5208451051 }, .{
5208551052 .required_cc_abi = .win64,
52086 .required_features = .{ .avx, null, null, null },
52087 .src_constraints = .{
52088 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
52089 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
52090 .any,
52091 },
52092 .patterns = &.{
52093 .{ .src = .{ .to_mem, .to_mem, .none } },
52094 },
52095 .call_frame = .{ .alignment = .@"16" },
52096 .extra_temps = .{
52097 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
52098 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
52099 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
52100 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
52101 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
52102 .unused,
52103 .unused,
52104 .unused,
52105 .unused,
52106 .unused,
52107 .unused,
52108 },
52109 .dst_temps = .{ .mem, .unused },
52110 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
52111 .each = .{ .once = &.{
52112 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
52113 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
52114 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
52115 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
52116 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
52117 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
52118 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
52119 } },
52120 }, .{
52121 .required_cc_abi = .win64,
52122 .required_features = .{ .sse2, null, null, null },
52123 .src_constraints = .{
52124 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
52125 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
52126 .any,
52127 },
52128 .patterns = &.{
52129 .{ .src = .{ .to_mem, .to_mem, .none } },
52130 },
52131 .call_frame = .{ .alignment = .@"16" },
52132 .extra_temps = .{
52133 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
52134 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
52135 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
52136 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
52137 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
52138 .unused,
52139 .unused,
52140 .unused,
52141 .unused,
52142 .unused,
52143 .unused,
52144 },
52145 .dst_temps = .{ .mem, .unused },
52146 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
52147 .each = .{ .once = &.{
52148 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
52149 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
52150 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
52151 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
52152 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
52153 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
52154 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
52155 } },
52156 }, .{
52157 .required_cc_abi = .win64,
52158 .required_features = .{ .sse, null, null, null },
5215951053 .src_constraints = .{
5216051054 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
5216151055 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -52169,8 +51063,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5216951063 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
5217051064 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
5217151065 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
51066 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
5217251067 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
52173 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
5217451068 .unused,
5217551069 .unused,
5217651070 .unused,
......@@ -52182,10 +51076,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5218251076 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
5218351077 .each = .{ .once = &.{
5218451078 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
52185 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
52186 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
52187 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
52188 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp4x, ._, ._ },
51079 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
51080 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
51081 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
51082 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
5218951083 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
5219051084 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
5219151085 } },
......@@ -54509,10 +53403,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5450953403 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5451053404 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5451153405 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
54512 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54513 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
53406 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
53407 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5451453408 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
54515 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
53409 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5451653410 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5451753411 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5451853412 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -54620,10 +53514,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5462053514 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5462153515 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5462253516 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
54623 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54624 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
53517 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
53518 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5462553519 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
54626 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
53520 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5462753521 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5462853522 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5462953523 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -54731,10 +53625,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5473153625 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5473253626 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5473353627 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
54734 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
53628 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5473553629 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5473653630 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
54737 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
53631 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5473853632 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5473953633 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5474053634 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -54842,10 +53736,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5484253736 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5484353737 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5484453738 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
54845 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
53739 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5484653740 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5484753741 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
54848 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
53742 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5484953743 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5485053744 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5485153745 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -54951,10 +53845,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5495153845 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5495253846 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5495353847 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
54954 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54955 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
53848 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
53849 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5495653850 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
54957 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
53851 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5495853852 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5495953853 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5496053854 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55066,10 +53960,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5506653960 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5506753961 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5506853962 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55069 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55070 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
53963 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
53964 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5507153965 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
55072 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
53966 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5507353967 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5507453968 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5507553969 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55181,10 +54075,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5518154075 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5518254076 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5518354077 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55184 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54078 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5518554079 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5518654080 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
55187 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
54081 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5518854082 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5518954083 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5519054084 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55296,10 +54190,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5529654190 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5529754191 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5529854192 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55299 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54193 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5530054194 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5530154195 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
55302 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
54196 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5530354197 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5530454198 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5530554199 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55411,10 +54305,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5541154305 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5541254306 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5541354307 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55414 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55415 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
54308 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
54309 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5541654310 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
55417 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
54311 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5541854312 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5541954313 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5542054314 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55532,10 +54426,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5553254426 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5553354427 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5553454428 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55535 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55536 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
54429 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
54430 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5553754431 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
55538 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
54432 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5553954433 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5554054434 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5554154435 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55653,10 +54547,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5565354547 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5565454548 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5565554549 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55656 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54550 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5565754551 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5565854552 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
55659 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
54553 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5566054554 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5566154555 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5566254556 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55774,10 +54668,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5577454668 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5577554669 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5577654670 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55777 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
54671 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5577854672 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5577954673 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
55780 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
54674 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5578154675 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5578254676 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5578354677 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -55897,10 +54791,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5589754791 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5589854792 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5589954793 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
55900 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55901 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
54794 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
54795 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5590254796 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
55903 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
54797 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5590454798 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5590554799 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5590654800 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -56015,10 +54909,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5601554909 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5601654910 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5601754911 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
56018 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
56019 .{ ._, ._, .lea, .tmp8q, .memad(.src1, .add_size, -8), ._, ._ },
54912 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
54913 .{ ._, ._, .lea, .tmp8p, .memad(.src1, .add_size, -8), ._, ._ },
5602054914 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
56021 .{ ._, ._nz, .cmov, .tmp2q, .tmp8q, ._, ._ },
54915 .{ ._, ._nz, .cmov, .tmp2p, .tmp8p, ._, ._ },
5602254916 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5602354917 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5602454918 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -56133,10 +55027,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5613355027 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5613455028 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5613555029 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
56136 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55030 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5613755031 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5613855032 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
56139 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
55033 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5614055034 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5614155035 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5614255036 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -56251,10 +55145,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
5625155145 .{ ._, ._, .xor, .tmp7d, .tmp7d, ._, ._ },
5625255146 .{ ._, ._, .cmp, .tmp1b, .tmp3b, ._, ._ },
5625355147 .{ ._, ._e, .j, .@"1f", ._, ._, ._ },
56254 .{ ._, ._, .lea, .tmp2q, .memad(.src0, .add_size, -8), ._, ._ },
55148 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_size, -8), ._, ._ },
5625555149 .{ ._, ._, .@"test", .tmp1b, .tmp1b, ._, ._ },
5625655150 .{ ._, ._z, .j, .@"0f", ._, ._, ._ },
56257 .{ ._, ._, .lea, .tmp2q, .memad(.src1, .add_size, -8), ._, ._ },
55151 .{ ._, ._, .lea, .tmp2p, .memad(.src1, .add_size, -8), ._, ._ },
5625855152 .{ .@"0:", ._, .mov, .tmp8d, .tmp7d, ._, ._ },
5625955153 .{ ._, ._, .sbb, .tmp8q, .leasi(.tmp2q, .@"8", .tmp0), ._, ._ },
5626055154 .{ ._, ._, .adc, .tmp6b, .tmp6b, ._, ._ },
......@@ -67560,7 +66454,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6756066454 .{ ._, ._, .sub, .dst0b, .sia(32, .src0, .sub_bit_size), ._, ._ },
6756166455 } },
6756266456 }, .{
67563 .required_features = .{ .false_deps_lzcnt_tzcnt, .lzcnt, null, null },
66457 .required_features = .{ .false_deps_lzcnt, .lzcnt, null, null },
6756466458 .src_constraints = .{ .{ .exact_int = 16 }, .any, .any },
6756566459 .patterns = &.{
6756666460 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -67596,7 +66490,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6759666490 .{ ._, ._, .sub, .dst0b, .sia(16, .src0, .sub_bit_size), ._, ._ },
6759766491 } },
6759866492 }, .{
67599 .required_features = .{ .false_deps_lzcnt_tzcnt, .lzcnt, null, null },
66493 .required_features = .{ .false_deps_lzcnt, .lzcnt, null, null },
6760066494 .src_constraints = .{ .{ .unsigned_int = .word }, .any, .any },
6760166495 .patterns = &.{
6760266496 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -67621,7 +66515,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6762166515 .{ ._, ._, .sub, .dst0b, .sia(16, .src0, .sub_bit_size), ._, ._ },
6762266516 } },
6762366517 }, .{
67624 .required_features = .{ .false_deps_lzcnt_tzcnt, .lzcnt, null, null },
66518 .required_features = .{ .false_deps_lzcnt, .lzcnt, null, null },
6762566519 .src_constraints = .{ .{ .exact_int = 32 }, .any, .any },
6762666520 .patterns = &.{
6762766521 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -67657,7 +66551,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6765766551 .{ ._, ._, .sub, .dst0b, .sia(32, .src0, .sub_bit_size), ._, ._ },
6765866552 } },
6765966553 }, .{
67660 .required_features = .{ .false_deps_lzcnt_tzcnt, .lzcnt, null, null },
66554 .required_features = .{ .false_deps_lzcnt, .lzcnt, null, null },
6766166555 .src_constraints = .{ .{ .unsigned_int = .dword }, .any, .any },
6766266556 .patterns = &.{
6766366557 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -67682,7 +66576,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6768266576 .{ ._, ._, .sub, .dst0b, .sia(32, .src0, .sub_bit_size), ._, ._ },
6768366577 } },
6768466578 }, .{
67685 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
66579 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6768666580 .src_constraints = .{ .{ .exact_int = 64 }, .any, .any },
6768766581 .patterns = &.{
6768866582 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -67720,7 +66614,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6772066614 .{ ._, ._, .sub, .dst0b, .sia(64, .src0, .sub_bit_size), ._, ._ },
6772166615 } },
6772266616 }, .{
67723 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
66617 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6772466618 .src_constraints = .{ .{ .unsigned_int = .qword }, .any, .any },
6772566619 .patterns = &.{
6772666620 .{ .src = .{ .to_mut_gpr, .none, .none } },
......@@ -68577,7 +67471,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6857767471 .{ ._, ._, .sub, .dst0b, .tmp0b, ._, ._ },
6857867472 } },
6857967473 }, .{
68580 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
67474 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6858167475 .src_constraints = .{ .{ .unsigned_or_exact_remainder_int = .{ .of = .xword, .is = .qword } }, .any, .any },
6858267476 .patterns = &.{
6858367477 .{ .src = .{ .to_mem, .none, .none } },
......@@ -68705,7 +67599,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6870567599 .{ ._, ._, .neg, .dst0d, ._, ._, ._ },
6870667600 } },
6870767601 }, .{
68708 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
67602 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6870967603 .src_constraints = .{ .{ .unsigned_or_exact_remainder_int = .{ .of = .xword, .is = .xword } }, .any, .any },
6871067604 .patterns = &.{
6871167605 .{ .src = .{ .to_mem, .none, .none } },
......@@ -68833,7 +67727,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6883367727 .{ ._, ._, .neg, .dst0d, ._, ._, ._ },
6883467728 } },
6883567729 }, .{
68836 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
67730 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6883767731 .src_constraints = .{ .{ .remainder_int = .{ .of = .xword, .is = .qword } }, .any, .any },
6883867732 .patterns = &.{
6883967733 .{ .src = .{ .to_mem, .none, .none } },
......@@ -68936,7 +67830,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
6893667830 .{ ._, ._, .neg, .dst0d, ._, ._, ._ },
6893767831 } },
6893867832 }, .{
68939 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
67833 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
6894067834 .src_constraints = .{ .{ .remainder_int = .{ .of = .xword, .is = .xword } }, .any, .any },
6894167835 .patterns = &.{
6894267836 .{ .src = .{ .to_mem, .none, .none } },
......@@ -70092,7 +68986,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7009268986 .{ ._, ._nz, .j, .@"0b", ._, ._, ._ },
7009368987 } },
7009468988 }, .{
70095 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
68989 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
7009668990 .src_constraints = .{ .{ .scalar_remainder_int = .{ .of = .xword, .is = .qword } }, .any, .any },
7009768991 .dst_constraints = .{ .{ .scalar_int_is = .byte }, .any },
7009868992 .patterns = &.{
......@@ -70115,7 +69009,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7011569009 .clobbers = .{ .eflags = true },
7011669010 .each = .{ .once = &.{
7011769011 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70118 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69012 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7011969013 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7012069014 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7012169015 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70129,7 +69023,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7012969023 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7013069024 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7013169025 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70132 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69026 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7013369027 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7013469028 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7013569029 } },
......@@ -70157,7 +69051,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7015769051 .clobbers = .{ .eflags = true },
7015869052 .each = .{ .once = &.{
7015969053 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70160 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69054 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7016169055 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7016269056 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7016369057 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70170,7 +69064,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7017069064 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7017169065 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7017269066 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70173 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69067 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7017469068 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7017569069 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7017669070 } },
......@@ -70198,7 +69092,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7019869092 .clobbers = .{ .eflags = true },
7019969093 .each = .{ .once = &.{
7020069094 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70201 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69095 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7020269096 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7020369097 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7020469098 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70211,12 +69105,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7021169105 .{ .@"1:", ._, .lea, .tmp3d, .leasiad(.tmp3, .@"8", .tmp2, .sub_src0_bit_size, 1), ._, ._ },
7021269106 .{ ._, ._, .neg, .tmp3b, ._, ._, ._ },
7021369107 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70214 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69108 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7021569109 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7021669110 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7021769111 } },
7021869112 }, .{
70219 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
69113 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
7022069114 .src_constraints = .{ .{ .scalar_remainder_int = .{ .of = .xword, .is = .xword } }, .any, .any },
7022169115 .dst_constraints = .{ .{ .scalar_int_is = .byte }, .any },
7022269116 .patterns = &.{
......@@ -70239,7 +69133,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7023969133 .clobbers = .{ .eflags = true },
7024069134 .each = .{ .once = &.{
7024169135 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70242 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69136 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7024369137 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7024469138 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7024569139 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70253,7 +69147,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7025369147 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7025469148 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7025569149 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70256 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69150 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7025769151 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7025869152 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7025969153 } },
......@@ -70281,7 +69175,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7028169175 .clobbers = .{ .eflags = true },
7028269176 .each = .{ .once = &.{
7028369177 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70284 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69178 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7028569179 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7028669180 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7028769181 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70294,7 +69188,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7029469188 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7029569189 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7029669190 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70297 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69191 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7029869192 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7029969193 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7030069194 } },
......@@ -70322,7 +69216,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7032269216 .clobbers = .{ .eflags = true },
7032369217 .each = .{ .once = &.{
7032469218 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70325 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69219 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7032669220 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7032769221 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7032869222 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70335,12 +69229,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7033569229 .{ .@"1:", ._, .lea, .tmp3d, .leasiad(.tmp3, .@"8", .tmp2, .sub_src0_bit_size, 1), ._, ._ },
7033669230 .{ ._, ._, .neg, .tmp3b, ._, ._, ._ },
7033769231 .{ ._, ._, .mov, .memia(.dst0b, .tmp0, .add_len), .tmp3b, ._, ._ },
70338 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69232 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7033969233 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7034069234 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7034169235 } },
7034269236 }, .{
70343 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
69237 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
7034469238 .src_constraints = .{ .{ .scalar_remainder_int = .{ .of = .xword, .is = .qword } }, .any, .any },
7034569239 .dst_constraints = .{ .{ .scalar_int_is = .word }, .any },
7034669240 .patterns = &.{
......@@ -70363,7 +69257,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7036369257 .clobbers = .{ .eflags = true },
7036469258 .each = .{ .once = &.{
7036569259 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70366 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69260 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7036769261 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7036869262 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7036969263 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70377,7 +69271,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7037769271 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7037869272 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7037969273 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70380 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69274 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7038169275 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7038269276 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7038369277 } },
......@@ -70405,7 +69299,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7040569299 .clobbers = .{ .eflags = true },
7040669300 .each = .{ .once = &.{
7040769301 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70408 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69302 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7040969303 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7041069304 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7041169305 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70418,7 +69312,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7041869312 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7041969313 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7042069314 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70421 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69315 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7042269316 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7042369317 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7042469318 } },
......@@ -70446,7 +69340,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7044669340 .clobbers = .{ .eflags = true },
7044769341 .each = .{ .once = &.{
7044869342 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70449 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69343 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7045069344 .{ .@"0:", ._, .mov, .tmp2d, .sia(-16, .none, .add_src0_elem_size), ._, ._ },
7045169345 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7045269346 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70459,12 +69353,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7045969353 .{ .@"1:", ._, .lea, .tmp3d, .leasiad(.tmp3, .@"8", .tmp2, .sub_src0_bit_size, 1), ._, ._ },
7046069354 .{ ._, ._, .neg, .tmp3d, ._, ._, ._ },
7046169355 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70462 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69356 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7046369357 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7046469358 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7046569359 } },
7046669360 }, .{
70467 .required_features = .{ .@"64bit", .false_deps_lzcnt_tzcnt, .lzcnt, null },
69361 .required_features = .{ .@"64bit", .false_deps_lzcnt, .lzcnt, null },
7046869362 .src_constraints = .{ .{ .scalar_remainder_int = .{ .of = .xword, .is = .xword } }, .any, .any },
7046969363 .dst_constraints = .{ .{ .scalar_int_is = .word }, .any },
7047069364 .patterns = &.{
......@@ -70487,7 +69381,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7048769381 .clobbers = .{ .eflags = true },
7048869382 .each = .{ .once = &.{
7048969383 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70490 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69384 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7049169385 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7049269386 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7049369387 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70501,7 +69395,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7050169395 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7050269396 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7050369397 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70504 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69398 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7050569399 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7050669400 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7050769401 } },
......@@ -70529,7 +69423,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7052969423 .clobbers = .{ .eflags = true },
7053069424 .each = .{ .once = &.{
7053169425 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70532 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69426 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7053369427 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7053469428 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7053569429 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70542,7 +69436,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7054269436 .{ .@"1:", ._, .neg, .tmp2d, ._, ._, ._ },
7054369437 .{ ._, ._, .lea, .tmp3d, .leasiad(.tmp4, .@"8", .tmp2, .add_src0_bit_size, -64), ._, ._ },
7054469438 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70545 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69439 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7054669440 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7054769441 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7054869442 } },
......@@ -70570,7 +69464,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7057069464 .clobbers = .{ .eflags = true },
7057169465 .each = .{ .once = &.{
7057269466 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_len), ._, ._ },
70573 .{ ._, ._, .lea, .tmp1q, .mem(.src0), ._, ._ },
69467 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
7057469468 .{ .@"0:", ._, .mov, .tmp2d, .sia(-8, .none, .add_src0_elem_size), ._, ._ },
7057569469 .{ ._, ._, .mov, .tmp3q, .ua(.src0, .add_umax), ._, ._ },
7057669470 .{ .@"1:", ._, .@"and", .tmp3q, .leai(.tmp1q, .tmp2), ._, ._ },
......@@ -70583,7 +69477,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7058369477 .{ .@"1:", ._, .lea, .tmp3d, .leasiad(.tmp3, .@"8", .tmp2, .sub_src0_bit_size, 1), ._, ._ },
7058469478 .{ ._, ._, .neg, .tmp3d, ._, ._, ._ },
7058569479 .{ ._, ._, .mov, .memsia(.dst0w, .@"2", .tmp0, .add_2_len), .tmp3w, ._, ._ },
70586 .{ ._, ._, .lea, .tmp1q, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
69480 .{ ._, ._, .lea, .tmp1p, .leaa(.tmp1, .add_src0_elem_size), ._, ._ },
7058769481 .{ ._, ._, .add, .tmp0p, .si(1), ._, ._ },
7058869482 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
7058969483 } },
......@@ -70649,7 +69543,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7064969543 .{ ._, ._, .tzcnt, .dst0w, .src0w, ._, ._ },
7065069544 } },
7065169545 }, .{
70652 .required_features = .{ .bmi, .false_deps_lzcnt_tzcnt, null, null },
69546 .required_features = .{ .bmi, .false_deps_tzcnt, null, null },
7065369547 .src_constraints = .{ .{ .exact_int = 32 }, .any, .any },
7065469548 .patterns = &.{
7065569549 .{ .src = .{ .mem, .none, .none } },
......@@ -70686,7 +69580,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7068669580 .{ ._, ._, .tzcnt, .dst0d, .src0d, ._, ._ },
7068769581 } },
7068869582 }, .{
70689 .required_features = .{ .@"64bit", .bmi, .false_deps_lzcnt_tzcnt, null },
69583 .required_features = .{ .@"64bit", .bmi, .false_deps_tzcnt, null },
7069069584 .src_constraints = .{ .{ .exact_int = 64 }, .any, .any },
7069169585 .patterns = &.{
7069269586 .{ .src = .{ .mem, .none, .none } },
......@@ -70863,7 +69757,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7086369757 .{ ._, ._f, .bs, .dst0q, .src0q, ._, ._ },
7086469758 } },
7086569759 }, .{
70866 .required_features = .{ .@"64bit", .bmi, .false_deps_lzcnt_tzcnt, null },
69760 .required_features = .{ .@"64bit", .bmi, .false_deps_tzcnt, null },
7086769761 .src_constraints = .{ .{ .remainder_int = .{ .of = .qword, .is = .qword } }, .any, .any },
7086869762 .patterns = &.{
7086969763 .{ .src = .{ .to_mem, .none, .none } },
......@@ -71479,13 +70373,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7147970373 .{ ._, ._, .mov, .tmp1q, .uia(0x33333333, .none, .repeat), ._, ._ },
7148070374 .{ ._, ._, .@"and", .dst0q, .tmp1q, ._, ._ },
7148170375 .{ ._, ._, .@"and", .tmp0q, .tmp1q, ._, ._ },
71482 .{ ._, ._, .lea, .dst0q, .leai(.dst0, .tmp0), ._, ._ },
70376 .{ ._, ._, .lea, .dst0p, .leai(.dst0, .tmp0), ._, ._ },
7148370377 .{ ._, ._, .mov, .tmp0q, .dst0q, ._, ._ },
7148470378 .{ ._, ._r, .sh, .dst0q, .ui(4), ._, ._ },
7148570379 .{ ._, ._, .mov, .tmp1q, .uia(0x0f0f0f0f, .none, .repeat), ._, ._ },
7148670380 .{ ._, ._, .@"and", .tmp0q, .tmp1q, ._, ._ },
7148770381 .{ ._, ._, .@"and", .dst0q, .tmp1q, ._, ._ },
71488 .{ ._, ._, .lea, .dst0q, .leai(.dst0, .tmp0), ._, ._ },
70382 .{ ._, ._, .lea, .dst0p, .leai(.dst0, .tmp0), ._, ._ },
7148970383 .{ ._, ._, .mov, .tmp1q, .uia(0x01010101, .none, .repeat), ._, ._ },
7149070384 .{ ._, .i_, .mul, .dst0q, .tmp1q, ._, ._ },
7149170385 .{ ._, ._r, .sh, .dst0q, .ui(64 - 8), ._, ._ },
......@@ -71523,13 +70417,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7152370417 .{ ._, ._, .mov, .tmp1q, .uia(0x33333333, .none, .repeat), ._, ._ },
7152470418 .{ ._, ._, .@"and", .dst0q, .tmp1q, ._, ._ },
7152570419 .{ ._, ._, .@"and", .tmp0q, .tmp1q, ._, ._ },
71526 .{ ._, ._, .lea, .dst0q, .leai(.dst0, .tmp0), ._, ._ },
70420 .{ ._, ._, .lea, .dst0p, .leai(.dst0, .tmp0), ._, ._ },
7152770421 .{ ._, ._, .mov, .tmp0q, .dst0q, ._, ._ },
7152870422 .{ ._, ._r, .sh, .dst0q, .ui(4), ._, ._ },
7152970423 .{ ._, ._, .mov, .tmp1q, .uia(0x0f0f0f0f, .none, .repeat), ._, ._ },
7153070424 .{ ._, ._, .@"and", .tmp0q, .tmp1q, ._, ._ },
7153170425 .{ ._, ._, .@"and", .dst0q, .tmp1q, ._, ._ },
71532 .{ ._, ._, .lea, .dst0q, .leai(.dst0, .tmp0), ._, ._ },
70426 .{ ._, ._, .lea, .dst0p, .leai(.dst0, .tmp0), ._, ._ },
7153370427 .{ ._, ._, .mov, .tmp1q, .uia(0x01010101, .none, .repeat), ._, ._ },
7153470428 .{ ._, .i_, .mul, .dst0q, .tmp1q, ._, ._ },
7153570429 .{ ._, ._r, .sh, .dst0q, .ui(64 - 8), ._, ._ },
......@@ -71754,13 +70648,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7175470648 .{ ._, ._, .mov, .tmp3q, .uia(0x33333333, .none, .repeat), ._, ._ },
7175570649 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
7175670650 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
71757 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70651 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7175870652 .{ ._, ._, .mov, .tmp2q, .tmp1q, ._, ._ },
7175970653 .{ ._, ._r, .sh, .tmp1q, .ui(4), ._, ._ },
7176070654 .{ ._, ._, .mov, .tmp3q, .uia(0x0f0f0f0f, .none, .repeat), ._, ._ },
7176170655 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
7176270656 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
71763 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70657 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7176470658 .{ ._, ._, .mov, .tmp3q, .uia(0x01010101, .none, .repeat), ._, ._ },
7176570659 .{ ._, .i_, .mul, .tmp1q, .tmp3q, ._, ._ },
7176670660 .{ ._, ._r, .sh, .tmp1q, .ui(64 - 8), ._, ._ },
......@@ -71806,13 +70700,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7180670700 .{ ._, ._, .mov, .tmp3q, .uia(0x33333333, .none, .repeat), ._, ._ },
7180770701 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
7180870702 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
71809 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70703 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7181070704 .{ ._, ._, .mov, .tmp2q, .tmp1q, ._, ._ },
7181170705 .{ ._, ._r, .sh, .tmp1q, .ui(4), ._, ._ },
7181270706 .{ ._, ._, .mov, .tmp3q, .uia(0x0f0f0f0f, .none, .repeat), ._, ._ },
7181370707 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
7181470708 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
71815 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70709 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7181670710 .{ ._, ._, .mov, .tmp3q, .uia(0x01010101, .none, .repeat), ._, ._ },
7181770711 .{ ._, .i_, .mul, .tmp1q, .tmp3q, ._, ._ },
7181870712 .{ ._, ._r, .sh, .tmp1q, .ui(64 - 8), ._, ._ },
......@@ -71858,13 +70752,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7185870752 .{ ._, ._, .mov, .tmp3q, .uia(0x33333333, .none, .repeat), ._, ._ },
7185970753 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
7186070754 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
71861 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70755 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7186270756 .{ ._, ._, .mov, .tmp2q, .tmp1q, ._, ._ },
7186370757 .{ ._, ._r, .sh, .tmp1q, .ui(4), ._, ._ },
7186470758 .{ ._, ._, .mov, .tmp3q, .uia(0x0f0f0f0f, .none, .repeat), ._, ._ },
7186570759 .{ ._, ._, .@"and", .tmp2q, .tmp3q, ._, ._ },
7186670760 .{ ._, ._, .@"and", .tmp1q, .tmp3q, ._, ._ },
71867 .{ ._, ._, .lea, .tmp1q, .leai(.tmp1, .tmp2), ._, ._ },
70761 .{ ._, ._, .lea, .tmp1p, .leai(.tmp1, .tmp2), ._, ._ },
7186870762 .{ ._, ._, .mov, .tmp3q, .uia(0x01010101, .none, .repeat), ._, ._ },
7186970763 .{ ._, .i_, .mul, .tmp1q, .tmp3q, ._, ._ },
7187070764 .{ ._, ._r, .sh, .tmp1q, .ui(64 - 8), ._, ._ },
......@@ -76474,7 +75368,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7647475368 } },
7647575369 }, .{
7647675370 .required_cc_abi = .win64,
76477 .required_features = .{ .sse, null, null, null },
7647875371 .src_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
7647975372 .patterns = &.{
7648075373 .{ .src = .{ .to_mem, .none, .none } },
......@@ -76482,6 +75375,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7648275375 .call_frame = .{ .alignment = .@"16" },
7648375376 .extra_temps = .{
7648475377 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
75378 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
7648575379 .{ .type = .usize, .kind = .{ .extern_func = "sqrtf128" } },
7648675380 .unused,
7648775381 .unused,
......@@ -76491,13 +75385,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7649175385 .unused,
7649275386 .unused,
7649375387 .unused,
76494 .unused,
7649575388 },
76496 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
75389 .dst_temps = .{ .mem, .unused },
7649775390 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
7649875391 .each = .{ .once = &.{
76499 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
76500 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
75392 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
75393 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
75394 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
7650175395 } },
7650275396 }, .{
7650375397 .required_cc_abi = .sysv64,
......@@ -76594,69 +75488,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7659475488 } },
7659575489 }, .{
7659675490 .required_cc_abi = .win64,
76597 .required_features = .{ .avx, null, null, null },
76598 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
76599 .patterns = &.{
76600 .{ .src = .{ .to_mem, .none, .none } },
76601 },
76602 .call_frame = .{ .alignment = .@"16" },
76603 .extra_temps = .{
76604 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
76605 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76606 .{ .type = .usize, .kind = .{ .extern_func = "sqrtf128" } },
76607 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76608 .unused,
76609 .unused,
76610 .unused,
76611 .unused,
76612 .unused,
76613 .unused,
76614 .unused,
76615 },
76616 .dst_temps = .{ .mem, .unused },
76617 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
76618 .each = .{ .once = &.{
76619 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
76620 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
76621 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
76622 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
76623 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
76624 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
76625 } },
76626 }, .{
76627 .required_cc_abi = .win64,
76628 .required_features = .{ .sse2, null, null, null },
76629 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
76630 .patterns = &.{
76631 .{ .src = .{ .to_mem, .none, .none } },
76632 },
76633 .call_frame = .{ .alignment = .@"16" },
76634 .extra_temps = .{
76635 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
76636 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76637 .{ .type = .usize, .kind = .{ .extern_func = "sqrtf128" } },
76638 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76639 .unused,
76640 .unused,
76641 .unused,
76642 .unused,
76643 .unused,
76644 .unused,
76645 .unused,
76646 },
76647 .dst_temps = .{ .mem, .unused },
76648 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
76649 .each = .{ .once = &.{
76650 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
76651 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
76652 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
76653 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
76654 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
76655 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
76656 } },
76657 }, .{
76658 .required_cc_abi = .win64,
76659 .required_features = .{ .sse, null, null, null },
7666075491 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
7666175492 .patterns = &.{
7666275493 .{ .src = .{ .to_mem, .none, .none } },
......@@ -76665,8 +75496,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7666575496 .extra_temps = .{
7666675497 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
7666775498 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
75499 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
7666875500 .{ .type = .usize, .kind = .{ .extern_func = "sqrtf128" } },
76669 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
7667075501 .unused,
7667175502 .unused,
7667275503 .unused,
......@@ -76679,9 +75510,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7667975510 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
7668075511 .each = .{ .once = &.{
7668175512 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
76682 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
76683 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
76684 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
75513 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
75514 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
75515 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
7668575516 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
7668675517 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
7668775518 } },
......@@ -77323,7 +76154,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7732376154 } },
7732476155 }, .{
7732576156 .required_cc_abi = .win64,
77326 .required_features = .{ .sse, null, null, null },
7732776157 .src_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
7732876158 .patterns = &.{
7732976159 .{ .src = .{ .to_mem, .none, .none } },
......@@ -77331,6 +76161,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7733176161 .call_frame = .{ .alignment = .@"16" },
7733276162 .extra_temps = .{
7733376163 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76164 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
7733476165 .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f128" } },
7733576166 .unused,
7733676167 .unused,
......@@ -77340,13 +76171,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7734076171 .unused,
7734176172 .unused,
7734276173 .unused,
77343 .unused,
7734476174 },
77345 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
76175 .dst_temps = .{ .mem, .unused },
7734676176 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
7734776177 .each = .{ .once = &.{
77348 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
77349 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
76178 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
76179 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
76180 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
7735076181 } },
7735176182 }, .{
7735276183 .required_cc_abi = .sysv64,
......@@ -77443,69 +76274,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7744376274 } },
7744476275 }, .{
7744576276 .required_cc_abi = .win64,
77446 .required_features = .{ .avx, null, null, null },
77447 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
77448 .patterns = &.{
77449 .{ .src = .{ .to_mem, .none, .none } },
77450 },
77451 .call_frame = .{ .alignment = .@"16" },
77452 .extra_temps = .{
77453 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
77454 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
77455 .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f128" } },
77456 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
77457 .unused,
77458 .unused,
77459 .unused,
77460 .unused,
77461 .unused,
77462 .unused,
77463 .unused,
77464 },
77465 .dst_temps = .{ .mem, .unused },
77466 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
77467 .each = .{ .once = &.{
77468 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
77469 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
77470 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
77471 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
77472 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
77473 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
77474 } },
77475 }, .{
77476 .required_cc_abi = .win64,
77477 .required_features = .{ .sse2, null, null, null },
77478 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
77479 .patterns = &.{
77480 .{ .src = .{ .to_mem, .none, .none } },
77481 },
77482 .call_frame = .{ .alignment = .@"16" },
77483 .extra_temps = .{
77484 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
77485 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
77486 .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f128" } },
77487 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
77488 .unused,
77489 .unused,
77490 .unused,
77491 .unused,
77492 .unused,
77493 .unused,
77494 .unused,
77495 },
77496 .dst_temps = .{ .mem, .unused },
77497 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
77498 .each = .{ .once = &.{
77499 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
77500 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
77501 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
77502 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
77503 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
77504 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
77505 } },
77506 }, .{
77507 .required_cc_abi = .win64,
77508 .required_features = .{ .sse, null, null, null },
7750976277 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
7751076278 .patterns = &.{
7751176279 .{ .src = .{ .to_mem, .none, .none } },
......@@ -77514,8 +76282,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7751476282 .extra_temps = .{
7751576283 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
7751676284 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
76285 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
7751776286 .{ .type = .usize, .kind = .{ .extern_func = @tagName(name) ++ "f128" } },
77518 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
7751976287 .unused,
7752076288 .unused,
7752176289 .unused,
......@@ -77528,9 +76296,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
7752876296 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
7752976297 .each = .{ .once = &.{
7753076298 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
77531 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
77532 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
77533 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
76299 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
76300 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
76301 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
7753476302 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
7753576303 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
7753676304 } },
......@@ -80175,7 +78943,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8017578943 } },
8017678944 }, .{
8017778945 .required_cc_abi = .win64,
80178 .required_features = .{ .sse, null, null, null },
8017978946 .src_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
8018078947 .patterns = &.{
8018178948 .{ .src = .{ .to_mem, .none, .none } },
......@@ -80183,6 +78950,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8018378950 .call_frame = .{ .alignment = .@"16" },
8018478951 .extra_temps = .{
8018578952 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
78953 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
8018678954 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
8018778955 else => unreachable,
8018878956 .down => "floorf128",
......@@ -80197,13 +78965,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8019778965 .unused,
8019878966 .unused,
8019978967 .unused,
80200 .unused,
8020178968 },
80202 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
78969 .dst_temps = .{ .mem, .unused },
8020378970 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
8020478971 .each = .{ .once = &.{
80205 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
80206 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
78972 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
78973 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
78974 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
8020778975 } },
8020878976 }, .{
8020978977 .required_cc_abi = .sysv64,
......@@ -80315,79 +79083,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8031579083 } },
8031679084 }, .{
8031779085 .required_cc_abi = .win64,
80318 .required_features = .{ .avx, null, null, null },
80319 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
80320 .patterns = &.{
80321 .{ .src = .{ .to_mem, .none, .none } },
80322 },
80323 .call_frame = .{ .alignment = .@"16" },
80324 .extra_temps = .{
80325 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
80326 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
80327 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
80328 else => unreachable,
80329 .down => "floorf128",
80330 .up => "ceilf128",
80331 .zero => "truncf128",
80332 } } },
80333 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
80334 .unused,
80335 .unused,
80336 .unused,
80337 .unused,
80338 .unused,
80339 .unused,
80340 .unused,
80341 },
80342 .dst_temps = .{ .mem, .unused },
80343 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
80344 .each = .{ .once = &.{
80345 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
80346 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
80347 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
80348 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
80349 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
80350 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
80351 } },
80352 }, .{
80353 .required_cc_abi = .win64,
80354 .required_features = .{ .sse2, null, null, null },
80355 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
80356 .patterns = &.{
80357 .{ .src = .{ .to_mem, .none, .none } },
80358 },
80359 .call_frame = .{ .alignment = .@"16" },
80360 .extra_temps = .{
80361 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
80362 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
80363 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
80364 else => unreachable,
80365 .down => "floorf128",
80366 .up => "ceilf128",
80367 .zero => "truncf128",
80368 } } },
80369 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
80370 .unused,
80371 .unused,
80372 .unused,
80373 .unused,
80374 .unused,
80375 .unused,
80376 .unused,
80377 },
80378 .dst_temps = .{ .mem, .unused },
80379 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
80380 .each = .{ .once = &.{
80381 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
80382 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
80383 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
80384 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
80385 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
80386 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
80387 } },
80388 }, .{
80389 .required_cc_abi = .win64,
80390 .required_features = .{ .sse, null, null, null },
8039179086 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
8039279087 .patterns = &.{
8039379088 .{ .src = .{ .to_mem, .none, .none } },
......@@ -80396,13 +79091,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8039679091 .extra_temps = .{
8039779092 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
8039879093 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
79094 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
8039979095 .{ .type = .usize, .kind = .{ .extern_func = switch (direction) {
8040079096 else => unreachable,
8040179097 .down => "floorf128",
8040279098 .up => "ceilf128",
8040379099 .zero => "truncf128",
8040479100 } } },
80405 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
8040679101 .unused,
8040779102 .unused,
8040879103 .unused,
......@@ -80415,9 +79110,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
8041579110 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
8041679111 .each = .{ .once = &.{
8041779112 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
80418 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
80419 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
80420 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
79113 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
79114 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
79115 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
8042179116 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
8042279117 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
8042379118 } },
......@@ -92472,6 +91167,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9247291167 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9247391168 } },
9247491169 }, .{
91170 .required_cc_abi = .sysv64,
9247591171 .required_features = .{ .sse, null, null, null },
9247691172 .src_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
9247791173 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92498,6 +91194,35 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9249891194 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
9249991195 } },
9250091196 }, .{
91197 .required_cc_abi = .win64,
91198 .required_features = .{ .sse, null, null, null },
91199 .src_constraints = .{ .{ .scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
91200 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91201 .patterns = &.{
91202 .{ .src = .{ .{ .to_param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .none, .none } },
91203 },
91204 .call_frame = .{ .alignment = .@"16" },
91205 .extra_temps = .{
91206 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91207 .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } },
91208 .unused,
91209 .unused,
91210 .unused,
91211 .unused,
91212 .unused,
91213 .unused,
91214 .unused,
91215 .unused,
91216 .unused,
91217 },
91218 .dst_temps = .{ .mem, .unused },
91219 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91220 .each = .{ .once = &.{
91221 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
91222 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
91223 } },
91224 }, .{
91225 .required_cc_abi = .sysv64,
9250191226 .required_features = .{ .avx, null, null, null },
9250291227 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
9250391228 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92530,6 +91255,40 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9253091255 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9253191256 } },
9253291257 }, .{
91258 .required_cc_abi = .win64,
91259 .required_features = .{ .avx, null, null, null },
91260 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
91261 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91262 .patterns = &.{
91263 .{ .src = .{ .to_mem, .none, .none } },
91264 },
91265 .call_frame = .{ .alignment = .@"16" },
91266 .extra_temps = .{
91267 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
91268 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91269 .{ .type = .f16, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
91270 .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } },
91271 .unused,
91272 .unused,
91273 .unused,
91274 .unused,
91275 .unused,
91276 .unused,
91277 .unused,
91278 },
91279 .dst_temps = .{ .mem, .unused },
91280 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91281 .each = .{ .once = &.{
91282 .{ ._, ._, .mov, .tmp0d, .sia(-2, .src0, .add_unaligned_size), ._, ._ },
91283 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"8", .tmp0), ._, ._ },
91284 .{ ._, .vp_, .xor, .tmp2x, .tmp2x, .tmp2x, ._ },
91285 .{ ._, .vp_w, .insr, .tmp2x, .tmp2x, .memi(.src0w, .tmp0), .ui(0) },
91286 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
91287 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
91288 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
91289 } },
91290 }, .{
91291 .required_cc_abi = .sysv64,
9253391292 .required_features = .{ .sse2, null, null, null },
9253491293 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
9253591294 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92562,6 +91321,40 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9256291321 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9256391322 } },
9256491323 }, .{
91324 .required_cc_abi = .win64,
91325 .required_features = .{ .sse2, null, null, null },
91326 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
91327 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91328 .patterns = &.{
91329 .{ .src = .{ .to_mem, .none, .none } },
91330 },
91331 .call_frame = .{ .alignment = .@"16" },
91332 .extra_temps = .{
91333 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
91334 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91335 .{ .type = .f16, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
91336 .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } },
91337 .unused,
91338 .unused,
91339 .unused,
91340 .unused,
91341 .unused,
91342 .unused,
91343 .unused,
91344 },
91345 .dst_temps = .{ .mem, .unused },
91346 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91347 .each = .{ .once = &.{
91348 .{ ._, ._, .mov, .tmp0d, .sia(-2, .src0, .add_unaligned_size), ._, ._ },
91349 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"8", .tmp0), ._, ._ },
91350 .{ ._, .p_, .xor, .tmp2x, .tmp2x, ._, ._ },
91351 .{ ._, .p_w, .insr, .tmp2x, .memi(.src0w, .tmp0), .ui(0), ._ },
91352 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
91353 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
91354 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
91355 } },
91356 }, .{
91357 .required_cc_abi = .sysv64,
9256591358 .required_features = .{ .sse, null, null, null },
9256691359 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
9256791360 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92594,6 +91387,40 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9259491387 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
9259591388 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9259691389 } },
91390 }, .{
91391 .required_cc_abi = .win64,
91392 .required_features = .{ .sse, null, null, null },
91393 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .word, .is = .word } }, .any, .any },
91394 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91395 .patterns = &.{
91396 .{ .src = .{ .to_mem, .none, .none } },
91397 },
91398 .call_frame = .{ .alignment = .@"16" },
91399 .extra_temps = .{
91400 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
91401 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91402 .{ .type = .f16, .kind = .{ .reg = .ax } },
91403 .{ .type = .f32, .kind = .mem },
91404 .{ .type = .f16, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
91405 .{ .type = .usize, .kind = .{ .extern_func = "__extendhftf2" } },
91406 .unused,
91407 .unused,
91408 .unused,
91409 .unused,
91410 .unused,
91411 },
91412 .dst_temps = .{ .mem, .unused },
91413 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91414 .each = .{ .once = &.{
91415 .{ ._, ._, .mov, .tmp0d, .sia(-2, .src0, .add_unaligned_size), ._, ._ },
91416 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0x, .@"8", .tmp0), ._, ._ },
91417 .{ ._, ._, .movzx, .tmp2d, .memi(.src0w, .tmp0), ._, ._ },
91418 .{ ._, ._, .mov, .mem(.tmp3d), .tmp2d, ._, ._ },
91419 .{ ._, ._ss, .mov, .tmp4x, .mem(.tmp3d), ._, ._ },
91420 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
91421 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
91422 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
91423 } },
9259791424 }, .{
9259891425 .required_features = .{ .avx, null, null, null },
9259991426 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
......@@ -92833,6 +91660,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9283391660 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9283491661 } },
9283591662 }, .{
91663 .required_cc_abi = .sysv64,
9283691664 .required_features = .{ .sse, null, null, null },
9283791665 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
9283891666 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92859,6 +91687,35 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9285991687 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
9286091688 } },
9286191689 }, .{
91690 .required_cc_abi = .win64,
91691 .required_features = .{ .sse, null, null, null },
91692 .src_constraints = .{ .{ .scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
91693 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91694 .patterns = &.{
91695 .{ .src = .{ .{ .to_param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } }, .none, .none } },
91696 },
91697 .call_frame = .{ .alignment = .@"16" },
91698 .extra_temps = .{
91699 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91700 .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } },
91701 .unused,
91702 .unused,
91703 .unused,
91704 .unused,
91705 .unused,
91706 .unused,
91707 .unused,
91708 .unused,
91709 .unused,
91710 },
91711 .dst_temps = .{ .mem, .unused },
91712 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91713 .each = .{ .once = &.{
91714 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
91715 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
91716 } },
91717 }, .{
91718 .required_cc_abi = .sysv64,
9286291719 .required_features = .{ .avx, null, null, null },
9286391720 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
9286491721 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92890,6 +91747,39 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9289091747 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9289191748 } },
9289291749 }, .{
91750 .required_cc_abi = .win64,
91751 .required_features = .{ .avx, null, null, null },
91752 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
91753 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91754 .patterns = &.{
91755 .{ .src = .{ .to_mem, .none, .none } },
91756 },
91757 .call_frame = .{ .alignment = .@"16" },
91758 .extra_temps = .{
91759 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
91760 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91761 .{ .type = .f32, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
91762 .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } },
91763 .unused,
91764 .unused,
91765 .unused,
91766 .unused,
91767 .unused,
91768 .unused,
91769 .unused,
91770 },
91771 .dst_temps = .{ .mem, .unused },
91772 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91773 .each = .{ .once = &.{
91774 .{ ._, ._, .mov, .tmp0d, .sia(-4, .src0, .add_unaligned_size), ._, ._ },
91775 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"4", .tmp0), ._, ._ },
91776 .{ ._, .v_ss, .mov, .tmp2x, .memi(.src0d, .tmp0), ._, ._ },
91777 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
91778 .{ ._, ._, .sub, .tmp0d, .si(4), ._, ._ },
91779 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
91780 } },
91781 }, .{
91782 .required_cc_abi = .sysv64,
9289391783 .required_features = .{ .sse2, null, null, null },
9289491784 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
9289591785 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92921,6 +91811,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9292191811 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9292291812 } },
9292391813 }, .{
91814 .required_cc_abi = .sysv64,
9292491815 .required_features = .{ .sse, null, null, null },
9292591816 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
9292691817 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -92951,6 +91842,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9295191842 .{ ._, ._, .sub, .tmp0d, .si(4), ._, ._ },
9295291843 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9295391844 } },
91845 }, .{
91846 .required_cc_abi = .win64,
91847 .required_features = .{ .sse, null, null, null },
91848 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .dword, .is = .dword } }, .any, .any },
91849 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91850 .patterns = &.{
91851 .{ .src = .{ .to_mem, .none, .none } },
91852 },
91853 .call_frame = .{ .alignment = .@"16" },
91854 .extra_temps = .{
91855 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
91856 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91857 .{ .type = .f32, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
91858 .{ .type = .usize, .kind = .{ .extern_func = "__extendsftf2" } },
91859 .unused,
91860 .unused,
91861 .unused,
91862 .unused,
91863 .unused,
91864 .unused,
91865 .unused,
91866 },
91867 .dst_temps = .{ .mem, .unused },
91868 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91869 .each = .{ .once = &.{
91870 .{ ._, ._, .mov, .tmp0d, .sia(-4, .src0, .add_unaligned_size), ._, ._ },
91871 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"4", .tmp0), ._, ._ },
91872 .{ ._, ._ss, .mov, .tmp2x, .memi(.src0d, .tmp0), ._, ._ },
91873 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
91874 .{ ._, ._, .sub, .tmp0d, .si(4), ._, ._ },
91875 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
91876 } },
9295491877 }, .{
9295591878 .required_features = .{ .x87, null, null, null },
9295691879 .src_constraints = .{ .{ .scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
......@@ -93006,6 +91929,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9300691929 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9300791930 } },
9300891931 }, .{
91932 .required_cc_abi = .sysv64,
9300991933 .required_features = .{ .sse, null, null, null },
9301091934 .src_constraints = .{ .{ .scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
9301191935 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -93032,6 +91956,35 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9303291956 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
9303391957 } },
9303491958 }, .{
91959 .required_cc_abi = .win64,
91960 .required_features = .{ .sse, null, null, null },
91961 .src_constraints = .{ .{ .scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
91962 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
91963 .patterns = &.{
91964 .{ .src = .{ .{ .to_param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } }, .none, .none } },
91965 },
91966 .call_frame = .{ .alignment = .@"16" },
91967 .extra_temps = .{
91968 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
91969 .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } },
91970 .unused,
91971 .unused,
91972 .unused,
91973 .unused,
91974 .unused,
91975 .unused,
91976 .unused,
91977 .unused,
91978 .unused,
91979 },
91980 .dst_temps = .{ .mem, .unused },
91981 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
91982 .each = .{ .once = &.{
91983 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
91984 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
91985 } },
91986 }, .{
91987 .required_cc_abi = .sysv64,
9303591988 .required_features = .{ .avx, null, null, null },
9303691989 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
9303791990 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -93063,6 +92016,39 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9306392016 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9306492017 } },
9306592018 }, .{
92019 .required_cc_abi = .win64,
92020 .required_features = .{ .avx, null, null, null },
92021 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
92022 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
92023 .patterns = &.{
92024 .{ .src = .{ .to_mem, .none, .none } },
92025 },
92026 .call_frame = .{ .alignment = .@"16" },
92027 .extra_temps = .{
92028 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
92029 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
92030 .{ .type = .f64, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
92031 .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } },
92032 .unused,
92033 .unused,
92034 .unused,
92035 .unused,
92036 .unused,
92037 .unused,
92038 .unused,
92039 },
92040 .dst_temps = .{ .mem, .unused },
92041 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
92042 .each = .{ .once = &.{
92043 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
92044 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"2", .tmp0), ._, ._ },
92045 .{ ._, .v_sd, .mov, .tmp2x, .memi(.src0q, .tmp0), ._, ._ },
92046 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
92047 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
92048 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
92049 } },
92050 }, .{
92051 .required_cc_abi = .sysv64,
9306692052 .required_features = .{ .sse2, null, null, null },
9306792053 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
9306892054 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -93094,6 +92080,39 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9309492080 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9309592081 } },
9309692082 }, .{
92083 .required_cc_abi = .win64,
92084 .required_features = .{ .sse2, null, null, null },
92085 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
92086 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
92087 .patterns = &.{
92088 .{ .src = .{ .to_mem, .none, .none } },
92089 },
92090 .call_frame = .{ .alignment = .@"16" },
92091 .extra_temps = .{
92092 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
92093 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
92094 .{ .type = .f64, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
92095 .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } },
92096 .unused,
92097 .unused,
92098 .unused,
92099 .unused,
92100 .unused,
92101 .unused,
92102 .unused,
92103 },
92104 .dst_temps = .{ .mem, .unused },
92105 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
92106 .each = .{ .once = &.{
92107 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
92108 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"2", .tmp0), ._, ._ },
92109 .{ ._, ._sd, .mov, .tmp2x, .memi(.src0q, .tmp0), ._, ._ },
92110 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
92111 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
92112 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
92113 } },
92114 }, .{
92115 .required_cc_abi = .sysv64,
9309792116 .required_features = .{ .sse, null, null, null },
9309892117 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
9309992118 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -93125,6 +92144,39 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9312592144 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
9312692145 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9312792146 } },
92147 }, .{
92148 .required_cc_abi = .win64,
92149 .required_features = .{ .sse, null, null, null },
92150 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .qword, .is = .qword } }, .any, .any },
92151 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
92152 .patterns = &.{
92153 .{ .src = .{ .to_mem, .none, .none } },
92154 },
92155 .call_frame = .{ .alignment = .@"16" },
92156 .extra_temps = .{
92157 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
92158 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
92159 .{ .type = .f64, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 1 } } },
92160 .{ .type = .usize, .kind = .{ .extern_func = "__extenddftf2" } },
92161 .unused,
92162 .unused,
92163 .unused,
92164 .unused,
92165 .unused,
92166 .unused,
92167 .unused,
92168 },
92169 .dst_temps = .{ .mem, .unused },
92170 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
92171 .each = .{ .once = &.{
92172 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
92173 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"2", .tmp0), ._, ._ },
92174 .{ ._, ._ps, .xor, .tmp2x, .tmp2x, ._, ._ },
92175 .{ ._, ._ps, .movl, .tmp2x, .memi(.src0q, .tmp0), ._, ._ },
92176 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
92177 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
92178 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
92179 } },
9312892180 }, .{
9312992181 .required_cc_abi = .sysv64,
9313092182 .required_features = .{ .avx, null, null, null },
......@@ -93214,7 +92266,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9321492266 } },
9321592267 }, .{
9321692268 .required_cc_abi = .win64,
93217 .required_features = .{ .sse, null, null, null },
9321892269 .src_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .tbyte } }, .any, .any },
9321992270 .dst_constraints = .{ .{ .scalar_float = .{ .of = .xword, .is = .xword } }, .any },
9322092271 .patterns = &.{
......@@ -93223,6 +92274,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9322392274 .call_frame = .{ .alignment = .@"16" },
9322492275 .extra_temps = .{
9322592276 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
92277 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
9322692278 .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } },
9322792279 .unused,
9322892280 .unused,
......@@ -93232,13 +92284,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9323292284 .unused,
9323392285 .unused,
9323492286 .unused,
93235 .unused,
9323692287 },
93237 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
92288 .dst_temps = .{ .mem, .unused },
9323892289 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
9323992290 .each = .{ .once = &.{
93240 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
93241 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
92291 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
92292 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
92293 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
9324292294 } },
9324392295 }, .{
9324492296 .required_cc_abi = .sysv64,
......@@ -93273,70 +92325,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9327392325 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
9327492326 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9327592327 } },
93276 }, .{
93277 .required_cc_abi = .win64,
93278 .required_features = .{ .avx, null, null, null },
93279 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .tbyte } }, .any, .any },
93280 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
93281 .patterns = &.{
93282 .{ .src = .{ .to_mem, .none, .none } },
93283 },
93284 .call_frame = .{ .alignment = .@"16" },
93285 .extra_temps = .{
93286 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
93287 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
93288 .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } },
93289 .{ .type = .f80, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
93290 .unused,
93291 .unused,
93292 .unused,
93293 .unused,
93294 .unused,
93295 .unused,
93296 .unused,
93297 },
93298 .dst_temps = .{ .mem, .unused },
93299 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
93300 .each = .{ .once = &.{
93301 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
93302 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
93303 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
93304 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
93305 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
93306 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
93307 } },
93308 }, .{
93309 .required_cc_abi = .win64,
93310 .required_features = .{ .sse2, null, null, null },
93311 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .tbyte } }, .any, .any },
93312 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
93313 .patterns = &.{
93314 .{ .src = .{ .to_mem, .none, .none } },
93315 },
93316 .call_frame = .{ .alignment = .@"16" },
93317 .extra_temps = .{
93318 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
93319 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
93320 .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } },
93321 .{ .type = .f80, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
93322 .unused,
93323 .unused,
93324 .unused,
93325 .unused,
93326 .unused,
93327 .unused,
93328 .unused,
93329 },
93330 .dst_temps = .{ .mem, .unused },
93331 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
93332 .each = .{ .once = &.{
93333 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
93334 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
93335 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
93336 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
93337 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
93338 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
93339 } },
9334092328 }, .{
9334192329 .required_cc_abi = .sysv64,
9334292330 .required_features = .{ .sse2, null, null, null },
......@@ -93405,7 +92393,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9340592393 } },
9340692394 }, .{
9340792395 .required_cc_abi = .win64,
93408 .required_features = .{ .sse, null, null, null },
9340992396 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .tbyte } }, .any, .any },
9341092397 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
9341192398 .patterns = &.{
......@@ -93415,8 +92402,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9341592402 .extra_temps = .{
9341692403 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
9341792404 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
92405 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
9341892406 .{ .type = .usize, .kind = .{ .extern_func = "__extendxftf2" } },
93419 .{ .type = .f80, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
9342092407 .unused,
9342192408 .unused,
9342292409 .unused,
......@@ -93429,9 +92416,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9342992416 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
9343092417 .each = .{ .once = &.{
9343192418 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
93432 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
93433 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
93434 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
92419 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
92420 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
92421 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
9343592422 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
9343692423 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
9343792424 } },
......@@ -96532,7 +95519,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9653295519 .clobbers = .{ .eflags = true },
9653395520 .each = .{ .once = &.{
9653495521 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
96535 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
95522 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9653695523 .{ .@"0:", ._, .movsx, .tmp2q, .memia(.src0b, .tmp0, .add_unaligned_size), ._, ._ },
9653795524 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9653895525 .{ ._, ._r, .sa, .tmp2q, .si(63), ._, ._ },
......@@ -96565,7 +95552,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9656595552 .clobbers = .{ .eflags = true },
9656695553 .each = .{ .once = &.{
9656795554 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
96568 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
95555 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9656995556 .{ .@"0:", ._, .movsx, .tmp2q, .memia(.src0b, .tmp0, .add_unaligned_size), ._, ._ },
9657095557 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9657195558 .{ ._, ._r, .sa, .tmp2q, .si(63), ._, ._ },
......@@ -96598,7 +95585,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9659895585 .clobbers = .{ .eflags = true },
9659995586 .each = .{ .once = &.{
9660095587 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
96601 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
95588 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9660295589 .{ .@"0:", ._, .movzx, .tmp2d, .memia(.src0b, .tmp0, .add_unaligned_size), ._, ._ },
9660395590 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9660495591 .{ ._, ._, .xor, .tmp2d, .tmp2d, ._, ._ },
......@@ -96631,7 +95618,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9663195618 .clobbers = .{ .eflags = true },
9663295619 .each = .{ .once = &.{
9663395620 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
96634 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
95621 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9663595622 .{ .@"0:", ._, .movzx, .tmp2d, .memia(.src0b, .tmp0, .add_unaligned_size), ._, ._ },
9663695623 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9663795624 .{ ._, ._, .xor, .tmp2d, .tmp2d, ._, ._ },
......@@ -97484,7 +96471,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9748496471 .clobbers = .{ .eflags = true },
9748596472 .each = .{ .once = &.{
9748696473 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
97487 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
96474 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9748896475 .{ .@"0:", ._, .movsx, .tmp2q, .memia(.src0w, .tmp0, .add_unaligned_size), ._, ._ },
9748996476 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9749096477 .{ ._, ._r, .sa, .tmp2q, .si(63), ._, ._ },
......@@ -97517,7 +96504,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9751796504 .clobbers = .{ .eflags = true },
9751896505 .each = .{ .once = &.{
9751996506 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
97520 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
96507 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9752196508 .{ .@"0:", ._, .movzx, .tmp2d, .memia(.src0w, .tmp0, .add_unaligned_size), ._, ._ },
9752296509 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9752396510 .{ ._, ._, .xor, .tmp2d, .tmp2d, ._, ._ },
......@@ -98011,7 +96998,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9801196998 .clobbers = .{ .eflags = true },
9801296999 .each = .{ .once = &.{
9801397000 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
98014 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
97001 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9801597002 .{ .@"0:", ._d, .movsx, .tmp2q, .memia(.src0d, .tmp0, .add_unaligned_size), ._, ._ },
9801697003 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9801797004 .{ ._, ._r, .sa, .tmp2q, .si(63), ._, ._ },
......@@ -98044,7 +97031,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
9804497031 .clobbers = .{ .eflags = true },
9804597032 .each = .{ .once = &.{
9804697033 .{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
98047 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
97034 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
9804897035 .{ .@"0:", ._, .mov, .tmp2d, .memia(.src0d, .tmp0, .add_unaligned_size), ._, ._ },
9804997036 .{ ._, ._sq, .sto, ._, ._, ._, ._ },
9805097037 .{ ._, ._, .xor, .tmp2d, .tmp2d, ._, ._ },
......@@ -108792,7 +107779,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
108792107779 .{ ._, ._, .@"or", .memd(.tmp2b, 1), .ui(0b000_0_11_00), ._, ._ },
108793107780 .{ ._, .f_cw, .ld, .tmp2w, ._, ._, ._ },
108794107781 .{ ._, ._, .mov, .memd(.tmp2b, 1), .dst0b, ._, ._ },
108795 .{ ._, ._, .lea, .dst0q, .mem(.tmp3), ._, ._ },
107782 .{ ._, ._, .lea, .dst0p, .mem(.tmp3), ._, ._ },
108796107783 .{ ._, .fi_p, .st, .tmp4q, ._, ._, ._ },
108797107784 .{ ._, .f_, .sub, .lea(.dst0d), ._, ._, ._ },
108798107785 .{ ._, ._, .mov, .tmp5q, .tmp4q, ._, ._ },
......@@ -112008,7 +110995,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
112008110995 .{ ._, ._, .@"or", .memd(.tmp2b, 1), .ui(0b000_0_11_00), ._, ._ },
112009110996 .{ ._, .f_cw, .ld, .tmp2w, ._, ._, ._ },
112010110997 .{ ._, ._, .mov, .memd(.tmp2b, 1), .dst0b, ._, ._ },
112011 .{ ._, ._, .lea, .dst0q, .mem(.tmp3), ._, ._ },
110998 .{ ._, ._, .lea, .dst0p, .mem(.tmp3), ._, ._ },
112012110999 .{ ._, .fi_p, .st, .tmp4q, ._, ._, ._ },
112013111000 .{ ._, .f_, .sub, .lea(.dst0d), ._, ._, ._ },
112014111001 .{ ._, ._, .mov, .tmp5q, .tmp4q, ._, ._ },
......@@ -112051,7 +111038,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
112051111038 .{ ._, ._, .@"or", .memd(.tmp2b, 1), .ui(0b000_0_11_11), ._, ._ },
112052111039 .{ ._, .f_cw, .ld, .tmp2w, ._, ._, ._ },
112053111040 .{ ._, ._, .mov, .memd(.tmp2b, 1), .dst0b, ._, ._ },
112054 .{ ._, ._, .lea, .dst0q, .mem(.tmp3), ._, ._ },
111041 .{ ._, ._, .lea, .dst0p, .mem(.tmp3), ._, ._ },
112055111042 .{ ._, .fi_p, .st, .tmp4q, ._, ._, ._ },
112056111043 .{ ._, .f_, .sub, .lea(.dst0d), ._, ._, ._ },
112057111044 .{ ._, ._, .mov, .tmp5q, .tmp4q, ._, ._ },
......@@ -125336,6 +124323,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125336124323 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125337124324 } },
125338124325 }, .{
124326 .required_cc_abi = .sysv64,
125339124327 .required_features = .{ .sse, null, null, null },
125340124328 .src_constraints = .{ .{ .signed_int = .byte }, .any, .any },
125341124329 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125364,6 +124352,36 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125364124352 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
125365124353 } },
125366124354 }, .{
124355 .required_cc_abi = .win64,
124356 .src_constraints = .{ .{ .signed_int = .byte }, .any, .any },
124357 .dst_constraints = .{ .{ .float = .xword }, .any },
124358 .patterns = &.{
124359 .{ .src = .{ .mem, .none, .none } },
124360 .{ .src = .{ .to_gpr, .none, .none } },
124361 },
124362 .call_frame = .{ .alignment = .@"16" },
124363 .extra_temps = .{
124364 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124365 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124366 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
124367 .unused,
124368 .unused,
124369 .unused,
124370 .unused,
124371 .unused,
124372 .unused,
124373 .unused,
124374 .unused,
124375 },
124376 .dst_temps = .{ .mem, .unused },
124377 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124378 .each = .{ .once = &.{
124379 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124380 .{ ._, ._, .movsx, .tmp1d, .src0b, ._, ._ },
124381 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
124382 } },
124383 }, .{
124384 .required_cc_abi = .sysv64,
125367124385 .required_features = .{ .sse, null, null, null },
125368124386 .src_constraints = .{ .{ .unsigned_int = .byte }, .any, .any },
125369124387 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125392,6 +124410,36 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125392124410 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
125393124411 } },
125394124412 }, .{
124413 .required_cc_abi = .win64,
124414 .src_constraints = .{ .{ .unsigned_int = .byte }, .any, .any },
124415 .dst_constraints = .{ .{ .float = .xword }, .any },
124416 .patterns = &.{
124417 .{ .src = .{ .mem, .none, .none } },
124418 .{ .src = .{ .to_gpr, .none, .none } },
124419 },
124420 .call_frame = .{ .alignment = .@"16" },
124421 .extra_temps = .{
124422 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124423 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124424 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
124425 .unused,
124426 .unused,
124427 .unused,
124428 .unused,
124429 .unused,
124430 .unused,
124431 .unused,
124432 .unused,
124433 },
124434 .dst_temps = .{ .mem, .unused },
124435 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124436 .each = .{ .once = &.{
124437 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124438 .{ ._, ._, .movzx, .tmp1d, .src0b, ._, ._ },
124439 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
124440 } },
124441 }, .{
124442 .required_cc_abi = .sysv64,
125395124443 .required_features = .{ .sse, null, null, null },
125396124444 .src_constraints = .{ .{ .signed_int = .word }, .any, .any },
125397124445 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125420,6 +124468,36 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125420124468 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
125421124469 } },
125422124470 }, .{
124471 .required_cc_abi = .win64,
124472 .src_constraints = .{ .{ .signed_int = .word }, .any, .any },
124473 .dst_constraints = .{ .{ .float = .xword }, .any },
124474 .patterns = &.{
124475 .{ .src = .{ .mem, .none, .none } },
124476 .{ .src = .{ .to_gpr, .none, .none } },
124477 },
124478 .call_frame = .{ .alignment = .@"16" },
124479 .extra_temps = .{
124480 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124481 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124482 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
124483 .unused,
124484 .unused,
124485 .unused,
124486 .unused,
124487 .unused,
124488 .unused,
124489 .unused,
124490 .unused,
124491 },
124492 .dst_temps = .{ .mem, .unused },
124493 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124494 .each = .{ .once = &.{
124495 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124496 .{ ._, ._, .movsx, .tmp1d, .src0w, ._, ._ },
124497 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
124498 } },
124499 }, .{
124500 .required_cc_abi = .sysv64,
125423124501 .required_features = .{ .sse, null, null, null },
125424124502 .src_constraints = .{ .{ .unsigned_int = .word }, .any, .any },
125425124503 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125448,6 +124526,36 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125448124526 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
125449124527 } },
125450124528 }, .{
124529 .required_cc_abi = .win64,
124530 .src_constraints = .{ .{ .unsigned_int = .word }, .any, .any },
124531 .dst_constraints = .{ .{ .float = .xword }, .any },
124532 .patterns = &.{
124533 .{ .src = .{ .mem, .none, .none } },
124534 .{ .src = .{ .to_gpr, .none, .none } },
124535 },
124536 .call_frame = .{ .alignment = .@"16" },
124537 .extra_temps = .{
124538 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124539 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124540 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
124541 .unused,
124542 .unused,
124543 .unused,
124544 .unused,
124545 .unused,
124546 .unused,
124547 .unused,
124548 .unused,
124549 },
124550 .dst_temps = .{ .mem, .unused },
124551 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124552 .each = .{ .once = &.{
124553 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124554 .{ ._, ._, .movzx, .tmp1d, .src0w, ._, ._ },
124555 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
124556 } },
124557 }, .{
124558 .required_cc_abi = .sysv64,
125451124559 .required_features = .{ .sse, null, null, null },
125452124560 .src_constraints = .{ .{ .signed_int = .dword }, .any, .any },
125453124561 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125474,6 +124582,34 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125474124582 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
125475124583 } },
125476124584 }, .{
124585 .required_cc_abi = .win64,
124586 .src_constraints = .{ .{ .signed_int = .dword }, .any, .any },
124587 .dst_constraints = .{ .{ .float = .xword }, .any },
124588 .patterns = &.{
124589 .{ .src = .{ .{ .to_param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } }, .none, .none } },
124590 },
124591 .call_frame = .{ .alignment = .@"16" },
124592 .extra_temps = .{
124593 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124594 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
124595 .unused,
124596 .unused,
124597 .unused,
124598 .unused,
124599 .unused,
124600 .unused,
124601 .unused,
124602 .unused,
124603 .unused,
124604 },
124605 .dst_temps = .{ .mem, .unused },
124606 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124607 .each = .{ .once = &.{
124608 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124609 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
124610 } },
124611 }, .{
124612 .required_cc_abi = .sysv64,
125477124613 .required_features = .{ .sse, null, null, null },
125478124614 .src_constraints = .{ .{ .unsigned_int = .dword }, .any, .any },
125479124615 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125500,6 +124636,34 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125500124636 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
125501124637 } },
125502124638 }, .{
124639 .required_cc_abi = .win64,
124640 .src_constraints = .{ .{ .unsigned_int = .dword }, .any, .any },
124641 .dst_constraints = .{ .{ .float = .xword }, .any },
124642 .patterns = &.{
124643 .{ .src = .{ .{ .to_param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } }, .none, .none } },
124644 },
124645 .call_frame = .{ .alignment = .@"16" },
124646 .extra_temps = .{
124647 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124648 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
124649 .unused,
124650 .unused,
124651 .unused,
124652 .unused,
124653 .unused,
124654 .unused,
124655 .unused,
124656 .unused,
124657 .unused,
124658 },
124659 .dst_temps = .{ .mem, .unused },
124660 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124661 .each = .{ .once = &.{
124662 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124663 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
124664 } },
124665 }, .{
124666 .required_cc_abi = .sysv64,
125503124667 .required_features = .{ .@"64bit", .sse, null, null },
125504124668 .src_constraints = .{ .{ .signed_int = .qword }, .any, .any },
125505124669 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125526,6 +124690,35 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125526124690 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
125527124691 } },
125528124692 }, .{
124693 .required_cc_abi = .win64,
124694 .required_features = .{ .@"64bit", null, null, null },
124695 .src_constraints = .{ .{ .signed_int = .qword }, .any, .any },
124696 .dst_constraints = .{ .{ .float = .xword }, .any },
124697 .patterns = &.{
124698 .{ .src = .{ .{ .to_param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } }, .none, .none } },
124699 },
124700 .call_frame = .{ .alignment = .@"16" },
124701 .extra_temps = .{
124702 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124703 .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } },
124704 .unused,
124705 .unused,
124706 .unused,
124707 .unused,
124708 .unused,
124709 .unused,
124710 .unused,
124711 .unused,
124712 .unused,
124713 },
124714 .dst_temps = .{ .mem, .unused },
124715 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124716 .each = .{ .once = &.{
124717 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124718 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
124719 } },
124720 }, .{
124721 .required_cc_abi = .sysv64,
125529124722 .required_features = .{ .@"64bit", .sse, null, null },
125530124723 .src_constraints = .{ .{ .unsigned_int = .qword }, .any, .any },
125531124724 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125551,6 +124744,34 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125551124744 .each = .{ .once = &.{
125552124745 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
125553124746 } },
124747 }, .{
124748 .required_cc_abi = .win64,
124749 .required_features = .{ .@"64bit", null, null, null },
124750 .src_constraints = .{ .{ .unsigned_int = .qword }, .any, .any },
124751 .dst_constraints = .{ .{ .float = .xword }, .any },
124752 .patterns = &.{
124753 .{ .src = .{ .{ .to_param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } }, .none, .none } },
124754 },
124755 .call_frame = .{ .alignment = .@"16" },
124756 .extra_temps = .{
124757 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124758 .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } },
124759 .unused,
124760 .unused,
124761 .unused,
124762 .unused,
124763 .unused,
124764 .unused,
124765 .unused,
124766 .unused,
124767 .unused,
124768 },
124769 .dst_temps = .{ .mem, .unused },
124770 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124771 .each = .{ .once = &.{
124772 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124773 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
124774 } },
125554124775 }, .{
125555124776 .required_cc_abi = .sysv64,
125556124777 .required_features = .{ .sse, null, null, null },
......@@ -125580,7 +124801,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125580124801 } },
125581124802 }, .{
125582124803 .required_cc_abi = .win64,
125583 .required_features = .{ .sse, null, null, null },
125584124804 .src_constraints = .{ .{ .signed_int = .xword }, .any, .any },
125585124805 .dst_constraints = .{ .{ .float = .xword }, .any },
125586124806 .patterns = &.{
......@@ -125589,6 +124809,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125589124809 .call_frame = .{ .alignment = .@"16" },
125590124810 .extra_temps = .{
125591124811 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124812 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125592124813 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
125593124814 .unused,
125594124815 .unused,
......@@ -125598,15 +124819,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125598124819 .unused,
125599124820 .unused,
125600124821 .unused,
125601 .unused,
125602124822 },
125603 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
124823 .dst_temps = .{ .mem, .unused },
125604124824 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125605124825 .each = .{ .once = &.{
125606 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
125607 .{ ._, ._, .call, .tmp1d, ._, ._, ._ },
124826 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124827 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
124828 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
125608124829 } },
125609124830 }, .{
124831 .required_cc_abi = .sysv64,
125610124832 .required_features = .{ .sse, null, null, null },
125611124833 .src_constraints = .{ .{ .unsigned_int = .xword }, .any, .any },
125612124834 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125633,6 +124855,35 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125633124855 .{ ._, ._, .call, .tmp0d, ._, ._, ._ },
125634124856 } },
125635124857 }, .{
124858 .required_cc_abi = .win64,
124859 .src_constraints = .{ .{ .unsigned_int = .xword }, .any, .any },
124860 .dst_constraints = .{ .{ .float = .xword }, .any },
124861 .patterns = &.{
124862 .{ .src = .{ .to_mem, .none, .none } },
124863 },
124864 .call_frame = .{ .alignment = .@"16" },
124865 .extra_temps = .{
124866 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124867 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124868 .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } },
124869 .unused,
124870 .unused,
124871 .unused,
124872 .unused,
124873 .unused,
124874 .unused,
124875 .unused,
124876 .unused,
124877 },
124878 .dst_temps = .{ .mem, .unused },
124879 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124880 .each = .{ .once = &.{
124881 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124882 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
124883 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
124884 } },
124885 }, .{
124886 .required_cc_abi = .sysv64,
125636124887 .required_features = .{ .@"64bit", .sse, null, null },
125637124888 .src_constraints = .{ .{ .remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
125638124889 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125661,6 +124912,37 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125661124912 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
125662124913 } },
125663124914 }, .{
124915 .required_cc_abi = .win64,
124916 .required_features = .{ .@"64bit", null, null, null },
124917 .src_constraints = .{ .{ .remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
124918 .dst_constraints = .{ .{ .float = .xword }, .any },
124919 .patterns = &.{
124920 .{ .src = .{ .to_mem, .none, .none } },
124921 },
124922 .call_frame = .{ .alignment = .@"16" },
124923 .extra_temps = .{
124924 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124925 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124926 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
124927 .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } },
124928 .unused,
124929 .unused,
124930 .unused,
124931 .unused,
124932 .unused,
124933 .unused,
124934 .unused,
124935 },
124936 .dst_temps = .{ .mem, .unused },
124937 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124938 .each = .{ .once = &.{
124939 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124940 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
124941 .{ ._, ._, .mov, .tmp2d, .sa(.src0, .add_bit_size), ._, ._ },
124942 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
124943 } },
124944 }, .{
124945 .required_cc_abi = .sysv64,
125664124946 .required_features = .{ .@"64bit", .sse, null, null },
125665124947 .src_constraints = .{ .{ .remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
125666124948 .dst_constraints = .{ .{ .float = .xword }, .any },
......@@ -125689,6 +124971,37 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125689124971 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
125690124972 } },
125691124973 }, .{
124974 .required_cc_abi = .win64,
124975 .required_features = .{ .@"64bit", null, null, null },
124976 .src_constraints = .{ .{ .remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
124977 .dst_constraints = .{ .{ .float = .xword }, .any },
124978 .patterns = &.{
124979 .{ .src = .{ .to_mem, .none, .none } },
124980 },
124981 .call_frame = .{ .alignment = .@"16" },
124982 .extra_temps = .{
124983 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
124984 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
124985 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
124986 .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } },
124987 .unused,
124988 .unused,
124989 .unused,
124990 .unused,
124991 .unused,
124992 .unused,
124993 .unused,
124994 },
124995 .dst_temps = .{ .mem, .unused },
124996 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
124997 .each = .{ .once = &.{
124998 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
124999 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
125000 .{ ._, ._, .mov, .tmp2d, .sa(.src0, .add_bit_size), ._, ._ },
125001 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125002 } },
125003 }, .{
125004 .required_cc_abi = .sysv64,
125692125005 .required_features = .{ .avx, .slow_incdec, null, null },
125693125006 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125694125007 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -125722,6 +125035,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125722125035 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125723125036 } },
125724125037 }, .{
125038 .required_cc_abi = .sysv64,
125725125039 .required_features = .{ .avx, null, null, null },
125726125040 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125727125041 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -125749,13 +125063,150 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125749125063 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125750125064 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125751125065 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125752 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125066 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125067 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125068 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125069 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125070 } },
125071 }, .{
125072 .required_cc_abi = .sysv64,
125073 .required_features = .{ .sse2, .slow_incdec, null, null },
125074 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125075 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125076 .patterns = &.{
125077 .{ .src = .{ .to_mem, .none, .none } },
125078 },
125079 .call_frame = .{ .alignment = .@"16" },
125080 .extra_temps = .{
125081 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125082 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125083 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125084 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125085 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125086 .unused,
125087 .unused,
125088 .unused,
125089 .unused,
125090 .unused,
125091 .unused,
125092 },
125093 .dst_temps = .{ .mem, .unused },
125094 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125095 .each = .{ .once = &.{
125096 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125097 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125098 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125099 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125100 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125101 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125102 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125103 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125104 } },
125105 }, .{
125106 .required_cc_abi = .sysv64,
125107 .required_features = .{ .sse2, null, null, null },
125108 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125109 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125110 .patterns = &.{
125111 .{ .src = .{ .to_mem, .none, .none } },
125112 },
125113 .call_frame = .{ .alignment = .@"16" },
125114 .extra_temps = .{
125115 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125116 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125117 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125118 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125119 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125120 .unused,
125121 .unused,
125122 .unused,
125123 .unused,
125124 .unused,
125125 .unused,
125126 },
125127 .dst_temps = .{ .mem, .unused },
125128 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125129 .each = .{ .once = &.{
125130 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125131 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125132 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125133 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125134 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125135 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125136 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125137 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125138 } },
125139 }, .{
125140 .required_cc_abi = .sysv64,
125141 .required_features = .{ .sse, .slow_incdec, null, null },
125142 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125143 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125144 .patterns = &.{
125145 .{ .src = .{ .to_mem, .none, .none } },
125146 },
125147 .call_frame = .{ .alignment = .@"16" },
125148 .extra_temps = .{
125149 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125150 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125151 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125152 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125153 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125154 .unused,
125155 .unused,
125156 .unused,
125157 .unused,
125158 .unused,
125159 .unused,
125160 },
125161 .dst_temps = .{ .mem, .unused },
125162 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125163 .each = .{ .once = &.{
125164 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125165 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125166 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125167 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125168 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125169 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125170 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125171 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125172 } },
125173 }, .{
125174 .required_cc_abi = .sysv64,
125175 .required_features = .{ .sse, null, null, null },
125176 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125177 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125178 .patterns = &.{
125179 .{ .src = .{ .to_mem, .none, .none } },
125180 },
125181 .call_frame = .{ .alignment = .@"16" },
125182 .extra_temps = .{
125183 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125184 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125185 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125186 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125187 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125188 .unused,
125189 .unused,
125190 .unused,
125191 .unused,
125192 .unused,
125193 .unused,
125194 },
125195 .dst_temps = .{ .mem, .unused },
125196 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125197 .each = .{ .once = &.{
125198 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125199 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125200 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125201 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125202 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125753125203 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125754125204 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125755125205 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125756125206 } },
125757125207 }, .{
125758 .required_features = .{ .sse2, .slow_incdec, null, null },
125208 .required_cc_abi = .win64,
125209 .required_features = .{ .slow_incdec, null, null, null },
125759125210 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125760125211 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125761125212 .patterns = &.{
......@@ -125765,9 +125216,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125765125216 .extra_temps = .{
125766125217 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125767125218 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125768 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125219 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125220 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125769125221 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125770 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125771125222 .unused,
125772125223 .unused,
125773125224 .unused,
......@@ -125780,15 +125231,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125780125231 .each = .{ .once = &.{
125781125232 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125782125233 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125783 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125784 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125785 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125234 .{ .@"0:", ._, .mov, .tmp2p, .tmp1p, ._, ._ },
125235 .{ ._, ._, .movsx, .tmp3d, .memi(.src0b, .tmp0), ._, ._ },
125236 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
125786125237 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125787125238 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125788125239 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125789125240 } },
125790125241 }, .{
125791 .required_features = .{ .sse2, null, null, null },
125242 .required_cc_abi = .win64,
125792125243 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125793125244 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125794125245 .patterns = &.{
......@@ -125798,9 +125249,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125798125249 .extra_temps = .{
125799125250 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125800125251 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125801 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125252 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125253 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125802125254 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125803 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125804125255 .unused,
125805125256 .unused,
125806125257 .unused,
......@@ -125813,16 +125264,17 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125813125264 .each = .{ .once = &.{
125814125265 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125815125266 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125816 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125817 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125818 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125267 .{ .@"0:", ._, .mov, .tmp2p, .tmp1p, ._, ._ },
125268 .{ ._, ._, .movsx, .tmp3d, .memi(.src0b, .tmp0), ._, ._ },
125269 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
125819125270 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125820125271 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125821125272 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125822125273 } },
125823125274 }, .{
125824 .required_features = .{ .sse, .slow_incdec, null, null },
125825 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125275 .required_cc_abi = .sysv64,
125276 .required_features = .{ .avx, .slow_incdec, null, null },
125277 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125826125278 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125827125279 .patterns = &.{
125828125280 .{ .src = .{ .to_mem, .none, .none } },
......@@ -125831,8 +125283,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125831125283 .extra_temps = .{
125832125284 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125833125285 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125834 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125835 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125286 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125287 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
125836125288 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125837125289 .unused,
125838125290 .unused,
......@@ -125846,16 +125298,17 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125846125298 .each = .{ .once = &.{
125847125299 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125848125300 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125849 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125301 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125850125302 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125851 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125303 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125852125304 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125853125305 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125854125306 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125855125307 } },
125856125308 }, .{
125857 .required_features = .{ .sse, null, null, null },
125858 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125309 .required_cc_abi = .sysv64,
125310 .required_features = .{ .avx, null, null, null },
125311 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125859125312 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125860125313 .patterns = &.{
125861125314 .{ .src = .{ .to_mem, .none, .none } },
......@@ -125864,8 +125317,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125864125317 .extra_temps = .{
125865125318 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125866125319 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
125867 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125868 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125320 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125321 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
125869125322 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125870125323 .unused,
125871125324 .unused,
......@@ -125879,15 +125332,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125879125332 .each = .{ .once = &.{
125880125333 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
125881125334 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125882 .{ .@"0:", ._, .movsx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125335 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125883125336 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125884 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125337 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125885125338 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125886125339 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125887125340 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125888125341 } },
125889125342 }, .{
125890 .required_features = .{ .avx, .slow_incdec, null, null },
125343 .required_cc_abi = .sysv64,
125344 .required_features = .{ .sse2, .slow_incdec, null, null },
125891125345 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125892125346 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125893125347 .patterns = &.{
......@@ -125914,13 +125368,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125914125368 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125915125369 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125916125370 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125917 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125371 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125918125372 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125919125373 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125920125374 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125921125375 } },
125922125376 }, .{
125923 .required_features = .{ .avx, null, null, null },
125377 .required_cc_abi = .sysv64,
125378 .required_features = .{ .sse2, null, null, null },
125924125379 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125925125380 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125926125381 .patterns = &.{
......@@ -125947,13 +125402,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125947125402 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125948125403 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125949125404 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125950 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125405 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125951125406 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125952125407 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
125953125408 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
125954125409 } },
125955125410 }, .{
125956 .required_features = .{ .sse2, .slow_incdec, null, null },
125411 .required_cc_abi = .sysv64,
125412 .required_features = .{ .sse, .slow_incdec, null, null },
125957125413 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125958125414 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125959125415 .patterns = &.{
......@@ -125980,13 +125436,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
125980125436 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
125981125437 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
125982125438 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125983 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125439 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125984125440 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
125985125441 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
125986125442 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125987125443 } },
125988125444 }, .{
125989 .required_features = .{ .sse2, null, null, null },
125445 .required_cc_abi = .sysv64,
125446 .required_features = .{ .sse, null, null, null },
125990125447 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
125991125448 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125992125449 .patterns = &.{
......@@ -126013,13 +125470,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126013125470 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
126014125471 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
126015125472 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126016 .{ ._, ._dqa, .mov, .lea(.tmp1x), .tmp4x, ._, ._ },
125473 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
126017125474 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
126018125475 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
126019125476 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
126020125477 } },
126021125478 }, .{
126022 .required_features = .{ .sse, .slow_incdec, null, null },
125479 .required_cc_abi = .win64,
125480 .required_features = .{ .slow_incdec, null, null, null },
126023125481 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
126024125482 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126025125483 .patterns = &.{
......@@ -126029,9 +125487,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126029125487 .extra_temps = .{
126030125488 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126031125489 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126032 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125490 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125491 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126033125492 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
126034 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126035125493 .unused,
126036125494 .unused,
126037125495 .unused,
......@@ -126044,15 +125502,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126044125502 .each = .{ .once = &.{
126045125503 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
126046125504 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
126047 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
126048 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126049 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125505 .{ .@"0:", ._, .mov, .tmp2p, .tmp1p, ._, ._ },
125506 .{ ._, ._, .movzx, .tmp3d, .memi(.src0b, .tmp0), ._, ._ },
125507 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
126050125508 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
126051125509 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
126052125510 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126053125511 } },
126054125512 }, .{
126055 .required_features = .{ .sse, null, null, null },
125513 .required_cc_abi = .win64,
126056125514 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .byte, .is = .byte } }, .any, .any },
126057125515 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126058125516 .patterns = &.{
......@@ -126062,9 +125520,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126062125520 .extra_temps = .{
126063125521 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126064125522 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126065 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125523 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125524 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126066125525 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
126067 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126068125526 .unused,
126069125527 .unused,
126070125528 .unused,
......@@ -126077,14 +125535,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126077125535 .each = .{ .once = &.{
126078125536 .{ ._, ._, .mov, .tmp0d, .sia(-1, .src0, .add_unaligned_size), ._, ._ },
126079125537 .{ ._, ._, .lea, .tmp1p, .memad(.dst0, .add_unaligned_size, -16), ._, ._ },
126080 .{ .@"0:", ._, .movzx, .tmp2d, .memi(.src0b, .tmp0), ._, ._ },
126081 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126082 .{ ._, ._ps, .mova, .lea(.tmp1x), .tmp4x, ._, ._ },
125538 .{ .@"0:", ._, .mov, .tmp2p, .tmp1p, ._, ._ },
125539 .{ ._, ._, .movzx, .tmp3d, .memi(.src0b, .tmp0), ._, ._ },
125540 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
126083125541 .{ ._, ._, .lea, .tmp1p, .lead(.tmp1, -16), ._, ._ },
126084125542 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
126085125543 .{ ._, ._ns, .j, .@"0b", ._, ._, ._ },
126086125544 } },
126087125545 }, .{
125546 .required_cc_abi = .sysv64,
126088125547 .required_features = .{ .avx, null, null, null },
126089125548 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .word, .is = .word } }, .any, .any },
126090125549 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126116,6 +125575,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126116125575 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126117125576 } },
126118125577 }, .{
125578 .required_cc_abi = .sysv64,
126119125579 .required_features = .{ .sse2, null, null, null },
126120125580 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .word, .is = .word } }, .any, .any },
126121125581 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126147,6 +125607,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126147125607 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126148125608 } },
126149125609 }, .{
125610 .required_cc_abi = .sysv64,
126150125611 .required_features = .{ .sse, null, null, null },
126151125612 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .word, .is = .word } }, .any, .any },
126152125613 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126178,6 +125639,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126178125639 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126179125640 } },
126180125641 }, .{
125642 .required_cc_abi = .win64,
125643 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .word, .is = .word } }, .any, .any },
125644 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125645 .patterns = &.{
125646 .{ .src = .{ .to_mem, .none, .none } },
125647 },
125648 .call_frame = .{ .alignment = .@"16" },
125649 .extra_temps = .{
125650 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125651 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125652 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125653 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125654 .unused,
125655 .unused,
125656 .unused,
125657 .unused,
125658 .unused,
125659 .unused,
125660 .unused,
125661 },
125662 .dst_temps = .{ .mem, .unused },
125663 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125664 .each = .{ .once = &.{
125665 .{ ._, ._, .mov, .tmp0d, .sia(-2, .src0, .add_unaligned_size), ._, ._ },
125666 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"8", .tmp0), ._, ._ },
125667 .{ ._, ._, .movsx, .tmp2d, .memi(.src0w, .tmp0), ._, ._ },
125668 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125669 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
125670 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125671 } },
125672 }, .{
125673 .required_cc_abi = .sysv64,
126181125674 .required_features = .{ .avx, null, null, null },
126182125675 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .word, .is = .word } }, .any, .any },
126183125676 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126209,6 +125702,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126209125702 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126210125703 } },
126211125704 }, .{
125705 .required_cc_abi = .sysv64,
126212125706 .required_features = .{ .sse2, null, null, null },
126213125707 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .word, .is = .word } }, .any, .any },
126214125708 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126240,6 +125734,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126240125734 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126241125735 } },
126242125736 }, .{
125737 .required_cc_abi = .sysv64,
126243125738 .required_features = .{ .sse, null, null, null },
126244125739 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .word, .is = .word } }, .any, .any },
126245125740 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126271,6 +125766,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126271125766 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126272125767 } },
126273125768 }, .{
125769 .required_cc_abi = .win64,
125770 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .word, .is = .word } }, .any, .any },
125771 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125772 .patterns = &.{
125773 .{ .src = .{ .to_mem, .none, .none } },
125774 },
125775 .call_frame = .{ .alignment = .@"16" },
125776 .extra_temps = .{
125777 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125778 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125779 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125780 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
125781 .unused,
125782 .unused,
125783 .unused,
125784 .unused,
125785 .unused,
125786 .unused,
125787 .unused,
125788 },
125789 .dst_temps = .{ .mem, .unused },
125790 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125791 .each = .{ .once = &.{
125792 .{ ._, ._, .mov, .tmp0d, .sia(-2, .src0, .add_unaligned_size), ._, ._ },
125793 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"8", .tmp0), ._, ._ },
125794 .{ ._, ._, .movzx, .tmp2d, .memi(.src0w, .tmp0), ._, ._ },
125795 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125796 .{ ._, ._, .sub, .tmp0d, .si(2), ._, ._ },
125797 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125798 } },
125799 }, .{
125800 .required_cc_abi = .sysv64,
126274125801 .required_features = .{ .avx, null, null, null },
126275125802 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126276125803 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126302,6 +125829,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126302125829 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126303125830 } },
126304125831 }, .{
125832 .required_cc_abi = .sysv64,
126305125833 .required_features = .{ .sse2, null, null, null },
126306125834 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126307125835 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126333,6 +125861,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126333125861 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126334125862 } },
126335125863 }, .{
125864 .required_cc_abi = .sysv64,
126336125865 .required_features = .{ .sse, null, null, null },
126337125866 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126338125867 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126364,6 +125893,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126364125893 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126365125894 } },
126366125895 }, .{
125896 .required_cc_abi = .win64,
125897 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
125898 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
125899 .patterns = &.{
125900 .{ .src = .{ .to_mem, .none, .none } },
125901 },
125902 .call_frame = .{ .alignment = .@"16" },
125903 .extra_temps = .{
125904 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
125905 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
125906 .{ .type = .i32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
125907 .{ .type = .usize, .kind = .{ .extern_func = "__floatsitf" } },
125908 .unused,
125909 .unused,
125910 .unused,
125911 .unused,
125912 .unused,
125913 .unused,
125914 .unused,
125915 },
125916 .dst_temps = .{ .mem, .unused },
125917 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
125918 .each = .{ .once = &.{
125919 .{ ._, ._, .mov, .tmp0d, .sia(-4, .src0, .add_unaligned_size), ._, ._ },
125920 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"4", .tmp0), ._, ._ },
125921 .{ ._, ._, .mov, .tmp2d, .memi(.src0d, .tmp0), ._, ._ },
125922 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
125923 .{ ._, ._, .sub, .tmp0d, .si(4), ._, ._ },
125924 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
125925 } },
125926 }, .{
125927 .required_cc_abi = .sysv64,
126367125928 .required_features = .{ .avx, null, null, null },
126368125929 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126369125930 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126395,6 +125956,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126395125956 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126396125957 } },
126397125958 }, .{
125959 .required_cc_abi = .sysv64,
126398125960 .required_features = .{ .sse2, null, null, null },
126399125961 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126400125962 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126426,6 +125988,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126426125988 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126427125989 } },
126428125990 }, .{
125991 .required_cc_abi = .sysv64,
126429125992 .required_features = .{ .sse, null, null, null },
126430125993 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126431125994 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126457,6 +126020,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126457126020 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126458126021 } },
126459126022 }, .{
126023 .required_cc_abi = .win64,
126024 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126025 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126026 .patterns = &.{
126027 .{ .src = .{ .to_mem, .none, .none } },
126028 },
126029 .call_frame = .{ .alignment = .@"16" },
126030 .extra_temps = .{
126031 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126032 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126033 .{ .type = .u32, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126034 .{ .type = .usize, .kind = .{ .extern_func = "__floatunsitf" } },
126035 .unused,
126036 .unused,
126037 .unused,
126038 .unused,
126039 .unused,
126040 .unused,
126041 .unused,
126042 },
126043 .dst_temps = .{ .mem, .unused },
126044 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126045 .each = .{ .once = &.{
126046 .{ ._, ._, .mov, .tmp0d, .sia(-4, .src0, .add_unaligned_size), ._, ._ },
126047 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"4", .tmp0), ._, ._ },
126048 .{ ._, ._, .mov, .tmp2d, .memi(.src0d, .tmp0), ._, ._ },
126049 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126050 .{ ._, ._, .sub, .tmp0d, .si(4), ._, ._ },
126051 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126052 } },
126053 }, .{
126054 .required_cc_abi = .sysv64,
126460126055 .required_features = .{ .@"64bit", .avx, null, null },
126461126056 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126462126057 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126483,12 +126078,45 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126483126078 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
126484126079 .{ .@"0:", ._, .mov, .tmp1q, .memi(.src0q, .tmp0), ._, ._ },
126485126080 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126486 .{ ._, .v_dqa, .mov, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126081 .{ ._, .v_dqa, .mov, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126082 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
126083 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126084 } },
126085 }, .{
126086 .required_cc_abi = .sysv64,
126087 .required_features = .{ .@"64bit", .sse2, null, null },
126088 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126089 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126090 .patterns = &.{
126091 .{ .src = .{ .to_mem, .none, .none } },
126092 },
126093 .call_frame = .{ .alignment = .@"16" },
126094 .extra_temps = .{
126095 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126096 .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126097 .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } },
126098 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126099 .unused,
126100 .unused,
126101 .unused,
126102 .unused,
126103 .unused,
126104 .unused,
126105 .unused,
126106 },
126107 .dst_temps = .{ .mem, .unused },
126108 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126109 .each = .{ .once = &.{
126110 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
126111 .{ .@"0:", ._, .mov, .tmp1q, .memi(.src0q, .tmp0), ._, ._ },
126112 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126113 .{ ._, ._dqa, .mov, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126487126114 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
126488126115 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126489126116 } },
126490126117 }, .{
126491 .required_features = .{ .@"64bit", .sse2, null, null },
126118 .required_cc_abi = .sysv64,
126119 .required_features = .{ .@"64bit", .sse, null, null },
126492126120 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126493126121 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126494126122 .patterns = &.{
......@@ -126514,12 +126142,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126514126142 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
126515126143 .{ .@"0:", ._, .mov, .tmp1q, .memi(.src0q, .tmp0), ._, ._ },
126516126144 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126517 .{ ._, ._dqa, .mov, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126145 .{ ._, ._ps, .mova, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126518126146 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
126519126147 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126520126148 } },
126521126149 }, .{
126522 .required_features = .{ .@"64bit", .sse, null, null },
126150 .required_cc_abi = .win64,
126151 .required_features = .{ .@"64bit", null, null, null },
126523126152 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126524126153 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126525126154 .patterns = &.{
......@@ -126528,9 +126157,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126528126157 .call_frame = .{ .alignment = .@"16" },
126529126158 .extra_temps = .{
126530126159 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126531 .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126160 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126161 .{ .type = .i64, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126532126162 .{ .type = .usize, .kind = .{ .extern_func = "__floatditf" } },
126533 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126534126163 .unused,
126535126164 .unused,
126536126165 .unused,
......@@ -126543,13 +126172,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126543126172 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126544126173 .each = .{ .once = &.{
126545126174 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
126546 .{ .@"0:", ._, .mov, .tmp1q, .memi(.src0q, .tmp0), ._, ._ },
126547 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126548 .{ ._, ._ps, .mova, .memsi(.dst0x, .@"2", .tmp0), .tmp3x, ._, ._ },
126175 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"2", .tmp0), ._, ._ },
126176 .{ ._, ._, .mov, .tmp2q, .memi(.src0q, .tmp0), ._, ._ },
126177 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126549126178 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
126550126179 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126551126180 } },
126552126181 }, .{
126182 .required_cc_abi = .sysv64,
126553126183 .required_features = .{ .@"64bit", .avx, null, null },
126554126184 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126555126185 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126581,6 +126211,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126581126211 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126582126212 } },
126583126213 }, .{
126214 .required_cc_abi = .sysv64,
126584126215 .required_features = .{ .@"64bit", .sse2, null, null },
126585126216 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126586126217 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126612,6 +126243,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126612126243 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126613126244 } },
126614126245 }, .{
126246 .required_cc_abi = .sysv64,
126615126247 .required_features = .{ .@"64bit", .sse, null, null },
126616126248 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126617126249 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126643,9 +126275,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126643126275 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126644126276 } },
126645126277 }, .{
126646 .required_cc_abi = .sysv64,
126647 .required_features = .{ .avx, null, null, null },
126648 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126278 .required_cc_abi = .win64,
126279 .required_features = .{ .@"64bit", null, null, null },
126280 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .qword, .is = .qword } }, .any, .any },
126649126281 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126650126282 .patterns = &.{
126651126283 .{ .src = .{ .to_mem, .none, .none } },
......@@ -126653,9 +126285,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126653126285 .call_frame = .{ .alignment = .@"16" },
126654126286 .extra_temps = .{
126655126287 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126656 .{ .type = .i128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126657 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
126658 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126288 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126289 .{ .type = .u64, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126290 .{ .type = .usize, .kind = .{ .extern_func = "__floatunditf" } },
126659126291 .unused,
126660126292 .unused,
126661126293 .unused,
......@@ -126667,16 +126299,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126667126299 .dst_temps = .{ .mem, .unused },
126668126300 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126669126301 .each = .{ .once = &.{
126670 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126671 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126672 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126673 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126674 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126675 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126302 .{ ._, ._, .mov, .tmp0d, .sia(-8, .src0, .add_unaligned_size), ._, ._ },
126303 .{ .@"0:", ._, .lea, .tmp1p, .memsi(.dst0, .@"2", .tmp0), ._, ._ },
126304 .{ ._, ._, .mov, .tmp2q, .memi(.src0q, .tmp0), ._, ._ },
126305 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126306 .{ ._, ._, .sub, .tmp0d, .si(8), ._, ._ },
126676126307 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126677126308 } },
126678126309 }, .{
126679 .required_cc_abi = .win64,
126310 .required_cc_abi = .sysv64,
126680126311 .required_features = .{ .avx, null, null, null },
126681126312 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126682126313 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126686,7 +126317,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126686126317 .call_frame = .{ .alignment = .@"16" },
126687126318 .extra_temps = .{
126688126319 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126689 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126320 .{ .type = .i128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126690126321 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
126691126322 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126692126323 .unused,
......@@ -126701,7 +126332,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126701126332 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126702126333 .each = .{ .once = &.{
126703126334 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126704 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
126335 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126336 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126705126337 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126706126338 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126707126339 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
......@@ -126741,8 +126373,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126741126373 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126742126374 } },
126743126375 }, .{
126744 .required_cc_abi = .win64,
126745 .required_features = .{ .sse2, null, null, null },
126376 .required_cc_abi = .sysv64,
126377 .required_features = .{ .sse, null, null, null },
126746126378 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126747126379 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126748126380 .patterns = &.{
......@@ -126751,7 +126383,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126751126383 .call_frame = .{ .alignment = .@"16" },
126752126384 .extra_temps = .{
126753126385 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126754 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126386 .{ .type = .u128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126755126387 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
126756126388 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126757126389 .unused,
......@@ -126766,15 +126398,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126766126398 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126767126399 .each = .{ .once = &.{
126768126400 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126769 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
126401 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126402 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126770126403 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126771 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126404 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126772126405 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126773126406 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126774126407 } },
126775126408 }, .{
126776 .required_cc_abi = .sysv64,
126777 .required_features = .{ .sse, null, null, null },
126409 .required_cc_abi = .win64,
126778126410 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126779126411 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126780126412 .patterns = &.{
......@@ -126783,9 +126415,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126783126415 .call_frame = .{ .alignment = .@"16" },
126784126416 .extra_temps = .{
126785126417 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126786 .{ .type = .u128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126418 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126419 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126787126420 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
126788 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126789126421 .unused,
126790126422 .unused,
126791126423 .unused,
......@@ -126798,17 +126430,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126798126430 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126799126431 .each = .{ .once = &.{
126800126432 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126801 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126802 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126803 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126804 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126433 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
126434 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
126435 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126805126436 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126806126437 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126807126438 } },
126808126439 }, .{
126809 .required_cc_abi = .win64,
126810 .required_features = .{ .sse, null, null, null },
126811 .src_constraints = .{ .{ .multiple_scalar_signed_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126440 .required_cc_abi = .sysv64,
126441 .required_features = .{ .avx, null, null, null },
126442 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126812126443 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126813126444 .patterns = &.{
126814126445 .{ .src = .{ .to_mem, .none, .none } },
......@@ -126816,8 +126447,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126816126447 .call_frame = .{ .alignment = .@"16" },
126817126448 .extra_temps = .{
126818126449 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126819 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126820 .{ .type = .usize, .kind = .{ .extern_func = "__floattitf" } },
126450 .{ .type = .u128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126451 .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } },
126821126452 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126822126453 .unused,
126823126454 .unused,
......@@ -126831,14 +126462,16 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126831126462 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126832126463 .each = .{ .once = &.{
126833126464 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126834 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
126465 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126466 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126835126467 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126836 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126468 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126837126469 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126838126470 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126839126471 } },
126840126472 }, .{
126841 .required_features = .{ .avx, null, null, null },
126473 .required_cc_abi = .sysv64,
126474 .required_features = .{ .sse2, null, null, null },
126842126475 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126843126476 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126844126477 .patterns = &.{
......@@ -126865,12 +126498,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126865126498 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126866126499 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126867126500 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126868 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126501 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126869126502 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126870126503 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126871126504 } },
126872126505 }, .{
126873 .required_features = .{ .sse2, null, null, null },
126506 .required_cc_abi = .sysv64,
126507 .required_features = .{ .sse, null, null, null },
126874126508 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126875126509 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126876126510 .patterns = &.{
......@@ -126897,12 +126531,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126897126531 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126898126532 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126899126533 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126900 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126534 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126901126535 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126902126536 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126903126537 } },
126904126538 }, .{
126905 .required_features = .{ .sse, null, null, null },
126539 .required_cc_abi = .win64,
126906126540 .src_constraints = .{ .{ .multiple_scalar_unsigned_int = .{ .of = .xword, .is = .xword } }, .any, .any },
126907126541 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126908126542 .patterns = &.{
......@@ -126911,9 +126545,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126911126545 .call_frame = .{ .alignment = .@"16" },
126912126546 .extra_temps = .{
126913126547 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126914 .{ .type = .u128, .kind = .{ .param_gpr_pair = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126548 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126549 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126915126550 .{ .type = .usize, .kind = .{ .extern_func = "__floatuntitf" } },
126916 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126917126551 .unused,
126918126552 .unused,
126919126553 .unused,
......@@ -126926,14 +126560,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126926126560 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126927126561 .each = .{ .once = &.{
126928126562 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
126929 .{ .@"0:", ._, .mov, .tmp1q0, .memi(.src0q, .tmp0), ._, ._ },
126930 .{ ._, ._, .mov, .tmp1q1, .memid(.src0q, .tmp0, 8), ._, ._ },
126931 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
126932 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp3x, ._, ._ },
126563 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
126564 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
126565 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
126933126566 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
126934126567 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126935126568 } },
126936126569 }, .{
126570 .required_cc_abi = .sysv64,
126937126571 .required_features = .{ .@"64bit", .avx, null, null },
126938126572 .src_constraints = .{ .{ .scalar_remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126939126573 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -126968,6 +126602,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
126968126602 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126969126603 } },
126970126604 }, .{
126605 .required_cc_abi = .sysv64,
126971126606 .required_features = .{ .@"64bit", .sse2, null, null },
126972126607 .src_constraints = .{ .{ .scalar_remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126973126608 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
......@@ -127002,41 +126637,148 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127002126637 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
127003126638 } },
127004126639 }, .{
126640 .required_cc_abi = .sysv64,
126641 .required_features = .{ .@"64bit", .sse, null, null },
126642 .src_constraints = .{ .{ .scalar_remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126643 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126644 .patterns = &.{
126645 .{ .src = .{ .to_mem, .none, .none } },
126646 },
126647 .call_frame = .{ .alignment = .@"16" },
126648 .extra_temps = .{
126649 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126650 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126651 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126652 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126653 .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } },
126654 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126655 .unused,
126656 .unused,
126657 .unused,
126658 .unused,
126659 .unused,
126660 },
126661 .dst_temps = .{ .mem, .unused },
126662 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126663 .each = .{ .once = &.{
126664 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
126665 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
126666 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
126667 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
126668 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
126669 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
126670 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
126671 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
126672 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126673 } },
126674 }, .{
126675 .required_cc_abi = .win64,
126676 .required_features = .{ .@"64bit", null, null, null },
126677 .src_constraints = .{ .{ .scalar_remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126678 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126679 .patterns = &.{
126680 .{ .src = .{ .to_mem, .none, .none } },
126681 },
126682 .call_frame = .{ .alignment = .@"16" },
126683 .extra_temps = .{
126684 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126685 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126686 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126687 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126688 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
126689 .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } },
126690 .unused,
126691 .unused,
126692 .unused,
126693 .unused,
126694 .unused,
126695 },
126696 .dst_temps = .{ .mem, .unused },
126697 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126698 .each = .{ .once = &.{
126699 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
126700 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
126701 .{ .@"0:", ._, .lea, .tmp2p, .memi(.dst0, .tmp1), ._, ._ },
126702 .{ ._, ._, .mov, .tmp3p, .tmp0p, ._, ._ },
126703 .{ ._, ._, .mov, .tmp4d, .sa(.src0, .add_bit_size), ._, ._ },
126704 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
126705 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
126706 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
126707 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126708 } },
126709 }, .{
126710 .required_cc_abi = .sysv64,
126711 .required_features = .{ .@"64bit", .avx, null, null },
126712 .src_constraints = .{ .{ .scalar_remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126713 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126714 .patterns = &.{
126715 .{ .src = .{ .to_mem, .none, .none } },
126716 },
126717 .call_frame = .{ .alignment = .@"16" },
126718 .extra_temps = .{
126719 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126720 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126721 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126722 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126723 .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } },
126724 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126725 .unused,
126726 .unused,
126727 .unused,
126728 .unused,
126729 .unused,
126730 },
126731 .dst_temps = .{ .mem, .unused },
126732 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126733 .each = .{ .once = &.{
126734 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
126735 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
126736 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
126737 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
126738 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
126739 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
126740 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
126741 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
126742 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126743 } },
126744 }, .{
126745 .required_cc_abi = .sysv64,
126746 .required_features = .{ .@"64bit", .sse2, null, null },
126747 .src_constraints = .{ .{ .scalar_remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
126748 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
126749 .patterns = &.{
126750 .{ .src = .{ .to_mem, .none, .none } },
126751 },
126752 .call_frame = .{ .alignment = .@"16" },
126753 .extra_temps = .{
126754 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
126755 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
126756 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126757 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126758 .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } },
126759 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
126760 .unused,
126761 .unused,
126762 .unused,
126763 .unused,
126764 .unused,
126765 },
126766 .dst_temps = .{ .mem, .unused },
126767 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
126768 .each = .{ .once = &.{
126769 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
126770 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
126771 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
126772 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
126773 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
126774 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
126775 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
126776 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
126777 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
126778 } },
126779 }, .{
126780 .required_cc_abi = .sysv64,
127005126781 .required_features = .{ .@"64bit", .sse, null, null },
127006 .src_constraints = .{ .{ .scalar_remainder_signed_int = .{ .of = .dword, .is = .dword } }, .any, .any },
127007 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
127008 .patterns = &.{
127009 .{ .src = .{ .to_mem, .none, .none } },
127010 },
127011 .call_frame = .{ .alignment = .@"16" },
127012 .extra_temps = .{
127013 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
127014 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
127015 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127016 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
127017 .{ .type = .usize, .kind = .{ .extern_func = "__floateitf" } },
127018 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127019 .unused,
127020 .unused,
127021 .unused,
127022 .unused,
127023 .unused,
127024 },
127025 .dst_temps = .{ .mem, .unused },
127026 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
127027 .each = .{ .once = &.{
127028 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
127029 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
127030 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
127031 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
127032 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
127033 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
127034 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
127035 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
127036 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
127037 } },
127038 }, .{
127039 .required_features = .{ .@"64bit", .avx, null, null },
127040126782 .src_constraints = .{ .{ .scalar_remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
127041126783 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
127042126784 .patterns = &.{
......@@ -127064,47 +126806,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127064126806 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
127065126807 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
127066126808 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
127067 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
127068 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
127069 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
127070 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
127071 } },
127072 }, .{
127073 .required_features = .{ .@"64bit", .sse2, null, null },
127074 .src_constraints = .{ .{ .scalar_remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
127075 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
127076 .patterns = &.{
127077 .{ .src = .{ .to_mem, .none, .none } },
127078 },
127079 .call_frame = .{ .alignment = .@"16" },
127080 .extra_temps = .{
127081 .{ .type = .usize, .kind = .{ .rc = .general_purpose } },
127082 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
127083 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127084 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
127085 .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } },
127086 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127087 .unused,
127088 .unused,
127089 .unused,
127090 .unused,
127091 .unused,
127092 },
127093 .dst_temps = .{ .mem, .unused },
127094 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
127095 .each = .{ .once = &.{
127096 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
127097 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
127098 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
127099 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
127100 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
127101 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
126809 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
127102126810 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
127103126811 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
127104126812 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
127105126813 } },
127106126814 }, .{
127107 .required_features = .{ .@"64bit", .sse, null, null },
126815 .required_cc_abi = .win64,
126816 .required_features = .{ .@"64bit", null, null, null },
127108126817 .src_constraints = .{ .{ .scalar_remainder_unsigned_int = .{ .of = .dword, .is = .dword } }, .any, .any },
127109126818 .dst_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any },
127110126819 .patterns = &.{
......@@ -127116,8 +126825,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127116126825 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
127117126826 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127118126827 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
126828 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
127119126829 .{ .type = .usize, .kind = .{ .extern_func = "__floatuneitf" } },
127120 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
127121126830 .unused,
127122126831 .unused,
127123126832 .unused,
......@@ -127129,10 +126838,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
127129126838 .each = .{ .once = &.{
127130126839 .{ ._, ._, .lea, .tmp0p, .mema(.src0, .add_unaligned_size_sub_elem_size), ._, ._ },
127131126840 .{ ._, ._, .mov, .tmp1d, .sia(-16, .dst0, .add_unaligned_size), ._, ._ },
127132 .{ .@"0:", ._, .mov, .tmp2p, .tmp0p, ._, ._ },
127133 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_bit_size), ._, ._ },
127134 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
127135 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp1), .tmp5x, ._, ._ },
126841 .{ .@"0:", ._, .lea, .tmp2p, .memi(.dst0, .tmp1), ._, ._ },
126842 .{ ._, ._, .mov, .tmp3p, .tmp0p, ._, ._ },
126843 .{ ._, ._, .mov, .tmp4d, .sa(.src0, .add_bit_size), ._, ._ },
126844 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
127136126845 .{ ._, ._, .lea, .tmp0p, .leaa(.tmp0, .sub_src0_elem_size), ._, ._ },
127137126846 .{ ._, ._, .sub, .tmp1d, .si(16), ._, ._ },
127138126847 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
......@@ -132481,7 +132190,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
132481132190 .{ ._, ._, .mov, .tmp3d, .sa(.dst0, .add_size_div_8), ._, ._ },
132482132191 .{ ._, .@"rep _sq", .mov, ._, ._, ._, ._ },
132483132192 .{ .@"0:", ._, .mov, .tmp1d, .sia(-8, .dst0, .add_size), ._, ._ },
132484 .{ ._, ._, .lea, .tmp2q, .memi(.src0, .tmp0), ._, ._ },
132193 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
132485132194 .{ .@"1:", ._, .mov, .tmp3q, .leai(.tmp2q, .tmp1), ._, ._ },
132486132195 .{ ._, ._, mir_tag, .memi(.dst0q, .tmp1), .tmp3q, ._, ._ },
132487132196 .{ ._, ._, .sub, .tmp1d, .si(8), ._, ._ },
......@@ -142586,75 +142295,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
142586142295 } },
142587142296 }, .{
142588142297 .required_cc_abi = .win64,
142589 .required_features = .{ .avx, null, null, null },
142590 .dst_constraints = .{ .{ .float = .xword }, .any },
142591 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
142592 .patterns = &.{
142593 .{ .src = .{ .to_mem, .none, .none } },
142594 },
142595 .call_frame = .{ .alignment = .@"16" },
142596 .extra_temps = .{
142597 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
142598 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
142599 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
142600 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
142601 .{ .type = .f128, .kind = .mem },
142602 .unused,
142603 .unused,
142604 .unused,
142605 .unused,
142606 .unused,
142607 .unused,
142608 },
142609 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
142610 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
142611 .each = .{ .once = &.{
142612 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
142613 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
142614 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
142615 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
142616 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
142617 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
142618 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
142619 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
142620 } },
142621 }, .{
142622 .required_cc_abi = .win64,
142623 .required_features = .{ .sse2, null, null, null },
142624 .dst_constraints = .{ .{ .float = .xword }, .any },
142625 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
142626 .patterns = &.{
142627 .{ .src = .{ .to_mem, .none, .none } },
142628 },
142629 .call_frame = .{ .alignment = .@"16" },
142630 .extra_temps = .{
142631 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
142632 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
142633 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
142634 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
142635 .{ .type = .f128, .kind = .mem },
142636 .unused,
142637 .unused,
142638 .unused,
142639 .unused,
142640 .unused,
142641 .unused,
142642 },
142643 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
142644 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
142645 .each = .{ .once = &.{
142646 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
142647 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
142648 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
142649 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
142650 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
142651 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
142652 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
142653 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
142654 } },
142655 }, .{
142656 .required_cc_abi = .win64,
142657 .required_features = .{ .sse2, null, null, null },
142658142298 .dst_constraints = .{ .{ .float = .xword }, .any },
142659142299 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
142660142300 .patterns = &.{
......@@ -142665,8 +142305,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
142665142305 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
142666142306 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
142667142307 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
142308 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
142668142309 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
142669 .{ .type = .f128, .kind = .mem },
142670142310 .unused,
142671142311 .unused,
142672142312 .unused,
......@@ -142674,15 +142314,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
142674142314 .unused,
142675142315 .unused,
142676142316 },
142677 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
142317 .dst_temps = .{ .mem, .unused },
142678142318 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
142679142319 .each = .{ .once = &.{
142680142320 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
142681 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
142682 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
142683 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
142684 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
142685 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
142321 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
142322 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
142323 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
142324 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
142325 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
142686142326 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
142687142327 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
142688142328 } },
......@@ -152819,75 +152459,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
152819152459 } },
152820152460 }, .{
152821152461 .required_cc_abi = .win64,
152822 .required_features = .{ .avx, null, null, null },
152823 .dst_constraints = .{ .{ .float = .xword }, .any },
152824 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
152825 .patterns = &.{
152826 .{ .src = .{ .to_mem, .none, .none } },
152827 },
152828 .call_frame = .{ .alignment = .@"16" },
152829 .extra_temps = .{
152830 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
152831 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
152832 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
152833 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
152834 .{ .type = .f128, .kind = .mem },
152835 .unused,
152836 .unused,
152837 .unused,
152838 .unused,
152839 .unused,
152840 .unused,
152841 },
152842 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
152843 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
152844 .each = .{ .once = &.{
152845 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
152846 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
152847 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
152848 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
152849 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
152850 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
152851 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
152852 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
152853 } },
152854 }, .{
152855 .required_cc_abi = .win64,
152856 .required_features = .{ .sse2, null, null, null },
152857 .dst_constraints = .{ .{ .float = .xword }, .any },
152858 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
152859 .patterns = &.{
152860 .{ .src = .{ .to_mem, .none, .none } },
152861 },
152862 .call_frame = .{ .alignment = .@"16" },
152863 .extra_temps = .{
152864 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
152865 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
152866 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
152867 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
152868 .{ .type = .f128, .kind = .mem },
152869 .unused,
152870 .unused,
152871 .unused,
152872 .unused,
152873 .unused,
152874 .unused,
152875 },
152876 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
152877 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
152878 .each = .{ .once = &.{
152879 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
152880 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
152881 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
152882 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
152883 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
152884 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
152885 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
152886 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
152887 } },
152888 }, .{
152889 .required_cc_abi = .win64,
152890 .required_features = .{ .sse2, null, null, null },
152891152462 .dst_constraints = .{ .{ .float = .xword }, .any },
152892152463 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
152893152464 .patterns = &.{
......@@ -152898,8 +152469,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
152898152469 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
152899152470 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
152900152471 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
152472 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
152901152473 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
152902 .{ .type = .f128, .kind = .mem },
152903152474 .unused,
152904152475 .unused,
152905152476 .unused,
......@@ -152907,15 +152478,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
152907152478 .unused,
152908152479 .unused,
152909152480 },
152910 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
152481 .dst_temps = .{ .mem, .unused },
152911152482 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
152912152483 .each = .{ .once = &.{
152913152484 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
152914 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
152915 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
152916 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
152917 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
152918 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
152485 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
152486 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
152487 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
152488 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
152489 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
152919152490 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
152920152491 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
152921152492 } },
......@@ -156644,7 +156215,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
156644156215 .{ ._, ._, .mov, .tmp3d, .sa(.dst0, .add_size_div_8), ._, ._ },
156645156216 .{ ._, .@"rep _sq", .mov, ._, ._, ._, ._ },
156646156217 .{ .@"0:", ._, .mov, .tmp1p, .sa(.dst0, .sub_size_div_8), ._, ._ },
156647 .{ ._, ._, .lea, .tmp2q, .memi(.src0, .tmp0), ._, ._ },
156218 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
156648156219 .{ ._, ._c, .cl, ._, ._, ._, ._ },
156649156220 .{ .@"1:", ._, .mov, .tmp3q, .leasia(.tmp2q, .@"8", .tmp1, .add_src0_elem_size), ._, ._ },
156650156221 .{ ._, ._, .adc, .memsia(.dst0q, .@"8", .tmp1, .add_size), .tmp3q, ._, ._ },
......@@ -157503,47 +157074,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
157503157074 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
157504157075 .each = .{ .once = &.{
157505157076 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
157506 .{ ._, ._dqa, .mov, .dst0x, .mem(.src0x), ._, ._ },
157507 .{ .@"0:", ._dqa, .mov, .tmp1x, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
157508 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
157509 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
157510 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
157511 } },
157512 }, .{
157513 .required_cc_abi = .sysv64,
157514 .required_features = .{ .sse, null, null, null },
157515 .dst_constraints = .{ .{ .float = .xword }, .any },
157516 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
157517 .patterns = &.{
157518 .{ .src = .{ .to_mem, .none, .none } },
157519 },
157520 .call_frame = .{ .alignment = .@"16" },
157521 .extra_temps = .{
157522 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
157523 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
157524 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
157525 .unused,
157526 .unused,
157527 .unused,
157528 .unused,
157529 .unused,
157530 .unused,
157531 .unused,
157532 .unused,
157533 },
157534 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
157535 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
157536 .each = .{ .once = &.{
157537 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
157538 .{ ._, ._ps, .mova, .dst0x, .mem(.src0x), ._, ._ },
157539 .{ .@"0:", ._ps, .mova, .tmp1x, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
157077 .{ ._, ._dqa, .mov, .dst0x, .mem(.src0x), ._, ._ },
157078 .{ .@"0:", ._dqa, .mov, .tmp1x, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
157540157079 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
157541157080 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
157542157081 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
157543157082 } },
157544157083 }, .{
157545 .required_cc_abi = .win64,
157546 .required_features = .{ .avx, null, null, null },
157084 .required_cc_abi = .sysv64,
157085 .required_features = .{ .sse, null, null, null },
157547157086 .dst_constraints = .{ .{ .float = .xword }, .any },
157548157087 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
157549157088 .patterns = &.{
......@@ -157552,47 +157091,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
157552157091 .call_frame = .{ .alignment = .@"16" },
157553157092 .extra_temps = .{
157554157093 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
157555 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
157556 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
157094 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
157557157095 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
157558 .{ .type = .f128, .kind = .mem },
157559 .unused,
157560157096 .unused,
157561157097 .unused,
157562157098 .unused,
157563157099 .unused,
157564157100 .unused,
157565 },
157566 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
157567 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
157568 .each = .{ .once = &.{
157569 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
157570 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
157571 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
157572 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
157573 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
157574 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
157575 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
157576 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
157577 } },
157578 }, .{
157579 .required_cc_abi = .win64,
157580 .required_features = .{ .sse2, null, null, null },
157581 .dst_constraints = .{ .{ .float = .xword }, .any },
157582 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
157583 .patterns = &.{
157584 .{ .src = .{ .to_mem, .none, .none } },
157585 },
157586 .call_frame = .{ .alignment = .@"16" },
157587 .extra_temps = .{
157588 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
157589 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
157590 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
157591 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
157592 .{ .type = .f128, .kind = .mem },
157593 .unused,
157594 .unused,
157595 .unused,
157596157101 .unused,
157597157102 .unused,
157598157103 .unused,
......@@ -157601,17 +157106,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
157601157106 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
157602157107 .each = .{ .once = &.{
157603157108 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
157604 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
157605 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
157606 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
157607 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
157608 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
157109 .{ ._, ._ps, .mova, .dst0x, .mem(.src0x), ._, ._ },
157110 .{ .@"0:", ._ps, .mova, .tmp1x, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
157111 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
157609157112 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
157610157113 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
157611157114 } },
157612157115 }, .{
157613157116 .required_cc_abi = .win64,
157614 .required_features = .{ .sse, null, null, null },
157615157117 .dst_constraints = .{ .{ .float = .xword }, .any },
157616157118 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
157617157119 .patterns = &.{
......@@ -157622,8 +157124,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
157622157124 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
157623157125 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
157624157126 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
157127 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
157625157128 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
157626 .{ .type = .f128, .kind = .mem },
157627157129 .unused,
157628157130 .unused,
157629157131 .unused,
......@@ -157631,15 +157133,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
157631157133 .unused,
157632157134 .unused,
157633157135 },
157634 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
157136 .dst_temps = .{ .mem, .unused },
157635157137 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
157636157138 .each = .{ .once = &.{
157637157139 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
157638 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
157639 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
157640 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
157641 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
157642 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
157140 .{ ._, ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
157141 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
157142 .{ ._, ._, .lea, .tmp3p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
157143 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
157144 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
157643157145 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
157644157146 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
157645157147 } },
......@@ -161226,75 +160728,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
161226160728 } },
161227160729 }, .{
161228160730 .required_cc_abi = .win64,
161229 .required_features = .{ .avx, null, null, null },
161230 .dst_constraints = .{ .{ .float = .xword }, .any },
161231 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
161232 .patterns = &.{
161233 .{ .src = .{ .to_mem, .none, .none } },
161234 },
161235 .call_frame = .{ .alignment = .@"16" },
161236 .extra_temps = .{
161237 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
161238 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
161239 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
161240 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
161241 .{ .type = .f128, .kind = .mem },
161242 .unused,
161243 .unused,
161244 .unused,
161245 .unused,
161246 .unused,
161247 .unused,
161248 },
161249 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
161250 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
161251 .each = .{ .once = &.{
161252 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
161253 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
161254 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
161255 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
161256 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
161257 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
161258 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
161259 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
161260 } },
161261 }, .{
161262 .required_cc_abi = .win64,
161263 .required_features = .{ .sse2, null, null, null },
161264 .dst_constraints = .{ .{ .float = .xword }, .any },
161265 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
161266 .patterns = &.{
161267 .{ .src = .{ .to_mem, .none, .none } },
161268 },
161269 .call_frame = .{ .alignment = .@"16" },
161270 .extra_temps = .{
161271 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
161272 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
161273 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
161274 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
161275 .{ .type = .f128, .kind = .mem },
161276 .unused,
161277 .unused,
161278 .unused,
161279 .unused,
161280 .unused,
161281 .unused,
161282 },
161283 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
161284 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
161285 .each = .{ .once = &.{
161286 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
161287 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
161288 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
161289 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
161290 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
161291 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
161292 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
161293 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
161294 } },
161295 }, .{
161296 .required_cc_abi = .win64,
161297 .required_features = .{ .sse, null, null, null },
161298160731 .dst_constraints = .{ .{ .float = .xword }, .any },
161299160732 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
161300160733 .patterns = &.{
......@@ -161305,8 +160738,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
161305160738 .{ .type = .isize, .kind = .{ .rc = .general_purpose } },
161306160739 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
161307160740 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
160741 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
161308160742 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
161309 .{ .type = .f128, .kind = .mem },
161310160743 .unused,
161311160744 .unused,
161312160745 .unused,
......@@ -161314,15 +160747,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
161314160747 .unused,
161315160748 .unused,
161316160749 },
161317 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
160750 .dst_temps = .{ .mem, .unused },
161318160751 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
161319160752 .each = .{ .once = &.{
161320160753 .{ ._, ._, .mov, .tmp0p, .sia(16, .src0, .sub_unaligned_size), ._, ._ },
161321 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
161322 .{ .@"0:", ._, .lea, .tmp2p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
161323 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
161324 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
161325 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
160754 .{ ._, ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
160755 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
160756 .{ ._, ._, .lea, .tmp3p, .memia(.src0, .tmp0, .add_unaligned_size), ._, ._ },
160757 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
160758 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
161326160759 .{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
161327160760 .{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
161328160761 } },
......@@ -163053,75 +162486,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
163053162486 } },
163054162487 }, .{
163055162488 .required_cc_abi = .win64,
163056 .required_features = .{ .avx, null, null, null },
163057 .dst_constraints = .{ .{ .float = .xword }, .any },
163058 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
163059 .patterns = &.{
163060 .{ .src = .{ .to_mem, .none, .none } },
163061 },
163062 .call_frame = .{ .alignment = .@"16" },
163063 .extra_temps = .{
163064 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
163065 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
163066 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
163067 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
163068 .{ .type = .f128, .kind = .mem },
163069 .unused,
163070 .unused,
163071 .unused,
163072 .unused,
163073 .unused,
163074 .unused,
163075 },
163076 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
163077 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
163078 .each = .{ .once = &.{
163079 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
163080 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
163081 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
163082 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
163083 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
163084 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
163085 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
163086 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
163087 } },
163088 }, .{
163089 .required_cc_abi = .win64,
163090 .required_features = .{ .sse2, null, null, null },
163091 .dst_constraints = .{ .{ .float = .xword }, .any },
163092 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
163093 .patterns = &.{
163094 .{ .src = .{ .to_mem, .none, .none } },
163095 },
163096 .call_frame = .{ .alignment = .@"16" },
163097 .extra_temps = .{
163098 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
163099 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
163100 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
163101 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
163102 .{ .type = .f128, .kind = .mem },
163103 .unused,
163104 .unused,
163105 .unused,
163106 .unused,
163107 .unused,
163108 .unused,
163109 },
163110 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
163111 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
163112 .each = .{ .once = &.{
163113 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
163114 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
163115 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
163116 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
163117 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
163118 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
163119 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
163120 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
163121 } },
163122 }, .{
163123 .required_cc_abi = .win64,
163124 .required_features = .{ .sse2, null, null, null },
163125162489 .dst_constraints = .{ .{ .float = .xword }, .any },
163126162490 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
163127162491 .patterns = &.{
......@@ -163132,8 +162496,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
163132162496 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
163133162497 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
163134162498 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
162499 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
163135162500 .{ .type = .usize, .kind = .{ .extern_func = "fminf128" } },
163136 .{ .type = .f128, .kind = .mem },
163137162501 .unused,
163138162502 .unused,
163139162503 .unused,
......@@ -163141,15 +162505,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
163141162505 .unused,
163142162506 .unused,
163143162507 },
163144 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
162508 .dst_temps = .{ .mem, .unused },
163145162509 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
163146162510 .each = .{ .once = &.{
163147162511 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
163148 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
163149 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
163150 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
163151 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
163152 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
162512 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
162513 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
162514 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
162515 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
162516 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
163153162517 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
163154162518 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
163155162519 } },
......@@ -164778,79 +164142,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164778164142 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164779164143 .each = .{ .once = &.{
164780164144 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164781 .{ ._, .v_dqa, .mov, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164782 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164783 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
164784 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164785 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164786 } },
164787 }, .{
164788 .required_cc_abi = .sysv64,
164789 .required_features = .{ .sse2, null, null, null },
164790 .dst_constraints = .{ .{ .float = .xword }, .any },
164791 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
164792 .patterns = &.{
164793 .{ .src = .{ .to_mem, .none, .none } },
164794 },
164795 .call_frame = .{ .alignment = .@"16" },
164796 .extra_temps = .{
164797 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
164798 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164799 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
164800 .unused,
164801 .unused,
164802 .unused,
164803 .unused,
164804 .unused,
164805 .unused,
164806 .unused,
164807 .unused,
164808 },
164809 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
164810 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164811 .each = .{ .once = &.{
164812 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164813 .{ ._, ._dqa, .mov, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164814 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164815 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
164816 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164817 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164818 } },
164819 }, .{
164820 .required_cc_abi = .sysv64,
164821 .required_features = .{ .sse, null, null, null },
164822 .dst_constraints = .{ .{ .float = .xword }, .any },
164823 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
164824 .patterns = &.{
164825 .{ .src = .{ .to_mem, .none, .none } },
164826 },
164827 .call_frame = .{ .alignment = .@"16" },
164828 .extra_temps = .{
164829 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
164830 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164831 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
164832 .unused,
164833 .unused,
164834 .unused,
164835 .unused,
164836 .unused,
164837 .unused,
164838 .unused,
164839 .unused,
164840 },
164841 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
164842 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164843 .each = .{ .once = &.{
164844 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164845 .{ ._, ._ps, .mova, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164846 .{ .@"0:", ._ps, .mova, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164145 .{ ._, .v_dqa, .mov, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164146 .{ .@"0:", .v_dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164847164147 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
164848164148 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164849164149 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164850164150 } },
164851164151 }, .{
164852 .required_cc_abi = .win64,
164853 .required_features = .{ .avx, null, null, null },
164152 .required_cc_abi = .sysv64,
164153 .required_features = .{ .sse2, null, null, null },
164854164154 .dst_constraints = .{ .{ .float = .xword }, .any },
164855164155 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
164856164156 .patterns = &.{
......@@ -164859,10 +164159,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164859164159 .call_frame = .{ .alignment = .@"16" },
164860164160 .extra_temps = .{
164861164161 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
164862 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
164863 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164162 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164864164163 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
164865 .{ .type = .f128, .kind = .mem },
164164 .unused,
164165 .unused,
164866164166 .unused,
164867164167 .unused,
164868164168 .unused,
......@@ -164874,17 +164174,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164874164174 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164875164175 .each = .{ .once = &.{
164876164176 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164877 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
164878 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
164879 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
164880 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
164881 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
164177 .{ ._, ._dqa, .mov, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164178 .{ .@"0:", ._dqa, .mov, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164179 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
164882164180 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164883164181 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164884164182 } },
164885164183 }, .{
164886 .required_cc_abi = .win64,
164887 .required_features = .{ .sse2, null, null, null },
164184 .required_cc_abi = .sysv64,
164185 .required_features = .{ .sse, null, null, null },
164888164186 .dst_constraints = .{ .{ .float = .xword }, .any },
164889164187 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
164890164188 .patterns = &.{
......@@ -164893,10 +164191,10 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164893164191 .call_frame = .{ .alignment = .@"16" },
164894164192 .extra_temps = .{
164895164193 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
164896 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
164897 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164194 .{ .type = .f128, .kind = .{ .param_sse = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164898164195 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
164899 .{ .type = .f128, .kind = .mem },
164196 .unused,
164197 .unused,
164900164198 .unused,
164901164199 .unused,
164902164200 .unused,
......@@ -164908,17 +164206,14 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164908164206 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164909164207 .each = .{ .once = &.{
164910164208 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164911 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
164912 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
164913 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
164914 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
164915 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
164209 .{ ._, ._ps, .mova, .dst0x, .memad(.src0x, .add_unaligned_size, -16), ._, ._ },
164210 .{ .@"0:", ._ps, .mova, .tmp1x, .memi(.src0x, .tmp0), ._, ._ },
164211 .{ ._, ._, .call, .tmp2d, ._, ._, ._ },
164916164212 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164917164213 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164918164214 } },
164919164215 }, .{
164920164216 .required_cc_abi = .win64,
164921 .required_features = .{ .sse2, null, null, null },
164922164217 .dst_constraints = .{ .{ .float = .xword }, .any },
164923164218 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
164924164219 .patterns = &.{
......@@ -164929,8 +164224,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164929164224 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
164930164225 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
164931164226 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
164227 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
164932164228 .{ .type = .usize, .kind = .{ .extern_func = "fmaxf128" } },
164933 .{ .type = .f128, .kind = .mem },
164934164229 .unused,
164935164230 .unused,
164936164231 .unused,
......@@ -164938,15 +164233,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
164938164233 .unused,
164939164234 .unused,
164940164235 },
164941 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
164236 .dst_temps = .{ .mem, .unused },
164942164237 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
164943164238 .each = .{ .once = &.{
164944164239 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
164945 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
164946 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
164947 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
164948 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
164949 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
164240 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
164241 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
164242 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
164243 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
164244 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
164950164245 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
164951164246 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
164952164247 } },
......@@ -167253,75 +166548,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
167253166548 } },
167254166549 }, .{
167255166550 .required_cc_abi = .win64,
167256 .required_features = .{ .avx, null, null, null },
167257 .dst_constraints = .{ .{ .float = .xword }, .any },
167258 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
167259 .patterns = &.{
167260 .{ .src = .{ .to_mem, .none, .none } },
167261 },
167262 .call_frame = .{ .alignment = .@"16" },
167263 .extra_temps = .{
167264 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
167265 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
167266 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
167267 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
167268 .{ .type = .f128, .kind = .mem },
167269 .unused,
167270 .unused,
167271 .unused,
167272 .unused,
167273 .unused,
167274 .unused,
167275 },
167276 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
167277 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
167278 .each = .{ .once = &.{
167279 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
167280 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
167281 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
167282 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
167283 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
167284 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
167285 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
167286 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
167287 } },
167288 }, .{
167289 .required_cc_abi = .win64,
167290 .required_features = .{ .sse2, null, null, null },
167291 .dst_constraints = .{ .{ .float = .xword }, .any },
167292 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
167293 .patterns = &.{
167294 .{ .src = .{ .to_mem, .none, .none } },
167295 },
167296 .call_frame = .{ .alignment = .@"16" },
167297 .extra_temps = .{
167298 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
167299 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
167300 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
167301 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
167302 .{ .type = .f128, .kind = .mem },
167303 .unused,
167304 .unused,
167305 .unused,
167306 .unused,
167307 .unused,
167308 .unused,
167309 },
167310 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
167311 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
167312 .each = .{ .once = &.{
167313 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
167314 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
167315 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
167316 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
167317 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
167318 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
167319 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
167320 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
167321 } },
167322 }, .{
167323 .required_cc_abi = .win64,
167324 .required_features = .{ .sse, null, null, null },
167325166551 .dst_constraints = .{ .{ .float = .xword }, .any },
167326166552 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
167327166553 .patterns = &.{
......@@ -167332,8 +166558,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
167332166558 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
167333166559 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
167334166560 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
166561 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
167335166562 .{ .type = .usize, .kind = .{ .extern_func = "__addtf3" } },
167336 .{ .type = .f128, .kind = .mem },
167337166563 .unused,
167338166564 .unused,
167339166565 .unused,
......@@ -167341,15 +166567,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
167341166567 .unused,
167342166568 .unused,
167343166569 },
167344 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
166570 .dst_temps = .{ .mem, .unused },
167345166571 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
167346166572 .each = .{ .once = &.{
167347166573 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
167348 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
167349 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
167350 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
167351 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
167352 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
166574 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
166575 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
166576 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
166577 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
166578 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
167353166579 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
167354166580 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
167355166581 } },
......@@ -168940,75 +168166,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
168940168166 } },
168941168167 }, .{
168942168168 .required_cc_abi = .win64,
168943 .required_features = .{ .avx, null, null, null },
168944 .dst_constraints = .{ .{ .float = .xword }, .any },
168945 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
168946 .patterns = &.{
168947 .{ .src = .{ .to_mem, .none, .none } },
168948 },
168949 .call_frame = .{ .alignment = .@"16" },
168950 .extra_temps = .{
168951 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
168952 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
168953 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
168954 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
168955 .{ .type = .f128, .kind = .mem },
168956 .unused,
168957 .unused,
168958 .unused,
168959 .unused,
168960 .unused,
168961 .unused,
168962 },
168963 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
168964 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
168965 .each = .{ .once = &.{
168966 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
168967 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
168968 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
168969 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
168970 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
168971 .{ ._, .v_dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
168972 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
168973 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
168974 } },
168975 }, .{
168976 .required_cc_abi = .win64,
168977 .required_features = .{ .sse2, null, null, null },
168978 .dst_constraints = .{ .{ .float = .xword }, .any },
168979 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
168980 .patterns = &.{
168981 .{ .src = .{ .to_mem, .none, .none } },
168982 },
168983 .call_frame = .{ .alignment = .@"16" },
168984 .extra_temps = .{
168985 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
168986 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
168987 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
168988 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
168989 .{ .type = .f128, .kind = .mem },
168990 .unused,
168991 .unused,
168992 .unused,
168993 .unused,
168994 .unused,
168995 .unused,
168996 },
168997 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
168998 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
168999 .each = .{ .once = &.{
169000 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
169001 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
169002 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
169003 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
169004 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
169005 .{ ._, ._dqa, .mov, .lea(.tmp1x), .dst0x, ._, ._ },
169006 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
169007 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
169008 } },
169009 }, .{
169010 .required_cc_abi = .win64,
169011 .required_features = .{ .sse, null, null, null },
169012168169 .dst_constraints = .{ .{ .float = .xword }, .any },
169013168170 .src_constraints = .{ .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } }, .any, .any },
169014168171 .patterns = &.{
......@@ -169019,8 +168176,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
169019168176 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
169020168177 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
169021168178 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
168179 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
169022168180 .{ .type = .usize, .kind = .{ .extern_func = "__multf3" } },
169023 .{ .type = .f128, .kind = .mem },
169024168181 .unused,
169025168182 .unused,
169026168183 .unused,
......@@ -169028,15 +168185,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
169028168185 .unused,
169029168186 .unused,
169030168187 },
169031 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
168188 .dst_temps = .{ .mem, .unused },
169032168189 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
169033168190 .each = .{ .once = &.{
169034168191 .{ ._, ._, .mov, .tmp0d, .sia(-32, .src0, .add_unaligned_size), ._, ._ },
169035 .{ ._, ._, .lea, .tmp1p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
169036 .{ .@"0:", ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
169037 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
169038 .{ ._, ._, .lea, .tmp1p, .mem(.tmp4), ._, ._ },
169039 .{ ._, ._ps, .mova, .lea(.tmp1x), .dst0x, ._, ._ },
168192 .{ ._, ._, .lea, .tmp2p, .memad(.src0, .add_unaligned_size, -16), ._, ._ },
168193 .{ .@"0:", ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
168194 .{ ._, ._, .lea, .tmp3p, .memi(.src0, .tmp0), ._, ._ },
168195 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
168196 .{ ._, ._, .lea, .tmp2p, .mem(.dst0), ._, ._ },
169040168197 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
169041168198 .{ ._, ._nb, .j, .@"0b", ._, ._, ._ },
169042168199 } },
......@@ -169093,7 +168250,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
169093168250 .each = .{ .once = &.{
169094168251 .{ ._, ._, .bt, .src0d, .si(0), ._, ._ },
169095168252 .{ ._, ._, .sbb, .tmp1b, .tmp1b, ._, ._ },
169096 .{ ._, ._, .lea, .tmp0q, .dst0b, ._, ._ },
168253 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
169097168254 .{ ._, ._, .mov, .tmp2d, .sia(1, .dst0, .add_bit_size_sub_1_div_8_down_1), ._, ._ },
169098168255 .{ ._, .@"rep _sb", .sto, ._, ._, ._, ._ },
169099168256 .{ ._, ._, .@"and", .memad(.dst0b, .add_bit_size_sub_1_div_8_down_1, 0), .ua(.dst0, .bit_size_last_byte_mask), ._, ._ },
......@@ -170845,8 +170002,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
170845170002 .dst_temps = .{ .mem, .unused },
170846170003 .each = .{ .once = &.{
170847170004 .{ ._, ._, .mov, .tmp0d, .sa(.dst0, .add_len), ._, ._ },
170848 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
170849 .{ .@"0:", ._, .lea, .tmp2q, .mem(.src0), ._, ._ },
170005 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
170006 .{ .@"0:", ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
170850170007 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_size_div_8), ._, ._ },
170851170008 .{ ._, .@"rep _sq", .mov, ._, ._, ._, ._ },
170852170009 .{ ._, ._, .sub, .tmp0d, .si(1), ._, ._ },
......@@ -170875,8 +170032,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
170875170032 .dst_temps = .{ .mem, .unused },
170876170033 .each = .{ .once = &.{
170877170034 .{ ._, ._, .mov, .tmp0d, .sa(.dst0, .add_len), ._, ._ },
170878 .{ ._, ._, .lea, .tmp1q, .mem(.dst0), ._, ._ },
170879 .{ .@"0:", ._, .lea, .tmp2q, .mem(.src0), ._, ._ },
170035 .{ ._, ._, .lea, .tmp1p, .mem(.dst0), ._, ._ },
170036 .{ .@"0:", ._, .lea, .tmp2p, .mem(.src0), ._, ._ },
170880170037 .{ ._, ._, .mov, .tmp3d, .sa(.src0, .add_size_div_8), ._, ._ },
170881170038 .{ ._, .@"rep _sq", .mov, ._, ._, ._, ._ },
170882170039 .{ ._, ._c, .de, .tmp0d, ._, ._, ._ },
......@@ -172770,7 +171927,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172770171927 } },
172771171928 }, .{
172772171929 .required_cc_abi = .win64,
172773 .required_features = .{ .sse, null, null, null },
172774171930 .src_constraints = .{
172775171931 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
172776171932 .{ .scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -172784,6 +171940,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172784171940 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
172785171941 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
172786171942 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
171943 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 3, .at = 3 } } },
172787171944 .{ .type = .usize, .kind = .{ .extern_func = "fmaf128" } },
172788171945 .unused,
172789171946 .unused,
......@@ -172791,15 +171948,15 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172791171948 .unused,
172792171949 .unused,
172793171950 .unused,
172794 .unused,
172795171951 },
172796 .dst_temps = .{ .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } }, .unused },
171952 .dst_temps = .{ .mem, .unused },
172797171953 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
172798171954 .each = .{ .once = &.{
172799 .{ ._, ._, .lea, .tmp0p, .mem(.src0), ._, ._ },
172800 .{ ._, ._, .lea, .tmp1p, .mem(.src1), ._, ._ },
172801 .{ ._, ._, .lea, .tmp2p, .mem(.src2), ._, ._ },
172802 .{ ._, ._, .call, .tmp3d, ._, ._, ._ },
171955 .{ ._, ._, .lea, .tmp0p, .mem(.dst0), ._, ._ },
171956 .{ ._, ._, .lea, .tmp1p, .mem(.src0), ._, ._ },
171957 .{ ._, ._, .lea, .tmp2p, .mem(.src1), ._, ._ },
171958 .{ ._, ._, .lea, .tmp3p, .mem(.src2), ._, ._ },
171959 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
172803171960 } },
172804171961 }, .{
172805171962 .required_cc_abi = .sysv64,
......@@ -172914,81 +172071,6 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
172914172071 } },
172915172072 }, .{
172916172073 .required_cc_abi = .win64,
172917 .required_features = .{ .avx, null, null, null },
172918 .src_constraints = .{
172919 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172920 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172921 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172922 },
172923 .patterns = &.{
172924 .{ .src = .{ .to_mem, .to_mem, .to_mem } },
172925 },
172926 .call_frame = .{ .alignment = .@"16" },
172927 .extra_temps = .{
172928 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
172929 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
172930 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
172931 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
172932 .{ .type = .usize, .kind = .{ .extern_func = "fmaf128" } },
172933 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
172934 .unused,
172935 .unused,
172936 .unused,
172937 .unused,
172938 .unused,
172939 },
172940 .dst_temps = .{ .mem, .unused },
172941 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
172942 .each = .{ .once = &.{
172943 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
172944 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
172945 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
172946 .{ ._, ._, .lea, .tmp3p, .memi(.src2, .tmp0), ._, ._ },
172947 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
172948 .{ ._, .v_dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
172949 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
172950 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
172951 } },
172952 }, .{
172953 .required_cc_abi = .win64,
172954 .required_features = .{ .sse2, null, null, null },
172955 .src_constraints = .{
172956 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172957 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172958 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172959 },
172960 .patterns = &.{
172961 .{ .src = .{ .to_mem, .to_mem, .to_mem } },
172962 },
172963 .call_frame = .{ .alignment = .@"16" },
172964 .extra_temps = .{
172965 .{ .type = .u32, .kind = .{ .rc = .general_purpose } },
172966 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
172967 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
172968 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
172969 .{ .type = .usize, .kind = .{ .extern_func = "fmaf128" } },
172970 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
172971 .unused,
172972 .unused,
172973 .unused,
172974 .unused,
172975 .unused,
172976 },
172977 .dst_temps = .{ .mem, .unused },
172978 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
172979 .each = .{ .once = &.{
172980 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
172981 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
172982 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
172983 .{ ._, ._, .lea, .tmp3p, .memi(.src2, .tmp0), ._, ._ },
172984 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
172985 .{ ._, ._dqa, .mov, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
172986 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
172987 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
172988 } },
172989 }, .{
172990 .required_cc_abi = .win64,
172991 .required_features = .{ .sse, null, null, null },
172992172074 .src_constraints = .{
172993172075 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
172994172076 .{ .multiple_scalar_float = .{ .of = .xword, .is = .xword } },
......@@ -173003,8 +172085,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173003172085 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 0, .at = 0 } } },
173004172086 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 1, .at = 1 } } },
173005172087 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 2, .at = 2 } } },
172088 .{ .type = .usize, .kind = .{ .param_gpr = .{ .cc = .ccc, .after = 3, .at = 3 } } },
173006172089 .{ .type = .usize, .kind = .{ .extern_func = "fmaf128" } },
173007 .{ .type = .f128, .kind = .{ .ret_sse = .{ .cc = .ccc, .after = 0, .at = 0 } } },
173008172090 .unused,
173009172091 .unused,
173010172092 .unused,
......@@ -173015,11 +172097,11 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
173015172097 .clobbers = .{ .eflags = true, .caller_preserved = .ccc },
173016172098 .each = .{ .once = &.{
173017172099 .{ ._, ._, .mov, .tmp0d, .sia(-16, .src0, .add_unaligned_size), ._, ._ },
173018 .{ .@"0:", ._, .lea, .tmp1p, .memi(.src0, .tmp0), ._, ._ },
173019 .{ ._, ._, .lea, .tmp2p, .memi(.src1, .tmp0), ._, ._ },
173020 .{ ._, ._, .lea, .tmp3p, .memi(.src2, .tmp0), ._, ._ },
173021 .{ ._, ._, .call, .tmp4d, ._, ._, ._ },
173022 .{ ._, ._ps, .mova, .memi(.dst0x, .tmp0), .tmp5x, ._, ._ },
172100 .{ .@"0:", ._, .lea, .tmp1p, .memi(.dst0, .tmp0), ._, ._ },
172101 .{ ._, ._, .lea, .tmp2p, .memi(.src0, .tmp0), ._, ._ },
172102 .{ ._, ._, .lea, .tmp3p, .memi(.src1, .tmp0), ._, ._ },
172103 .{ ._, ._, .lea, .tmp4p, .memi(.src2, .tmp0), ._, ._ },
172104 .{ ._, ._, .call, .tmp5d, ._, ._, ._ },
173023172105 .{ ._, ._, .sub, .tmp0d, .si(16), ._, ._ },
173024172106 .{ ._, ._ae, .j, .@"0b", ._, ._, ._ },
173025172107 } },
......@@ -182472,12 +181554,13 @@ fn hasFeature(cg: *CodeGen, feature: std.Target.x86.Feature) bool {
182472181554 .x86_64 => true,
182473181555 },
182474181556 .false_deps_getmant,
182475 .false_deps_lzcnt_tzcnt,
181557 .false_deps_lzcnt,
182476181558 .false_deps_mulc,
182477181559 .false_deps_mullq,
182478181560 .false_deps_perm,
182479181561 .false_deps_popcnt,
182480181562 .false_deps_range,
181563 .false_deps_tzcnt,
182481181564 .slow_3ops_lea,
182482181565 .slow_incdec,
182483181566 .slow_lea,
......@@ -192323,10 +191406,7 @@ const Select = struct {
192323191406 const RefImm = switch (size) {
192324191407 else => comptime unreachable,
192325191408 .none => Imm,
192326 .byte, .word, .dword, .qword => @Int(
192327 @typeInfo(Imm).int.signedness,
192328 size.bitSize(undefined),
192329 ),
191409 .byte, .word, .dword, .qword => @Int(@typeInfo(Imm).int.signedness, size.bitSize(undefined)),
192330191410 };
192331191411 break :lhs @bitCast(@as(Imm, @intCast(@as(RefImm, switch (adjust) {
192332191412 else => comptime unreachable,
src/codegen/x86_64/abi.zig+1-2
......@@ -131,8 +131,7 @@ pub fn classifyWindows(init_ty: Type, zcu: *Zcu, target: *const std.Target, ctx:
131131 .float => switch (ty.floatBits(target)) {
132132 else => unreachable,
133133 16, 32, 64 => if (target.cpu.has(.x86, .soft_float)) .integer else .sse,
134 80 => .memory,
135 128 => if (target.cpu.has(.x86, .soft_float)) .memory else .win_i128,
134 80, 128 => .memory,
136135 },
137136 .vector => {
138137 const len = ty.vectorLen(zcu);
src/libs/libcxx.zig+3-2
......@@ -82,6 +82,7 @@ const libcxx_base_files = [_][]const u8{
8282 "src/support/win32/locale_win32.cpp",
8383 "src/support/win32/support.cpp",
8484 "src/system_error.cpp",
85 "src/text_encoding.cpp",
8586 "src/typeinfo.cpp",
8687 "src/valarray.cpp",
8788 "src/variant.cpp",
......@@ -214,7 +215,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
214215 try cflags.append("-faligned-allocation");
215216
216217 try cflags.append("-nostdinc++");
217 try cflags.append("-std=c++23");
218 try cflags.append("-std=c++26");
218219
219220 // These depend on only the zig lib directory file path, which is
220221 // purposefully either in the cache or not in the cache. The decision
......@@ -402,7 +403,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
402403
403404 try cflags.append("-nostdinc++");
404405 try cflags.append("-fstrict-aliasing");
405 try cflags.append("-std=c++23");
406 try cflags.append("-std=c++26");
406407
407408 // These depend on only the zig lib directory file path, which is
408409 // purposefully either in the cache or not in the cache. The decision
src/libs/libtsan.zig+1
......@@ -350,6 +350,7 @@ fn addCcArgs(target: *const std.Target, args: *std.array_list.Managed([]const u8
350350}
351351
352352const tsan_sources = [_][]const u8{
353 "tsan_adaptive_delay.cpp",
353354 "tsan_debugging.cpp",
354355 "tsan_external.cpp",
355356 "tsan_fd.cpp",
src/libs/libunwind.zig+3
......@@ -124,6 +124,9 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
124124 if (!comp.config.any_non_single_threaded) {
125125 try cflags.append("-D_LIBUNWIND_HAS_NO_THREADS");
126126 }
127 if (target.os.tag == .haiku) {
128 try cflags.append("-D_LIBUNWIND_USE_HAIKU_BSD_LIB");
129 }
127130 if (target.cpu.arch.isArm() and target.abi.float() == .hard) {
128131 try cflags.append("-DCOMPILER_RT_ARMHF_TARGET");
129132 }
src/link/Dwarf.zig+3
......@@ -4189,6 +4189,9 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co
41894189 .riscv32_ilp32_v,
41904190 => .LLVM_RISCVVectorCall,
41914191
4192 .loongarch32_preserve_none => .LLVM_PreserveNone,
4193 .loongarch64_preserve_none => .LLVM_PreserveNone,
4194
41924195 .m68k_rtd => .LLVM_M68kRTD,
41934196
41944197 .sh_renesas => .GNU_renesas_sh,
src/link/Wasm.zig+3
......@@ -3238,6 +3238,7 @@ pub const Feature = packed struct(u8) {
32383238 @"tail-call",
32393239 @"shared-mem",
32403240 @"wide-arithmetic",
3241 @"relaxed-atomics",
32413242
32423243 pub fn fromCpuFeature(feature: std.Target.wasm.Feature) Tag {
32433244 return switch (feature) {
......@@ -3255,6 +3256,7 @@ pub const Feature = packed struct(u8) {
32553256 .nontrapping_bulk_memory_len0 => .@"nontrapping-bulk-memory-len0", // Zig extension.
32563257 .nontrapping_fptoint => .@"nontrapping-fptoint",
32573258 .reference_types => .@"reference-types",
3259 .relaxed_atomics => .@"relaxed-atomics",
32583260 .relaxed_simd => .@"relaxed-simd",
32593261 .sign_ext => .@"sign-ext",
32603262 .simd128 => .simd128,
......@@ -3280,6 +3282,7 @@ pub const Feature = packed struct(u8) {
32803282 .@"nontrapping-bulk-memory-len0" => .nontrapping_bulk_memory_len0, // Zig extension.
32813283 .@"nontrapping-fptoint" => .nontrapping_fptoint,
32823284 .@"reference-types" => .reference_types,
3285 .@"relaxed-atomics" => .relaxed_atomics,
32833286 .@"relaxed-simd" => .relaxed_simd,
32843287 .@"sign-ext" => .sign_ext,
32853288 .simd128 => .simd128,
src/target.zig+3
......@@ -423,6 +423,9 @@ pub fn hasDebugInfo(target: *const std.Target) bool {
423423 .ptx87,
424424 .ptx88,
425425 .ptx90,
426 .ptx91,
427 .ptx92,
428 .ptx93,
426429 }),
427430 .bpfel, .bpfeb => false,
428431 else => true,
src/zig_clang_cc1_main.cpp+14-21
......@@ -144,13 +144,13 @@ static int PrintSupportedExtensions(std::string TargetStr) {
144144 std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
145145 TheTarget->createTargetMachine(Triple, "", "", Options, std::nullopt));
146146 const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
147 const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
147 const llvm::MCSubtargetInfo &MCInfo = TheTargetMachine->getMCSubtargetInfo();
148148 const llvm::ArrayRef<llvm::SubtargetFeatureKV> Features =
149 MCInfo->getAllProcessorFeatures();
149 MCInfo.getAllProcessorFeatures();
150150
151151 llvm::StringMap<llvm::StringRef> DescMap;
152152 for (const llvm::SubtargetFeatureKV &feature : Features)
153 DescMap.insert({feature.Key, feature.Desc});
153 DescMap.insert({feature.key(), feature.desc()});
154154
155155 if (MachineTriple.isRISCV())
156156 llvm::RISCVISAInfo::printSupportedExtensions(DescMap);
......@@ -187,23 +187,23 @@ static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
187187 TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr,
188188 BackendOptions, std::nullopt));
189189 const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
190 const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
190 const llvm::MCSubtargetInfo &MCInfo = TheTargetMachine->getMCSubtargetInfo();
191191
192192 // Extract the feature names that are enabled for the given target.
193193 // We do that by capturing the key from the set of SubtargetFeatureKV entries
194194 // provided by MCSubtargetInfo, which match the '-target-feature' values.
195 const std::vector<llvm::SubtargetFeatureKV> Features =
196 MCInfo->getEnabledProcessorFeatures();
195 const std::vector<const llvm::SubtargetFeatureKV *> Features =
196 MCInfo.getEnabledProcessorFeatures();
197197 std::set<llvm::StringRef> EnabledFeatureNames;
198 for (const llvm::SubtargetFeatureKV &feature : Features)
199 EnabledFeatureNames.insert(feature.Key);
198 for (const llvm::SubtargetFeatureKV *feature : Features)
199 EnabledFeatureNames.insert(feature->key());
200200
201201 if (MachineTriple.isAArch64())
202202 llvm::AArch64::printEnabledExtensions(EnabledFeatureNames);
203203 else if (MachineTriple.isRISCV()) {
204204 llvm::StringMap<llvm::StringRef> DescMap;
205 for (const llvm::SubtargetFeatureKV &feature : Features)
206 DescMap.insert({feature.Key, feature.Desc});
205 for (const llvm::SubtargetFeatureKV *feature : Features)
206 DescMap.insert({feature->key(), feature->desc()});
207207 llvm::RISCVISAInfo::printEnabledExtensions(MachineTriple.isArch64Bit(),
208208 EnabledFeatureNames, DescMap);
209209 } else {
......@@ -289,20 +289,11 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
289289 static_cast<void*>(&Clang->getDiagnostics()));
290290
291291 DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
292 if (!Success) {
293 Clang->getDiagnosticClient().finish();
292 if (!Success)
294293 return 1;
295 }
296294
297295 // Execute the frontend actions.
298 {
299 llvm::TimeTraceScope TimeScope("ExecuteCompiler");
300 bool TimePasses = Clang->getCodeGenOpts().TimePasses;
301 if (TimePasses)
302 Clang->createFrontendTimer();
303 llvm::TimeRegion Timer(TimePasses ? &Clang->getFrontendTimer() : nullptr);
304 Success = ExecuteCompilerInvocation(Clang.get());
305 }
296 Success = ExecuteCompilerInvocation(Clang.get());
306297
307298 // If any timers were active but haven't been destroyed yet, print their
308299 // results now. This happens in -disable-free mode.
......@@ -339,6 +330,8 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
339330
340331 // When running with -disable-free, don't do any destruction or shutdown.
341332 if (Clang->getFrontendOpts().DisableFree) {
333 // DiagnosticConsumer must be always destroyed.
334 Clang->getDiagnosticClient().~DiagnosticConsumer();
342335 llvm::BuryPointer(std::move(Clang));
343336 return !Success;
344337 }
src/zig_clang_cc1as_main.cpp+12-4
......@@ -177,6 +177,8 @@ struct AssemblerInvocation {
177177 LLVM_PREFERRED_TYPE(bool)
178178 unsigned X86Sse2Avx : 1;
179179
180 RelocSectionSymType RelocSectionSym = RelocSectionSymType::All;
181
180182 /// The name of the relocation model to use.
181183 std::string RelocationModel;
182184
......@@ -387,6 +389,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
387389 llvm::StringSwitch<EmitDwarfUnwindType>(A->getValue())
388390 .Case("always", EmitDwarfUnwindType::Always)
389391 .Case("no-compact-unwind", EmitDwarfUnwindType::NoCompactUnwind)
392 .Case("dwarf-only", EmitDwarfUnwindType::DwarfOnly)
390393 .Case("default", EmitDwarfUnwindType::Default);
391394 }
392395
......@@ -394,6 +397,12 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
394397 Args.hasArg(OPT_femit_compact_unwind_non_canonical);
395398 Opts.EmitSFrameUnwind = Args.hasArg(OPT_gsframe);
396399 Opts.Crel = Args.hasArg(OPT_crel);
400 Opts.RelocSectionSym = RelocSectionSymType::All;
401 if (auto *A = Args.getLastArg(OPT_reloc_section_sym))
402 Opts.RelocSectionSym = StringSwitch<RelocSectionSymType>(A->getValue())
403 .Case("internal", RelocSectionSymType::Internal)
404 .Case("none", RelocSectionSymType::None)
405 .Default(RelocSectionSymType::All);
397406 Opts.ImplicitMapsyms = Args.hasArg(OPT_mmapsyms_implicit);
398407 Opts.X86RelaxRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
399408 Opts.X86Sse2Avx = Args.hasArg(OPT_msse2avx);
......@@ -461,6 +470,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
461470 MCOptions.EmitSFrameUnwind = Opts.EmitSFrameUnwind;
462471 MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels;
463472 MCOptions.Crel = Opts.Crel;
473 MCOptions.RelocSectionSym = Opts.RelocSectionSym;
464474 MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms;
465475 MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations;
466476 MCOptions.X86Sse2Avx = Opts.X86Sse2Avx;
......@@ -497,8 +507,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
497507 << Opts.CPU << FS.empty() << FS;
498508 }
499509
500 MCContext Ctx(Triple(Opts.Triple), MAI.get(), MRI.get(), STI.get(), &SrcMgr,
501 &MCOptions);
510 MCContext Ctx(Triple(Opts.Triple), *MAI, *MRI, *STI, &SrcMgr);
502511
503512 bool PIC = false;
504513 if (Opts.RelocationModel == "static") {
......@@ -617,9 +626,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
617626 std::unique_ptr<MCAsmParser> Parser(
618627 createMCAsmParser(SrcMgr, Ctx, *Str, *MAI));
619628
620 // FIXME: init MCTargetOptions from sanitizer flags here.
621629 std::unique_ptr<MCTargetAsmParser> TAP(
622 TheTarget->createMCAsmParser(*STI, *Parser, *MCII, MCOptions));
630 TheTarget->createMCAsmParser(*STI, *Parser, *MCII));
623631 if (!TAP)
624632 Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str();
625633
src/zig_clang_driver.cpp+37-8
......@@ -55,6 +55,10 @@
5555#include <optional>
5656#include <set>
5757#include <system_error>
58// zig patch: don't rely on LLVM_ON_UNIX that comes from the build system
59#if !defined(_WIN32)
60#include <signal.h>
61#endif
5862
5963using namespace clang;
6064using namespace clang::driver;
......@@ -223,6 +227,7 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
223227 return cc1_main(ArrayRef(ArgV).slice(1), ArgV[0], GetExecutablePathVP);
224228 if (Tool == "-cc1as")
225229 return cc1as_main(ArrayRef(ArgV).slice(2), ArgV[0], GetExecutablePathVP);
230 // zig patch: no -cc1gen-reproducer
226231 // Reject unknown tools.
227232 llvm::errs()
228233 << "error: unknown integrated tool '" << Tool << "'. "
......@@ -230,11 +235,13 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
230235 return 1;
231236}
232237
238// zig patch: use custom entry point
233239static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContext) {
234240 noteBottomOfStack();
235241 llvm::setBugReportMsg("PLEASE submit a bug report to " BUG_REPORT_URL
236 " and include the crash backtrace, preprocessed "
237 "source, and associated run script.\n");
242 " and include the crash backtrace and"
243 " dumped files.\n");
244 // zig patch: fix argv offset
238245 size_t argv_offset = (strcmp(Argv[1], "-cc1") == 0 || strcmp(Argv[1], "-cc1as") == 0) ? 0 : 1;
239246 SmallVector<const char *, 256> Args(Argv + argv_offset, Argv + Argc);
240247
......@@ -373,7 +380,8 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
373380 if (!UseNewCC1Process) {
374381 TheDriver.CC1Main = ExecuteCC1WithContext;
375382 // Ensure the CC1Command actually catches cc1 crashes
376 llvm::CrashRecoveryContext::Enable();
383 llvm::CrashRecoveryContext::Enable(
384 /*NeedsPOSIXUtilitySignalHandling=*/true);
377385 }
378386
379387 std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(Args));
......@@ -402,6 +410,7 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
402410 Driver::CommandStatus CommandStatus = Driver::CommandStatus::Ok;
403411 // Pretend the first command failed if ReproStatus is Always.
404412 const Command *FailingCommand = nullptr;
413 int CommandRes = 0;
405414 if (!C->getJobs().empty())
406415 FailingCommand = &*C->getJobs().begin();
407416 if (C && !C->containsError()) {
......@@ -409,7 +418,7 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
409418 Res = TheDriver.ExecuteCompilation(*C, FailingCommands);
410419
411420 for (const auto &P : FailingCommands) {
412 int CommandRes = P.first;
421 CommandRes = P.first;
413422 FailingCommand = P.second;
414423 if (!Res)
415424 Res = CommandRes;
......@@ -421,8 +430,8 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
421430 IsCrash = CommandRes < 0 || CommandRes == 70;
422431#ifdef _WIN32
423432 IsCrash |= CommandRes == 3;
424#endif
425#if LLVM_ON_UNIX
433// zig patch: don't rely on LLVM_ON_UNIX that comes from the build system
434#else
426435 // When running in integrated-cc1 mode, the CrashRecoveryContext returns
427436 // the same codes as if the program crashed. See section "Exit Status for
428437 // Commands":
......@@ -445,8 +454,6 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
445454 *C, *FailingCommand))
446455 Res = 1;
447456
448 Diags.getClient()->finish();
449
450457 if (!UseNewCC1Process && IsCrash) {
451458 // When crashing in -fintegrated-cc1 mode, bury the timer pointers, because
452459 // the internal linked list might point to already released stack frames.
......@@ -464,6 +471,28 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
464471 // propagated.
465472 if (Res < 0)
466473 Res = 1;
474// zig patch: don't rely on LLVM_ON_UNIX that comes from the build system
475#else
476 // On Unix, signals are represented by return codes of 128 plus the signal
477 // number. If the return code indicates it was from a signal handler, raise
478 // the signal so that the exit code includes the signal number, as required
479 // by POSIX. Return code 255 is excluded because some tools, such as
480 // llvm-ifs, exit with code 255 (-1) on failure.
481 if (CommandRes > 128 && CommandRes != 255) {
482 llvm::sys::unregisterHandlers();
483 // DiagnosticConsumer must be always destroyed.
484 Diags.getClient()->~DiagnosticConsumer();
485 raise(CommandRes - 128);
486 }
487 // When cc1 runs out-of-process (CLANG_SPAWN_CC1), ExecuteAndWait returns -2
488 // if the child was killed by a signal. The signal number is not preserved,
489 // so resignal with SIGABRT to ensure the driver exits via signal.
490 if (CommandRes == -2) {
491 llvm::sys::unregisterHandlers();
492 // DiagnosticConsumer must be always destroyed.
493 Diags.getClient()->~DiagnosticConsumer();
494 raise(SIGABRT);
495 }
467496#endif
468497
469498 // If we have multiple failing commands, we return the result of the first
src/zig_llvm-ar.cpp+33-8
......@@ -83,6 +83,7 @@ static void printArHelp(StringRef ToolName) {
8383 =darwin - darwin
8484 =bsd - bsd
8585 =bigarchive - big archive (AIX OS)
86 =zos - zos archive (z/OS OS)
8687 =coff - coff
8788 --plugin=<string> - ignored for compatibility
8889 -h --help - display this help and exit
......@@ -195,7 +196,16 @@ static SmallVector<const char *, 256> PositionalArgs;
195196static bool MRI;
196197
197198namespace {
198enum Format { Default, GNU, COFF, BSD, DARWIN, BIGARCHIVE, Unknown };
199enum Format {
200 Default,
201 GNU,
202 COFF,
203 BSD,
204 DARWIN,
205 BIGARCHIVE,
206 ZOSARCHIVE,
207 Unknown
208};
199209}
200210
201211static Format FormatType = Default;
......@@ -713,8 +723,11 @@ static void performReadOperation(ArchiveOperation Operation,
713723 });
714724 if (I == Members.end())
715725 continue;
716 if (CountParam && ++MemberCount[Name] != CountParam)
717 continue;
726 if (CountParam) {
727 std::string CountKey = normalizePath(*I);
728 if (++MemberCount[CountKey] != CountParam)
729 continue;
730 }
718731 Members.erase(I);
719732 }
720733
......@@ -854,14 +867,19 @@ static InsertAction computeInsertAction(ArchiveOperation Operation,
854867 if (Operation == QuickAppend || Members.empty())
855868 return IA_AddOldMember;
856869
857 auto MI = find_if(Members, [Name](StringRef Path) {
870 std::string CountKey;
871 auto MI = find_if(Members, [Name, &CountKey](StringRef Path) {
872 SmallString<128> MatchPath(Path);
858873 if (Thin && !sys::path::is_absolute(Path)) {
859874 Expected<std::string> PathOrErr =
860875 computeArchiveRelativePath(ArchiveName, Path);
861 return comparePaths(Name, PathOrErr ? *PathOrErr : Path);
862 } else {
863 return comparePaths(Name, Path);
876 if (PathOrErr)
877 MatchPath = *PathOrErr;
864878 }
879 if (!comparePaths(Name, MatchPath))
880 return false;
881 CountKey = normalizePath(MatchPath);
882 return true;
865883 });
866884
867885 if (MI == Members.end())
......@@ -870,7 +888,7 @@ static InsertAction computeInsertAction(ArchiveOperation Operation,
870888 Pos = MI;
871889
872890 if (Operation == Delete) {
873 if (CountParam && ++MemberCount[Name] != CountParam)
891 if (CountParam && ++MemberCount[CountKey] != CountParam)
874892 return IA_AddOldMember;
875893 return IA_Delete;
876894 }
......@@ -1071,6 +1089,11 @@ static void performWriteOperation(ArchiveOperation Operation,
10711089 fail("only the gnu format has a thin mode");
10721090 Kind = object::Archive::K_AIXBIG;
10731091 break;
1092 case ZOSARCHIVE:
1093 if (Thin)
1094 fail("only the gnu format has a thin mode");
1095 Kind = object::Archive::K_ZOS;
1096 break;
10741097 case Unknown:
10751098 llvm_unreachable("");
10761099 }
......@@ -1389,6 +1412,7 @@ static int ar_main(int argc, char **argv) {
13891412 .Case("bsd", BSD)
13901413 .Case("bigarchive", BIGARCHIVE)
13911414 .Case("coff", COFF)
1415 .Case("zos", ZOSARCHIVE)
13921416 .Default(Unknown);
13931417 if (FormatType == Unknown)
13941418 fail(std::string("Invalid format ") + Match);
......@@ -1509,6 +1533,7 @@ static int ranlib_main(int argc, char **argv) {
15091533 return 0;
15101534}
15111535
1536// zig patch: use custom entry point
15121537static int llvm_ar_main(int argc, char **argv, const llvm::ToolContext &) {
15131538 ToolName = argv[0];
15141539
src/zig_llvm.cpp+2-2
......@@ -285,7 +285,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
285285 PipelineTuningOptions pipeline_opts;
286286 pipeline_opts.LoopUnrolling = !options->is_debug;
287287 pipeline_opts.SLPVectorization = !options->is_debug;
288 pipeline_opts.LoopVectorization = false; // https://github.com/llvm/llvm-project/issues/186922
288 pipeline_opts.LoopVectorization = !options->is_debug;
289289 pipeline_opts.LoopInterleaving = !options->is_debug;
290290 pipeline_opts.MergeFunctions = !options->is_debug;
291291
......@@ -373,7 +373,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
373373 if (options->is_debug)
374374 opt_level = OptimizationLevel::O0;
375375 else if (options->is_small)
376 opt_level = OptimizationLevel::Oz;
376 opt_level = OptimizationLevel::O2;
377377 else
378378 opt_level = OptimizationLevel::O3;
379379
stage1/zig.h-25
......@@ -5874,27 +5874,12 @@ typedef __float128 zig_f128;
58745874#define zig_make_special_f128(sign, name, arg, repr) sign __builtin_##name##f128(arg)
58755875#else
58765876#undef zig_has_f128
5877#if defined(zig_x86_64) && defined(ZIG_TARGET_ABI_MSVC)
5878#if defined(zig_msvc) && !defined(__clang__)
5879#include <emmintrin.h>
5880typedef __m128i zig_f128;
5881#define zig_init_repr_f128(hi, lo) { .m128i_u64 = { lo, hi } }
5882#define zig_lo_repr_f128(arg) (arg).m128i_u64[0]
5883#define zig_hi_repr_f128(arg) (arg).m128i_u64[1]
5884#else
5885typedef __attribute__((__vector_size__(2 * sizeof(uint64_t)))) uint64_t zig_f128;
5886#define zig_init_repr_f128(hi, lo) { lo, hi }
5887#define zig_lo_repr_f128(arg) (arg)[0]
5888#define zig_hi_repr_f128(arg) (arg)[1]
5889#endif
5890#else
58915877typedef zig_u128 zig_f128;
58925878#define zig_init_repr_f128(hi, lo) zig_init_u128(hi, lo)
58935879#define zig_make_repr_f128(hi, lo) zig_make_u128(hi, lo)
58945880#define zig_lo_repr_f128(arg) zig_lo_u128(arg)
58955881#define zig_hi_repr_f128(arg) zig_hi_u128(arg)
58965882#endif
5897#endif
58985883#ifndef zig_has_f128
58995884#define zig_has_f128 0
59005885#define zig_make_f128(fp, repr) repr
......@@ -6182,16 +6167,6 @@ static inline zig_f128 zig_floatuntitf(zig_u128 arg) {
61826167 extern zig_f128 __floatuntitf(zig_f128 arg);
61836168 return __floatuntitf(zig_f128_bitCast_u128(arg));
61846169}
6185#elif defined(zig_x86_64) && defined(zig_windows)
6186zig_common_float_builtins(128)
6187static inline zig_f128 zig_floattitf(zig_i128 arg) {
6188 extern zig_f128 __floattitf(zig_i128 arg);
6189 return __floattitf(arg);
6190}
6191static inline zig_f128 zig_floatuntitf(zig_u128 arg) {
6192 extern zig_f128 __floatuntitf(uint64_t arg_lo, uint64_t arg_hi);
6193 return __floatuntitf(zig_lo_u128(arg), zig_hi_u128(arg));
6194}
61956170#else
61966171zig_float_builtins(128)
61976172#endif
test/behavior/floatop.zig-3
......@@ -234,7 +234,6 @@ test "vector cmp f32" {
234234 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isArm()) return error.SkipZigTest;
235235 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isAarch64() and builtin.os.tag == .netbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/36765
236236 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isAarch64() and builtin.os.tag == .netbsd) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/36765
237 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/214198
238237 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
239238
240239 try testCmpVector(f32);
......@@ -258,7 +257,6 @@ test "vector cmp f128" {
258257 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
259258 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
260259 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
261 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/214198
262260 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
263261
264262 try testCmpVector(f128);
......@@ -268,7 +266,6 @@ test "vector cmp f128" {
268266test "vector cmp f80/c_longdouble" {
269267 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
270268 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
271 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/214198
272269 if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
273270 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
274271
test/c_abi/cfuncs.c+1-1
......@@ -16624,7 +16624,7 @@ struct ByRef __attribute__((sysv_abi)) c_explict_sys_v(struct ByRef in) {
1662416624}
1662516625#endif
1662616626
16627#if defined __x86_64__ || defined __aarch64__
16627#if defined __x86_64__ || defined __aarch64__ || defined __loongarch__
1662816628int __attribute__((preserve_none)) c_preserve_none(int x) {
1662916629 return x + 1;
1663016630}
test/c_abi/main.zig+3
......@@ -18045,6 +18045,9 @@ const preserve_none_cc: ?std.lang.CallingConvention = if (builtin.zig_backend !=
1804518045else switch (builtin.cpu.arch) {
1804618046 .x86_64 => .{ .x86_64_preserve_none = .{} },
1804718047 .aarch64, .aarch64_be => .{ .aarch64_preserve_none = .{} },
18048 // Supported in LLVM but not yet wired up in Clang.
18049 // .loongarch32 => .{ .loongarch32_preserve_none = .{} },
18050 // .loongarch64 => .{ .loongarch64_preserve_none = .{} },
1804818051 else => null,
1804918052};
1805018053
test/libc.zig+4-4
......@@ -190,7 +190,7 @@ pub fn addCases(cases: *tests.LibcContext) void {
190190 cases.addLibcTestCase("math/exp2f.c", .{});
191191 cases.addLibcTestCase("math/exp2l.c", .{});
192192 cases.addLibcTestCase("math/expf.c", .{});
193 cases.addLibcTestCase("math/expl.c", .{});
193 // cases.addLibcTestCase("math/expl.c", .{});
194194 // cases.addLibcTestCase("math/expm1.c", .{});
195195 // cases.addLibcTestCase("math/expm1f.c", .{});
196196 // cases.addLibcTestCase("math/expm1l.c", .{});
......@@ -258,9 +258,9 @@ pub fn addCases(cases: *tests.LibcContext) void {
258258 cases.addLibcTestCase("math/log2.c", .{});
259259 cases.addLibcTestCase("math/log2f.c", .{});
260260 cases.addLibcTestCase("math/log2l.c", .{});
261 cases.addLibcTestCase("math/logb.c", .{});
262 cases.addLibcTestCase("math/logbf.c", .{});
263 cases.addLibcTestCase("math/logbl.c", .{});
261 // cases.addLibcTestCase("math/logb.c", .{});
262 // cases.addLibcTestCase("math/logbf.c", .{});
263 // cases.addLibcTestCase("math/logbl.c", .{});
264264 cases.addLibcTestCase("math/logf.c", .{});
265265 cases.addLibcTestCase("math/logl.c", .{});
266266 cases.addLibcTestCase("math/lrint.c", .{});
test/llvm_targets.zig+1
......@@ -231,6 +231,7 @@ const targets = [_]std.Target.Query{
231231 .{ .cpu_arch = .riscv64, .os_tag = .fuchsia, .abi = .none },
232232 .{ .cpu_arch = .riscv64, .os_tag = .haiku, .abi = .none },
233233 .{ .cpu_arch = .riscv64, .os_tag = .hermit, .abi = .none },
234 .{ .cpu_arch = .riscv64, .os_tag = .hurd, .abi = .gnu },
234235 .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .android },
235236 .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .gnu },
236237 .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .musl },
test/src/Libc.zig+3-2
......@@ -45,8 +45,9 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
4545 } else false;
4646 if (!want_debug) return;
4747
48 const triple_txt = target.query.zigTriple(libc.b.allocator) catch @panic("OOM");
49
4850 if (libc.options.test_target_filters.len > 0) {
49 const triple_txt = target.query.zigTriple(libc.b.allocator) catch @panic("OOM");
5051 for (libc.options.test_target_filters) |filter| {
5152 if (std.mem.find(u8, triple_txt, filter)) |_| break;
5253 } else return;
......@@ -75,7 +76,7 @@ pub fn addTarget(libc: *const Libc, target: std.Build.ResolvedTarget) void {
7576 });
7677
7778 for (libc.test_cases.items) |*test_case| {
78 const annotated_case_name = libc.b.fmt("run libc-test {s}", .{test_case.name});
79 const annotated_case_name = libc.b.fmt("run libc-test {s} ({s})", .{ test_case.name, triple_txt });
7980 for (libc.options.test_filters) |test_filter| {
8081 if (std.mem.find(u8, annotated_case_name, test_filter)) |_| break;
8182 } else if (libc.options.test_filters.len > 0) continue;
test/tests.zig+12-9
......@@ -2377,13 +2377,17 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
23772377 .@"16bit_mode",
23782378 .@"32bit_mode",
23792379 .@"64bit",
2380 .false_deps_bls,
2381 .false_deps_compress,
2382 .false_deps_expand,
23802383 .false_deps_getmant,
2381 .false_deps_lzcnt_tzcnt,
2384 .false_deps_lzcnt,
23822385 .false_deps_mulc,
23832386 .false_deps_mullq,
23842387 .false_deps_perm,
23852388 .false_deps_popcnt,
23862389 .false_deps_range,
2390 .false_deps_tzcnt,
23872391 .fast_11bytenop,
23882392 .fast_15bytenop,
23892393 .fast_7bytenop,
......@@ -2411,10 +2415,12 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
24112415 .prefer_legacy_setcc,
24122416 .prefer_mask_registers,
24132417 .prefer_movmsk_over_vtest,
2418 .prefer_ndd_mem,
24142419 .prefer_no_gather,
24152420 .prefer_no_scatter,
24162421 .slow_3ops_lea,
24172422 .slow_incdec,
2423 .slow_indirect_call,
24182424 .slow_lea,
24192425 .slow_pmaddwd,
24202426 .slow_pmulld,
......@@ -2426,10 +2432,13 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
24262432 }),
24272433 .aarch64, .aarch64_be => std.Target.aarch64.featureSet(&.{
24282434 .addr_lsl_slow_14,
2435 .align_cmp_csel_pairs,
24292436 .alu_lsl_fast,
24302437 .avoid_ldapur,
24312438 .disable_fast_inc_vl,
24322439 .exynos_cheap_as_move,
2440 .fast_ld1_single,
2441 .fixed_load_latency_4,
24332442 .fuse_address,
24342443 .fuse_addsub_2reg_const1,
24352444 .fuse_adrp_add,
......@@ -2438,7 +2447,9 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
24382447 .fuse_crypto_eor,
24392448 .fuse_csel,
24402449 .fuse_cset,
2450 .fuse_fcsel,
24412451 .fuse_literals,
2452 .has_limited_64bit_vector_mul_bandwidth,
24422453 .predictable_select_expensive,
24432454 .slow_misaligned_128store,
24442455 .slow_paired_128,
......@@ -2908,14 +2919,6 @@ fn addOneModuleTest(
29082919 });
29092920 these_tests.linkage = test_target.linkage;
29102921 these_tests.use_new_linker = test_target.new_linker;
2911 // https://codeberg.org/ziglang/zig/issues/31701
2912 if (!(mem.eql(u8, options.name, "compiler-rt") or mem.eql(u8, options.name, "libc"))) {
2913 if (options.no_builtin) these_tests.root_module.no_builtin = true;
2914 }
2915 // https://codeberg.org/ziglang/zig/issues/31702
2916 if (mem.eql(u8, options.name, "compiler-rt") or mem.eql(u8, options.name, "libc")) {
2917 these_tests.root_module.stack_protector = false;
2918 }
29192922 // https://github.com/llvm/llvm-project/issues/195561
29202923 if (target.cpu.arch.isPowerPC()) {
29212924 these_tests.root_module.stack_protector = false;
tools/macos-headers.c+1
......@@ -190,6 +190,7 @@
190190#include <libkern/OSTypes.h>
191191#include <MacTypes.h>
192192#include <os/lock.h>
193#include <os/os_sync_wait_on_address.h>
193194#include <simd/simd.h>
194195#include <xpc/xpc.h>
195196#include <CommonCrypto/CommonCrypto.h>
tools/update_clang_options.zig+1-1
......@@ -681,7 +681,7 @@ pub fn main(init: std.process.Init) !void {
681681 "--dump-json",
682682 try std.fmt.allocPrint(arena, "{s}/clang/include/clang/Options/Options.td", .{llvm_src_root}),
683683 try std.fmt.allocPrint(arena, "-I={s}/llvm/include", .{llvm_src_root}),
684 try std.fmt.allocPrint(arena, "-I={s}/clang/include/clang/Driver", .{llvm_src_root}),
684 try std.fmt.allocPrint(arena, "-I={s}/clang/include/clang/Options", .{llvm_src_root}),
685685 };
686686
687687 const child_result = try std.process.run(arena, io, .{
tools/update_cpu_features.zig+46-99
......@@ -131,6 +131,14 @@ const targets = [_]ArchTarget{
131131 .zig_name = "contextidr_el2",
132132 .desc = "Enable RW operand Context ID Register (EL2)",
133133 },
134 .{
135 .llvm_name = "hip12",
136 .flatten = true,
137 },
138 .{
139 .llvm_name = "mca-streaming-sched",
140 .omit = true,
141 },
134142 .{
135143 .llvm_name = "neoversee1",
136144 .flatten = true,
......@@ -1481,6 +1489,42 @@ const targets = [_]ArchTarget{
14811489 .omit = true,
14821490 },
14831491 },
1492 .extra_cpus = &.{
1493 .{
1494 .llvm_name = null,
1495 .zig_name = "cell",
1496 .features = &.{
1497 "64bit_support",
1498 "altivec",
1499 "fres",
1500 "frsqrte",
1501 "fsqrt",
1502 "mfocrf",
1503 "stfiwx",
1504 },
1505 },
1506 .{
1507 .llvm_name = null,
1508 .zig_name = "e500v2",
1509 .features = &.{
1510 "efpu2",
1511 "isel",
1512 "msync",
1513 },
1514 },
1515 .{
1516 .llvm_name = null,
1517 .zig_name = "e6500",
1518 .features = &.{
1519 "64bit_support",
1520 "altivec",
1521 "booke",
1522 "isel",
1523 "mfocrf",
1524 "stfiwx",
1525 },
1526 },
1527 },
14841528 .omit_cpus = &.{
14851529 "ppc32",
14861530 },
......@@ -1553,103 +1597,6 @@ const targets = [_]ArchTarget{
15531597 .zig_name = "baseline_rv64",
15541598 .features = &.{ "64bit", "a", "c", "d", "f", "i", "m" },
15551599 },
1556 .{
1557 .llvm_name = null,
1558 .zig_name = "spacemit_a100",
1559 .features = &.{
1560 "64bit",
1561 "a",
1562 "b",
1563 "c",
1564 "dlen_factor_2",
1565 "i",
1566 "m",
1567 "optimized_nf2_segment_load_store",
1568 "optimized_nf3_segment_load_store",
1569 "optimized_nf4_segment_load_store",
1570 "smepmp",
1571 "smnpm",
1572 "smstateen",
1573 "ssccptr",
1574 "sscofpmf",
1575 "sscounterenw",
1576 "ssnpm",
1577 "sspm",
1578 "sstc",
1579 "sstvala",
1580 "sstvecd",
1581 "ssu64xl",
1582 "supm",
1583 "svade",
1584 "svbare",
1585 "svinval",
1586 "svnapot",
1587 "svpbmt",
1588 "unaligned_scalar_mem",
1589 "v",
1590 "vxrm_pipeline_flush",
1591 "za64rs",
1592 "zawrs",
1593 "zbc",
1594 "zbkc",
1595 "zcb",
1596 "zcmop",
1597 "zfa",
1598 "zfh",
1599 "zic64b",
1600 "zicbom",
1601 "zicbop",
1602 "zicboz",
1603 "ziccamoa",
1604 "ziccif",
1605 "zicclsm",
1606 "ziccrse",
1607 "zicntr",
1608 "zicond",
1609 "zifencei",
1610 "zihintntl",
1611 "zihintpause",
1612 "zihpm",
1613 "zimop",
1614 "zkt",
1615 "zvbb",
1616 "zvfbfwma",
1617 "zvfh",
1618 "zvkng",
1619 "zvknha",
1620 "zvksc",
1621 "zvksg",
1622 "zvl1024b",
1623 },
1624 },
1625 .{
1626 .llvm_name = null,
1627 .zig_name = "spacemit_x100",
1628 .features = &.{
1629 "dlen_factor_2",
1630 "optimized_nf2_segment_load_store",
1631 "optimized_nf3_segment_load_store",
1632 "optimized_nf4_segment_load_store",
1633 "rva23s64",
1634 "smepmp",
1635 "smnpm",
1636 "smstateen",
1637 "sspm",
1638 "unaligned_scalar_mem",
1639 "vxrm_pipeline_flush",
1640 "xsmtvdot",
1641 "zbc",
1642 "zbkc",
1643 "zfh",
1644 "zvfbfwma",
1645 "zvfh",
1646 "zvkng",
1647 "zvknha",
1648 "zvksc",
1649 "zvksg",
1650 "zvl256b",
1651 },
1652 },
16531600 },
16541601 },
16551602 .{
......@@ -2450,7 +2397,7 @@ fn processOneTargetInner(io: Io, job: Job) !void {
24502397 for (all_features.items) |feature| {
24512398 if (feature.llvm_name) |llvm_name| {
24522399 try w.print(
2453 \\ result[@intFromEnum(Feature.{f})] = .{{
2400 \\ result[@backingInt(Feature.{f})] = .{{
24542401 \\ .llvm_name = "{f}",
24552402 \\ .description = "{f}",
24562403 \\ .dependencies = featureSet(&[_]Feature{{
......@@ -2463,7 +2410,7 @@ fn processOneTargetInner(io: Io, job: Job) !void {
24632410 );
24642411 } else {
24652412 try w.print(
2466 \\ result[@intFromEnum(Feature.{f})] = .{{
2413 \\ result[@backingInt(Feature.{f})] = .{{
24672414 \\ .llvm_name = null,
24682415 \\ .description = "{f}",
24692416 \\ .dependencies = featureSet(&[_]Feature{{